Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove dependency on HPL.

  • Loading branch information...
commit 34bfc8f7a6fc87dd60cd0098804935d10064ab2d 1 parent fed4685
@chewi chewi authored urkle committed
View
3  TODO
@@ -1,6 +1,3 @@
* Add a Visual Studio Project file for windows
-* remove dependency on HPL1Engine core
- - Memory wrappers
- - String processing (cString class)
* Update WAVE loading to not use old Deprecated OpenAL APIs
* Use system include paths for OpenAL headers instead of dependencies bundle
View
2  include/OALWrapper/OAL_OggStream.h
@@ -21,8 +21,6 @@
#include "OAL_OggHelper.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
//------------------------------------------------------------------------
View
2  include/OALWrapper/OAL_Source.h
@@ -26,8 +26,6 @@ class cOAL_SourceManager;
#include "OAL_Effect.h"
#include "OAL_Filter.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
#define OAL_SEND_DIRECT 0x10000000h
View
5 sources/OAL_AudioData.cpp
@@ -9,7 +9,6 @@
#include "OALWrapper/OAL_Buffer.h"
-#include "system/LowLevelSystem.h"
//-------------------------------------------------------------------------------
@@ -20,7 +19,7 @@ iOAL_AudioData::iOAL_AudioData(eOAL_AudioDataType aType, int alBuffersToCreate)
{
mType = aType;
for(int i=0;i<alBuffersToCreate;++i)
- mvBuffers.push_back(hplNew(cOAL_Buffer,(this)));
+ mvBuffers.push_back(new cOAL_Buffer(this));
Reset();
}
@@ -28,7 +27,7 @@ iOAL_AudioData::iOAL_AudioData(eOAL_AudioDataType aType, int alBuffersToCreate)
iOAL_AudioData::~iOAL_AudioData()
{
for(int i=0;i<(int)mvBuffers.size();++i)
- hplDelete(mvBuffers[i]);
+ delete mvBuffers[i];
}
//-------------------------------------------------------------------------------
View
2  sources/OAL_Buffer.cpp
@@ -20,8 +20,6 @@
#include "OALWrapper/OAL_Helper.h"
#include "OALWrapper/OAL_Source.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
//------------------------------------------------------------------
View
29 sources/OAL_Device.cpp
@@ -23,7 +23,6 @@
#include "OALWrapper/OAL_Filter.h"
#include "OALWrapper/OAL_Effect_Reverb.h"
-#include "system/LowLevelSystem.h"
#include <cstring>
//-------------------------------------------------------------------------
@@ -190,18 +189,18 @@ bool cOAL_Device::Init( cOAL_Init_Params& acParams )
if (acParams.mbUseEFX && IsExtensionAvailable (OAL_ALC_EXT_EFX))
{
LogMsg("",eOAL_LogVerbose_Low, eOAL_LogMsg_Info, "Starting EFX on request\n" );
- mpEFXManager = hplNew( cOAL_EFXManager, () );
+ mpEFXManager = new cOAL_EFXManager;
mbEFXActive = mpEFXManager->Initialize( acParams.mlNumSlotsHint, mlEFXSends, acParams.mbUseThread, acParams.mlSlotUpdateFreq );
if (!mbEFXActive)
{
mpEFXManager->Destroy();
- hplDelete(mpEFXManager);
+ delete mpEFXManager;
}
}
LogMsg("",eOAL_LogVerbose_Low, eOAL_LogMsg_Info, "Creating Source Manager\n" );
//Create The source manager
- mpSourceManager = hplNew( cOAL_SourceManager, () );
+ mpSourceManager = new cOAL_SourceManager;
if ( mpSourceManager->Initialize( acParams.mbVoiceManagement, acParams.mlNumSourcesHint, acParams.mbUseThread, acParams.mlUpdateFreq, mlEFXSends ) == false)
{
LogMsg("",eOAL_LogVerbose_None, eOAL_LogMsg_Error, "Error creating Source Manager\n");
@@ -230,14 +229,14 @@ void cOAL_Device::Close ()
//Delete samples
{
for(tSampleListIt it = mlstSamples.begin(); it!=mlstSamples.end(); ++it )
- hplDelete((*it));
+ delete (*it);
mlstSamples.clear();
}
LogMsg("",eOAL_LogVerbose_Low, eOAL_LogMsg_Info, "Cleaning up Streams...\n" );
{
for (tStreamListIt it=mlstStreams.begin();it!=mlstStreams.end(); ++it )
- hplDelete((*it));
+ delete (*it);
mlstStreams.clear();
}
@@ -245,7 +244,7 @@ void cOAL_Device::Close ()
{
LogMsg("",eOAL_LogVerbose_Low, eOAL_LogMsg_Info, "Cleaning up Source Manager...\n" );
mpSourceManager->Destroy();
- hplDelete(mpSourceManager);
+ delete mpSourceManager;
mpSourceManager = NULL;
}
@@ -253,7 +252,7 @@ void cOAL_Device::Close ()
{
LogMsg("",eOAL_LogVerbose_Low, eOAL_LogMsg_Info, "Cleaning up EFX Manager...\n" );
mpEFXManager->Destroy();
- hplDelete(mpEFXManager);
+ delete mpEFXManager;
mpEFXManager = NULL;
}
@@ -309,15 +308,15 @@ cOAL_Sample* cOAL_Device::LoadSample(const wstring& asFilename)
// Check file format and load the sample data according to it
wstring strExt = GetExtensionW(asFilename);
if(strExt.compare(L"ogg") == 0 ) // Load an Ogg Vorbis sample
- pSample = hplNew(cOAL_OggSample,());
+ pSample = new cOAL_OggSample;
else if(strExt.compare(L"wav")==0) // Load a .WAV sample
- pSample = hplNew(cOAL_WAVSample,());
+ pSample = new cOAL_WAVSample;
if(pSample && pSample->CreateFromFile(asFilename) )
mlstSamples.push_back(pSample);
else
{
- hplDelete(pSample);
+ delete pSample;
pSample = NULL;
}
@@ -340,7 +339,7 @@ cOAL_Stream* cOAL_Device::LoadStream(const wstring &asFilename)
wstring strExt = GetExtensionW(asFilename);
if(strExt.compare(L"ogg")==0)
- pStream = hplNew(cOAL_OggStream,());
+ pStream = new cOAL_OggStream;
if(pStream && pStream->CreateFromFile(asFilename))
{
@@ -349,7 +348,7 @@ cOAL_Stream* cOAL_Device::LoadStream(const wstring &asFilename)
}
else
{
- hplDelete(pStream);
+ delete pStream;
pStream = NULL;
}
@@ -365,7 +364,7 @@ void cOAL_Device::UnloadSample(cOAL_Sample* apSample)
return;
mlstSamples.remove(apSample);
- hplDelete(apSample);
+ delete apSample;
}
//-------------------------------------------------------------------------
@@ -376,7 +375,7 @@ void cOAL_Device::UnloadStream(cOAL_Stream* apStream)
return;
mlstStreams.remove(apStream);
- hplDelete(apStream);
+ delete apStream;
}
//-------------------------------------------------------------------------
View
34 sources/OAL_EFXManager.cpp
@@ -13,8 +13,6 @@
#include "OALWrapper/OAL_Device.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
int SlotUpdaterThread(void* alUnusedArg);
@@ -167,7 +165,7 @@ bool cOAL_EFXManager::Initialize(int alNumSlotsHint, int alNumSends, bool abUseT
RUN_AL_FUNC(alDeleteAuxiliaryEffectSlots ( mlNumSlots, lTempSlot ));
- mpvSlots = hplNew (tSlotVector ,());
+ mpvSlots = new tSlotVector;
mpvSlots->reserve(mlNumSlots);
LogMsg("",eOAL_LogVerbose_Medium, eOAL_LogMsg_Info, "Creating High Level Effect Slots\n" );
@@ -175,7 +173,7 @@ bool cOAL_EFXManager::Initialize(int alNumSlotsHint, int alNumSends, bool abUseT
for ( int i = 0; i < mlNumSlots; i++ )
{
- cOAL_EffectSlot *pSlot = hplNew( cOAL_EffectSlot,(this, i) );
+ cOAL_EffectSlot *pSlot = new cOAL_EffectSlot(this, i);
mpvSlots->push_back(pSlot);
}
@@ -183,8 +181,8 @@ bool cOAL_EFXManager::Initialize(int alNumSlotsHint, int alNumSends, bool abUseT
LogMsg("",eOAL_LogVerbose_Medium, eOAL_LogMsg_Info, "Creating Filter and Effect containers\n" );
- mplstEffectList = hplNew( tOALEffectList, () );
- mplstFilterList = hplNew( tOALFilterList, () );
+ mplstEffectList = new tOALEffectList;
+ mplstFilterList = new tOALFilterList;
if (!mplstEffectList || !mplstFilterList)
{
@@ -237,10 +235,10 @@ void cOAL_EFXManager::Destroy()
for ( vSlotIterator = mpvSlots->begin(); vSlotIterator != mpvSlots->end(); ++vSlotIterator )
{
(*vSlotIterator)->Reset();
- hplDelete((*vSlotIterator));
+ delete (*vSlotIterator);
}
mpvSlots->clear();
- hplDelete(mpvSlots);
+ delete mpvSlots;
mpvSlots = NULL;
}
@@ -251,10 +249,10 @@ void cOAL_EFXManager::Destroy()
{
for ( lstEffectIterator = mplstEffectList->begin(); lstEffectIterator != mplstEffectList->end(); ++lstEffectIterator )
{
- hplDelete ((*lstEffectIterator));
+ delete (*lstEffectIterator);
}
mplstEffectList->clear();
- hplDelete(mplstEffectList);
+ delete mplstEffectList;
mplstEffectList = NULL;
}
@@ -264,10 +262,10 @@ void cOAL_EFXManager::Destroy()
{
for ( lstFilterIterator = mplstFilterList->begin(); lstFilterIterator != mplstFilterList->end(); ++lstFilterIterator )
{
- hplDelete ((*lstFilterIterator));
+ delete (*lstFilterIterator);
}
mplstFilterList->clear();
- hplDelete(mplstFilterList);
+ delete mplstFilterList;
mplstFilterList = NULL;
}
@@ -279,7 +277,7 @@ void cOAL_EFXManager::Destroy()
cOAL_Filter* cOAL_EFXManager::CreateFilter()
{
- cOAL_Filter* pFilter = hplNew (cOAL_Filter,());
+ cOAL_Filter* pFilter = new cOAL_Filter;
if(pFilter && pFilter->GetStatus())
{
@@ -288,7 +286,7 @@ cOAL_Filter* cOAL_EFXManager::CreateFilter()
}
else
{
- hplDelete ( pFilter );
+ delete pFilter ;
pFilter = NULL;
return NULL;
@@ -299,7 +297,7 @@ cOAL_Filter* cOAL_EFXManager::CreateFilter()
cOAL_Effect_Reverb* cOAL_EFXManager::CreateReverbEffect()
{
- cOAL_Effect_Reverb* pEffect = hplNew (cOAL_Effect_Reverb, () );
+ cOAL_Effect_Reverb* pEffect = new cOAL_Effect_Reverb;
if (pEffect && pEffect->GetStatus())
{
@@ -308,7 +306,7 @@ cOAL_Effect_Reverb* cOAL_EFXManager::CreateReverbEffect()
}
else
{
- hplDelete (pEffect);
+ delete pEffect;
pEffect = NULL;
return NULL;
@@ -324,7 +322,7 @@ void cOAL_EFXManager::DestroyFilter ( cOAL_Filter* apFilter )
return;
mplstFilterList->remove(apFilter);
- hplDelete (apFilter);
+ delete apFilter;
}
////////////////////////////////////////////////////////////
@@ -335,7 +333,7 @@ void cOAL_EFXManager::DestroyEffect ( cOAL_Effect *apEffect )
return;
mplstEffectList->remove(apEffect);
- hplDelete (apEffect);
+ delete apEffect;
}
////////////////////////////////////////////////////////////
View
6 sources/OAL_Init.cpp
@@ -18,8 +18,6 @@
#include "OALWrapper/OAL_Device.h"
#include "OALWrapper/OAL_SourceManager.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
cOAL_Device* gpDevice = NULL;
@@ -42,7 +40,7 @@ bool OAL_Init ( cOAL_Init_Params &acParams )
{
OAL_Log(eOAL_LogVerbose_None, eOAL_LogMsg_Text,"-------------------------------------\n----- OpenAL Wrapper Log opened -----\n-------------------------------------\n");
- gpDevice = hplNew( cOAL_Device, () );
+ gpDevice = new cOAL_Device;
bool bSuccess = gpDevice->Init( acParams );
/*asDeviceName , alOutputFreq,
abUseThread, alUpdateFreq,
@@ -76,7 +74,7 @@ void OAL_Close ()
// OAL_Source_Stop ( OAL_ALL );
gpDevice->Close();
- hplDelete(gpDevice);
+ delete gpDevice;
gpDevice = NULL;
OAL_Log(eOAL_LogVerbose_Low, eOAL_LogMsg_Text,"-------------------------------------\n----- OpenAL Wrapper Log closed -----\n-------------------------------------\n");
View
18 sources/OAL_OggSample.cpp
@@ -15,9 +15,8 @@
#include "OALWrapper/OAL_OggSample.h"
#include "OALWrapper/OAL_Buffer.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
-#include "system/String.h"
+#include <stdlib.h>
+#include <string>
#include <cstring>
//-------------------------------------------------------------------------------
@@ -50,7 +49,12 @@ bool cOAL_OggSample::CreateFromFile(const wstring &asFilename)
msFilename = asFilename;
- FILE *fileHandle = fopen(hpl::cString::To8Char(asFilename).c_str(),"rb");
+ std::string sTemp;
+ size_t needed = wcstombs(NULL,&asFilename[0],asFilename.length());
+ sTemp.resize(needed);
+ wcstombs(&sTemp[0],&asFilename[0],asFilename.length());
+
+ FILE *fileHandle = fopen(sTemp.c_str(),"rb");
// If no file is present, set the error status and return
if(!fileHandle)
@@ -78,7 +82,7 @@ bool cOAL_OggSample::CreateFromFile(const wstring &asFilename)
// Reserve memory for 'mlChannels' channels of 'mlSamples' * 2 bytes of data each
int lSizeInBytes = mlSamples * mlChannels * GetBytesPerSample();
- pPCMBuffer = (char *) hplMalloc (lSizeInBytes);
+ pPCMBuffer = (char *) malloc (lSizeInBytes);
memset (pPCMBuffer, 0, lSizeInBytes);
// Loop which loads chunks of decoded data into a buffer
@@ -95,7 +99,7 @@ bool cOAL_OggSample::CreateFromFile(const wstring &asFilename)
// If we get a negative value, then something went wrong. Clean up and set error status.
else if(lChunkSize < 0)
{
- hplFree(pPCMBuffer);
+ free(pPCMBuffer);
ov_clear(&ovFileHandle);
// ov_clear closes the file handle for us
mbStatus = false;
@@ -111,7 +115,7 @@ bool cOAL_OggSample::CreateFromFile(const wstring &asFilename)
// If something went wrong, set error status. Clean up afterwards.
mbStatus = pBuffer->Feed((ALvoid*)pPCMBuffer, lDataSize);
}
- hplFree(pPCMBuffer);
+ free(pPCMBuffer);
ov_clear(&ovFileHandle);
// ov_clear closes the file handle for us
View
10 sources/OAL_OggStream.cpp
@@ -16,8 +16,9 @@
#include "OALWrapper/OAL_OggStream.h"
#include "OALWrapper/OAL_Buffer.h"
-#include "system/String.h"
#include <stdio.h>
+#include <stdlib.h>
+#include <string>
extern ov_callbacks gCallbacks;
@@ -144,8 +145,13 @@ bool cOAL_OggStream::CreateFromFile(const wstring &asFilename)
if(mbStatus==false)
return false;
+ std::string sTemp;
+ size_t needed = wcstombs(NULL,&asFilename[0],asFilename.length());
+ sTemp.resize(needed);
+ wcstombs(&sTemp[0],&asFilename[0],asFilename.length());
+
int lOpenResult;
- FILE *pStreamFile = fopen(hpl::cString::To8Char(asFilename).c_str(),"rb");
+ FILE *pStreamFile = fopen(sTemp.c_str(),"rb");
if (pStreamFile == NULL)
return false;
View
2  sources/OAL_Sample.cpp
@@ -20,8 +20,6 @@
#include "OALWrapper/OAL_Buffer.h"
#include "OALWrapper/OAL_Source.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
//------------------------------------------------------------------
View
6 sources/OAL_Source.cpp
@@ -63,7 +63,7 @@ cOAL_Source::cOAL_Source(cOAL_SourceManager *apSourceManager, int alId, int alSe
LogMsg("",eOAL_LogVerbose_High, eOAL_LogMsg_Info, "", "Activating EFX Source stuff\n" );
for (int i=0; i<alSends; ++i)
{
- cOAL_SourceSend* pSend = hplNew(cOAL_SourceSend, ());
+ cOAL_SourceSend* pSend = new cOAL_SourceSend;
mvSends.push_back(pSend);
}
}
@@ -95,7 +95,7 @@ cOAL_Source::~cOAL_Source()
if(mpFilter)
{
LogMsg("",eOAL_LogVerbose_High, eOAL_LogMsg_Info, "Destroying Filter...\n" );
- hplDelete(mpFilter);
+ delete mpFilter;
mpFilter = NULL;
}
@@ -103,7 +103,7 @@ cOAL_Source::~cOAL_Source()
{
LogMsg("",eOAL_LogVerbose_High, eOAL_LogMsg_Info, "Destroying Sends...\n" );
for(unsigned int i = 0; i<mvSends.size(); ++i)
- hplDelete(mvSends[i]);
+ delete mvSends[i];
}
LogMsg("",eOAL_LogVerbose_High, eOAL_LogMsg_Info, "Destroying Low Level Object...\n" );
DestroyLowLevelID();
View
6 sources/OAL_SourceManager.cpp
@@ -9,8 +9,6 @@
#include "OALWrapper/OAL_Source.h"
#include "OALWrapper/OAL_Device.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
//-----------------------------------------------------------------------------------
@@ -77,7 +75,7 @@ bool cOAL_SourceManager::Initialize ( bool abManageVoices, int alNumSourcesHint,
mvSources.resize(mlNumOfVoices);
for(int i=0; i<mlNumOfVoices; ++i)
{
- cOAL_Source *pSource = hplNew( cOAL_Source,(this, i,alEFXSends) );
+ cOAL_Source *pSource = new cOAL_Source(this, i, alEFXSends);
mvSources[i] = pSource;
}
@@ -125,7 +123,7 @@ void cOAL_SourceManager::Destroy()
//hpl::Log("source: %d\n",pSource);
//hpl::Log("source id: %d\n",pSource->GetSourceID());
pSource->Stop();
- hplDelete(pSource);
+ delete pSource;
}
mvSources.clear();
View
2  sources/OAL_Stream.cpp
@@ -12,8 +12,6 @@
#include "OALWrapper/OAL_Source.h"
#include "OALWrapper/OAL_Buffer.h"
-#include "system/MemoryManager.h"
-#include "system/LowLevelSystem.h"
//-----------------------------------------------------------------------------------
View
5 sources/OAL_WAVSample.cpp
@@ -17,7 +17,6 @@
#include "OALWrapper/OAL_Buffer.h"
#include "OALWrapper/OAL_Helper.h"
#include "OALWrapper/OAL_Device.h"
-#include "system/LowLevelSystem.h"
//------------------------------------------------------------------
@@ -70,7 +69,7 @@ bool cOAL_WAVSample::CreateFromFile(const wstring &asFilename)
if(pBuffer->Feed(pPCMBuffer, lSize)==false)
{
mlBuffersUsed = 1;
- //hplFree ( pPCMBuffer );
+ //free( pPCMBuffer );
alutUnloadWAV( mFormat, pPCMBuffer, lSize, mlFrequency);
status = alutGetError();
mbStatus = false;
@@ -84,7 +83,7 @@ bool cOAL_WAVSample::CreateFromFile(const wstring &asFilename)
mfTotalTime = ((double)mlSamples)/mlFrequency;
-// hplFree ( pPCMBuffer );
+// free( pPCMBuffer );
alutUnloadWAV( mFormat, pPCMBuffer, lSize, mlFrequency);
status = alutGetError ();
Please sign in to comment.
Something went wrong with that request. Please try again.