Hello,
This read might help: http://wiki.sparrow-framework.org/manual/audio_playback.
You only need to retain the sound channel if you want to access it outside of the scope of the method/run loop.
For instance, this is the proper way to use the sound channel when you only need to access it in the same method:
SPSound *sound = [SPSound soundWithContentsOfFile:@"sound.caf"];
SPSoundChannel *channel = [sound createChannel];
[channel play];
If you want to access the sound channel outside of the method, you need to retain it and release it when you are done with it, like this:
- (void)loadSound {
SPSound *sound = [SPSound soundWithContentsOfFile:@"sound.caf"];
mSoundChannel = [[sound createChannel] retain];
}
- (void)playSound {
[mSoundChannel play];
}
- (void)dealloc {
[mSoundChannel release];
[super dealloc];
}
mSoundChannel would be an instance variable declared in the interface.
I assume you are getting EXC_BAD_ACCESS because you are releasing the wrong object. Just a warning, never NSLog an object that has a retainCount of 0 or you will get a crash.