FMOD - 同时播放多个声音?
我正在尝试设置我的声音管理器(FMOD)以在不同通道上播放背景音乐和其他动作声音,因为我知道这是使用 FMOD 同时发出声音的唯一方法......我的设置如下,如果我调用 playRepeat
,然后 playOnce
第一个曲目停止!
void SoundMgr::addSound(char *path, string n){
Sound* s;
fmodsys->createSound(path, FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &s);
soundMap.insert(pair<string,Sound*>(n, s));
}
void SoundMgr::playOnce(string name){
fmodsys->playSound(FMOD_CHANNEL_FREE,
soundMap.find(name)->second, true, &fmodchn);
fmodchn->setPosition(0, FMOD_TIMEUNIT_PCM);
fmodchn->setPaused(false);
}
void SoundMgr::playRepeat(string name){
fmodsys->playSound(FMOD_CHANNEL_FREE,
soundMap.find(name)->second, true, &backChn);
backChn->setMode(FMOD_LOOP_NORMAL);
backChn->setPosition(0, FMOD_TIMEUNIT_PCM);
backChn->setPaused(false);
}
...尽管我使用两个独立的频道...我是否遗漏了一些东西?
I am trying to set up my Sound Manager (FMOD) to play a background music and other action sounds on different channels, as I understand that this is the only way of having simultaneous sounds with FMOD.... My setup is below, if I call playRepeat
and then playOnce
the first track stops!
void SoundMgr::addSound(char *path, string n){
Sound* s;
fmodsys->createSound(path, FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &s);
soundMap.insert(pair<string,Sound*>(n, s));
}
void SoundMgr::playOnce(string name){
fmodsys->playSound(FMOD_CHANNEL_FREE,
soundMap.find(name)->second, true, &fmodchn);
fmodchn->setPosition(0, FMOD_TIMEUNIT_PCM);
fmodchn->setPaused(false);
}
void SoundMgr::playRepeat(string name){
fmodsys->playSound(FMOD_CHANNEL_FREE,
soundMap.find(name)->second, true, &backChn);
backChn->setMode(FMOD_LOOP_NORMAL);
backChn->setPosition(0, FMOD_TIMEUNIT_PCM);
backChn->setPaused(false);
}
...despite the fact that I AM using two separate channels.... am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是我只用一个通道初始化 FMOD,
将其更改为更高的数字使上述设置可以正常工作!
The issue was that I was only initialising FMOD with one channel
Changing that to a higher number made the setup above work ok!