summaryrefslogtreecommitdiff
path: root/plugin/drumgizmo_plugin.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-03-27 19:47:13 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2016-03-27 19:47:13 +0200
commitd803ddc1ddc76735a541cb2cd392f449e2152d4a (patch)
tree7d7e16935382fb49501cbe5d7c1bb89835ca5331 /plugin/drumgizmo_plugin.cc
parent8a5cc35bf5be3388f85c5ebf538a75a406de13e5 (diff)
Fix plugin 'no playback when running with resampler' bug.
Diffstat (limited to 'plugin/drumgizmo_plugin.cc')
-rw-r--r--plugin/drumgizmo_plugin.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc
index 025cb2b..29c2306 100644
--- a/plugin/drumgizmo_plugin.cc
+++ b/plugin/drumgizmo_plugin.cc
@@ -265,7 +265,20 @@ void DrumGizmoPlugin::Output::pre(size_t nsamples)
void DrumGizmoPlugin::Output::run(int ch, sample_t *samples, size_t nsamples)
{
-// assert(false);
+ assert(plugin.output_samples);
+
+ assert(sizeof(float) == sizeof(sample_t));
+
+ if((std::size_t)ch >= plugin.output_samples->size())
+ {
+ return;
+ }
+
+ // We are not running directly on the internal buffer: do a copy.
+ if((*plugin.output_samples)[ch] != samples)
+ {
+ memcpy((*plugin.output_samples)[ch], samples, nsamples * sizeof(sample_t));
+ }
}
void DrumGizmoPlugin::Output::post(size_t nsamples)