Author Topic: Linux: ALSA exclusive mode  (Read 120 times)

elan

  • Posts: 65
Linux: ALSA exclusive mode
« on: 5 May '22 - 23:07 »
Based on documentation, by default the Linux version opens the device in exclusive mode. I personally like this, but with a caveat—it would be great if BASS "let go" when paused for a while. We already detect this, and tried calling BASS_Pause, but apparently that isn't enough to close the ALSA device.

I assume you need BASS_Stop & BASS_Free for that, but I'm wondering if there's any reason BASS_Pause or BASS_Stop without the freeing doing do it (If we have to tear down the whole audio stack after being paused for a while it's a lot harder to get things started again vs pausing or stopping.)

Thanks!
« Last Edit: 6 May '22 - 01:19 by elan »

Ian @ un4seen

  • Administrator
  • Posts: 24424
Re: Linux: ALSA exclusive mode
« Reply #1 on: 6 May '22 - 12:33 »
Exclusive access is the standard ALSA mode of operation, with the "dmix" plugin and PulseAudio/PipeWire adding the ability to share a device. BASS doesn't currently totally release its ALSA resources until BASS_Free is called, so you would indeed probably need to call that. Doing that would also free any streams/etc that are using the device, but one way you could avoid that happening is by first moving them to the "No Sound" device via BASS_ChannelSetDevice. And then move them back again when you reinitialize the device.

elan

  • Posts: 65
Re: Linux: ALSA exclusive mode
« Reply #2 on: 7 May '22 - 03:11 »
OK, cool, we'll make it work with BASS_Free, thanks very much for the quick reply!