22 t_object *dummy = NULL;
27 int JAMOMA_EXPORT_MAXOBJ
main(
void)
31 common_symbols_init();
33 ps_rolloff = gensym(
"rolloff");
34 ps_src_position = gensym(
"src_position");
35 ps_src_gain = gensym(
"src_gain");
36 ps_src_mute = gensym(
"src_mute");
37 ps_src_blur = gensym(
"blur");
38 ps_dst_position = gensym(
"dst_position");
39 ps_dimensions = gensym(
"dimensions");
40 ps_num_sources = gensym(
"num_sources");
41 ps_num_destinations = gensym(
"num_destinations");
42 ps_jit_matrix = gensym(
"jit_matrix");
43 ps_getdata = gensym(
"getdata");
44 ps_setinfo = gensym(
"setinfo");
48 c = class_new(
"j.dbap",
57 class_addmethod(c, (method)
dbap_blur,
"blur", A_GIMME, 0);
58 class_addmethod(c, (method)
dbap_blurall,
"blurall", A_FLOAT, 0);
59 class_addmethod(c, (method)
dbap_source,
"src_position", A_GIMME, 0);
66 class_addmethod(c, (method)
dbap_hull,
"hull", A_LONG, 0);
68 class_addmethod(c, (method)
dbap_view,
"view", A_GIMME, 0);
70 class_addmethod(c, (method)
dbap_view_size,
"view_size", A_LONG, A_LONG, 0);
72 class_addmethod(c, (method)
dbap_view_end,
"view_end", A_GIMME, 0);
74 class_addmethod(c, (method)
dbap_assist,
"assist", A_CANT, 0);
75 class_addmethod(c, (method)
dbap_info,
"info", 0);
76 class_addmethod(c, (method)object_obex_dumpout,
"dumpout", 0);
79 CLASS_ATTR_LONG(c,
"dimensions", 0, t_dbap, attr_dimensions);
81 CLASS_ATTR_ENUM(c,
"dimensions", 0,
"1 2 3");
83 CLASS_ATTR_LONG(c,
"num_sources", 0, t_dbap, attr_num_sources);
86 CLASS_ATTR_LONG(c,
"num_destinations", 0, t_dbap, attr_num_destinations);
89 CLASS_ATTR_DOUBLE(c,
"rolloff", 0, t_dbap, attr_rolloff);
93 class_register(CLASS_BOX, c);
106 #pragma mark object life
108 void *dbap_new(t_symbol *msg,
long argc, t_atom *argv)
116 object_obex_store(x, _sym_dumpout, (
object *)outlet_new(x,NULL));
117 x->outlet[2] = outlet_new(x, 0);
118 x->outlet[1] = outlet_new(x, 0);
119 x->outlet[0] = outlet_new(x, 0);
123 x->attr_num_sources = 1;
124 x->attr_num_destinations = 1;
125 x->attr_dimensions = 2;
126 x->attr_rolloff = 6.;
128 x->attr_view_update =
false;
129 atom_setsym(&x->last_view[0],gensym(
"all"));
130 atom_setlong(&x->last_view[1],1);
132 x->attr_view_start.x = 0.;
133 x->attr_view_start.y = 0.;
134 x->attr_view_start.z = 0.;
135 x->attr_view_end.x = 22.;
136 x->attr_view_end.y = 15.;
137 x->attr_view_end.z = 0.;
140 jit_matrix_info_default(&x->view_info);
141 x->view_info.type = gensym(
"char");
142 x->view_info.planecount = 1;
143 x->view_info.dimcount = 2;
144 x->view_info.dim[0] = 80;
145 x->view_info.dim[1] = 60;
146 x->view_matrix = jit_object_new(ps_jit_matrix, &x->view_info);
147 x->view_name = jit_symbol_unique();
148 x->view_matrix = jit_object_register(x->view_matrix, x->view_name);
150 for (i=0; i<MAX_NUM_SOURCES; i++) {
151 x->src_position[i].x = 0.;
152 x->src_position[i].y = 0.;
153 x->src_position[i].z = 0.;
154 x->blur[i] = 0.000001;
155 x->src_gain[i] = 1.0;
156 x->src_not_muted[i] = 1.0;
159 for (i=0; i<MAX_NUM_DESTINATIONS; i++) {
160 x->dst_position[i].x = 0.;
161 x->dst_position[i].y = 0.;
162 x->dst_position[i].z = 0.;
165 for (i=0;i<MAX_NUM_WEIGHTED_SOURCES;i++) {
166 for (j=0;j<MAX_NUM_WEIGHTED_DESTINATIONS;j++) {
167 x->src_weight[i][j] = 1.;
176 x->hull2.num_dst = 0;
178 attr_args_process(x, argc, argv);
185 void dbap_free(t_dbap *x)
188 jit_object_unregister(x->view_matrix);
191 jit_object_free(x->view_matrix);
202 void dbap_blur(t_dbap *x, t_symbol *msg,
long argc, t_atom *argv)
207 if ((argc>=2) && argv) {
208 n = atom_getlong(argv)-1;
209 if ( (n<0) || (n>=MAX_NUM_SOURCES) ) {
210 error(
"Invalid argument(s) for blur");
214 f = atom_getfloat(argv);
222 error(
"Invalid argument(s) for blur");
232 for (i=0; i<x->attr_num_sources; i++) {
244 if (argc >= (x->attr_dimensions + 1)) {
245 n = atom_getlong(argv)-1;
246 if ( (n<0) || (n>=MAX_NUM_SOURCES) ) {
247 error(
"Invalid arguments for source.");
250 switch (x->attr_dimensions)
253 x->src_position[n].x = atom_getfloat(argv+1);
256 x->src_position[n].x = atom_getfloat(argv+1);
257 x->src_position[n].y = atom_getfloat(argv+2);
260 x->src_position[n].x = atom_getfloat(argv+1);
261 x->src_position[n].y = atom_getfloat(argv+2);
262 x->src_position[n].z = atom_getfloat(argv+3);
268 error(
"Invalid arguments for source.");
277 if (argc >= (x->attr_dimensions + 1)) {
278 n = atom_getlong(argv)-1;
279 if ( (n<0) || (n>=MAX_NUM_DESTINATIONS) ) {
280 error(
"Invalid arguments for destination.");
283 switch (x->attr_dimensions)
286 x->dst_position[n].x = atom_getfloat(argv+1);
289 x->dst_position[n].x = atom_getfloat(argv+1);
290 x->dst_position[n].y = atom_getfloat(argv+2);
293 x->dst_position[n].x = atom_getfloat(argv+1);
294 x->dst_position[n].y = atom_getfloat(argv+2);
295 x->dst_position[n].z = atom_getfloat(argv+3);
304 error(
"Invalid arguments for speaker.");
313 if ((argc>=2) && argv) {
314 n = atom_getlong(argv)-1;
315 if ( (n<0) || (n>=MAX_NUM_SOURCES) ) {
316 error(
"Invalid argument(s) for source_gain");
320 f = atom_getfloat(argv);
327 error(
"Invalid argument(s) for source_gain");
337 if (x->master_gain<0.)
341 for (i=0; i<x->attr_num_sources; i++)
352 if (atom_gettype(argv) == A_LONG) {
353 source = atom_getlong(argv)-1;
355 if ((source < 0)||(source >= x->attr_num_sources)) {
356 object_error((t_object*)x,
"src_weight : the source n°%d doesn't exist", source+1);
361 object_error((t_object*)x,
"src_weight : no source id");
365 for (i=0; i<x->attr_num_destinations; i++) {
368 if (atom_gettype(&argv[i+1]) == A_LONG)
369 weight = (float)atom_getlong(&argv[i+1]);
371 if (atom_gettype(&argv[i+1]) == A_FLOAT)
372 weight = atom_getfloat(&argv[i+1]);
380 x->src_weight[source][i] = weight;
387 object_error((t_object*)x,
"src_weight : needs arguments");
394 if ((argc>=2) && argv) {
395 n = atom_getlong(argv)-1;
396 if ( (n<0) || (n>=MAX_NUM_SOURCES) ) {
397 error(
"Invalid argument(s) for source_mute");
401 x->src_not_muted[n] = (atom_getfloat(argv)==0.0);
405 error(
"Invalid argument(s) for source_mute");
411 bool refresh =
false;
417 if (x->attr_dimensions == 1) {
418 if ((x->hull1.min == 0.)&&(x->hull1.max == 0.)) refresh =
true;
420 else if (x->attr_dimensions == 2) {
421 if (x->hull2.num_dst == 0) refresh =
true;
429 void dbap_view(t_dbap *x,
void *msg,
long argc, t_atom *argv)
435 jit_object_method(x->view_matrix, _sym_clear);
437 if ((argc==2) && argv) {
438 if ((atom_gettype(argv) == A_LONG) && (atom_gettype(argv+1) == A_LONG)) {
439 dst = atom_getlong(argv)-1;
440 src = atom_getlong(argv+1)-1;
441 if ((src<0) || (src>=MAX_NUM_SOURCES) || (dst<0) || (dst>=MAX_NUM_DESTINATIONS)) {
442 error(
"Invalid argument(s) for view");
448 if ((atom_gettype(argv) == A_SYM) && (atom_gettype(argv+1) == A_LONG)) {
449 all = atom_getsym(argv);
450 src = atom_getlong(argv+1)-1;
451 if ((src<0) || (src>=MAX_NUM_SOURCES) || (all != gensym(
"all"))) {
452 error(
"Invalid argument(s) for view");
457 for (i=0; i<x->attr_num_destinations; i++) {
458 if (x->src_weight[src][i] > 0)
467 x->last_view[0] = argv[0];
468 x->last_view[1] = argv[1];
471 error(
"Invalid argument(s) for view");
477 x->attr_view_update = io > 0;
485 if ((sizeX > 0)&&(sizeY > 0)) {
488 if ((sizeX > MAX_SIZE_VIEW_X)||(sizeY > MAX_SIZE_VIEW_Y))
489 object_warn((t_object*)x,
"size over %d x %d takes time to render", MAX_SIZE_VIEW_X, MAX_SIZE_VIEW_Y);
491 x->view_info.dim[0] = sizeX;
492 x->view_info.dim[1] = sizeY;
495 jit_object_method(x->view_matrix, ps_setinfo, &x->view_info);
500 error(
"Invalid argument(s) for view_size");
506 if ((argc == x->attr_dimensions) && argv) {
507 if (atom_gettype(argv) == A_FLOAT)
508 x->attr_view_start.x = atom_getfloat(argv);
514 if (atom_gettype(argv+1) == A_FLOAT)
515 x->attr_view_start.y = atom_getfloat(argv+1);
521 if (atom_gettype(argv+2) == A_FLOAT)
522 x->attr_view_start.z = atom_getfloat(argv+2);
529 error(
"Invalid argument(s) for view_start");
535 if ((argc == x->attr_dimensions) && argv) {
536 if (atom_gettype(argv) == A_FLOAT)
537 x->attr_view_end.x = atom_getfloat(argv);
543 if (atom_gettype(argv+1) == A_FLOAT)
544 x->attr_view_end.y = atom_getfloat(argv+1);
550 if (atom_gettype(argv+2) == A_FLOAT)
551 x->attr_view_end.z = atom_getfloat(argv+2);
558 error(
"Invalid argument(s) for view_end");
566 atom_setfloat(&a[0], x->attr_rolloff);
567 object_obex_dumpout(x, ps_rolloff, 1, a);
569 atom_setlong(&a[0], x->attr_dimensions);
570 object_obex_dumpout(x, ps_dimensions, 1, a);
572 atom_setlong(&a[0], x->attr_num_sources);
573 object_obex_dumpout(x, ps_num_sources, 1, a);
575 for (i=0; i<x->attr_num_sources; i++) {
576 atom_setlong(&a[0], i+1);
577 atom_setfloat(&a[1], x->src_position[i].x);
578 atom_setfloat(&a[2], x->src_position[i].y);
579 atom_setfloat(&a[3], x->src_position[i].z);
580 object_obex_dumpout(x, ps_src_position, x->attr_dimensions+1, a);
581 atom_setfloat(&a[1], x->src_gain[i]);
582 object_obex_dumpout(x, ps_src_gain, 2, a);
583 atom_setlong(&a[1], (x->src_not_muted[i]==0));
584 object_obex_dumpout(x, ps_src_mute, 2, a);
585 atom_setfloat(&a[1], x->blur[i]);
586 object_obex_dumpout(x, ps_src_blur, 2, a);
589 atom_setlong(&a[0], x->attr_num_destinations);
590 object_obex_dumpout(x, ps_num_destinations, 1, a);
592 for (i=0; i<x->attr_num_destinations; i++) {
593 atom_setlong(&a[0], i+1);
594 atom_setfloat(&a[1], x->dst_position[i].x);
595 atom_setfloat(&a[2], x->dst_position[i].y);
596 atom_setfloat(&a[3], x->dst_position[i].z);
597 object_obex_dumpout(x, ps_dst_position, x->attr_dimensions+1, a);
603 void dbap_assist(t_dbap *x,
void *b,
long msg,
long arg,
char *dst)
610 strcpy(dst,
"set source and speaker positions");
619 strcpy(dst,
"(list) messages for matrix~");
622 strcpy(dst,
"(list) distance from convex hull");
625 strcpy(dst,
"(jit_matrix) visualization");
628 strcpy(dst,
"dumpout");
638 #pragma mark attribute accessors
646 n = atom_getlong(argv);
649 x->attr_dimensions = n;
662 n = atom_getlong(argv);
665 if (n>MAX_NUM_SOURCES)
667 x->attr_num_sources = n;
678 n = atom_getlong(argv);
681 if (n>MAX_NUM_DESTINATIONS)
682 n = MAX_NUM_DESTINATIONS;
683 x->attr_num_destinations = n;
698 f = atom_getfloat(argv);
700 error(
"Invalid argument for rolloff. Must be > 0");
707 for (i=0; i<x->attr_num_sources; i++)
718 #pragma mark calculations
724 if (x->attr_dimensions == 1)
727 else if (x->attr_dimensions == 2)
743 double dia[MAX_NUM_DESTINATIONS];
747 xPos = x->src_position[n].x;
751 if (xPos < x->hull1.min) {
752 dist = x->hull1.min - xPos;
755 else if (xPos > x->hull1.max) {
756 dist = xPos - x->hull1.max;
762 atom_setlong(&a[0], n);
763 atom_setfloat(&a[1], dist);
764 outlet_anything(x->outlet[1], _sym_list, 2, a);
767 r2 = x->blur[n] * x->variance;
770 for (i=0; i<x->attr_num_destinations; i++) {
771 dx = xPos - x->dst_position[i].x;
772 dia[i] = pow(dx*dx + r2, 0.5*x->a);
773 k2inv = k2inv + (x->src_weight[n][i]*x->src_weight[n][i])/(dia[i]*dia[i]);
776 k = k*x->master_gain*x->src_gain[n]*x->src_not_muted[n];
778 atom_setlong(&a[0], n);
779 for (i=0; i<x->attr_num_destinations; i++) {
780 atom_setlong(&a[1], i);
781 atom_setfloat(&a[2], x->src_weight[n][i]*k/dia[i]);
782 outlet_anything(x->outlet[0], _sym_list, 3, a);
793 double dia[MAX_NUM_DESTINATIONS];
794 double sdia[MAX_NUM_DESTINATIONS];
798 double kCN, dist, min_dist;
804 r2 = x->blur[n] * x->variance;
807 for (i=0; i<x->attr_num_destinations; i++) {
808 dx = x->src_position[n].
x - x->dst_position[i].x;
809 dy = x->src_position[n].y - x->dst_position[i].y;
810 dia[i] = pow((dx*dx + dy*dy + r2), (0.5*x->a));
811 if (x->hull_io) sdia[i] = dx*dx + dy*dy;
813 k2inv = k2inv + (x->src_weight[n][i]*x->src_weight[n][i])/(dia[i]*dia[i]);
820 for (j=0; j<x->hull2.num_dst; j++) {
822 iC = x->hull2.id_dst[j];
823 iN = x->hull2.id_dst[(j+1)%x->hull2.num_dst];
828 sCN = x->hull2.dst2next[j];
829 kCN = (sSC + sCN - sSN)/sCN;
840 P.
x = (kCN/2) * (x->dst_position[iN].x - x->dst_position[iC].x) + x->dst_position[iC].x;
841 P.
y = (kCN/2) * (x->dst_position[iN].y - x->dst_position[iC].y) + x->dst_position[iC].y;
843 dx = x->src_position[n].x - P.
x;
844 dy = x->src_position[n].y - P.
y;
845 dist = sqrt(dx*dx + dy*dy);
850 v = (x->dst_position[iN].x - x->dst_position[iC].x)*(x->src_position[n].y - x->dst_position[iC].y);
851 v -= (x->dst_position[iN].y - x->dst_position[iC].y)*(x->src_position[n].x - x->dst_position[iC].x);
854 if (dist < min_dist) {
856 if (sSC < sSN) id_min = iC;
861 atom_setlong(&a[0],n+1);
862 atom_setfloat(&a[1],out*min_dist);
863 atom_setlong(&a[2],id_min+1);
864 outlet_anything(x->outlet[1], _sym_list, 3, a);
868 k = k*x->master_gain*x->src_gain[n]*x->src_not_muted[n];
870 atom_setlong(&a[0], n);
871 for (i=0; i<x->attr_num_destinations; i++) {
872 atom_setlong(&a[1], i);
873 atom_setfloat(&a[2], x->src_weight[n][i]*k/dia[i]);
874 outlet_anything(x->outlet[0], _sym_list, 3, a);
884 double dia[MAX_NUM_DESTINATIONS];
890 r2 = x->blur[n] * x->variance;
893 for (i=0; i<x->attr_num_destinations; i++) {
894 dx = x->src_position[n].x - x->dst_position[i].x;
895 dy = x->src_position[n].y - x->dst_position[i].y;
896 dz = x->src_position[n].z - x->dst_position[i].z;
897 dia[i] = pow(
double(dx*dx + dy*dy + dz*dz + r2),
double(0.5*x->a));
898 k2inv = k2inv + (x->src_weight[n][i]*x->src_weight[n][i])/(dia[i]*dia[i]);
901 k = k*x->master_gain*x->src_gain[n]*x->src_not_muted[n];
903 atom_setlong(&a[0], n);
905 for (i=0; i<x->attr_num_destinations; i++) {
906 atom_setlong(&a[1], i);
907 atom_setfloat(&a[2], x->src_weight[n][i]*k/dia[i]);
908 outlet_anything(x->outlet[0], _sym_list, 3, a);
915 x->a = log(pow(10., (x->attr_rolloff / 20.)))/log(2.);
927 for (i=0; i<x->attr_num_destinations; i++) {
928 a += x->dst_position[i].x;
929 b += x->dst_position[i].y;
930 c += x->dst_position[i].z;
932 x->mean_dst_position.x = a/x->attr_num_destinations;
933 x->mean_dst_position.y = b/x->attr_num_destinations;
934 x->mean_dst_position.z = c/x->attr_num_destinations;
947 if (x->attr_dimensions == 1) {
948 for (i=0; i<x->attr_num_destinations; i++) {
949 dx = x->dst_position[i].x - x->mean_dst_position.x;
953 else if (x->attr_dimensions == 2) {
954 for (i=0; i<x->attr_num_destinations; i++) {
955 dx = x->dst_position[i].x - x->mean_dst_position.x;
956 dy = x->dst_position[i].y - x->mean_dst_position.y;
961 for (i=0; i<x->attr_num_destinations; i++) {
962 dx = x->dst_position[i].x - x->mean_dst_position.x;
963 dy = x->dst_position[i].y - x->mean_dst_position.y;
964 dz = x->dst_position[i].z - x->mean_dst_position.z;
965 d2 += dx*dx + dy*dy + dz*dz;
968 x->variance = sqrt(d2/(x->attr_num_destinations-1));
971 for (i=0; i<x->attr_num_sources; i++)
979 if (x->attr_dimensions == 1)
982 else if (x->attr_dimensions == 2)
996 min = x->dst_position[0].x;
997 max = x->dst_position[0].x;
999 for (i=1; i<x->attr_num_destinations; i++) {
1000 if (x->dst_position[i].x < min)
1001 min = x->dst_position[i].x;
1002 if (x->dst_position[i].x > max)
1003 max = x->dst_position[i].x;
1019 if (x->attr_num_destinations < 2)
return;
1020 else h2.nb_point = x->attr_num_destinations;
1023 for (i = 0; i<x->attr_num_destinations; i++) {
1024 h2.point[i].v[X] = (double) x->dst_position[i].x;
1025 h2.point[i].v[Y] = (
double) x->dst_position[i].y;
1026 h2.point[i].vnum = i+1;
1027 h2.point[i].del =
false;
1032 for (i = 1; i<x->attr_num_destinations; i++) {
1033 if ((h2.point[i].v[Y] < h2.point[m].v[Y]) || ((h2.point[i].v[Y] == h2.point[m].v[Y]) && (h2.point[i].v[X] > h2.point[m].v[X]))) {
1046 for (i = 0; i<x->attr_num_destinations; i++) {
1047 h2.point[i].p0[0] = h2.point[0].v[0];
1048 h2.point[i].p0[1] = h2.point[0].v[1];
1056 x->attr_num_destinations-1,
1057 sizeof(t_structPoint),
1063 for (i = 1; i<x->attr_num_destinations; i++) {
1064 if (h2.point[i].del) h2.nb_delete++;
1071 if (h2.nb_delete > 0) {
1074 while (i < x->attr_num_destinations) {
1075 if (!h2.point[i].del) {
1082 else Delete(h2.point,i);
1091 h2.stack = Graham(h2);
1103 x->hull2.id_dst[i] = (h2.stack->p->vnum)-1;
1107 dx = x->dst_position[x->hull2.id_dst[i-1]].x - x->dst_position[x->hull2.id_dst[i]].x;
1108 dy = x->dst_position[x->hull2.id_dst[i-1]].y - x->dst_position[x->hull2.id_dst[i]].y;
1109 x->hull2.dst2next[i-1] = dx*dx + dy*dy;
1113 h2.stack = h2.stack->next;
1116 x->hull2.num_dst = i;
1118 dx = x->dst_position[x->hull2.id_dst[i-1]].x - x->dst_position[x->hull2.id_dst[0]].x;
1119 dy = x->dst_position[x->hull2.id_dst[i-1]].y - x->dst_position[x->hull2.id_dst[0]].y;
1120 x->hull2.dst2next[i-1] = dx*dx + dy*dy;
1132 void dbap_hull2_postpoint(t_dbap *x, t_H2D h2)
1135 post(
"H2D : %d points", h2.nb_point);
1136 for (i = 0; i<x->attr_num_destinations; i++)
1137 if (!h2.point[i].del)
1138 post(
"vnum = %d, x = %f, y = %f",
1139 h2.point[i].vnum, h2.point[i].v[X], h2.point[i].v[Y]);
1151 if (x->attr_dimensions == 1)
1154 else if (x->attr_dimensions == 2)
1164 if (x->attr_view_update)
1165 defer_low(x,(method)
dbap_view, gensym(
"view"), 2, x->last_view);
1170 post(
"TODO: 1D render view");
1179 double dia[MAX_NUM_DESTINATIONS];
1180 double div_x, div_y;
1188 jit_object_method(x->view_matrix,ps_getdata, &bp);
1192 div_x = (x->attr_view_end.x - x->attr_view_start.x)/x->view_info.dim[0];
1193 div_y = (x->attr_view_end.y - x->attr_view_start.y)/x->view_info.dim[1];
1196 for (i=0; i<x->view_info.dim[0]; i++) {
1198 for (j=0 ; j<x->view_info.dim[1]; j++) {
1200 temp_src.
x = x->attr_view_start.x + i * div_x;
1201 temp_src.
y = x->attr_view_start.y + j * div_y;
1206 r2 = x->blur[src] * x->variance;
1210 for (d=0; d<x->attr_num_destinations; d++) {
1211 dx = temp_src.
x - x->dst_position[d].x;
1212 dy = temp_src.
y - x->dst_position[d].y;
1213 dia[d] = pow(
double(dx*dx + dy*dy + r2),
double(0.5*x->a));
1214 k2inv = k2inv + (x->src_weight[src][d]*x->src_weight[src][d])/(dia[d]*dia[d]);
1219 pix = k*x->src_weight[src][dst]/ dia[dst];
1221 val = (
unsigned char)(pix*255.);
1224 p = bp + i + (x->view_info.dim[1] - j-1)*x->view_info.dim[0];
1227 if (*((
unsigned char *)p) < val)
1228 *((
unsigned char *)p) = val;
1235 post(
"TODO: 3D render view");
1241 atom_setsym(&m[0], x->view_name);
1242 outlet_anything(x->outlet[2], _sym_jit_matrix, 1, m);
void dbap_calculate_view2D(t_dbap *x, long dst, long src)
Calculate the view (2D-matrix) : 2D.
t_max_err dbap_attr_setdimensions(t_dbap *x, void *attr, long argc, t_atom *argv)
Set number of dimensions of the system.
void dbap_mastergain(t_dbap *x, double f)
Set master gain for all values passed from the object to matrix~.
void dbap_calculate_hull3D(t_dbap *x, long n)
Calculate convex hull of space spanned by destination points: 3D.
void dbap_calculate_a(t_dbap *x)
Calculation of exponent coefficient based on rolloff.
void dbap_assist(t_dbap *x, void *b, long msg, long arg, char *dst)
Display assist strings while patching.
void dbap_sourceweight(t_dbap *x, t_symbol *msg, long argc, t_atom *argv)
Set weight for nth source by passing a list to balance each destination.
t_max_err dbap_attr_setnum_destinations(t_dbap *x, void *attr, long argc, t_atom *argv)
Set the number of destinations of the system.
void dbap_calculate_mean_dst_position(t_dbap *x)
Calculate mean position of the destination points.
void dbap_calculate_hull(t_dbap *x, long n)
Calculate convex hull of space spanned by destination points.
void dbap_calculate1D(t_dbap *x, long n)
Calculate matrix coefficients for nth source: 1D space.
void dbap_calculate_hull2D(t_dbap *x, long n)
Calculate convex hull of space spanned by destination points: 2D.
void dbap_output_view(t_dbap *x)
Output the calculated view.
void dbap_calculate_hull1D(t_dbap *x, long n)
Calculate convex hull of space spanned by destination points: 1D.
int JAMOMA_EXPORT_MAXOBJ main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
t_max_err dbap_attr_setrolloff(t_dbap *x, void *attr, long argc, t_atom *argv)
Set rolloff in dB.
void dbap_view(t_dbap *x, void *msg, long argc, t_atom *argv)
Display a hitmap view of the dbap for a destination and a source weight config or all (on the info ou...
void dbap_calculate_view3D(t_dbap *x, long dst, long src)
Calculate the view (2D-matrix) : 3D.
void dbap_view_update(t_dbap *x, long io)
Turn on/off the auto view updating.
void dbap_calculate2D(t_dbap *x, long n)
Calculate matrix coefficients for nth source: 2D space.
void dbap_source(t_dbap *x, void *msg, long argc, t_atom *argv)
Set the position of the nth virtual source.
void dbap_calculate(t_dbap *x, long n)
General method for calculation of matrix coefficient for nth source.
void dbap_calculate_view(t_dbap *x, long dst, long src)
Calculate the view (2D-matrix)
void dbap_hull(t_dbap *x, long f)
Turn on/off the calculation of distance to hull.
void dbap_view_start(t_dbap *x, void *msg, long argc, t_atom *argv)
Set the start point of the hitmap view window.
void dbap_calculate_view1D(t_dbap *x, long dst, long src)
Calculate the view (2D-matrix) : 1D.
void dbap_view_end(t_dbap *x, void *msg, long argc, t_atom *argv)
Set the end point of the hitmap view window.
t_max_err dbap_attr_setnum_sources(t_dbap *x, void *attr, long argc, t_atom *argv)
Set the number of sources of the system.
void dbap_blur(t_dbap *x, t_symbol *msg, long argc, t_atom *argv)
Set spatial blur for nth source.
void dbap_destination(t_dbap *x, void *msg, long argc, t_atom *argv)
Set the position of the nth speaker.
void dbap_blurall(t_dbap *x, double f)
Set spatial blur for all sources.
j.dbap - Distance Based Amplitude Panning
void dbap_info(t_dbap *x)
Get info on destination setup ++.
void dbap_sourcegain(t_dbap *x, void *msg, long argc, t_atom *argv)
Set input gain for nth source.
void dbap_calculate_variance(t_dbap *x)
Calculate bias-corrected variance of distance from destination points to mean destination point...
void dbap_sourcemute(t_dbap *x, void *msg, long argc, t_atom *argv)
Mute and unmute sources.
void dbap_update_view(t_dbap *x)
If the attr_view_update is true : calculate the last view.
Data structure for storing a 1,2 or 3 dimensional space data.
t_class * this_class
Required. Global pointing to this class.
void dbap_view_size(t_dbap *x, long sizeX, long sizeY)
Set the size of hitmap view window.
void dbap_calculate3D(t_dbap *x, long n)
Calculate matrix coefficients for nth source: 3D space.