Permalink
Browse files

Think this adds modes in...

  • Loading branch information...
1 parent 9b8264b commit 94fb44562c409ad0868e4e8eb2a5c0b1b2e81da8 @LastOfTheCarelessMen committed Dec 30, 2009
Showing with 22 additions and 5 deletions.
  1. +22 −5 playing.pl
View
@@ -54,13 +54,30 @@ ($key_signature_name)
die "Illegal key signature\n" unless $match ~~ Match;
say "$key_signature_name:";
my $lookup = [~] $match<ABC::basenote>.uc, $match[0];
+ my $sharps = %keys{$lookup};
- my @sharps = <F C G D A E B>;
- my %hash = @sharps Z @sharps;
+ if ($match[1].defined) {
+ given ~($match[1]) {
+ when "" { }
+ when /^maj/ { }
+ when /^ion/ { }
+ when /^mix/ { $sharps -= 1; }
+ when /^dor/ { $sharps -= 2; }
+ when /^m/ { $sharps -= 3; }
+ when /^aeo/ { $sharps -= 3; }
+ when /^phr/ { $sharps -= 4; }
+ when /^loc/ { $sharps -= 5; }
+ when /^lyd/ { $sharps += 1; }
+ default { die "Unknown mode {$match[1]} requested"; }
+ }
+ }
+
+ my @sharp_notes = <F C G D A E B>;
+ my %hash = @sharp_notes Z @sharp_notes;
- given %keys{$lookup} {
- when 1..7 { for ^%keys{$lookup} -> $i { %hash{@sharps[$i]} = "^" ~ @sharps[$i]; } }
- when -7..-1 { for ^(-%keys{$lookup}) -> $i { %hash{@sharps[6-$i]} = "_" ~ @sharps[6-$i]; } }
+ given $sharps {
+ when 1..7 { for ^$sharps -> $i { %hash{@sharp_notes[$i]} = "^" ~ @sharp_notes[$i]; } }
+ when -7..-1 { for ^(-$sharps) -> $i { %hash{@sharp_notes[6-$i]} = "_" ~ @sharp_notes[6-$i]; } }
}
say %hash.perl;

0 comments on commit 94fb445

Please sign in to comment.