Working with Note Tracks

Changing the time property of a note key may cause it to go out of time order relative to the other keys in the controller. You must call the sortKeys() function on the controller or associated MAXNoteKeyArray once all key time manipulations of this kind is complete so that animation will perform correctly.

FOR EXAMPLE,

   s = sphere()-- create a sphere
   -->$Sphere:Sphere02 @ [0.0,0.0,0.0]
   ntp1 = NoteTrack"PosNT1"-- create a note track
   -->Notetrack:PosNT1
   ntp2 = NoteTrack"PosNT2"-- create another note track
   -->Notetrack:PosNT2
   -- apply first note track to sphere's pos controller:
   addNoteTrack s.pos.controller ntp1
   -->OK
   -- apply second note track to sphere's pos controller:
   addNoteTrack s.pos.controller ntp2
   -->OK
   -- check number of note tracks on pos controller:
   numNoteTracks s.pos.controller
   -->2
   -- test to see if pos controller has note tracks:
   hasNoteTracks s.pos.controller
   -->true
   -- add key to first note track, and select the key:
   addNewNoteKey ntp1.keys 20 #select
   -->#Note key(1 @ 20f)
   -- add another key to first note track:
   addNewNoteKey ntp1.keys 40
   -->#Note key(2 @ 40f)
   -- retrieve first note track on the pos controller:
   n = getNoteTrack s.pos.controller 1
   -- retrieve an instance of the note track key array Notetrack:
   nk=n.keys
   -->#keys(20f, 40f)
   -- set value for second note key:
   nk[2].value ="Yo What's Up"
   -->"Yo What's Up"
   -- change the time for second note key. Now first key
   nk[2].time = 10
   -->10
   nk[1].selected = true-- select the first note key
   -->true
   -- changed the time of the note keys, so re-sort:
   sortNoteKeys nk
   -->OK
   nk.count-- check number of keys
   -->2
   nk-- display the note keys
   -->#keys(10f, 20f)
   --  To delete the note tracks and note keys:
   deleteNoteKey nk 1-- delete first note key
   -->OK
   deleteNoteKeys n.keys #allKeys-- delete all the note keys
   -->OK
   -- remove note track from pos controller:
   deleteNoteTrack s.pos.controller ntp1
   -->OK
   -- remove note track from pos controller:
   deleteNoteTrack s.pos.controller ntp2
   -->OK