Repository navigation
Add opt-in --release-device to close ALSA/PortAudio output on stream end - #100
Merged
chrisuthe merged 1 commit intoOct 27, 2026
Conversation
Lets other players take turns on an exclusive hw: DAC between Sendspin streams. Off by default: another app can take the device between streams, and every stream pays a cold open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--release-device/release-device = true. When it is set, the ALSA or PortAudio output is closed when a stream ends and reopened at the nextstream/start, so Squeezelite, AirPlay and Spotify can use the same exclusivehw:DAC between Sendspin streams. It is off by default because of the trade-off: another app can take the device between streams, and the next stream is then discarded through the existing per-stream refusal.AudioSink::release()defaults toclear(). ALSA and PortAudio override it to drop, close, forgetlast_format_and cancel any owed recovery, sopoll()never reopens a released device. A latewrite()discards without logging the device-lost error.PlayerListenerreleases before the stop hook fires, so a hook that starts another player finds the device free.SinkRecovery::cancel(), and the ordering of release vs clear relative to the stop event.Breaking changes: none for CLI users. The option is opt-in and default behaviour is unchanged.
Manual check still to do (needs hardware): Pi with
-o hw:...and--release-device. After a stop,/proc/asound/cardN/pcm0p/sub0/statusshould readclosed,aplay -D hw:...should succeed, and the next Sendspin stream should play.Closes #80