laziness, impatience, and hubris | |
PerlMonks |
Re: Audio Stream Bufferby Zaxo (Archbishop) |
on Jul 01, 2004 at 01:36 UTC ( [id://370954]=note: print w/replies, xml ) | Need Help?? |
I think that you will get better results from four-arg select or the higher level IO::Select. The select loop would allow several input packets to accumulate (with the .= operator) while a stalled write to *AUDIO_OUT is cooking. Once the delay in output is resolved, you'd have all the received data to pass along. That will be most effective if you have an intermediate child process which can quickly read and buffer what you write to it and handle writes to the audio player in its own good time. Update: Here's a fairly dumb example of a select loop. It reads from STDIN and writes to a child of open. Sorry I couldn't write closer to the problem, but my setup doesn't have alsasound installed. reds, your fork example looks pretty good, but I think I see the problem. The child process will be unable to see changes the parent makes in its copy of $buffer. You'd need to set up IPC between the two, like a pipe or socket, to pass data. After Compline,
In Section
Seekers of Perl Wisdom
|
|