Max 5 API Reference
00001 /* 00002 jit.attribute.util.c 00003 00004 Copyright 2001-2005 - Cycling '74 00005 Joshua Kit Clayton jkc@cycling74.com 00006 00007 */ 00008 00009 #include "jit.common.h" 00010 #include "ext_obex.h" 00011 00012 /** 00013 * @defgroup attrmod Attribute Module 00014 @ingroup jitter 00015 */ 00016 00017 00018 // need to use the old functions for the time being as the 00019 // kernel attr functions will not handle decorator objects 00020 // properly, as in the instance of jit_mop_io 00021 long jit_attr_getlong_old(void *x, t_symbol *s); 00022 t_jit_err jit_attr_setlong_old(void *x, t_symbol *s, long c); 00023 float jit_attr_getfloat_old(void *x, t_symbol *s); 00024 t_jit_err jit_attr_setfloat_old(void *x, t_symbol *s, float c); 00025 t_symbol *jit_attr_getsym_old(void *x, t_symbol *s); 00026 t_jit_err jit_attr_setsym_old(void *x, t_symbol *s, t_symbol *c); 00027 //------------ 00028 long jit_attr_getlong_array_old(void *x, t_symbol *s, long max, long *vals); 00029 t_jit_err jit_attr_setlong_array_old(void *x, t_symbol *s, long count, long *vals); 00030 long jit_attr_getchar_array_old(void *x, t_symbol *s, long max, uchar *vals); 00031 t_jit_err jit_attr_setchar_array_old(void *x, t_symbol *s, long count, uchar *vals); 00032 long jit_attr_getfloat_array_old(void *x, t_symbol *s, long max, float *vals); 00033 t_jit_err jit_attr_setfloat_array_old(void *x, t_symbol *s, long count, float *vals); 00034 long jit_attr_getdouble_array_old(void *x, t_symbol *s, long max, double *vals); 00035 t_jit_err jit_attr_setdouble_array_old(void *x, t_symbol *s, long count, double *vals); 00036 long jit_attr_getsym_array_old(void *x, t_symbol *s, long max, t_symbol **vals); 00037 t_jit_err jit_attr_setsym_array_old(void *x, t_symbol *s, long count, t_symbol **vals); 00038 00039 /** 00040 * Retrieves attribute value as a long integer value. 00041 * 00042 * @ingroup attrmod 00043 * 00044 * @param x object pointer 00045 * @param s attribute name 00046 * 00047 * @return long integer value 00048 * 00049 */ 00050 long jit_attr_getlong(void *x, t_symbol *s) 00051 { 00052 if (object_attr_get(x,s)) 00053 return object_attr_getlong(x,s); 00054 else 00055 return jit_attr_getlong_old(x,s); 00056 } 00057 00058 /** 00059 * Sets attribute value as a long integer value. 00060 * 00061 * @ingroup attrmod 00062 * 00063 * @param x object pointer 00064 * @param s attribute name 00065 * @param c value 00066 * 00067 * @return t_jit_err error code. 00068 * 00069 */ 00070 t_jit_err jit_attr_setlong(void *x, t_symbol *s, long c) 00071 { 00072 if (object_attr_get(x,s)) 00073 return jit_err_from_max_err(object_attr_setlong(x,s,c)); 00074 else 00075 return jit_attr_setlong_old(x,s,c); 00076 } 00077 00078 /** 00079 * Retrieves attribute value as a floating point value. 00080 * 00081 * @ingroup attrmod 00082 * 00083 * @param x object pointer 00084 * @param s attribute name 00085 * 00086 * @return floating point value 00087 * 00088 */ 00089 float jit_attr_getfloat(void *x, t_symbol *s) 00090 { 00091 if (object_attr_get(x,s)) 00092 return object_attr_getfloat(x,s); 00093 else 00094 return jit_attr_getfloat_old(x,s); 00095 } 00096 00097 /** 00098 * Sets attribute value as a floating point value. 00099 * 00100 * @ingroup attrmod 00101 * 00102 * @param x object pointer 00103 * @param s attribute name 00104 * @param c value 00105 * 00106 * @return t_jit_err error code. 00107 * 00108 */ 00109 t_jit_err jit_attr_setfloat(void *x, t_symbol *s, float c) 00110 { 00111 if (object_attr_get(x,s)) 00112 return jit_err_from_max_err(object_attr_setfloat(x,s,c)); 00113 else 00114 return jit_attr_setfloat_old(x,s,c); 00115 } 00116 00117 /** 00118 * Retrieves attribute value as a symbol value. 00119 * 00120 * @ingroup attrmod 00121 * 00122 * @param x object pointer 00123 * @param s attribute name 00124 * 00125 * @return symbol value 00126 * 00127 */ 00128 t_symbol *jit_attr_getsym(void *x, t_symbol *s) 00129 { 00130 if (object_attr_get(x,s)) 00131 return object_attr_getsym(x,s); 00132 else 00133 return jit_attr_getsym_old(x,s); 00134 } 00135 00136 /** 00137 * Sets attribute value as a symbol value. 00138 * 00139 * @ingroup attrmod 00140 * 00141 * @param x object pointer 00142 * @param s attribute name 00143 * @param c value 00144 * 00145 * @return t_jit_err error code. 00146 * 00147 */ 00148 t_jit_err jit_attr_setsym(void *x, t_symbol *s, t_symbol *c) 00149 { 00150 if (object_attr_get(x,s)) 00151 return jit_err_from_max_err(object_attr_setsym(x,s,c)); 00152 else 00153 return jit_attr_setsym_old(x,s,c); 00154 } 00155 00156 //------------ 00157 00158 /** 00159 * Retrieves attribute value as an array of long integer values. 00160 * 00161 * @ingroup attrmod 00162 * 00163 * @param x object pointer 00164 * @param s attribute name 00165 * @param max maximum number of values to copy 00166 * @param vals pointer to retrieved values 00167 * 00168 * @return number of values retrieved. 00169 * 00170 */ 00171 long jit_attr_getlong_array(void *x, t_symbol *s, long max, long *vals) 00172 { 00173 if (object_attr_get(x,s)) 00174 return object_attr_getlong_array(x,s,max,vals); 00175 else 00176 return jit_attr_getlong_array_old(x,s,max,vals); 00177 } 00178 00179 /** 00180 * Sets attribute value as an array of long integer values. 00181 * 00182 * @ingroup attrmod 00183 * 00184 * @param x object pointer 00185 * @param s attribute name 00186 * @param count number of values 00187 * @param vals pointer to values 00188 * 00189 * @return t_jit_err error code. 00190 * 00191 */ 00192 t_jit_err jit_attr_setlong_array(void *x, t_symbol *s, long count, long *vals) 00193 { 00194 if (object_attr_get(x,s)) 00195 return jit_err_from_max_err(object_attr_setlong_array(x,s,count,vals)); 00196 else 00197 return jit_attr_setlong_array_old(x,s,count,vals); 00198 } 00199 00200 /** 00201 * Retrieves attribute value as an array of char values. 00202 * 00203 * @ingroup attrmod 00204 * 00205 * @param x object pointer 00206 * @param s attribute name 00207 * @param max maximum number of values to copy 00208 * @param vals pointer to retrieved values 00209 * 00210 * @return number of values retrieved. 00211 * 00212 */ 00213 long jit_attr_getchar_array(void *x, t_symbol *s, long max, uchar *vals) 00214 { 00215 if (object_attr_get(x,s)) 00216 return object_attr_getchar_array(x,s,max,vals); 00217 else 00218 return jit_attr_getchar_array_old(x,s,max,vals); 00219 } 00220 00221 /** 00222 * Sets attribute value as an array of char values. 00223 * 00224 * @ingroup attrmod 00225 * 00226 * @param x object pointer 00227 * @param s attribute name 00228 * @param count number of values 00229 * @param vals pointer to values 00230 * 00231 * @return t_jit_err error code. 00232 * 00233 */ 00234 t_jit_err jit_attr_setchar_array(void *x, t_symbol *s, long count, uchar *vals) 00235 { 00236 if (object_attr_get(x,s)) 00237 return jit_err_from_max_err(object_attr_setchar_array(x,s,count,vals)); 00238 else 00239 return jit_attr_setchar_array_old(x,s,count,vals); 00240 } 00241 00242 /** 00243 * Retrieves attribute value as an array of floating point values. 00244 * 00245 * @ingroup attrmod 00246 * 00247 * @param x object pointer 00248 * @param s attribute name 00249 * @param max maximum number of values to copy 00250 * @param vals pointer to retrieved values 00251 * 00252 * @return number of values retrieved. 00253 * 00254 */ 00255 long jit_attr_getfloat_array(void *x, t_symbol *s, long max, float *vals) 00256 { 00257 if (object_attr_get(x,s)) 00258 return object_attr_getfloat_array(x,s,max,vals); 00259 else 00260 return jit_attr_getfloat_array_old(x,s,max,vals); 00261 } 00262 00263 /** 00264 * Sets attribute value as an array of floating point values. 00265 * 00266 * @ingroup attrmod 00267 * 00268 * @param x object pointer 00269 * @param s attribute name 00270 * @param count number of values 00271 * @param vals pointer to values 00272 * 00273 * @return t_jit_err error code. 00274 * 00275 */ 00276 t_jit_err jit_attr_setfloat_array(void *x, t_symbol *s, long count, float *vals) 00277 { 00278 if (object_attr_get(x,s)) 00279 return jit_err_from_max_err(object_attr_setfloat_array(x,s,count,vals)); 00280 else 00281 return jit_attr_setfloat_array_old(x,s,count,vals); 00282 } 00283 00284 /** 00285 * Retrieves attribute value as an array of double precision floating point values. 00286 * 00287 * @ingroup attrmod 00288 * 00289 * @param x object pointer 00290 * @param s attribute name 00291 * @param max maximum number of values to copy 00292 * @param vals pointer to retrieved values 00293 * 00294 * @return number of values retrieved. 00295 * 00296 */ 00297 long jit_attr_getdouble_array(void *x, t_symbol *s, long max, double *vals) 00298 { 00299 if (object_attr_get(x,s)) 00300 return object_attr_getdouble_array(x,s,max,vals); 00301 else 00302 return jit_attr_getdouble_array_old(x,s,max,vals); 00303 } 00304 00305 /** 00306 * Sets attribute value as an array of double precision floating point values. 00307 * 00308 * @ingroup attrmod 00309 * 00310 * @param x object pointer 00311 * @param s attribute name 00312 * @param count number of values 00313 * @param vals pointer to values 00314 * 00315 * @return t_jit_err error code. 00316 * 00317 */ 00318 t_jit_err jit_attr_setdouble_array(void *x, t_symbol *s, long count, double *vals) 00319 { 00320 if (object_attr_get(x,s)) 00321 return jit_err_from_max_err(object_attr_setdouble_array(x,s,count,vals)); 00322 else 00323 return jit_attr_setdouble_array_old(x,s,count,vals); 00324 } 00325 00326 /** 00327 * Retrieves attribute value as an array of symbol values. 00328 * 00329 * @ingroup attrmod 00330 * 00331 * @param x object pointer 00332 * @param s attribute name 00333 * @param max maximum number of values to copy 00334 * @param vals pointer to retrieved values 00335 * 00336 * @return number of values retrieved. 00337 * 00338 */ 00339 long jit_attr_getsym_array(void *x, t_symbol *s, long max, t_symbol **vals) 00340 { 00341 if (object_attr_get(x,s)) 00342 return object_attr_getsym_array(x,s,max,vals); 00343 else 00344 return jit_attr_getsym_array_old(x,s,max,vals); 00345 } 00346 00347 /** 00348 * Sets attribute value as an array of symbol values. 00349 * 00350 * @ingroup attrmod 00351 * 00352 * @param x object pointer 00353 * @param s attribute name 00354 * @param count number of values 00355 * @param vals pointer to values 00356 * 00357 * @return t_jit_err error code. 00358 * 00359 */ 00360 t_jit_err jit_attr_setsym_array(void *x, t_symbol *s, long count, t_symbol **vals) 00361 { 00362 if (object_attr_get(x,s)) 00363 return jit_err_from_max_err(object_attr_setsym_array(x,s,count,vals)); 00364 else 00365 return jit_attr_setsym_array_old(x,s,count,vals); 00366 } 00367 00368 //----------------------------------------------- 00369 00370 long jit_attr_getlong_old(void *x, t_symbol *s) 00371 { 00372 long ac=0; 00373 t_atom *av=NULL; 00374 char str[256]; 00375 long rv=0; 00376 00377 if (x&&s) { 00378 sprintf(str,"get%s",s->s_name); 00379 00380 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00381 if (ac&&av) { 00382 rv = jit_atom_getlong(av); 00383 jit_freebytes(av,sizeof(t_atom)*ac); 00384 } 00385 } 00386 } 00387 return rv; 00388 } 00389 00390 t_jit_err jit_attr_setlong_old(void *x, t_symbol *s, long c) 00391 { 00392 long ac=1; 00393 t_atom av[1]; 00394 t_jit_err rv=JIT_ERR_GENERIC; 00395 00396 if (x&&s) { 00397 jit_atom_setlong(av,c); 00398 rv = (t_jit_err)jit_object_method(x,s,ac,av); 00399 } 00400 return rv; 00401 } 00402 00403 float jit_attr_getfloat_old(void *x, t_symbol *s) 00404 { 00405 long ac=0; 00406 t_atom *av=NULL; 00407 char str[256]; 00408 float rv=0; 00409 00410 if (x&&s) { 00411 sprintf(str,"get%s",s->s_name); 00412 00413 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00414 if (ac&&av) { 00415 rv = jit_atom_getfloat(av); 00416 jit_freebytes(av,sizeof(t_atom)*ac); 00417 } 00418 } 00419 } 00420 return rv; 00421 } 00422 00423 t_jit_err jit_attr_setfloat_old(void *x, t_symbol *s, float c) 00424 { 00425 long ac=1; 00426 t_atom av[1]; 00427 t_jit_err rv=JIT_ERR_GENERIC; 00428 00429 if (x&&s) { 00430 jit_atom_setfloat(av,c); 00431 rv = (t_jit_err)jit_object_method(x,s,ac,av); 00432 } 00433 return rv; 00434 } 00435 00436 t_symbol *jit_attr_getsym_old(void *x, t_symbol *s) 00437 { 00438 long ac=0; 00439 t_atom *av=NULL; 00440 char str[256]; 00441 t_symbol *rv=NULL; 00442 00443 if (x&&s) { 00444 sprintf(str,"get%s",s->s_name); 00445 00446 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00447 if (ac&&av) { 00448 rv = jit_atom_getsym(av); 00449 jit_freebytes(av,sizeof(t_atom)*ac); 00450 } 00451 } 00452 } 00453 return rv; 00454 } 00455 00456 t_jit_err jit_attr_setsym_old(void *x, t_symbol *s, t_symbol *c) 00457 { 00458 long ac=1; 00459 t_atom av[1]; 00460 t_jit_err rv=JIT_ERR_GENERIC; 00461 00462 if (x&&s) { 00463 jit_atom_setsym(av,c); 00464 rv = (t_jit_err)jit_object_method(x,s,ac,av); 00465 } 00466 return rv; 00467 } 00468 //------------ 00469 long jit_attr_getlong_array_old(void *x, t_symbol *s, long max, long *vals) 00470 { 00471 long i,ac=0; 00472 t_atom *av=NULL; 00473 char str[256]; 00474 00475 if (x&&s&&vals) { 00476 sprintf(str,"get%s",s->s_name); 00477 00478 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00479 if (ac&&av) { 00480 max = MIN(max,ac); 00481 for (i=0;i<max;i++) { 00482 vals[i]=jit_atom_getlong(av+i); 00483 } 00484 jit_freebytes(av,sizeof(t_atom)*ac); 00485 } 00486 } 00487 } 00488 return ac; 00489 } 00490 00491 t_jit_err jit_attr_setlong_array_old(void *x, t_symbol *s, long count, long *vals) 00492 { 00493 t_atom av[256]; 00494 t_jit_err rv=JIT_ERR_GENERIC; 00495 long i; 00496 00497 if (x&&s&&vals) { 00498 for (i=0;i<count;i++) 00499 jit_atom_setlong(av+i,vals[i]); 00500 rv = (t_jit_err)jit_object_method(x,s,count,av); 00501 } 00502 return rv; 00503 } 00504 00505 long jit_attr_getchar_array_old(void *x, t_symbol *s, long max, uchar *vals) 00506 { 00507 long i,ac=0; 00508 t_atom *av=NULL; 00509 char str[256]; 00510 00511 if (x&&s&&vals) { 00512 sprintf(str,"get%s",s->s_name); 00513 00514 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00515 if (ac&&av) { 00516 max = MIN(max,ac); 00517 for (i=0;i<max;i++) { 00518 vals[i]=jit_atom_getlong(av+i); 00519 } 00520 jit_freebytes(av,sizeof(t_atom)*ac); 00521 } 00522 } 00523 } 00524 return ac; 00525 } 00526 00527 t_jit_err jit_attr_setchar_array_old(void *x, t_symbol *s, long count, uchar *vals) 00528 { 00529 t_atom av[256]; 00530 t_jit_err rv=JIT_ERR_GENERIC; 00531 long i; 00532 00533 if (x&&s&&vals) { 00534 for (i=0;i<count;i++) 00535 jit_atom_setlong(av+i,vals[i]); 00536 rv = (t_jit_err)jit_object_method(x,s,count,av); 00537 } 00538 return rv; 00539 } 00540 00541 long jit_attr_getfloat_array_old(void *x, t_symbol *s, long max, float *vals) 00542 { 00543 long i,ac=0; 00544 t_atom *av=NULL; 00545 char str[256]; 00546 00547 if (x&&s&&vals) { 00548 sprintf(str,"get%s",s->s_name); 00549 00550 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00551 if (ac&&av) { 00552 max = MIN(max,ac); 00553 for (i=0;i<max;i++) { 00554 vals[i]=jit_atom_getfloat(av+i); 00555 } 00556 jit_freebytes(av,sizeof(t_atom)*ac); 00557 } 00558 } 00559 } 00560 return ac; 00561 } 00562 00563 t_jit_err jit_attr_setfloat_array_old(void *x, t_symbol *s, long count, float *vals) 00564 { 00565 t_atom av[256]; 00566 t_jit_err rv=JIT_ERR_GENERIC; 00567 long i; 00568 00569 if (x&&s&&vals) { 00570 for (i=0;i<count;i++) 00571 jit_atom_setfloat(av+i,vals[i]); 00572 rv = (t_jit_err)jit_object_method(x,s,count,av); 00573 } 00574 return rv; 00575 } 00576 00577 long jit_attr_getdouble_array_old(void *x, t_symbol *s, long max, double *vals) 00578 { 00579 long i,ac=0; 00580 t_atom *av=NULL; 00581 char str[256]; 00582 00583 if (x&&s&&vals) { 00584 sprintf(str,"get%s",s->s_name); 00585 00586 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00587 if (ac&&av) { 00588 max = MIN(max,ac); 00589 for (i=0;i<max;i++) { 00590 vals[i]=jit_atom_getfloat(av+i); 00591 } 00592 jit_freebytes(av,sizeof(t_atom)*ac); 00593 } 00594 } 00595 } 00596 return ac; 00597 } 00598 00599 t_jit_err jit_attr_setdouble_array_old(void *x, t_symbol *s, long count, double *vals) 00600 { 00601 t_atom av[256]; 00602 t_jit_err rv=JIT_ERR_GENERIC; 00603 long i; 00604 00605 if (x&&s&&vals) { 00606 for (i=0;i<count;i++) 00607 jit_atom_setfloat(av+i,vals[i]); 00608 rv = (t_jit_err)jit_object_method(x,s,count,av); 00609 } 00610 return rv; 00611 } 00612 00613 long jit_attr_getsym_array_old(void *x, t_symbol *s, long max, t_symbol **vals) 00614 { 00615 long i,ac=0; 00616 t_atom *av=NULL; 00617 char str[256]; 00618 00619 if (x&&s&&vals) { 00620 sprintf(str,"get%s",s->s_name); 00621 00622 if ((((t_jit_err)jit_object_method(x,gensym(str),&ac,&av))==JIT_ERR_NONE)&&av) { 00623 if (ac&&av) { 00624 max = MIN(max,ac); 00625 for (i=0;i<max;i++) { 00626 vals[i]=jit_atom_getsym(av+i); 00627 } 00628 jit_freebytes(av,sizeof(t_atom)*ac); 00629 } 00630 } 00631 } 00632 return ac; 00633 } 00634 00635 t_jit_err jit_attr_setsym_array_old(void *x, t_symbol *s, long count, t_symbol **vals) 00636 { 00637 t_atom av[256]; 00638 t_jit_err rv=JIT_ERR_GENERIC; 00639 long i; 00640 00641 if (x&&s&&vals) { 00642 for (i=0;i<count;i++) 00643 jit_atom_setsym(av+i,vals[i]); 00644 rv = (t_jit_err)jit_object_method(x,s,count,av); 00645 } 00646 return rv; 00647 } 00648 00649 00650 00651 00652 00653 t_jit_err jit_attr_addfilterset_clip(void *x, double min, double max, long usemin, long usemax) 00654 { 00655 void *o; 00656 00657 if (x&&(o=jit_object_new(gensym("jit_attr_filter_clip")))) { 00658 jit_attr_setsym(o,_jit_sym_type,jit_object_method(x,gensym("gettype"))); 00659 jit_attr_setfloat(o,gensym("min"),min); 00660 jit_attr_setfloat(o,gensym("max"),max); 00661 jit_attr_setlong(o,gensym("usemin"),usemin); 00662 jit_attr_setlong(o,gensym("usemax"),usemax); 00663 jit_object_method(x,gensym("filterset"),o); 00664 return JIT_ERR_NONE; 00665 } 00666 return JIT_ERR_GENERIC; 00667 } 00668 00669 t_jit_err jit_attr_addfilterset_clip_scale(void *x, double scale, double min, double max, long usemin, long usemax) 00670 { 00671 void *o; 00672 00673 if (x&&(o=jit_object_new(gensym("jit_attr_filter_clip")))) { 00674 jit_attr_setsym(o,_jit_sym_type,jit_object_method(x,gensym("gettype"))); 00675 jit_attr_setfloat(o,gensym("scale"),scale); 00676 jit_attr_setfloat(o,gensym("min"),min); 00677 jit_attr_setfloat(o,gensym("max"),max); 00678 jit_attr_setlong(o,gensym("usemin"),usemin); 00679 jit_attr_setlong(o,gensym("usemax"),usemax); 00680 jit_attr_setlong(o,gensym("usescale"),1); 00681 jit_object_method(x,gensym("filterset"),o); 00682 return JIT_ERR_NONE; 00683 } 00684 return JIT_ERR_GENERIC; 00685 } 00686 /* 00687 t_jit_err jit_attr_addfilterset_enum(void *x, long argc, t_atom argv) 00688 { 00689 void *o; 00690 long i; 00691 00692 if (x&&(o=jit_object_new(gensym("jit_attr_filter_enum"),argc,argv))) { 00693 jit_attr_setsym(o,_jit_sym_type,jit_object_method(x,gensym("gettype"))); 00694 jit_object_method(x,gensym("filterset"),o); 00695 } 00696 } 00697 */ 00698 t_jit_err jit_attr_addfilterget_clip(void *x, double min, double max, long usemin, long usemax) 00699 { 00700 void *o; 00701 00702 if (x&&(o=jit_object_new(gensym("jit_attr_filter_clip")))) { 00703 jit_attr_setsym(o,_jit_sym_type,jit_object_method(x,gensym("gettype"))); 00704 jit_attr_setfloat(o,gensym("min"),min); 00705 jit_attr_setfloat(o,gensym("max"),max); 00706 jit_attr_setlong(o,gensym("usemin"),usemin); 00707 jit_attr_setlong(o,gensym("usemax"),usemax); 00708 jit_object_method(x,gensym("filterget"),o); 00709 return JIT_ERR_NONE; 00710 } 00711 return JIT_ERR_GENERIC; 00712 } 00713 00714 t_jit_err jit_attr_addfilterget_clip_scale(void *x, double scale, double min, double max, long usemin, long usemax) 00715 { 00716 void *o; 00717 00718 if (x&&(o=jit_object_new(gensym("jit_attr_filter_clip")))) { 00719 jit_attr_setsym(o,_jit_sym_type,jit_object_method(x,gensym("gettype"))); 00720 jit_attr_setfloat(o,gensym("scale"),scale); 00721 jit_attr_setfloat(o,gensym("min"),min); 00722 jit_attr_setfloat(o,gensym("max"),max); 00723 jit_attr_setlong(o,gensym("usemin"),usemin); 00724 jit_attr_setlong(o,gensym("usemax"),usemax); 00725 jit_attr_setlong(o,gensym("usescale"),1); 00726 jit_object_method(x,gensym("filterget"),o); 00727 return JIT_ERR_NONE; 00728 } 00729 return JIT_ERR_GENERIC; 00730 } 00731 00732 t_jit_err jit_attr_addfilter_clip(void *x, double min, double max, long usemin, long usemax) 00733 { 00734 return jit_attr_addfilterset_clip(x, min, max, usemin, usemax); 00735 } 00736 00737 00738 t_jit_err jit_attr_addfilter_clip_scale(void *x, double scale, double min, double max, long usemin, long usemax) 00739 { 00740 t_jit_err err; 00741 err = jit_attr_addfilterset_clip_scale(x, scale, min, max, usemin, usemax); 00742 if (err) return err; 00743 return jit_attr_addfilterget_clip_scale(x, 1./scale, 0, 0, 0, 0); 00744 } 00745 00746 t_jit_err jit_attr_addfilterset_proc(void *x, method proc) 00747 { 00748 void *o; 00749 00750 if (x&&(o=jit_object_new(gensym("jit_attr_filter_proc"),proc))) { 00751 jit_object_method(x,gensym("filterset"),o); 00752 return JIT_ERR_NONE; 00753 } 00754 return JIT_ERR_GENERIC; 00755 } 00756 00757 t_jit_err jit_attr_addfilterget_proc(void *x, method proc) 00758 { 00759 void *o; 00760 00761 if (x&&(o=jit_object_new(gensym("jit_attr_filter_proc"),proc))) { 00762 jit_object_method(x,gensym("filterset"),o); 00763 return JIT_ERR_NONE; 00764 } 00765 return JIT_ERR_GENERIC; 00766 } 00767 00768
Copyright © 2008, Cycling '74