about summary refs log tree commit homepage
path: root/lib/dtas/splitfx.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-10 09:10:51 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-10 09:10:51 +0000
commitf260cd93067d81e7e5bc33d8f1b30f0639a1dc89 (patch)
treec4576e35450f0bb9257fd3fd8707811b755433b4 /lib/dtas/splitfx.rb
parent064e91d9b334f544d5ac2ff57d06d338dfcdb3d8 (diff)
downloaddtas-f260cd93067d81e7e5bc33d8f1b30f0639a1dc89.tar.gz
This reduces duplication for sox-based components, which our audio
editing components will rely on.  We only use avconv/ffmpeg for odd
formats which sox does not play natively, and editing audio in
strange/lossy formats is undesirable anyways.
Diffstat (limited to 'lib/dtas/splitfx.rb')
-rw-r--r--lib/dtas/splitfx.rb17
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb
index b83f7db..6f1654e 100644
--- a/lib/dtas/splitfx.rb
+++ b/lib/dtas/splitfx.rb
@@ -134,27 +134,12 @@ class DTAS::SplitFX # :nodoc:
     load_tracks!(hash)
   end
 
-  # FIXME: duplicate from dtas/source/sox
-  def precision
-    qx(@env, %W(soxi -p #@infile), err: "/dev/null").to_i # sox.git f4562efd0aa3
-  rescue # fallback to parsing the whole output
-    s = qx(@env, %W(soxi #@infile), err: "/dev/null")
-    s =~ /Precision\s+:\s*(\d+)-bit/n
-    v = $1.to_i
-    return v if v > 0
-    raise TypeError, "could not determine precision for #@infile"
-  end
-
   def load_input!(hash)
     @infile = hash["infile"] or raise ArgumentError, "'infile' not specified"
     if infmt = hash["infmt"] # rarely needed
       @infmt = DTAS::Format.load(infmt)
     else # likely
-      @infmt = DTAS::Format.new
-      @infmt.channels = qx(@env, %W(soxi -c #@infile)).to_i
-      @infmt.rate = qx(@env, %W(soxi -r #@infile)).to_i
-      @infmt.bits ||= precision
-      # we don't care for type
+      @infmt = DTAS::Format.from_file(@env, @infile)
     end
   end