Removed CD sound buffer dependency on main sound buffer. Fixes CD audio issues following the last commit.
This commit is contained in:
parent
2e965db14e
commit
c581b018a7
2 changed files with 12 additions and 4 deletions
10
src/sound.c
10
src/sound.c
|
|
@ -93,6 +93,7 @@ static int16_t cd_buffer[CD_BUFLEN * 2];
|
|||
static thread_t *sound_cd_thread_h;
|
||||
static event_t *sound_cd_event;
|
||||
static unsigned int cd_vol_l, cd_vol_r;
|
||||
static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN;
|
||||
|
||||
void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r)
|
||||
{
|
||||
|
|
@ -207,8 +208,13 @@ void sound_poll(void *priv)
|
|||
fwrite(buf16,(SOUNDBUFLEN)*2*2,1,soundf);*/
|
||||
|
||||
if (soundon) givealbuffer(outbuffer);
|
||||
|
||||
thread_set_event(sound_cd_event);
|
||||
|
||||
cd_buf_update--;
|
||||
if (!cd_buf_update)
|
||||
{
|
||||
cd_buf_update = (48000 / SOUNDBUFLEN) / (CD_FREQ / CD_BUFLEN);
|
||||
thread_set_event(sound_cd_event);
|
||||
}
|
||||
|
||||
sound_pos_global = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ void inital()
|
|||
#ifdef USE_OPENAL
|
||||
int c;
|
||||
int16_t buf[BUFLEN*2];
|
||||
|
||||
int16_t cd_buf[CD_BUFLEN*2];
|
||||
|
||||
// printf("1\n");
|
||||
check();
|
||||
|
||||
|
|
@ -120,12 +121,13 @@ void inital()
|
|||
check();
|
||||
|
||||
memset(buf,0,BUFLEN*4);
|
||||
memset(cd_buf, 0, CD_BUFLEN*4);
|
||||
|
||||
// printf("5\n");
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
alBufferData(buffers[c], AL_FORMAT_STEREO16, buf, BUFLEN*2*2, FREQ);
|
||||
alBufferData(buffers_cd[c], AL_FORMAT_STEREO16, buf, CD_BUFLEN*2*2, CD_FREQ);
|
||||
alBufferData(buffers_cd[c], AL_FORMAT_STEREO16, cd_buf, CD_BUFLEN*2*2, CD_FREQ);
|
||||
}
|
||||
|
||||
alSourceQueueBuffers(source[0], 4, buffers);
|
||||
|
|
|
|||
Loading…
Reference in a new issue