diff --git a/source/music/BufferCircle.cpp b/source/music/BufferCircle.cpp index 4b849761..3ba70a49 100644 --- a/source/music/BufferCircle.cpp +++ b/source/music/BufferCircle.cpp @@ -51,9 +51,10 @@ void BufferCircle::SetBufferBlockSize(int size) for(int i = 0; i < Size(); i++) { if(SoundBuffer[i] != NULL) - MEM1_free(SoundBuffer[i]); + MEM2_free(SoundBuffer[i]); - SoundBuffer[i] = (u8 *)MEM1_memalign(32, BufferBlockSize); + SoundBuffer[i] = (u8 *)MEM2_memalign(32, BufferBlockSize); + memset(SoundBuffer[i], 0, sizeof(SoundBuffer[i])); BufferSize[i] = 0; BufferReady[i] = false; } @@ -73,7 +74,10 @@ void BufferCircle::Resize(int size) for(int i = oldSize; i < Size(); i++) { if(BufferBlockSize > 0) - SoundBuffer[i] = (u8 *)MEM1_memalign(32, BufferBlockSize); + { + SoundBuffer[i] = (u8 *)MEM2_memalign(32, BufferBlockSize); + memset(SoundBuffer[i], 0, sizeof(SoundBuffer[i])); + } else SoundBuffer[i] = NULL; BufferSize[i] = 0; @@ -87,7 +91,7 @@ void BufferCircle::RemoveBuffer(int pos) return; if(SoundBuffer[pos] != NULL) - MEM1_free(SoundBuffer[pos]); + MEM2_free(SoundBuffer[pos]); SoundBuffer.erase(SoundBuffer.begin()+pos); BufferSize.erase(BufferSize.begin()+pos); @@ -109,7 +113,7 @@ void BufferCircle::FreeBuffer() for(int i = 0; i < Size(); i++) { if(SoundBuffer[i] != NULL) - MEM1_free(SoundBuffer[i]); + MEM2_free(SoundBuffer[i]); BufferSize[i] = 0; BufferReady[i] = false; } diff --git a/source/music/BufferCircle.hpp b/source/music/BufferCircle.hpp index fcb9d6e4..6eec4b6e 100644 --- a/source/music/BufferCircle.hpp +++ b/source/music/BufferCircle.hpp @@ -28,6 +28,7 @@ #include #include +#include class BufferCircle { diff --git a/source/music/SoundHandler.cpp b/source/music/SoundHandler.cpp index ca8267f3..b2fbd2ec 100644 --- a/source/music/SoundHandler.cpp +++ b/source/music/SoundHandler.cpp @@ -43,7 +43,7 @@ SoundHandler::SoundHandler() for(u32 i = 0; i < MAX_DECODERS; ++i) DecoderList[i] = NULL; - ThreadStack = (u8 *)MEM1_memalign(32, 32768); + ThreadStack = (u8 *)MEM2_memalign(32, 32768); if(!ThreadStack) return; @@ -61,7 +61,7 @@ SoundHandler::~SoundHandler() SoundThread = LWP_THREAD_NULL; if(ThreadStack != NULL) { - MEM1_free(ThreadStack); + MEM2_free(ThreadStack); ThreadStack = NULL; }