Re: [LAD] Real-time plotting of audio/ oscilloscope.

From: David Olofson <david@email-addr-hidden>
Date: Fri Jun 18 2010 - 03:37:20 EEST

On Friday 18 June 2010, at 02.09.43, Jeremy <jeremybubs@email-addr-hidden> wrote:
[...]
> After doing some more experimenting, I realize that SDL does not in fact
> cause any xruns if I don't ask it to refresh.

Of course. Depending on how you set up the SDL display, the pixel plotting may
actually just be raw memory access in a system RAM shadow buffer. No
scheduling/xrun issues with that, obviously. Refreshing, however, is where the
real work is done. Whether you're using SDL or the underlying APIs directly is
of no relevance here.

Realistically, for reliable operation in your average environment (X11,
Windows GDI, whatever...), there is only one solution: You need to move the
plotting into a separate thread. Could be a global GUI thread. What's critical
is that it's NOT the audio thread.

You may get away with just passing the coordinates (or raw samples) from the
audio thread to the rendering thread via a shared buffer, but the proper,
solid solution is to pass it in some synchronized manner, preferably lock-
free.

-- 
//David Olofson - Developer, Artist, Open Source Advocate
.--- Games, examples, libraries, scripting, sound, music, graphics ---.
|  http://olofson.net   http://kobodeluxe.com   http://audiality.org  |
|  http://eel.olofson.net  http://zeespace.net   http://reologica.se  |
'---------------------------------------------------------------------'
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Jun 18 04:15:03 2010

This archive was generated by hypermail 2.1.8 : Fri Jun 18 2010 - 04:15:03 EEST