Permalink
Browse files

fix Scissor::Tape#stretch

  • Loading branch information...
youpy committed Jan 2, 2012
1 parent a5df2c5 commit f6d7a679fcc8e427ceb5225c7d6d7748a2ba964c
Showing with 17 additions and 3 deletions.
  1. +4 −2 lib/scissor/fragment.rb
  2. +2 −1 lib/scissor/tape.rb
  3. +11 −0 spec/scissor_spec.rb
View
@@ -43,7 +43,8 @@ def create(remaining_start, remaining_length)
start + remaining_start * pitch.to_f / 100,
(duration - remaining_start) * pitch.to_f / 100,
false,
- pitch)
+ pitch,
+ stretched?)
remaining_length -= duration - remaining_start
remaining_start = 0
@@ -53,7 +54,8 @@ def create(remaining_start, remaining_length)
start + remaining_start * pitch.to_f / 100,
remaining_length * pitch.to_f / 100,
false,
- pitch)
+ pitch,
+ stretched?)
remaining_start = 0
remaining_length = 0
View
@@ -170,7 +170,8 @@ def reverse
fragment.start,
fragment.original_duration,
!fragment.reversed?,
- fragment.pitch))
+ fragment.pitch,
+ fragment.stretched?))
end
new_instance
View
@@ -187,6 +187,17 @@
scissor.duration.should eql(0.1)
scissor.pitch((0.1 / 120) * 100, true).duration.should be_close(120.0, 0.1)
scissor.stretch((120 / 0.1) * 100).duration.should be_close(120.0, 0.1)
+
+ stretched = scissor.stretch((120 / 0.1) * 100).slice(0, 10)
+ stretched.fragments.first.should be_stretched
+
+ stretched1 = scissor.stretch((120 / 0.1) * 100)
+ stretched2 = scissor.stretch((120 / 0.1) * 100)
+ stretched = (stretched1 + stretched2).slice(100, 50)
+ stretched.fragments.first.should be_stretched
+
+ scissor = (@mp3.slice(0, 10) + @mp3.slice(0, 5)).stretch(200).reverse
+ scissor.fragments.first.should be_stretched
end
it "should join instances of scissor" do

0 comments on commit f6d7a67

Please sign in to comment.