diff options
author | Eric Wong <e@80x24.org> | 2016-01-04 10:11:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-01-04 10:14:46 +0000 |
commit | 44248402de9050418c78fc994fc433cb1a6372ae (patch) | |
tree | 0f2e10dd86edd13510fc6f67fb9025a77069b98e /bin/dtas-console | |
parent | 83ab812ea560f5f327ea2df00f8f0292d96b1795 (diff) | |
download | dtas-44248402de9050418c78fc994fc433cb1a6372ae.tar.gz |
Try to take advantage of bypass being enabled for sample rate, then show the raw sample offset if we cannot get the rate.
Diffstat (limited to 'bin/dtas-console')
-rwxr-xr-x | bin/dtas-console | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/dtas-console b/bin/dtas-console index 298a809..5765cbd 100755 --- a/bin/dtas-console +++ b/bin/dtas-console @@ -149,17 +149,17 @@ begin fmt = "(#{fmt} > #{fmt})" end elsif cur['paused'] && infile = cur['current_paused'] - fmt = '(paused)' + fmt = "[paused] (#{fmt_to_s(pfmt)})" paused = true infile = infile['command'] if Hash === infile if Array === infile infile, elapsed = infile elapsed = elapsed.to_i samples = rate = 0 - begin - rate = qx(%W(soxi -r #{infile})).to_i - rescue => e - warn "#{e.message} (#{e.class})" + if (bypass = cur['bypass']) && bypass.include?('rate') + rate = pfmt['rate'].to_f + else + rate = qx(%W(soxi -r #{infile}), err: DTAS.null).to_i rescue 0 end elapsed /= rate.to_f if rate != 0 end @@ -176,7 +176,11 @@ begin total = " [#{Time.at(samples / rate).strftime(tfmt)}]" if samples != 0 Curses.setpos(lineno += 1, 0) Curses.clrtoeol - Curses.addstr("#{Time.at(elapsed).strftime(tfmt)}#{total} #{fmt}") + if rate != 0 + Curses.addstr("#{Time.at(elapsed).strftime(tfmt)}#{total} #{fmt}") + else + Curses.addstr("#{elapsed} samples #{total} #{fmt}") + end else Curses.setpos(lineno += 1, 0) Curses.clrtoeol |