Overview
TheMidiTrack class extends the base Track class to provide MIDI-specific functionality. MIDI tracks can contain MIDI clips and support VST instrument plugins for sound generation.
Constructor
MidiTrack()
Creates a new MIDI track with default settings.Optional name for the track. Defaults to an empty string.
Properties
TrackType
Returns
TrackType.Midi to identify this as a MIDI track.DraggedClip
Returns the currently dragged MIDI clip data, or null if no clip is being dragged.
Inherited Properties
MidiTrack inherits the following properties from theTrack base class:
The audio engine for this track (TrackMidiEngine).
Unique identifier for the track (auto-generated GUID).
The display name of the track.
Whether the track is enabled (unmuted).
Whether the track is soloed.
Whether recording should start when the play button is pressed.
Track volume in decibels (-90dB to +6dB).
Track panning (-50 to +50).
RGBA color of the track.
List of clips contained in this track.
The Y position of the track in the arrangement view.
Whether the mouse cursor is over this track.
Selected time region on the track in musical time.
Whether the track is in area selection mode.
Methods
CreateMidiClip(long)
Creates a new MIDI clip at the specified time position.The starting time in ticks for the new MIDI clip.
CreateMidiClip(TimeSelection)
Creates a new MIDI clip with the duration and position defined by a time selection.The time selection defining the clip’s start, end, and duration.
Inherited Methods
MidiTrack inherits these methods from theTrack base class:
SetDraggedClip()
Sets the currently dragged clip.The clip being dragged, or null to clear.
SetDragStartOffset()
Sets the offset from the clip’s start when dragging begins.The X offset in pixels.
RenderArrangement()
Renders the track in the arrangement view. This method handles all track rendering including clips, selection areas, and grid lines.RenderControls()
Renders the track control panel including volume, pan, mute, solo, and other controls.Events
MidiTrack automatically subscribes to volume measurement events from its audio engine:- VolumeMeasured: Triggered when audio volume is measured, updates left and right channel gain meters.
Usage Example
Notes
- MIDI tracks automatically create a
TrackMidiEngineon construction - Double-clicking on empty space in the arrangement creates a new MIDI clip
- MIDI tracks support VST instrument plugins for sound generation
- The track color is randomly assigned on creation but can be changed
- Volume gain is measured in real-time for the left and right channels