I need to play a sound file automaticly when my application starts, when I put 'iAudioAdapter->PlayL();' in the constructor it gives a CMdaAudioPlayerU 1 panic when the appliction starts. Where sould I call playL()?
Here is what I did:
1- I tryed in the appliction UI constructor:
you basically need to check that the file was opened without errors before playing it. So safest place would be to play it in the callback function, or have boolean variable indicating (that is set in call back) if the player is ready to play,, so you could play it on other places as well.
I checked that the file is working correctlly, if I put the same iPlayerAdapter->PlayL() to be played when selecting an option it worked and the sound is being played. Where can I call PlayL() to be run automaically when the application starts? Can you give me any idea with sample code?
I'm a bit sure it is race condition. So you need really to have some sort of identification process, where you know to play the sound only after it is succesfully opened. One way would be to put the view activation code to the call back of the audio player.