dtas 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) 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-console.txt +1 -1
  6. data/Documentation/dtas-ctl.txt +1 -1
  7. data/Documentation/dtas-cueedit.txt +1 -1
  8. data/Documentation/dtas-enq.txt +1 -1
  9. data/Documentation/dtas-msinkctl.txt +1 -1
  10. data/Documentation/dtas-player.txt +1 -1
  11. data/Documentation/dtas-player_effects.txt +1 -1
  12. data/Documentation/dtas-player_protocol.txt +3 -3
  13. data/Documentation/dtas-player_sink_examples.txt +1 -1
  14. data/Documentation/dtas-sinkedit.txt +1 -1
  15. data/Documentation/dtas-sourceedit.txt +1 -1
  16. data/Documentation/dtas-splitfx.txt +1 -1
  17. data/Documentation/dtas-tl.txt +2 -1
  18. data/Documentation/dtas-xdelay.txt +1 -1
  19. data/GIT-VERSION-GEN +2 -2
  20. data/GNUmakefile +1 -1
  21. data/HACKING +1 -1
  22. data/INSTALL +5 -5
  23. data/README +1 -1
  24. data/Rakefile +2 -2
  25. data/TODO +1 -1
  26. data/bin/dtas-console +18 -3
  27. data/bin/dtas-ctl +1 -1
  28. data/bin/dtas-cueedit +1 -3
  29. data/bin/dtas-enq +2 -3
  30. data/bin/dtas-msinkctl +1 -1
  31. data/bin/dtas-partstats +1 -1
  32. data/bin/dtas-player +3 -4
  33. data/bin/dtas-sinkedit +1 -1
  34. data/bin/dtas-sourceedit +1 -1
  35. data/bin/dtas-splitfx +1 -1
  36. data/bin/dtas-tl +3 -3
  37. data/bin/dtas-xdelay +1 -1
  38. data/dtas-linux.gemspec +1 -1
  39. data/dtas-mpris.gemspec +1 -1
  40. data/dtas.gemspec +1 -1
  41. data/examples/trimfx.sample.yml +2 -5
  42. data/lib/dtas.rb +1 -1
  43. data/lib/dtas/buffer.rb +1 -1
  44. data/lib/dtas/buffer/read_write.rb +1 -1
  45. data/lib/dtas/buffer/splice.rb +1 -1
  46. data/lib/dtas/command.rb +1 -1
  47. data/lib/dtas/compat_onenine.rb +1 -1
  48. data/lib/dtas/compat_rbx.rb +1 -1
  49. data/lib/dtas/cue_index.rb +1 -1
  50. data/lib/dtas/disclaimer.rb +1 -1
  51. data/lib/dtas/edit_client.rb +1 -1
  52. data/lib/dtas/format.rb +1 -1
  53. data/lib/dtas/parse_time.rb +1 -1
  54. data/lib/dtas/partstats.rb +1 -1
  55. data/lib/dtas/pipe.rb +1 -1
  56. data/lib/dtas/player.rb +2 -2
  57. data/lib/dtas/player/client_handler.rb +5 -5
  58. data/lib/dtas/process.rb +1 -1
  59. data/lib/dtas/replaygain.rb +1 -1
  60. data/lib/dtas/rg_state.rb +1 -1
  61. data/lib/dtas/serialize.rb +1 -1
  62. data/lib/dtas/sigevent.rb +1 -1
  63. data/lib/dtas/sigevent/efd.rb +1 -1
  64. data/lib/dtas/sigevent/pipe.rb +1 -1
  65. data/lib/dtas/sink.rb +2 -2
  66. data/lib/dtas/source.rb +1 -1
  67. data/lib/dtas/source/av.rb +1 -1
  68. data/lib/dtas/source/av_ff_common.rb +1 -1
  69. data/lib/dtas/source/cmd.rb +1 -1
  70. data/lib/dtas/source/common.rb +1 -1
  71. data/lib/dtas/source/ff.rb +1 -1
  72. data/lib/dtas/source/file.rb +1 -1
  73. data/lib/dtas/source/mp3gain.rb +1 -1
  74. data/lib/dtas/source/sox.rb +1 -1
  75. data/lib/dtas/splitfx.rb +1 -1
  76. data/lib/dtas/state_file.rb +1 -1
  77. data/lib/dtas/tracklist.rb +1 -1
  78. data/lib/dtas/trimfx.rb +64 -3
  79. data/lib/dtas/unix_accepted.rb +3 -1
  80. data/lib/dtas/unix_client.rb +2 -2
  81. data/lib/dtas/unix_server.rb +8 -2
  82. data/lib/dtas/util.rb +1 -1
  83. data/lib/dtas/writable_iter.rb +1 -1
  84. data/lib/dtas/xs.rb +2 -2
  85. data/perl/dtas-graph +1 -1
  86. data/test/covshow.rb +1 -1
  87. data/test/helper.rb +24 -3
  88. data/test/player_integration.rb +1 -1
  89. data/test/test_buffer.rb +1 -1
  90. data/test/test_env.rb +1 -1
  91. data/test/test_format.rb +1 -1
  92. data/test/test_format_change.rb +1 -1
  93. data/test/test_player.rb +1 -1
  94. data/test/test_player_client_handler.rb +1 -1
  95. data/test/test_player_integration.rb +1 -1
  96. data/test/test_process.rb +1 -1
  97. data/test/test_rg_integration.rb +1 -1
  98. data/test/test_rg_state.rb +1 -1
  99. data/test/test_sink.rb +1 -1
  100. data/test/test_sink_pipe_size.rb +1 -1
  101. data/test/test_sink_tee_integration.rb +1 -1
  102. data/test/test_source_av.rb +1 -1
  103. data/test/test_source_sox.rb +1 -1
  104. data/test/test_splitfx.rb +8 -12
  105. data/test/test_tracklist.rb +1 -1
  106. data/test/test_trimfx.rb +33 -2
  107. data/test/test_unixserver.rb +1 -1
  108. data/test/test_util.rb +1 -1
  109. metadata +3 -5
  110. data/lib/dtas/fadefx.rb +0 -32
  111. data/test/test_fadefx.rb +0 -18
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
2
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
3
3
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
4
4
  USAGE = "Usage: #$0 [-x FREQ] [-l] /dev/fd/LO /dev/fd/HI DELAY [DELAY ...]"
