<div>Hi All,</div><div><br></div><div>Firstly apologies if my audio domain terminology is incorrect, I'm new to the topic currently exploring ways to solve the task I have, and would like to check that PulseAudio is the right tool for the job.</div>
<div><br></div>I'm currently looking to implement an audio switching solution on Meego initially just taking inputs from multiple ALSA sources and controlling which audio stream is currently the 'active' stream and routed to a single output. Eventually I'll want to add in more complexity, by routing the audio through custom sound effects modules (Echo cancellation and the like), and by having a routing policy to make decisions based on the needs of the sources, e.g. requires exclusive use of the single output, or can be mixed together, etc.<div>
<br></div><div>My initial approach has been to create two virtual ALSA devices by editing the /etc/asound.conf (or rather the default pulse file which is hooked to).</div><div><br></div><div><font face="'courier new', monospace">pcm.virtual01 {</font></div>
<div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="'courier new', monospace">type pulse</font></div></blockquote><font face="'courier new', monospace">}</font></div><div><font face="'courier new', monospace"><br>
</font></div><div><font face="'courier new', monospace">pcm.virtual02 {</font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="'courier new', monospace">type pulse</font></div>
</blockquote><div><font face="'courier new', monospace">}</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">As an initial test I then played two audio tracks, one at each virtual devices and fired up the 'pacmd' CLI to experiment with manipulating the two sources.</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><span style="font-family:arial,helvetica,sans-serif">If my understanding of what is happening is correct, both of these virtual devices, (and indeed all the ALSA audio on the platform) are first collated into an ALSA plugin which then feeds into PulseAudio.</span></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">With the CLI I am able to see that the instances of the application used to play the streams are identified as 'sink inputs', and I am able to mute or re-route a sink input to a null output sink by means of the CLI commands.</font></div>
<div><span style="font-family:arial,helvetica,sans-serif">However, the sink inputs are identified and manipulated by their index, and I cannot seen any obvious way to map a sink input to the virtual ALSA device source, as the source looks to be the ALSA plugin.</span></div>
<div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">Ultimately I want to expose the switching functionality via a C++ API so will need to accomplish this via the Async PulseAudio API.</span></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Can PulseAudio form a framework for what I am trying to achieve or am I misconstruing its purpose?</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Regards,</font></div><div><font face="arial, helvetica, sans-serif">Tez</font></div>