c++ - FMOD playSound throws an error about invalid parameter -
i've tried building sort of audio manager after openal failed deliver on machines found out fmod. after few hours of changes in code nothing works. playsound call seems bugging.
an invalid parameter passed function.
this errorcheck output gives me.
code...let's start:
typedef std::map<std::string, fmod::sound*> soundpool; soundpool m_sounds; fmod::channel* m_soundchannels[max_sounds]; fmod::system* m_soundsystem;
and then:
fmod::system_create(&m_soundsystem); m_soundsystem->init(32, fmod_init_normal, null); for(int = 0; < max_sounds; i++) m_soundchannels[i] = 0;
and later:
void cresourcemanager::playsound(std::string filename, float volume) { for(int = 0; < max_sounds; i++) { if(m_soundchannels[i] == 0) { if(volume > 1.0f) volume = 1.0f; fmod_result result = m_soundsystem->playsound(fmod_channel_free, m_sounds[filename], false, &m_soundchannels[i]); if(result != fmod_ok) { std::cout << fmod_errorstring(result); //// here's error } m_soundchannels[i]->setvolume(volume); break; } } } void cresourcemanager::update() { m_soundsystem->update(); for(int = 0; < max_sounds; i++) { if(m_soundchannels[i] != 0) { bool playing; m_soundchannels[i]->isplaying(&playing); if(!playing) m_soundchannels[i] = 0; } } } bool cresourcemanager::addsound( std::string filename ) { fmod_result result = m_soundsystem->createsound(filename.c_str(), fmod_loop_normal, null, &m_sounds[filename]); if(result == fmod_ok) return true; return false; }
Comments
Post a Comment