5
5
  require 'optparse'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  #
4
4
  # this just declares dependencies to make gem installation a little easier
@@ -1,4 +1,4 @@
1
- # Copyright 2013, Eric Wong <normalperson@yhbt.net> and all contributors.
1
+ # Copyright 2013-2014, Eric Wong <e@80x24.org> and all contributors.
2
2
  # License: GPLv2 or later <http://www.gnu.org/licenses/gpl-2.0.txt>
3
3
  # This is GPLv2+ instead of GPLv3+ because ruby-dbus is LGPLv2.1 (only)
4
4
  Gem::Specification.new do |s|
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  Gem::Specification.new do |s|
4
4
  manifest = File.read('.gem-manifest').split(/\n/)
@@ -15,16 +15,13 @@ comments:
15
15
  YEAR: 2013
16
16
  track_start: 1
17
17
  effects:
18
- # the fade parameter sets the default fade for every subsequent effect
19
- - fade=t1,t1;t1,t1 # fade-out-prev,fade-in-main;fade-out-main,fade-in-next
20
-
21
18
  # the following commands are equivalent
22
- - trim 52 =53 sh sox $SOXIN $SOXOUT $TRIMFX vol -6dB $FADEFX
19
+ - trim 52 =53 sh sox $SOXIN $SOXOUT $TRIMFX vol -6dB
23
20
  - trim 52 1 sox vol -6dB # shorthand
24
21
 
25
22
  # as are the following (for little endian machines)
26
23
  - trim 52 1 eca -eadb:-6
27
24
  - trim 52 1 sh sox $SOXIN $SOX2ECA $TRIMFX | ecasound $ECAFMT
28
- -i stdin -o stdout -eadb:-6 | sox $ECA2SOX - $SOXOUT $FADEFX
25
+ -i stdin -o stdout -eadb:-6 | sox $ECA2SOX - $SOXOUT
29
26
  # SOX2ECA='-tf32 -c$CHANNELS -r$RATE'
30
27
  # ECAFMT='-f32_le,$CHANNELS,$RATE
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  module DTAS # :nodoc:
4
4
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'io/wait'
4
4
  require_relative '../dtas'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'io/nonblock'
4
4
  require_relative '../../dtas'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'io/nonblock'
4
4
  require 'io/splice'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  # common code for wrapping SoX/ecasound/... commands
4
4
  require_relative 'serialize'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
 
