public void ReadNote(Track track, Bar bar, Voice voice, Beat beat, int stringIndex)
{
var newNote = new Note();
newNote.String = track.Tuning.Length - stringIndex;
var flags = Data.ReadByte();
if ((flags & 0x02) != 0)
{
newNote.Accentuated = AccentuationType.Heavy;
}
else if ((flags & 0x40) != 0)
{
newNote.Accentuated = AccentuationType.Normal;
}
newNote.IsGhost = ((flags & 0x04) != 0);
if ((flags & 0x20) != 0)
{
var noteType = Data.ReadByte();
if (noteType == 3)
{
newNote.IsDead = true;
}
else if (noteType == 2)
{
newNote.IsTieDestination = true;
}
}
if ((flags & 0x01) != 0 && _versionNumber < 500)
{
Data.ReadByte(); // duration
Data.ReadByte(); // tuplet
}
if ((flags & 0x10) != 0)
{
var dynamicNumber = Data.ReadSignedByte();
newNote.Dynamic = ToDynamicValue(dynamicNumber);
beat.Dynamic = newNote.Dynamic;
}
if ((flags & 0x20) != 0)
{
newNote.Fret = Data.ReadSignedByte();
}
if ((flags & 0x80) != 0)
{
newNote.LeftHandFinger = (Fingers)Data.ReadSignedByte();
newNote.RightHandFinger = (Fingers)Data.ReadSignedByte();
newNote.IsFingering = true;
}
if (_versionNumber >= 500)
{
if ((flags & 0x01) != 0)
{
newNote.DurationPercent = ReadDouble();
}
var flags2 = Data.ReadByte();
newNote.AccidentalMode = (flags2 & 0x02) != 0
? NoteAccidentalMode.SwapAccidentals
: NoteAccidentalMode.Default;
}
beat.AddNote(newNote);
if ((flags & 0x08) != 0)
{
ReadNoteEffects(track, voice, beat, newNote);
}
}