[jmsl] Track.getInsertionIndex() ?

jmsl at music.columbia.edu jmsl at music.columbia.edu
Mon Dec 1 15:58:28 EST 2008

Hi Peter

You are right there is no public getter for a Track's insertion index.  
Until now, the only one who needs to kow it is the Track, which most of 
the time is being told what its insertion index is by other classes, who 
do not care what the current index i (for example, the action of 
clicking between a couple of notes to insert a new note does not depend 
on the current insertion index.

I guess you are either inserting notes into a track with public void 
insertNote(Note note)  or insertNote(Note note, int index) ?
If the latter, then you already know the index. If the former, then you 
should know that insertindex is incremented by 1 every time this is called.

Alternatively you could keep track of the last Note added to each Track 
and then ask the Note.getNoteIndex()

But let's back up for a sec;  what method are you calling to insert 
notes into your Tracks?


jmsl at music.columbia.edu wrote:
> Hi Nick,
> I was wondering if it would be possible to see what the current 
> insertionIndex is for a track, so that it's possible to see where the 
> last insertion was made.  Is this feasible?
> I'm working on a step-time entry (again!) for JMSL, and I'd like it 
> such that when I change tracks, I can jump back to the last insert 
> position with the cursor.  There's other ways to do this, but it seems 
> like it probably already exists and is closest to the underlying 
> code.  (though there may be a reason why this isn't public?)
> thanks,
> Peter McCulloch
> _______________________________________________
> jmsl mailing list
> jmsl at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/jmsl

More information about the jmsl mailing list