diff options
author | David Robillard <d@drobilla.net> | 2007-07-04 02:07:46 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-04 02:07:46 +0000 |
commit | 7c7e747f79d5073890ce37b761c3945ae97b8f18 (patch) | |
tree | f44d17ecf041144d2fd995d4ba35e2d04ba70363 /src/libs | |
parent | b7c5e24f4a10558942cde30c3cc4eb995846df3d (diff) | |
download | ingen-7c7e747f79d5073890ce37b761c3945ae97b8f18.tar.gz ingen-7c7e747f79d5073890ce37b761c3945ae97b8f18.tar.bz2 ingen-7c7e747f79d5073890ce37b761c3945ae97b8f18.zip |
Fix MIDI control and trigger nodes.
git-svn-id: http://svn.drobilla.net/lad/ingen@568 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/engine/InputPort.cpp | 8 | ||||
-rw-r--r-- | src/libs/engine/InputPort.h | 1 | ||||
-rw-r--r-- | src/libs/engine/MidiControlNode.cpp | 10 | ||||
-rw-r--r-- | 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); |