#import <OscgUG.h>
Public Member Functions | |
(id) | - setInc: |
Sets increment as an integer as specified. | |
(id) | - setFreq: |
Sets oscillator frequency in Hz. | |
(id) | - setAmp: |
Sets amplitude as specifed. | |
(id) | - setPhase: |
Sets oscillator phase in degrees. | |
(id) | - runSelf |
You never send this message. | |
(id) | - idleSelf |
You never send this message. | |
(id) | - setOutput: |
Set output patchPoint of the oscillator. | |
(id) | - setTable:length: |
Sets the lookup table of the oscillator. | |
(id) | - setTable: |
Like setTable:length:, but uses a default length. | |
(id) | - setTableToSineROM |
Sets the lookup table to the DSP sine ROM, if address space is Y. | |
(id) | - setTable:length:defaultToSineROM: |
This method is provided as a convenience. | |
(id) | - setTable:defaultToSineROM: |
Like setTable:length:defaultToSineROM:, but uses a default length. | |
(unsigned) | - tableLength |
Returns the length of the assigned table or 0 if no table is assigned. | |
Static Public Member Functions | |
(BOOL) | + shouldOptimize: |
Specifies that all arguments are to be optimized if possible except the phase. |
This is a non-interpolating oscillator. That means that its fidelity depends on the size of the table (larger tables have lower distortion) and the highest frequency represented in the table. For high-quality synthesis, an interpolating oscillator, such as OscgafiUG is preferable. However, an interpolating oscillator is also more expensive, in terms of DSP cycles. OscgUG is useful in cases where density of texture is more important than fidelity of individual sounds.
Restrictions: The wavetable length must be a power of 2. The wavetable increment must be nonnegative.
OscgUGab a output b table space
+ (BOOL) shouldOptimize: | (unsigned) | arg |
Specifies that all arguments are to be optimized if possible except the phase.
arg | is an unsigned. |
Reimplemented from MKUnitGenerator.
- (id) setFreq: | (double) | aFreq |
Sets oscillator frequency in Hz.
aFreq | is a double. |
- (id) setAmp: | (double) | aAmp |
Sets amplitude as specifed.
aAmp | is a double. |
- (id) setPhase: | (double) | aPhase |
Sets oscillator phase in degrees.
aPhase | is a double. |
- (id) runSelf |
You never send this message.
Reimplemented from MKUnitGenerator.
- (id) idleSelf |
You never send this message.
Reimplemented from MKUnitGenerator.
- (id) setOutput: | (id) | aPatchPoint |
Set output patchPoint of the oscillator.
aPatchPoint | is an id. |
- (id) setTable: | (id) | anObj | ||
length: | (int) | aLength | ||
Sets the lookup table of the oscillator.
anObj can be a MKSynthData object or a MKWaveTable (MKPartials or MKSamples).
This method first releases its claim on the locally-allocated MKSynthData, if any. (see below). Then, if anObj is a MKSynthData object, the SynthData object is used directly. If anObj is a MKWaveTable, the receiver first searches in its MKOrchestra's shared object table to see if there is already an existing MKSynthData based on the same MKWaveTable, of the same length, and in the required memory space. Otherwise, a local MKSynthData object is created and installed in the shared object table so that other unit generators running simultaneously may share it. If the requested size is too large, because there is not sufficient DSP memory, smaller sizes are tried. You can determine what size was used by sending the tableLength message. If anObj is nil, this method simply releases the locally-allocated MKSynthData, if any.
Note that altering the contents of a MKWaveTable will have no effect once it has been installed, even if you call setTable:length: again after modifying the MKWaveTable. The reason is that the MKOrchestra's shared data mechanism finds the requested object based on its id, rather than its contents.
You should not free MKWaveTables used as arguments to OscgUG until the performance is over.
If the table is not a power of 2, returns nil and generates the error MK_ugsPowerOf2Err.
anObj | is an id. | |
aLength | is an int. |
- (id) setTable: | (id) | anObj |
Like setTable:length:, but uses a default length.
anObj | is an id. |
- (id) setTableToSineROM |
Sets the lookup table to the DSP sine ROM, if address space is Y.
- (id) setTable: | (id) | anObj | ||
length: | (int) | aLength | ||
defaultToSineROM: | (BOOL) | yesOrNo | ||
This method is provided as a convenience.
anObj | is an id. | |
aLength | is an int. | |
yesOrNo | is a BOOL. |
A common use of this method is to pass YES as the argument yesOrNo only if the MKSynthPatch is beginning a new phrase (the assumtion is that it is better to keep the old wavetable than to use the sine ROM in this case). Another use of this method is to specifically request the sine ROM by passing nil as anObj. If the sine ROM is used, the aLength argument is ignored.
If anObj is not nil and the sine ROM is used, generates the error MK_spsSineROMSubstitutionErr. If yesOrNo is YES but the receiver's table memory space is X, the error MK_spsCantGetMemoryErr is generated.
- (id) setTable: | (id) | anObj | ||
defaultToSineROM: | (BOOL) | yesOrNo | ||
Like setTable:length:defaultToSineROM:, but uses a default length.
anObj | is an id. | |
yesOrNo | is a BOOL. |
- (unsigned) tableLength |
Returns the length of the assigned table or 0 if no table is assigned.