我正在使用Ubuntu中的FMOD在我的游戏中播放声音。
我有下一个
#include "SoundEngine.h"
bool SoundEngine::initSystem()
{
System_Create(&system);// create an instance of the game engine
system->init(32, FMOD_INIT_NORMAL, 0);// initialise the game engine with 32 channels
//load sounds
system->createSound("Media/NoMoreMagic.ogg", FMOD_HARDWARE, 0, &sound1);
sound1->setMode(FMOD_LOOP_OFF); /* drumloop.wav has embedded loop points which automatically makes looping turn on, */
/* so turn it off here. We could have also just put FMOD_LOOP_OFF in the above CreateSound call. */
system->playSound(FMOD_CHANNEL_FREE, sound1, false, 0);
return true;
}SoundEngine.h是:
#ifndef SOUNDENGINE_H_
#define SOUNDENGINE_H_
#include "FMOD/inc/fmod.hpp" //fmod c++ header
#pragma comment( lib, "fmodex_vc.lib" ) // fmod library
using namespace FMOD;
class SoundEngine{
public:
bool initSystem(void);
private:
//FMod Stuff
System *system; //handle to FMOD engine
Sound *sound1, *sound2; //sound that will be loaded and played
};
#endif /* SOUNDENGINE_H_ */THe问题是找不到FMOD_HARDWARE或FMOD_CHANNEL_FREE。
有人知道他们在哪吗?
编辑:另一件事是杂注注释抛出一个警告,告诉忽略杂注。也许问题与语用有关?如何修复杂注?
发布于 2014-10-14 01:31:25
我相信FMOD_HARDWARE来自较老的FMOD Ex API。你使用的是FMOD 5吗?在我对System::createSound的调用中,我使用了FMOD_DEFAULT或FMOD_CREATESAMPLE (后者将加载整个声音并解压缩到内存中,以加快播放速度),这似乎很好地利用了硬件。对于您的playSound调用,请尝试
FMOD::Channel *channel;
system->playSound(sound1, NULL, false, &channel);https://stackoverflow.com/questions/25723881
复制相似问题