diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-11-04 05:25:10 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-11-04 05:25:10 +0100 |
commit | f5e8f70a7aaab571e1136e2eb789e3c1ebdc26f6 (patch) | |
tree | 827abc2ccf52626a418d271c32fbac802667f85b /applause.lua | |
parent | 4f800f22dcf18830a53bc8e736c51e4e7707b4a2 (diff) | |
download | applause2-f5e8f70a7aaab571e1136e2eb789e3c1ebdc26f6.tar.gz |
added simple support for MIDI CC commands
* MIDICCStream provides a stream of CC values as if
polled from the controller (this is emulated in
applause.c)
Diffstat (limited to 'applause.lua')
-rw-r--r-- | applause.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/applause.lua b/applause.lua index 5d19ad8..e5a9b42 100644 --- a/applause.lua +++ b/applause.lua @@ -884,6 +884,27 @@ function NoiseStream:tick() end end +MIDICCStream = DeriveClass(Stream, function(self, control, channel) + self.control = control + self.channel = channel or 0 +end) + +-- implemented in applause.c, private! +function MIDICCStream.getValue(control, channel) + error("C function not registered!") +end + +-- FIXME: Perhaps implement tick() directly in C? +function MIDICCStream:tick() + local control = self.control + local channel = self.channel + local getValue = self.getValue + + return function() + return getValue(control, channel) + end +end + -- primitives function tostream(v) |