-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluid-transientslice.lua
66 lines (54 loc) · 2.43 KB
/
fluid-transientslice.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local info = debug.getinfo(1,'S');
local script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]
loadfile(script_path .. "lib/reacoma.lua")()
if reacoma.settings.fatal then return end
local exe = reacoma.utils.wrap_quotes(
reacoma.settings.path .. "/fluid-transientslice"
)
local num_selected_items = reaper.CountSelectedMediaItems(0)
if num_selected_items > 0 then
local processor = reacoma.params.archetype.transientslice
reacoma.params.check_params(processor)
local param_names = "order,blocksize,padsize,skew,threshfwd,threshback,windowsize,clumplength,minslicelength"
local param_values = reacoma.params.parse_params(param_names, processor)
local confirm, user_inputs = reaper.GetUserInputs("Transient Slice Parameters", 9, param_names, param_values)
if confirm then
reacoma.params.store_params(processor, param_names, user_inputs)
local params = reacoma.utils.split_comma(user_inputs)
local order = params[1]
local blocksize = params[2]
local padsize = params[3]
local skew = params[4]
local threshfwd = params[5]
local threshback = params[6]
local windowsize = params[7]
local clumplength = params[8]
local minslicelength = params[9]
local data = reacoma.slicing.container
for i=1, num_selected_items do
reacoma.slicing.get_data(i, data)
local cmd = exe ..
" -source " .. reacoma.utils.wrap_quotes(data.full_path[i]) ..
" -indices " .. reacoma.utils.wrap_quotes(data.tmp[i]) ..
" -order " .. order ..
" -blocksize " .. blocksize ..
" -padsize " .. padsize ..
" -skew " .. skew ..
" -threshfwd " .. threshfwd ..
" -threshback " .. threshback ..
" -windowsize " .. windowsize ..
" -clumplength " .. clumplength ..
" -minslicelength " .. minslicelength ..
" -numframes " .. data.item_len_samples[i] ..
" -startframe " .. data.take_ofs_samples[i]
table.insert(data.cmd, cmd)
end
for i=1, num_selected_items do
reacoma.utils.cmdline(data.cmd[i])
table.insert(data.slice_points_string, reacoma.utils.readfile(data.tmp[i]))
reacoma.slicing.process(i, data)
end
reacoma.utils.arrange("reacoma-transientslice")
reacoma.utils.cleanup(data.tmp)
end
end