Skip to main content

Overview

The ArrangementView class is a static class that manages the main arrangement view in Lumix. It handles track management, clip selection, zoom controls, and rendering of the arrangement interface.

Namespace

Lumix.Views.Arrangement

Properties

MasterTrack
MasterTrack
required
The master track for the arrangement. Contains master audio output and effects.
public static MasterTrack MasterTrack { get; set; }
Tracks
List<Track>
required
List of all tracks in the arrangement. Read-only access to the tracks collection.
public static List<Track> Tracks { get; private set; }
BeatsPerBar
float
Current beats per bar setting for the arrangement grid. Read-only property.
public static float BeatsPerBar { get; }
Zoom
float
Current zoom level of the arrangement view. Value is clamped between 0.05 and 2.0.
public static float Zoom { get; }
SelectedClips
List<Clip>
List of currently selected clips in the arrangement.
public static List<Clip> SelectedClips { get; set; }
WindowPos
Vector2
Position of the arrangement window in screen coordinates.
public static Vector2 WindowPos { get; }
ArrangementScrollX
float
Horizontal scroll position of the arrangement view.
public static float ArrangementScrollX { get; }
ArrangementWidth
float
Width of the visible arrangement area.
public static float ArrangementWidth { get; }
MaxClipLength
float
Length of the longest clip in the arrangement, in pixels.
public static float MaxClipLength { get; }

Methods

Init

Initializes the arrangement view with default tracks.
public static void Init()
Example:
ArrangementView.Init();
// Creates 5 audio tracks and 5 MIDI tracks with default names

NewAudioTrack

Creates a new audio track and adds it to the arrangement.
public static AudioTrack NewAudioTrack(string name, int index = -1)
name
string
required
Name of the new audio track
index
int
default:"-1"
Position to insert the track. If -1, adds to the end of the track list.
Returns: The newly created AudioTrack Example:
// Add track at the end
var track = ArrangementView.NewAudioTrack("My Audio Track");

// Insert track at specific position
var insertedTrack = ArrangementView.NewAudioTrack("Inserted Track", 2);

NewMidiTrack

Creates a new MIDI track and adds it to the arrangement.
public static MidiTrack NewMidiTrack(string name, int index = -1)
name
string
required
Name of the new MIDI track
index
int
default:"-1"
Position to insert the track. If -1, adds to the end of the track list.
Returns: The newly created MidiTrack Example:
// Add MIDI track at the end
var midiTrack = ArrangementView.NewMidiTrack("Synth Lead");

// Insert MIDI track after selected track
int selectedIndex = ArrangementView.Tracks.IndexOf(DevicesView.SelectedTrack);
var newTrack = ArrangementView.NewMidiTrack("Bass", selectedIndex + 1);

ZoomChange

Changes the zoom level of the arrangement view with smooth interpolation.
public static void ZoomChange(float value)
value
float
required
Zoom delta. Positive values zoom in, negative values zoom out.
Example:
// Zoom in
ArrangementView.ZoomChange(1.0f);

// Zoom out
ArrangementView.ZoomChange(-1.0f);

NewZoomChange

Alternative zoom implementation with fixed increments and centered mouse behavior.
public static void NewZoomChange(float value)
value
float
required
Zoom direction. Positive values zoom in by 0.1, negative values zoom out by 0.1.
Example:
// Handle mouse wheel zoom
if (ImGui.IsKeyDown(ImGuiKey.ModCtrl))
{
    float scrollDelta = ImGui.GetIO().MouseWheel;
    if (scrollDelta != 0)
    {
        ArrangementView.NewZoomChange(scrollDelta);
    }
}

Render

Renders the arrangement view and handles all user interactions.
public static void Render()
Example:
// In your main render loop
ArrangementView.Render();

Keyboard Shortcuts

The ArrangementView responds to the following keyboard shortcuts:
ShortcutAction
DeleteDelete selected clips
Ctrl+DDuplicate selected clips
0Toggle enable/disable for selected clips
Right Arrow (hold)Move selected clips forward by one grid unit
Left Arrow (hold)Move selected clips backward by one grid unit
Ctrl+TCreate new audio track after selected track
Ctrl+Shift+TCreate new MIDI track after selected track
Ctrl+ScrollZoom in/out
Middle MousePan view

Usage Example

using Lumix.Views.Arrangement;
using Lumix.Tracks.AudioTracks;
using Lumix.Clips.AudioClips;

// Initialize the arrangement
ArrangementView.Init();

// Create a custom audio track
var guitarTrack = ArrangementView.NewAudioTrack("Guitar");

// Create a MIDI track for drums
var drumTrack = ArrangementView.NewMidiTrack("Drums");

// Select multiple clips
ArrangementView.SelectedClips.AddRange(guitarTrack.Clips.Take(3));

// Adjust zoom level
ArrangementView.ZoomChange(0.5f);

// Render the view
ArrangementView.Render();

Notes

  • The arrangement view automatically handles waveform resizing when zooming
  • Clips can be selected by clicking or using Ctrl+Click for multi-selection
  • The view supports grid snapping based on the BeatsPerBar setting
  • Timeline position can be changed by clicking in the arrangement area
  • All track rendering is handled internally by the Render() method

Build docs developers (and LLMs) love