Here's a quick code sample. The trick is to store the channel as a member variable of the class.
@implementation Game
{
SPSoundChannel *_soundChannel;
}
- (id)init
{
if ((self = [super init]))
{
SPSound *sound = [SPSound soundWithContentsOfFile:@"click.caf"];
_soundChannel = [sound createChannel];
_sound.volume = 0.6f;
}
return self;
}
- (void)playSound
{
[_soundChannel play];
}
@end
Alternatively, if you need to play the sound several times simultaneously, you can also store the "SPSound" as a member variable, and use its "play" method. That will create a channel and keep it alive as long as necessary.
Have a look at the sound scene in the Sparrow demo for more sample code.
I hope that helps!