That's a lot of inputs, thanks very very much! It'll take me a while to digest and try out your various suggestions. I expect to report back within a week.
-mandar Mike Kazantsev wrote (Fri, Oct 30, 2020 at 10:07:22PM +0500): > On Fri, 30 Oct 2020 22:01:43 +0530 > Mandar Mitra <[email protected]> wrote: > > > I can use the mate volume control applet to switch between the > > builtin speakers on my computer and an external speaker connected via > > bluetooth. > > Other applications like Firefox and mpv (played from the command-line) > > send the output to whatever is currently selected as the sound sink, > > With mpv this should probably happens when you start a fresh instance, > so it selects new default sink, but if you start mpv before switching, > it won't auto-migrate running playback stream to a new sink, correct? > > > > but emms seems to always send output to the default builtin speaker, > > even when a bluetooth speaker is connected and selected in the volume > > control applet. > > If you use mpv as a player in emms, then it should use a long-running > mpv process that doesn't get restarted between tracks by default. > > It does however close and re-open the output stream for each track, > which might play on the new default sink, so that might be a hacky fix, > if the issue is only with currently-playing stuff - hit "stop" and then > "play" key. > Not a nice fix though, obviously. > > (not entirely sure if mpv/libpulse will use different sink for new > stream, but it probably should, unless directed to do otherwise via > e.g. PULSE_SINK env option) > > > > I can probably use the discussion here > > > > https://askubuntu.com/questions/71863/how-to-change-pulseaudio-sink-with-pacmd-s > > et-default-sink-during-playback > > > > and cobble together an elisp function to run the necessary shell commands, > > but > > don't know how to integrate this into emms. > > To be clear, one of the essential commands that you're talking about is > something like "pactl move-sink-input 5 1"? > I.e. to move currently-playing music stream to a new sink? > > As I assume that you change default sink in the desktop environment > applet already (as otherwise not sure what else it might be doing), > so there's no need to run that part from the link. > > > > Could you please give me a hint or two -- maybe point me to which .el files > > I > > should look at for more info? Or let me know that this is not easily doable? > > Do you want emacs or emms to detect when default sink in pulseaudio > changes and migrate running mpv playback stream to a new default sink? > > Don't think it has much to do with emms, as it doesn't monitor > pulseaudio state in any way, and doesn't really know that it even > exists, as only mpv interacts with it, if it is the output configured > there. > > I'd suggest these options: > > - Checking DE volume applet for some hook that it might run when > changing sinks and adding a script there to also migrate any running > streams. > > - Contacting applet devs, asking if there's an option to do that, and > maybe considering adding it, as it sounds generally useful. > > - Making a script that'd do that independently of emms (as again, it > shouldn't have much to do with this). > > For example, with shell, guess you can monitor "pactl subscribe" > output and react to relevant sink state changes there. > Or you can make same script with e.g. python, elisp or in any other > language, of course, some of which have more convenient libpulse > bindings. > > But feel like maybe I've misunderstood the question, given how it seem > to be directed to this mailing list, while having little to do with > emms in my current understanding. > >
