How to delete clip with Javascript?
I've got this library (https://github.com/ricardomatias/ableton-live) that interfaces between javascript (outside of max) and ableton live. I'm trying to add the delete_clip function to a track, which expects a Clip to be passed as an argument. I tried to pass an id and it didn't work, I then tried passing the LiveAPI instance of the clip, but that also didn't work. Does anyone have any idea what's the method to have these kind of functions that need instances of an element working?
What error are you getting in the console? The message "call delete_clip id 1117" works for me in Max. So in JS I'd expect this to work:
track_api.call("delete_clip", "id", 1117)
----- After a little testing I can confirm this is working in JS -----
function bang() {
var api = new LiveAPI(null, "this_device canonical_parent clip_slots 0 clip")
post("api.id", api.id, api.type, "\n")
var id = api.id
api.goto("canonical_parent canonical_parent")
post("api.id", api.id, api.type, "\n")
api.call("delete_clip", "id", id)
}
Thanks Tyler, it works now! I was passing just the id beforehand without prepending "id".