summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/BufferFactory.cpp3
-rw-r--r--src/server/DirectDriver.hpp6
-rw-r--r--src/server/Driver.hpp3
-rw-r--r--src/server/Engine.cpp6
-rw-r--r--src/server/Engine.hpp2
-rw-r--r--src/server/JackDriver.cpp8
-rw-r--r--src/server/JackDriver.hpp2
-rw-r--r--src/server/ingen_lv2.cpp10
8 files changed, 30 insertions, 10 deletions
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index 88ec195b..c05632e5 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -77,7 +77,6 @@ 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) {
@@ -86,7 +85,7 @@ BufferFactory::default_size(LV2_URID type) const
return sizeof(LV2_Atom_URID);
} else if (type == _uris.atom_Sequence) {
if (_seq_size == 0) {
- return _engine.driver()->block_length() * SEQ_BYTES_PER_FRAME;
+ return _engine.driver()->seq_size();
} else {
return _seq_size;
}
diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp
index ca9c3ae4..812a7e2a 100644
--- a/src/server/DirectDriver.hpp
+++ b/src/server/DirectDriver.hpp
@@ -29,9 +29,10 @@ namespace Server {
*/
class DirectDriver : public Driver {
public:
- DirectDriver(double sample_rate, SampleCount block_length)
+ DirectDriver(double sample_rate, SampleCount block_length, size_t seq_size)
: _sample_rate(sample_rate)
, _block_length(block_length)
+ , _seq_size(seq_size)
{}
virtual ~DirectDriver() {}
@@ -73,6 +74,8 @@ public:
virtual void unregister_port(EnginePort& port) {}
virtual SampleCount block_length() const { return _block_length; }
+
+ virtual size_t seq_size() const { return _seq_size; }
virtual SampleCount sample_rate() const { return _sample_rate; }
@@ -87,6 +90,7 @@ private:
Ports _ports;
SampleCount _sample_rate;
SampleCount _block_length;
+ size_t _seq_size;
};
} // namespace Server
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index 2c9390a9..6d0f8693 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -84,6 +84,9 @@ public:
/** Return the audio buffer size in frames */
virtual SampleCount block_length() const = 0;
+ /** Return the event buffer size in bytes */
+ virtual size_t seq_size() const = 0;
+
/** Return the sample rate in Hz */
virtual SampleCount sample_rate() const = 0;
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index 5fd792bf..2e2d571e 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -215,9 +215,9 @@ execute_and_delete_event(ProcessContext& context, Event* ev)
}
void
-Engine::init(double sample_rate, uint32_t block_length)
+Engine::init(double sample_rate, uint32_t block_length, size_t seq_size)
{
- set_driver(SPtr<Driver>(new DirectDriver(sample_rate, block_length)));
+ set_driver(SPtr<Driver>(new DirectDriver(sample_rate, block_length, seq_size)));
_direct_driver = true;
}
@@ -266,7 +266,7 @@ Engine::activate()
Resource::Property(uris.atom_Sequence)));
control_properties.insert(
make_pair(uris.rsz_minimumSize,
- forge.make(4096)));
+ forge.make(int32_t(driver()->seq_size()))));
// Add control input
Resource::Properties in_properties(control_properties);
diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp
index 1d8b0051..6c932e18 100644
--- a/src/server/Engine.hpp
+++ b/src/server/Engine.hpp
@@ -68,7 +68,7 @@ public:
virtual ~Engine();
// EngineBase methods
- virtual void init(double sample_rate, uint32_t block_length);
+ virtual void init(double sample_rate, uint32_t block_length, size_t seq_size);
virtual bool activate();
virtual void deactivate();
virtual bool pending_events();
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 16c4d507..3452c163 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -59,6 +59,7 @@ JackDriver::JackDriver(Engine& engine)
, _flag(false)
, _client(NULL)
, _block_length(0)
+ , _seq_size(0)
, _sample_rate(0)
, _is_activated(false)
, _old_bpm(120.0f)
@@ -127,8 +128,9 @@ JackDriver::attach(const std::string& server_name,
_client = (jack_client_t*)jack_client;
}
+ _sample_rate = jack_get_sample_rate(_client);
_block_length = jack_get_buffer_size(_client);
- _sample_rate = jack_get_sample_rate(_client);
+ _seq_size = jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE);
jack_on_shutdown(_client, shutdown_cb, this);
@@ -502,9 +504,13 @@ JackDriver::_block_length_cb(jack_nframes_t nframes)
{
if (_engine.root_graph()) {
_block_length = nframes;
+ _seq_size = jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE);
_engine.root_graph()->set_buffer_size(
_engine.process_context(), *_engine.buffer_factory(), PortType::AUDIO,
_engine.buffer_factory()->audio_buffer_size(nframes));
+ _engine.root_graph()->set_buffer_size(
+ _engine.process_context(), *_engine.buffer_factory(), PortType::ATOM,
+ _seq_size);
}
return 0;
}
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index 2fe86387..f3b4d929 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -89,6 +89,7 @@ public:
jack_client_t* jack_client() const { return _client; }
SampleCount block_length() const { return _block_length; }
+ size_t seq_size() const { return _seq_size; }
SampleCount sample_rate() const { return _sample_rate; }
inline SampleCount frame_time() const { return _client ? jack_frame_time(_client) : 0; }
@@ -143,6 +144,7 @@ protected:
std::atomic<bool> _flag;
jack_client_t* _client;
jack_nframes_t _block_length;
+ size_t _seq_size;
jack_nframes_t _sample_rate;
uint32_t _midi_event_type;
bool _is_activated;
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 7238a69c..cf81fd73 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -93,7 +93,10 @@ class LV2Driver : public Ingen::Server::Driver
, public Ingen::AtomSink
{
public:
- LV2Driver(Engine& engine, SampleCount block_length, SampleCount sample_rate)
+ LV2Driver(Engine& engine,
+ SampleCount block_length,
+ size_t seq_size,
+ SampleCount sample_rate)
: _engine(engine)
, _main_sem(0)
, _reader(engine.world()->uri_map(),
@@ -109,6 +112,7 @@ public:
, _root_graph(NULL)
, _notify_capacity(0)
, _block_length(block_length)
+ , _seq_size(seq_size)
, _sample_rate(sample_rate)
, _frame_time(0)
, _to_ui_overflow_sem(0)
@@ -373,6 +377,7 @@ public:
}
virtual SampleCount block_length() const { return _block_length; }
+ virtual size_t seq_size() const { return _seq_size; }
virtual SampleCount sample_rate() const { return _sample_rate; }
virtual SampleCount frame_time() const { return _frame_time; }
@@ -394,6 +399,7 @@ private:
GraphImpl* _root_graph;
uint32_t _notify_capacity;
SampleCount _block_length;
+ size_t _seq_size;
SampleCount _sample_rate;
SampleCount _frame_time;
Raul::Semaphore _to_ui_overflow_sem;
@@ -579,7 +585,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
Server::ThreadManager::set_flag(Server::THREAD_PRE_PROCESS);
Server::ThreadManager::single_threaded = true;
- LV2Driver* driver = new LV2Driver(*engine.get(), block_length, rate);
+ LV2Driver* driver = new LV2Driver(*engine.get(), block_length, seq_size, rate);
engine->set_driver(SPtr<Ingen::Server::Driver>(driver));
engine->activate();