From d91f5830d24f8e2025aad494dfcf957fd124f5b1 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Sun, 18 Jul 2010 15:03:54 +0200
Subject: [PATCH] For explicitly notated accidentals, also create a
 <accidental> for the visual appearance

---
 pae2xml.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/pae2xml.pl b/pae2xml.pl
index 9ac3d50..25efe3e 100755
--- a/pae2xml.pl
+++ b/pae2xml.pl
@@ -519,6 +519,8 @@ sub parse_note {
 
   # Determine graphic notehead:
   print OUT notehead ($dur, $dot);
+  # If we have an explicit accidental on the note, print the <accidental> tag
+  print OUT accidental_explicit ($acc);
 
   print OUT $addition;
 
@@ -588,6 +590,17 @@ sub alter {
   return "";
 }
 
+sub accidental_explicit {
+  my ($acc) = @_;
+  my %accidentals = ("xx", "double-sharp", "x", "sharp", "n", "natural", "b", "flat", "bb", "flat-flat");
+  my $this_acc = $accidentals{$acc};
+  if ($this_acc) {
+    return "\t\t\t\t<accidental>$this_acc</accidental>\n";
+  } else {
+    return "";
+  }
+}
+
 sub notehead {
   my ($duration, $dots) = @_;
   if ($duration.$dots ne "") {
-- 
GitLab