dtas 0.14.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Documentation/.gitignore +1 -1
  4. data/Documentation/GNUmakefile +1 -1
  5. data/Documentation/dtas-archive.pod +2 -2
  6. data/Documentation/dtas-console.pod +2 -2
  7. data/Documentation/dtas-ctl.pod +2 -2
  8. data/Documentation/dtas-cueedit.pod +2 -2
  9. data/Documentation/dtas-enq.pod +2 -2
  10. data/Documentation/dtas-env.pod +2 -2
  11. data/Documentation/dtas-msinkctl.pod +2 -2
  12. data/Documentation/dtas-player.pod +2 -2
  13. data/Documentation/dtas-player_effects.pod +2 -2
  14. data/Documentation/dtas-player_protocol.pod +19 -4
  15. data/Documentation/dtas-player_sink_examples.pod +2 -2
  16. data/Documentation/dtas-sinkedit.pod +2 -2
  17. data/Documentation/dtas-sourceedit.pod +2 -2
  18. data/Documentation/dtas-splitfx.pod +1 -1
  19. data/Documentation/dtas-tl.pod +2 -2
  20. data/Documentation/dtas-xdelay.pod +2 -2
  21. data/Documentation/update-footer.rb +3 -3
  22. data/GIT-VERSION-GEN +2 -2
  23. data/GNUmakefile +1 -1
  24. data/HACKING +2 -2
  25. data/INSTALL +10 -10
  26. data/README +6 -5
  27. data/Rakefile +5 -5
  28. data/TODO +1 -1
  29. data/bin/dtas-archive +2 -2
  30. data/bin/dtas-console +1 -1
  31. data/bin/dtas-ctl +1 -1
  32. data/bin/dtas-cueedit +1 -1
  33. data/bin/dtas-enq +1 -1
  34. data/bin/dtas-mlib +1 -1
  35. data/bin/dtas-msinkctl +1 -1
  36. data/bin/dtas-partstats +1 -1
  37. data/bin/dtas-player +1 -1
  38. data/bin/dtas-readahead +19 -8
  39. data/bin/dtas-sinkedit +1 -1
  40. data/bin/dtas-sourceedit +1 -1
  41. data/bin/dtas-splitfx +1 -1
  42. data/bin/dtas-tl +1 -1
  43. data/bin/dtas-xdelay +1 -1
  44. data/dtas-linux.gemspec +2 -2
  45. data/dtas-mpris.gemspec +2 -2
  46. data/dtas.gemspec +2 -2
  47. data/lib/dtas.rb +15 -2
  48. data/lib/dtas/buffer.rb +1 -1
  49. data/lib/dtas/buffer/read_write.rb +1 -1
  50. data/lib/dtas/buffer/splice.rb +1 -2
  51. data/lib/dtas/command.rb +1 -1
  52. data/lib/dtas/compat_onenine.rb +1 -1
  53. data/lib/dtas/cue_index.rb +1 -1
  54. data/lib/dtas/disclaimer.rb +1 -1
  55. data/lib/dtas/edit_client.rb +1 -1
  56. data/lib/dtas/fadefx.rb +2 -2
  57. data/lib/dtas/format.rb +9 -5
  58. data/lib/dtas/mcache.rb +31 -0
  59. data/lib/dtas/mlib.rb +11 -7
  60. data/lib/dtas/mlib/migrations/0001_initial.rb +1 -1
  61. data/lib/dtas/nonblock.rb +1 -1
  62. data/lib/dtas/parse_freq.rb +1 -1
  63. data/lib/dtas/parse_time.rb +1 -1
  64. data/lib/dtas/partstats.rb +2 -3
  65. data/lib/dtas/pipe.rb +1 -1
  66. data/lib/dtas/player.rb +2 -1
  67. data/lib/dtas/player/client_handler.rb +74 -16
  68. data/lib/dtas/process.rb +1 -1
  69. data/lib/dtas/replaygain.rb +1 -1
  70. data/lib/dtas/rg_state.rb +4 -9
  71. data/lib/dtas/serialize.rb +1 -1
  72. data/lib/dtas/sigevent.rb +1 -1
  73. data/lib/dtas/sigevent/efd.rb +1 -1
  74. data/lib/dtas/sigevent/pipe.rb +1 -1
  75. data/lib/dtas/sink.rb +1 -1
  76. data/lib/dtas/source.rb +2 -1
  77. data/lib/dtas/source/av.rb +1 -1
  78. data/lib/dtas/source/av_ff_common.rb +7 -3
  79. data/lib/dtas/source/cmd.rb +1 -1
  80. data/lib/dtas/source/common.rb +1 -1
  81. data/lib/dtas/source/ff.rb +1 -1
  82. data/lib/dtas/source/file.rb +1 -1
  83. data/lib/dtas/source/mp3gain.rb +1 -1
  84. data/lib/dtas/source/sox.rb +59 -32
  85. data/lib/dtas/spawn_fix.rb +1 -1
  86. data/lib/dtas/splitfx.rb +11 -6
  87. data/lib/dtas/state_file.rb +1 -1
  88. data/lib/dtas/tfx.rb +1 -1
  89. data/lib/dtas/track.rb +1 -1
  90. data/lib/dtas/tracklist.rb +1 -1
  91. data/lib/dtas/unix_accepted.rb +1 -1
  92. data/lib/dtas/unix_client.rb +1 -1
  93. data/lib/dtas/unix_server.rb +1 -1
  94. data/lib/dtas/util.rb +1 -1
  95. data/lib/dtas/writable_iter.rb +1 -1
  96. data/lib/dtas/xs.rb +1 -1
  97. data/perl/dtas-graph +1 -1
  98. data/test/covshow.rb +1 -1
  99. data/test/helper.rb +1 -1
  100. data/test/player_integration.rb +1 -1
  101. data/test/test_buffer.rb +11 -7
  102. data/test/test_env.rb +1 -1
  103. data/test/test_fadefx.rb +1 -1
  104. data/test/test_format.rb +1 -1
  105. data/test/test_format_change.rb +1 -1
  106. data/test/test_mcache.rb +19 -0
  107. data/test/test_mlib.rb +1 -1
  108. data/test/test_parse_freq.rb +1 -1
  109. data/test/test_player.rb +1 -1
  110. data/test/test_player_client_handler.rb +1 -1
  111. data/test/test_player_integration.rb +1 -1
  112. data/test/test_process.rb +1 -1
  113. data/test/test_rg_integration.rb +2 -2
  114. data/test/test_rg_state.rb +9 -2
  115. data/test/test_sink.rb +1 -1
  116. data/test/test_sink_pipe_size.rb +1 -1
  117. data/test/test_sink_tee_integration.rb +1 -1
  118. data/test/test_source_av.rb +1 -1
  119. data/test/test_source_sox.rb +2 -1
  120. data/test/test_splitfx.rb +1 -1
  121. data/test/test_tfx.rb +1 -1
  122. data/test/test_tracklist.rb +1 -1
  123. data/test/test_unixserver.rb +1 -1
  124. data/test/test_util.rb +1 -1
  125. metadata +6 -4
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
5
5
  require_relative 'parse_time'
