/* set tie target */ public static void PutQuantizedEventTieTarget( QuantEventRec Event, QuantEventRec TieTarget) { Debug.Assert(Event.Type == QuantEventType.eQuantizedNoteEvent); Event.TieTarget = TieTarget; }
/* get comment event information. *MessageActualOut is the actual heap block. */ /* fields may be NIL if value is not needed */ public static void GetQuantizedCommentEventInfo( QuantEventRec Event, out FractionRec StartTimeOut, out double StartTimeAdjustOut, out string CommentStringOut) { Debug.Assert(Event.Type == QuantEventType.eQuantizedCommentEvent); StartTimeOut = Event.StartTime; StartTimeAdjustOut = Event.StartTimeAdjust; CommentStringOut = Event.CommentString; }
/* create new interval comment. comment string is a heap allocated */ /* non-null-terminated string; onwership of string goes to the object */ public static QuantEventRec NewQuantizedCommentEvent( FractionRec StartTime, double StartTimeAdjust, string CommentString) { QuantEventRec Event = new QuantEventRec(); Event.Type = QuantEventType.eQuantizedCommentEvent; Event.StartTime = StartTime; Event.StartTimeAdjust = StartTimeAdjust; Event.CommentString = CommentString; return(Event); }
/* look up note event corresponding to quant event */ public static NoteNoteObjectRec TieMappingLookup( TieMappingRec Mapping, QuantEventRec Key) { NodeRec Scan; Scan = Mapping.List; while (Scan != null) { if (Scan.Key == Key) { return(Scan.Value); } Scan = Scan.Next; } Debug.Assert(false); // key not found return(null); }
/* get note event information. fields may be NIL if value is not needed */ public static void GetQuantizedNoteEventInfo( QuantEventRec Event, out FractionRec StartTimeOut, out double StartTimeAdjustOut, out NoteFlags DurationOut, out double DurationAdjustOut, out short MIDIPitchOut, out short MIDIAttackVelocityOut, out short MIDIReleaseVelocityOut) { Debug.Assert(Event.Type == QuantEventType.eQuantizedNoteEvent); StartTimeOut = Event.StartTime; StartTimeAdjustOut = Event.StartTimeAdjust; DurationOut = Event.Duration; DurationAdjustOut = Event.DurationAdjust; MIDIPitchOut = Event.MIDIPitch; MIDIAttackVelocityOut = Event.MIDIAttackVelocity; MIDIReleaseVelocityOut = Event.MIDIReleaseVelocity; }
/* insert new event sorted into the track */ public static void QuantizedTrackInsertEventSorted( QuantizedTrackRec Track, QuantEventRec Event) { FractionRec OurEventStartTime = GetQuantizedEventTime(Event); int Scan = Track.EventList.Count - 1; while (Scan >= 0) { QuantEventRec OtherEvent = Track.EventList[Scan]; FractionRec OtherEventStartTime = GetQuantizedEventTime(OtherEvent); if (FractionRec.FracGreaterEqual(OurEventStartTime, OtherEventStartTime)) { Track.EventList.Insert(Scan + 1, Event); return; } Scan -= 1; } Track.EventList.Insert(0, Event); }
/* add a quant-note pair */ public static void TieMappingAddPair( TieMappingRec Mapping, QuantEventRec QuantEvent, NoteNoteObjectRec NoteEvent) { NodeRec NewNode; /* allocate */ if (Mapping.FreeList == null) { ExpandFreeList(Mapping); } /* unlink first mapping entry */ NewNode = Mapping.FreeList; Mapping.FreeList = Mapping.FreeList.Next; /* fill in fields */ NewNode.Key = QuantEvent; NewNode.Value = NoteEvent; NewNode.Next = Mapping.List; Mapping.List = NewNode; }
/* create new interval note */ public static QuantEventRec NewQuantizedNoteEvent( FractionRec StartTime, double StartTimeAdjust, NoteFlags Duration, double DurationAdjust, short MIDIPitch, short MIDIAttackVelocity, short MIDIReleaseVelocity) { QuantEventRec Event = new QuantEventRec(); Event.Type = QuantEventType.eQuantizedNoteEvent; Event.StartTime = StartTime; Event.StartTimeAdjust = StartTimeAdjust; Event.Duration = Duration; Event.DurationAdjust = DurationAdjust; Event.MIDIPitch = MIDIPitch; Event.MIDIAttackVelocity = MIDIAttackVelocity; Event.MIDIReleaseVelocity = MIDIReleaseVelocity; Event.TieTarget = null; return(Event); }
/* get the tie target */ public static QuantEventRec GetQuantizedEventTieTarget(QuantEventRec Event) { Debug.Assert(Event.Type == QuantEventType.eQuantizedNoteEvent); return(Event.TieTarget); }
/* get event time */ public static FractionRec GetQuantizedEventTime(QuantEventRec Event) { return(Event.StartTime); }
/* get type of event */ public static QuantEventType QuantizedEventGetType(QuantEventRec Event) { return(Event.Type); }