Exemplo n.º 1
0
        /// <summary>Inserts a new system exclusive (SysEx) message/event into this file at the specified index.</summary>
        /// <param name="index">The index in this file's list at which the event should be inserted.</param>
        /// <param name="deltaTime">The amount of time (in ticks) between the previous event in the track and this one.</param>
        /// <param name="escape">
        /// False indicates a regular SysEx message, which could be the first in a series of timed packets.
        /// True indicates a SysEx "escape," or the next in a series of timed packets.
        /// </param>
        /// <param name="bytes">Array of bytes containing the event data (not including the delta-time or status byte).</param>
        /// <returns>The new MidiSysExEvent object that is inserted.</returns>
        public MidiSysExEvent InsertSysExEvent(int index, int deltaTime, bool escape, byte[] bytes)
        {
            int n = MidiSysExEvent.SizeItem(0, 0), offset = this.Items[index].Offset;

            this.Resize(n, offset, index);
            MidiSysExEvent sysExEvent = this.CreateSysExEvent(offset, deltaTime, escape, bytes);

            this.Items.Insert(index, sysExEvent);
            this.SetTotalTime(index);
            return(sysExEvent);
        }
Exemplo n.º 2
0
        /// <summary>Adds a new system exclusive (SysEx) message/event to the end of this file.</summary>
        /// <param name="deltaTime">The amount of time (in ticks) between the previous event in the track and this one.</param>
        /// <param name="escape">
        /// False indicates a regular SysEx message, which could be the first in a series of timed packets.
        /// True indicates a SysEx "escape," or the next in a series of timed packets.
        /// </param>
        /// <param name="bytes">Array of bytes containing the event data (not including the delta-time or status byte).</param>
        /// <returns>The new MidiSysExEvent object that is added.</returns>
        public MidiSysExEvent AddSysExEvent(int deltaTime, bool escape, byte[] bytes)
        {
            int n = MidiSysExEvent.SizeItem(0, 0), offset = this.Bytes.Length;

            this.Resize(n, offset, this.ItemCount);
            MidiSysExEvent sysExEvent = this.CreateSysExEvent(offset, deltaTime, escape, bytes);

            this.Items.Add(sysExEvent);
            this.SetTotalTime(this.ItemCount - 1);
            return(sysExEvent);
        }