dtas 0.13.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Documentation/.gitignore +1 -0
  3. data/Documentation/GNUmakefile +28 -5
  4. data/Documentation/dtas-archive.pod +74 -0
  5. data/Documentation/dtas-console.pod +94 -0
  6. data/Documentation/{dtas-ctl.txt → dtas-ctl.pod} +21 -19
  7. data/Documentation/dtas-cueedit.pod +38 -0
  8. data/Documentation/dtas-enq.pod +43 -0
  9. data/Documentation/dtas-env.pod +75 -0
  10. data/Documentation/{dtas-msinkctl.txt → dtas-msinkctl.pod} +18 -14
  11. data/Documentation/{dtas-player.txt → dtas-player.pod} +34 -33
  12. data/Documentation/dtas-player_effects.pod +103 -0
  13. data/Documentation/dtas-player_protocol.pod +460 -0
  14. data/Documentation/{dtas-player_sink_examples.txt → dtas-player_sink_examples.pod} +25 -21
  15. data/Documentation/{dtas-sinkedit.txt → dtas-sinkedit.pod} +34 -24
  16. data/Documentation/{dtas-sourceedit.txt → dtas-sourceedit.pod} +34 -25
  17. data/Documentation/dtas-splitfx.pod +271 -0
  18. data/Documentation/dtas-tl.pod +129 -0
  19. data/Documentation/dtas-xdelay.pod +96 -0
  20. data/Documentation/update-footer.rb +16 -12
  21. data/GIT-VERSION-GEN +1 -1
  22. data/GNUmakefile +1 -1
  23. data/INSTALL +3 -3
  24. data/Rakefile +11 -4
  25. data/bin/dtas-console +1 -1
  26. data/bin/dtas-mlib +3 -1
  27. data/bin/dtas-tl +0 -1
  28. data/lib/dtas/format.rb +1 -1
  29. data/lib/dtas/mlib.rb +28 -19
  30. data/lib/dtas/partstats.rb +1 -1
  31. data/lib/dtas/player.rb +1 -1
  32. data/lib/dtas/player/client_handler.rb +18 -4
  33. data/lib/dtas/source/av_ff_common.rb +1 -0
  34. data/lib/dtas/source/mp3gain.rb +1 -1
  35. data/lib/dtas/source/sox.rb +8 -4
  36. data/lib/dtas/source/splitfx.rb +4 -0
  37. data/lib/dtas/tracklist.rb +19 -8
  38. metadata +20 -18
  39. data/Documentation/dtas-archive.txt +0 -62
  40. data/Documentation/dtas-console.txt +0 -73
  41. data/Documentation/dtas-cueedit.txt +0 -36
  42. data/Documentation/dtas-enq.txt +0 -41
  43. data/Documentation/dtas-env.txt +0 -60
  44. data/Documentation/dtas-player_effects.txt +0 -57
  45. data/Documentation/dtas-player_protocol.txt +0 -326
  46. data/Documentation/dtas-splitfx.txt +0 -188
  47. data/Documentation/dtas-tl.txt +0 -96
  48. data/Documentation/dtas-xdelay.txt +0 -76
@@ -160,7 +160,7 @@ def run(opts = {})
160
160
 
161
161
  def parse_stats(stats, trim_part, buf)
162
162
  trim_row = [ trim_part ]
163
- buf.split(/\n/).each do |line|
163
+ buf.split("\n").each do |line|
164
164
  do_map = true
165
165
  case line
166
166
  when /\A(\S+ \S+ dB)\s/, /\A(Crest factor)\s+-\s/
@@ -115,7 +115,7 @@ def to_hsh
115
115
  unless @sinks.empty?
116
116
  sinks = rv["sinks"] = []
117
117
  # sort sinks by name for human viewability
118
- @sinks.keys.sort.each do |name|
118
+ @sinks.keys.sort!.each do |name|
119
119
  sinks << @sinks[name].to_hsh
120
120
  end
121
121
  end
@@ -122,7 +122,7 @@ def dpc_sink(io, msg)
122
122
  name = msg[1]
123
123
  case msg[0]
124
124
  when "ls"
125
- io.emit(xs(@sinks.keys.sort))
125
+ io.emit(xs(@sinks.keys.sort!))
126
126
  when "rm"
127
127
  sink = @sinks.delete(name) or return io.emit("ERR #{name} not found")
128
128
  drop_sink(sink)
