From 48e6e4eb984d5a7275d4db279846af1867496a1b Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Mon, 28 Mar 2016 07:50:48 -0400 Subject: [PATCH] Sync up llaudio/llaudioengine_fmodstudio.cpp: Compile now, please? --- indra/llaudio/llaudioengine_fmodstudio.cpp | 45 +++++----------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index 930af7fc2..dc192a899 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -1,5 +1,5 @@ /** - * @file audioengine_FMODSTUDIO.cpp + * @file audioengine_fmodstudio.cpp * @brief Implementation of LLAudioEngine class abstracting the audio support as a FMOD 3D implementation * * $LicenseInfo:firstyear=2002&license=viewergpl$ @@ -79,7 +79,7 @@ bool attemptDelayLoad() static bool sVerboseDebugging = false; -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); +FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); FMOD::ChannelGroup *LLAudioEngine_FMODSTUDIO::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0}; @@ -248,7 +248,6 @@ LLAudioEngine_FMODSTUDIO::~LLAudioEngine_FMODSTUDIO() { } - inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) { if(result == FMOD_OK) @@ -257,28 +256,6 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) return true; } -void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - if(type & FMOD_MEMORY_STREAM_DECODE) - { - LL_INFOS("AudioImpl") << "Decode buffer size: " << size << LL_ENDL; - } - else if(type & FMOD_MEMORY_STREAM_FILE) - { - LL_INFOS("AudioImpl") << "Stream buffer size: " << size << LL_ENDL; - } - return new char[size]; -} -void* F_STDCALL decode_realloc(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - memset(ptr,0,size); - return ptr; -} -void F_STDCALL decode_dealloc(void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr) -{ - delete[] (char*)ptr; -} - bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata) { LL_WARNS("AudioImpl") << "BARKBARKBARK" << LL_ENDL; @@ -288,14 +265,11 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata) #endif U32 version = 0; + FMOD_RESULT result; LL_DEBUGS("AppInit") << "LLAudioEngine_FMODSTUDIO::init() initializing FMOD" << LL_ENDL; - //result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE); - //if(Check_FMOD_Error(result, "FMOD::Memory_Initialize")) - // return false; - result = FMOD::System_Create(&mSystem); if(Check_FMOD_Error(result, "FMOD::System_Create")) return false; @@ -533,15 +507,16 @@ bool LLAudioEngine_FMODSTUDIO::initWind() dspdesc.pluginsdkversion = FMOD_PLUGIN_SDK_VERSION; strncpy(dspdesc.name,"Wind Unit", sizeof(dspdesc.name)); //Set name to "Wind Unit" dspdesc.numoutputbuffers = 1; - dspdesc.read = &windCallback; //Assign callback. + dspdesc.read = &windDSPCallback; //Assign callback. if (Check_FMOD_Error(mSystem->createDSP(&dspdesc, &mWindDSP), "FMOD::createDSP") || !mWindDSP) return false; int frequency = 44100; - if (!Check_FMOD_Error(mSystem->getSoftwareFormat(&frequency, NULL, NULL), "FMOD::System::getSoftwareFormat")) + FMOD_SPEAKERMODE mode; + if (!Check_FMOD_Error(mSystem->getSoftwareFormat(&frequency, &mode, NULL), "FMOD::System::getSoftwareFormat")) { mWindGen = new LLWindGen((U32)frequency); - FMOD_SPEAKERMODE mode; + if (!Check_FMOD_Error(mWindDSP->setUserData((void*)mWindGen), "FMOD::DSP::setUserData") && !Check_FMOD_Error(mSystem->playDSP(mWindDSP, NULL, false, 0), "FMOD::System::playDSP") && !Check_FMOD_Error(mSystem->getSoftwareFormat(NULL, &mode, NULL), "FMOD::System::getSoftwareFormat") && @@ -686,6 +661,7 @@ bool LLAudioChannelFMODSTUDIO::updateBuffer() return false; } + // Actually play the sound. Start it off paused so we can do all the necessary // setup. if(!mChannelp) @@ -924,8 +900,7 @@ bool LLAudioBufferFMODSTUDIO::loadWAV(const std::string& filename) } FMOD_MODE base_mode = FMOD_LOOP_NORMAL; - FMOD_CREATESOUNDEXINFO exinfo; - memset(&exinfo,0,sizeof(exinfo)); + FMOD_CREATESOUNDEXINFO exinfo = {0}; exinfo.cbsize = sizeof(exinfo); exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_WAV; //Hint to speed up loading. // Load up the wav file into an fmod sample @@ -983,7 +958,7 @@ void LLAudioChannelFMODSTUDIO::set3DMode(bool use3d) } -FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels) +FMOD_RESULT F_CALLBACK windDSPCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels) { // inbuffer = incomming data. // newbuffer = outgoing data. AKA this DSP's output.