Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introduced numerical intervals * Numeric pitch prefix is pit/pitch instead of y * Numeric velocity prefix is vel/velocity in addition to v * Numeric duration prefix is dur/duration instead of u Fixed issues with Ruby expressions for these numerical nodes not re-evaluating when looping.
- Loading branch information
1 parent
fd9fad4
commit cf61a49
Showing
9 changed files
with
169 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require File.dirname(__FILE__)+'/spec_helper' | ||
|
||
SEQUENCE_COUNT_LIMIT = 1000 | ||
|
||
describe Cosy::Sequencer do | ||
|
||
describe 'Ruby Support' do | ||
|
||
it 'should re-evaluate Ruby values for numeric pitches' do | ||
$x = nil | ||
sequence('pit{$x ||= 0; $x += 1}*3').should == [1,2,3] | ||
end | ||
|
||
it 'should re-evaluate Ruby values for numeric intervals' do | ||
$x = nil | ||
sequence('i{$x ||= 0; $x += 1}*3').should == [1,2,3] | ||
end | ||
|
||
it 'should re-evaluate Ruby values for numeric velocities' do | ||
$x = nil | ||
sequence('v{$x ||= 0; $x += 1}*3').should == [1,2,3] | ||
end | ||
|
||
it 'should re-evaluate Ruby values for numeric durations' do | ||
$x = nil | ||
sequence('dur{$x ||= 0; $x += 1}*3').should == [1,2,3] | ||
end | ||
|
||
end # described Ruby support | ||
|
||
|
||
def sequencer(input) | ||
Sequencer.new(input) | ||
end | ||
|
||
def sequence(input) | ||
if input.is_a? Sequencer | ||
sequener = input | ||
else | ||
sequener = sequencer(input) | ||
end | ||
sequence = [] | ||
count = 0 | ||
while value=sequener.next and count < SEQUENCE_COUNT_LIMIT | ||
sequence << value | ||
count += 1 | ||
end | ||
if count == SEQUENCE_COUNT_LIMIT | ||
# this is for infinite loop prevention | ||
fail "#{input} output more than #{SEQUENCE_COUNT_LIMIT}" | ||
end | ||
return sequence | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.