private static Note PreviousNoteOnSameLine(Note note)
{
var previousBeat = note.Beat.PreviousBeat;
// keep searching in same bar
while (previousBeat != null && previousBeat.Voice.Bar.Index >= note.Beat.Voice.Bar.Index - MaxOffsetForSameLineSearch)
{
var noteOnString = previousBeat.GetNoteOnString(note.String);
if (noteOnString != null)
{
return noteOnString;
}
else
{
previousBeat = previousBeat.PreviousBeat;
}
}
return null;
}