@@ -422,7 +422,7 @@ def dpc_restart(io, _)
422
422
  def dpc_format(io, msg)
423
423
  new_fmt = @format.dup
424
424
  msg.each do |kv|
425
- k, v = kv.split(/=/, 2)
425
+ k, v = kv.split('=', 2)
426
426
  case k
427
427
  when "type"
428
428
  new_fmt.valid_type?(v) or return io.emit("ERR invalid file type")
@@ -484,7 +484,7 @@ def dpc_source(io, msg)
484
484
  __current_requeue
485
485
  return io.emit("OK")
486
486
  when "ls"
487
- s = map.keys.sort { |a,b| map[a].tryorder <=> map[b].tryorder }
487
+ s = map.keys.sort! { |a,b| map[a].tryorder <=> map[b].tryorder }
488
488
  return io.emit(s.join(' '))
489
489
  end
490
490
 
@@ -497,7 +497,7 @@ def dpc_source(io, msg)
497
497
  before = src.to_state_hash.inspect
498
498
  sd = src.source_defaults
499
499
  msg.each do |kv|
500
- k, v = kv.split(/=/, 2)
500
+ k, v = kv.split('=', 2)
501
501
  case k
502
502
  when "command"
503
503
  src.command = v.empty? ? sd[k] : v
@@ -630,6 +630,20 @@ def _dpc_tl_shuffle(io, msg)
630
630
  io.emit("tl shuffle #{prev}")
631
631
  end
632
632
 
633
+ def _dpc_tl_consume(io, msg)
634
+ prev = (!!@tl.consume).to_s
635
+ v = msg.shift
636
+ case v
637
+ when nil
638
+ else
639
+ set_bool(io, 'tl consume', v) do |b|
640
+ @tl.consume = b
641
+ __wall("tl consume #{b}")
642
+ end
643
+ end
644
+ io.emit("tl consume #{prev}")
645
+ end
646
+
633
647
  def _dpc_tl_max(io, msg)
634
648
  prev = @tl.max
635
649
  case msg.shift
@@ -19,6 +19,7 @@ module DTAS::Source::AvFfCommon # :nodoc:
19
19
 
20
20
  attr_reader :precision # always 32
21
21
  attr_reader :format
22
+ attr_reader :duration
22
23
 
23
24
  def try(infile, offset = nil, trim = nil)
24
25
  rv = source_file_dup(infile, offset, trim)
@@ -16,7 +16,7 @@ def mp3gain_comments
16
16
  case @infile
17
17
  when String
18
18
  @infile =~ /\.mp[g23]\z/in or return
