audiograph master fade
audiograph master fade
- Subject: audiograph master fade
- From: Robert Carroll <email@hidden>
- Date: Fri, 03 Jan 2014 10:16:14 -0500
Is there an optimal way to fade out an audiograph's output in real time?
currently, I'm setting an NSTimer and scaling the mixerAU's output bus volume in 100 steps over approx. 5ms.
fadeDelta = playbackVolume * .01; fadeCount = 0; // Set a timer running that will update our output volume // in real time, 5ms, 100 steps fadeTimer = [NSTimer scheduledTimerWithTimeInterval:0.0005 target:self selector:@selector(masterFade) userInfo:nil repeat
-(void) masterFade { //5ms fade out, 100 steps if (fadeCount < 101) { fadeOutVolume = (float)playbackVolume - (fadeCount * fadeDelta); [self setMixerOutputGain:fadeOutVolume]; fadeCount ++; } else { OSStatus result = AUGraphStop(processingGraph); if (noErr != result) {[self printErrorMessage: @"AUGraphStop failed" withStatus: result]; return;} [fadeTimer invalidate]; fadeTimer = nil; [self setMixerOutputGain:playbackVolume]; } }
This is working, but seems to have some performance overhead problems. Plus, it does not guarantee that another process won't interrupt the NSTimer. The power curve of the resulting fade and the zippering from the 100 steps are adequate for the application as it is.
thanks,
Robert Carroll RSM Records Toronto
|
_______________________________________________
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