Hello,
Thanks for pointing me to the concept of proxy inlets.
I've tried to implement a test external using this code: http://puredata.info/Members/mjmogo/proxy-example-for-pd.zip/view
In the linked code, they're basically making another class of type t_proxy:
typedef struct _proxy { t_pd l_pd; // if you want to maintain a pointer to your main class, // if not, besure to change the 'init' function void *yourclass; } t_proxy;
This struct is declared as a member of the main class's struct:
typedef struct _yourclass { t_object x_obj; t_proxy pxy; } t_yourclass;
and the new inlet is created in the "new" method of the main class (yourclass_new) but with the destination pointing to the proxy rather than the main class. This is done via:
inlet_new(&x -> x_obj, &x -> pxy.l_pd, 0, 0); with no selectors passed. However, this only makes a control inlet.
Trying out:
inlet_new(&x -> x_obj, &x -> pxy.l_pd, &s_signal, &s_signal); makes a signal inlet, but it seems like the signal values are only accessible via the main class's dsp/perform methods and not via the dsp/perform methods i tried to make for proxy (I call CLASS_MAINSIGNALIN in both the setup of the main class and the proxy class). That's not a huge deal, but I also declared a float method within proxy's setup via class_addfloat(proxy_class, (t_method)proxy_post); where proxy_post just posts to the pd window whenever it receives a float and this method only seems to be called when I declare the inlet the first way with no selectors (when it's a control inlet) and not the second way passing the signal selectors (making it a signal inlet). In the second way, the float just acts like a substitute for a signal (which is what I don't want).
My main goal is to have a second signal inlet that can also accept floats not as a substitute for a signal but calls a separate method. Any ideas? Thanks!
www.derekxkwan.com
Am 27. März 2016 07:21:59 MESZ, schrieb Derek Kwan derek.x.kwan@gmail.com:
My main goal is to have a second signal inlet that can also accept floats not as a substitute for a signal but calls a separate method.
Are you really sure you want that? These days most Pd-users expect an implicit float-to-signal conversion. This might lead to unexpected (though well-defined) behaviour of your objects. My advice is to not try hard to break the expectancy of your users.
mfg.ugd.fhj IOhannes
-- Sent from my pdp-11