Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playlist creation
#1
I have been unable to figure out how to create a new playlist on a track in an EditorAction script.
I have a nice little script working except for this one (or two) lines.

Has anybody done this, or have any idea where to look?

Thanks in advance.

-Rick

Edit: I just noticed that after I run the script, the Undo command says it wants to undo a "new playlist" command, so something is happening.

The (simplified) code at issue is:
for t in Session:get_tracks():iter() do
Editor:new_playlists(t.to_audio_track)
end

I have no idea if this is how it's supposed to be done, and have yet to find an example anywhere.
Reply
#2
Good idea for a script!
Reply
#3
Thanks, Ben.
The whole thing is to iterate over all the tracks, and for each track that is record enabled, to create a new playlist.
Then, it record-enables the session, moves the playhead to Start, and rolls transport.
This then makes it a one-click operation to do a new take - assuming you're using playlists for takes.

All of that works except for the creation of the new playlist on each track, which I haven't figured out.
Reply
#4
(11-10-2017, 09:16 AM)dustinnr Wrote: Thanks, Ben.
The whole thing is to iterate over all the tracks, and for each track that is record enabled, to create a new playlist.
Then, it record-enables the session, moves the playhead to Start, and rolls transport.
This then makes it a one-click operation to do a new take - assuming you're using playlists for takes.

All of that works except for the creation of the new playlist on each track, which I haven't figured out.

Turns out you were incredibly close! I noticed in the class reference for Lua that new_playlists() takes an argument of a TimeAxisView. I seemed to recall this being used in s_showhide_track.lua.

Really all you needted to do was lookup the route/track's RouteTimeAxisView and then call that function with it cast :to_timeaxisview()

Code:
ardour {
    ["type"]    = "EditorAction",
    name        = "New Playlist",
    license     = "MIT",
    author      = "Nik",
    description = [[Prompts and builds a new playlist for every track in the session.]]
}

function factory () return function ()

    for r in Session:get_tracks():iter() do
        local rtav = Editor:rtav_from_route(r) -- lookup RTAV
        Editor:new_playlists(rtav:to_timeaxisview())
    end

collectgarbage()
end end

Coincidentally, just hold down 'enter' and it'll get rid of the dialog box very quickly. (though I should say, you'll want to have good naming conventions using this)
Welcome to Zombocom
Reply
#5
Nice. Thanks. That works.
I'm typically using this with only one track (but which one it is varies), so I'm not going to see 100 dialog boxes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)