fix sound, fix compiling on r22

This commit is contained in:
dborth 2010-06-24 18:07:10 +00:00
parent 34460387ee
commit e5e30cbf32
2 changed files with 8 additions and 6 deletions

View file

@ -40,6 +40,7 @@
static const char WIIAUD_DRIVER_NAME[] = "wii"; static const char WIIAUD_DRIVER_NAME[] = "wii";
static Uint32 dma_buffers[2][SAMPLES_PER_DMA_BUFFER*8] __attribute__((aligned(32))); static Uint32 dma_buffers[2][SAMPLES_PER_DMA_BUFFER*8] __attribute__((aligned(32)));
static int dma_buffers_size[2] = { SAMPLES_PER_DMA_BUFFER*4, SAMPLES_PER_DMA_BUFFER*4 };
static Uint8 whichab = 0; static Uint8 whichab = 0;
#define AUDIOSTACK 16384*2 #define AUDIOSTACK 16384*2
@ -60,9 +61,6 @@ AudioThread (void *arg)
if(stopaudio) if(stopaudio)
break; break;
whichab ^= 1;
memset(dma_buffers[whichab], 0, sizeof(dma_buffers[0]));
// Is the device ready? // Is the device ready?
if (current_audio && (!current_audio->paused)) if (current_audio && (!current_audio->paused))
{ {
@ -82,6 +80,8 @@ AudioThread (void *arg)
// Copy from SDL buffer to DMA buffer // Copy from SDL buffer to DMA buffer
memcpy(dma_buffers[whichab], current_audio->convert.buf, current_audio->convert.len_cvt); memcpy(dma_buffers[whichab], current_audio->convert.buf, current_audio->convert.len_cvt);
DCFlushRange(dma_buffers[whichab], current_audio->convert.len_cvt);
dma_buffers_size[whichab] = current_audio->convert.len_cvt;
} }
else else
{ {
@ -90,6 +90,8 @@ AudioThread (void *arg)
current_audio->spec.userdata, current_audio->spec.userdata,
(Uint8 *)dma_buffers[whichab], (Uint8 *)dma_buffers[whichab],
SAMPLES_PER_DMA_BUFFER*4); SAMPLES_PER_DMA_BUFFER*4);
DCFlushRange(dma_buffers[whichab], SAMPLES_PER_DMA_BUFFER*4);
dma_buffers_size[whichab] = SAMPLES_PER_DMA_BUFFER*4;
SDL_mutexV(current_audio->mixer_lock); SDL_mutexV(current_audio->mixer_lock);
} }
} }
@ -105,8 +107,8 @@ AudioThread (void *arg)
static void static void
DMACallback() DMACallback()
{ {
DCFlushRange (dma_buffers[whichab], sizeof(dma_buffers[0])); whichab ^= 1;
AUDIO_InitDMA ((Uint32)dma_buffers[whichab], SAMPLES_PER_DMA_BUFFER*4); AUDIO_InitDMA ((Uint32)dma_buffers[whichab], dma_buffers_size[whichab]);
LWP_ThreadSignal (audioqueue); LWP_ThreadSignal (audioqueue);
} }

View file

@ -12,7 +12,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#ifndef __BEOS__ #ifndef __BEOS__
#include <sys/select.h> //#include <sys/select.h>
#endif #endif
#endif #endif