On Sat, May 03, 2008 at 11:48:04AM -0700, Nick Thompson wrote: > I fully accept that my use of pulse might be somewhat unorthodox since > it is in a speciailsed embedded system, however I also think that > multiple device support and routing is of great interest, especially > to the music community. If you're part of the music community, you probably should be looking at Jack (http://jackaudio.org/). Except that even though it has marvelous support for routing audio, it doesn't support multiple devices directly. You might have success by using a program called Jack Diplomat (which connects multiple Jack servers). Better support for multiple sound cards is planned for future versions, but I don't expect it to happen anytime soon. > Phew. Anyway the second question was not really answered fully. It > might be my imprecision in stating the problem so let me try to > distill it to the bare bones: For pulseaudio I'd like to know how or > if a virtual stream can be created in pulse allowing on the fly > redirection to an ALSA sink, that is the crux of the question that I'm > searching for an answer. I'd like in an alsa program (or set of > programs) to write to a virtual device and have pulse route all audio > on that device to a sink, and be able to switch sinks on the fly. > I've spent a couple weeks looking into this and I think I've made > quite a lot of progress but that part is not clear. It's not possible with current virtual devices. The virtual devices that you can create don't allow their streams (the ones from the virtual device to the destination sinks) to be moved. > I could write a pulse module that will implement routing policy for > individual stream, but since streams are created often I'd need to to > track them (not too hard) and know when they are created (harder) and > set the routing before the stream starts (no sure how to do this). It > seems there might be an easier way, but I don't know what that is. Writing a module is one possibility. A virtual sink, of which master sink can be changed, doesn't sound a bad idea to me. module-remap-sink could be a good starting point, but I believe it would still take quite a bit of time to figure out the internal APIs. The "routing table" approach on the other hand could probably be done as a pulse client instead of a module. You could create one or more null sinks (one for each stream "class") and maybe set one of them as the default sink. Then your router program listens for new stream events, and if a stream is connected to one of the null sinks, it is added to the tracked streams list and is moved to the appropriate alsa sink. Not the prettiest solution, but it's the easiest I could come up with. -- Tanu Kaskinen