|
|
|
10-11-2019, 04:04 PM
|
#1
|
Human being with feelings
Join Date: Nov 2009
Posts: 2,232
|
set pre-roll on/set pre-roll off
searched actions and reapack and, while i do find an action to toggle the pre-roll, i don't find an action(s) to set a specific state, such as on or off. anyone know if this exists?
i ask because i was just testing the avid media composer key command emulation scripts and find that they are a little funny if pre-roll is on. thought i'd try making a custom action that would set the pre-roll to off when starting the avid keys script but then couldn't find an action to set the pre-roll to 'off'.
thanks,
babag
|
|
|
10-11-2019, 06:10 PM
|
#2
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Metronome Settings
REAPER.ini
1 Pre-roll before playback
2 Pre-roll before recording
preroll=11
1 Pre-roll before playback
preroll=9
2 Pre-roll before recording
preroll=10
something like this:
Code:
inipath = reaper.get_ini_file()
retval, prerol_state = reaper.BR_Win32_GetPrivateProfileString("reaper", "preroll", "", inipath)
use reaper.BR_Win32_WritePrivateProfileString( "reaper", "preroll", value, inipath) to set it
Last edited by MusoBob; 10-11-2019 at 06:16 PM.
|
|
|
10-11-2019, 06:22 PM
|
#3
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
This can also be done by checking the state of the action and running it if necessary:
Code:
function setActionEnabled(action, state)
if reaper.GetToggleCommandState(action) == 1 ~= state then
reaper.Main_OnCommand(action, 0)
end
end
-- Set "Pre-roll: Toggle pre-roll on play" to ON
setActionEnabled(41818, true)
-- Set "Pre-roll: Toggle pre-roll on record" to OFF
setActionEnabled(41819, false)
Quote:
Originally Posted by MusoBob
Metronome Settings
REAPER.ini
|
The .ini file may or may not be read/written immediately. Many REAPER settings that don't have a dedicated API can be set directly using the configvar API:
Code:
oldValue = reaper.SNM_GetIntConfigVar('preroll', 0)
reaper.SNM_SetIntConfigVar('preroll', newValue)
The preroll configvar is a bitfield. Its known values have been documented here by mespotine: https://mespotin.uber.space/Mespotin...s.html#preroll.
Last edited by cfillion; 10-11-2019 at 06:35 PM.
|
|
|
10-11-2019, 09:10 PM
|
#4
|
Human being with feelings
Join Date: Nov 2009
Posts: 2,232
|
wow. thanks for all of the suggestions. i think i follow the edgemeal approach a little better but am trying to grasp the cfillion.
not having much idea about how to do these things, here are the things i did with the cfillion approach for review. they do seem to do what i want, to toggle the playback pre-roll in the appropriate circumstance.
toggle_pre-roll_if_disabled
Code:
function setActionEnabled(action, state)
if reaper.GetToggleCommandState(41818) == 0 ~= state then
reaper.Main_OnCommand(41818, 0)
end
end
-- Set "Pre-roll: Toggle pre-roll on play" to ON
setActionEnabled(41818, true)
-- Set "Pre-roll: Toggle pre-roll on record" to OFF
setActionEnabled(41819, false)
toggle_pre-roll_if_enabled
Code:
function setActionEnabled(action, state)
if reaper.GetToggleCommandState(41818) == 1 ~= state then
reaper.Main_OnCommand(41818, 0)
end
end
-- Set "Pre-roll: Toggle pre-roll on play" to ON
setActionEnabled(41818, true)
-- Set "Pre-roll: Toggle pre-roll on record" to OFF
setActionEnabled(41819, false)
actually, as i look at it, it looks like all i did was to set one script to a state of 1 and the other to 0 and insert the id's.
thanks again,
babag
Last edited by babag; 10-11-2019 at 09:27 PM.
|
|
|
10-11-2019, 09:44 PM
|
#5
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
Quote:
Originally Posted by cfillion
The .ini file may or may not be read/written immediately. Many REAPER settings that don't have a dedicated API can be set directly using the configvar API:
Code:
oldValue = reaper.SNM_GetIntConfigVar('preroll', 0)
reaper.SNM_SetIntConfigVar('preroll', newValue)
The preroll configvar is a bitfield. Its known values have been documented here by mespotine: https://mespotin.uber.space/Mespotin...s.html#preroll.
|
I'm gonna have to hang that up on the wall.
|
|
|
10-11-2019, 10:23 PM
|
#6
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
Quote:
Originally Posted by babag
not having much idea about how to do these things, here are the things i did with the cfillion approach for review. they do seem to do what i want, to toggle the playback pre-roll in the appropriate circumstance.
|
The contents of the setActionEnabled function should be left as I originally posted. The other lines are usage examples:
toggle_pre-roll_if_disabled.lua would do setActionEnabled(41818, true) and toggle_pre-roll_if_enabled.lua would do setActionEnabled(41818, false). The first parameter is the action ID and the second parameter is whether that action should be enabled (true) or disabled (false) by the function.
Last edited by cfillion; 10-11-2019 at 10:46 PM.
|
|
|
10-12-2019, 09:56 AM
|
#7
|
Human being with feelings
Join Date: Nov 2009
Posts: 2,232
|
ok. i might be getting this a little better. changed per cfillion advice and added comments for myself.
since i'm using these for the play pre-roll, in all cases, the record lines are commented.
toggle_pre-roll_if_disabled:
Code:
function setActionEnabled(action, state)
if reaper.GetToggleCommandState(action) == 1 ~= state then
reaper.Main_OnCommand(action, 0)
end
end
-- Set "Pre-roll: Toggle pre-roll on play"
-- uncomment 'true' line to turn ON pre-roll if it's currently OFF
-- uncomment 'false' line to turn OFF pre-roll if it's currently ON
setActionEnabled(41818, true)
--setActionEnabled(41818, false)
-- Set "Pre-roll: Toggle pre-roll on record" to OFF
-- uncomment 'true' line to turn ON pre-roll if it's currently OFF
-- uncomment 'false' line to turn OFF pre-roll if it's currently ON
--setActionEnabled(41819, true)
--setActionEnabled(41819, false)
toggle_pre-roll_if_enabled:
Code:
function setActionEnabled(action, state)
if reaper.GetToggleCommandState(action) == 1 ~= state then
reaper.Main_OnCommand(action, 0)
end
end
-- Set "Pre-roll: Toggle pre-roll on play"
-- uncomment 'true' line to turn ON pre-roll if it's currently OFF
-- uncomment 'false' line to turn OFF pre-roll if it's currently ON
--setActionEnabled(41818, true)
setActionEnabled(41818, false)
-- Set "Pre-roll: Toggle pre-roll on record" to OFF
-- uncomment 'true' line to turn ON pre-roll if it's currently OFF
-- uncomment 'false' line to turn OFF pre-roll if it's currently ON
--setActionEnabled(41819, true)
--setActionEnabled(41819, false)
do i have things right now? do my comments seem right?
thanks again,
babag
Last edited by babag; 10-12-2019 at 10:01 AM.
|
|
|
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 03:57 AM.
|