I'm trying to get/set the rate of an AudioUnit with subtype 
`kAudioUnitSubType_NewTimePitch`.

The audio unit is added to an `AUGraph`, through an `AUNode`, which has the 
following component description:

    acd->componentType = kAudioUnitType_Effect;
    acd->componentSubType = kAudioUnitSubType_NewTimePitch;
    acd->componentManufacturer = kAudioUnitManufacturer_Apple;

According to `AudioUnitParameters.h`, get/set the rate should be as simple as 
get/set the rate parameter on the audio unit.

    // rate control.
        // Global, rate, 1/32 -> 32.0, 1.0
        kNewTimePitchParam_Rate                                                 
= 0,

However, while setting the value seems no problem (no error is returned) 
getting the value yields a `OSStatus` with value `-10878 
(kAudioUnitErr_InvalidParameter)`.

Here is how I set the value :

    - (void)setTempo:(float)value {
        OSStatus err = noErr;
        err = AudioUnitSetParameter(tempoUnit, kNewTimePitchParam_Rate, 
kAudioUnitScope_Global, 0, (Float32)value, 0);
        if (err != noErr) {
            NSLog(@"Could not set tempo unit rate: %d", err);
        } // no error
    }

and how I (try to) get it :

    - (float)tempo {
        OSStatus err = noErr;
        Float32 value = 1.0;
        err = AudioUnitGetParameter(tempoUnit, kNewTimePitchParam_Rate, 
kAudioUnitScope_Global, 0, &value);
        if (err != noErr) {  // -10878
            NSLog(@"Could not get tempo unit rate: %d", err);
        }
        return value;
    }

The input of the node is connected to a mixer node, and the output to the 
RemoteIO unit.

Any ideas ?
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to