Old 03-22-2015, 08:05 AM   #1
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default REQ: Script to automatically set Record Mode

Hello!

I would like a script that would do the following:

- Check if there is a time selection
yes -> set record mode to autopunch time selection
no ->
- Check if there are any items selected
yes -> set record mode to autopunch selected items
no -> leave the Record mode as it is (unchanged)

Could someone make it for me? Thanks!

EDIT:

spk77's script (working in Reaper 4)
heda's script (requires v5)

Thank you guys!!!

Last edited by amagalma; 03-23-2015 at 04:38 AM.
amagalma is offline   Reply With Quote
Old 03-22-2015, 09:07 AM   #2
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

The main core should be something like this..

Code:
GetSet_LoopTimeRange(a, "", "", "", "")
a=1 ? Main_OnCommand(40076, "") : 
CountSelectedMediaItems(0) > 1 ? Main_OnCommand(40253, "")
Could someone correct it for me?
amagalma is offline   Reply With Quote
Old 03-22-2015, 09:50 AM   #3
Seventh
Human being with feelings
 
Seventh's Avatar
 
Join Date: Sep 2010
Location: Finland
Posts: 776
Default

I'm using an SWS custom conditional action for this. It also adds pre-record if preroll is enabled (to avoid cutting off the start of the first note). (I can post it later if you wish).

A ReaScript would be a much more straightforward way to do this though. I can try and give it a shot when I get back to my comp...
__________________
Grey, flat and minimal theme for Reaper: Symbiosis
Seventh is offline   Reply With Quote
Old 03-22-2015, 09:54 AM   #4
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Please do post it!
amagalma is offline   Reply With Quote
Old 03-22-2015, 10:00 AM   #5
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

SWS/BR Cycle through record modes can be mapped to a keyboard shortcut.
You need to have SWS extensions installed.

I am pretty sure you can't change record modes on the fly though, you would have to stop recording in each mode before switching as files are generated accordingly.

You could make some custom actions that set record enabled and the mode at the same time though.
For example,

Record: Set record mode to selected item auto-punch
Transport: Record

Record: Set record mode to time selection auto-punch
Transport: Record

Record: Set record mode to normal
Transport: Record

You normally wouldn't need to count the selected items as Reaper will only punch in on the selected items by default.
J Reverb is offline   Reply With Quote
Old 03-22-2015, 10:12 AM   #6
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Thanks J Reverb... but the idea is having the mode set automatically, so that I do not need to think about what mode to choose or what key to press.
I want to press record and if there is a time selection record to the time selection. If not, then if there are selected items, record the selected items.
amagalma is offline   Reply With Quote
Old 03-22-2015, 10:35 AM   #7
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Problem is that you can have items selected and time selection at the same time so Reaper would have to know which mode you are in so it's a bit of a catch 22, therefore you have to tell Reaper what mode you are choosing and that requires an action to be performed. Either some sort of toggle or custom action in this case. Either way I think you are looking at pressing 1 of three buttons, I may be wrong, good luck though
J Reverb is offline   Reply With Quote
Old 03-22-2015, 10:43 AM   #8
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Maybe something could be possible with defer function ? It allows to have script running in background.
I dont know a lot about this at this time.
X-Raym is offline   Reply With Quote
Old 03-22-2015, 10:57 AM   #9
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by J Reverb View Post
Problem is that you can have items selected and time selection at the same time...
There would be no problem! See the logic here:


Plus, the script does not need to run all the time. I will make a custom action that includes this script + Transport: Record. So, when I press Record, the script runs and decides the appropriate mode.
Attached Images
File Type: jpg logic.jpg (16.4 KB, 704 views)
amagalma is offline   Reply With Quote
Old 03-22-2015, 11:57 AM   #10
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Maybe this would work:

Code:
GetSet_LoopTimeRange(0, 0, start, end, 0);

start != end ? (
  Main_OnCommand(40076, 0);
) : 
CountSelectedMediaItems(0) > 0 ? (
 Main_OnCommand(40253, 0);
);
spk77 is offline   Reply With Quote
Old 03-22-2015, 12:04 PM   #11
Seventh
Human being with feelings
 
Seventh's Avatar
 
Join Date: Sep 2010
Location: Finland
Posts: 776
Default

Looks like I had modified the action a bit... I don't have the item auto-punch option, as I was not using that mode at all. Instead I have a little different recording button logic, with four different actions which do the following:

Main
NUM0: Record (This is a custom action created with SWS cycle action editor. Preroll amount depends on the current grid setting.)


Main (alt recording)
Enter/Space: (this action works like time auto punch, but it also records the preroll and tail, in case you might need them.)


NUM0:


NUM Del:


I've found the restoring of edit cursor position very handy if you need to restart the recording a lot (so many bad takes...) Hopefully you find this helpful.
Attached Images
File Type: png rec1.png (6.6 KB, 689 views)
File Type: png rec2.png (2.8 KB, 687 views)
File Type: png rec3.png (2.5 KB, 700 views)
File Type: png rec4.png (2.6 KB, 678 views)
__________________
Grey, flat and minimal theme for Reaper: Symbiosis
Seventh is offline   Reply With Quote
Old 03-22-2015, 12:38 PM   #12
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Thank you both for your help!

Spk77, this is exactly what I was asking! Just in order for me to understand what is going on...
1) GetSet_LoopTimeRange(0, 0, start, end, 0)
Why the 0 (zeros)? What do they mean? And the variable names "start" and "end" are chosen by you? I mean could they be something else?
2) Main_OnCommand(40076, 0)
Again, what does the 0 (zero) denote?

