Skip to content

Fix insert_device to select track before browser.load_item() #174

@ldraney

Description

@ldraney

Problem

/live/track/insert_device ignores the track index parameter. Devices load to whatever track is currently selected in Ableton's UI.

Root cause: browser.load_item() in abletonosc/track.py loads to the selected track, not the track passed to the handler.

Current workaround

Callers must select the track first:

view.set_selected_track(track_idx)
time.sleep(0.1)
track.insert_device(track_idx, "Wavetable")

Proposed fix

In abletonosc/track.py, line ~145, add track selection before load_item:

def track_insert_device(track, params: Tuple[Any]):
    device_uri = str(params[0])
    device_index = int(params[1]) if len(params) > 1 else -1
    
    # Select this track so browser.load_item targets it
    self.song.view.selected_track = track
    
    # ... existing browser.load_item code

Testing

Run from ableton-mcp-server or any song script - device should load to specified track without manual selection.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions