Skip to content

Commit

Permalink
improve support for list of parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreguillot committed Jul 18, 2018
1 parent 3ff0f4b commit c54a710
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 20 deletions.
111 changes: 94 additions & 17 deletions external/faustgen~-help.pd
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ the redering, f 55;
#X text 84 116 Print faustgen~ informations;
#X connect 1 0 4 0;
#X connect 6 0 4 0;
#X restore 247 235 pd options;
#X restore 287 185 pd options;
#N canvas 287 129 388 208 recompilation 0;
#X obj 17 75 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
Expand All @@ -64,22 +64,99 @@ f 37;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 6 0 2 0;
#X restore 247 264 pd recompilation;
#N canvas 467 328 450 300 controls 0;
#X obj 30 168 dac~ 1 2;
#X obj 30 107 osc~ 220;
#X msg 92 107 gain \$1;
#X obj 92 87 nbx 5 14 0 1 0 0 empty empty Gain 0 -8 0 10 -262144 -1
-1 0 256;
#X obj 30 135 faustgen~ examples/resonator -vs 64 -vec;
#X msg 161 105 print;
#X connect 1 0 4 0;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X connect 4 0 0 0;
#X connect 4 0 0 1;
#X connect 5 0 4 0;
#X restore 247 293 pd controls;
#X restore 287 214 pd recompilation;
#N canvas 364 121 646 630 control 0;
#X obj 30 598 dac~ 1 2;
#X msg 45 195 print;
#N canvas 0 22 450 278 (subpatch) 0;
#X array \$0-gains 20 float 3;
#A 0 0.706521 0.597826 0.521739 0.521739 0.521739 0.378572 0.442858
0.528573 0.621431 0.685717 0.792861 0.921433 0.950004 0.950004 0.950004
0.871432 0.792861 0.607145 0.578574 0.3;
#X coords 0 1 20 0 199 92 1 0 0;
#X restore 397 74 graph;
#N canvas 0 22 450 278 (subpatch) 0;
#X array \$0-decays 20 float 3;
#A 0 0.0652173 0.0978258 0.119565 0.152173 0.206521 0.260868 0.326085
0.402172 0.456519 0.521736 0.65217 0.706518 0.771735 0.804344 0.804344
0.804344 0.771735 0.749996 0.66304 0.608692;
#X coords 0 1 20 0 199 92 1 0 0;
#X restore 397 198 graph;
#N canvas 0 22 450 278 (subpatch) 0;
#X array \$0-freq 20 float 3;
#A 0 0.0652173 6956.52 6956.52 8260.87 9347.82 10434.8 11956.5 13478.2
15000 16521.7 17608.7 18478.2 19130.4 18913 18260.8 14782.6 11304.3
9347.82 8695.65 0.608692;
#X coords 0 20000 20 0 199 92 1 0 0;
#X restore 397 328 graph;
#X obj 30 107 noise~;
#X obj 30 525 faustgen~ examples/resonator;
#X obj 119 177 list trim;
#X obj 119 155 list prepend gain 0;
#X obj 119 133 array get \$0-gains;
#X obj 119 112 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X text 17 13 Use lists of values to control the lists of parameters.
The first element of the list must be the name of the parameter \,
the second argument is the index of the first parameters the other
arguments are the list., f 44;
#X obj 139 291 list trim;
#X obj 139 227 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 139 248 array get \$0-decays 2 4;
#X obj 139 270 list prepend decay 2;
#X text 44 145 Print to display the parameters' information, f 11
;
#X obj 203 320 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 203 362 freq 4 \$1;
#X obj 203 341 array get \$0-decays 3 1;
#X text 395 10 Change the value of the arrays and use the bangs to
send them to the faustgen~ object, f 33;
#X text 116 84 Set the values of all the "gain" parameters, f 23;
#X text 137 199 Set the values of 4 "decay" parameters starting with
the index 2, f 36;
#X text 201 292 Set the value of the 3rd "freq" parameter, f 23;
#X obj 201 481 list trim;
#X obj 201 417 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 256 416 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10
-262144 -1 -1 0 256;
#X obj 312 416 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10
-262144 -1 -1 0 256;
#X obj 201 438 array get \$0-decays;
#X obj 201 460 list prepend decay 0;
#X text 199 388 Dynamic approach, f 9;
#X text 254 398 Index;
#X text 312 398 Size;
#X obj 30 566 *~;
#X obj 45 546 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X connect 1 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 33 0;
#X connect 7 0 6 0;
#X connect 8 0 7 0;
#X connect 9 0 8 0;
#X connect 10 0 9 0;
#X connect 12 0 6 0;
#X connect 13 0 14 0;
#X connect 14 0 15 0;
#X connect 15 0 12 0;
#X connect 17 0 19 0;
#X connect 18 0 6 0;
#X connect 19 0 18 0;
#X connect 24 0 6 0;
#X connect 25 0 28 0;
#X connect 26 0 28 1;
#X connect 26 0 29 1;
#X connect 27 0 28 2;
#X connect 28 0 29 0;
#X connect 29 0 24 0;
#X connect 33 0 0 0;
#X connect 33 0 0 1;
#X connect 34 0 33 1;
#X restore 287 243 pd control lists;
#X connect 1 0 2 0;
#X connect 4 0 19 0;
#X connect 5 0 6 0;
Expand Down
16 changes: 13 additions & 3 deletions src/faustgen_tilde.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,23 @@ static void faustgen_tilde_anything(t_faustgen_tilde *x, t_symbol* s, int argc,
return;
}
start = (int)argv[0].a_w.w_float;
for(i = 0; i < argc; ++i)
for(i = 0; i < argc - 1; ++i)
{
sprintf(name, "%s %i", s->s_name, start+i);
if(start+i < 10)
{
sprintf(name, "%s %i", s->s_name, start+i);
}
else if(start+i < 100)
{
sprintf(name, "%s %i", s->s_name, start+i);
}
else
{
sprintf(name, "%s%i", s->s_name, start+i);
}
if(argv[i+1].a_type != A_FLOAT)
{
pd_error(x, "faustgen~: active parameter requires a float value");
return;
}
if(faust_ui_manager_set(x->f_ui_manager, gensym(name), argv[i+1].a_w.w_float))
{
Expand Down

0 comments on commit c54a710

Please sign in to comment.