Seventh, thank you for your cycle actions! It is a good workaround for Reaper's lack of ability to record in the pre-roll time!
amagalma is offline   Reply With Quote
Old 03-22-2015, 01:01 PM   #13
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by amagalma View Post
Thank you both for your help!

Spk77, this is exactly what I was asking! Just in order for me to understand what is going on...
1) GetSet_LoopTimeRange(0, 0, start, end, 0)
Why the 0 (zeros)? What do they mean? And the variable names "start" and "end" are chosen by you? I mean could they be something else?
In EEL, 0 = false and 1 = true

Here's the function description:
EEL: GetSet_LoopTimeRange(bool isSet, bool isLoop, &startOut, &endOut, bool allowautoseek)
  • bool isSet: set this to 0 (false) to get values (1 would set the time selection)
  • bool isLoop: we want to get values from the time selection (not from loop points), that's why it's set to 0
  • &startOut: when getting values, time selection start is stored to this variable (you can choose the name by yourself)
  • &endOut: when getting values, time selection end is stored to this variable (you can choose the name by yourself)
  • bool allowautoseek: (not sure about this)

Quote:
Originally Posted by amagalma View Post
2) Main_OnCommand(40076, 0)
Again, what does the 0 (zero) denote?

Seventh, thank you for your cycle actions! It is a good workaround for Reaper's lack of ability to record in the pre-roll time!
It's an "extra flag", but I think it should always be set to 0
spk77 is offline   Reply With Quote
Old 03-22-2015, 02:02 PM   #14
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

BIG BIG THANKS!!! You 've made it so clear!!!

Quote:
Originally Posted by spk77 View Post
In EEL, 0 = false and 1 = true
  • bool isSet: set this to 0 (false) to get values (1 would set the time selection)
  • bool isLoop: we want to get values from the time selection (not from loop points), that's why it's set to 0
  • &startOut: when getting values, time selection start is stored to this variable (you can choose the name by yourself)
  • &endOut: when getting values, time selection end is stored to this variable (you can choose the name by yourself)
  • bool allowautoseek: (not sure about this)
Did you write that, or do these things exist written somewhere for each of the commands? If they exist, then where!???

Because in the ReaScript Documentation I can only find this:
Code:
C: void GetSet_LoopTimeRange(bool isSet, bool isLoop, double* startOut, double* endOut, bool allowautoseek)

EEL: GetSet_LoopTimeRange(bool isSet, bool isLoop, &startOut, &endOut, bool allowautoseek)

Python: (Boolean isSet, Boolean isLoop, Float startOut, Float endOut, Boolean allowautoseek) = RPR_GetSet_LoopTimeRange(isSet, isLoop, startOut, endOut, allowautoseek)
Which is not very helpful...
amagalma is offline   Reply With Quote
Old 03-22-2015, 11:21 PM   #15
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,241
Default

Quote:
Originally Posted by amagalma View Post
Because in the ReaScript Documentation I can only find this:
Code:
C: void GetSet_LoopTimeRange(bool isSet, bool isLoop, double* startOut, double* endOut, bool allowautoseek)

EEL: GetSet_LoopTimeRange(bool isSet, bool isLoop, &startOut, &endOut, bool allowautoseek)

Python: (Boolean isSet, Boolean isLoop, Float startOut, Float endOut, Boolean allowautoseek) = RPR_GetSet_LoopTimeRange(isSet, isLoop, startOut, endOut, allowautoseek)
Which is not very helpful...
The documentation is not very intuitive. It is more a reference than a documentation. It is not aimed at beginners. But once you understand how it is, it is the most used document when scripting

Thanks spk77 and amagalma. It is a very nice script idea
heda is offline   Reply With Quote
Old 03-22-2015, 11:58 PM   #16
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,241
Default

REAPER 5 version with toggle button support and runs in background.
Changed the behaviour to return to normal mode if no items are selected.

Download (for REAPER 5): Auto Record Mode.eel
* v0.1 (2015-03-23)
+ REAPER 5 version that runs in background and toggle button support

heda is offline   Reply With Quote
Old 03-23-2015, 03:26 AM   #17
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Great script Heda!! :-) Solves the problem of needing a dedicated record button for automatic recording (as Reaper's default record button cannot be assigned to a custom action/script)

P.S. I'll add both scripts to my first post

Last edited by amagalma; 03-23-2015 at 04:35 AM.
amagalma is offline   Reply With Quote
Old 06-13-2016, 02:56 PM   #18
MRMJP
Human being with feelings
 
Join Date: May 2016
Posts: 2,065
Default

Quote:
Originally Posted by heda View Post
REAPER 5 version with toggle button support and runs in background.
Changed the behaviour to return to normal mode if no items are selected.

Download (for REAPER 5): Auto Record Mode.eel
* v0.1 (2015-03-23)
+ REAPER 5 version that runs in background and toggle button support

Sorry to be such a newb, but how do I install the Auto Record script? I have the HeDa_Auto Record Mode.eel file download.
__________________
REAPER, just script it bro.
MRMJP is offline   Reply With Quote
Old 06-14-2016, 12:16 AM   #19
MisterBerniman
Human being with feelings
 
Join Date: Jan 2014
Location: Paris
Posts: 60
Default Conditionnal "actions"?

Why not using "conditionnal script"?
Depending on where the mouse cursor is the recording mode is selected...
MisterBerniman is offline   Reply With Quote
Old 09-22-2016, 10:58 AM   #20
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Is this is ReaPack, what is its name there?
TonE 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 06:48 AM.


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