[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/7] tracklist: next_track -> advance_track
From: |
Eric Wong |
Subject: |
[PATCH 3/7] tracklist: next_track -> advance_track |
Date: |
Mon, 9 Sep 2013 08:31:05 +0000 |
This is a more accurate depiction of what happens,
and we'll implement "next" and "previous" commands in the future.
---
lib/dtas/player.rb | 4 ++--
lib/dtas/splitfx.rb | 4 ++--
lib/dtas/tracklist.rb | 2 +-
test/test_tracklist.rb | 12 ++++++------
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index 8926e0b..5e78d8e 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -260,7 +260,7 @@ class DTAS::Player # :nodoc:
end
def _next
- @queue.shift || @tl.next_track
+ @queue.shift || @tl.advance_track
end
def sink_death(sink, status)
@@ -353,7 +353,7 @@ class DTAS::Player # :nodoc:
# don't get stuck in an infinite loop if @tl.repeat==true and we can't
# decode anything (FS errors, sox uninstalled, etc...)
- while path = @tl.next_track(false)
+ while path = @tl.advance_track(false)
@sources.each do |src|
rv = src.try(path) and return rv
end
diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb
index 02be3a3..39726de 100644
--- a/lib/dtas/splitfx.rb
+++ b/lib/dtas/splitfx.rb
@@ -14,8 +14,8 @@ class DTAS::SplitFX # :nodoc:
include DTAS::XS
class T < Struct.new(:env, :comments, :tstart, :fade_in, :fade_out)
- def commit(next_track_samples)
- tlen = next_track_samples - tstart
+ def commit(advance_track_samples)
+ tlen = advance_track_samples - tstart
trimfx = "trim #{tstart}s #{tlen}s"
if fade_in
trimfx << " #{fade_in}"
diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb
index a51db32..e0b00cb 100644
--- a/lib/dtas/tracklist.rb
+++ b/lib/dtas/tracklist.rb
@@ -65,7 +65,7 @@ class DTAS::Tracklist
@list.map { |t| t.object_id }
end
- def next_track(repeat_ok = true)
+ def advance_track(repeat_ok = true)
return if @list.empty?
next_pos = @goto_pos || @pos + 1
@goto_pos = nil
diff --git a/test/test_tracklist.rb b/test/test_tracklist.rb
index e4ca9ac..fb5cc3e 100644
--- a/test/test_tracklist.rb
+++ b/test/test_tracklist.rb
@@ -28,15 +28,15 @@ class TestTracklist < Testcase
assert_equal '/foo.flac', tl.cur_track
end
- def test_next_track
+ def test_advance_track
tl = DTAS::Tracklist.new
tl.instance_variable_get(:@list).replace(%w(a b c d e f g))
%w(a b c d e f g).each do |t|
- assert_equal t, tl.next_track
+ assert_equal t, tl.advance_track
end
- assert_nil tl.next_track
+ assert_nil tl.advance_track
tl.repeat = true
- assert_equal 'a', tl.next_track
+ assert_equal 'a', tl.advance_track
end
def _build_mapping(tl)
@@ -49,9 +49,9 @@ class TestTracklist < Testcase
tl.instance_variable_get(:@list).replace(%w(a b c d e f g))
mapping = _build_mapping(tl)
assert_equal 'f', tl.go_to(mapping['f'])
- assert_equal 'f', tl.next_track
+ assert_equal 'f', tl.advance_track
assert_nil tl.go_to(1 << 128)
- assert_equal 'g', tl.next_track
+ assert_equal 'g', tl.advance_track
end
def test_remove_track
--
1.8.4
- [PATCH 1/7] dtas-console: avoid using current if it is nil, Eric Wong, 2013/09/09
- [PATCH 3/7] tracklist: next_track -> advance_track,
Eric Wong <=
- [PATCH 5/7] player: "tl goto" takes optional offset arg in HHMMSS.SUBSEC, Eric Wong, 2013/09/09
- [PATCH 7/7] tracklist: implement single-track repeat, Eric Wong, 2013/09/09
- [PATCH 2/7] player: reset tracklist when idle stat is detected, Eric Wong, 2013/09/09
- [PATCH 6/7] tracklist: previous! only wraps around when repeat is enabled, Eric Wong, 2013/09/09
- [PATCH 4/7] player: implement previous/next commands, Eric Wong, 2013/09/09