private void parseChords(Song2014 xml, Sng2014File sng, Int16[] tuning, bool bass)
{
sng.Chords = new ChordSection();
sng.Chords.Count = xml.ChordTemplates.Length;
sng.Chords.Chords = new Chord[sng.Chords.Count];
for (int i = 0; i < sng.Chords.Count; i++)
{
var chord = xml.ChordTemplates[i];
var c = new Chord();
// fix for 'Object reference not set to an instance of an object' error
if (chord.DisplayName == null)
chord.DisplayName = String.Empty;
if (chord.DisplayName.EndsWith("arp"))
c.Mask |= CON.CHORD_MASK_ARPEGGIO;
else if (chord.DisplayName.EndsWith("nop"))
c.Mask |= CON.CHORD_MASK_NOP;
c.Frets[0] = (Byte)chord.Fret0;
c.Frets[1] = (Byte)chord.Fret1;
c.Frets[2] = (Byte)chord.Fret2;
c.Frets[3] = (Byte)chord.Fret3;
c.Frets[4] = (Byte)chord.Fret4;
c.Frets[5] = (Byte)chord.Fret5;
c.Fingers[0] = (Byte)chord.Finger0;
c.Fingers[1] = (Byte)chord.Finger1;
c.Fingers[2] = (Byte)chord.Finger2;
c.Fingers[3] = (Byte)chord.Finger3;
c.Fingers[4] = (Byte)chord.Finger4;
c.Fingers[5] = (Byte)chord.Finger5;
for (Byte s = 0; s < 6; s++)
c.Notes[s] = GetMidiNote(tuning, s, c.Frets[s], bass, xml.Capo, template: true);
readString(chord.ChordName, c.Name);
sng.Chords.Chords[i] = c;
}
}