4
4
  # Make Ruby 1.9.3 look like Ruby 2.0.0 to us
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
 
4
4
  # ref: https://github.com/rubysl/rubysl-io-wait/issues/1
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../dtas'
4
4
  class DTAS::CueIndex
@@ -1,5 +1,5 @@
1
1
  # :enddoc:
2
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
2
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
3
3
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
4
4
  DTAS_PROGNAME = File.basename($0)
5
5
  DTAS_DISCLAIMER = <<EOF
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'tempfile'
4
4
  require 'yaml'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  # class represents an audio format (type/bits/channels/sample rate/...)
4
4
  require_relative '../dtas'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../dtas'
4
4
  module DTAS::ParseTime
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: binary -*-
2
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
2
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
3
3
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
4
4
  # Unlike the stuff for dtas-player, dtas-partstats is fairly tied to sox
5
5
  require_relative '../dtas'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  begin
4
4
  require 'io/splice'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'yaml'
4
4
  require 'shellwords'
@@ -52,7 +52,7 @@ class DTAS::Player # :nodoc:
52
52
  end
53
53
 
54
54
  def source_map_reload
55
- @sources = @source_map.values.sort_by { |src| src.tryorder }
55
+ @sources = @source_map.values.sort_by(&:tryorder)
56
56
  end
57
57
 
58
58
  def wall(msg)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../xs'
4
4
  module DTAS::Player::ClientHandler # :nodoc:
@@ -583,7 +583,7 @@ module DTAS::Player::ClientHandler # :nodoc:
583
583
  @queue.delete_if { |t| Array === t && t[0].object_id == track_id }
584
584
  io.emit("OK")
585
585
  when "get"
586
- res = @tl.get_tracks(msg.map! { |i| i.to_i })
586
+ res = @tl.get_tracks(msg.map!(&:to_i))
587
587
  res.map! { |tid, file| "#{tid}=#{file ? Shellwords.escape(file) : ''}" }
588
588
  io.emit("#{res.size} #{res.join(' ')}")
589
589
  when "tracks"
@@ -618,11 +618,11 @@ module DTAS::Player::ClientHandler # :nodoc:
618
618
  def __bp_prev_next(io, msg, cur, bp)
619
619
  case type = msg[1]
620
620
  when nil, "track"
621
- bp.keep_if { |ci| ci.track? }
621
+ bp.keep_if(&:track?)
622
622
  when "pregap"
623
- bp.keep_if { |ci| ci.pregap? }
623
+ bp.keep_if(&:pregap?)
624
624
  when "subindex" # any subindex
625
- bp.keep_if { |ci| ci.subindex? }
625
+ bp.keep_if(&:subindex?)
626
626
  when /\A\d+\z/ # exact subindex match
627
627
  si = type.to_i
628
628
  bp.keep_if { |ci| ci.index == si }
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'io/wait'
4
4
  require_relative '../dtas'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  #
4
4
  # Represents ReplayGain metadata for a DTAS::Source
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  #
4
4
  # provides support for generating appropriate effects for ReplayGain
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  module DTAS::Serialize # :nodoc:
4
4
  def ivars_to_hash(ivars, rv = {})
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  begin
4
4
  raise LoadError, "no eventfd with _DTAS_POSIX" if ENV["_DTAS_POSIX"]
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  class DTAS::Sigevent < SleepyPenguin::EventFD # :nodoc:
4
4
  include SleepyPenguin
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  class DTAS::Sigevent # :nodoc:
4
4
  attr_reader :to_io
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'yaml'
4
4
  require_relative '../dtas'
@@ -102,7 +102,7 @@ class DTAS::Sink # :nodoc:
102
102
  end
103
103
 
104
104
  @pid = dtas_spawn(format.to_env.merge!(@env), cmd, opts)
105
- inputs.each_value { |rpipe| rpipe.close }
105
+ inputs.each_value(&:close)
106
106
  rv
107
107
  end
108
108
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../dtas'
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../../dtas'
4
4
  require_relative 'av_ff_common'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../../dtas'
4
4
  require_relative '../source'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../../dtas'
4
4
  require_relative '../source'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  module DTAS::Source::Common # :nodoc:
4
4
  attr_reader :dst_zero_byte
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../../dtas'
4
4
  require_relative 'av_ff_common'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../../dtas'
4
4
  require_relative '../source'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../process'
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../../dtas'
4
4
  require_relative '../source'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  # Unlike the stuff for dtas-player, dtas-splitfx is fairly tied to sox
