about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dtas-console19
-rwxr-xr-xbin/dtas-tl8
2 files changed, 18 insertions, 9 deletions
diff --git a/bin/dtas-console b/bin/dtas-console
index a98244b..a8e1838 100755
--- a/bin/dtas-console
+++ b/bin/dtas-console
@@ -114,6 +114,7 @@ def may_fail(res, events)
   events << res if res != "OK"
 end
 
+pre_mute_vol = 1.0
 enc_locale = Encoding.find("locale")
 $stdout.set_encoding(enc_locale)
 enc_opts = { undef: :replace, invalid: :replace, replace: '?' }
@@ -163,12 +164,18 @@ begin
       Curses.setpos(lineno += 1, 0)
       Curses.clrtoeol
     end
-
-    rgs = rg_string(cur["rg"] || {}, current)
+    rg = cur['rg'] || {}
+    rgs = rg_string(rg, current)
     Curses.setpos(lineno += 1, 0)
     Curses.clrtoeol
     Curses.addstr(rgs)
 
+    Curses.setpos(lineno += 1, 0)
+    Curses.clrtoeol
+    cur_vol = rg['volume'] || 1.0
+    Curses.addstr("volume=#{cur_vol}")
+    pre_mute_vol = cur_vol if cur_vol != 0
+
     show_events(lineno, screen, events)
 
     Curses.refresh # draw and wait
@@ -206,8 +213,12 @@ begin
         # yes, some of us have long audio files
         when Curses::KEY_PPAGE then c.req_ok("seek +600")
         when Curses::KEY_NPAGE then c.req_ok("seek -600")
-        when "9" then c.req_ok("rg preamp-=1")
-        when "0" then c.req_ok("rg preamp+=1")
+        when '9' then c.req_ok('rg volume-=0.01')
+        when '0' then c.req_ok('rg volume+=0.01')
+        when '=' then c.req_ok('rg volume=1')
+        when '7' then c.req_ok('rg preamp-=1')
+        when '8' then c.req_ok('rg preamp+=1')
+        when 'm' then c.req_ok("rg volume=#{cur_vol == 0 ? pre_mute_vol : 0}")
         when "F" then c.req_ok("rg fallback_gain+=1")
         when "f" then c.req_ok("rg fallback_gain-=1")
         when ">" then c.req_ok("tl next")
diff --git a/bin/dtas-tl b/bin/dtas-tl
index b682e2b..34fba81 100755
--- a/bin/dtas-tl
+++ b/bin/dtas-tl
@@ -105,7 +105,7 @@ when "cat"
   end
 when "addhead"
   ARGV.shift
-  ARGV.reverse.each do |path|
+  ARGV.reverse_each do |path|
     path = File.expand_path(path)
     res = c.req(%W(tl add #{path}))
     print "#{path} #{res}\n"
@@ -114,13 +114,11 @@ when "addtail"
   ARGV.shift
   track_ids = get_track_ids(c)
   last_id = track_ids.pop
-  ARGV.each do |path|
+  ARGV.reverse_each do |path|
     path = File.expand_path(path)
-    req = %W(tl add #{path})
-    req << last_id.to_s if last_id
+    req = %W(tl add #{path} #{last_id})
     res = c.req(req)
     print "#{path} #{res}\n"
-    last_id = res if res =~ /\A\d+\z/
   end
 when "reto"
   fixed = ARGV.delete("-F")