mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 05:24:21 +01:00
Fine-tune SDL sound output
This commit is contained in:
parent
f731ceafa9
commit
5324a2e769
@ -30,7 +30,7 @@
|
|||||||
static SDL_AudioSpec spec;
|
static SDL_AudioSpec spec;
|
||||||
|
|
||||||
#define FRODO_SNDBUF 512
|
#define FRODO_SNDBUF 512
|
||||||
#define SOUNDBUFSIZE 2048
|
#define SOUNDBUFSIZE 1024
|
||||||
#define N_BUFS 8
|
#define N_BUFS 8
|
||||||
|
|
||||||
static int16 soundbuffer[N_BUFS][FRODO_SNDBUF];
|
static int16 soundbuffer[N_BUFS][FRODO_SNDBUF];
|
||||||
@ -76,6 +76,7 @@ void DigitalRenderer::init_sound(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->sound_buffer = new int16[this->sndbufsize];
|
this->sound_buffer = new int16[this->sndbufsize];
|
||||||
|
memset(this->sound_buffer, 0, sizeof(int16) * this->sndbufsize);
|
||||||
ready = true;
|
ready = true;
|
||||||
SDL_PauseAudio(0);
|
SDL_PauseAudio(0);
|
||||||
}
|
}
|
||||||
@ -137,12 +138,12 @@ void DigitalRenderer::PushVolume(uint8 vol)
|
|||||||
int datalen = sndbufsize;
|
int datalen = sndbufsize;
|
||||||
to_output -= datalen;
|
to_output -= datalen;
|
||||||
|
|
||||||
|
|
||||||
SDL_LockAudio();
|
SDL_LockAudio();
|
||||||
calc_buffer(soundbuffer[head], datalen * 2);
|
calc_buffer(soundbuffer[head], datalen * 2);
|
||||||
head = (head + 1) % N_BUFS;
|
head = (head + 1) % N_BUFS;
|
||||||
if (head == tail)
|
if (head == tail) {
|
||||||
printf("Uh oh, hit the tail\n");
|
tail = (head + 1) % N_BUFS;
|
||||||
|
}
|
||||||
SDL_UnlockAudio();
|
SDL_UnlockAudio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user