Commit 77fa84f
Improve PulseAudio/PipeWire integration and audio device discovery (#240)
## Summary
This PR enhances Sendspin's audio output handling on Linux desktop
environments by properly identifying the application to the sound server
and improving the audio device discovery experience.
## Key Changes
- **PulseAudio/PipeWire metadata**: Added `_set_pulse_client_metadata()`
function that sets libpulse environment variables before client
connection, allowing the audio stream to register as "Sendspin" instead
of a generic "ALSA plug-in [python3]" name. Users can override these
defaults by setting their own environment variables.
- **Audio device recommendations**: Enhanced `list_audio_devices()` to
display recommended desktop audio routing options (`pulse`, `pipewire`,
`default`) when available, making it easier for users to choose
appropriate devices.
- **Improved help text**: Updated help documentation for the
`--audio-device` argument in both player and daemon modes to explicitly
mention that `pulse`, `pipewire`, and `default` are available routing
options on Linux desktops.
- **Automatic initialization**: The metadata setup is called
automatically in `main()` before argument parsing, ensuring proper
identification with the sound server from the start.
## Implementation Details
- The metadata function uses `os.environ.setdefault()` to respect user
overrides
- Recommended devices are filtered to only show those actually available
on the system
- The changes are backward compatible and only affect Linux desktop
environments using PulseAudio or PipeWire
https://claude.ai/code/session_01H1fE1RpT8dQd3FEhveB5qe
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 23a1760 commit 77fa84f
1 file changed
Lines changed: 40 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
66 | 85 | | |
67 | 86 | | |
68 | 87 | | |
| |||
106 | 125 | | |
107 | 126 | | |
108 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
109 | 141 | | |
110 | 142 | | |
111 | 143 | | |
| |||
146 | 178 | | |
147 | 179 | | |
148 | 180 | | |
149 | | - | |
| 181 | + | |
| 182 | + | |
150 | 183 | | |
151 | 184 | | |
152 | 185 | | |
| |||
375 | 408 | | |
376 | 409 | | |
377 | 410 | | |
378 | | - | |
379 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
380 | 415 | | |
381 | 416 | | |
382 | 417 | | |
| |||
693 | 728 | | |
694 | 729 | | |
695 | 730 | | |
| 731 | + | |
| 732 | + | |
696 | 733 | | |
697 | 734 | | |
698 | 735 | | |
| |||
0 commit comments