4
4
  # (but we may still pipe to ecasound or anything else)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'yaml'
4
4
  require 'tempfile'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../dtas'
4
4
  require_relative 'serialize'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../dtas'
4
4
  require_relative 'parse_time'
@@ -36,14 +36,13 @@ class DTAS::TrimFX
36
36
  def tfx_sox(args)
37
37
  @cmd = %w(sox $SOXIN $SOXOUT $TRIMFX)
38
38
  @cmd.concat(args)
39
- @cmd.concat(%w($FADEFX))
40
39
  end
41
40
 
42
41
  def tfx_eca(args)
43
42
  @cmd = %w(sox $SOXIN $SOX2ECA $TRIMFX)
44
43
  @cmd.concat(%w(| ecasound $ECAFMT -i stdin -o stdout))
45
44
  @cmd.concat(args)
46
- @cmd.concat(%w(| sox $ECA2SOX - $SOXOUT $FADEFX))
45
+ @cmd.concat(%w(| sox $ECA2SOX - $SOXOUT))
47
46
  end
48
47
 
49
48
  def to_sox_arg(format)
@@ -75,4 +74,66 @@ class DTAS::TrimFX
75
74
  @tbeg = tbeg
76
75
  @tlen = tlen
77
76
  end
77
+
78
+ def <=>(other)
79
+ tbeg <=> other.tbeg
80
+ end
81
+
82
+ # for stable sorting
83
+ class TFXSort < Struct.new(:tfx, :idx)
84
+ def <=>(other)
85
+ cmp = tfx <=> other.tfx
86
+ 0 == cmp ? idx <=> other.idx : cmp
87
+ end
88
+ end
89
+
90
+ # there'll be multiple epochs if ranges overlap
91
+ def self.schedule(ary)
92
+ sorted = []
93
+ ary.each_with_index { |tfx, i| sorted << TFXSort[tfx, i] }
94
+ sorted.sort!
95
+ rv = []
96
+ epoch = 0
97
+ prev_end = 0
98
+ defer = []
99
+ begin
100
+ while tfxsort = sorted.shift
101
+ tfx = tfxsort.tfx
102
+ if tfx.tbeg >= prev_end
103
+ prev_end = tfx.tbeg + tfx.tlen
104
+ (rv[epoch] ||= []) << tfx
105
+ else
106
+ defer << tfxsort
107
+ end
108
+ end
109
+ if defer[0]
110
+ epoch += 1
111
+ sorted = defer
112
+ defer = []
113
+ prev_end = 0
114
+ end
115
+ end while sorted[0]
116
+ rv
117
+ end
118
+
119
+ def self.expand(ary, total_len)
120
+ rv = []
121
+ schedule(ary).each_with_index do |sary, i|
122
+ tip = 0
123
+ dst = rv[i] = []
124
+ while tfx = sary.shift
125
+ if tfx.tbeg > tip
126
+ nfx = new(%W(trim #{tip} =#{tfx.tbeg}))
127
+ dst << nfx
128
+ dst << tfx
129
+ tip = tfx.tbeg + tfx.tlen
130
+ end
131
+ end
132
+ if tip < total_len
133
+ nfx = new(%W(trim #{tip} =#{total_len}))
134
+ dst << nfx
135
+ end
136
+ end
137
+ rv
138
+ end
78
139
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require 'socket'
4
4
  require 'io/wait'
@@ -57,6 +57,8 @@ class DTAS::UNIXAccepted # :nodoc:
57
57
  begin
58
58
  begin
59
59
  msg, _, _ = io.recvmsg_nonblock(nread)
60
+ rescue Errno::EAGAIN
61
+ return :wait_readable
60
62
  rescue EOFError, SystemCallError
61
63
  return nil
62
64
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
1
+ # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
2
2
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  require_relative '../dtas'
4
4
  require_relative 'xs'
@@ -13,7 +13,7 @@ class DTAS::UNIXClient # :nodoc:
13
13
  include DTAS::XS
14
14
 
15
15
  def self.default_path
16
- (ENV["DTAS_PLAYER_SOCK"] || File.expand_path("~/.dtas/player.sock")).b
16
+ (ENV["DTAS_PLAYER_SOCK"] || File.expand_path("~/.dtas/player.sock"))
17
17
  end
18
18
 
19
19
  def initialize(path = self.class.default_path)