cocos2dx v3.2 sound stop

I want to stop in two seconds after me.I tried as follows.

-(void)start
{
 SimpleAudioEngine::getInstance()->setEffectsVolume(0.5);
 SimpleAudioEngine::getInstance()->preloadEffect(“r.mp3.mp3”);
 SimpleAudioEngine::getInstance()->playEffect(“r.mp3.mp3”,true);
 int soundIDone = SimpleAudioEngine::getInstance()->playEffect(“r.mp3.mp3”);

this->scheduleOnce(schedule_selector(GameScene::stop), 2);
}

-(void)stop(float dt)
{
 SimpleAudioEngine::getInstance()->stopEffect(true);
}

Please tell me how to stop after 2 seconds.

I think in you stop function you want

SimpleAudioEngine::getInstance()->stopEffect(soundIDone);

But soundIDone would need to be a member variable of the scene or class. It needs to be saved and not overwritten so you can use it later to stop the effect.