Skip to main content

Overview

The Track class is an abstract base class representing a track in the Lumix DAW. Tracks contain clips, manage audio routing through a track engine, and provide UI controls for volume, pan, solo, mute, and recording.

Namespace

Lumix.Tracks

Inheritance

public abstract class Track

Properties

TrackType
TrackType
required
The type of track (Audio, Midi, or Group). This is an abstract property that must be implemented by derived classes.
public abstract TrackType TrackType { get; }
Engine
TrackEngine
required
The audio engine responsible for processing this track’s audio output.
public TrackEngine Engine { get; protected set; }
Id
string
required
Unique identifier for the track. Automatically generated using Guid.NewGuid().
public string Id { get; set; }
Name
string
required
The display name of the track.
public string Name { get; protected set; }
Enabled
bool
required
Whether the track is enabled (not muted). When disabled, the track produces no output.
public bool Enabled { get; private set; }
Default: true
Solo
bool
required
Whether the track is soloed. When enabled, all other tracks are muted.
public bool Solo { get; private set; }
Default: false
RecordOnStart
bool
required
Whether the track should start recording when the global record button is pressed.
public bool RecordOnStart { get; private set; }
Default: false
Volume
float
required
Track volume in decibels (dB). Range: -90.0 to 6.0 dB.
public float Volume { get; private set; }
Pan
float
required
Track panning. Range: -50.0 (hard left) to 50.0 (hard right).
public float Pan { get; private set; }
Default: 0 (center)
Color
Vector4
required
RGBA color of the track for visual identification.
public Vector4 Color { get; protected set; }
Clips
List<Clip>
required
List of all clips contained in this track.
public List<Clip> Clips
TimeSelectionArea
TimeSelection
required
The currently selected time range in musical time on this track.
public TimeSelection TimeSelectionArea { get; protected set; }
DraggedClip
Clip
required
The clip currently being dragged by the user, or null if no clip is being dragged.
public Clip DraggedClip { get; }

Methods

SetDraggedClip

Sets the currently dragged clip.
public void SetDraggedClip(Clip? draggedClip)
draggedClip
Clip?
required
The clip being dragged, or null to clear.

SetDragStartOffset

Stores the horizontal offset when a drag operation starts.
public void SetDragStartOffset(float dragStartOffsetX)
dragStartOffsetX
float
required
The X-axis offset in pixels where the drag started.

RenderArrangement

Renders the track in the arrangement view, including all clips and grid lines.
public void RenderArrangement()
This method handles:
  • Clip rendering and dragging
  • Time selection area
  • Grid line visualization
  • Drag-and-drop operations for clips and plugins
  • Clip duplication

RenderControls

Renders the track control panel with volume, pan, solo, mute, and other controls.
public void RenderControls()
This method displays:
  • Track name
  • Track reordering buttons
  • Volume meter
  • Enable/solo/record toggles
  • Volume and pan sliders
  • Track color picker

Example Usage

// Creating a new audio track (typically done through ArrangementView)
var audioTrack = new AudioTrack("Vocals", project.AudioOutputDevice);
audioTrack.Color = new Vector4(0.2f, 0.5f, 0.8f, 1.0f);

// Adding a clip to the track
var audioClip = new AudioClip(audioTrack, new AudioClipData("vocal.wav"), 0);
audioTrack.Clips.Add(audioClip);

// Adjusting track volume (in dB)
audioTrack.Volume = -6.0f;
float linearVolume = (float)Math.Pow(10, audioTrack.Volume / 20);
audioTrack.Engine.StereoSampleProvider.SetGain(linearVolume);

// Panning the track
audioTrack.Pan = 25.0f; // Pan right
float mappedPan = audioTrack.Pan / 50f;
audioTrack.Engine.StereoSampleProvider.Pan = mappedPan;

Derived Classes

  • AudioTrack: For audio clips and audio processing
  • MidiTrack: For MIDI clips and virtual instruments
  • GroupTrack: For grouping and submixing multiple tracks

See Also

  • Clip - Audio and MIDI clips contained in tracks
  • TrackEngine - Audio processing engine for tracks
  • MusicalTime - Time representation in bars, beats, and ticks

Build docs developers (and LLMs) love