My SDL external blits and updates the render window each time the "blender_alpha" method is called (by the alpha selector). As far as I can tell the render speed is quite sufficient, but seems to lag behind what the number box is doing. Its like my number box goes through a pipe object before it gets to the external. Its just not quite as responsive as i would like. Is it more likely my SDL rendering speed or does an external have a built-in input buffer causing the lag? Here is my blender_setup function:
void blender_setup(void) { myclass = class_new(gensym("blender"), /* symname is the symbolic name */ (t_newmethod)blender_new, /* Constructor Function */ 0, /* Destructor Function */ sizeof(mystruct), /* Size of the structure */ CLASS_DEFAULT, /* Graphical Representation */ 0); /* 0 Terminates Argument List */
class_addmethod(myclass, /* Add function as method */ (t_method)new_blender_window, /* Bind method to function */ gensym("create"), /* symbol to invoke method */ 0); /* method arguments */
class_addmethod(myclass, /* Add function as method */ (t_method)blender_close, /* Bind method to function */ gensym("destroy"), /* symbol to invoke method */ 0); /* method arguments */
class_addmethod(myclass, /* Add function as method */ (t_method)blender_alpha, /* Bind method to function */ gensym("alpha"), /* symbol to invoke method */ A_DEFFLOAT, 0); /* method arguments */
}
While I'm on the topic, what is the proper way to create a deconstructor function? (to close my SDL process when PD closes) I tried passing (t_newmethod)sdl_close as the 3rd argument to my class_new function, but that causes the following compile error:
blender.c: In function `blender_setup': blender.c:82: warning: passing arg 3 of `class_new' from incompatible pointer type
Thanks! Ben
B. Bogart ---------
Ben Bogart - FMPM/F1999 wrote:
My SDL external blits and updates the render window each time the "blender_alpha" method is called (by the alpha selector). As far as I can tell the render speed is quite sufficient, but seems to lag behind what the number box is doing. Its like my number box goes through a pipe object before it gets to the external. Its just not quite as responsive as i would like. Is it more likely my SDL rendering speed or does an external have a built-in input buffer causing the lag? Here is my blender_setup function:
when you heavily drag your number-box you get quite a lot of numbers within a short period. (like 200 per sec, depending on your mouse-speed) you then will call the SDL-call 200 times per sec. this is much calculation !
maybe you should try throttling down the calls to blender_alpha with a timer or something. a maximum of 20 blendings/second should be enough
While I'm on the topic, what is the proper way to create a deconstructor function? (to close my SDL process when PD closes) I tried passing (t_newmethod)sdl_close as the 3rd argument to my class_new function, but that causes the following compile error:
blender.c: In function `blender_setup': blender.c:82: warning: passing arg 3 of `class_new' from incompatible pointer type
it's a (t_method) not a (t_newmethod)
mfg.cds.r IOhannes
Hi,
Ben Bogart - FMPM/F1999 hat gesagt: // Ben Bogart - FMPM/F1999 wrote:
While I'm on the topic, what is the proper way to create a deconstructor function?
It surely is not the canonical way, but it's very proper to use flext if you want a destructor like the ~one in C++. But I'm biased here, as I never really learned C, only C++ and the C therein, so I feel more at home with flext.
ciao,