diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/BufferFactory.cpp | 10 | ||||
-rw-r--r-- | src/server/BufferFactory.hpp | 2 | ||||
-rw-r--r-- | src/server/ingen_lv2.cpp | 19 |
3 files changed, 21 insertions, 10 deletions
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index 720a4639..ccb3170d 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -24,11 +24,10 @@ namespace Ingen { namespace Server { -static const size_t EVENT_BYTES_PER_FRAME = 4; // FIXME - BufferFactory::BufferFactory(Engine& engine, URIs& uris) : _engine(engine) , _uris(uris) + , _seq_size(0) , _silent_buffer(NULL) { } @@ -72,12 +71,17 @@ BufferFactory::audio_buffer_size(SampleCount nframes) uint32_t BufferFactory::default_size(LV2_URID type) const { + static const uint32_t SEQ_BYTES_PER_FRAME = 4; if (type == _uris.atom_Float) { return sizeof(LV2_Atom_Float); } else if (type == _uris.atom_Sound) { return audio_buffer_size(_engine.driver()->block_length()); } else if (type == _uris.atom_Sequence) { - return _engine.driver()->block_length() * EVENT_BYTES_PER_FRAME; + if (_seq_size == 0) { + return _engine.driver()->block_length() * SEQ_BYTES_PER_FRAME; + } else { + return _seq_size; + } } else { return 0; } diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp index 11d31b2d..643c5d97 100644 --- a/src/server/BufferFactory.hpp +++ b/src/server/BufferFactory.hpp @@ -59,6 +59,7 @@ public: BufferRef silent_buffer(); void set_block_length(SampleCount block_length); + void set_seq_size(uint32_t seq_size); Forge& forge(); URIs& uris() { return _uris; } @@ -89,6 +90,7 @@ private: Glib::Mutex _mutex; Engine& _engine; URIs& _uris; + uint32_t _seq_size; BufferRef _silent_buffer; }; diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index ccbeb7d4..7da7f476 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -494,23 +494,28 @@ ingen_instantiate(const LV2_Descriptor* descriptor, } } + plugin->world = new Ingen::World( + plugin->argc, plugin->argv, plugin->map, unmap); + if (!plugin->world->load_module("serialisation")) { + delete plugin->world; + return NULL; + } + uint32_t block_length = 4096; + uint32_t seq_size = 0; if (access) { uint32_t min, multiple_of, power_of; access->get_sample_count( access->handle, &min, &block_length, &multiple_of, &power_of); + access->get_buf_size( + access->handle, &seq_size, + plugin->world->uris().atom_Sequence, block_length); Raul::info(Raul::fmt("Block length: %1% frames\n") % block_length); + Raul::info(Raul::fmt("Sequence size: %1% bytes\n") % seq_size); } else { Raul::warn("Warning: No buffer size access, guessing 4096 frames.\n"); } - plugin->world = new Ingen::World( - plugin->argc, plugin->argv, plugin->map, unmap); - if (!plugin->world->load_module("serialisation")) { - delete plugin->world; - return NULL; - } - SharedPtr<Server::Engine> engine(new Server::Engine(plugin->world)); plugin->world->set_engine(engine); |