View Single Post
Old 11-20-2016, 04:10 AM   #5
Human being with feelings
planetnine's Avatar
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,585

You want to record-arm selected tracks or have individual actions for record-arming their "own" tracks, AkeW?

This works:

-- PL9-switch record arm state on track01.lua

track_num =1    -- 01 to 99
rec_onoff = 1    -- 1 for arm, 0 for unarm
rec_toggle_comm_id = 8*track_num +17    -- calculate CommandID num for track
toggle_state = reaper.GetToggleCommandStateEx(0, rec_toggle_comm_id)    -- get toggle state for track
if toggle_state ~= rec_onoff then reaper.Main_OnCommandEx(rec_toggle_comm_id, 0, 0) end    -- if toggle_state isn't desired rec_onoff state, toggle
-- reaper.Main_OnCommandEx(integer command, integer flag, ReaProject proj)

Just set the "track_num" variable to the track you want to arm and save the script as "PL9-switch record arm state on tracknn.lua"

The above script is for track 1. You can have an action for individul tracks from 1 to 99 with this.

If you want to make the action unarm, then set rec_onoff = 0 and save accordingly with a clear unarm filename inc track number.

I've just tested tracks 1 to 5 with the above and it works well -you could assign the scripts to your controller MIDI numbers and I think you'd be sorted. Shout back if there's anything you need clarifying...

planetnine is offline   Reply With Quote