|
|
|
09-03-2015, 05:48 AM
|
#41
|
Human being with feelings
Join Date: Jan 2014
Location: Norway
Posts: 140
|
This is looking really promising. Could finally have folder tracks looking like folders.
|
|
|
09-03-2015, 05:51 AM
|
#42
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
I have made progress with getting layouts from reaper but waiting for this error to get fixed.(Layouts won't be defined in the script,you will choose them from Screenset/Layouts window)
|
|
|
09-03-2015, 06:13 AM
|
#43
|
Mortal
Join Date: Dec 2008
Location: France
Posts: 1,969
|
Code:
cur=""
retval, cur = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", cur, 0)
|
|
|
09-03-2015, 09:52 AM
|
#44
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Added layout code for "separator",and everything works great (setting/changing layouts from reaper).Just need a little help from SPK77 for one thing and I will post the code.
|
|
|
09-03-2015, 11:42 AM
|
#45
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
New Update REQUIRES V5.02pre1+ and SWS:
Many thanks to Jeffos and SPK77
-Works with ANY theme
-Added Separator Layout code (When track is named "SEPARATOR")
-Layouts are defined in Layout Window in Reaper
-TCP only currently
-RecArm Layout Disabled for : Folder,Aux,Separator
Setup (All actions need to be set on "Selected Track Panel)":
Default Layout (Also Audio Layout) is Track Panel
Rec Arm Layout is Action#1
Folder is Action#2
Separator Action#3
Aux Action#4
Audio Action#5
Midi Action#6
Video Action#7
Mixed Items (Audio/MIDI/Video) Action#8
When Changing layouts you need to click on arrange window to update
Code:
defer_cnt=0
function cooldown()
if defer_cnt >= 10 then -- run Main() every ~300ms
defer_cnt=0
reaper.PreventUIRefresh(1)
Main()
reaper.PreventUIRefresh(-1)
else
defer_cnt=defer_cnt+1
end
reaper.defer(cooldown)
end
function Main()
test = reaper.SNM_GetIntConfigVar("layout_tcp",0)
------READ FROM REAPER INI--------------------------------
_, DefLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layout_tcp", "", reaper.GetResourcePath().. "\\REAPER.ini")
_, RecArmLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction0", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 1
RecArmLayTCP = string.sub(RecArmLayTCP,9)
_, FolderLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction1", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 2
FolderLayTCP = string.sub(FolderLayTCP,9)
_, SeparatorLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction2", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 3
SeparatorLayTCP = string.sub(SeparatorLayTCP,9)
_, AuxLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction3", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 4
AuxLayTCP = string.sub(AuxLayTCP,9)
_, AudioLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction4", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 5
AudioLayTCP = string.sub(AudioLayTCP,9)
_, MidiLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction5", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 5
MidiLayTCP = string.sub(MidiLayTCP,9)
_, VideoLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction6", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 6
VideoLayTCP = string.sub(VideoLayTCP,9)
_, MixedLayTCP = reaper.BR_Win32_GetPrivateProfileString("REAPER", "layoutaction7", "", reaper.GetResourcePath().. "\\REAPER.ini") --ACTTION 7
MixedLayTCP = string.sub(MixedLayTCP,9)
------READ FROM REAPER INI--------------------------------
-- COUNT TRACKS
count_tracks = reaper.CountTracks(0)
-- LOOP FOR EVERY TRACK
for i = 0, count_tracks -1 do
track = reaper.GetTrack(0, i)
retval, TrackState = reaper.GetTrackState(track)
count_items_track = reaper.CountTrackMediaItems(track)
receives = reaper.GetTrackNumSends(track, -1)
retval, TrName = reaper.GetSetMediaTrackInfo_String(track, "P_NAME", "", 0)
--------------------------------- GET CURRENT LAYOUT ------------------------------------------
retval, cur = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", "" ,0)
--------------------------------- LAYOUTS SET - COPY THIS ------------------------------------------
-- retval, DefLayTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", DefLayTCP , 1)
-- retval, SetRecArmTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", RecArmLayTCP, 1)
-- retval, SetFolderTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", FolderLayTCP, 1)
-- retval, SetSeparatorTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", SeparatorLayTCP, 1)
-- retval, SetAuxTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", AuxLayTCP, 1)
-- retval, SetMidiTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", MidiLayTCP, 1)
-- retval, SetVideoTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", VideoLayTCP, 1)
-- retval, SetMixedTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", MixedLayTCP, 1)
--------------------------------- LAYOUTS SET ------------------------------------------
-------------------TRACK STATES---------------------------------
----------------TRACK HAS RECEIVES ? ----------------------------
if receives > 0 then
HasReceive = 1
else
HasReceive = 0
end
-------------------AUX TRACK-----------------------------------
if HasReceive == 1 and (TrackState &4) == 4 then
Aux = 1
else
Aux = 0
end
--------------------SEPARATOR-----------------------------------
if TrName == "SEPARATOR" then
Separator = 1
else
Separator = 0
end
-------------------FOLDER TRACK--------------------------------
if (TrackState &1) == 1 then
Folder = 1
else
Folder = 0
end
-------------------REC-ARM TRACK-------------------------------
if (TrackState &64) == 64 then
RecArm = 1
else
RecArm = 0
end
---------------------------------------------------------------
-- LOOP FOR EVERY ITEM
for j = 0, count_items_track -1 do
item = reaper.GetTrackMediaItem(track, j)
-- CHECK THE FIRST TAKE OF ITEM TO DETERMINE SOURCE TYPE
take = reaper.GetMediaItemTake(item, 0)
source = reaper.GetMediaItemTake_Source(take)
take_type = reaper.GetMediaSourceType(source, "test")
_G["take_type"..j] = take_type
---- TAKE TYPES -----------------------------------------
if take_type == "MIDI" then
RTakeType = "M"
elseif take_type == "VIDEO" then
RTakeType = "V"
else
RTakeType = "A"
end
end
item_check = 1 --ITEMS IN TRACK ARE CONSIDERED TO BE ALL SIMILAR
if count_items_track >= 2 then
--CHECK IF SOME ITEMS IN TRACK DON'T MATCH
for l = 0, count_items_track -2 do
m = (l + 1)
if take_type0 ~= _G["take_type"..m] and cur ~= MixedLayTCP then
SetMixedTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", MixedLayTCP, 1)
item_check = 0
break
end
end
end
--IF ALL THE ITEMS MATCH CHECK THE SOURCE TYPE AND CHANGE TRACK LAYOUT
----------------------------TRACK HAS ITEMS ------------------------------------------
if item_check == 1 and count_items_track > 0 and RecArm == 0 then
---------MIDI---------------------------------------------------------------------
if RTakeType == "M" and cur ~= MidiLayTCP then
SetMidiTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", MidiLayTCP, 1)
---------VIDEO--------------------------------------------------------------------
elseif RTakeType == "V" and cur ~= VideoLayTCP then
SetVideoTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", VideoLayTCP, 1)
---------AUDIO--------------------------------------------------------------------
elseif RTakeType == "A" and cur ~= DefLayTCP then
SetAudioLayTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT",DefLayTCP , 1)
end
end
----------------------------TRACK HAS ITEMS ------------------------------------------
------------------------NO ITEMS -------------------------------------------------
if count_items_track == 0 then
--------FOLDER--------------------------------------------------------------------
if Folder == 1 and cur ~= FolderLayTCP then
SetFolderTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", FolderLayTCP, 1)
--------SEPARATOR--------------------------------------------------------------------
elseif Separator == 1 and cur ~= SeparatorLayTCP and Folder ~= 1 then
SetSeparatorTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", SeparatorLayTCP, 1)
--------AUX--------------------------------------------------------------------
elseif Aux == 1 and cur ~= AuxLayTCP then
SetAuxTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", AuxLayTCP, 1)
--------DEFAULT LAYOUT-------------------------------------------------------------
elseif RecArm == 0 and cur ~= DefLayTCP and Separator ~= 1 and Folder ~= 1 and Aux ~= 1 then
SetDefTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT",DefLayTCP , 1)
end
end
---------REC ARM LAYOUT------------------------------------------------------------
if count_items_track >= 0 and RecArm == 1 and Folder ~= 1 and Separator ~= 1 and Aux ~= 1 and cur ~= RecArmLayTCP then
SetRecArmTCP = reaper.GetSetMediaTrackInfo_String(track, "P_TCP_LAYOUT", RecArmLayTCP, 1)
end
end
end
cooldown()
Or link:
https://stash.reaper.fm/25012/Smart%2...rHalfFinal.Lua
Few more things need to improve,
Last edited by Sexan; 09-04-2015 at 03:56 AM.
|
|
|
09-03-2015, 12:25 PM
|
#46
|
Human being with feelings
Join Date: May 2010
Location: Norway
Posts: 7,318
|
TCP only?
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
|
|
|
09-03-2015, 01:08 PM
|
#47
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
For now... I wll add mcp soon ..later
..soon
|
|
|
09-03-2015, 01:41 PM
|
#48
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Update:
Added MCP,but this ones won't update when clicking on arrange (don't know why its the same code) they will update on next layout change.
https://stash.reaper.fm/25021/Smart%2...ngerTCPMCP.Lua
For MCP its the same like TCP but actions start at Action#8 for Rec-arm
So TCP actions from 1-7 , MCP 8-14
Default layout is Track Panel For TCP,and Mixer Panel for MCP
next to add is envelope layouts...btw any ideas are welcome
Last edited by Sexan; 09-04-2015 at 04:04 AM.
|
|
|
09-03-2015, 03:29 PM
|
#49
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
I write a simple script to see how things work, stop working on it during a moment because I'm moving and have no wifi and when I come back it has been brought to a whole other level. Thank you Sexan and also Jeffos and SPK77!
The slowdown when using the bridge is weird... Any idea why it happens? I really don't know much about how the bridge works and I don't understand how it can interfere with this script.
|
|
|
09-03-2015, 03:57 PM
|
#50
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Really don't know,but its plugin specific,on some plugins slowdown is about 5-10% on 50 tracks,but on some you can get past 10 tracks ,I have project with 15 track and this script is a no no on it (need to kill reaper),that is when I've discovered this behavior.On UAD plugins (I have old one) its almost impossible to work,on bootsy (variety of sound) you can have some number of tracks,so I really don't know how to pinpoint the problem.
Edit:Spoke too soon (like usually),on the latest script with new native api,there is no slow down at all (maybe because of new defered cooldown ?)
Last edited by Sexan; 09-04-2015 at 04:37 AM.
|
|
|
09-03-2015, 08:21 PM
|
#51
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
Nothing to see here. Wrong manipulation.
|
|
|
09-03-2015, 08:22 PM
|
#52
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
I just tested the new code on my Mac but the BR_Win32_GetPrivateProfileScreen function seems to work only on windows...
|
|
|
09-04-2015, 02:32 AM
|
#53
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Ok, I reverted the code on the initial (code bigger) idea,using SPK77 awesome ini reader,this should work on OSX:
https://stash.reaper.fm/25019/Smart%2...rHalfFinal.Lua
All actions from 1-14 need to be set,1-7 TCP , 8-14 MCP (Screenset/Layout window)
This one is little more cpu heavier than last one,until we find a simpler way to read ini file on OSX
And Windows only (little cpu lighter) :
https://stash.reaper.fm/25022/Smart%2...ngerTCPMCP.Lua
Last edited by Sexan; 09-04-2015 at 05:53 AM.
|
|
|
09-04-2015, 04:30 AM
|
#54
|
Human being with feelings
Join Date: May 2010
Location: Norway
Posts: 7,318
|
Nice. Will try it.
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
|
|
|
09-05-2015, 03:35 AM
|
#56
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Is there a way to get VCA flag from the track?
|
|
|
09-07-2015, 07:59 AM
|
#57
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
I keep getting a boolean instead of the expected string on line 78. Does the mac and windows version works on windows?
|
|
|
09-07-2015, 08:32 AM
|
#58
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
If that line starts DefLayTCP change it to SetDefLayTCP that was my error but i thought i fixed it.
Yes both versions work on windows(osx version doesn't have SWS api)
Last edited by Sexan; 09-07-2015 at 09:11 AM.
|
|
|
09-07-2015, 09:08 AM
|
#59
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Here is the latest one which I use (bug free AFAIK):
https://stash.reaper.fm/25048/SmartLayoutOptimized.lua
BTW all 14 actions need to be set:
1-7 TCP ,8-14 MCP:
RecArmLayTCP --ACTTION 1
FolderLayTCP --ACTTION 2
SeparatorLayTCP--ACTTION 3
AuxLayTCP --ACTTION 4
MidiLayTCP --ACTTION 5
VideoLayTCP --ACTTION 6
MixedLayTCP --ACTTION 7
Same order for MCP but from 8-14
Last edited by Sexan; 09-07-2015 at 09:14 AM.
|
|
|
09-08-2015, 03:11 PM
|
#60
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
I finally have the wifi set up. I was able to go through the script and understand where the problem was. For some reason I didn't have the layoutaction0, 1 and 3 defined in my reaper.ini. Changing the theme and going back to the default theme fixed the problem. But despite the new API I still get the graphic glitch.
|
|
|
09-08-2015, 03:40 PM
|
#61
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Glitch like before (graphics are corrupted) or blinking ?
I have 0 issues with new API (OSX related?)
Btw script needs improving,if action is not set to use default layout,now actions need to be set or there will be an error
|
|
|
09-08-2015, 03:50 PM
|
#62
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
Quote:
Originally Posted by Sexan
Here is the latest one which I use (bug free AFAIK):
https://stash.reaper.fm/25048/SmartLayoutOptimized.lua
BTW all 14 actions need to be set:
1-7 TCP ,8-14 MCP:
RecArmLayTCP --ACTTION 1
FolderLayTCP --ACTTION 2
SeparatorLayTCP--ACTTION 3
AuxLayTCP --ACTTION 4
MidiLayTCP --ACTTION 5
VideoLayTCP --ACTTION 6
MixedLayTCP --ACTTION 7
Same order for MCP but from 8-14
|
What do you mean when you say that all 14 actions need to be set?
|
|
|
09-08-2015, 10:18 PM
|
#63
|
Human being with feelings
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
|
Quote:
What do you mean when you say that all 14 actions need to be set?
|
Ctrl + E for opening the screenset/layout widows
layout tab, scroll down, and you'll find 20 layout action
Bu I dont know If the action has to be set to Selected track or not...
|
|
|
09-08-2015, 11:32 PM
|
#64
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Yeah they need to be selected tcp and mcp
|
|
|
09-09-2015, 01:56 PM
|
#65
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
No graphic glitch actually, I think I got lost in all the versions of the script I have and ran an older one...
I did set all the actions but I still can't make the script work. It looks like the optimized version can't read my ini file (no values in the IDE). The non-optimized version reads it correctly but it doesn't work (nothing happen)...
|
|
|
09-16-2015, 03:39 PM
|
#66
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
Busy, busy but I got the occasion to do some more test. I can't make the BR_Win32_GetPrivateProfileString work on my mac... I will see with Breeder if there is a fix.
|
|
|
09-25-2015, 07:19 AM
|
#67
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
Victory! Figured out the two problems I was having on my mac!
You can find the link to download the script (windows and mac version) in the first post: http://forum.cockos.com/showthread.php?t=165694
Please report any bug you may find.
Last edited by swiiscompos; 09-25-2015 at 09:27 AM.
|
|
|
11-25-2015, 01:05 PM
|
#68
|
Human being with feelings
Join Date: Jun 2015
Location: Indonesia Raya
Posts: 684
|
this is very interesting script. thank you for sharing this.
i've downloaded from stash the latest version from the first post
https://stash.reaper.fm/v/25210/Smart...timizedOSX.lua
i also have set up actions in screenset/layout.
but it doesn't work in my REAPER 5.11pre4/64, SWS/S&M 2.8.2, OSX El Capitan 10.11.1.
the script from post #45 by @Sexan worked (only for TCP).
any ideas?
thank you
EDIT: figured it out. it's working now. thank you!
Last edited by jrengmusic; 11-25-2015 at 01:25 PM.
|
|
|
12-04-2015, 12:09 PM
|
#69
|
Human being with feelings
Join Date: Feb 2014
Posts: 309
|
excuse my ignorance, but is this more for layout-tweaking?
having a read of the thread, and a glance at the gifs, it looks like (also?) a way of controlling reaper when application is not in focus, not sure if this is achieved lots anyway through (m)any of the other extensive bits of reaper, or even natively (global hotkeys)'
So so much to learn
|
|
|
07-26-2016, 07:26 AM
|
#70
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
I just imported the script and when I run it, I get this error?
" ...ation Support/REAPER/Scripts/SmartLayoutOptimizedOSX.lua:79: bad argument #1 to 'GetMediaItemTake_Source' (MediaItem_Take expected) "
|
|
|
07-26-2016, 08:14 AM
|
#71
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
oh man this is amazing, thank you!
|
|
|
09-13-2016, 05:42 AM
|
#72
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Quote:
Originally Posted by lexaproductions
I just imported the script and when I run it, I get this error?
" ...ation Support/REAPER/Scripts/SmartLayoutOptimizedOSX.lua:79: bad argument #1 to 'GetMediaItemTake_Source' (MediaItem_Take expected) "
|
+1
Any ideas?
|
|
|
12-20-2016, 01:48 PM
|
#73
|
Human being with feelings
Join Date: Dec 2010
Posts: 3,826
|
Is there a way for a script to access layouts that doesn't use the layout actions
So for instance a dead simple script that when run it just changes the layout of the selected track MCP and TCP, but not via the Reaper layout actions 1-20, but by me typing the name of the layout in to the script ?
__________________
Stop posting huge images, smaller images or thumbnail, it's not rocket science!
|
|
|
02-11-2019, 11:05 AM
|
#74
|
Human being with feelings
Join Date: Dec 2011
Location: Finland
Posts: 792
|
Darn it! I needed this, but I'm a bit confused where to find the latest version and if the script is up to date enough to work on the latest version of REAPER...
I'll try it out, but we'll see. It seems that at least some people have had trouble with the script.
Last edited by Icchan; 02-12-2019 at 11:55 AM.
Reason: typo fixing!
|
|
|
02-12-2019, 05:58 AM
|
#75
|
Human being with feelings
Join Date: Feb 2017
Posts: 305
|
Oh, why is that abandoned?
It's quite creative thing.
|
|
|
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 05:52 PM.
|