diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Buffer.cpp | 9 | ||||
-rw-r--r-- | src/server/Buffer.hpp | 3 | ||||
-rw-r--r-- | src/server/LV2Node.cpp | 2 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 8 | ||||
-rw-r--r-- | src/server/events/Disconnect.cpp | 2 |
5 files changed, 11 insertions, 13 deletions
diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 4de832e9..b10ccfc6 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -104,7 +104,7 @@ Buffer::clear() { if (is_audio() || is_control()) { _atom->size = _capacity - sizeof(LV2_Atom); - set_block(0, 0, nframes() - 1); + set_block(0, 0, nframes()); } else if (is_sequence()) { _atom->size = sizeof(LV2_Atom_Sequence_Body); } @@ -125,13 +125,12 @@ Buffer::copy(Context& context, const Buffer* src) } void -Buffer::set_block(Sample val, size_t start_offset, size_t end_offset) +Buffer::set_block(Sample val, const SampleCount start, const SampleCount end) { - assert(end_offset >= start_offset); - assert(end_offset < nframes()); + assert(end <= nframes()); Sample* const buf = samples(); - for (size_t i = start_offset; i <= end_offset; ++i) { + for (SampleCount i = start; i < end; ++i) { buf[i] = val; } } diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index cb07b09e..329abb12 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -18,7 +18,6 @@ #define INGEN_ENGINE_BUFFER_HPP #include <cassert> -#include <cstddef> #include <boost/utility.hpp> @@ -50,7 +49,7 @@ public: virtual void clear(); virtual void resize(uint32_t size); virtual void copy(Context& context, const Buffer* src); - virtual void set_block(Sample val, size_t start_offset, size_t end_offset); + virtual void set_block(Sample val, SampleCount start, SampleCount end); virtual void prepare_write(Context& context); void* port_data(PortType port_type, SampleCount offset); diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index b3e65555..4ed6c05a 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -100,7 +100,7 @@ LV2Node::make_instance(URIs& uris, if (buffer) { if (port->is_a(PortType::CV) || port->is_a(PortType::CONTROL)) { - buffer->set_block(port->value().get_float(), 0, buffer->nframes() - 1); + buffer->set_block(port->value().get_float(), 0, buffer->nframes()); } else { buffer->clear(); } diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index a336439f..21c77b42 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -153,9 +153,9 @@ PortImpl::set_voice_value(Context& context, uint32_t voice, FrameTime time, Samp } FrameTime offset = time - context.start(); - FrameTime last = (_type == PortType::CONTROL) ? 0 : context.nframes() - 1; + FrameTime end = (_type == PortType::CONTROL) ? 1 : context.nframes(); if (offset < context.nframes()) { - buffer(voice)->set_block(value, offset, last); + buffer(voice)->set_block(value, offset, end); } // else trigger at very end of block, and set to 0 at start of next block SetState& state = _set_states->at(voice); @@ -175,7 +175,7 @@ PortImpl::update_set_state(Context& context, uint32_t voice) } break; case SetState::HALF_SET_CYCLE_2: { - buffer(voice)->set_block(state.value, 0, context.nframes() - 1); + buffer(voice)->set_block(state.value, 0, context.nframes()); state.state = SetState::SET; break; } @@ -296,7 +296,7 @@ PortImpl::clear_buffers() case PortType::CV: for (uint32_t v = 0; v < _poly; ++v) { Buffer* buf = buffer(v).get(); - buf->set_block(_value.get_float(), 0, buf->nframes() - 1); + buf->set_block(_value.get_float(), 0, buf->nframes()); SetState& state = _set_states->at(v); state.state = SetState::SET; state.value = _value.get_float(); diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index c84dd7a3..6ee86eed 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -101,7 +101,7 @@ Disconnect::Impl::Impl(Engine& e, for (uint32_t i = 0; i < _buffers->size(); ++i) { if (is_control) { Buffer* buf = _buffers->at(i).get(); - buf->set_block(value, 0, buf->nframes() - 1); + buf->set_block(value, 0, buf->nframes()); } else { _buffers->at(i)->clear(); } |