0
0

Fight now Im trying to implement a AudioManager I created into Ogre Project Im working on. The AudioManager works away from the Ogre enviroment but not inside it. It’s just a ambient sound created that has no interaction with anythin Ogre related.

Here is my create sound functions:

[code:220dw5vc] SoundObj::SoundObj(AudioManager *AM,string filename,string id)
{
string type = "Hardware";
setId(id);
paused = true;
loop = FMOD_LOOP_OFF;

channel = 0;

FMOD_RESULT res = AM->getSystem()->createSound(filename.c_str(), FMOD_HARDWARE | FMOD_3D,0,&this->sound);  /*<-------- CRASHES HERE */

AM->setResult( res );
if( AM->getResult() != FMOD_OK)
{
FMOD_RESULT res = AM->getSystem()->createSound(filename.c_str(), FMOD_SOFTWARE | FMOD_3D,0,&this->sound);
AM->ERRCHECK();
}

AM->setResult(this->sound->set3DMinMaxDistance(2.0f * AM->getMeasuringUnit(), 10000.0f * AM->getMeasuringUnit()));
AM->ERRCHECK();

AM->setResult(sound->setMode(loop));
AM->ERRCHECK();

FMOD_VECTOR temp = {0,0,0};

            this->position = temp;
this->velocity = temp;   

}[/code:220dw5vc]

Any Ideas on what I should look into?

  • You must to post comments
0
0

maybe your this pointer is null. Why would you explicitly reference it.

Did you use a debugger?

  • You must to post comments
0
0

With Ogre you can’t use a debugger because it’s stupid and needs to get rendering info that it can’t access in debug mode. But we found this was the line it crashed on my commenting section of code till we found what one it crashed on. Ill look into the this pointer but if that where the case why would the exact same Audio Manager/Sound object work in another program?

  • You must to post comments
0
0

The code you are showing is probably crashing because of the environment it is in, such as an ogre project, where there may be memory corruption, or you are calling fmod from different threads which is also not safe?

Simply calling createsound does not make fmod crash, so you are going to have to isolate the problem on your end until it does not crash.

With no debugger, you can always use printf :)

  • You must to post comments
0
0

Alright I fixed it. There was a problem with the way I was accessing system for some reason. Here is what I changed.

[code:21vuv40u]FMOD_RESULT res = AM->getSystem()->createSound(filename.c_str(), FMOD_HARDWARE | FMOD_3D,0,&this->sound);[/code:21vuv40u]
to:
[code:21vuv40u]FMOD::System *system = AM->getSystem();

FMOD_RESULT res = system->createSound(filename.c_str(), FMOD_HARDWARE | FMOD_3D,0,&sound);
AM->setResult( res );[/code:21vuv40u]

And that fixed it. I guess it just got to confused.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.