The Mudcat Café TM
Thread #51563   Message #917108
Posted By: GUEST,Jon
24-Mar-03 - 11:22 AM
Thread Name: Mudcat Guide: TABS for Mandolin/Guitar From the DT
Subject: RE: Mudcat Guide: TABS for Mandolin/Guitar From the DT
John, I'm really struggling with this - trying to understand his logic and to understand Perl (though it is C like enough to make some sense to me).

After about 3 hrs... I've found the reason for the accidentals not working. He has a section:


if ($nt < $NumChars - 1) {   
   SWITCH: for (substr($inline,$nt+1,1)) {
       /\(/          && do { $ProcessNow = "Yes"; };
       /\|/          && do { $ProcessNow = "Yes"; };
       /\:/          && do { $ProcessNow = "Yes"; };
       /\[/          && do { $ProcessNow = "Yes"; };
       / /            && do { $ProcessNow = "Yes"; };
       /[A-Ga-gZz]/   && do { $ProcessNow = "Yes"; };
};

What that does is checks the character after the one being currently being worked on. The logic is for example that if the next character is a note, it's time to put all the information (note length, whether an accidental, etc.) into his structure.

The flaw is that certain items like accidentals precede notes. So if you have ^C, the above code sees the next character is a note and decides to move on to the next step.

I've managed to get:
C ^C | D^D E F ^F G ^G | A ^A B c ^c | d ^d e f | ^f g ^g a ^a b |

to display correctly by adding a line after that switch statement to tell it that if the current character is a "sharp", it should set $ProcessNow = "No".

Jon