|
|
|
11-19-2016, 03:23 PM
|
#1
|
Human being with feelings
Join Date: Dec 2008
Posts: 39
|
Set (not toggle) record arm via midi
Trying to control Reaper from my Korg Nanokontrol. Muting a track works fine and synchs with the led on the nanokontrol by mapping to 'set mute on track...' action.
But there is no corresponding action for 'set record arm', only toggle..? Then the button led and record state can diverge.
SWS has a 'set record arm', but that only enables, never disables record arming.
Any workarounds?
|
|
|
11-20-2016, 12:02 AM
|
#2
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,784
|
A workaround (if really necessary) could be, to do a small batch/script that first enables and then toggles.
-Michael
|
|
|
11-20-2016, 12:18 AM
|
#3
|
Human being with feelings
Join Date: Dec 2008
Posts: 39
|
Not sure I follow... Won't that always disable record arm?
The point is to get the led button matching the state in Reaper. And the nanokontrol sends 7f when the led is lit, and 00 when it is turned off.
|
|
|
11-20-2016, 12:20 AM
|
#4
|
Human being with feelings
Join Date: Dec 2008
Posts: 39
|
Seems that you can make custom actions with 'if' statements. This will probably work (but is a bit cumbersome).
|
|
|
11-20-2016, 04:10 AM
|
#5
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
You want to record-arm selected tracks or have individual actions for record-arming their "own" tracks, AkeW?
This works:
Code:
-- 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 track nn.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...
>
|
|
|
11-20-2016, 05:01 PM
|
#6
|
Human being with feelings
Join Date: May 2012
Location: Brighton
Posts: 1,989
|
What you can do, is too:
Edit main toolbar, add action to toggle record arm to selected track, and then use midi input for it. With toggle you can turn it on and off.
Last edited by MikComposer; 11-20-2016 at 06:52 PM.
|
|
|
11-21-2016, 01:40 AM
|
#7
|
Human being with feelings
Join Date: Dec 2008
Posts: 39
|
planetnine - Thanks, this could work together with the if-actions. What I want is actions to arm/unarm specific tracks.
But is it possible to read a midi cc value in the script so it can set rec_onoff based on if the midi value is 0 or 127?
Like the "set mute for track x (midi only)" standard action in Reaper.
MikComposer: A toggle action won't work since the led on my controller can get out of synch with the actual state if i toggle by mouse click first, and then via the controller.
|
|
|
11-21-2016, 02:05 AM
|
#8
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
AkeW, this is a script action to arm specific tracks.
You make a copy of this for each track and just config each one with the user-settings I posted above. You can arm specific tracks with specific MIDI events then -I presumed this was for use with a controller.
If you want a single script to run and lurk, scanning for specific MIDI events and arming/unarming them, it can be done. I thought you'd probably only need 8 or 16 of these for your controller
>
|
|
|
11-21-2016, 01:35 PM
|
#9
|
Human being with feelings
Join Date: Dec 2008
Posts: 39
|
planetnine - Modified your script to read rec_onoff from midi value. It works great Thanks!
Code:
track_num = 1 -- 01 to 99
is_new,name,sec,cmd,rel,res,val = reaper.get_action_context()
if val > 62 then
rec_onoff = 1
else
rec_onoff = 0
end
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
|
|
|
11-21-2016, 01:40 PM
|
#10
|
Human being with feelings
Join Date: Dec 2008
Posts: 39
|
And I only had the energy to make versions for the first 9 tracks ;D
|
|
|
08-09-2017, 03:01 AM
|
#11
|
Human being with feelings
Join Date: Aug 2017
Posts: 47
|
Hello,
I need to do the exact same thing as thread author. I am a bit new to reaper so if somebody can help me step by step how to use the code as posted by AkeW would be very helpful.
I have copied the code from AkeW above and made a new reascript from the action list window in reaper. Then I tried to bind it to a regular midi CC. All fine so far, but then nothing happens when I send the cc from my controller.
Help please
|
|
|
05-19-2018, 07:36 AM
|
#12
|
Human being with feelings
Join Date: Mar 2018
Posts: 19
|
Problem with Main_OnCommandEx
Hello,
I try to do the same... BUT this command doesn't do anything !
the only line of my LUA script :
reaper.Main_OnCommandEx(25, 0, 0)
ID #25 : Toggle record arm for track O1
The same with 22 for mute
The ID to close the project works fine.
Any idea ?
Alain
|
|
|
05-19-2018, 09:12 AM
|
#13
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by Alain78
Hello,
I try to do the same... BUT this command doesn't do anything !
the only line of my LUA script :
reaper.Main_OnCommandEx(25, 0, 0)
ID #25 : Toggle record arm for track O1
The same with 22 for mute
The ID to close the project works fine.
Any idea ?
Alain
|
Continued in this thread : https://forum.cockos.com/showthread.php?t=206902
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:10 PM.
|