-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
53 lines (47 loc) · 1.69 KB
/
main.lua
File metadata and controls
53 lines (47 loc) · 1.69 KB
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
function set_midifighter_buttons()
local outs = renoise.Midi.available_output_devices()
local instrIndex = renoise.song().selected_instrument_index
local instr = renoise.song().instruments[instrIndex]
local samplemappings = instr.sample_mappings[renoise.Instrument.LAYER_NOTE_ON]
local colortable = {79,61,109,30 ,84,80,74}
local out = nil
local noteon = 0x90
local noteoff = 0x80
for i=1, #outs do
if string.find( outs[i], "Midi Fighter 3D") then
out = renoise.Midi.create_output_device( outs[i] )
break;
end
end
if out then
-- clear all buttons
for i=1, 127 do
out:send {noteoff+2, i, 0x0}
end
--step through each sample
for i=1, table.getn(samplemappings) do
if samplemappings[i].base_note>23 and samplemappings[i].base_note<87 then
if samplemappings[i].sample.mute_group>0 then
out:send {
noteon+2,
samplemappings[i].base_note-((renoise.song().transport.octave-4)*12),
colortable[samplemappings[i].sample.mute_group]
}
out:send {
noteon+3,
samplemappings[i].base_note-((renoise.song().transport.octave-4)*12),
33
}
end
end
end
end
end
renoise.tool():add_menu_entry {
name = "--- Main Menu:Tools:Set midifighter button led ...",
invoke = function() set_midifighter_buttons() end
}
renoise.tool():add_keybinding {
name = "Global:Midifighter:Set button led ...",
invoke = function() set_midifighter_buttons() end
}