• nasker

    Hi there!
    Using pd those days I was missing some function that could perform a floor function. I know it is not much to it, quiet simple too, so I made the extern.
    It does work, but I have a problem with it; for it to work I need to send a message "solve" in the first inlet. It's not a big problem but it's weird, cause the operation it's quiet simple. What should I change in the code (above) so I don't need to "bang" the solve message when I use it on Pd?
    Thanx so much!


    #include <math.h>
    #include "m_pd.h"

    static t_class *rounder_class;

    typedef struct _rounder{
    t_object x_obj;
    t_float A,B;
    t_outlet *result_out;
    }t_rounder;

    void rounder_solve(t_rounder *x){

    t_int result;
    result= round(x->A);

    outlet_float(x->x_obj.ob_outlet,result);
    }

    void *rounder_new(t_symbol *s,int argc, t_atom *argv){

    t_rounder *x=(t_rounder *)pd_new(rounder_class);

    floatinlet_new(&x->x_obj,&x->A);

    x->result_out=outlet_new(&x->x_obj, &s_float);

    return (void*)x;
    }

    void rounder_setup(void){
    rounder_class = class_new(gensym("rounder"),
    (t_newmethod)rounder_new,
    0, sizeof(t_rounder),
    CLASS_DEFAULT,
    A_DEFFLOAT, 0);

    class_addmethod(rounder_class,
    (t_method)rounder_solve,
    gensym("solve"),A_DEFFLOAT,0);
    }


    posted in extra~ read more
  • nasker

    Hi there,
    Maybe it's cause my brain it's quiet dead today but I just can't figure this out;
    I'm receiving via OSC a string containing the name of a file and it's extension p.ex: "junkbrain.wav". The thing is that I'm trying to use this message for putting it into another message for compossing the order for [soundfiller] so I can load and audio archive, it should be something like that << read -resize ../samples/junkbrain.wav sample0 >>
    I've tried different things but none of them seemed to work!!
    HELP US, me and my sore head!

    posted in technical issues read more
  • nasker

    Hey there,
    I've been "writting" this PD external as a part of an university project.
    It's a ripoff from PeiXiang's [earplug~], it ain't a copy-paste either but it's a lot like earplug. I've changed a few things for using IRCAM's database (based on human subjects) instead of KEMAR's and a few other things, so it's quiet the same but simplified, I don't even perform interpolation (by now).
    The point is I've taken some "riscs" changing the code, that why maybe it doesn't work.
    I compiled it on Xcode, but when I call the object on PD it just doesn't work.
    I attach the code, all comments on it are on Catalan so tell me if you need translation, I can even pass you the .txt with the coefficients if you're interested.
    Thanx!

    http://www.pdpatchrepo.info/hurleur/huikey~.c

    posted in extra~ read more
  • nasker

    Hey there,
    I'm trying to write a simple external on my way for learning how to write them, i've followed the "HOW-TO"tutorial building succesfully the examples in there.
    The extern I'm trying to build it's suposed to solve the pitagoras triangle, but well the math operation here it's not important here, but the management of the inlets and outlets is, also writting the propper code for making the class. The thing is that it does compile in XCode but when I try calling it in PD it just doesn't work and i get a post like this :

    "/Applications/Pd-extended.app/Contents/Resources/extra/pitagorin/pitagorin.pd_darwin: dlopen(/Applications/Pd-extended.app/Contents/Resources/extra/pitagorin/pitagorin.pd_darwin, 10): Symbol not found: _class_addsolve
    Referenced from: /Applications/Pd-extended.app/Contents/Resources/extra/pitagorin/pitagorin.pd_darwin
    Expected in: dynamic lookup

    pitagorin
    ... couldn't create"

    I'm sure that something is wrong with my code, but still dunno what&where!

    Here it is:

    #include "m_pd.h"

    static t_class *pitagorin_class;

    typedef struct _pitagorin{
    t_object x_obj;
    t_float A,B;
    t_outlet *result_out;
    }t_pitagorin;

    void pitagorin_solve(t_pitagorin *x){

    t_float result;
    result= ( sqrt( x->A*x->A + x->B*x->B) );

    outlet_float(x->x_obj.ob_outlet,result);
    }

    void *pitagorin_new(t_symbol *s,int argc, t_atom *argv){

    t_pitagorin *x=(t_pitagorin *)pd_new(pitagorin_class);

    floatinlet_new(&x->x_obj,&x->A);
    floatinlet_new(&x->x_obj,&x->B);

    x->result_out=outlet_new(&x->x_obj, &s_float);

    return (void*)x;
    }

    void pitagorin_setup(void){
    pitagorin_class = class_new(gensym("pitagorin"),
    (t_newmethod)pitagorin_new,
    0, sizeof(t_pitagorin),
    CLASS_DEFAULT,
    A_DEFFLOAT, 0);
    class_addsolve(pitagorin_class, pitagorin_solve);

    }

    Thanx so much!

    posted in extra~ read more
  • nasker

    Maelstrom, you rock!
    Thanx so much!

    posted in extra~ read more
  • nasker

    oops, actually the topic should be "round external", cause this extern performs a round function!
    Some answers please!

    posted in extra~ read more
  • nasker

    Hey there, again,
    Still working on the external, I haven't made much more progress, but now I know why it doesn't sound: my code doesn't load properly the text file where I have the impulse responses, here is that part of the code:

    fop = open_via_path(canvas_getdir(canvas_getcurrent())->s_name,"databaseHrirREDUX.txt", "", buff, &buffptr, 1024, 0);
    /* Here I call the function that looks for the archive at the path*/

    if (fop >= 0) { /*if the return value of the last function is bigger than 0 then it will keep loading the file */

    post("[huikey~]....

    ALL THIS LINES ARE SKIPPED ANYWAYS CAUSE THE CONDITION IT'S NOT PASED (WHYY??)

    .....
    }
    fclose(fid); /* Tanquem l'arxiu finalitzada la seva lectura */

    }
    else post ("Error al obrir l'arxiu"); <-THIS MESSAGE ACTUALLY APPEARS, SHOWING THAT IT COULDN'T OPEN THE TXT FILE!! I've made sure that the filename it's allright!!

    If anyone can tell WTF I'm doing wrong, I'll really appreciate!

    posted in extra~ read more
  • nasker

    I've just changed that gensym [huikey] into [huikey~] as you said, now when I call the object it appears apparently correct (number of signal in/outs and the other stuff) but I don't get any sound when I use it.
    I'll keep working on it, any suggestion will be really appreciated, thanx!

    posted in extra~ read more
  • nasker

    Yeah, you're right, I should have said which error I get: When I call the object in PD typing [huikey~] I get "couldn't create", but I guess that you've found one of the main mystakes (thanx so much!) and it's the symbol name! I'll change that and see what I get!
    Thanx again!
    I'll write later cause I'm pretty sure It will give me another problems!

    posted in extra~ read more
  • nasker

    Hey dio_333,
    Now it works, thank so much, you're the man!!
    I'll keep on trying things with that type of object, the thing is I was looking for that; writting an object with 2 inlets, a more or less complex operation and an outlet!

    posted in extra~ read more

Internal error.

Oops! Looks like something went wrong!