summaryrefslogtreecommitdiffstats
path: root/src/engine/AudioBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/AudioBuffer.cpp')
-rw-r--r--src/engine/AudioBuffer.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/engine/AudioBuffer.cpp b/src/engine/AudioBuffer.cpp
index 99d97e14..145df559 100644
--- a/src/engine/AudioBuffer.cpp
+++ b/src/engine/AudioBuffer.cpp
@@ -170,10 +170,23 @@ AudioBuffer::copy(Context& context, const Buffer* src)
return;
}
- // Control => Control or Audio => Audio
+ // Control => Control
if (src_abuf->is_control() == is_control()) {
ObjectBuffer::copy(context, src);
+ // Audio => Audio
+ } else if (!src_abuf->is_control() && !is_control()) {
+ copy(src_abuf->data(),
+ context.offset(), context.offset() + context.nframes() - 1);
+
+ // Audio => Control
+ } else if (!src_abuf->is_control() && is_control()) {
+ data()[0] = src_abuf->data()[context.offset()];
+
+ // Control => Audio
+ } else if (src_abuf->is_control() && !is_control()) {
+ data()[context.offset()] = src_abuf->data()[0];
+
// Control => Audio or Audio => Control
} else {
set_block(src_abuf->data()[0], 0, nframes());