• 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
Does kAudioUnitProperty_BypassEffect work once and never again?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Does kAudioUnitProperty_BypassEffect work once and never again?


  • Subject: Does kAudioUnitProperty_BypassEffect work once and never again?
  • From: Chris Adamson <email@hidden>
  • Date: Tue, 08 Nov 2011 12:12:51 -0500

I've got an AUGraph demo with three units (AURemoteIO bus 1, AUSampler, and AUFilePlayer) going into a mixer and then through a chain of effects before going to  the AURemoteIO bus 0 for output to h/w.

A UISwitch lets you set the kAudioUnitProperty_BypassEffect on the effect units.

All the effects default to non-bypass (ie, the effect is active).  When I bypass the effect, I stop hearing the distortion or whatever, and that's great.  But when I set kAudioUnitProperty_BypassEffect back to 0, the effect stops processing sound and the app goes quiet.  And when I bypass again, the sound goes through (w/out the effect, naturally).  So what I have is an effect that works so long as I never bypass it.

In other words, by state, with just the distortion effect:
   0 (default): Switch ON, bypass off, sound distorted
   1: Switch OFF, bypass on, sound non-distorted
   2: Switch ON, bypass off, no sound
   3: Switch OFF, bypass on, sound non-distorted
   [repeat states 2 and 3]

Is there some other cleanup I have to do after setting BypassEffect?  Trying AudioUnitReset didn't do anything.

Here's the relevant code:

-(IBAction)handleEffectEnabledSwitchValueChange:(id)sender {
   UInt32 bypassed = self.effectEnabledSwitch.on ? 0 : 1;
   NSLog (@"setting bypassed to %ld", bypassed);
   CheckError(AudioUnitSetProperty (self.audioUnit,
                            kAudioUnitProperty_BypassEffect,
                            kAudioUnitScope_Global,
                            0,
                            &bypassed,
                            sizeof(bypassed)),
            "Couldn't set bypassed status");
//   does noting
//   CheckError(AudioUnitReset(self.audioUnit, kAudioUnitScope_Global, 0),
//            "Couldn't reset audio unit");
   
}

("CheckError" is the same function as in the Core Audio book: check the return against noErr, pretty print and exit if there's an error)

I can put my project on my Dropbox if anyone wants to look… this is for my Core Audio talk at VTM:iOS next weekend in Boston, so I'll eventually be putting the finished version there in any case (i.e., don't ask me to post the buggy version now just because you don't think you'll never get it otherwise)

--Chris

 _______________________________________________
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: Does kAudioUnitProperty_BypassEffect work once and never again?
      • From: tahome izwah <email@hidden>
  • Prev by Date: AUGraph with own render thread
  • Next by Date: Re: NSTimer and trackpad and mouse clicks
  • Previous by thread: Re: AUGraph with own render thread
  • Next by thread: Re: Does kAudioUnitProperty_BypassEffect work once and never again?
  • Index(es):
    • Date
    • Thread