summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-02-17 19:23:12 +0100
committerDavid Robillard <d@drobilla.net>2017-02-18 19:38:13 +0100
commit2754f232613dca72c2f964d092569faf1a176c80 (patch)
tree6a8966ca56acd74a42c691be5d900d221ceb348d /src
parentfa6bb9afe8fcf2b0b8348495b9c4e1d6425136f0 (diff)
downloadingen-2754f232613dca72c2f964d092569faf1a176c80.tar.gz
ingen-2754f232613dca72c2f964d092569faf1a176c80.tar.bz2
ingen-2754f232613dca72c2f964d092569faf1a176c80.zip
Reduce Driver coupling
Diffstat (limited to 'src')
-rw-r--r--src/server/BufferFactory.cpp7
-rw-r--r--src/server/ControlBindings.cpp5
-rw-r--r--src/server/Driver.hpp2
-rw-r--r--src/server/Engine.cpp22
-rw-r--r--src/server/Engine.hpp10
-rw-r--r--src/server/GraphImpl.cpp3
-rw-r--r--src/server/InternalPlugin.cpp3
-rw-r--r--src/server/LV2Block.cpp7
-rw-r--r--src/server/LV2Plugin.cpp3
-rw-r--r--src/server/PortImpl.cpp7
-rw-r--r--src/server/RunContext.cpp1
-rw-r--r--src/server/Worker.cpp1
-rw-r--r--src/server/events/Copy.cpp1
-rw-r--r--src/server/events/CreateBlock.cpp1
-rw-r--r--src/server/events/CreateGraph.cpp3
-rw-r--r--src/server/events/Get.cpp5
-rw-r--r--src/server/events/SetPortValue.cpp1
-rw-r--r--src/server/internals/Note.cpp1
18 files changed, 45 insertions, 38 deletions
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp
index fea74eca..1dadd520 100644
--- a/src/server/BufferFactory.cpp
+++ b/src/server/BufferFactory.cpp
@@ -19,7 +19,6 @@
#include "Buffer.hpp"
#include "BufferFactory.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
namespace Ingen {
@@ -83,7 +82,7 @@ BufferFactory::audio_buffer_size(SampleCount nframes)
uint32_t
BufferFactory::audio_buffer_size() const
{
- return _engine.driver()->block_length() * sizeof(Sample);
+ return _engine.block_length() * sizeof(Sample);
}
uint32_t
@@ -92,12 +91,12 @@ BufferFactory::default_size(LV2_URID type) const
if (type == _uris.atom_Float) {
return sizeof(LV2_Atom_Float);
} else if (type == _uris.atom_Sound) {
- return audio_buffer_size(_engine.driver()->block_length());
+ return audio_buffer_size(_engine.block_length());
} else if (type == _uris.atom_URID) {
return sizeof(LV2_Atom_URID);
} else if (type == _uris.atom_Sequence) {
if (_seq_size == 0) {
- return _engine.driver()->seq_size();
+ return _engine.sequence_size();
} else {
return _seq_size;
}
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 6ae4f856..57d037c3 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -25,7 +25,6 @@
#include "Buffer.hpp"
#include "ControlBindings.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "PortImpl.hpp"
#include "RunContext.hpp"
@@ -210,8 +209,8 @@ get_range(RunContext& context, const PortImpl* port, float* min, float* max)
*min = port->minimum().get<float>();
*max = port->maximum().get<float>();
if (port->is_sample_rate()) {
- *min *= context.engine().driver()->sample_rate();
- *max *= context.engine().driver()->sample_rate();
+ *min *= context.engine().sample_rate();
+ *max *= context.engine().sample_rate();
}
}
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index 5a8fbed0..3e1a724f 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -88,7 +88,7 @@ public:
virtual size_t seq_size() const = 0;
/** Return the sample rate in Hz */
- virtual SampleCount sample_rate() const = 0;
+ virtual SampleRate sample_rate() const = 0;
/** Return the current frame time (running counter) */
virtual SampleCount frame_time() const = 0;
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index 794088bc..a460ac48 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -271,6 +271,24 @@ Engine::store() const
return _world->store();
}
+SampleRate
+Engine::sample_rate() const
+{
+ return _driver->sample_rate();
+}
+
+SampleCount
+Engine::block_length() const
+{
+ return _driver->block_length();
+}
+
+size_t
+Engine::sequence_size() const
+{
+ return _driver->seq_size();
+}
+
size_t
Engine::event_queue_size() const
{
@@ -366,8 +384,8 @@ Engine::activate()
ThreadManager::single_threaded = true;
_buffer_factory->set_block_length(_driver->block_length());
- _options->set(driver()->sample_rate(),
- driver()->block_length(),
+ _options->set(sample_rate(),
+ block_length(),
buffer_factory()->default_size(_world->uris().atom_Sequence));
const Ingen::URIs& uris = world()->uris();
diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp
index 6e8e74c9..de14b024 100644
--- a/src/server/Engine.hpp
+++ b/src/server/Engine.hpp
@@ -150,9 +150,13 @@ public:
SPtr<Store> store() const;
- size_t event_queue_size() const;
- size_t n_threads() const { return _run_contexts.size(); }
- bool atomic_bundles() const { return _atomic_bundles; }
+ SampleRate sample_rate() const;
+ SampleCount block_length() const;
+ size_t sequence_size() const;
+ size_t event_queue_size() const;
+
+ size_t n_threads() const { return _run_contexts.size(); }
+ bool atomic_bundles() const { return _atomic_bundles; }
private:
Ingen::World* _world;
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index 6b1d0464..1311755d 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -25,7 +25,6 @@
#include "ArcImpl.hpp"
#include "BlockImpl.hpp"
#include "BufferFactory.hpp"
-#include "Driver.hpp"
#include "DuplexPort.hpp"
#include "Engine.hpp"
#include "GraphImpl.hpp"
@@ -69,7 +68,7 @@ GraphImpl::duplicate(Engine& engine,
GraphImpl* parent)
{
BufferFactory& bufs = *engine.buffer_factory();
- const SampleRate rate = engine.driver()->sample_rate();
+ const SampleRate rate = engine.sample_rate();
// Duplicate graph
GraphImpl* dup = new GraphImpl(
diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp
index 1d397f14..3342ef84 100644
--- a/src/server/InternalPlugin.cpp
+++ b/src/server/InternalPlugin.cpp
@@ -21,7 +21,6 @@
#include "internals/Time.hpp"
#include "internals/Trigger.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "InternalPlugin.hpp"
@@ -49,7 +48,7 @@ InternalPlugin::instantiate(BufferFactory& bufs,
Engine& engine,
const LilvState* state)
{
- const SampleCount srate = engine.driver()->sample_rate();
+ const SampleCount srate = engine.sample_rate();
if (uri() == NS_INTERNALS "BlockDelay") {
return new BlockDelayNode(this, bufs, symbol, polyphonic, parent, srate);
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index ab2582d1..82e5f229 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -36,7 +36,6 @@
#include "ingen/URIs.hpp"
#include "Buffer.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "InputPort.hpp"
@@ -170,7 +169,7 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly)
if (_polyphony == poly)
return true;
- const SampleRate rate = bufs.engine().driver()->sample_rate();
+ const SampleRate rate = bufs.engine().sample_rate();
assert(!_prepared_instances);
_prepared_instances = bufs.maid().make_managed<Instances>(
poly, *_instances, SPtr<Instance>());
@@ -421,7 +420,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
_features = world->lv2_features().lv2_features(world, this);
// Actually create plugin instances and port buffers.
- const SampleRate rate = bufs.engine().driver()->sample_rate();
+ const SampleRate rate = bufs.engine().sample_rate();
_instances = bufs.maid().make_managed<Instances>(
_polyphony, SPtr<Instance>());
for (uint32_t i = 0; i < _polyphony; ++i) {
@@ -493,7 +492,7 @@ LV2Block::duplicate(Engine& engine,
const Raul::Symbol& symbol,
GraphImpl* parent)
{
- const SampleRate rate = engine.driver()->sample_rate();
+ const SampleRate rate = engine.sample_rate();
// Get current state
LilvState* state = lilv_state_new_from_instance(
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 8e820b8e..667190ae 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -20,7 +20,6 @@
#include "ingen/URIs.hpp"
#include "lv2/lv2plug.in/ns/ext/presets/presets.h"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "LV2Block.hpp"
#include "LV2Plugin.hpp"
@@ -94,7 +93,7 @@ LV2Plugin::instantiate(BufferFactory& bufs,
const LilvState* state)
{
LV2Block* b = new LV2Block(
- this, symbol, polyphonic, parent, engine.driver()->sample_rate());
+ this, symbol, polyphonic, parent, engine.sample_rate());
if (!b->instantiate(bufs, state)) {
delete b;
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 19f71953..1db98840 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -23,7 +23,6 @@
#include "Buffer.hpp"
#include "BufferFactory.hpp"
#include "Engine.hpp"
-#include "Driver.hpp"
#include "PortImpl.hpp"
#include "PortType.hpp"
#include "ThreadManager.hpp"
@@ -39,8 +38,8 @@ static const uint32_t monitor_rate = 25.0; // Hz
static inline uint32_t
monitor_period(const Engine& engine)
{
- return std::max(engine.driver()->block_length(),
- engine.driver()->sample_rate() / monitor_rate);
+ return std::max(engine.block_length(),
+ engine.sample_rate() / monitor_rate);
}
PortImpl::PortImpl(BufferFactory& bufs,
@@ -183,7 +182,7 @@ PortImpl::activate(BufferFactory& bufs)
monitor period, to spread the load out over time. Otherwise, every
port would try to send an update at exactly the same time, every time.
*/
- const double srate = bufs.engine().driver()->sample_rate();
+ const double srate = bufs.engine().sample_rate();
const uint32_t period = srate / monitor_rate;
_frames_since_monitor = bufs.engine().frand() * period;
_monitor_value = 0.0f;
diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp
index 81b59552..cebfdcfe 100644
--- a/src/server/RunContext.cpp
+++ b/src/server/RunContext.cpp
@@ -20,7 +20,6 @@
#include "Broadcaster.hpp"
#include "BufferFactory.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "PortImpl.hpp"
#include "RunContext.hpp"
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 1ff7a89c..51b37797 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -18,7 +18,6 @@
#include "ingen/Log.hpp"
#include "lv2/lv2plug.in/ns/ext/worker/worker.h"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "LV2Block.hpp"
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index 1f7ca708..53f62958 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -21,7 +21,6 @@
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "EnginePort.hpp"
#include "GraphImpl.hpp"
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index 0b4cbae3..eb696c6b 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -23,7 +23,6 @@
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
#include "CreateBlock.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "PluginImpl.hpp"
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp
index 891ca33c..304656af 100644
--- a/src/server/events/CreateGraph.cpp
+++ b/src/server/events/CreateGraph.cpp
@@ -20,7 +20,6 @@
#include "raul/Path.hpp"
#include "Broadcaster.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "PreProcessContext.hpp"
@@ -155,7 +154,7 @@ CreateGraph::pre_process(PreProcessContext& ctx)
} else {
// Create a new graph
_graph = new GraphImpl(_engine, symbol, ext_poly, _parent,
- _engine.driver()->sample_rate(), int_poly);
+ _engine.sample_rate(), int_poly);
_graph->add_property(uris.rdf_type, uris.ingen_Graph.urid);
_graph->add_property(uris.rdf_type,
Property(uris.ingen_Block,
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index baa9b16e..5988f0e0 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -23,7 +23,6 @@
#include "BlockImpl.hpp"
#include "Broadcaster.hpp"
#include "BufferFactory.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "Get.hpp"
#include "GraphImpl.hpp"
@@ -93,9 +92,9 @@ Get::post_process()
_request_client->put(
Raul::URI("ingen:/engine"),
{ { uris.param_sampleRate,
- uris.forge.make(int32_t(_engine.driver()->sample_rate())) },
+ uris.forge.make(int32_t(_engine.sample_rate())) },
{ uris.bufsz_maxBlockLength,
- uris.forge.make(int32_t(_engine.driver()->block_length())) },
+ uris.forge.make(int32_t(_engine.block_length())) },
{ uris.ingen_numThreads,
uris.forge.make(int32_t(_engine.n_threads())) } });
} else {
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index ff0827e4..b8c23605 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -23,7 +23,6 @@
#include "Broadcaster.hpp"
#include "Buffer.hpp"
#include "ControlBindings.hpp"
-#include "Driver.hpp"
#include "Engine.hpp"
#include "PortImpl.hpp"
#include "RunContext.hpp"
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index cc592794..021967e9 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -23,7 +23,6 @@
#include "raul/Maid.hpp"
#include "Buffer.hpp"
-#include "Driver.hpp"
#include "GraphImpl.hpp"
#include "InputPort.hpp"
#include "InternalPlugin.hpp"