diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-10-10 09:10:51 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-10-10 09:10:51 +0000 |
commit | f260cd93067d81e7e5bc33d8f1b30f0639a1dc89 (patch) | |
tree | c4576e35450f0bb9257fd3fd8707811b755433b4 /lib/dtas/source/sox.rb | |
parent | 064e91d9b334f544d5ac2ff57d06d338dfcdb3d8 (diff) | |
download | dtas-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/source/sox.rb')
-rw-r--r-- | lib/dtas/source/sox.rb | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb index 484a0ec..2a54bb9 100644 --- a/lib/dtas/source/sox.rb +++ b/lib/dtas/source/sox.rb @@ -47,26 +47,8 @@ class DTAS::Source::Sox # :nodoc: source_file_dup(infile, offset) end - 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 format - @format ||= begin - fmt = DTAS::Format.new - path = @infile - fmt.channels = qx(@env, %W(soxi -c #{path})).to_i - fmt.type = qx(@env, %W(soxi -t #{path})).strip - fmt.rate = qx(@env, %W(soxi -r #{path})).to_i - fmt.bits ||= precision - fmt - end + @format ||= DTAS::Format.from_file(@env, @infile) end # This is the number of samples according to the samples in the source |