helloSystem / Menu

Global menu bar written in Qt
43 stars 14 forks source link

Implement volume and audio device selection for FreeBSD #3

Closed probonopd closed 1 year ago

probonopd commented 3 years ago
user@FreeBSD$  mixer -s pcm 100
Setting the mixer pcm from 100:100 to 100:100.

user@FreeBSD$  mixer pcm 100
Setting the mixer pcm from 100:100 to 100:100.

GUI: DSBMixer

probonopd commented 3 years ago

@antranigv is looking into it.

probonopd commented 3 years ago

Also make it possible to switch the audio device. For example, list all available input and output devices in a right-click menu.

Needs to be done for already running as well as for newly started applications. Note that changing hw.snd.default_unit only applies to new open() calls to the default device names.

probonopd commented 3 years ago

https://unix.stackexchange.com/questions/361167/freebsd-no-automatic-switching-between-sound-in-speaker-and-built-in-headphones has some additional interesting information.

I have set hw.snd.default_auto=2 in the hope that it will automatically switch audio to the last plugged in device.

probonopd commented 3 years ago

Also make it possible to switch the audio device.

Roughly like this (the example is written in Python though):

https://github.com/yktoo/indicator-sound-switcher

image

grahamperrin commented 3 years ago

If I recall correctly … for For a range of audio devices to work reliably when factors include:

with some approaches to audio, special attention is required.

grahamperrin commented 3 years ago

From https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194727#c49:

… failure to suspend …

… essentially – wishing for improvements to the FreeBSD sleep/wake story:

  • I'd like a simple press on a button to not require forethought to audio, sound, pause, playback or USB

– the power button, preset to suspend. Thanks.

grahamperrin commented 3 years ago

https://github.com/helloSystem/Menu/issues/3#issuecomment-751477589

From https://github.com/yktoo/indicator-sound-switcher#readme:

… PulseAudio …

FreeBSD bug 194727 mentions PulseAudio-related patches but still, there's weirdness.

I'm almost certain that this system failure (Tuesday 2021-01-05 around 09:30) did not involve virtual_oss, so (given my system config) it must have been PulseAudio:

suspend failure

Excuse the poor photograph. Most memorable about this incident was that prior to the attempt to sleep the computer (HP EliteBook 8570p), I had done nothing overtly audio-related, so the failure to suspend was extremely weird. No recollection of playback at any web page (auto-play is disabled), and so on. A wild guess: maybe the attempt to suspend coincided with a beep/bleep from Konsole.


In any case: at the time of writing, is seems that virtual_oss may be less troublesome than PulseAudio.

Can we find a switcher that's not tied to PulseAudio?

probonopd commented 3 years ago

An initial volume menu entry is now available as a Developer Preview in the latest experimental builds - feel free to have a look at the code and to improve!

Relevant UX discussion: https://medium.com/@probonopd/make-it-simple-linux-desktop-usability-part-2-d34b86fd9b79