From 7c7e747f79d5073890ce37b761c3945ae97b8f18 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 Jul 2007 02:07:46 +0000 Subject: Fix MIDI control and trigger nodes. git-svn-id: http://svn.drobilla.net/lad/ingen@568 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/InputPort.cpp | 8 ++++++++ src/libs/engine/InputPort.h | 1 + src/libs/engine/MidiControlNode.cpp | 10 ++++++---- src/libs/engine/MidiTriggerNode.cpp | 2 ++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index bdc6162c..349175eb 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -221,6 +221,14 @@ InputPort::set_buffer_size(size_t size) } +void +InputPort::post_process(SampleCount nframes, FrameTime start, FrameTime end) +{ + // Prepare for next cycle + for (size_t i=0; i < _poly; ++i) + _buffers.at(i)->prepare_write(nframes); +} + } // namespace Ingen diff --git a/src/libs/engine/InputPort.h b/src/libs/engine/InputPort.h index 25777ecf..e0367025 100644 --- a/src/libs/engine/InputPort.h +++ b/src/libs/engine/InputPort.h @@ -57,6 +57,7 @@ public: const Connections& connections() { return _connections; } void pre_process(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(SampleCount nframes, FrameTime start, FrameTime end); bool is_connected() const { return (_connections.size() > 0); } bool is_connected_to(const OutputPort* port) const; diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index 05454bdb..cca43549 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -76,15 +76,17 @@ MidiControlNode::process(SampleCount nframes, FrameTime start, FrameTime end) while (midi_in->get_event(×tamp, &size, &buffer) < nframes) { - cerr << "EVENT: "; + printf("EVENT: "); for (size_t i=0; i < size; ++i) - cerr << buffer[i] << " "; - cerr << endl; + printf("%X ", (int)buffer[i]); + printf("\n"); //const FrameTime time = start + (FrameTime)timestamp; if (size >= 3 && (buffer[0] & 0xF0) == MIDI_CMD_CONTROL) control(buffer[1], buffer[2], (SampleCount)timestamp); + + midi_in->increment(); } NodeBase::post_process(nframes, start, end); @@ -132,7 +134,7 @@ MidiControlNode::control(uchar control_num, uchar val, SampleCount offset) } if (control_num == ((AudioBuffer*)_param_port->buffer(0))->value_at(0)) { - ((AudioBuffer*)_control_port->buffer(0))->set(scaled_value, offset); + ((AudioBuffer*)_control_port->buffer(0))->set(scaled_value, 0); ((AudioBuffer*)_audio_port->buffer(0))->set(scaled_value, offset); } } diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index d45cfe85..a0b0c032 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -92,6 +92,8 @@ MidiTriggerNode::process(SampleCount nframes, FrameTime start, FrameTime end) break; } } + + midi_in->increment(); } NodeBase::post_process(nframes, start, end); -- cgit v1.2.1