开发者

problem with Fmod wrapper (soundManager) for Ogre3d [closed]

开发者 https://www.devze.com 2023-02-20 06:30 出处:网络
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code nece
Closed. This question needs debugging details. It is not currently accepting answers.

Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.

Closed 5 years ago.

Improve this question

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.


I quickly checked the SoundManager code, and it appears the "PlaySound" function calls through to FMODs "playSound" function. In FMOD "playSound" is not a blocking operation, it will start playing the sound in another thread, then return. So since you are deleting the sound manager right away, it hasn't had a chance to play anything yet.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号