summaryrefslogtreecommitdiffstats
path: root/src/engine/MidiTriggerNode.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-28 01:26:54 +0000
committerDavid Robillard <d@drobilla.net>2008-11-28 01:26:54 +0000
commit0bf73b59335d917400c18ae9d664226c1a4da4c2 (patch)
tree5403e1c54de2e1e9e8e4aaedd1a69d674f8c4963 /src/engine/MidiTriggerNode.cpp
parent6bf8ac34199f1c3e8d57a43bf1ed7025ce0cc3f9 (diff)
downloadingen-0bf73b59335d917400c18ae9d664226c1a4da4c2.tar.gz
ingen-0bf73b59335d917400c18ae9d664226c1a4da4c2.tar.bz2
ingen-0bf73b59335d917400c18ae9d664226c1a4da4c2.zip
MIDI learn for note trigger node.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1812 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/MidiTriggerNode.cpp')
-rw-r--r--src/engine/MidiTriggerNode.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/engine/MidiTriggerNode.cpp b/src/engine/MidiTriggerNode.cpp
index c68a0b96..0212154a 100644
--- a/src/engine/MidiTriggerNode.cpp
+++ b/src/engine/MidiTriggerNode.cpp
@@ -34,6 +34,7 @@ namespace Ingen {
MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, PatchImpl* parent, SampleRate srate, size_t buffer_size)
: NodeBase(new InternalPlugin(NS_INGEN "trigger_node", "trigger", "Trigger"),
path, false, parent, srate, buffer_size)
+ , _learning(false)
{
_ports = new Raul::Array<PortImpl*>(5);
@@ -106,6 +107,14 @@ MidiTriggerNode::note_on(ProcessContext& context, uchar note_num, uchar velocity
{
assert(time >= context.start() && time <= context.end());
assert(time - context.start() < _buffer_size);
+
+ if (_learning) {
+ _note_port->set_value(note_num);
+ ((AudioBuffer*)_note_port->buffer(0))->set_value(
+ (float)note_num, context.start(), context.end());
+ _note_port->broadcast_value(context, true);
+ _learning = false;
+ }
/*cerr << "[MidiTriggerNode] " << path() << " Note " << (int)note_num << " on @ " << time << endl;*/