I'm having an odd problem playing audio with BASS. I decode and play an AAC music stream, with a tempo-shifting effect added onto it. This works fine until I play another audio clip on top of it. The audio clip plays correctly over top of the music, BUT once the clip is finished, the background music will only play when I'm playing an additional clip. The music stops whenever I'm not playing an audio clip, and resumes (flawlessly!) during the next clip played.
This is how I'm playing audio:
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
if (error) {
// do stuff
}
player.delegate = self;
if (![player prepareToPlay]) {
// do stuff
}
[player play];
And this is how I'm setting up BASS:
BASS_Init(-1, 22050, 0, 0, 0));
appMusicChannel = BASS_StreamCreateFile(NO, [currentTrack.filename cStringUsingEncoding:NSUTF8StringEncoding], 0, 0, BASS_STREAM_DECODE);
playbackEndSync = BASS_ChannelSetSync(appMusicChannel, BASS_SYNC_END, 0, bassPlaybackEndSynProc, nil);
appMusicChannel = BASS_FX_TempoCreate(appMusicChannel, BASS_FX_FREESOURCE);
if (!BASS_ChannelPlay(appMusicChannel, NO)) {
printf("Could not play BASS channel. BASS error code: %i\n", BASS_ErrorGetCode());
}
I suspect there might be something in the run loop or the avaudiosession that I'm getting a little messed up, but I'm unsure what it might be. The app can do other things in the background without causing problems, but once I run an avaudioplayer instance I get this weird behavior.