Old 08-11-2019, 12:05 PM   #1
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 24,337
Default Get Record Mode?

I've been wanting this for a few years now...

I'd really like a single button/key to cycle through record modes (normal, auto-punch selection, auto-punch item) as it's a pain to right-click the record button and select it. There are no actions I can find nor can I find a way to get the mode via script/code - without that, it seems a bit useless as I'd have to keep up with an array position each time I click the button without knowing what the current state is (and I assume I'd have to keep up with the position between script runs if I can't get the current mode which feels hacky).

Or is a way to do this right under my nose and I missed? Any ideas?
__________________
If it requires a null test to find it, it is by definition minuscule.
karbomusic is online now   Reply With Quote
Old 08-11-2019, 03:40 PM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,915
Default

On a quick look at the API doc I couldn't find a function for it either.
But you can access it via int config variable projrecmode using SWS provided functions SNM_GetIntConfigVar() and SNM_SetIntConfigVar().

Code:
-- get record mode
recMode = reaper.SNM_GetIntConfigVar("projrecmode", -666)

-- set record mode
reaper.SNM_SetIntConfigVar("projrecmode", 0) -- e.g. auto-punch sel. items
 
-- hack to trigger record button update
reaper.Main_OnCommand(1007, 0) -- Transport: Play
reaper.Main_OnCommand(1016, 0) -- Transport: Stop
The recording mode symbol of the record button doesn't update immediately when setting it this way it seems, so I've put in start / stop actions to trigger a redraw, maybe there's a more non-hacky way, not sure.

Btw. I used mespotine's Display altered config-variables script to find the right one, very helpful for stuff like this, props to him.

edit:
I missed that setting the mode can also be done via actions which solves the button update issue.

edit2:
As the 'set record mode' actions report a toggle state alternatively you can use GetToggleCommandState() to query the recording mode, not requiring SWS.

Last edited by nofish; 08-11-2019 at 04:25 PM.
nofish is offline   Reply With Quote
Old 08-11-2019, 04:38 PM   #3
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 24,337
Default

Quote:
Originally Posted by nofish View Post
maybe there's a more non-hacky way, not sure.
I just needed to get the mode so I could send the actionID to set the mode which appears to update properly, so this is perfect and thank you!!!

Code:
--   # Cycles through record modes

-- 0, Record mode: auto-punch selected items
-- 1, Record mode: normal
-- 2, Record mode: time selection auto punch

-- get record mode
recMode = reaper.SNM_GetIntConfigVar("projrecmode", -666)
 
recModeAction = 0

if recMode then
  if recMode == 0 then
   recModeAction = 40252 --Normal mode
  end
  if recMode == 1 then
  recModeAction = 40076  --Time selection auto-punch
  end
  if recMode == 2 then
  recModeAction = 40253  --Item selection auto-punch
  end
  
  reaper.Main_OnCommand(recModeAction, 0)
  
end
__________________
If it requires a null test to find it, it is by definition minuscule.
karbomusic is online now   Reply With Quote
Old 08-11-2019, 04:43 PM   #4
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,915
Default

Yeah, edited that in my reply meanwhile.
Glad it helped, you're welcome.
nofish is offline   Reply With Quote
Old 08-11-2019, 04:44 PM   #5
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 24,337
Default

Ah thanks, I was heads down and didn't see the edit.
__________________
If it requires a null test to find it, it is by definition minuscule.
karbomusic is online now   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 05:48 PM.


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