my goal is to call a function after background music ends in cocos2dx.
playing background music using this code
CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("shortSound.wav",false);
and need to call my Function
void GamePlay::gameLevelEnds()
when the background sound ends.
There are no direct interfaces to do in cocos2dx but you can just find the duration of sound file and run an action with delay of duration followed by callback function.