aboutsummaryrefslogtreecommitdiff
path: root/intervals.lua
diff options
context:
space:
mode:
Diffstat (limited to 'intervals.lua')
-rw-r--r--intervals.lua45
1 files changed, 29 insertions, 16 deletions
diff --git a/intervals.lua b/intervals.lua
index 2b402d5..cd61424 100644
--- a/intervals.lua
+++ b/intervals.lua
@@ -491,22 +491,6 @@ function play(note, vel)
end
function init()
- -- initialize midi
- -- TODO configure vport
- intervals_state.midi_in = midi.connect(1)
- intervals_state.midi_in.event = function (a)
- b = midi.to_msg(a)
- -- monitor
- if b.type == "note_on" then
- play_start(b.note, b.vel)
- end
- if b.type == "note_off" or b.vel == 0 then
- play_stop(b.note, b.vel)
- end
- state_call(intervals_state, "midi", {b})
- end
- intervals_state.midi_out = midi.connect(2)
-
-- TODO save
params:add({
type = "option",
@@ -558,6 +542,35 @@ function init()
action = function(value)
intervals_state.note_vel = value
end})
+ params:add({
+ type = "control",
+ id = "midi_in_vport",
+ name = "Midi in vport",
+ default=60,
+ controlspec = ControlSpec.new(1, 4, 'lin', 1, 1),
+ action = function(value)
+ intervals_state.midi_in = midi.connect(value)
+ intervals_state.midi_in.event = function (a)
+ b = midi.to_msg(a)
+ -- monitor
+ if b.type == "note_on" then
+ play_start(b.note, b.vel)
+ end
+ if b.type == "note_off" or b.vel == 0 then
+ play_stop(b.note, b.vel)
+ end
+ state_call(intervals_state, "midi", {b})
+ end
+ end})
+ params:add({
+ type = "control",
+ id = "midi_out_vport",
+ name = "Midi out vport",
+ default=60,
+ controlspec = ControlSpec.new(1, 4, 'lin', 1, 2),
+ action = function(value)
+ intervals_state.midi_out = midi.connect(value)
+ end})
params:bang()
play(60)