Track myTrack; Media myMedia; QTAtomContainer anEventList; PTMHDescriptionHandle aDesc = nil; TimeValue sampleTime; myTrack = NewMovieTrack(theMovie, (long) myWidth << 16, (long) myHeight << 16, 0); // create the media for the track myMedia = NewTrackMedia(myTrack, // the track kPTMediaType, // the type of media aTimeScale, // time scale nil, // data ref (OSType) nil); // type of data ref anEventList = PTNewEventList(); anError = PTAddLocateEventToList(anEventList, 1, // target 0, // time 0, // x 0, // y 0); // z anError = PTAddNoteEventToList(anEventList, 1, // target 5, // time 60, // note 95, // velocity 0); // duration (0=forever) anError = PTAddNoteEventToList(anEventList, 1, // target 65, // time 60, // note 0, // velocity (0=off) 0); // duration (0=forever) aDesc = (PTMHDescriptionHandle) NewHandleClear(sizeof(PTMHDescription)); (**aDesc).size = sizeof(PTMHDescription); (**aDesc).type = kPTMediaType; (**aDesc).version = kPTMediaVersion; // Start editing session anError = BeginMediaEdits(theMedia); // add the data to the media anError = AddMediaSample(theMedia, (Handle) anEventList, // the sample 0L, // offset GetHandleSize((Handle) anEventList), 65, // duration of sample (SampleDescriptionHandle) aDesc, 1, // number of samples 0, // sample flags &sampleTime); // returned time // end editing session anError = EndMediaEdits(theMedia); // append to the track anError = InsertMediaIntoTrack(theTrack, // the track -1, // where to insert 0, // where in the media 65, // how much media to insert 1L << 16); // the media rate