Hello Stk-users/devs,<br><br>I&#39;ve been working on fixing STK&#39;s alsa backend so that RtApiAlsa doesn&#39;t hog the sound device it&#39;s using (i.e. other programs can use it at the same time). I&#39;ve been doing the work on github, in an appropriately-named &quot;fix_alsa&quot; branch:<br>
<br><a href="https://github.com/tmatth/stk/tree/fix_alsa">https://github.com/tmatth/stk/tree/fix_alsa</a><br><br>There are two things that had to be changed:<br>1) snd_pcm_open needed to be called with the SND_PCM_NONBLOCK flag, not the SND_PCM_ASYNC flag. The SND_PCM_ASYNC flag just causes SIGIO to be emitted every period (which wasn&#39;t getting handled anywhere). Furthermore, when writing to the device in NONBLOCK mode, you have to wait on the device before writing to it (with snd_pcm_wait).<br>
2) The interface to use by default should be &quot;default&quot;, not &quot;hw:0&quot;. This is because using the hw:0 interface name means ALSA will try to open it for exclusive use. The device pointed to by &quot;default&quot; can be changed in one&#39;s .asoundrc file.<br>
<br>The second point is a bit trickier, because RtAudio by default expects to be able to enumerate the devices by number. ALSA is expecting devices to be specified by name rather than number, that&#39;s why defaulting the first device is not great behaviour. In my branch, currently I set the device name to &quot;default&quot; unless the user has specified the HOG_DEVICE flag in their stream parameters, in which case it will grab the interface corresponding to the integer deviceID. I discussed this a bit off-list with Stephen Sinclair, but wanted more feedback since it seems like a poor solution.<br>
<br>Best,<br>Tristan<br><br clear="all"><br>-- <br>Tristan Matthews<br>email: <a href="mailto:tristan@sat.qc.ca">tristan@sat.qc.ca</a><br>web: <a href="http://tristanswork.blogspot.com">http://tristanswork.blogspot.com</a><br>