everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Rene Maurer <rmnet@mailc.net>
Cc: dtas-all@nongnu.org
Subject: [PATCH] player: automatically pause if last sink dies
Date: Sat, 2 Nov 2019 21:16:54 +0000	[thread overview]
Message-ID: <20191102211654.GA17315@dcvr> (raw)
In-Reply-To: <874l0kb9qm.fsf@loco10.cumparsita.ch>

Attempting to play (and fail) every song in the queue or
tracklist is not ideal when a the USB/HDMI cable to the sound
device gets unplugged by accident.

When tee-ing to multiple sinks, we will still gracefully continue
if one goes dead and there are remaining sinks.

Suggested-by: Rene Maurer
Link: https://80x24.org/dtas-all/874l0kb9qm.fsf@loco10.cumparsita.ch/
---
 lib/dtas/player.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index 37f2c96..61d29d2 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -282,7 +282,7 @@ def sink_death(sink, status)
     if deleted[0]
       warn("#{sink.name} died unexpectedly: #{status.inspect}")
       deleted.each { |t| drop_target(t) }
-      __current_drop unless @targets[0]
+      do_pause unless @targets[0]
       return # sink stays dead if it died unexpectedly
     end
 
@@ -451,7 +451,7 @@ def __current_drop(src = @current)
   # pull data from sink_buf into @targets, source feeds into sink_buf
   def sink_iter
     wait_iter = broadcast_iter(@sink_buf, @targets)
-    __current_drop if nil == wait_iter # sink error, stop source
+    do_pause if nil == wait_iter # sink error, stop source
     return wait_iter if @current
 
     # no source left to feed sink_buf, drain the remaining data


  parent reply	other threads:[~2019-11-02 21:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 20:07 sound card interruptions Rene Maurer
2019-10-08  8:32 ` Eric Wong
2019-10-08 12:03   ` Rene Maurer
2019-11-02 21:16 ` Eric Wong [this message]
2019-11-10  7:36   ` [PATCH] player: automatically pause if last sink dies Rene Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://80x24.org/dtas/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191102211654.GA17315@dcvr \
    --to=e@80x24.org \
    --cc=dtas-all@nongnu.org \
    --cc=rmnet@mailc.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/dtas.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).