Skip to content

Commit

Permalink
fix Scissor::Tape#stretch
Browse files Browse the repository at this point in the history
  • Loading branch information
youpy committed Dec 19, 2011
1 parent 7cf4b43 commit 7e961a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/scissor/tape.rb
Expand Up @@ -193,7 +193,7 @@ def pitch(pitch, stretch = false)
end

def stretch(factor)
factor_for_pitch = ((100 / factor.to_f) * 100).to_i
factor_for_pitch = 1 / (factor.to_f / 100) * 100
pitch(factor_for_pitch, true)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/scissor_spec.rb
Expand Up @@ -182,11 +182,11 @@
end

it "should stretch" do
scissor = @mp3.slice(0, 10) + @mp3.slice(0, 5)
scissor = @mp3.slice(0, 0.1)

scissor.duration.should eql(15.0)
scissor.pitch(50, true).duration.should eql(30.0)
scissor.stretch(200).duration.should eql(30.0)
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)
end

it "should join instances of scissor" do
Expand Down

0 comments on commit 7e961a0

Please sign in to comment.