PromyLOPh / pianobar

Console-based pandora.com player
http://6xq.net/pianobar/
Other
1.74k stars 323 forks source link

Audio Output Switching #536

Open jrleeman opened 9 years ago

jrleeman commented 9 years ago

When switching audio outputs from system preferences in OS X 10.10.5 the audio disappears. Piano bar must be restarted to get it back after every output switch.

PromyLOPh commented 9 years ago

Can you set debug=1 in your ~/.libao and post a log of pianobar’s output immediately before/after switching audio outputs?

jrleeman commented 9 years ago

No problem. Just did it and found that if the song plays to completion, it will switch, but switching mid song either changes nothing or the audio totally dies. Looks like switching stations will make the audio switch properly too.

jleeman:~/ $ pianobar                                                                                                             [8:27:27]
debug: Loaded driver null (built-in)
debug: Loaded driver wav (built-in)
debug: Loaded driver raw (built-in)
debug: Loaded driver au (built-in)
debug: Loading driver plugins from /usr/local/Cellar/libao/1.2.0/lib/ao/plugins-4...
debug: Loaded driver macosx
Welcome to pianobar (2014.09.28)! Press ? for a list of commands.
[?] Email: jrl1209@psu.edu
[?] Password:
(i) Login... Ok.
(i) Get stations... Ok.
     0) q   Alternative Endurance Training Radio
     1) q   Antonio Vivaldi Radio
[?] Select station: 1
|>  Station "Antonio Vivaldi Radio" (1296840382709275929)
(i) Receiving new playlist... Ok.
|>  "Concerto Alla Rustica, For Strings & Continuo In G Major, RV 151" by "Vivaldi, Antonio" on "Takako Nishizaki, Vivaldi: The Four Seasons; Concerto Alla Rustica"
debug: Testing drivers to find playback default...
debug: ...testing macosx
debug: OK, using driver macosx
ao_macosx debug: Starting audio output unit
|>  "Cavalleria Rusticana, Opera (Melodramma) In 1 Act" by "Mascagni, Pietro" on "National Philharmonic Orchestra, Mascagni: Cavalleria Rusticana"
debug: Testing drivers to find playback default...
debug: ...testing macosx
debug: OK, using driver macosx
ao_macosx debug: Starting audio output unit
PromyLOPh commented 9 years ago

No problem. Hm, the “debug” output is a little less verbose than I though.

Just did it and found that if the song plays to completion, it will switch, but switching mid song either changes nothing or the audio totally dies. Looks like switching stations will make the audio switch properly too. That makes sense. We’re closing and reopening the audio device every time a new song is played. So I assume the problem is that ao_play’s return value is unchecked. Does this patch (https://gist.github.com/b58e5abca81e96a3fa57) fix the issue?

jrleeman commented 9 years ago

Just re-compiled with that patch and still have to wait until the end of the song for the audio output device to change.

PromyLOPh commented 9 years ago

So apparently libao does not signal this change to the application. That’s a case for libao’s issue tracker I suppose. Please report it at https://trac.xiph.org/, reference this issue and post a link here afterwards.

jrleeman commented 9 years ago

Issue tracker link: https://trac.xiph.org/ticket/2217

serpico7456 commented 3 years ago

Updated issue tracker link (moved from Trac to GitLab): https://gitlab.xiph.org/xiph/libao/-/issues/2217

Doesn't appear to be any progress in libao in the last 5 years. Workaround of Ctrl-C (SIGINT) works well (may be ~5 sec delay)--suggested by @PromyLOPh in #589

yebo29 commented 3 years ago

I'm thankful there's at least a workaround! I just used Ctrl+c and it worked for me as well.