From 1d55ac1706fe6427252493521fe42293135939ab Mon Sep 17 00:00:00 2001 From: Nikolaus Gullotta Date: Tue, 31 Jul 2018 14:40:07 -0500 Subject: [PATCH] incorporate program name into save and recalling --- scripts/mixer_settings_recall.lua | 17 +++++++++++++++-- scripts/mixer_settings_store.lua | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/scripts/mixer_settings_recall.lua b/scripts/mixer_settings_recall.lua index d693f8aa16..0e981288d6 100644 --- a/scripts/mixer_settings_recall.lua +++ b/scripts/mixer_settings_recall.lua @@ -30,6 +30,19 @@ function factory () return function () end return ok, err end + function whoami() + if not pcall(function() local first_check = Session:get_mixbus(0) end) then + return "Ardour" + else + local second_check = Session:get_mixbus(11) + if second_check:isnil() then + return "Mixbus" + else + return "32C" + end + end + end + function isdir(path) return exists(path.."/") end @@ -351,7 +364,7 @@ function factory () return function () local recall_options = { { type = "label", col=0, colspan=10, align="left", title = "" }, - { type = "file", col=0, colspan=10, align="left", key = "file", title = "Select a Settings File:", path = ARDOUR.LuaAPI.build_filename(Session:path(), "export", "params.lua") }, + { type = "file", col=0, colspan=15, align="left", key = "file", title = "Select a Settings File:", path = ARDOUR.LuaAPI.build_filename(Session:path(), "export", "params.lua") }, { type = "label", col=0, colspan=10, align="left", title = "" }, } @@ -362,7 +375,7 @@ function factory () return function () else if gvld['recall-dir'] == 1 then local global_ok = isdir(global_path) - local global_default_path = ARDOUR.LuaAPI.build_filename(global_path, 'factory_default.lua') + local global_default_path = ARDOUR.LuaAPI.build_filename(global_path, string.format("FactoryDefault-%s.lua", whoami())) print(global_default_path) if global_ok then recall_options[2]['path'] = global_default_path diff --git a/scripts/mixer_settings_store.lua b/scripts/mixer_settings_store.lua index 4b0d7ca46f..ca8af27c7b 100644 --- a/scripts/mixer_settings_store.lua +++ b/scripts/mixer_settings_store.lua @@ -30,6 +30,19 @@ function factory () return function () end return ok, err end + function whoami() + if not pcall(function() local first_check = Session:get_mixbus(0) end) then + return "Ardour" + else + local second_check = Session:get_mixbus(11) + if second_check:isnil() then + return "Mixbus" + else + return "32C" + end + end + end + function isdir(path) return exists(path.."/") end @@ -40,7 +53,7 @@ function factory () return function () if not(isdir(global_path)) then global_ok, _, _ = os.execute('mkdir '.. global_path) if global_ok == 0 then - local default_file = ARDOUR.LuaAPI.build_filename(global_path, 'factory_default.lua') + local default_file = ARDOUR.LuaAPI.build_filename(global_path, 'FactoryDefault-'..whoami()..'.lua') local file = io.open(default_file, "w") file:write("") file:close() @@ -327,13 +340,13 @@ function factory () return function () local filename = rv['filename'] if rv['store-dir'] == 1 then - local store_path = ARDOUR.LuaAPI.build_filename(global_path, filename .. '.lua') + local store_path = ARDOUR.LuaAPI.build_filename(global_path, string.format("%s-%s.lua", filename, whoami())) local selected = rv['selected'] mark_tracks(selected, store_path) end if rv['store-dir'] == 2 then - local store_path = ARDOUR.LuaAPI.build_filename(local_path, filename .. '.lua') + local store_path = ARDOUR.LuaAPI.build_filename(local_path, string.format("%s-%s.lua", filename, whoami())) print(store_path) local selected = rv['selected'] mark_tracks(selected, store_path)