/// <summary>Inserts a new meta-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="type">Meta-event type (always less than 128).</param> /// <param name="bytes"> /// Array of bytes containing the event data (not including the delta-time, status byte, or type byte). /// </param> /// <returns>The new MidiMetaEvent object that is inserted.</returns> public MidiMetaEvent InsertMetaEvent(int index, int deltaTime, int type, byte[] bytes) { int n = MidiMetaEvent.SizeItem(0, 0), offset = this.Items[index].Offset; this.Resize(n, offset, index); MidiMetaEvent metaEvent = this.CreateMetaEvent(offset, deltaTime, type, bytes); this.Items.Insert(index, metaEvent); this.SetTotalTime(index); return(metaEvent); }
/// <summary>Adds a new meta-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="type">Meta-event type (always less than 128).</param> /// <param name="bytes"> /// Array of bytes containing the event data (not including the delta-time, status byte, or type byte). /// </param> /// <returns>The new MidiMetaEvent object that is added.</returns> public MidiMetaEvent AddMetaEvent(int deltaTime, int type, byte[] bytes) { int n = MidiMetaEvent.SizeItem(0, 0), offset = this.Bytes.Length; this.Resize(n, offset, this.ItemCount); MidiMetaEvent metaEvent = this.CreateMetaEvent(offset, deltaTime, type, bytes); this.Items.Add(metaEvent); this.SetTotalTime(this.ItemCount - 1); return(metaEvent); }