addProgramChange method

dynamic addProgramChange({
  1. required int tracknum,
  2. required int channel,
  3. required num time,
  4. required int program,
})

Add a MIDI program change event. :param tracknum: The zero-based track number to which program change event is added. :param channel: the MIDI channel to assign to the event. Integer, 0-15 :param time: The time (in beats) at which the program change event is placed double. :param program: the program number. Integer, 0-127.

Implementation

///:param tracknum: The zero-based track number to which program change event is added.
///:param channel: the MIDI channel to assign to the event.  [Integer, 0-15]
/// :param time: The time (in beats) at which the program change event is  placed [double].
/// :param program: the program number. [Integer, 0-127].

addProgramChange(
    {required int tracknum,
    required int channel,
    required num time,
    required int program}) {
  if (this._header.numeric_format == 1) {
    tracknum += 1;
  }

  this._tracks[tracknum].addProgramChange(
      channel, this._time_to_ticks(time), program,
      insertion_order: this._event_counter);
  this._event_counter += 1;
}