Description: replace error() with pd_error()
 the former was removed from Pd's public API with Pd-0.52
Author: IOhannes m zmölnig
Bug: https://github.com/asb2m10/jsusfx/issues/38
Last-Update: 2021-12-20
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- jsusfx.orig/pd/jsusfx_pd.cpp
+++ jsusfx/pd/jsusfx_pd.cpp
@@ -107,7 +107,9 @@
     bool dspOn;
     WDL_Mutex dspLock;
 
-    JsusFxPd(JsusFxPathLibrary &pathLibrary) : JsusFx(pathLibrary) {
+    const void*object;
+
+    JsusFxPd(JsusFxPathLibrary &pathLibrary, const void*obj = nullptr) : JsusFx(pathLibrary), object(obj) {
         midi = &midiHead[0];
         NSEEL_addfunc_varparm("midisend",3,NSEEL_PProc_THIS,&midisend);
     }
@@ -182,7 +184,7 @@
         vsnprintf(output, 4095, fmt, argptr);
         va_end(argptr);
 
-        error("%s", output);
+        pd_error(object, "%s", output);
     }
 
     void flushMidi() {
@@ -276,7 +278,7 @@
             filename += ".jsfx";
             
             if ( ! x->path->resolveDataPath(string(filename), result) ) {
-                error("jsusfx~: unable to find script %s", newFile->s_name);
+                pd_error(x, "jsusfx~: unable to find script %s", newFile->s_name);
                 return;
             }
         }
@@ -302,7 +304,7 @@
     if ( i > 64 || i < 0 )
         return;
     if ( ! x->fx->sliders[i].exists ) {
-        error("jsusfx~: slider number %d is not assigned for this effect", i);
+        pd_error(x, "jsusfx~: slider number %d is not assigned for this effect", i);
         return;
     }
     x->fx->moveSlider(i, value, 1);
@@ -313,7 +315,7 @@
     if ( i > 64 || i < 0 )
         return;
     if ( ! x->fx->sliders[i].exists ) {
-        error("jsusfx~: slider number %d is not assigned for this effect", i);
+        pd_error(x, "jsusfx~: slider number %d is not assigned for this effect", i);
         return;
     }
     x->fx->moveSlider(i, value, 0);
@@ -401,7 +403,7 @@
     x->bypass = true;
     x->user_bypass = false;
     x->scriptpath[0] = 0;
-    x->fx = new JsusFxPd(*(x->path));
+    x->fx = new JsusFxPd(*(x->path), x);
     x->x_clock = clock_new(x, (t_method)jsusfx_midiout);
 
     x->pinIn = 2;
@@ -482,7 +484,7 @@
     }
 
     if ( script == NULL || script->s_name[0] == 0) {
-        error("jsfx~: missing script");
+        pd_error(0, "jsfx~: missing script");
         return NULL;
     }
     
@@ -491,7 +493,7 @@
     x->bypass = true;
     x->user_bypass = false;
     x->scriptpath[0] = 0;
-    x->fx = new JsusFxPd(*(x->path));
+    x->fx = new JsusFxPd(*(x->path), x);
     x->x_clock = clock_new(x, (t_method)jsusfx_midiout);
     
     x->pinIn = 2;
