summaryrefslogtreecommitdiff
path: root/plugin/drumgizmo_plugin.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-07-24 10:06:27 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2016-07-24 10:28:43 +0200
commite5efc3656090d39de1d8854aa495c8c16218c2f6 (patch)
treec3126c789fd37b43218371bf7c16fa2066a7007d /plugin/drumgizmo_plugin.cc
parent973d411598958d968226ed878d9426f23e8f7cbf (diff)
Clear output buffers in LV2 and jack modes before each process iteration to eliminte noise when drumkit has not yet been loaded.
Diffstat (limited to 'plugin/drumgizmo_plugin.cc')
-rw-r--r--plugin/drumgizmo_plugin.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc
index 5e4ebeb..fa51575 100644
--- a/plugin/drumgizmo_plugin.cc
+++ b/plugin/drumgizmo_plugin.cc
@@ -26,13 +26,7 @@
*/
#include "drumgizmo_plugin.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <iostream>
+#include <cstring>
#include <midievent.h>
@@ -292,6 +286,14 @@ void DrumGizmoPlugin::Output::stop()
void DrumGizmoPlugin::Output::pre(size_t nsamples)
{
+ // Clear all channels
+ for(auto& channel : *plugin.output_samples)
+ {
+ if(channel)
+ {
+ std::memset(channel, 0, nsamples * sizeof(sample_t));
+ }
+ }
}
void DrumGizmoPlugin::Output::run(int ch, sample_t *samples, size_t nsamples)