Exemplo n.º 1
0
 /* set tie target */
 public static void PutQuantizedEventTieTarget(
     QuantEventRec Event,
     QuantEventRec TieTarget)
 {
     Debug.Assert(Event.Type == QuantEventType.eQuantizedNoteEvent);
     Event.TieTarget = TieTarget;
 }
Exemplo n.º 2
0
 /* 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;
 }
Exemplo n.º 3
0
        /* 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);
        }
Exemplo n.º 4
0
        /* 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);
        }
Exemplo n.º 5
0
 /* 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;
 }
Exemplo n.º 6
0
        /* 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);
        }
Exemplo n.º 7
0
        /* 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;
        }
Exemplo n.º 8
0
        /* 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);
        }
Exemplo n.º 9
0
 /* get the tie target */
 public static QuantEventRec GetQuantizedEventTieTarget(QuantEventRec Event)
 {
     Debug.Assert(Event.Type == QuantEventType.eQuantizedNoteEvent);
     return(Event.TieTarget);
 }
Exemplo n.º 10
0
 /* get event time */
 public static FractionRec GetQuantizedEventTime(QuantEventRec Event)
 {
     return(Event.StartTime);
 }
Exemplo n.º 11
0
 /* get type of event */
 public static QuantEventType QuantizedEventGetType(QuantEventRec Event)
 {
     return(Event.Type);
 }