Initial commit - Rest of scripts
This commit is contained in:
parent
64fb78ad16
commit
76ec212640
87
Realive_ProjectTabsList_AddOneTab.lua
Normal file
87
Realive_ProjectTabsList_AddOneTab.lua
Normal file
@ -0,0 +1,87 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Refresh.lua
|
||||
* Description: ProjectTabsList_Refresh
|
||||
* Instructions:
|
||||
* Author: Alex Paquette
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI:
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 1.0
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
local debug = false
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
-- reaper.Main_OnCommand(40859, 0) -- Add One Project Tab
|
||||
reaper.gmem_write(gmem_idx_Management, gmemPlaylist_RealiveListItem_Add)
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
269
Realive_ProjectTabsList_CloseAllTabs.lua
Normal file
269
Realive_ProjectTabsList_CloseAllTabs.lua
Normal file
@ -0,0 +1,269 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_CloseAllTabs.lua
|
||||
* Description: Close All Project Tabs
|
||||
* Instructions:
|
||||
* Author: Alex Paquette, Thanks to Claude Fillion for the Large contribution
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI: https://forum.cockos.com/showthread.php?p=1854775#post1854775
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 2.00
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
local EXT_SECTION = 'ProjectTabs_Reaper_list'
|
||||
local EXT_SECTION_PLAYLIST = 'ProjectTabs_Realive_list'
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
local RegionWindow_cmdID = reaper.NamedCommandLookup("_RS05396ad2c5c53e928799e707652dea37cc588b3c")
|
||||
local ResetPlayView_cmdID = reaper.NamedCommandLookup("_RS08d5f2749008cc0f6f53feb223d1638fde598566")
|
||||
local REAPERPath = reaper.GetResourcePath()
|
||||
local ProjectPath = (REAPERPath.."//ProjectTemplates")
|
||||
local ProjectName = "AudioRouting.RPP"
|
||||
|
||||
|
||||
|
||||
|
||||
local debug = false
|
||||
|
||||
-----// Project Templates //------------------------------
|
||||
local Template_AudioRouting_cmdID = reaper.NamedCommandLookup("_RS46bebf2345d0c062f8ec5e72df8bc80190970cfb")
|
||||
local Template_LineCheck_cmdID = reaper.NamedCommandLookup("_RS9799aed89bdfcc32214f3bd1e17ec57ba42ae7eb")
|
||||
local Template_Song_cmdID = reaper.NamedCommandLookup("_RS62e37ab3059a6dab6616675ecd3c4c83162a0859")
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
local playlistState = reaper.GetExtState('Realive_Playlist', 'State')
|
||||
local realivePlaylist_compare = 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// FUNCTIONS //---------------------------------------
|
||||
-----------------------------------------------------------
|
||||
function Playlist_CountProjectTabs()
|
||||
local ProjCount=-1
|
||||
local Aretval="t"
|
||||
while Aretval~=nil do
|
||||
local Aretval, Aprojfn = reaper.EnumProjects(ProjCount+1, "")
|
||||
if Aretval~=nil then ProjCount=ProjCount+1
|
||||
else break
|
||||
end
|
||||
end
|
||||
return ProjCount+1
|
||||
end
|
||||
|
||||
|
||||
|
||||
function Actions_ResetAllProjects()
|
||||
local prjct_Counter = Playlist_CountProjectTabs()
|
||||
for p = 0, prjct_Counter do
|
||||
local proj = reaper.EnumProjects(p, 0)
|
||||
if not proj then break
|
||||
else
|
||||
reaper.SetEditCurPos2(proj, 0, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// Realive List Management //-------------------------
|
||||
-----------------------------------------------------------
|
||||
|
||||
function makeKey(i)
|
||||
return string.format('project%d', i)
|
||||
end
|
||||
|
||||
|
||||
function enum_RealivePlaylist()
|
||||
local i = 1
|
||||
return function()
|
||||
local key = makeKey(i)
|
||||
i = i + 1
|
||||
if reaper.HasExtState(EXT_SECTION_PLAYLIST, key) then
|
||||
return key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function get_RealivePlaylist()
|
||||
local Realive_list = {}
|
||||
for Realive_key in enum_RealivePlaylist() do
|
||||
local Realive_projfn = reaper.GetExtState(EXT_SECTION_PLAYLIST, Realive_key)
|
||||
table.insert(Realive_list, Realive_projfn)
|
||||
end
|
||||
return Realive_list
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// SAVE RPL FUNCTION //-------------------------------
|
||||
-----------------------------------------------------------
|
||||
function SaveRPL()
|
||||
local out_str = ''
|
||||
local targetPath = ''
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'lastPath') then
|
||||
lastPath = reaper.GetExtState('Realive_PlaylistFolder', 'lastPath')
|
||||
end
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'defaultPath') then
|
||||
defaultPath = reaper.GetExtState('Realive_PlaylistFolder', 'defaultPath')
|
||||
end
|
||||
if lastPath ~= '' then targetPath = lastPath
|
||||
elseif defaultPath ~= '' then targetPath = defaultPath
|
||||
end
|
||||
local unsavedConfirm = 0
|
||||
local playlist = get_RealivePlaylist()
|
||||
|
||||
local projcnt = Playlist_CountProjectTabs()
|
||||
local UnsavedProj_cnt = 0
|
||||
for i = 1, projcnt do
|
||||
local retval, projfn= reaper.EnumProjects( i-1, '' )
|
||||
if projfn =='' then UnsavedProj_cnt = UnsavedProj_cnt+1 end
|
||||
Msg('projfn: '..projfn)
|
||||
end
|
||||
Msg('UnsavedProject: '..UnsavedProj_cnt)
|
||||
if UnsavedProj_cnt > 0 then
|
||||
unsavedConfirm = reaper.ShowMessageBox("Your list contains project(s) that have no name. They will not be saved in the playlist. Do you still want to proceed? ", 'Warning', 4) -- Yes = 6, No = 7, Cancel = 2
|
||||
Msg('unsavedConfirm: '..unsavedConfirm)
|
||||
if unsavedConfirm ~= 6 then return end
|
||||
end
|
||||
|
||||
local SaveDialogAnswer, saving_folder = reaper.JS_Dialog_BrowseForSaveFile('Save RPL', targetPath, '', 'Reaper Playlist files (.RPL)\0*.RPL\0\0')
|
||||
Msg('SaveDialogAnswer: '..SaveDialogAnswer)
|
||||
if SaveDialogAnswer == 1 then -- if a file was selected
|
||||
extst_path = string.match(saving_folder, ".+/")
|
||||
reaper.SetExtState('Realive_PlaylistFolder', 'lastPath', extst_path, false)
|
||||
Msg('path: '..extst_path)
|
||||
for i = 1, #playlist do
|
||||
out_str = out_str..playlist[i]..'\n'
|
||||
end
|
||||
local f = io.open(saving_folder, 'w')
|
||||
f:write(out_str)
|
||||
f:close()
|
||||
CloseAllTabs()
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
-----------------------------------------------------------
|
||||
-----------------------------------------------------------
|
||||
function RefreshPlaylist()
|
||||
-- reaper.gmem_write(gmem_idx_Management, gmemPlaylist_Initialize)
|
||||
---[[
|
||||
local cmd_id = reaper.NamedCommandLookup('_RS2071ccff7199c897478c49da97ca1422fc732d4f')
|
||||
local state = reaper.GetToggleCommandState(cmd_id)
|
||||
if state == 1 then
|
||||
reaper.Main_OnCommand(cmd_id, 0)
|
||||
reaper.Main_OnCommand(cmd_id, 0)
|
||||
reaper.SetCursorContext(1) --Focus Arrange Window
|
||||
end
|
||||
--]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function CloseAllTabs()
|
||||
reaper.Main_OnCommand(40886, 0) -- Close All Projects
|
||||
reaper.Main_OnCommand(41929, 0) -- Open empty project
|
||||
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_FIRSTPROJTAB"), 0) -- Switch to 1st Tab
|
||||
reaper.Main_OnCommand(40860, 0) -- Close tab
|
||||
-- reaper.SetExtState('Realive_Playlist', 'audioRouting_Validation', 'NotValid', false)
|
||||
reaper.Main_openProject('template:'..ProjectPath.."/"..ProjectName)
|
||||
reaper.Main_OnCommand(40859, 0) -- New Tab Ignore Default Template
|
||||
-- reaper.Main_OnCommand(Template_Song_cmdID, 0) -- Open Song Tab
|
||||
RefreshPlaylist()
|
||||
|
||||
reaper.Main_OnCommand(ResetPlayView_cmdID, 0) -- Reset Play View
|
||||
|
||||
-- reaper.gmem_write(gmem_idx_Management, gmemPlaylist_ProjectTabs_CleanStatus)
|
||||
-- reaper.SetExtState('Realive_Playlist', 'State', 'Cln', false)
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
|
||||
if playlistState == 'Drty' then
|
||||
realivePlaylist_compare = reaper.ShowMessageBox("Do you want to save your Playlist? ", 'Playlist was Changed', 3) -- Yes = 6, No = 7, Cancel = 2
|
||||
end
|
||||
|
||||
if realivePlaylist_compare == 2 then return end -- if Cancel then Do Nothing
|
||||
if realivePlaylist_compare == 6 then -- if Yes then Save RPL
|
||||
SaveRPL()
|
||||
else
|
||||
CloseAllTabs()
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
129
Realive_ProjectTabsList_CloseCurrentTab.lua
Normal file
129
Realive_ProjectTabsList_CloseCurrentTab.lua
Normal file
@ -0,0 +1,129 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Refresh.lua
|
||||
* Description: ProjectTabsList_Refresh
|
||||
* Instructions:
|
||||
* Author: Alex Paquette
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI:
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 1.0
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function PathStuff()
|
||||
local save_targetPath = ''
|
||||
local save_lastPath = ''
|
||||
if reaper.HasExtState('Realive_ProjectFolder', 'lastPath') then
|
||||
save_lastPath = reaper.GetExtState('Realive_ProjectFolder', 'lastPath')
|
||||
end
|
||||
if reaper.HasExtState('Realive_ProjectFolder', 'defaultPath') then
|
||||
save_defaultPath = reaper.GetExtState('Realive_ProjectFolder', 'defaultPath')
|
||||
end
|
||||
if save_lastPath ~= '' then save_targetPath = save_lastPath
|
||||
elseif save_defaultPath ~= '' then save_targetPath = save_defaultPath
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// SAVE File FUNCTION //-------------------------------
|
||||
-----------------------------------------------------------
|
||||
function SaveFile()
|
||||
-- local r, fn = reaper.JS_Dialog_BrowseForSaveFile('Save RPP', '', '', '*.RPP')
|
||||
|
||||
-- if r == 1 then
|
||||
--
|
||||
-- end
|
||||
-- return r
|
||||
end
|
||||
|
||||
--[[
|
||||
function SaveFile()
|
||||
local projName = reaper.GetProjectName(0, '')
|
||||
local dirtySt = reaper.IsProjectDirty(0)
|
||||
if dirtySt == 0 then return end
|
||||
doYouWantToSave = reaper.ShowMessageBox( 'Save Project '..projName..'before closing?', 'REAPER Query', 3) -- Yes = 6, No = 7, Cancel = 2
|
||||
if doYouWantToSave == 6 then
|
||||
local r, fn = reaper.JS_Dialog_BrowseForSaveFile('Save RPP', '', '', '*.RPP')
|
||||
if r == 1 then
|
||||
reaper.Main_saveProject(fn)
|
||||
end
|
||||
end
|
||||
return doYouWantToSave
|
||||
end
|
||||
--]]
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
reaper.gmem_write(gmem_idx_Management, gmemPlaylist_RealiveListItem_Remove)
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
51
Realive_ProjectTabsList_Disable.lua
Normal file
51
Realive_ProjectTabsList_Disable.lua
Normal file
@ -0,0 +1,51 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Disable.lua
|
||||
* Description: ProjectTabsList_Disable
|
||||
* Instructions:
|
||||
* Author: Alex Paquette
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI:
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 1.0
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
local cmd_id = reaper.NamedCommandLookup("_RS2071ccff7199c897478c49da97ca1422fc732d4f")
|
||||
|
||||
local state = reaper.GetToggleCommandState(cmd_id)
|
||||
|
||||
if state == 0 then
|
||||
reaper.Main_OnCommand(cmd_id, 0)
|
||||
reaper.SetCursorContext(1) --Focus Arrange Window
|
||||
end
|
||||
51
Realive_ProjectTabsList_Enable.lua
Normal file
51
Realive_ProjectTabsList_Enable.lua
Normal file
@ -0,0 +1,51 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Enable.lua
|
||||
* Description: ProjectTabsList_Enable
|
||||
* Instructions:
|
||||
* Author: Alex Paquette
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI:
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 1.0
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
local cmd_id = reaper.NamedCommandLookup("_RS2071ccff7199c897478c49da97ca1422fc732d4f")
|
||||
|
||||
local state = reaper.GetToggleCommandState(cmd_id)
|
||||
|
||||
if state == 0 then
|
||||
reaper.Main_OnCommand(cmd_id, 0)
|
||||
reaper.SetCursorContext(1) --Focus Arrange Window
|
||||
end
|
||||
69
Realive_ProjectTabsList_Nav_Next.lua
Normal file
69
Realive_ProjectTabsList_Nav_Next.lua
Normal file
@ -0,0 +1,69 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Nav_Next.lua
|
||||
* Description: Realive_ProjectTabsList_Nav_Next
|
||||
* Instructions:
|
||||
* Author: Alex Paquette, Modified Script from to MPL, Mespotine
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI: https://forum.cockos.com/showthread.php?p=1854775#post1854775
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 2.00
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
local debug = false
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
function ProjectNavigation_Next()
|
||||
local nextproj = ''
|
||||
if reaper.HasExtState('Realive_Playlist', 'nextProjectID') then
|
||||
nextproj = reaper.GetExtState('Realive_Playlist', 'nextProjectID')
|
||||
end
|
||||
local nextproj_ID, fn = reaper.EnumProjects(nextproj-1,'')
|
||||
reaper.SelectProjectInstance(nextproj_ID)
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
ProjectNavigation_Next()
|
||||
end
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
run()
|
||||
|
||||
69
Realive_ProjectTabsList_Nav_Prev.lua
Normal file
69
Realive_ProjectTabsList_Nav_Prev.lua
Normal file
@ -0,0 +1,69 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Nav_Prev.lua
|
||||
* Description: Realive_ProjectTabsList_Nav_Prev
|
||||
* Instructions:
|
||||
* Author: Alex Paquette, Modified Script from to MPL, Mespotine
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI: https://forum.cockos.com/showthread.php?p=1854775#post1854775
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 2.00
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
local debug = false
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
function ProjectNavigation_Prev()
|
||||
local prevproj = ''
|
||||
if reaper.HasExtState('Realive_Playlist', 'prevProjectID') then
|
||||
prevproj = reaper.GetExtState('Realive_Playlist', 'prevProjectID')
|
||||
end
|
||||
local prevproj_ID, fn = reaper.EnumProjects(prevproj-1,'')
|
||||
reaper.SelectProjectInstance(prevproj_ID)
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
ProjectNavigation_Prev()
|
||||
end
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
run()
|
||||
|
||||
306
Realive_ProjectTabsList_Open.lua
Normal file
306
Realive_ProjectTabsList_Open.lua
Normal file
@ -0,0 +1,306 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Open.lua
|
||||
* Description: Open RPL File
|
||||
* Instructions:
|
||||
* Author: Alex Paquette, Thanks to Claude Fillion for the Large contribution
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI: https://forum.cockos.com/showthread.php?p=1854775#post1854775
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 2.00
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
local EXT_SECTION = 'ProjectTabs_Reaper_list'
|
||||
local EXT_SECTION_PLAYLIST = 'ProjectTabs_Realive_list'
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
local RegionWindow_cmdID = reaper.NamedCommandLookup("_RS05396ad2c5c53e928799e707652dea37cc588b3c")
|
||||
local ResetPlayView_cmdID = reaper.NamedCommandLookup("_RS08d5f2749008cc0f6f53feb223d1638fde598566")
|
||||
local PlaylistWindow_cmdID = reaper.NamedCommandLookup('_RS2071ccff7199c897478c49da97ca1422fc732d4f')
|
||||
local debug = false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
local playlistState = reaper.GetExtState('Realive_Playlist', 'State')
|
||||
local realivePlaylist_compare = 0
|
||||
|
||||
-----// Zoom Variables //------------------------------
|
||||
local Zoom2Amount = 100
|
||||
local Zoom2Forceset = 1
|
||||
local Zoom2Doupd = false
|
||||
local Zoom2Centermode = -1-- 0=EditCursor,
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// FUNCTIONS //---------------------------------------
|
||||
-----------------------------------------------------------
|
||||
function Playlist_CountProjectTabs()
|
||||
local ProjCount=-1
|
||||
local Aretval="t"
|
||||
while Aretval~=nil do
|
||||
local Aretval, Aprojfn = reaper.EnumProjects(ProjCount+1, "")
|
||||
if Aretval~=nil then ProjCount=ProjCount+1
|
||||
else break
|
||||
end
|
||||
end
|
||||
return ProjCount+1
|
||||
end
|
||||
|
||||
|
||||
|
||||
function Actions_ResetAllProjects()
|
||||
local prjct_Counter = Playlist_CountProjectTabs()
|
||||
for p = 0, prjct_Counter do
|
||||
local proj = reaper.EnumProjects(p, 0)
|
||||
if not proj then break
|
||||
else
|
||||
reaper.SetEditCurPos2(proj, 0, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// Realive List Management //-------------------------
|
||||
-----------------------------------------------------------
|
||||
|
||||
function makeKey(i)
|
||||
return string.format('project%d', i)
|
||||
end
|
||||
|
||||
|
||||
function enum_RealivePlaylist()
|
||||
local i = 1
|
||||
return function()
|
||||
local key = makeKey(i)
|
||||
i = i + 1
|
||||
if reaper.HasExtState(EXT_SECTION_PLAYLIST, key) then
|
||||
return key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function get_RealivePlaylist()
|
||||
local Realive_list = {}
|
||||
for Realive_key in enum_RealivePlaylist() do
|
||||
local Realive_projfn = reaper.GetExtState(EXT_SECTION_PLAYLIST, Realive_key)
|
||||
table.insert(Realive_list, Realive_projfn)
|
||||
end
|
||||
return Realive_list
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// SAVE RPL FUNCTION //-------------------------------
|
||||
-----------------------------------------------------------
|
||||
function SaveRPL()
|
||||
local out_str = ''
|
||||
local save_targetPath = ''
|
||||
local save_lastPath = ''
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'lastPath') then
|
||||
save_lastPath = reaper.GetExtState('Realive_PlaylistFolder', 'lastPath')
|
||||
end
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'defaultPath') then
|
||||
save_defaultPath = reaper.GetExtState('Realive_PlaylistFolder', 'defaultPath')
|
||||
end
|
||||
if save_lastPath ~= '' then save_targetPath = save_lastPath
|
||||
elseif save_defaultPath ~= '' then save_targetPath = save_defaultPath
|
||||
end
|
||||
local unsavedConfirm = 0
|
||||
local playlist = get_RealivePlaylist()
|
||||
|
||||
local projcnt = Playlist_CountProjectTabs()
|
||||
local UnsavedProj_cnt = 0
|
||||
for i = 1, projcnt do
|
||||
local retval, projfn= reaper.EnumProjects( i-1, '' )
|
||||
if projfn =='' then UnsavedProj_cnt = UnsavedProj_cnt+1 end
|
||||
Msg('projfn: '..projfn)
|
||||
end
|
||||
Msg('UnsavedProject: '..UnsavedProj_cnt)
|
||||
if UnsavedProj_cnt > 0 then
|
||||
unsavedConfirm = reaper.ShowMessageBox("Your list contains project(s) that have no name. They will not be saved in the playlist. Do you still want to proceed? ", 'Warning', 4) -- Yes = 6, No = 7, Cancel = 2
|
||||
Msg('unsavedConfirm: '..unsavedConfirm)
|
||||
if unsavedConfirm ~= 6 then return end
|
||||
end
|
||||
|
||||
local SaveDialogAnswer, saving_folder = reaper.JS_Dialog_BrowseForSaveFile('Save RPL', save_targetPath, '', 'Reaper Playlist files (.RPL)\0*.RPL\0\0')
|
||||
Msg('SaveDialogAnswer: '..SaveDialogAnswer)
|
||||
if SaveDialogAnswer == 1 then -- if a file was selected
|
||||
extst_path = string.match(saving_folder, ".+/")
|
||||
reaper.SetExtState('Realive_PlaylistFolder', 'lastPath', extst_path, false)
|
||||
Msg('path: '..extst_path)
|
||||
for i = 1, #playlist do
|
||||
out_str = out_str..playlist[i]..'\n'
|
||||
end
|
||||
local f = io.open(saving_folder, 'w')
|
||||
f:write(out_str)
|
||||
f:close()
|
||||
OpenRPL()
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
-----------------------------------------------------------
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// OPEN RPL FUNCTION //-------------------------------
|
||||
-----------------------------------------------------------
|
||||
function OpenRPL()
|
||||
local open_targetPath = ''
|
||||
local open_lastPath = ''
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'lastPath') then
|
||||
open_lastPath = reaper.GetExtState('Realive_PlaylistFolder', 'lastPath')
|
||||
end
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'defaultPath') then
|
||||
open_defaultPath = reaper.GetExtState('Realive_PlaylistFolder', 'defaultPath')
|
||||
end
|
||||
if open_lastPath ~= '' then open_targetPath = open_lastPath
|
||||
elseif open_defaultPath ~= '' then open_targetPath = open_defaultPath
|
||||
end
|
||||
|
||||
local r, fn = reaper.JS_Dialog_BrowseForOpenFiles('Open RPL', open_targetPath, '', 'Reaper Playlist files (.RPL)\0*.RPL\0\0', false)
|
||||
Msg('r: '..r)
|
||||
|
||||
if r == 1 then
|
||||
if fn ~= '' then
|
||||
extst_path = string.match(fn, ".+/")
|
||||
reaper.SetExtState('Realive_PlaylistFolder', 'lastPath', extst_path, false)
|
||||
Msg('path: '..extst_path)
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
local f = io.open(fn, 'r')
|
||||
if not f then return end
|
||||
local context = f:read('a')
|
||||
f:close()
|
||||
CloseAllTabs()
|
||||
for line in context:gmatch('[^\r\n]+') do
|
||||
reaper.Main_OnCommand(41929, 0 ) -- New project tab (ignore default template)
|
||||
reaper.Main_openProject( line )
|
||||
end
|
||||
reaper.SelectProjectInstance( reaper.EnumProjects( 0, '') )
|
||||
reaper.Main_OnCommand(40860,0) -- Close current project tab
|
||||
Playlist_Init()
|
||||
end
|
||||
-----------------------------------------------------------
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
||||
function RestartPlaylistWindow()
|
||||
local state = reaper.GetToggleCommandState(PlaylistWindow_cmdID)
|
||||
if state == 1 then
|
||||
reaper.Main_OnCommand(PlaylistWindow_cmdID,0) --Close Playlist Window
|
||||
reaper.Main_OnCommand(PlaylistWindow_cmdID,0) --Restart Playlist Window
|
||||
end
|
||||
end
|
||||
|
||||
function CloseAllTabs()
|
||||
reaper.Main_OnCommand(40886, 0) -- Close All Projects
|
||||
reaper.Main_OnCommand(41929, 0) -- Open empty project
|
||||
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_FIRSTPROJTAB"), 0) -- Switch to 1st Tab
|
||||
reaper.Main_OnCommand(40860, 0) -- Close tab
|
||||
|
||||
end
|
||||
|
||||
|
||||
function Playlist_Init()
|
||||
RestartPlaylistWindow()
|
||||
Actions_ResetAllProjects()
|
||||
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_PROJTAB2"), 0) -- Switch to 2nd Tab
|
||||
-- reaper.Main_OnCommand(RegionWindow_cmdID,0) --Initialize Region Window
|
||||
reaper.Main_OnCommand(ResetPlayView_cmdID,0) --Reset Live Playing View
|
||||
reaper.adjustZoom(Zoom2Amount, Zoom2Forceset, Zoom2Doupd, Zoom2Centermode)
|
||||
reaper.SetEditCurPos(0, true, true)
|
||||
end
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
if playlistState == 'Drty' then
|
||||
realivePlaylist_compare = reaper.ShowMessageBox("Do you want to save your Playlist? ", 'Playlist was Changed', 3) -- Yes = 6, No = 7, Cancel = 2
|
||||
end
|
||||
|
||||
if realivePlaylist_compare == 2 then return end -- if Cancel then abort the whole thing
|
||||
if realivePlaylist_compare == 6 then -- if Yes then save RPL
|
||||
SaveRPL()
|
||||
else
|
||||
OpenRPL()
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
199
Realive_ProjectTabsList_OpenTab.lua
Normal file
199
Realive_ProjectTabsList_OpenTab.lua
Normal file
@ -0,0 +1,199 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_OpenTab.lua
|
||||
* Description: Realive_ProjectTabsList_OpenTab
|
||||
* Instructions:
|
||||
* Author: Alex Paquette
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI:
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 1.0
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
local repeatScriptState_Disable = reaper.NamedCommandLookup("_RS24446d8435cd186efe8d61c5b1da7b00a11c959c")
|
||||
local debug = false
|
||||
local ClickTracks = "ClickMaster"
|
||||
local CueTracks = "QsMaster"
|
||||
|
||||
|
||||
-----// Zoom Variables //------------------------------
|
||||
local Zoom2Amount = 100
|
||||
local Zoom2Forceset = 1
|
||||
local Zoom2Doupd = false
|
||||
local Zoom2Centermode = -1-- 0=EditCursor,
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function getTrackByName(name)
|
||||
reaper.Main_OnCommand(40297, 0) -- Unselect all tracks
|
||||
local CountTrack = reaper.CountTracks( 0 )
|
||||
if CountTrack == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if not name then name = "{$[(*)]*[}{(*)]$}" end
|
||||
for i = 1,CountTrack do
|
||||
local track_search = reaper.GetTrack( 0, i-1 )
|
||||
local retval, buf = reaper.GetTrackName( track_search, "" )
|
||||
if buf == name then
|
||||
reaper.SetOnlyTrackSelected(track_search)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UnMuteTrackByName(TrackToBeUnMuted)
|
||||
reaper.Main_OnCommand(40297, 0) -- Unselect all tracks
|
||||
local CountTrack = reaper.CountTracks( 0 )
|
||||
if CountTrack == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if not TrackToBeUnMuted then TrackToBeUnMuted = "{$[(*)]*[}{(*)]$}" end
|
||||
for i = 1,CountTrack do
|
||||
local Track = reaper.GetTrack( 0, i-1 )
|
||||
local retval, buf = reaper.GetTrackName( Track, "" )
|
||||
if buf == TrackToBeUnMuted then
|
||||
reaper.SetMediaTrackInfo_Value(Track, "B_MUTE", 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// OPEN File FUNCTION //-------------------------------
|
||||
-----------------------------------------------------------
|
||||
function OpenFile()
|
||||
|
||||
local lastProjPath = reaper.GetExtState('Realive_Projects', 'last_opened_proj')
|
||||
local curProjPath_retval, curProjPath = reaper.EnumProjects(-1, '' )
|
||||
if curProjPath ~= '' then
|
||||
projPath = curProjPath
|
||||
else
|
||||
projPath = lastProjPath
|
||||
end
|
||||
|
||||
local r, fn = reaper.JS_Dialog_BrowseForOpenFiles('Open RPP', ('/'..projPath), '', 'Reaper files (.RPP)\0*.RPP;*.rpp-bak\0\0', false)
|
||||
Msg('r: '..r)
|
||||
|
||||
if r == 1 then
|
||||
reaper.Main_openProject(fn)
|
||||
reaper.SetExtState('Realive_Projects', 'last_opened_proj', tostring(fn), true)
|
||||
else
|
||||
return
|
||||
end
|
||||
return r
|
||||
end
|
||||
-----------------------------------------------------------
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
||||
function ScreensetSetUp()
|
||||
reaper.Main_OnCommand(PlayView_cmdID, 0) --Load Play View Window Set
|
||||
reaper.SetCursorContext(1) --Focus Arrange Window
|
||||
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_HIDEMASTER"), 0) --Hide Master Track in TCP
|
||||
getTrackByName("Structure")
|
||||
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWS_VZOOMFIT_NO_ENV"), 0) --Vertical Zoom to Selected tracks
|
||||
if reaper.GetToggleCommandState(40390) == 0 then reaper.Main_OnCommand(40390, 0) end -- Enable Smooth Seek
|
||||
reaper.Main_OnCommand(40340, 0) --Unsolo all tracks
|
||||
reaper.Main_OnCommand(40769, 0) --Unselect all everything
|
||||
reaper.Main_OnCommand(40635, 0) --Remove Time Selection
|
||||
--reaper.Main_OnCommand(reaper.NamedCommandLookup("_XENAKIOS_TVPAGEHOME"), 0) --Scroll Track View To Home
|
||||
reaper.Main_OnCommand(40923, 0) --Grid Set To Measure
|
||||
reaper.Main_OnCommand(40754, 0) --Snapping Enable Snap
|
||||
if reaper.GetToggleCommandState(40145) == 0 then reaper.Main_OnCommand(40145, 0) end --Enable Gridlines
|
||||
if reaper.GetToggleCommandState(42328) == 0 then reaper.Main_OnCommand(42328, 0) end -- Enable Marker And Region Gridlines
|
||||
reaper.Main_OnCommand(40634, 0) -- Remove Loop Points Time Selection
|
||||
reaper.SNM_SetIntConfigVar('playcursormode', 15)
|
||||
reaper.SetExtState('Realive', 'currentView', 'live', false)
|
||||
reaper.SetExtState('Realive', 'CursorChasing', 'Enabled', false)
|
||||
|
||||
reaper.Main_OnCommand(41746,0) --Disable Metronome
|
||||
reaper.Main_OnCommand(repeatScriptState_Disable, 0) --Repeat State Disable
|
||||
UnMuteTrackByName(CueTracks)
|
||||
UnMuteTrackByName(ClickTracks)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
-- reaper.Main_OnCommand(40025, 0) -- Open New Project
|
||||
if OpenFile() == 1 then
|
||||
reaper.gmem_write(gmem_idx_Management, gmemPlaylist_RealiveListItem_Update)
|
||||
ScreensetSetUp()
|
||||
reaper.adjustZoom(Zoom2Amount, Zoom2Forceset, Zoom2Doupd, Zoom2Centermode)
|
||||
reaper.SetEditCurPos(0, true, true)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
90
Realive_ProjectTabsList_Refresh.lua
Normal file
90
Realive_ProjectTabsList_Refresh.lua
Normal file
@ -0,0 +1,90 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Refresh.lua
|
||||
* Description: ProjectTabsList_Refresh
|
||||
* Instructions:
|
||||
* Author: Alex Paquette
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI:
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 1.0
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
|
||||
|
||||
function RefreshPlaylist()
|
||||
local cmd_id = reaper.NamedCommandLookup('_RS2071ccff7199c897478c49da97ca1422fc732d4f')
|
||||
local state = reaper.GetToggleCommandState(cmd_id)
|
||||
if state == 1 then
|
||||
reaper.Main_OnCommand(cmd_id, 0)
|
||||
reaper.Main_OnCommand(cmd_id, 0)
|
||||
reaper.SetCursorContext(1) --Focus Arrange Window
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
|
||||
function run()
|
||||
-- RefreshPlaylist()
|
||||
reaper.gmem_write(gmem_idx_Management, gmemPlaylist_Initialize)
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
222
Realive_ProjectTabsList_Save.lua
Normal file
222
Realive_ProjectTabsList_Save.lua
Normal file
@ -0,0 +1,222 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Compare.lua
|
||||
* Description: Project Tabs List Compare with last Saved One
|
||||
* Instructions:
|
||||
* Author: Alex Paquette, Thanks to Claude Fillion for the Large contribution
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI: https://forum.cockos.com/showthread.php?p=1854775#post1854775
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 2.00
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
local EXT_SECTION = 'ProjectTabs_Reaper_list'
|
||||
local EXT_SECTION_PLAYLIST = 'ProjectTabs_Realive_list'
|
||||
local debug = false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// FUNCTIONS //---------------------------------------
|
||||
-----------------------------------------------------------
|
||||
function Playlist_CountProjectTabs()
|
||||
local ProjCount=-1
|
||||
local Aretval="t"
|
||||
while Aretval~=nil do
|
||||
local Aretval, Aprojfn = reaper.EnumProjects(ProjCount+1, "")
|
||||
if Aretval~=nil then ProjCount=ProjCount+1
|
||||
else break
|
||||
end
|
||||
end
|
||||
return ProjCount+1
|
||||
end
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// Realive List Management //-------------------------
|
||||
-----------------------------------------------------------
|
||||
function makeKey(i)
|
||||
return string.format('project%d', i)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function enum_RealivePlaylist()
|
||||
local i = 1
|
||||
return function()
|
||||
local key = makeKey(i)
|
||||
i = i + 1
|
||||
if reaper.HasExtState(EXT_SECTION_PLAYLIST, key) then
|
||||
return key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function get_RealivePlaylist()
|
||||
local Realive_list = {}
|
||||
for Realive_key in enum_RealivePlaylist() do
|
||||
local Realive_projfn = reaper.GetExtState(EXT_SECTION_PLAYLIST, Realive_key)
|
||||
table.insert(Realive_list, Realive_projfn)
|
||||
end
|
||||
return Realive_list
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// SAVE RPL FUNCTION //-------------------------------
|
||||
-----------------------------------------------------------
|
||||
function SaveRPL()
|
||||
local out_str = ''
|
||||
local targetPath = ''
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'lastPath') then
|
||||
lastPath = reaper.GetExtState('Realive_PlaylistFolder', 'lastPath')
|
||||
end
|
||||
if reaper.HasExtState('Realive_PlaylistFolder', 'defaultPath') then
|
||||
defaultPath = reaper.GetExtState('Realive_PlaylistFolder', 'defaultPath')
|
||||
end
|
||||
if lastPath ~= '' then targetPath = lastPath
|
||||
elseif defaultPath ~= '' then targetPath = defaultPath
|
||||
end
|
||||
local unsavedConfirm = 0
|
||||
local playlist = get_RealivePlaylist()
|
||||
|
||||
local projcnt = Playlist_CountProjectTabs()
|
||||
local UnsavedProj_cnt = 0
|
||||
for i = 1, projcnt do
|
||||
local retval, projfn= reaper.EnumProjects( i-1, '' )
|
||||
if projfn =='' then UnsavedProj_cnt = UnsavedProj_cnt+1 end
|
||||
Msg('projfn: '..projfn)
|
||||
end
|
||||
Msg('UnsavedProject: '..UnsavedProj_cnt)
|
||||
if UnsavedProj_cnt > 0 then
|
||||
unsavedConfirm = reaper.ShowMessageBox("Your list contains project(s) that have no name. They will not be saved in the playlist. Do you still want to proceed? ", 'Warning', 4) -- Yes = 6, No = 7, Cancel = 2
|
||||
Msg('unsavedConfirm: '..unsavedConfirm)
|
||||
if unsavedConfirm ~= 6 then return end
|
||||
end
|
||||
|
||||
local SaveDialogAnswer, saving_folder = reaper.JS_Dialog_BrowseForSaveFile('Save RPL', targetPath, '', 'Reaper Playlist files (.RPL)\0*.RPL\0\0')
|
||||
Msg('SaveDialogAnswer: '..SaveDialogAnswer)
|
||||
if SaveDialogAnswer == 1 then -- if a file was selected
|
||||
extst_path = string.match(saving_folder, ".+/")
|
||||
reaper.SetExtState('Realive_PlaylistFolder', 'lastPath', extst_path, false)
|
||||
Msg('path: '..extst_path)
|
||||
for i = 1, #playlist do
|
||||
out_str = out_str..playlist[i]..'\n'
|
||||
end
|
||||
local f = io.open(saving_folder, 'w')
|
||||
f:write(out_str)
|
||||
f:close()
|
||||
reaper.gmem_write(gmem_idx_Management, gmemPlaylist_ProjectTabs_CleanStatus)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
|
||||
function run()
|
||||
SaveRPL()
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
184
Realive_ProjectTabsList_SaveAllTabs.lua
Normal file
184
Realive_ProjectTabsList_SaveAllTabs.lua
Normal file
@ -0,0 +1,184 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Compare.lua
|
||||
* Description: Project Tabs List Compare with last Saved One
|
||||
* Instructions:
|
||||
* Author: Alex Paquette, Thanks to Claude Fillion for the Large contribution
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI: https://forum.cockos.com/showthread.php?p=1854775#post1854775
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 2.00
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
|
||||
local EXT_SECTION_PLAYLIST = 'ProjectTabs_Realive_list'
|
||||
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmemPlaylist_RealiveListItem_Cleanup = 10
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
local debug = false
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// FUNCTIONS //---------------------------------------
|
||||
-----------------------------------------------------------
|
||||
function Playlist_CountProjectTabs()
|
||||
local ProjCount=-1
|
||||
local Aretval="t"
|
||||
while Aretval~=nil do
|
||||
local Aretval, Aprojfn = reaper.EnumProjects(ProjCount+1, "")
|
||||
if Aretval~=nil then ProjCount=ProjCount+1
|
||||
else break
|
||||
end
|
||||
end
|
||||
return ProjCount+1
|
||||
end
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
-----// Realive List Management //-------------------------
|
||||
-----------------------------------------------------------
|
||||
function makeKey(i)
|
||||
return string.format('project%d', i)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function enum_RealivePlaylist()
|
||||
local i = 1
|
||||
return function()
|
||||
local key = makeKey(i)
|
||||
i = i + 1
|
||||
if reaper.HasExtState(EXT_SECTION_PLAYLIST, key) then
|
||||
return key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function get_RealivePlaylist()
|
||||
local Realive_list = {}
|
||||
for Realive_key in enum_RealivePlaylist() do
|
||||
local Realive_projfn = reaper.GetExtState(EXT_SECTION_PLAYLIST, Realive_key)
|
||||
table.insert(Realive_list, Realive_projfn)
|
||||
end
|
||||
return Realive_list
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function SaveProject(proj, proj_fn)
|
||||
local drtyState = reaper.IsProjectDirty(proj)
|
||||
-- Msg('proj_fn: '..proj_fn)
|
||||
|
||||
if drtyState == 1 or proj_fn == '' then
|
||||
local before_projfn = reaper.GetProjectPathEx(proj, '')
|
||||
Msg('before_projfn: '..before_projfn)
|
||||
reaper.Main_SaveProject(proj, false)
|
||||
local after_projfn= reaper.GetProjectPathEx(proj, '')
|
||||
Msg('after_projfn: '..after_projfn)
|
||||
if before_projfn ~= after_projfn then
|
||||
Msg('Project Updated!!!')
|
||||
reaper.SelectProjectInstance(proj)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function SaveAllTabs()
|
||||
local playlist = get_RealivePlaylist()
|
||||
----- Loop...
|
||||
for i = 1, #playlist do
|
||||
local retval, projfn= reaper.EnumProjects( i-1, '' )
|
||||
SaveProject(retval, projfn)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
local current_proj, current_projfn= reaper.EnumProjects(-1, '')
|
||||
SaveAllTabs()
|
||||
-- reaper.gmem_write(gmem_idx_Management, gmemPlaylist_RealiveListItem_Cleanup)
|
||||
reaper.gmem_write(gmem_idx_Management, gmemPlaylist_Initialize)
|
||||
reaper.SelectProjectInstance(current_proj)
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
94
Realive_ProjectTabsList_SaveAsCurrentTab.lua
Normal file
94
Realive_ProjectTabsList_SaveAsCurrentTab.lua
Normal file
@ -0,0 +1,94 @@
|
||||
--------------------------------------
|
||||
----------// HEADER //----------------
|
||||
--------------------------------------
|
||||
--[[
|
||||
* REALIVE: Reaper Setup for a Complete Live Playback Engine
|
||||
* ReaScript Name: Realive_ProjectTabsList_Refresh.lua
|
||||
* Description: ProjectTabsList_Refresh
|
||||
* Instructions:
|
||||
* Author: Alex Paquette
|
||||
* Repository:
|
||||
* Repository URI:
|
||||
* File URI:
|
||||
* Licence: GPL v3
|
||||
* Forum Thread:
|
||||
* Forum Thread URI:
|
||||
* REAPER: 5
|
||||
* Extensions: SWS/S&M
|
||||
* Version: 1.0
|
||||
--]]
|
||||
|
||||
--[[
|
||||
* Changelog:
|
||||
* v1.0 (2019-06-02)
|
||||
+ Initial Release
|
||||
--]]
|
||||
|
||||
|
||||
--------------------------------------
|
||||
----------// VARIABLES //-------------
|
||||
--------------------------------------
|
||||
|
||||
|
||||
|
||||
local reaper = reaper -------// Performance Enhancement //----------
|
||||
|
||||
-----// Window Set Numbers //------------------------------
|
||||
local PlayViewWindowSet = 01 -- Enter Window Set Number Used for the "Live Play" View
|
||||
local AllTracksViewWindowSet = 02 -- Enter the Window Set Number for the "Show All Tracks" View
|
||||
local WindowSetBaseNumber = 40453
|
||||
local PlayView_cmdID = WindowSetBaseNumber+PlayViewWindowSet
|
||||
local AllView_cmdID = WindowSetBaseNumber+AllTracksViewWindowSet
|
||||
|
||||
-----// Other Variables //------------------------------
|
||||
|
||||
|
||||
-----// gmem Variables //------------------------------
|
||||
local gmemSect = 'Realive_Gmem'
|
||||
local gmem_idx_PlaylistState = 11
|
||||
local gmem_idx_Management = 12
|
||||
local gmem_idx_PlaylistState_Clean = 32
|
||||
local gmem_idx_PlaylistCount_Reaper = 30
|
||||
local gmem_idx_PlaylistCount_Realive = 31
|
||||
local gmemPlaylist_SaveRequest = 1
|
||||
local gmemPlaylist_SaveRefused = 2
|
||||
local gmemPlaylist_Initialize = 3
|
||||
local gmemPlaylist_RealiveListItem_Remove = 4
|
||||
local gmemPlaylist_RealiveListItem_Add = 5
|
||||
local gmemPlaylist_RealiveListItem_Update = 6
|
||||
local gmemPlaylist_ProjectTabs_CleanStatus = 9
|
||||
local gmem_idxRead_Mngmt = reaper.gmem_read(gmem_idx_Management)
|
||||
|
||||
|
||||
local debug = false
|
||||
-----------------------------------------------------------
|
||||
-----// DEBUG FUNCTION //----------------------------------
|
||||
-----------------------------------------------------------
|
||||
if debug then reaper.ShowConsoleMsg("") end
|
||||
function Msg(value)
|
||||
if debug then
|
||||
reaper.ShowConsoleMsg(tostring(value) .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------
|
||||
---------// RUN FUNCTION //--------------
|
||||
------------------------------------------
|
||||
function run()
|
||||
local proj, projfn= reaper.EnumProjects( -1, '' )
|
||||
local before_projfn = reaper.GetProjectPathEx(proj, '')
|
||||
Msg('before_projfn: '..before_projfn)
|
||||
reaper.Main_OnCommand(40022, 0) -- Save As Project Tab
|
||||
local after_projfn= reaper.GetProjectPathEx(proj, '')
|
||||
Msg('after_projfn: '..after_projfn)
|
||||
if before_projfn ~= after_projfn then
|
||||
reaper.gmem_write(gmem_idx_Management, gmemPlaylist_RealiveListItem_Update)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
---------// RUNTIME //-------------------
|
||||
------------------------------------------
|
||||
reaper.gmem_attach(gmemSect)
|
||||
run()
|
||||
Loading…
Reference in New Issue
Block a user