@@ -95,7 +95,7 @@ def fade_in_next_fx(format, tbeg, tlen)
95
95
  def parse!(str)
96
96
  return nil if str.empty?
97
97
  type = "t"
98
- str.sub!(/\A([a-z])/, "") and type = $1.freeze
98
+ str.sub!(/\A([a-z])/, "") and type = DTAS.dedupe_str($1)
99
99
  F.new(type, parse_time(str))
100
100
  end
101
101
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
5
5
  require_relative 'process'
@@ -56,10 +56,14 @@ def self.precision(env, infile)
56
56
 
57
57
  def self.from_file(env, infile)
58
58
  fmt = new
59
- fmt.channels = qx(env, %W(soxi -c #{infile})).to_i
60
- fmt.type = qx(env, %W(soxi -t #{infile})).strip
61
- fmt.rate = qx(env, %W(soxi -r #{infile})).to_i
62
- fmt.bits ||= precision(env, infile)
59
+ out = qx(env, %W(soxi #{infile}), err: DTAS.null)
60
+ out =~ /^Channels\s*:\s*(\d+)/n
61
+ fmt.channels = $1.to_i
62
+ out =~ /^Sample Rate\s*:\s*(\d+)/n
63
+ fmt.rate = $1.to_i
64
+ out =~ /Precision\s*:\s*(\d+)-bit/n
65
+ fmt.bits = $1.to_i
66
+ fmt.type = qx(env, %W(soxi -t #{infile})).strip # ....
63
67
  fmt
64
68
  end
65
69
 
@@ -0,0 +1,31 @@
1
+ # Copyright (C) 2016 all contributors <dtas-all@nongnu.org>
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
+ # frozen_string_literal: true
4
+ # encoding: binary
5
+ require_relative '../dtas'
6
+
7
+ class DTAS::Mcache
8
+ def initialize(shift = 8, ttl = 60)
9
+ @mask = (1 << shift) - 1
10
+ @ttl = ttl
11
+ @tbl = []
12
+ end
13
+
14
+ def lookup(infile)
15
+ bucket = infile.hash & @mask
16
+ if cur = @tbl[bucket]
17
+ if cur[:infile] == infile && (DTAS.now - cur[:btime]) < @ttl
18
+ return cur
19
+ end
20
+ end
21
+ return unless block_given?
22
+ @tbl[bucket] = begin
23
+ cur = cur ? cur.clear : {}
24
+ if ret = yield(infile, cur)
25
+ ret[:infile] = infile.frozen? ? infile : infile.dup.freeze
26
+ ret[:btime] = DTAS.now
27
+ end
28
+ ret
29
+ end
30
+ end
31
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
3
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
3
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  #
6
6
  require_relative '../dtas'
@@ -190,7 +190,9 @@ def load_tags
190
190
  tag_id = tag_map[x] and tag_map["#{x}number"] = tag_id
191
191
  end
192
192
  @tag_rmap = tag_map.invert.freeze
193
- tag_map.merge!(Hash[*(tag_map.map { |k,v| [k.upcase.freeze, v] }.flatten!)])
193
+ tag_map.merge!(Hash[*(tag_map.map { |k,v|
194
+ [DTAS.dedupe_str(k.upcase), v]
195
+ }.flatten!)])
194
196
  @tag_map = tag_map.freeze
195
197
  end
196
198
 
@@ -298,8 +300,10 @@ def scan_dir(path, st, parent_id = nil)
298
300
  dir = dir_vivify(@pwd.split(%r{/+}n), st.ctime.to_i)
299
301
  dir_id = dir[:id]
300
302
 
301
- @db[:nodes].where(parent_id: dir_id).each do |node|
302
- File.exist?(node[:name]) or remove_entry(node)
303
+ @db.transaction do
304
+ @db[:nodes].where(parent_id: dir_id).each do |node|
305
+ File.exist?(node[:name]) or remove_entry(node)
306
+ end
303
307
  end
304
308
 
305
309
  Dir.foreach('.', encoding: Encoding::BINARY) do |x|
@@ -398,7 +402,7 @@ def path_of(node, cache)
398
402
  return '/' if base == '' # root_node
399
403
  parent_id = node[:parent_id]
400
404
  base += '/' unless node[:tlen] >= 0
401
- ppath = cache[parent_id] and return "#{ppath}/#{base}"
405
+ ppath = cache[parent_id] and return DTAS.dedupe_str("#{ppath}/#{base}")
402
406
  parts = []
403
407
  begin
404
408
  node = @db[:nodes][id: node[:parent_id]]
@@ -406,9 +410,9 @@ def path_of(node, cache)
406
410
  parts.unshift node[:name]
407
411
  end while true
408
412
  parts.unshift('')
409
- cache[parent_id] = parts.join('/')
413
+ cache[parent_id] = DTAS.dedupe_str(parts.join('/'))
410
414
  parts << base
411
- parts.join('/').freeze
415
+ DTAS.dedupe_str(parts.join('/'))
412
416
  end
413
417
 
414
418
  def emit_recurse(node, cache, cb)
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
 
4
4
  Sequel.migration do
5
5
  up do
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
 
4
4
  class DTAS::Nonblock < IO # :nodoc:
5
5
  if RUBY_VERSION.to_f <= 2.0
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../dtas'
5
5
  module DTAS::ParseFreq # :nodoc:
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
3
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
3
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  require_relative '../dtas'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: binary -*-
2
2
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
3
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
3
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4
4
  # frozen_string_literal: true
5
5
  require_relative '../dtas'
6
6
  require_relative 'xs'
@@ -173,8 +173,7 @@ def parse_stats(stats, trim_part, buf)
173
173
  else
174
174
  next
175
175
  end
176
- key = $1
177
- key.freeze
176
+ key = DTAS.dedupe_str($1)
178
177
  key_idx = @key_idx[key]
179
178
  parts = line.split(/\s+/)
180
179
  nshift.times { parts.shift } # remove stuff we don't need
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  begin
5
5
  require 'io/splice'
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require 'yaml'
5
5
  require 'shellwords'
@@ -168,6 +168,7 @@ def self.load(hash)
168
168
 
169
169
  if sinks = hash["sinks"]
170
170
  sinks.each do |sink_hsh|
171
+ sink_hsh['name'] = DTAS.dedupe_str(sink_hsh['name'])
171
172
  sink = DTAS::Sink.load(sink_hsh)
172
173
  sink.env = to_omap(sink.env)
173
174
  @sinks[sink.name] = sink
@@ -1,8 +1,9 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require_relative '../xs'
5
5
  require_relative '../parse_time'
6
+ require_relative '../../dtas'
6
7
 
7
8
  # client protocol handling for -player
8
9
  module DTAS::Player::ClientHandler # :nodoc:
@@ -134,7 +135,7 @@ def dpc_sink(io, msg)
134
135
  # or variable names.
135
136
  sink.valid_name?(name) or return io.emit("ERR sink name invalid")
136
137
 
137
- sink.name = name
138
+ sink.name = DTAS.dedupe_str(name)
138
139
  active_before = sink.active
139
140
  before = __sink_snapshot(sink)
140
141
 
@@ -143,7 +144,7 @@ def dpc_sink(io, msg)
143
144
  k, v = kv.split('=', 2)
144
145
  case k
145
146
  when %r{\Aenv\.([^=]+)\z}
146
- sink.env[$1] = v
147
+ sink.env[DTAS.dedupe_str($1)] = v
147
148
  when %r{\Aenv#([^=]+)\z}
148
149
  v == nil or return io.emit("ERR unset env has no value")
149
150
  sink.env.delete($1)
@@ -186,6 +187,21 @@ def bytes_decoded(src = @current)
186
187
  bytes = bytes < 0 ? 0 : bytes # maybe negative in case of sink errors
187
188
  end
188
189
 
190
+ def __goto_offset_samples(offset)
191
+ if offset.sub!(/\A\+/, '')
192
+ __offset_to_samples(offset)
193
+ elsif offset.sub!(/\A-/, '')
194
+ __offset_to_samples(offset) * -1
195
+ else # ignore leading '=' for sox compat with 2nd "trim" arg
196
+ __offset_to_samples(offset)
197
+ end
198
+ end
199
+
200
+ def __offset_to_samples(offset)
201
+ offset.sub!(/s\z/, '') and return offset.to_i
202
+ @current.format.hhmmss_to_samples(offset)
203
+ end
204
+
189
205
  # returns seek offset as an Integer in sample count
190
206
  def __seek_offset_adj(dir, offset)
191
207
  if offset.sub!(/s\z/, '')
@@ -259,8 +275,7 @@ def dpc_rg(io, msg)
259
275
  when "fallback_track"
260
276
  rv = set_bool(io, kv, v) { |b| @rg.fallback_track = b }
261
277
  rv == true or return rv
262
- when %r{(?:gain_threshold|norm_threshold|
263
- preamp|norm_level|fallback_gain|volume)[+-]?\z}x
278
+ when %r{(?:preamp|norm_level|fallback_gain|volume)[+-]?\z}x
264
279
  rv = adjust_numeric(io, @rg, k, v)
265
280
  rv == true or return rv
266
281
  end
@@ -377,7 +392,7 @@ def seek_internal(cur, offset)
377
392
  end
378
393
 
379
394
  def dpc_seek(io, msg)
380
- offset = msg[0]
395
+ offset = msg[0] or return io.emit('ERR usage: seek OFFSET')
381
396
  if @current
382
397
  if @current.respond_to?(:infile)
383
398
  begin
@@ -730,6 +745,7 @@ def _dpc_tl_swap(io, msg)
730
745
  end
731
746
 
732
747
  def __bp_prev_next(io, msg, cur, bp)
748
+ # msg = [ (prev|next) [, (track|pregap|subindex|<digit>|any) ]
733
749
  case type = msg[1]
734
750
  when nil, "track"
735
751
  bp.keep_if(&:track?)
@@ -745,9 +761,9 @@ def __bp_prev_next(io, msg, cur, bp)
745
761
  return io.emit("INVALID TYPE")
746
762
  end
747
763
  fmt = cur.format
764
+ ds = __current_decoded_samples
748
765
  case msg[0]
749
766
  when "next"
750
- ds = __current_decoded_samples
751
767
  bp.each do |ci|
752
768
  next if ci.offset_samples(fmt) < ds
753
769
  seek_internal(cur, ci.offset)
@@ -756,11 +772,15 @@ def __bp_prev_next(io, msg, cur, bp)
756
772
  # go to the next (real) track if not found
757
773
  __current_drop
758
774
  when "prev"
759
- os = cur.offset_samples # where we currently started
775
+ prev = nil
760
776
  bp.reverse_each do |ci|
761
- next if ci.offset_samples(fmt) >= os
762
- seek_internal(cur, ci.offset)
763
- return io.emit("OK")
777
+ if prev.nil?
778
+ next if ci.offset_samples(fmt) >= ds
779
+ prev = ci
780
+ else
781
+ seek_internal(cur, ci.offset)
782
+ return io.emit("OK")
783
+ end
764
784
  end
765
785
  # offset may be nil/zero if we couldn't find a previous breakpoint
766
786
  seek_internal(cur, '0')
@@ -768,6 +788,47 @@ def __bp_prev_next(io, msg, cur, bp)
768
788
  io.emit("OK")
769
789
  end
770
790
 
791
+ def __bp_seek(io, msg, cur, bp)
792
+ offset = msg[1] or return io.emit('ERR usage: cue seek OFFSET')
793
+
794
+ # relative + offset work just like normal, non-CUE "seek"
795
+ offset =~ /\A[\+-]/ and return dpc_seek(io, [ offset ])
796
+
797
+ # "=-" is special, it means go before the current index start:
798
+ dir = offset.sub!(/\A=-/, '') ? -1 : 1
799
+
800
+ begin
801
+ offset = __offset_to_samples(offset)
802
+ rescue ArgumentError
803
+ return io.emit('ERR bad time format')
804
+ end
805
+
806
+ ds = __current_decoded_samples
807
+ fmt = cur.format
808
+ prev = 0
809
+ bp.each do |ci|
810
+ ci_offset = ci.offset_samples(fmt)
811
+ break if ci_offset >= ds
812
+ prev = ci_offset
813
+ end
814
+ offset = offset * dir + prev
815
+ seek_internal(cur, "#{offset < 0 ? 0 : offset}s")
816
+ io.emit('OK')
817
+ end
818
+
819
+ def __bp_goto(io, msg, cur, bp)
820
+ index = msg[1] or return io.emit('NOINDEX')
821
+ ci = bp[index.to_i] or return io.emit('BADINDEX')
822
+ if offset = msg[2]
823
+ fmt = cur.format
824
+ offset = "#{ci.offset_samples(fmt) + __goto_offset_samples(offset)}s"
825
+ else
826
+ offset = ci.offset
827
+ end
828
+ seek_internal(cur, offset)
829
+ io.emit('OK')
830
+ end
831
+
771
832
  def dpc_cue(io, msg)
772
833
  cur = @current
773
834
  if cur.respond_to?(:cuebreakpoints)
@@ -778,11 +839,8 @@ def dpc_cue(io, msg)
778
839
  io.emit(tmp.to_yaml)
779
840
  when "next", "prev"
780
841
  return __bp_prev_next(io, msg, cur, bp)
781
- when "goto"
782
- index = msg[1] or return io.emit("NOINDEX")
783
- ci = bp[index.to_i] or return io.emit("BADINDEX")
784
- seek_internal(cur, ci.offset)
785
- return io.emit("OK")
842
+ when 'seek' then return __bp_seek(io, msg, cur, bp)
843
+ when 'goto' then return __bp_goto(io, msg, cur, bp)
786
844
  end
787
845
  else
788
846
  io.emit("NOCUE")
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  require 'io/wait'
5
5
  require 'shellwords'
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
 
5
5
  # Represents ReplayGain metadata for a DTAS::Source, only used by -player
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  #
5
5
  # provides support for generating appropriate effects for ReplayGain
@@ -22,8 +22,6 @@ class DTAS::RGState # :nodoc:
22
22
  RG_DEFAULT = {
23
23
  "volume" => 1.0,
24
24
  # skip the effect if the adjustment is too small to be noticeable
25
- "gain_threshold" => 0.00000001, # in dB
26
- "norm_threshold" => 0.00000001,
27
25
 
28
26
  "preamp" => 0, # no extra adjustment
29
27
  # "mode" => "album_gain", # nil: off
@@ -73,23 +71,21 @@ def to_sox_gain(val)
73
71
  when -1 then return 'gain -192'
74
72
  when 1 then return 'gain 192'
75
73
  else
76
- sprintf('gain %0.8g', val).freeze
74
+ val.abs <= 0.00000001 and return
75
+ DTAS.dedupe_str(sprintf('gain %0.8f', val))
77
76
  end
78
77
  end
79
78
 
80
79
  # returns a dB argument to the "gain" effect, nil if nothing found
81
80
  def rg_vol_gain(val)
82
81
  val = val.to_f + @preamp + vol_db
83
- return if val.abs < @gain_threshold
84
82
  to_sox_gain(val)
85
83
  end
86
84
 
87
85
  # returns a DB argument to the "gain" effect
88
86
  def rg_vol_norm(val)
89
87
  n = @norm_level == 1.0 ? @volume : @norm_level
90
- diff = n - val.to_f
91
- return if (n - diff).abs < @norm_threshold
92
- diff += n
88
+ diff = n * 2 - val.to_f
93
89
  to_sox_gain(linear_to_db(diff))
94
90
  end
95
91
 
@@ -99,7 +95,6 @@ def rg_vol_norm(val)
99
95
  # tag slips into the queue
100
96
  def rg_fallback_effect(reason)
101
97
  val = (@fallback_gain || 0) + @preamp + vol_db
102
- return if val.abs < @gain_threshold
103
98
  warn(reason) if $DEBUG
104
99
  to_sox_gain(val)
105
100
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
 
5
5
  # used to serialize player state to the state file
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
2
- # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
2
+ # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
3
3
  # frozen_string_literal: true
4
4
  begin
5
5
  raise LoadError, "no eventfd with _DTAS_POSIX" if ENV["_DTAS_POSIX"]