Search code examples
cocos2d-iphoneeffectsimpleaudioengine

How to stopEffect in Cocos2d via ALuint?


Where is the soundId in Cocos2d?

I understand that it is returned from somewhere, but how do you capture this value or where it is?

I am trying to stop an effect using:

[[SimpleAudioEngine sharedEngine] stopEffect:<#(ALuint)#>];

But, I do not know where to get the soundId for said effect.

Any help is greatly appreciated.

Thanks.


Solution

  • The ALuint is returned from playEffect:

    ALuint effect = [[SimpleAudioEngine sharedEngine] playEffect:@"effect.caf"];
    [[SimpleAudioEngine sharedEngine] stopEffect:effect];