|
|
|
09-08-2015, 12:00 PM
|
#1
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
Lua : Folder Rec-Arm arms child Tracks
Latest version of the script,based on SPK77 (90%) code and modified to work with monitoring also and some other features
When folder is rec-armed its input is disabled to avoid double monitoring or recording on the folder track.After rec-disarming folder input is reverted to what was set before.Individual tracks within the folder can be armed or disarmed individually (regardless of the folder arming) and the same for monitoring.
It would be cool if SKP77 would approve this to be in ReaScript tool in his repository
https://stash.reaper.fm/27319/FolderR...o_children.lua
Last edited by Sexan; 04-15-2016 at 08:36 AM.
|
|
|
09-08-2015, 12:30 PM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,874
|
Nice job :O
|
|
|
09-09-2015, 02:56 AM
|
#3
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
Edit: news in first post
Last edited by Sexan; 09-09-2015 at 06:03 AM.
|
|
|
09-11-2015, 01:16 AM
|
#4
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
edit...
Last edited by Sexan; 04-15-2016 at 08:31 AM.
|
|
|
09-11-2015, 11:29 AM
|
#5
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
new update:
-Childs can be monitor enabled individually and globally
-Folder restores last selected input after monitor enabled(when monitor enabled it goes to non-input so cuz of feedback)
https://stash.reaper.fm/25092/SmartRe...dersUPDATE.lua
|
|
|
09-20-2015, 07:03 AM
|
#6
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
edit...
Last edited by Sexan; 04-15-2016 at 08:31 AM.
|
|
|
09-21-2015, 12:18 AM
|
#7
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,581
|
(subscribe!)
|
|
|
09-21-2015, 07:05 AM
|
#8
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
Pleeeaaaaaseeee anyone por favor!
|
|
|
09-28-2015, 11:12 AM
|
#9
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
I tried a different approach...
I recently found these functions: - reaper.GetProjectStateChangeCount
- reaper.Undo_CanUndo2
We can monitor for rec arm button presses (and many other things)...
...this means that it's possible to (greatly) reduce the cpu usage with this "method"
Here's an example:
Code:
function msg(m)
reaper.ShowConsoleMsg(tostring(m) .. "\n")
end
local last_proj_change_count = reaper.GetProjectStateChangeCount(0)
-- Returns a track's folder depth
function get_track_folder_depth(track_index)
local folder_depth = 0
for i=0, track_index do -- loop from start of tracks to "track_index"...
local track = reaper.GetTrack(0, i)
folder_depth = folder_depth + reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH") -- ...to get the actual folder depth
end
return folder_depth
end
-----------------------
-- on_rec_arm_change --
-----------------------
-- this function is called when rec arm button is pressed on some track
function on_rec_arm_change(track_pointer, track_index)
-- If this function is called, we know that:
-- last touched track is a folder track (parent)
-- rec-arm button was clicked on that track
-- call "get_track_folder_depth" to get the actual folder depth
local parent_folder_depth = get_track_folder_depth(track_index)
local parent_rec_arm = reaper.GetMediaTrackInfo_Value(track_pointer, "I_RECARM") -- get (parent) track's rec arm state
-- loop from" parent track index" to end of tracks (break when last child is found)
for i = track_index + 1, reaper.CountTracks(0) do
child_track = reaper.GetTrack(0, i-1)
reaper.SetMediaTrackInfo_Value(child_track, "I_RECARM", parent_rec_arm)
child_track_folder_depth = parent_folder_depth + reaper.GetMediaTrackInfo_Value(child_track, "I_FOLDERDEPTH")
if child_track_folder_depth < parent_folder_depth then
break -- break when last child is found
end
end
reaper.UpdateArrange() -- update arrange view
reaper.TrackList_AdjustWindows(false) -- update tracklist
end
-----------------------------
-- on_project_state_change --
-----------------------------
-- this function is called when project state changes
function on_project_state_change(last_action)
local last_a = last_action
-- if last action (that changed the project state) was "Toggle Track Record Arming"...
if last_action == "Toggle Track Record Arming" then
local last_touched_track = reaper.GetLastTouchedTrack() -- get last touched track's "track pointer"
local last_touched_track_name, flags = reaper.GetTrackState(last_touched_track)
local last_touched_track_index = reaper.CSurf_TrackToID(last_touched_track, false) - 1 -- get track index from "last touched track"
-- Check if last_touched_track was a folder track
if flags&1 ~= 1 then -- if last_touched track was not a folder (parent)...
return -- ...return to main function...
end
msg("Rec arm was pressed on track named: " .. last_touched_track_name)
msg("Track number: " .. last_touched_track_index+1 .. "\n")
on_rec_arm_change(last_touched_track, last_touched_track_index) -- ...(else) call "on_rec_arm_change"
end
end
----------
-- Main --
----------
function main()
local proj_change_count = reaper.GetProjectStateChangeCount(0)
if proj_change_count > last_proj_change_count then
local last_action = reaper.Undo_CanUndo2(0) -- get last action
if last_action ~= nil then
msg("--------------------------------")
msg("Last action: " .. last_action)
on_project_state_change(last_action) -- call "on_project_state_change" to update something if needed
end
last_proj_change_count = proj_change_count -- store "Project State Change Count" for the next pass
end
reaper.defer(main)
end
main()
|
|
|
09-28-2015, 01:12 PM
|
#10
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
AWESOME!!!!!!!!! Would you please implement monitoring and inputs?
Thank you !
|
|
|
09-28-2015, 01:36 PM
|
#11
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,874
|
@spk77
the code snippet for knowing what last action is used is pretty useful !
It doesn't work with all actions I tested but it is very coo, even just for copy pasting action names for writing a tutorial !
|
|
|
09-29-2015, 02:01 AM
|
#12
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
edit...
Last edited by Sexan; 04-15-2016 at 08:25 AM.
|
|
|
04-15-2016, 08:30 AM
|
#13
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
Latest version of the script,based on SPK77 (90%) code and modified to work with monitoring also and some other features
When folder is rec-armed its input is disabled to avoid double monitoring or recording on the folder track.After rec-disarming folder input is reverted to what was set before.Individual tracks within the folder can be armed or disarmed individually (regardless of the folder arming) and the same for monitoring.
It would be cool if SKP77 would approve this to be in ReaPack tool in his repository
https://stash.reaper.fm/27319/FolderR...o_children.lua
Last edited by Sexan; 04-15-2016 at 08:37 AM.
|
|
|
12-14-2017, 07:56 AM
|
#15
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
Quote:
Originally Posted by Plant
|
Yeah its broken, somewhere in some Reaper updates they changed the way actions are displayed. For example they used to be "Toggle Track Record" and now its "Toggle track record". Will fix it soon
|
|
|
12-22-2019, 06:13 AM
|
#16
|
Human being with feelings
Join Date: Nov 2014
Posts: 17
|
Hello,
I tried different versions and couldn't make it work. Are all of them broken? I would use this a lot.
Thank you
|
|
|
09-19-2020, 01:22 AM
|
#17
|
Human being with feelings
Join Date: Nov 2014
Posts: 17
|
Quote:
Originally Posted by Sexan
Yeah its broken, somewhere in some Reaper updates they changed the way actions are displayed. For example they used to be "Toggle Track Record" and now its "Toggle track record". Will fix it soon
|
I did those changes and it is working now . Submited a pull request on your gihub.
EDIT : Also changed the condition of change detection in the main() function because it didn't work across tabs, because each tab has its own GetProjectStateChangeCount(0) counter.
So instead of :
if proj_change_count > last_proj_change_count then
I did :
if proj_change_count ~= last_proj_change_count then
Seems to work flawlessly now !
Last edited by HurdyGuigui; 09-19-2020 at 02:34 AM.
Reason: Some more changes
|
|
|
09-19-2020, 05:52 AM
|
#18
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,585
|
Will merge but just fix this also:
Code:
local last_action = reaper.Undo_CanUndo2(0)
to
Code:
local last_action = reaper.Undo_CanUndo2(0):lower()
this way all action names will be lowercase so there will not be any issue later
And after you need to change every action name to lowercase:
Code:
if last_a == "toggle track record arming" then
|
|
|
09-20-2020, 06:35 AM
|
#19
|
Human being with feelings
Join Date: Nov 2014
Posts: 17
|
Quote:
Originally Posted by Sexan
Will merge but just fix this also:
Code:
local last_action = reaper.Undo_CanUndo2(0)
to
Code:
local last_action = reaper.Undo_CanUndo2(0):lower()
this way all action names will be lowercase so there will not be any issue later
And after you need to change every action name to lowercase:
Code:
if last_a == "toggle track record arming" then
|
Smart . I just did it
|
|
|
10-07-2020, 06:22 AM
|
#20
|
Human being with feelings
Join Date: Nov 2010
Posts: 1,721
|
Sorry for being dense, I just tried this "folder record monitor arming childs ", but couldn't make it work.
Is that the right script?
|
|
|
04-09-2021, 11:22 AM
|
#22
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,131
|
Until merged the updated version can be downloaded here
Last edited by Buy One; 04-09-2021 at 12:47 PM.
|
|
|
03-20-2023, 05:04 PM
|
#23
|
Human being with feelings
Join Date: Mar 2023
Posts: 2
|
Quote:
Originally Posted by Sexan
Latest version of the script,based on SPK77 (90%) code and modified to work with monitoring also and some other features
When folder is rec-armed its input is disabled to avoid double monitoring or recording on the folder track.After rec-disarming folder input is reverted to what was set before.Individual tracks within the folder can be armed or disarmed individually (regardless of the folder arming) and the same for monitoring.
It would be cool if SKP77 would approve this to be in ReaScript tool in his repository
https://stash.reaper.fm/27319/Folder...o_children.lua
|
Please friend I'm new to Reaper could you help me to use the script
|
|
|
03-20-2023, 05:05 PM
|
#24
|
Human being with feelings
Join Date: Mar 2023
Posts: 2
|
Quote:
Originally Posted by spk77
I tried a different approach...
I recently found these functions: - reaper.GetProjectStateChangeCount
- reaper.Undo_CanUndo2
We can monitor for rec arm button presses (and many other things)...
...this means that it's possible to (greatly) reduce the cpu usage with this "method"
Here's an example:
Code:
function msg(m)
reaper.ShowConsoleMsg(tostring(m) .. "\n")
end
local last_proj_change_count = reaper.GetProjectStateChangeCount(0)
-- Returns a track's folder depth
function get_track_folder_depth(track_index)
local folder_depth = 0
for i=0, track_index do -- loop from start of tracks to "track_index"...
local track = reaper.GetTrack(0, i)
folder_depth = folder_depth + reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH") -- ...to get the actual folder depth
end
return folder_depth
end
-----------------------
-- on_rec_arm_change --
-----------------------
-- this function is called when rec arm button is pressed on some track
function on_rec_arm_change(track_pointer, track_index)
-- If this function is called, we know that:
-- last touched track is a folder track (parent)
-- rec-arm button was clicked on that track
-- call "get_track_folder_depth" to get the actual folder depth
local parent_folder_depth = get_track_folder_depth(track_index)
local parent_rec_arm = reaper.GetMediaTrackInfo_Value(track_pointer, "I_RECARM") -- get (parent) track's rec arm state
-- loop from" parent track index" to end of tracks (break when last child is found)
for i = track_index + 1, reaper.CountTracks(0) do
child_track = reaper.GetTrack(0, i-1)
reaper.SetMediaTrackInfo_Value(child_track, "I_RECARM", parent_rec_arm)
child_track_folder_depth = parent_folder_depth + reaper.GetMediaTrackInfo_Value(child_track, "I_FOLDERDEPTH")
if child_track_folder_depth < parent_folder_depth then
break -- break when last child is found
end
end
reaper.UpdateArrange() -- update arrange view
reaper.TrackList_AdjustWindows(false) -- update tracklist
end
-----------------------------
-- on_project_state_change --
-----------------------------
-- this function is called when project state changes
function on_project_state_change(last_action)
local last_a = last_action
-- if last action (that changed the project state) was "Toggle Track Record Arming"...
if last_action == "Toggle Track Record Arming" then
local last_touched_track = reaper.GetLastTouchedTrack() -- get last touched track's "track pointer"
local last_touched_track_name, flags = reaper.GetTrackState(last_touched_track)
local last_touched_track_index = reaper.CSurf_TrackToID(last_touched_track, false) - 1 -- get track index from "last touched track"
-- Check if last_touched_track was a folder track
if flags&1 ~= 1 then -- if last_touched track was not a folder (parent)...
return -- ...return to main function...
end
msg("Rec arm was pressed on track named: " .. last_touched_track_name)
msg("Track number: " .. last_touched_track_index+1 .. "\n")
on_rec_arm_change(last_touched_track, last_touched_track_index) -- ...(else) call "on_rec_arm_change"
end
end
----------
-- Main --
----------
function main()
local proj_change_count = reaper.GetProjectStateChangeCount(0)
if proj_change_count > last_proj_change_count then
local last_action = reaper.Undo_CanUndo2(0) -- get last action
if last_action ~= nil then
msg("--------------------------------")
msg("Last action: " .. last_action)
on_project_state_change(last_action) -- call "on_project_state_change" to update something if needed
end
last_proj_change_count = proj_change_count -- store "Project State Change Count" for the next pass
end
reaper.defer(main)
end
main()
|
Please friend I'm new to Reaper could you help me to use the script
|
|
|
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 02:50 AM.
|