Re: [LAD] need help mixing on the fly

From: Fons Adriaensen <fons@email-addr-hidden>
Date: Sun Feb 19 2017 - 16:43:07 EET

On Sun, Feb 19, 2017 at 01:47:39PM +0000, David Griffith wrote:

> A mixer thread is spawned when Frotz starts up. It waits for one or
> both float buffers to fill whereupon it mixes their contents,
> converts the result to pcm16 and calls libao to play it. playaiff()
> or playmusic() are spawned by the main thread as separate threads to
> read audio data from the container IFF and fill up the float buffers
> for the mixer to read.

/me looks at code...

This is all so horribly wrong that I don't know where to be
begin. Honestly, I'm surprised it works at all (assuming it
does, with one source).

But the main error seems to be the way the audio_full and
audio_empty semas are used. If there are two producers,
audio_full is posted twice. And then the two producers
are waiting on the same sema, audio_empty. This can't
work ever. It's not some small bug -- the entire logic
and structure of this code is just wrong.

Apart from that, if this code is meant to be Linux only,
consider using ALSA or Jack. If not, consider something
like Portaudio. OSS and everything built on it have been
deprecated for at least 12 years now.

Ciao,

-- 
FA
A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sun Feb 19 20:15:01 2017

This archive was generated by hypermail 2.1.8 : Sun Feb 19 2017 - 20:15:01 EET