void *op_slider(t_brick *brick) { void *data = brick->plug_intern.data; t_data_type type = brick->plug_intern.data_type; switch( brick->state_pressed) { case BRICK_LEFT: switch( type) { case dt_int: set_int( data, drf_int( data) - 1); break; case dt_float: set_float( data, drf_float( data) - .1); break; default: break; } break; case BRICK_RIGHT: switch( type) { case dt_int: set_int( data, drf_int( data) + 1); break; case dt_float: set_float( data, drf_float( data) + .1); break; default: break; } break; default: break; } return NULL; }
void __cls_plug_flow_int(t_plug_mode mode,t_plug *plug,t_plug *src_plug) { if(src_plug) { t_data_type src_type=src_plug->data_type; int *data=plug->data; float increment=plug->brick->var.increment; switch(src_type) { case dt_int: *data=drf_int(src_plug->data); break; case dt_float: *data=(int)drf_float(src_plug->data); break; case dt_lst: break; default: plug_warning(plug,src_plug); break; } if(increment) *data=*data * increment; } }
void vlst_float_add(t_vlst *vlst,t_data_type type,void *data) { int count=vlst->count; int length=vlst->length; int i,j; float *data_dst=vlst->data; for(i=0;i<count;i++) { for(j=0;j<length;j++) { switch(type) { case(dt_int): *data_dst += (float)drf_int(data); break; case(dt_float): *data_dst += drf_float(data); break; default:printf("? ? !!\n"); } data_dst++; } } }