• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AudioUnitScheduleParameters with an AUTimePitch unit.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioUnitScheduleParameters with an AUTimePitch unit.


  • Subject: AudioUnitScheduleParameters with an AUTimePitch unit.
  • From: John Clayton <email@hidden>
  • Date: Fri, 10 Oct 2008 16:23:49 +0200

Hi All,

I'd like to ramp the playback rate of an AUTimePitch unit, I've read the docs and searched the examples + google, but still my rate change on the pitch unit doesn't seem to take effect when I call AudioUnitScheduleParameters.

I'm registering for render-notify like this:
	if(mPitchCallback || mPitchCallbackRefCon)
		XThrowIfError(AudioUnitAddRenderNotify(mPitchUnit,
					   mPitchCallback,
					   mPitchCallbackRefCon), "setting output render callback");

and in this callback, I have code like this:

- (double) rateValueForPercent:(double)pcnt {
	double rateValue = 	fabs(0.5 - pcnt);
	if(rateValue < 0.25)
		rateValue = 0.25;
	if(rateValue > 1.0)
		rateValue = 1.0;
	return rateValue;
}

notes: pcnt is the total percentage complete (always from 0 thru 1.0)

if(*ioActionFlags & kAudioUnitRenderAction_PreRender) {
// set the rate to fabs(0.5 - pcnt)
AudioUnit pitchUnit = [self pitchUnit];

AudioUnitParameterEvent inEvent;
memset(&inEvent, 0, sizeof(inEvent));

inEvent.scope = kAudioUnitScope_Output;
inEvent.element = 0;
inEvent.parameter = kTimePitchParam_Rate;
inEvent.eventType = kParameterEvent_Ramped;

// for this set of frames, what are the ramping values associated with the begin/end times?
double beginRateValue = [self rateValueForPercent:pcnt];
double endRateValue = [self rateValueForPercent:endPcnt];

inEvent.eventValues.ramp.startValue = beginRateValue;
inEvent.eventValues.ramp.endValue = endRateValue;
inEvent.eventValues.ramp.durationInFrames = inNumberFrames;
inEvent.eventValues.ramp.startBufferOffset = 0;

ComponentResult res = AudioUnitScheduleParameters(pitchUnit, &inEvent, 1);
if(res != 0)
printf("cant set up the scheduled param: %d\r\n", res);
}
}


No errors are printed to the console.

I hear audio being played back, but the pitch never changes - is the error obvious perhaps? Keen for any feedback / help, thanks.

Thanks--
John Clayton
Skype: johncclayton

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: AudioUnitScheduleParameters with an AUTimePitch unit.
      • From: William Stewart <email@hidden>
  • Prev by Date: Re: iPhone audio decompression
  • Next by Date: Re: CAClock and MIDI Clock
  • Previous by thread: Re: iPhone audio decompression
  • Next by thread: Re: AudioUnitScheduleParameters with an AUTimePitch unit.
  • Index(es):
    • Date
    • Thread