mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[sound] Add a threaded field to snd_t
Care needs to be taken when freeing channels as doing so while an asynchronous mixer is using them is unlikely to end well. However, whether the mixer is asynchronous depends on the output driver. This lets the driver inform the rest of the system that the output and mixer are running asynchronously.
This commit is contained in:
parent
48f704c84e
commit
fdd070f6dc
4 changed files with 5 additions and 1 deletions
|
@ -106,6 +106,7 @@ struct snd_s {
|
|||
int submission_chunk; //!< don't mix less than this #
|
||||
unsigned paintedtime; //!< sound clock in samples
|
||||
int framepos; //!< position of dma cursor
|
||||
int threaded; //!< output runs in a thread
|
||||
unsigned char *buffer; //!< destination for mixed sound
|
||||
/** Transfer mixed samples to the output.
|
||||
\param paintbuffer The buffer of mixed samples to be transferred.
|
||||
|
|
|
@ -186,7 +186,7 @@ static void
|
|||
s_stop_all_sounds (void)
|
||||
{
|
||||
SND_StopAllSounds (&snd);
|
||||
SND_ScanChannels (&snd, 0);
|
||||
SND_ScanChannels (&snd, snd.threaded);
|
||||
s_clear_buffer (&snd);
|
||||
}
|
||||
|
||||
|
|
|
@ -655,6 +655,8 @@ SNDDMA_Init (snd_t *snd)
|
|||
|
||||
snd->frames = buffer_size;
|
||||
|
||||
snd->threaded = 1;//XXX FIXME double check whether it's always true
|
||||
|
||||
// send the first period to fill the buffer
|
||||
// also sets snd->buffer
|
||||
if (alsa_process (pcm, snd) < 0) {
|
||||
|
|
|
@ -278,6 +278,7 @@ static int
|
|||
s_init (snd_t *snd)
|
||||
{
|
||||
snd->xfer = snd_jack_xfer;
|
||||
snd->threaded = 1;
|
||||
return s_jack_connect (snd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue