From db3bf85c9d043fc52176ef7a432fece900215c8a Mon Sep 17 00:00:00 2001
From: John Glover <j@johnglover.net>
Date: Mon, 10 Sep 2012 19:07:18 +0200
Subject: [base] If Frames allocate their own memory, zero all sample arrays
 when clear function is called.

---
 src/simpl/base.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src')

diff --git a/src/simpl/base.cpp b/src/simpl/base.cpp
index 8086143..1751dd5 100644
--- a/src/simpl/base.cpp
+++ b/src/simpl/base.cpp
@@ -142,6 +142,13 @@ void Frame::destroy_arrays() {
 void Frame::clear() {
     clear_peaks();
     clear_partials();
+
+    if(_alloc_memory) {
+        memset(_audio, 0.0, sizeof(sample) * _size);
+        memset(_synth, 0.0, sizeof(sample) * _synth_size);
+        memset(_residual, 0.0, sizeof(sample) * _size);
+        memset(_synth_residual, 0.0, sizeof(sample) * _synth_size);
+    }
 }
 
 void Frame::clear_peaks() {
-- 
cgit v1.2.3