private int[] GetBrushInfo(Beat beat)
{
var brushInfo = new int[beat.Voice.Bar.Staff.Track.Tuning.Length];
if (beat.BrushType != BrushType.None)
{
//
// calculate the number of
// a mask where the single bits indicate the strings used
var stringUsed = 0;
for (int i = 0, j = beat.Notes.Count; i < j; i++)
{
var n = beat.Notes[i];
if (n.IsTieDestination) continue;
stringUsed |= 0x01 << (n.String - 1);
}
//
// calculate time offset for all strings
if (beat.Notes.Count > 0)
{
int brushMove = 0;
var brushIncrement = GetBrushIncrement(beat);
for (int i = 0, j = beat.Voice.Bar.Staff.Track.Tuning.Length; i < j; i++)
{
var index = (beat.BrushType == BrushType.ArpeggioDown || beat.BrushType == BrushType.BrushDown)
? i
: ((brushInfo.Length - 1) - i);
if ((stringUsed & (0x01 << index)) != 0)
{
brushInfo[index] = brushMove;
brushMove = brushIncrement;
}
}
}
}
return brushInfo;
}