diff options
author | David Robillard <d@drobilla.net> | 2007-09-23 02:03:41 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-23 02:03:41 +0000 |
commit | d1ba04724f0bfbed18690316dbe5eb977a131733 (patch) | |
tree | 76ce5146a916ff4a497f88a7c4c3e99c64f4fca6 /src/libs/engine/events | |
parent | c1160ffc8a5dfb38891b0faa6373c9eecdd8e4c9 (diff) | |
download | ingen-d1ba04724f0bfbed18690316dbe5eb977a131733.tar.gz ingen-d1ba04724f0bfbed18690316dbe5eb977a131733.tar.bz2 ingen-d1ba04724f0bfbed18690316dbe5eb977a131733.zip |
Working LV2 UI control setting (including MIDI).
Klaviatur (ll-plugins virtual keyboard) is now fully functional inside Ingen.
git-svn-id: http://svn.drobilla.net/lad/ingen@766 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r-- | src/libs/engine/events/SetPortValueEvent.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/events/SetPortValueQueuedEvent.cpp | 29 |
2 files changed, 23 insertions, 10 deletions
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index fa2238e2..9d1ad0db 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -95,7 +95,7 @@ SetPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) Buffer* const buf = _port->buffer(0); AudioBuffer* const abuf = dynamic_cast<AudioBuffer*>(buf); if (abuf) { - const size_t offset = (buf->size() == 1) ? 0 : _time - start; + const uint32_t offset = (buf->size() == 1) ? 0 : _time - start; if (_omni) for (uint32_t i=0; i < _port->poly(); ++i) @@ -108,7 +108,7 @@ SetPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) MidiBuffer* const mbuf = dynamic_cast<MidiBuffer*>(buf); if (mbuf) { - const double stamp = std::max((double)_time, mbuf->latest_stamp()); + const double stamp = std::max((double)(_time - start), mbuf->latest_stamp()); mbuf->append(stamp, _data_size, (const unsigned char*)_data); } } diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index 8940d4c5..d0bfff4a 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -25,6 +25,7 @@ #include "Node.hpp" #include "ObjectStore.hpp" #include "AudioBuffer.hpp" +#include "MidiBuffer.hpp" namespace Ingen { @@ -94,14 +95,26 @@ SetPortValueQueuedEvent::execute(SampleCount nframes, FrameTime start, FrameTime if (_error == NO_ERROR) { assert(_port); - AudioBuffer* const buf = (AudioBuffer*)_port->buffer(0); - const size_t offset = (buf->size() == 1) ? 0 : _time - start; - - if (_omni) - for (uint32_t i=0; i < _port->poly(); ++i) - ((AudioBuffer*)_port->buffer(i))->set(*(float*)_data, offset); - else - ((AudioBuffer*)_port->buffer(_voice_num))->set(*(float*)_data, offset); + + Buffer* const buf = _port->buffer(0); + AudioBuffer* const abuf = dynamic_cast<AudioBuffer*>(buf); + if (abuf) { + const uint32_t offset = (buf->size() == 1) ? 0 : _time - start; + + if (_omni) + for (uint32_t i=0; i < _port->poly(); ++i) + ((AudioBuffer*)_port->buffer(i))->set(*(float*)_data, offset); + else + ((AudioBuffer*)_port->buffer(_voice_num))->set(*(float*)_data, offset); + + return; + } + + MidiBuffer* const mbuf = dynamic_cast<MidiBuffer*>(buf); + if (mbuf) { + const double stamp = std::max((double)(_time - start), mbuf->latest_stamp()); + mbuf->append(stamp, _data_size, (const unsigned char*)_data); + } } } |