sending data to /dev/dsp Solved.
- Date: Sat, 02 Sep 2017 21:46:29 -0500
- From: "Martin McCormick" <martin.m@xxxxxxxxxxxxxx>
- Subject: sending data to /dev/dsp Solved.
I was using audio samples from a radio and a named pipe
open for reading to get them in to the ring buffer. The ring
buffer code was old code which works but I snatched defeat from
the jaws of victory by using the read command instead of fread.
The read command gets text strings while fread is meant for
binary data which this happens to be as in 16-bit audio samples.
Using the read command against that pipe pretended to work but
seems to actually get nothing at all. It looked like whatever I
initialized the sample variable to stayed there and wasn't
ever changed at all.
So, that was one killer.
Another odd thing appears to be that uninitialized memory
such as that ring buffer is now cleaner than it used to be so
even without initializing it, no noise blasted out of the speaker
as if it is all zeroed out. Just to be safe, it is probably
better to set the buffer values to silence when starting up.
It all works now.