Added 3d right handed flag for core init.

Added profile flags for debug configuration.
Added handling of software format and output type (TO BE TESTED)
This commit is contained in:
SHAM-DP 2023-03-07 10:35:45 +08:00
parent 99f7c3c799
commit 87d9158f75
1 changed files with 34 additions and 5 deletions

View File

@ -54,12 +54,41 @@ namespace SHADE
denseListener = &SHComponentManager::GetDense<SHAudioListenerComponent>();
fmodStudioSystem->getCoreSystem(&fmodSystem);
fmodSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_5POINT1, 0);
result = fmodStudioSystem->initialize(AUDIO_SYS_MAX_CHANNELS, AUDIO_SYS_MAX_CHANNELS, FMOD_STUDIO_INIT_NORMAL | FMOD_INIT_NORMAL, extraDriverData);
ErrorCheck();
fmodSystem->setSoftwareFormat(0, speakerMode, 0);
result = fmodSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_5POINT1, 0);
ErrorCheck();
result = fmodSystem->setOutput(FMOD_OUTPUTTYPE_AUDIO3D);
if(result != FMOD_OK)
{
result = fmodSystem->setOutput(FMOD_OUTPUTTYPE_WINSONIC);
if (result == FMOD_OK)
{
result = fmodSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_7POINT1POINT4, 0);
ErrorCheck();
}
}
int numDrivers{};
result = fmodSystem->getNumDrivers(&numDrivers);
if(numDrivers == 0)
{
fmodSystem->setDSPBufferSize(512, 4);
fmodSystem->setOutput(FMOD_OUTPUTTYPE_AUTODETECT);
}
FMOD_OUTPUTTYPE outputType = FMOD_OUTPUTTYPE_WINSONIC;
fmodSystem->getSoftwareFormat(0, &speakerMode, 0);
fmodSystem->getOutput(&outputType);
FMOD_STUDIO_INITFLAGS studioInitFlags = FMOD_STUDIO_INIT_NORMAL;
FMOD_INITFLAGS coreInitFlags = FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED | FMOD_INIT_PREFER_DOLBY_DOWNMIX;
#ifdef _DEBUG
studioInitFlags |= FMOD_STUDIO_INIT_LIVEUPDATE;
coreInitFlags |= FMOD_INIT_PROFILE_ENABLE;
#endif
result = fmodStudioSystem->initialize(AUDIO_SYS_MAX_CHANNELS, studioInitFlags, coreInitFlags, extraDriverData);
ErrorCheck();
result = fmodSystem->createChannelGroup("SFX", &sfxChannelGroup);
ErrorCheck();