Permalink
Browse files

Move apply_key_signature to ABC.pm.

  • Loading branch information...
1 parent 7e4ae77 commit fe6fa09bde69cef533d825262202e4b20e197ac8 @LastOfTheCarelessMen committed Jan 6, 2010
Showing with 17 additions and 17 deletions.
  1. +17 −0 lib/ABC.pm
  2. +0 −17 playing.pl
View
@@ -99,6 +99,23 @@ sub key_signature($key_signature_name)
return %hash;
}
+sub apply_key_signature(%key_signature, $pitch)
+{
+ my $resulting_note = "";
+ if $pitch<accidental>
+ {
+ $resulting_note ~= $pitch<accidental>.Str;
+ }
+ else
+ {
+ $resulting_note ~= %key_signature{$pitch<basenote>.uc}
+ if (%key_signature.exists($pitch<basenote>.uc));
+ }
+ $resulting_note ~= $pitch<basenote>.Str;
+ $resulting_note ~= $pitch<octave>.Str if $pitch<octave>;
+ return $resulting_note;
+}
+
class ABCHeader
{
View
@@ -30,23 +30,6 @@
}
}
-sub apply_key_signature(%key_signature, $pitch)
-{
- my $resulting_note = "";
- if $pitch<accidental>
- {
- $resulting_note ~= $pitch<accidental>.Str;
- }
- else
- {
- $resulting_note ~= %key_signature{$pitch<basenote>.uc}
- if (%key_signature.exists($pitch<basenote>.uc));
- }
- $resulting_note ~= $pitch<basenote>;
- $resulting_note ~= $pitch<octave> if $pitch<octave>;
- return $resulting_note;
-}
-
my %header = header_hash($match<ABC::tune><header>);
my %key_signature = key_signature(%header<K>);

0 comments on commit fe6fa09

Please sign in to comment.