diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-04-09 13:12:30 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-04-09 13:12:30 +0300 |
commit | 8cb9bcf1d6379afb3f0784c3741f77b5df437dea (patch) | |
tree | 0157e27a296bb846291fee36dde02a6f7743f8cb /indra/llaudio/llaudioengine_fmodstudio.cpp | |
parent | 5e9ecc123e146bccd36232642561b5f20de37431 (diff) |
SL-11445 Fix fmod studio opening audio files
Diffstat (limited to 'indra/llaudio/llaudioengine_fmodstudio.cpp')
-rw-r--r-- | indra/llaudio/llaudioengine_fmodstudio.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index 15bf8926c1..8f07c81c57 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -49,19 +49,20 @@ FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, FMOD::ChannelGroup *LLAudioEngine_FMODSTUDIO::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; LLAudioEngine_FMODSTUDIO::LLAudioEngine_FMODSTUDIO(bool enable_profiler) +: mInited(false), + mWindGen(NULL), + mWindDSP(NULL), + mSystem(NULL), + mEnableProfiler(enable_profiler), + mWindDSPDesc(NULL) { - mInited = false; - mWindGen = NULL; - mWindDSP = NULL; - mSystem = NULL; - mEnableProfiler = enable_profiler; - mWindDSPDesc = NULL; } LLAudioEngine_FMODSTUDIO::~LLAudioEngine_FMODSTUDIO() { - delete mWindDSPDesc; + // mWindDSPDesc, mWindGen and mWindDSP get cleaned up on cleanupWind in LLAudioEngine::shutdown() + // mSystem gets cleaned up at shutdown() } @@ -400,10 +401,12 @@ void LLAudioEngine_FMODSTUDIO::setInternalGain(F32 gain) gain = llclamp(gain, 0.0f, 1.0f); - FMOD::ChannelGroup *master_group; - mSystem->getMasterChannelGroup(&master_group); - - master_group->setVolume(gain); + FMOD::ChannelGroup* master_group = NULL; + if (!Check_FMOD_Error(mSystem->getMasterChannelGroup(&master_group), "FMOD::System::getMasterChannelGroup") + && master_group) + { + master_group->setVolume(gain); + } LLStreamingAudioInterface *saimpl = getStreamingAudioImpl(); if (saimpl) @@ -658,12 +661,8 @@ bool LLAudioBufferFMODSTUDIO::loadWAV(const std::string& filename) memset(&exinfo, 0, sizeof(exinfo)); exinfo.cbsize = sizeof(exinfo); exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_WAV; //Hint to speed up loading. - // Load up the wav file into an fmod sample -#if LL_WINDOWS - FMOD_RESULT result = getSystem()->createSound((const char*)utf8str_to_utf16str(filename).c_str(), base_mode, &exinfo, &mSoundp); -#else + // Load up the wav file into an fmod sample (since 1.05 fmod studio expects everything in UTF-8) FMOD_RESULT result = getSystem()->createSound(filename.c_str(), base_mode, &exinfo, &mSoundp); -#endif if (result != FMOD_OK) { |