I’m not an expert, but I think this method is not as “automagic" as you and I both assumed. I believe what you are really scheduling is sample accurate ramping of a parameter change that should be done in a render notification callback. You are responsible for keeping track of the incremental parameter values across frames.
So you need to add a render notification callback: AudioUnitAddRenderNotify(mixerUnit, MixerRenderProc, &mixerUnit/* Or whatever you need */); And the parameter event like this (for example): AudioUnitParameterEvent parameterEvent = { .scope = parameter.mScope, .element = parameter.mElement, .parameter = parameter.mParameterID, .eventType = kParameterEvent_Ramped, .eventValues.ramp.startBufferOffset = 0, .eventValues.ramp.durationInFrames = 0, .eventValues.ramp.startValue = 0.0, .eventValues.ramp.endValue = 0.01 }; And this callback that would continually ramp from from a volume of 0.0 to 1.0: OSStatus MixerRenderProc(void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags, const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList* ioData) { AudioUnit* mixerUnit = (AudioUnit*)inRefCon; if ((*ioActionFlags & kAudioUnitRenderAction_PreRender) == kAudioUnitRenderAction_PreRender) { parameterEvent.eventValues.ramp.startBufferOffset = 0; parameterEvent.eventValues.ramp.durationInFrames = inNumberFrames; CheckError(AudioUnitScheduleParameters(*mixerUnit, ¶meterEvent, 1), "ramped volume parameter could not be scheduled"); if (parameterEvent.eventValues.ramp.endValue >= 1.0) { parameterEvent.eventValues.ramp.startValue = 0.0; parameterEvent.eventValues.ramp.endValue = 0.01; } else { parameterEvent.eventValues.ramp.startValue += 0.01; parameterEvent.eventValues.ramp.endValue += 0.01; } } return noErr; } If this is not how this is intended to work I hope someone else answers, because I would also like to better understand. - Matt Grippaldi > On Jul 22, 2016, at 3:17 AM, Benjamin Federer <benja...@boinx.com> wrote: > > Hello everyone > > I am trying to ramp the input volume for one of the input busses of a stereo > mixer unit (part of an AUGraph). Although I don’t get any errors when running > my code, nothing happens at all, i.e. no audible volume changes occur. I am > unsure what I am missing. Or could it be that the parameter just cannot be > ramped at all – although it reports otherwise? > > This is what I got so far: > > > AudioUnitParameter parameter = { > .mAudioUnit = mixerUnit, > .mParameterID = kStereoMixerParam_Volume, > .mScope = kAudioUnitScope_Input, > .mElement = busNumber > }; > > AudioUnitParameterInfo parameterInfo = {}; > UInt32 parameterInfoSize = sizeof(AudioUnitParameterInfo); > error = AudioUnitGetProperty(parameter.mAudioUnit, > kAudioUnitProperty_ParameterInfo, parameter.mScope, parameter.mParameterID, > ¶meterInfo, ¶meterInfoSize); > if (error) > { > return error; > } > > AudioUnitParameterOptions parameterOptions = parameterInfo.flags; > if ((parameterOptions & kAudioUnitParameterFlag_CanRamp) != > kAudioUnitParameterFlag_CanRamp) > { > // parameter cannot be ramped- > return paramErr; > } > > AudioUnitParameterEvent parameterEvent = { > .scope = parameter.mScope, > .element = parameter.mElement, > .parameter = parameter.mParameterID, > .eventType = kParameterEvent_Ramped, > .eventValues.ramp.startBufferOffset = 0, > .eventValues.ramp.durationInFrames = durationInFrames, > .eventValues.ramp.startValue = startValue, > .eventValues.ramp.endValue = endValue > }; > > error = AudioUnitScheduleParameters(parameter.mAudioUnit, ¶meterEvent, 1); > > > Thanks for any help in advance > > Benjamin > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Coreaudio-api mailing list (Coreaudio-api@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/coreaudio-api/mattg%40kinematicsystems.com > > This email sent to ma...@kinematicsystems.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (Coreaudio-api@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to arch...@mail-archive.com