6

With the comming of Audio Unit v3, the main class we subclass is new AUAudioUnit objective C class.

The AUAudioUnit has AUParameter implementation and is easy to work with AUParameter via AUAudioUnit.parameterTree property.

I am unable to use Audio Unit properties as AUAudioUnit do not exposes its AudioUnit property that is required as parameter

extern OSStatus
AudioUnitGetProperty(           AudioUnit               inUnit,
                                AudioUnitPropertyID     inID,
                                AudioUnitScope          inScope,
                                AudioUnitElement        inElement,
                                void *                  outData,
                                UInt32 *                ioDataSize) 

Currently there is no AudioUnit class property or inspection on AUAudioUnit. I am not sure how to use AudioUnit properties in AudioUnit v3 framework.

Anybody has any clue how to use AudioUnit properties in new API v3?

Thank you.

Jan Kubny
  • 303
  • 1
  • 8

1 Answers1

-2

There's an example of how to do it in Apple's AudioUnitV3Example. Here's the code from that:

// Create a parameter object for the cutoff frequency.
    AUParameter *cutoffParam = [AUParameterTree createParameterWithIdentifier:@"cutoff" name:@"Cutoff"
            address:FilterParamCutoff
            min:12.0 max:20000.0 unit:kAudioUnitParameterUnit_Hertz unitName:nil
            flags: kAudioUnitParameterFlag_IsReadable |
                   kAudioUnitParameterFlag_IsWritable |
                   kAudioUnitParameterFlag_CanRamp
            valueStrings:nil dependentParameters:nil];

  // Initialize default parameter values.
    cutoffParam.value = 20000.0;
    resonanceParam.value = 0.0;
    _kernel.setParameter(FilterParamCutoff, cutoffParam.value);
    _kernel.setParameter(FilterParamResonance, resonanceParam.value);

  // Create the parameter tree.
    _parameterTree = [AUParameterTree createTreeWithChildren:@[cutoffParam, resonanceParam]];

(I omitted the code for resonanceParam)

There's also a great tutorial here that covers it: https://audiokitpro.com/auv3-midi-tutorial-part2/