19
- qx(%W(mp3gain -s c #@infile)).split(/\n/).each do |line|
19
+ qx(%W(mp3gain -s c #@infile)).split("\n").each do |line|
20
20
  case line
21
21
  when /^Recommended "(Track|Album)" dB change:\s*(\S+)/
22
22
  tmp["REPLAYGAIN_#{$1.upcase}_GAIN"] = $2
@@ -21,8 +21,7 @@ class DTAS::Source::Sox # :nodoc:
21
21
  )
22
22
 
23
23
  # we use this to be less noisy when seeking a file
24
- @last_failed = nil
25
- def self.try_to_fail_harder(infile, s, cmd)
24
+ def try_to_fail_harder(infile, s, cmd)
26
25
  msg = nil
27
26
  case s
28
27
  when %r{\A0\s*\z} then msg = "detected zero samples"
@@ -37,6 +36,7 @@ def self.try_to_fail_harder(infile, s, cmd)
37
36
  end
38
37
 
39
38
  def initialize
39
+ @last_failed = nil
40
40
  command_init(SOX_DEFAULTS)
41
41
  end
42
42
 
@@ -45,7 +45,7 @@ def try(infile, offset = nil, trim = nil)
45
45
  cmd = %W(soxi -s #{infile})
46
46
  s = qx(@env.dup, cmd, err_str: err, no_raise: true)
47
47
  return if err =~ /soxi FAIL formats:/
48
- self.class.try_to_fail_harder(infile, s, cmd) or return
48
+ try_to_fail_harder(infile, s, cmd) or return
49
49
  source_file_dup(infile, offset, trim)
50
50
  end
51
51
 
@@ -53,6 +53,10 @@ def format
53
53
  @format ||= DTAS::Format.from_file(@env, @infile)
54
54
  end
55
55
 
56
+ def duration
57
+ samples / format.rate.to_f
58
+ end
59
+
56
60
  # This is the number of samples according to the samples in the source
57
61
  # file itself, not the decoded output
58
62
  def samples
@@ -71,7 +75,7 @@ def __load_comments
71
75
  key, value = line.split('=', 2)
72
76
  key && value or next
73
77
  # TODO: multi-line/multi-value/repeated tags
74
- tmp[key.upcase] = value
78
+ tmp[key.upcase.freeze] = value
75
79
  end
76
80
  end
77
81
  tmp
@@ -107,6 +107,10 @@ def samples
107
107
  @sox.samples
108
108
  end
109
109
 
110
+ def duration
111
+ @sox.duration
112
+ end
113
+
110
114
  def source_defaults
111
115
  SPLITFX_DEFAULTS
112
116
  end
@@ -12,11 +12,13 @@ class DTAS::Tracklist # :nodoc:
12
12
  attr_accessor :repeat # true, false, 1
13
13
  attr_reader :shuffle # false or shuffled @list
14
14
  attr_accessor :max # integer
15
+ attr_accessor :consume # boolean
15
16
 
16
17
  TL_DEFAULTS = {
17
18
  'pos' => -1,
18
19
  'repeat' => false,
19
20
  'max' => 20_000,
21
+ 'consume' => false,
20
22
  }
21
23
  SIVS = TL_DEFAULTS.keys
22
24
 
@@ -116,20 +118,25 @@ def tracks
116
118
  def advance_track(repeat_ok = true)
117
119
  cur = @shuffle || @list
118
120
  return if cur.empty?
121
+ prev = cur[@pos] if @consume && @pos >= 0
119
122
  # @repeat == 1 for single track repeat
120
123
  repeat = repeat_ok ? @repeat : false
121
124
  next_pos = @goto_pos || @pos + (repeat == 1 ? 0 : 1)
122
125
  next_off = @goto_off # nil by default
123
126
  @goto_pos = @goto_off = nil
124
- if cur[next_pos]
127
+
128
+ if nxt = cur[next_pos]
125
129
  @pos = next_pos
130
+ remove_track(prev.track_id) if prev
126
131
  else
132
+ remove_track(prev.track_id) if prev
127
133
  # reshuffle the tracklist when we've exhausted it
128
134
  cur.shuffle! if @shuffle
129
- return unless repeat
135
+ return if !repeat || cur.empty?
130
136
  next_pos = @pos = 0
137
+ nxt = cur[0]
131
138
  end
132
- [ cur[next_pos].to_path, next_off ]
139
+ [ nxt.to_path, next_off ]
133
140
  end
134
141
 
135
142
  def cur_track
@@ -189,14 +196,18 @@ def _idx_of(list, track_id)
189
196
 
190
197
  def remove_track(track_id)
191
198
  idx = _idx_of(@list, track_id) or return false
199
+ track = @list.delete_at(idx)
192
200
  if @shuffle
193
- si = _idx_of(@shuffle, track_id) or return false
194
- @shuffle.delete_at(si)
201
+ idx = _idx_of(@shuffle, track_id) or return false
202
+ @shuffle.delete_at(idx)
195
203
  end
196
- track = @list.delete_at(idx)
197
204
  len = @list.size
198
- @pos = len - 1 if @pos >= len
199
- @goto_pos = @goto_pos = nil # TODO: reposition?
205
+ if @pos >= len
206
+ @pos = len - 1
207
+ elsif idx <= @pos
208
+ @pos -= 1
209
+ end
210
+ @goto_pos = @goto_off = nil # TODO: reposition?
200
211
  track.to_path
201
212
  end
202
213
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dtas hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-17 00:00:00.000000000 Z
11
+ date: 2016-01-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Free Software command-line tools for audio playback, mastering, and
@@ -42,22 +42,22 @@ files:
42
42
  - COPYING
43
43
  - Documentation/.gitignore
44
44
  - Documentation/GNUmakefile
45
- - Documentation/dtas-archive.txt
46
- - Documentation/dtas-console.txt
47
- - Documentation/dtas-ctl.txt
48
- - Documentation/dtas-cueedit.txt
49
- - Documentation/dtas-enq.txt
50
- - Documentation/dtas-env.txt
51
- - Documentation/dtas-msinkctl.txt
52
- - Documentation/dtas-player.txt
53
- - Documentation/dtas-player_effects.txt
54
- - Documentation/dtas-player_protocol.txt
55
- - Documentation/dtas-player_sink_examples.txt
56
- - Documentation/dtas-sinkedit.txt
57
- - Documentation/dtas-sourceedit.txt
58
- - Documentation/dtas-splitfx.txt
59
- - Documentation/dtas-tl.txt
60
- - Documentation/dtas-xdelay.txt
45
+ - Documentation/dtas-archive.pod
46
+ - Documentation/dtas-console.pod
47
+ - Documentation/dtas-ctl.pod
48
+ - Documentation/dtas-cueedit.pod
49
+ - Documentation/dtas-enq.pod
50
+ - Documentation/dtas-env.pod
51
+ - Documentation/dtas-msinkctl.pod
52
+ - Documentation/dtas-player.pod
53
+ - Documentation/dtas-player_effects.pod
54
+ - Documentation/dtas-player_protocol.pod
55
+ - Documentation/dtas-player_sink_examples.pod
56
+ - Documentation/dtas-sinkedit.pod
57
+ - Documentation/dtas-sourceedit.pod
58
+ - Documentation/dtas-splitfx.pod
59
+ - Documentation/dtas-tl.pod
60
+ - Documentation/dtas-xdelay.pod
61
61
  - Documentation/update-footer.rb
62
62
  - GIT-VERSION-FILE
63
63
  - GIT-VERSION-GEN
@@ -144,10 +144,12 @@ files:
144
144
  - man/dtas-archive.1
145
145
  - man/dtas-console.1
146
146
  - man/dtas-ctl.1
147
+ - man/dtas-cueedit.1
147
148
  - man/dtas-enq.1
148
149
  - man/dtas-env.7
149
150
  - man/dtas-msinkctl.1
150
151
  - man/dtas-player.1
152
+ - man/dtas-player_effects.7
151
153
  - man/dtas-player_protocol.7
152
154
  - man/dtas-player_sink_examples.7
153
155
  - man/dtas-sinkedit.1
@@ -1,62 +0,0 @@
1
- % dtas-archive(1) dtas user manual
2
- %
3
-
4
- # NAME
5
-
6
- dtas-archive - paranoid audio file copy
7
-
8
- # SYNOPSYS
9
-
10
- dtas-archive [OPTIONS] SOURCE DESTINATION
11
-
12
- # DESCRIPTION
13
-
14
- dtas-archive is intended for archiving audio data to/from laptops,
15
- marginal USB ports, and computers without ECC memory, attempting
16
- to read data multiple times in an attempt to detect memory or
17
- bus corruption. dtas-archive may only be effective on machines
18
- running the Linux kernel where posix_fadvise(2) can be used to
19
- drop caches for a particular file after fsync(2).
20
-
21
- dtas-archive spawns sox(1) to archive audio data (likely uncompressed
22
- WAVE) to FLAC and verifies the result using sndfile-cmp(1), a tool
23
- implemented by different than sox and less likely to share the same bugs
24
- (if any) as sox.
25
-
26
- # OPTIONS
27
-
28
- -j, \--jobs [JOBS]
29
- : Number of jobs to run in parallel. Incrementing this may hurt
30
- performance on slow storage devices. Default: 1
31
-
32
- -n, \--dry-run
33
- : Print, but do not run the commands to be executed
34
-
35
- -s, \--quiet, \--silent
36
- : Silent operation, commands are not printed as executed
37
-
38
- -S, \--stats
39
- : Run and save the text output of the sox "stats" effect as
40
- $DESTINATION_FILE_WITHOUT_SUFFIX.stats next to the output file
41
-
42
- -k, \--keep-going
43
- : Continue after error
44
-
45
- -r, \--repeat [COUNT]
46
- : Number of times to repeat the sndfile-cmp(1) check. Default: 1
47
-
48
- # COPYRIGHT
49
-
50
- Copyright 2015-2016 all contributors <dtas-all@nongnu.org>.\
51
- License: GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.txt>
52
-
53
- # CONTACT
54
-
55
- All feedback welcome via plain-text mail to: <dtas-all@nongnu.org>\
56
- Mailing list archives available at <http://80x24.org/dtas-all/> and
57
- <ftp://lists.gnu.org/dtas-all/>\
58
- No subscription is necessary to post to the mailing list.
59
-
60
- # SEE ALSO
61
-
62
- sndfile-cmp(1), sox(1)
@@ -1,73 +0,0 @@
1
- % dtas-console(1) dtas user manual
2
-
3
- # NAME
4
-
5
- dtas-console - rudimentary curses console client for dtas-player
6
-
7
- # SYNOPSIS
8
-
9
- dtas-console
10
-
11
- # DESCRIPTION
12
-
13
- dtas-console displays the elapsed decoder time of the track, which can be
14
- used as an approximation of the current playback time of a track.
15
-
16
- It cannot display an accurate playback time due to variable buffering
17
- in the sinks and pipes.
18
-
19
- See dtas-player_protocol(7) for a detailed description of the protocol.
20
-
21
- # KEYBOARD CONTROL
22
-
23
- Key bindings are inspired partially by mplayer(1)
24
-
25
- - 'j'/'k' - seek backward/forward 5 seconds
26
- - LEFT/RIGHT - seek backward/forward 10 seconds
27
- - UP/DOWN - seek forward/backward 1 minute
28
- - PGUP/PGDWN - seek forward/backward 10 minutes
29
- - SPACE - toggle play/pause state of the playback
30
- - 'p'/'P' - decrease/increase timer resolution
31
- - BACKSPACE - seek to the beginning of the track
32
- - 7/8 - decrease/increase ReplayGain preamp
33
- - 9/0 - decrease/increase software volume
34
- - '=' - set software volume to 1.0 (no adjustment)
35
- - 'm' - mute set software volume to 0.0 (mute)
36
- - 'f'/'F' - decrease/increase ReplayGain fallback_gain value
37
- - 'r'/'R' - cycle forward/backwards through ReplayGain modes
38
- - 'q'/Ctrl-C - exit dtas-console
39
- - 'o' - toggle display between HH:MM:SS and absolute seconds
40
-
41
- # ENVIRONMENT
42
-
43
- DTAS_PLAYER_SOCK - the path to the dtas-player control socket.
44
- This defaults to ~/.dtas/player.sock
45
-
46
- # CAVEATS
47
-
48
- Increasing timer resolution increases the number of CPU wakeups and
49
- power consumption. This defeats the efforts of dtas-player
50
- configurations which use large buffers (especially in the sink) to
51
- reduce wakeups and power consumption.
52
-
53
- In rare cases (or poorly-configured systems), increased wakeups from
54
- dtas-console will also increase contention with the sound card,
55
- negatively affecting audio quality even if CPU utilization is not
56
- a problem.
57
-
58
- # CONTACT
59
-
60
- All feedback welcome via plain-text mail to: <dtas-all@nongnu.org>\
61
- Mailing list archives available at <http://80x24.org/dtas-all/> and
62
- <ftp://lists.gnu.org/dtas-all/>\
63
- No subscription is necessary to post to the mailing list.
64
-
65
- # COPYRIGHT
66
-
67
- Copyright 2013-2016 all contributors <dtas-all@nongnu.org>.\
68
- License: GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.txt>
69
-
70
- # SEE ALSO
71
-
72
- dtas-player(1), dtas-player_protocol(7), dtas-ctl(1), dtas-sinkedit(1),
73
- dtas-sourceedit(1)
@@ -1,36 +0,0 @@
1
- % dtas-cueedit(1) dtas user manual
2
- %
3
-
4
- # NAME
5
-
6
- dtas-cueedit - edit embedded cuesheets in audio files
7
-
8
- # SYNOPSYS
9
-
10
- dtas-cueedit /path/to/audio.flac
11
-
12
- # DESCRIPTION
13
-
14
- dtas-cueedit spawns an editor to edit the embedded cuesheet in FLAC files.
15
- In the future, other audio formats with embedded cuesheets may be supported.
16
- Use with the metaflac(1) is required.
17
-
18
- # ENVIRONMENT
19
-
20
- VISUAL / EDITOR - your favorite *nix text editor, defaults to 'vi' if unset.
21
-
22
- # CONTACT
23
-
24
- All feedback welcome via plain-text mail to: <dtas-all@nongnu.org>\
25
- Mailing list archives available at <http://80x24.org/dtas-all/> and
26
- <ftp://lists.gnu.org/dtas-all/>\
27
- No subscription is necessary to post to the mailing list.
28
-
29
- # COPYRIGHT
30
-
31
- Copyright 2013-2016 all contributors <dtas-all@nongnu.org>.\
32
- License: GPL-3.0+ <http://www.gnu.org/licenses/gpl-3.0.txt>
33
-
34
- # SEE ALSO
35
-
36
- metaflac(1)