0
0

Hi!
Here is my initialization procedure:
[code:20sqmri0] unsigned int version;

if (CheckFMODError(EventSystem_Create(&EVENTsystem)))
return;

if (CheckFMODError(EVENTsystem->getSystemObject(&FMODsystem)))
return;

if (CheckFMODError(FMODsystem->getVersion(&version)))
return;

if (version < FMOD_VERSION)
{
TheEngine->Report(String<255>("You are using FMOD version: <div></div>") + String<255>(version), kReportError | kReportLog);
TheEngine->Report(String<255>("This game requires: <div></div>") + String<255>(FMOD_VERSION), kReportError | kReportLog);
return;
}

int numdrivers;

if (CheckFMODError(FMODsystem->getNumDrivers(&numdrivers)))
return;

if (numdrivers == 0)
{
if (CheckFMODError(FMODsystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND)))
return;
}
else
{
FMOD_SPEAKERMODE speakermode = (FMOD_SPEAKERMODE)snSpeakersVariable->GetIntegerValue();
FMOD_CAPS caps;

if (speakermode == FMOD_SPEAKERMODE_RAW)
{
  if (CheckFMODError(FMODsystem-&gt;getDriverCaps(0, &amp;caps, nullptr, nullptr, &amp;speakermode)))
    return;
}
else
  if (CheckFMODError(FMODsystem-&gt;getDriverCaps(0, &amp;caps, nullptr, nullptr, nullptr)))
    return;

if (CheckFMODError(FMODsystem-&gt;setSpeakerMode(speakermode)))
  return;

if (caps &amp; FMOD_CAPS_HARDWARE_EMULATED)
{
  TheEngine-&gt;Report(&quot;Sound acceleration is turned off in windows settings!&quot;);
  if (CheckFMODError(FMODsystem-&gt;setDSPBufferSize(1024, 10)))
    return;
}

char name[256];
if (CheckFMODError(FMODsystem-&gt;getDriverInfo(0, name, 256, nullptr)))
  return;

if (Text::CompareText(name, &quot;SigmaTel&quot;))
{
  if (CheckFMODError(FMODsystem-&gt;setSoftwareFormat(48000, FMOD_SOUND_FORMAT_PCMFLOAT, 0, 0, FMOD_DSP_RESAMPLER_LINEAR)))
    return;
}

}

FMOD_RESULT result = EVENTsystem->init(100, FMOD_INIT_NORMAL | FMOD_INIT_DSOUND_HRTFFULL | PROFILER, nullptr, FMOD_EVENT_INIT_NORMAL);
if (CheckFMODError(result))
return;

if (result == FMOD_ERR_OUTPUT_CREATEBUFFER)
{
if (CheckFMODError(FMODsystem->setSpeakerMode(FMOD_SPEAKERMODE_STEREO)))
return;

if (CheckFMODError(EVENTsystem-&gt;init(100, FMOD_INIT_NORMAL | FMOD_INIT_DSOUND_HRTFFULL | PROFILER, nullptr, FMOD_EVENT_INIT_NORMAL)))
  return;

}

if (CheckFMODError(EVENTsystem->getMusicSystem(&MUSICsystem)))
return;

if (CheckFMODError(EVENTsystem->setMediaPath(SOUNDS_PATH)))
return;[/code:20sqmri0]First question. Is it correct?
If it is, then here is my DEinitialization procedure:
[code:20sqmri0] if (CheckFMODError(FMODsystem->release()))
return;[/code:20sqmri0]Second question is, if my initialization/deinitializations are correct, then why i can’t reinitialize FMOD after it’s deinitialization?
If to be simple… I have a wrapper class. I construct it (and initialize FMOD in it as shown above) and destruct it (deinitializing FMOD). Then i construct it again and get the following error right on the first EventSystem_Create():
[quote:20sqmri0]Cannot call this command after System::init.[/quote:20sqmri0]I would greatly appreciate any help.
Thank you!

  • You must to post comments
0
0

You can’t release the FMOD System inside the event system and then recreate it. You could try calling System::close instead of System::release, or you could release the EventSystem instead of the FMOD System and then recreate the EventSystem. The latter would probably be the best option.

  • You must to post comments
0
0

Thank you!
Releasing EVENT system did the job!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.