-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutil.lua
More file actions
34 lines (29 loc) · 872 Bytes
/
util.lua
File metadata and controls
34 lines (29 loc) · 872 Bytes
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
TOCALL = nil -- function to call when the timer runs out
KILL = false -- has the stop button been pushed
-- use a renoise timer to call a function in approx. mill milleseconds
function call_in(func, mill)
TOCALL = func
renoise.tool():add_timer(call, mill)
end
-- do the actual function call
function call()
renoise.tool():remove_timer(call)
if TOCALL and not KILL then
TOCALL()
end
end
function update_status(status)
renoise.app():show_status(status)
print(status)
end
-- convert a renoise note number to its name
function note_to_name(note)
local octave = math.floor(note/12)
local key = note % 12
local keys = {[0]="C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}
return keys[key] .. tostring(octave)
end
-- capitalize a word
function upcase(word)
return string.gsub(" "..word, "%W%l", string.upper):sub(2)
end