-
Notifications
You must be signed in to change notification settings - Fork 0
/
preferences.lua
47 lines (30 loc) · 894 Bytes
/
preferences.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local function loadDependency(arg)
dofile(debug.getinfo(1,'S').source:match[[^@?(.*[\/])[^\/]-$]] .. arg .. ".lua")
end
loadDependency("Pickle")
local activeProjectIndex = 0
local sectionName = "com.pandabot.CopyAndPasteRhythm"
local rhythmNotesKey = "rhythmNotes"
local scriptIsRunningKey = "scriptIsRunning"
--
local function setValue(key, value)
reaper.SetProjExtState(activeProjectIndex, sectionName, key, value)
end
local function getValue(key)
local valueExists, value = reaper.GetProjExtState(activeProjectIndex, sectionName, key)
if valueExists == 0 then
return nil
end
return value
end
--[[ ]]--
function getRhythmNotesFromPreferences()
local pickledValue = getValue(rhythmNotesKey)
if pickledValue == nil then
return nil
end
return unpickle(pickledValue)
end
function setRhythmNotesInPreferences(arg)
setValue(rhythmNotesKey, pickle(arg))
end