-
Notifications
You must be signed in to change notification settings - Fork 1
/
midi_in.lua
111 lines (77 loc) · 3.22 KB
/
midi_in.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
-- Receiving MIDI messages
--
-- The callbacks to process specific types of incoming MIDI messages.
-- Do not leave empty or unused callback functions in your Lua module -
-- it saves Electra's processing resources.
--
-- The midiInput.interface is a string currently. I would like to change
-- it to a numeric identifier.
--
function midi.onControlChange (midiInput, channel, controllerNumber, value)
print ("controlChange received: interface=" .. midiInput.interface ..
" channel=" .. channel ..
" controllerNumber=" .. controllerNumber .. " value=" .. value)
end
function midi.onNoteOn (midiInput, channel, noteNumber, velocity)
print ("noteOn received: interface=" .. midiInput.interface ..
" channel=" .. channel ..
" noteNumber=" .. noteNumber .. " velocity=" .. velocity)
end
function midi.onNoteOff (midiInput, channel, noteNumber, velocity)
print ("noteOff received: interface=" .. midiInput.interface ..
" channel=" .. channel ..
" noteNumber=" .. noteNumber .. " velocity=" .. velocity)
end
function midi.onAfterTouchPoly (midiInput, channel, noteNumber, pressure)
print ("afterTouchPoly received: interface=" .. midiInput.interface ..
" channel=" .. channel ..
" noteNumber=" .. noteNumber .. " pressure=" .. pressure)
end
function midi.onProgramChange (midiInput, channel, programNumber)
print ("programChange received: interface=" .. midiInput.interface ..
" channel=" .. channel ..
" programNumber=" .. programNumber)
end
function midi.onAfterTouchChannel (midiInput, channel, pressure)
print ("afterTouchChannel received: interface=" .. midiInput.interface ..
" channel=" .. channel ..
" pressure=" .. pressure)
end
function midi.onPitchBendChannel (midiInput, channel, value)
print ("pitchBend received: interface=" .. midiInput.interface ..
" channel=" .. channel ..
" value=" .. value)
end
function midi.onSongSelect (midiInput, songNumber)
print ("songSelect received: interface=" .. midiInput.interface ..
" songNumber=" .. songNumber)
end
function midi.onSongPosition (midiInput, position)
print ("songPosition received: interface=" .. midiInput.interface ..
" position=" .. position)
end
function midi.onClock (midiInput)
print ("midi clock received: interface=" .. midiInput.interface)
end
function midi.onStart (midiInput)
print ("start received: interface=" .. midiInput.interface)
end
function midi.onStop (midiInput)
print ("stop received: interface=" .. midiInput.interface)
end
function midi.onContinue (midiInput)
print ("continue received: interface=" .. midiInput.interface)
end
function midi.onActiveSensing (midiInput)
print ("active sensing received: interface=" .. midiInput.interface)
end
function midi.onSystemReset (midiInput)
print ("system reset received: interface=" .. midiInput.interface)
end
function midi.onTuneRequest (midiInput)
print ("tune request received: interface=" .. midiInput.interface)
end
function midi.onSysex (midiInput, data)
print ("sysex message received: interface=" .. midiInput.interface ..
" data=[" .. table.concat (data,", ") .. "]")
end