Frictional Games Forum (read-only)

Full Version: [Patch] Code update for new versions of ALUT
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The following is the code that needs to be changed/added in order for the new version of ALUT to be used with OALWrapper. This is confirmed to work with ALUT 1.1.0.

In OAL_WAVSample.cpp line 54:
PHP Code:
#if defined(__APPLE__)
    
alutLoadWAVFile ( (ALbyte*) sFilename.c_str(), &mFormat, &pPCMBuffer, &lSize, &mlFrequency);
#else
    
alutLoadWAVFile ( (ALbyte*) sFilename.c_str(), &mFormat, &pPCMBuffer, &lSize, &mlFrequencyAL_FALSE);
#endif 
Changes to:
PHP Code:
#if defined(__APPLE__)
    
pPCMBuffer alutLoadMemoryFromFile(sFilename.c_str(), &mFormat, &lSize, &mlFrequency);
#else
    
pPCMBuffer alutLoadMemoryFromFile(sFilename.c_str(), &mFormat, &lSize, &mlFrequency);
#endif 

In order for alutLoadMemoryFromFile to work in the new API, ALUT must be initialized first. Therefore some code must be added to OAL_Device.cpp.

At the end of cOAL_Device::Init:
PHP Code:
#ifdef WITH_ALUT
    
if(!alutInitWithoutContext(NULL,NULL))
    {
        
LogMsg("",eOAL_LogVerbose_NoneeOAL_LogMsg_Error"Error initializing ALUT\n");
        return 
false;
    }
#endif 
And just before the end in cOAL_Device::Close:
PHP Code:
#ifdef WITH_ALUT
    
LogMsg("",eOAL_LogVerbose_LoweOAL_LogMsg_Info"Exiting ALUT...\n" );
    if(!
alutExit())
    {
        
LogMsg("",eOAL_LogVerbose_NoneeOAL_LogMsg_Error"Error exiting ALUT!\n");
    }
#endif 
Thanks... I'll take a look at that and confirm on Mac os x and Linux. What platform are you developing/testing on?
I'm testing on Windows XP with MinGW. I'm using Code::Blocks for the IDE.