From a41af6e41d60f8724809486b94ce1e6281c3bc31 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Jul 2012 04:49:47 +0000 Subject: Remove AudioBuffer::copy and just use memcpy. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4583 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/AudioBuffer.cpp | 19 ------------------- src/server/AudioBuffer.hpp | 1 - src/server/JackDriver.cpp | 2 +- src/server/ingen_lv2.cpp | 4 ++-- 4 files changed, 3 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/server/AudioBuffer.cpp b/src/server/AudioBuffer.cpp index 9cd267ee..719b06e3 100644 --- a/src/server/AudioBuffer.cpp +++ b/src/server/AudioBuffer.cpp @@ -76,25 +76,6 @@ AudioBuffer::set_block(Sample val, size_t start_offset, size_t end_offset) buf[i] = val; } -/** Copy a block of @a src into buffer. - * - * @a start_sample and @a end_sample define the inclusive range to be set. - * This function only copies the same range in one buffer to another. - */ -void -AudioBuffer::copy(const Sample* src, size_t start_sample, size_t end_sample) -{ - assert(end_sample >= start_sample); - assert(nframes() != 0); - - Sample* const buf = data(); - assert(buf); - - const size_t copy_end = std::min(end_sample, (size_t)nframes() - 1); - for (size_t i = start_sample; i <= copy_end; ++i) - buf[i] = src[i]; -} - void AudioBuffer::copy(Context& context, const Buffer* src) { diff --git a/src/server/AudioBuffer.hpp b/src/server/AudioBuffer.hpp index e8bfa411..ca519650 100644 --- a/src/server/AudioBuffer.hpp +++ b/src/server/AudioBuffer.hpp @@ -41,7 +41,6 @@ public: void clear(); void set_block(Sample val, size_t start_offset, size_t end_offset); - void copy(const Sample* src, size_t start_sample, size_t end_sample); void copy(Context& context, const Buffer* src); float peak(Context& context) const; diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 8d030bf3..b21a3c58 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -118,7 +118,7 @@ JackPort::pre_process(ProcessContext& context) if (_patch_port->is_a(PortType::AUDIO)) { AudioBuffer* patch_buf = (AudioBuffer*)_patch_port->buffer(0).get(); - patch_buf->copy((jack_sample_t*)_buffer, 0, nframes - 1); + memcpy(patch_buf->data(), _buffer, nframes * sizeof(float)); } else if (_patch_port->buffer_type() == _patch_port->bufs().uris().atom_Sequence) { Buffer* patch_buf = (Buffer*)_patch_port->buffer(0).get(); diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 88db9b24..8c8dce2c 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -101,10 +101,10 @@ public: if (_patch_port->is_a(PortType::AUDIO) || _patch_port->is_a(PortType::CV)) { AudioBuffer* patch_buf = (AudioBuffer*)_patch_port->buffer(0).get(); - patch_buf->copy((Sample*)_buffer, 0, context.nframes() - 1); + memcpy(patch_buf->data(), _buffer, context.nframes() * sizeof(float)); } else if (_patch_port->is_a(PortType::CONTROL)) { AudioBuffer* patch_buf = (AudioBuffer*)_patch_port->buffer(0).get(); - patch_buf->copy((Sample*)_buffer, 0, 0); + memcpy(patch_buf->data(), _buffer, sizeof(float)); } else { LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_buffer; bool enqueued = false; -- cgit v1.2.1