• 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
audiograph master fade
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
http://www.rsmrecords.com



 _______________________________________________
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

  • Prev by Date: AUGraph Teardown sequence
  • Next by Date: Re: AUGraph Teardown sequence
  • Previous by thread: RE: AUGraph Teardown sequence
  • Next by thread: audiograph 5ms fade
  • Index(es):
    • Date
    • Thread