everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] dtas 0.18.1 - duct tape audio suite for *nix
@ 2021-02-13 21:59  5% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-02-13 21:59 UTC (permalink / raw)
  To: dtas-all, ruby-talk

Free Software command-line tools for audio playback, mastering, and
whatever else related to audio.  dtas follows the worse-is-better
philosophy and acts as duct tape to combine existing command-line tools
for flexibility and ease-of-development.  dtas is currently implemented
in Ruby (and some embedded shell), but may use other languages in the
future.

Changes:

    Mainly seek improvements to dtas-player.  The fallback to use
    charlock-holmes for strangely-encoded files is fixed.

    7 changes since 0.18.0 (2020-02-03):

          splitfx: reduce syscalls for writing comments file
          splitfx: support --err-suffix option
          player: fix +/- directional seeks while paused
          README: update and add more URLs for archives
          encoding: use CharlockHolmes properly on first run
          dtas-console: gracefully handle seek failures
          INSTALL: update dependencies for current Debian stable

* homepage: https://80x24.org/dtas/
* https://80x24.org/dtas/INSTALL
* https://80x24.org/dtas/dtas-player.txt
* https://80x24.org/dtas/NEWS.atom
* git clone https://80x24.org/dtas.git
* dtas-all@nongnu.org (plain-text only, no HTML mail, please)
* mail archives: https://80x24.org/dtas-all/
  nntps://news.public-inbox.org/inbox.comp.audio.dtas
  imaps://anon:mous@public-inbox.org/inbox.comp.audio.dtas.0
  nntp://ou63pmih66umazou.onion/inbox.comp.audio.dtas
  imap://anon:mous@ou63pmih66umazou.onion/inbox.comp.audio.dtas.0
  https://80x24.org/dtas-all/new.atom

note: .onion URLs require Tor: <https://www.torproject.org/>


^ permalink raw reply	[relevance 5%]

* [PATCH] player: fix +/- directional seeks while paused
@ 2020-05-25  9:10  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-05-25  9:10 UTC (permalink / raw)
  To: dtas-all

Using relative seek (Up/Dn/PgUp/PgDn) with dtas-console while
dtas-player is paused was causing non-sensical/confusing results
on unpause.

So clamp the minimum seek time to 0s the same way we clamp
during playback.
---
 lib/dtas/player/client_handler.rb | 36 +++++++++++++++++++------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index 6535f04..cf5442d 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -197,19 +197,20 @@ def __goto_offset_samples(offset)
     end
   end
 
+  def __offset_to_i(offset, src)
+    # either "999s" for 999 samples or HH:MM:SS for time
+    offset.sub!(/s\z/, '') ? offset.to_i : src.format.hhmmss_to_samples(offset)
+  end
+
   def __offset_to_samples(offset)
-    offset.sub!(/s\z/, '') and return offset.to_i
-    @current.format.hhmmss_to_samples(offset)
+    __offset_to_i(offset, @current)
   end
 
   # returns seek offset as an Integer in sample count
-  def __seek_offset_adj(dir, offset)
-    if offset.sub!(/s\z/, '')
-      offset = offset.to_i
-    else # time
-      offset = @current.format.hhmmss_to_samples(offset)
-    end
-    n = __current_decoded_samples + (dir * offset)
+  def __seek_offset_adj(dir, offset,
+                        src = @current,
+                        current_decoded_samples = __current_decoded_samples)
+    n = current_decoded_samples + (dir * __offset_to_i(offset, src))
     n = 0 if n < 0
     "#{n}s"
   end
@@ -391,15 +392,17 @@ def seek_internal(cur, offset)
     end
   end
 
+  def __offset_direction(offset)
+    offset.sub!(/\A\+/, '') ? 1 : (offset.sub!(/\A-/, '') ? -1 : nil)
+  end
+
   def dpc_seek(io, msg)
     offset = msg[0] or return io.emit('ERR usage: seek OFFSET')
     if @current
       if @current.respond_to?(:infile)
         begin
-          if offset.sub!(/\A\+/, '')
-            offset = __seek_offset_adj(1, offset)
-          elsif offset.sub!(/\A-/, '')
-            offset = __seek_offset_adj(-1, offset)
+          if direction = __offset_direction(offset)
+            offset = __seek_offset_adj(direction, offset)
           # else: pass to sox directly
           end
         rescue ArgumentError
@@ -413,7 +416,12 @@ def dpc_seek(io, msg)
       case file = @queue[0]
       when String
         @queue[0] = [ file, offset ]
-      when Array
+      when Array # offset already stored, adjust
+        if direction = __offset_direction(offset)
+          tmp = try_file(*file)
+          cur_off = __offset_to_i(file[1].dup, tmp)
+          offset = __seek_offset_adj(direction, offset, tmp, cur_off)
+        end
         file[1] = offset
       else
         return io.emit("ERR unseekable")


^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-05-25  9:10  7% [PATCH] player: fix +/- directional seeks while paused Eric Wong
2021-02-13 21:59  5% [ANN] dtas 0.18.1 - duct tape audio suite for *nix Eric Wong

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).