aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgretchen <gretchen@gnar.cool>2019-11-16 16:08:58 -0800
committergretchen <gretchen@gnar.cool>2019-11-16 16:08:58 -0800
commitf050c35cc329e6dcdd21b747065205633bb192f6 (patch)
treeee27d2a4dbf3302b4eea60234b4900be6b3c0af1
parent106922c94796317c7cc8370791ab611b801ec883 (diff)
downloadintervals-f050c35cc329e6dcdd21b747065205633bb192f6.tar.gz
intervals-f050c35cc329e6dcdd21b747065205633bb192f6.zip
Configurable vport
-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)