diff options
author | David Robillard <d@drobilla.net> | 2012-07-25 23:13:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-25 23:13:09 +0000 |
commit | 59d70a37ca7a6c1601f437f7a9f99d77399c8d7d (patch) | |
tree | 7632e62be9fe5c0390fcd7162c0014dee7c1023a /src | |
parent | 8d02ef7f4f1b938881ec3e78bcc9d79d569d53ec (diff) | |
download | ingen-59d70a37ca7a6c1601f437f7a9f99d77399c8d7d.tar.gz ingen-59d70a37ca7a6c1601f437f7a9f99d77399c8d7d.tar.bz2 ingen-59d70a37ca7a6c1601f437f7a9f99d77399c8d7d.zip |
Remove unnecessary NodeImpl::_srate field.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4552 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/server/LV2Node.cpp | 14 | ||||
-rw-r--r-- | src/server/LV2Node.hpp | 6 | ||||
-rw-r--r-- | src/server/NodeImpl.cpp | 1 | ||||
-rw-r--r-- | src/server/NodeImpl.hpp | 8 | ||||
-rw-r--r-- | src/server/internals/Delay.cpp | 8 |
5 files changed, 22 insertions, 15 deletions
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index 23e64df6..3d1e4a52 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -31,6 +31,7 @@ #include "ingen/shared/URIs.hpp" #include "AudioBuffer.hpp" +#include "Driver.hpp" #include "Engine.hpp" #include "InputPort.hpp" #include "LV2Node.hpp" @@ -68,10 +69,13 @@ LV2Node::~LV2Node() } SharedPtr<LilvInstance> -LV2Node::make_instance(Shared::URIs& uris, uint32_t voice, bool preparing) +LV2Node::make_instance(Shared::URIs& uris, + SampleRate rate, + uint32_t voice, + bool preparing) { LilvInstance* inst = lilv_plugin_instantiate( - _lv2_plugin->lilv_plugin(), _srate, _features->array()); + _lv2_plugin->lilv_plugin(), rate, _features->array()); if (!inst) { Raul::error(Raul::fmt("Failed to instantiate <%1%>\n") @@ -142,10 +146,11 @@ LV2Node::prepare_poly(BufferFactory& bufs, uint32_t poly) if (_polyphony == poly) return true; + const SampleRate rate = bufs.engine().driver()->sample_rate(); assert(!_prepared_instances); _prepared_instances = new Instances(poly, *_instances, SharedPtr<void>()); for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) { - SharedPtr<LilvInstance> inst = make_instance(bufs.uris(), i, true); + SharedPtr<LilvInstance> inst = make_instance(bufs.uris(), rate, i, true); if (!inst) { return false; } @@ -370,9 +375,10 @@ LV2Node::instantiate(BufferFactory& bufs) _features = info->world().lv2_features().lv2_features(&info->world(), this); // Actually create plugin instances and port buffers. + const SampleRate rate = bufs.engine().driver()->sample_rate(); _instances = new Instances(_polyphony, SharedPtr<void>()); for (uint32_t i = 0; i < _polyphony; ++i) { - _instances->at(i) = make_instance(bufs.uris(), i, false); + _instances->at(i) = make_instance(bufs.uris(), rate, i, false); if (!_instances->at(i)) { return false; } diff --git a/src/server/LV2Node.hpp b/src/server/LV2Node.hpp index b588de78..60d412c8 100644 --- a/src/server/LV2Node.hpp +++ b/src/server/LV2Node.hpp @@ -65,8 +65,10 @@ public: SampleCount offset); protected: - SharedPtr<LilvInstance> make_instance( - Shared::URIs& uris, uint32_t voice, bool preparing); + SharedPtr<LilvInstance> make_instance(Shared::URIs& uris, + SampleRate rate, + uint32_t voice, + bool preparing); inline LilvInstance* instance(uint32_t voice) { return (LilvInstance*)(*_instances)[voice].get(); diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp index b6b3b564..39affd63 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -43,7 +43,6 @@ NodeImpl::NodeImpl(PluginImpl* plugin, , _ports(NULL) , _context(Context::AUDIO) , _polyphony((polyphonic && parent) ? parent->internal_poly() : 1) - , _srate(srate) , _input_ready(1) , _process_lock(0) , _n_inputs_ready(0) diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index f97c6d90..995450f3 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -183,10 +183,9 @@ public: /** The Patch this Node belongs to. */ inline PatchImpl* parent_patch() const { return (PatchImpl*)_parent; } - Context::ID context() const { return _context; } - SampleRate sample_rate() const { return _srate; } - uint32_t num_ports() const { return _ports ? _ports->size() : 0; } - virtual uint32_t polyphony() const { return _polyphony; } + Context::ID context() const { return _context; } + uint32_t num_ports() const { return _ports ? _ports->size() : 0; } + virtual uint32_t polyphony() const { return _polyphony; } /** Used by the process order finding algorithm (ie during connections) */ bool traversed() const { return _traversed; } @@ -197,7 +196,6 @@ protected: Raul::Array<PortImpl*>* _ports; ///< Access in audio thread only Context::ID _context; ///< Context this node runs in uint32_t _polyphony; - SampleRate _srate; Raul::Semaphore _input_ready; ///< Parallelism: input ready signal Raul::AtomicInt _process_lock; ///< Parallelism: Waiting on inputs 'lock' Raul::AtomicInt _n_inputs_ready; ///< Parallelism: # input ready signals this cycle diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index f825ffa5..d7cbcfb9 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -25,14 +25,15 @@ #include "raul/log.hpp" #include "raul/midi_events.h" -#include "internals/Delay.hpp" #include "AudioBuffer.hpp" #include "Driver.hpp" +#include "Engine.hpp" #include "InputPort.hpp" #include "InternalPlugin.hpp" #include "OutputPort.hpp" #include "PatchImpl.hpp" #include "ProcessContext.hpp" +#include "internals/Delay.hpp" #include "util.hpp" #define LOG(s) s << "[DelayNode] " @@ -104,7 +105,8 @@ void DelayNode::activate(BufferFactory& bufs) { NodeImpl::activate(bufs); - const SampleCount min_size = MAX_DELAY_SECONDS * _srate; + const SampleRate rate = bufs.engine().driver()->sample_rate(); + const SampleCount min_size = MAX_DELAY_SECONDS * rate; // Smallest power of two larger than min_size SampleCount size = 1; @@ -154,7 +156,7 @@ DelayNode::process(ProcessContext& context) float* const out = out_buf->data(); const float delay_time = delay_buf->data()[0]; const uint32_t buffer_mask = plugin_data->_buffer_mask; - const unsigned int sample_rate = plugin_data->_srate; + const SampleRate sample_rate = context.engine().driver()->sample_rate(); float delay_samples = plugin_data->_delay_samples; int64_t write_phase = plugin_data->_write_phase; const uint32_t sample_count = context.nframes(); |