[PD] how can I clear [vd~]

Mathieu Bouchard matju at artengine.ca
Tue Feb 1 04:06:34 CET 2011


On Tue, 1 Feb 2011, Ingo Scherzinger wrote:

> Yes, you are right, Mathieu!
> It's the [delwrite~]! I am already toggling between two [vd~] objects. I
> guess if I'd add a second [delwrite~] to keep the other one "cleard" with no
> signal being fed into it while the other one is active it would work.
> Thank you for the idea!

Well, if you switch off and on and off and on real quick, then your 
double-delwrite~ trick doesn't work anymore. I suppose that it would be 
better to actually add the clear method :

Index: d_delay.c
===================================================================
--- d_delay.c	(révision 14844)
+++ d_delay.c	(copie de travail)
@@ -5,6 +5,7 @@
  /*  send~, delread~, throw~, catch~ */

  #include "m_pd.h"
+#include <string.h>
  extern int ugen_getsortno(void);

  #define DEFDELVS 64             /* LATER get this from canvas at DSP time */
@@ -129,6 +130,11 @@
          (x->x_cspace.c_n + XTRASAMPS) * sizeof(t_sample));
  }

+static void sigdelwrite_clear(t_sigdelwrite *x) {
+    int n = XTRASAMPS + x->x_cspace.c_n;
+    memset(x->x_cspace.c_vec, 0, n * sizeof(t_sample));
+}
+
  static void sigdelwrite_setup(void)
  {
      sigdelwrite_class = class_new(gensym("delwrite~"),
@@ -137,6 +143,8 @@
      CLASS_MAINSIGNALIN(sigdelwrite_class, t_sigdelwrite, x_f);
      class_addmethod(sigdelwrite_class, (t_method)sigdelwrite_dsp,
          gensym("dsp"), 0);
+    class_addmethod(sigdelwrite_class, (t_method)sigdelwrite_clear,
+        gensym("clear"), 0);
  }

  /* ----------------------------- delread~ ----------------------------- */

  _______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC


More information about the Pd-list mailing list