0

i am trying to use fmod with a c++ project and created a soundbank. when i try to load it, no error is shown but it wont play any sound.

here is the soundengine.h:

...
static FMOD_RESULT result;
static FMOD::Studio::System * fmodStudio;
static FMOD::Studio::Bank* masterBank;
static FMOD::Studio::EventDescription * eventDesc;
static FMOD::Studio::EventInstance * engine;
...
static void loadBank();

and soundengine.cpp

...
FMOD::Studio::System * SoundEngine::fmodStudio;
FMOD::Studio::Bank * SoundEngine::masterBank;
FMOD::Studio::EventDescription * SoundEngine::eventDesc;
FMOD::Studio::EventInstance * SoundEngine::engine;
...

void SoundEngine::initialise (void) 
{
result = FMOD::Studio::System::create(&fmodStudio);
if (result != FMOD_OK) possible = false; 
if (possible)result = fmodStudio->initialize(320, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, 0);
if (result != FMOD_OK) possible = false;
//sets initial sound volume (mute)
if (possible) channel->setVolume(0.0f);
fmodStudio->update();
}

void SoundEngine::loadBank()
{
//load master bank
if (possible)result = fmodStudio->loadBankFile("EnvironmentSound.bank", FMOD_STUDIO_LOAD_BANK_NORMAL, &masterBank);
if (result != FMOD_OK) possible = false;
result = fmodStudio->getEvent("event:/StaticSounds/Engine", &eventDesc);
result = eventDesc->createInstance(&engine);
engine->start();
fmodStudio->update();
}

then i simply call the SoundEngine::loadBank(); in main.cpp it runs and all but there is no sound. i placed EnvironmentSound.bank in the same folder of main.cpp, not sure about the "event:/StaticSounds/Engine" though. as i just followed the example of fmod simple_event.cpp

Can anyone point out the mistakes i make? if there isnt enough info please let me know.

Ahmet Bat
  • 13
  • 5

1 Answers1

0

I know I'm late to answer this, but the problem here at least for me, is that you didn't loaded the bank strings, so you can't find the events with the string "event:/StaticSounds/Engine".

if (possible)
    result = fmodStudio->loadBankFile("EnvironmentSound.strings.bank", FMOD_STUDIO_LOAD_BANK_NORMAL, &masterBank);
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164