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 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
我快速检查了 SoundManager 代码,发现“PlaySound”函数调用了 FMOD 的“playSound”函数。在FMOD中“playSound”不是一个阻塞操作,它将在另一个线程中开始播放声音,然后返回。因此,由于您立即删除声音管理器,因此它还没有机会播放任何内容。
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.
我相信 SoundManager 需要更新,这是由
frameStarted()
完成的。这意味着要开始播放声音,您必须使用root->startRendering();
开始运行 Ogre 应用程序。你尝试过吗?上面的代码要么不完整(在这种情况下你确实有问题),要么你只需要通过启动图形渲染来启动 SoundManager 的更新,从而调用 SoundManager 的frameStarted。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 usingroot->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.