Hi,
I'm having difficulties writing a simple alsa plugin that plays and captures from a socket.
The background is that there should be a "server" application that processes PCM data. In order to "connect" ALSA to that application I would like to use a socket.
I looked at the bluez bluetooth audio plugin which seems to do a similar task.
Basically the idea is that the alsa plugin transfer callback function just sends and receives PCM samples in periods to/from the socket (depending on whether the plugin is used for playback or capture).
To control the timing and to increment the hw_ptr a separate thread in the alsa plugin is used. Basically for each period the thread will increment the hw_ptr and signal to the alsa plugin that the next period can be written.
This signaling is done by using a pipe. As the plugin code is poll-based I guess it needs to poll both the socket and the pipe (which is used to communicate with the "timing" thread).
For this reason the alsa plugin would only write to the socket if the socket is ready for writing _and_ the time for writing the next period has come (which will be signaled by a write to the pipe by the timing thread).
Would such a implementation work so far ?
At the moment I'm having some real difficulties as for some reason the start callback function that would start the thread is not called at all. My code is pretty much the same as in the bluez bluetooth audio plugin.
cheers, stefan