[PD] arguments not passed to an external

Alexandros Drymonitis adrcki at gmail.com
Mon May 26 11:59:08 CEST 2014

On Mon, May 26, 2014 at 11:28 AM, IOhannes m zmoelnig <zmoelnig at iem.at>wrote:

> Hash: SHA256
> On 2014-05-26 09:35, Alexandros Drymonitis wrote:
> >> void *tabPowSine_new(t_symbol *s, short argc, t_atom *argv)
> short argc? why short?
> this *must* be int (32bit!).
It was shown this way in Lyon's book, no idea why, or what it should be.
Tried with an int though and it still won't work. Is it in the setup
function or the perform routine? I've read that Pd cannot know whether an
object's inlet has been connected to another object, so how can I use
variables which have their values set by creation arguments, instead of
vectors arriving at the object's inlets?

My perform routine starts as follows:
t_int *powSine_perform(t_int *w)
        // Copy the object pointer
        t_powSine *x = (t_powSine *) (w[1]);

        // Copy signal vector pointers
        t_float *frequency = (t_float *) (w[2]);
        t_float *phase_mod = (t_float *) (w[3]);
        t_float *power = (t_float *) (w[4]);
        t_float *out = (t_float *) (w[5]);

        // Copy the signal vector size
        t_int n = w[6];

And then I set some local variables and run the while loop for each sample.
The while loop is using *frequency and *power for its calculations. Since
Pd cannot know if the object is connected to another object, how can I use
x->x_frequency and x->x_power (variables declared in the object structure)
instead of *frequency and *power, until I start sending signals (or floats)
to the respective inlets? A few emails further up in this thread I've
posted the setup function as well, I'm posting it again:
void powSine_tilde_setup(void)
        // Initialize the class
        powSine_class = class_new(gensym("powSine~"),
(t_newmethod)powSine_new, 0, sizeof(t_powSine), 0, A_GIMME, 0);

        // Specify signal input, with automatic float to signal conversion
        CLASS_MAINSIGNALIN(powSine_class, t_powSine, x_f);

        // Bind the DSP method, which is called when the DACs are turned on
        class_addmethod(powSine_class, (t_method)powSine_dsp,
gensym("dsp"), A_CANT, 0);

        // Bind the method to receive a float in the last inlet (control)
to reset the phase
        class_addmethod(powSine_class, (t_method)powSine_ft1,
gensym("ft1"), A_FLOAT, 0);

        // Print authorship to Pd window
        post("powSine~: Sinewave oscillator raised to a power\n external by
Alexandros Drymonitis");
I've added a control inlet to set the oscillator's phase which is working
fine (I've kind of copied the code from [phasor~]'s code). That wasn't
included in the previous email.

> fgamsdr
> IOhannes
> Version: GnuPG v1
> Comment: Using GnuPG with Icedove - http://www.enigmail.net/
> iQIcBAEBCAAGBQJTgvsuAAoJELZQGcR/ejb4wHcP/jFL24R1nT6lh46fw04EycEw
> DDLP8vsElpyYkJ73cT9s5cjP+in9CayqxMB/GzMst0jOKByibSvrO8oRm7WmEdo8
> 7tWaF+ZClvAO8ksAbe8P4Ir9DxHH7lHMYhJJxfebgbUY9UFAcDUTqCFfEjUQYC64
> Mb8P0a/duI9vXwmbVhAbx+DRFjh4qY60t+Jhan3EYlQBmi25Z1QnzzJdEHje0N2K
> fIqSArkOau4xKeah6hKPTcYukh/BTHGOtX8Zq1aEfmWjwhEYBmwpkaAwdY4dsAts
> 9TZIrmG+HGQKSusJN1cAPWb8WubwFzwh6VO4QGcaaf6ftmE6FLM0B0mimhnLkni3
> lyT9pKNKl6zRDc85DY90PpCnuvQJlGTG5PYi698lC102rJsgHXz4pghCdK/X3v22
> UjBPvGXUx4ScnFl1+6rwmnzS5Xdr8Aw54xFa+1D8E1UtANwNovi9C4KEP/XKPRri
> s+EIKnKuTMsc4+tUsuQdysm2SIZDvOxIsm3eI0+mEeu6g4KZZC8Bb+T7sA8BSZLp
> FpOo/5wEuI6RzvmKj5Syx5TRwfol4XzVBRYfyf15lmgi+IiXy3PAtTi7dPtBSGlL
> FGCSOxTrpoBWsieSEC7EXgKvQCC5o80QfBnxXmoJoeG7OjP7OF+fsfrZ+0GiDVeh
> j16bDOwyuxmgMYT28ld2
> =Ag7/
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20140526/e54ff1e9/attachment-0001.html>

More information about the Pd-list mailing list