mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Allow DMA/SDL sound in OGG_Stream when compiling with USE_OPENAL
This commit is contained in:
parent
e388a425b4
commit
65914b342d
1 changed files with 32 additions and 28 deletions
|
@ -602,38 +602,42 @@ OGG_Stream ( void )
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
/*
|
||||
*/
|
||||
|
||||
if ( ogg_status == PLAY )
|
||||
{
|
||||
|
||||
/* active_buffers are all active OpenAL buffers,
|
||||
buffering normal sfx _and_ ogg/vorbis samples.
|
||||
Empirical testing showed that there are most
|
||||
likly never more than 256 sfx buffers active.
|
||||
Read ogg samples into buffers until there are
|
||||
384 active buffers. This keeps at least 128
|
||||
ogg buffers (128 * 4096 Byte = 512 KByte) in
|
||||
the memory. That's about 30 second of music
|
||||
playback, more than enough to rule out buffer
|
||||
underruns even at very, very, very low frame
|
||||
rates. */
|
||||
while ( active_buffers <= 384 )
|
||||
#ifdef USE_OPENAL
|
||||
if( sound_started == SS_OAL )
|
||||
{
|
||||
OGG_Read();
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Read that number samples into the buffer, that
|
||||
were played since the last call to this function.
|
||||
This keeps the buffer at all times at an "optimal"
|
||||
fill level. */
|
||||
while ( ogg_status == PLAY && paintedtime + MAX_RAW_SAMPLES - 2048 > s_rawend )
|
||||
{
|
||||
OGG_Read();
|
||||
}
|
||||
/* active_buffers are all active OpenAL buffers,
|
||||
buffering normal sfx _and_ ogg/vorbis samples.
|
||||
Empirical testing showed that there are most
|
||||
likly never more than 256 sfx buffers active.
|
||||
Read ogg samples into buffers until there are
|
||||
384 active buffers. This keeps at least 128
|
||||
ogg buffers (128 * 4096 Byte = 512 KByte) in
|
||||
the memory. That's about 30 second of music
|
||||
playback, more than enough to rule out buffer
|
||||
underruns even at very, very, very low frame
|
||||
rates. */
|
||||
while ( active_buffers <= 384 )
|
||||
{
|
||||
OGG_Read();
|
||||
}
|
||||
} else { // using DMA/SDL
|
||||
#endif
|
||||
/* Read that number samples into the buffer, that
|
||||
were played since the last call to this function.
|
||||
This keeps the buffer at all times at an "optimal"
|
||||
fill level. */
|
||||
while ( paintedtime + MAX_RAW_SAMPLES - 2048 > s_rawend )
|
||||
{
|
||||
OGG_Read();
|
||||
}
|
||||
#ifdef USE_OPENAL
|
||||
} // using DMA/SDL
|
||||
#endif
|
||||
} // ogg_status == PLAY
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue