Search code examples
c++ogre3dfmodogre

problem with Fmod wrapper (soundManager) for Ogre3d


I have a problem with Soundmanager (class) (wrapper) for fmod in ogre3d engine. Here is the code just in case :

ISoundManager.h If somebody wants I will upload it but I can't upload more than 2 hyperlinks now.

SoundManager.h http://codeviewer.org/view/code:18c9

SoundManager.cpp http://codeviewer.org/view/code:18ca

I have a simple code piece to play the sound :

`   SoundManager *soundManagerPtr = new SoundManager;

    soundManagerPtr->Initialize();

    int mySound1 = soundManagerPtr->CreateStream(Ogre::String("boing.wav") );
    int channel1 = 0;

    soundManagerPtr->PlaySound(mySound1, headNode, &channel1);

    delete soundManagerPtr;`

Everything is fine, sound is loading, but PlaySound() function does not throw any error and does not play the sound either. I was asking on the ogre3d forum but no solution yet.


Solution

  • I believe the SoundManager needs to get updated and this is done by frameStarted(). This means for your sound to start playing you have to start running your Ogre application using root->startRendering();. Have you tried that? The above code is either incomplete (in which case you really do have a problem) or you just have to get the update of the SoundManager started off by starting the graphics to render and thus call frameStarted of SoundManager.