-some people reported problems with sound buffers in mem1, since

the mem1 code is changed it looks like it doesnt work well anymore,
so back in mem2 with it
This commit is contained in:
fix94.1 2012-06-12 20:32:17 +00:00
parent ce8d2f1641
commit adb0fcb17b
3 changed files with 12 additions and 7 deletions

View File

@ -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;
}

View File

@ -28,6 +28,7 @@
#include <vector>
#include <gctypes.h>
#include <string.h>
class BufferCircle
{

View File

@ -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;
}