diff options
author | David Robillard <d@drobilla.net> | 2007-09-19 06:29:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-19 06:29:58 +0000 |
commit | cfbcb812e96b740e16510bf736cef688d8ebe986 (patch) | |
tree | 8fb96f95c1adb87116bfcd6439897e6970948456 /src/libs | |
parent | 36b22fe2bea643d7d4ff69764016ae5be9c6de69 (diff) | |
download | ingen-cfbcb812e96b740e16510bf736cef688d8ebe986.tar.gz ingen-cfbcb812e96b740e16510bf736cef688d8ebe986.tar.bz2 ingen-cfbcb812e96b740e16510bf736cef688d8ebe986.zip |
Fix LV2 dynamic poly crash.
Update client-side patch model on polyphony change.
git-svn-id: http://svn.drobilla.net/lad/ingen@726 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/client/Store.cpp | 10 | ||||
-rw-r--r-- | src/libs/client/Store.hpp | 1 | ||||
-rw-r--r-- | src/libs/engine/AudioBuffer.hpp | 3 | ||||
-rw-r--r-- | src/libs/engine/Buffer.hpp | 2 | ||||
-rw-r--r-- | src/libs/engine/LV2Node.cpp | 10 | ||||
-rw-r--r-- | src/libs/engine/MidiBuffer.hpp | 3 | ||||
-rw-r--r-- | src/libs/engine/OSCBuffer.hpp | 2 |
7 files changed, 29 insertions, 2 deletions
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 75eb943b..84528d00 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -44,6 +44,7 @@ Store::Store(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> em emitter->new_port_sig.connect(sigc::mem_fun(this, &Store::new_port_event)); emitter->patch_enabled_sig.connect(sigc::mem_fun(this, &Store::patch_enabled_event)); emitter->patch_disabled_sig.connect(sigc::mem_fun(this, &Store::patch_disabled_event)); + emitter->patch_polyphony_sig.connect(sigc::mem_fun(this, &Store::patch_polyphony_event)); emitter->patch_cleared_sig.connect(sigc::mem_fun(this, &Store::patch_cleared_event)); emitter->connection_sig.connect(sigc::mem_fun(this, &Store::connection_event)); emitter->disconnection_sig.connect(sigc::mem_fun(this, &Store::disconnection_event)); @@ -451,6 +452,15 @@ Store::patch_disabled_event(const Path& path) patch->disable(); } + +void +Store::patch_polyphony_event(const Path& path, uint32_t poly) +{ + SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(path)); + if (patch) + patch->poly(poly); +} + void Store::patch_cleared_event(const Path& path) diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp index 25398eaa..e5309484 100644 --- a/src/libs/client/Store.hpp +++ b/src/libs/client/Store.hpp @@ -99,6 +99,7 @@ private: void new_port_event(const Path& path, const string& data_type, bool is_output); void patch_enabled_event(const Path& path); void patch_disabled_event(const Path& path); + void patch_polyphony_event(const Path& path, uint32_t poly); void patch_cleared_event(const Path& path); void metadata_update_event(const Path& subject_path, const string& predicate, const Atom& value); void control_change_event(const Path& port_path, float value); diff --git a/src/libs/engine/AudioBuffer.hpp b/src/libs/engine/AudioBuffer.hpp index d0379895..de9fc4a6 100644 --- a/src/libs/engine/AudioBuffer.hpp +++ b/src/libs/engine/AudioBuffer.hpp @@ -46,6 +46,9 @@ public: /** For driver use only!! */ void set_data(Sample* data); + inline void* raw_data() const + { return ((_joined_buf != NULL) ? _joined_buf->raw_data() : _data); } + inline Sample* data() const { return ((_joined_buf != NULL) ? _joined_buf->data() : _data); } diff --git a/src/libs/engine/Buffer.hpp b/src/libs/engine/Buffer.hpp index bdca2c07..4a79c482 100644 --- a/src/libs/engine/Buffer.hpp +++ b/src/libs/engine/Buffer.hpp @@ -39,6 +39,8 @@ public: /** Clear contents and reset state */ virtual void clear() = 0; + + virtual void* raw_data() const = 0; /** Rewing (ie reset read pointer), but leave contents unchanged */ virtual void rewind() const = 0; diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 8ecd00b7..7e56c64d 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -61,7 +61,7 @@ LV2Node::prepare_poly(uint32_t poly) _prepared_poly = poly; _prepared_instances = new Raul::Array<SLV2Instance>(_prepared_poly, *_instances); - for (uint32_t i=_poly; i < _prepared_poly; ++i) { + for (uint32_t i = _poly; i < _prepared_poly; ++i) { _prepared_instances->at(i) = slv2_plugin_instantiate(_lv2_plugin, _srate, NULL); if ((*_prepared_instances)[i] == NULL) { cerr << "Failed to instantiate plugin!" << endl; @@ -82,9 +82,15 @@ LV2Node::apply_poly(Raul::Maid& maid, uint32_t poly) assert(poly <= _prepared_poly); NodeBase::apply_poly(maid, poly); - + maid.push(_instances); _instances = _prepared_instances; + + for (uint32_t port=0; port < num_ports(); ++port) + for (uint32_t voice = _poly; voice < _prepared_poly; ++voice) + slv2_instance_connect_port((*_instances)[voice], port, + _ports->at(port)->buffer(voice)->raw_data()); + _poly = poly; _prepared_instances = NULL; diff --git a/src/libs/engine/MidiBuffer.hpp b/src/libs/engine/MidiBuffer.hpp index 87504833..15548625 100644 --- a/src/libs/engine/MidiBuffer.hpp +++ b/src/libs/engine/MidiBuffer.hpp @@ -42,6 +42,9 @@ public: uint32_t event_count() const { return _buf->event_count; } inline LV2_MIDI* local_data() { return _local_buf; } + + inline void* raw_data() const + { return ((_joined_buf != NULL) ? _joined_buf->raw_data() : _buf); } inline LV2_MIDI* data() { return ((_joined_buf != NULL) ? _joined_buf->data() : _buf); } diff --git a/src/libs/engine/OSCBuffer.hpp b/src/libs/engine/OSCBuffer.hpp index 7e1bc451..1d3758e5 100644 --- a/src/libs/engine/OSCBuffer.hpp +++ b/src/libs/engine/OSCBuffer.hpp @@ -37,6 +37,8 @@ public: void prepare_read(SampleCount nframes); void prepare_write(SampleCount nframes); + + void* raw_data() const { return _buf; } bool is_joined_to(Buffer* buf) const; bool join(Buffer* buf); |