[jmsl] Insertion index for Track...?
jmsl at music.columbia.edu
jmsl at music.columbia.edu
Sat Nov 1 17:33:03 EDT 2008
Hi Nick,
Thanks, that clarifies much!
Peter McCulloch
On Nov 1, 2008, at 9:09 AM, jmsl at music.columbia.edu wrote:
> Hi Peter
>
> When the mouse is clicked with the intention of inserting a note,
> EditManager enumerates through all notes in the current layout and
> finds the closest note. Notes which are close but not in the
> currently active track are scored as very far away
> Something like
> if (note.getTrack().getTrackIndex() !=
> score.getCurrentTrackNumber()) {
> distance = Integer.MAX_VALUE;
> }
> By the end of the enumeration a temporary variable "closestNote" is
> inspected and if its distance from the mouse click is less than some
> threshold ("chord attractor radius"), the new note becomes part of a
> chord that is built on closestNote
> Else if the closestNote does not qualify as being close enough, the
> new note gets inserted into staff with the insertion index
> calculated by:
> int insertionIndex = staff.getInsertionIndex(location,
> editStateProvider.getActiveTrackIndex());
>
> Thanks
> Nick
More information about the jmsl
mailing list