A bunch of noob questions

edited June 2013

I'm in the process of migrating an AVAudioPlayer-based app to TAAE. It's a sampler. No audiobus yet. I got it to work, but there are a few things that aren't perfect yet:

1) When I create an AEAudioController (which is set to allow mixing audio with other apps) and -start it, the audio currently playing from the Music app stops for about a second (this does not happen if I skip the controller creation or the -start). Is there a way around this? This ONLY happens if I set inputEnabled to YES.

self.audioController = [[AEAudioController alloc]

2) So these 20 AEAudioFilePlayers are loaded but all have a "channelIsPlaying" of NO initially. When the user taps on a pad, I set "channelIsPlaying" to YES for the corresponding channel. The first time this happens, for each channel, I experience a fast volume fade-in, but it's long enough to ruin e.g. a bass drum sample. Every subsequent play of that same channel works as expected (no fade-in). Setting the volume to 1 on players doesn't help. How do I turn this fade-in off? I can upload a recording of this if needed.

3) When the user taps on a pad, wether the corresponding channel is playing or not, I re-trigger the sample by setting
player.currentTime = 0;
player.channelIsPlaying = YES;
with the intent of having it play again from the beginning. This however doesn't seem to work if the tap happens around the time the sample stops playing on its own - what I hear is the sample playing from the beginning for a very, very short time and then stopping. It works reliably if I re-trigger it a bit before it ends or a bit after it ends. I'm not doing anything to the players or the controller in a player's "completionBlock". Any ideas what might cause this?

4) I'm currently using the main thread for all operations, like creating a controller, starting it, creating channels and setting properties on channels. Is this recommended? Can I use a background thread for any of this?

I hope someone had the patience to read all of this!

P.s. all of the above happens with a week-old download of TAAE from GitHub. I'll definitely try to keep updating and seeing if any of the above gets resolved.


  • Update: I answered one of my questions (yes, AEAudioFilePlayer loads the sample in memory) and gained more insight on another.

  • Some answers:

    1) That's to be expected, only create a controller with inputEnabled if you need input.

    2) I ended up patching -configureChannelsInRange:forGroup: to always set kMultiChannelMixerParam_Enable to YES, that way the microfade happens when the channel is added to the controller instead of when it starts playing for the first time. In my case the channels aren't playing when they are added, so this fixes it for me. There might be a more elegant solution, like maybe adding a -(BOOL)shouldStartEnabled optional method on the AEAudioPlayable protocol which governs this behavior. If anyone's interested I can send a PR.

    4) Running TAAE entirely on a background thread is NOT recommended and is in fact a bad idea. However, you can freely call [AEAudioFilePlayer audioFilePlayerWithURL:…] on a background thread so loading samples won't block the main thread (thanks Micheal for this one!).

    Still banging my head on 3). I think it happens if I set player.currentTime = 0; player.channelIsPlaying = YES; while the renderCallback of that AEAudioFilePlayer is running for the last time. Any suggestions on that one greatly appreciated.

Sign In or Register to comment.