Old 11-19-2016, 03:23 PM   #1
AkeW
Human being with feelings
 
Join Date: Dec 2008
Posts: 39
Default 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?
AkeW is offline   Reply With Quote
Old 11-20-2016, 12:02 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 7,902
Default

A workaround (if really necessary) could be, to do a small batch/script that first enables and then toggles.

-Michael
mschnell is online now   Reply With Quote
Old 11-20-2016, 12:18 AM   #3
AkeW
Human being with feelings
 
Join Date: Dec 2008
Posts: 39
Default

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.
AkeW is offline   Reply With Quote
Old 11-20-2016, 12:20 AM   #4
AkeW
Human being with feelings
 
Join Date: Dec 2008
Posts: 39
Default

Seems that you can make custom actions with 'if' statements. This will probably work (but is a bit cumbersome).
AkeW is offline   Reply With Quote
Old 11-20-2016, 04:10 AM   #5
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,585
Default

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 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
Old 11-20-2016, 05:01 PM   #6
MikComposer
Human being with feelings
 
MikComposer's Avatar
 
Join Date: May 2012
Location: Brighton
Posts: 1,988
Default

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.
__________________
My Royalty Free Music library

Last edited by MikComposer; 11-20-2016 at 06:52 PM.
MikComposer is offline   Reply With Quote
Old 08-09-2017, 03:01 AM   #7
manneokoko
Human being with feelings
 
Join Date: Aug 2017
Posts: 47
Default

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
manneokoko is offline   Reply With Quote
Old 05-19-2018, 07:36 AM   #8
Alain78
Human being with feelings
 
Join Date: Mar 2018
Posts: 17
Default 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
Alain78 is offline   Reply With Quote
Old 05-19-2018, 09:12 AM   #9
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 3,758
Default

Quote:
Originally Posted by Alain78 View Post
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
solger is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.