summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/synti/zynaddsubfx/UI/FilterUI.fl
blob: 44b50b94d26c39fd5d2064a59f8e6d62dd084cd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# data file for the Fltk User Interface Designer (fluid)
version 1.0106 
header_name {.h} 
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} 

decl {//License: GNU GPL version 2} {} 

decl {\#include "WidgetPDial.h"} {public
} 

decl {\#include <stdio.h>} {public
} 

decl {\#include <stdlib.h>} {public
} 

decl {\#include "../globals.h"} {public
} 

decl {\#include <FL/Fl_Group.H>} {public
} 

decl {\#include "../Params/FilterParams.h"} {public
} 

decl {\#include <FL/Fl_Box.H>} {public
} 

decl {\#include <FL/fl_draw.H>} {public
} 

decl {\#include <FL/fl_ask.H>} {public
} 

decl {\#include "PresetsUI.h"} {public
} 

class FormantFilterGraph {: {public Fl_Box}
} {
  Function {FormantFilterGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
    code {pars=NULL;
nvowel=NULL;
nformant=NULL;
graphpoints=NULL;} {}
  }
  Function {init(FilterParams *pars_,int *nvowel_,int *nformant_)} {} {
    code {pars=pars_;
nvowel=nvowel_;
nformant=nformant_;
oldx=-1;
graphpoints=new REALTYPE [w()];} {}
  }
  Function {draw_freq_line(REALTYPE freq,int type)} {} {
    code {REALTYPE freqx=pars->getfreqpos(freq);
switch(type){
  case 0:fl_line_style(FL_SOLID);break;
  case 1:fl_line_style(FL_DOT);break;
  case 2:fl_line_style(FL_DASH);break;
}; 


if ((freqx>0.0)&&(freqx<1.0))
   fl_line(x()+(int) (freqx*w()),y(),
   x()+(int) (freqx*w()),y()+h());} {}
  }
  Function {draw()} {open
  } {
    code {int maxdB=30;
int ox=x(),oy=y(),lx=w(),ly=h(),i,oiy;
REALTYPE freqx;

fl_color(FL_BLACK);
fl_rectf(ox,oy,lx,ly);


//draw the lines
fl_color(FL_GRAY);

fl_line_style(FL_SOLID);
//fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2);

freqx=pars->getfreqpos(1000.0);
if ((freqx>0.0)&&(freqx<1.0))
   fl_line(ox+(int) (freqx*lx),oy,
    ox+(int) (freqx*lx),oy+ly);

for (i=1;i<10;i++){
   if(i==1){
     draw_freq_line(i*100.0,0);
     draw_freq_line(i*1000.0,0);
   }else 
    if (i==5){
      draw_freq_line(i*100.0,2);
      draw_freq_line(i*1000.0,2);
    }else{
      draw_freq_line(i*100.0,1);
      draw_freq_line(i*1000.0,1);
    };
};

draw_freq_line(10000.0,0);
draw_freq_line(20000.0,1);

fl_line_style(FL_DOT);
int GY=10;if (ly<GY*3) GY=-1;
for (i=1;i<GY;i++){
   int tmp=(int)(ly/(REALTYPE)GY*i);
   fl_line(ox+2,oy+tmp,ox+lx-2,oy+tmp);
};

fl_color(FL_YELLOW);
fl_font(FL_HELVETICA,10);
if (*nformant<pars->Pnumformants){
   draw_freq_line(pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq),2);

//show some information (like current formant frequency,amplitude)
   char tmpstr[20];

   snprintf(tmpstr,20,"%.2f kHz",pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq)*0.001);
   fl_draw(tmpstr,ox+1,oy+1,40,12,FL_ALIGN_LEFT,NULL,0);

   snprintf(tmpstr,20,"%d dB",(int)( rap2dB(1e-9 + pars->getformantamp(pars->Pvowels[*nvowel].formants[*nformant].amp)) + pars->getgain() ));
   fl_draw(tmpstr,ox+1,oy+15,40,12,FL_ALIGN_LEFT,NULL,0);

};

//draw the data

fl_color(FL_RED);
fl_line_style(FL_SOLID);

pars->formantfilterH(*nvowel,lx,graphpoints);

oiy=(int) ((graphpoints[0]/maxdB+1.0)*ly/2.0);
for (i=1;i<lx;i++){
   int iy=(int) ((graphpoints[i]/maxdB+1.0)*ly/2.0);
   if ((iy>=0)&&(oiy>=0)&&(iy<ly)&&(oiy<lx))
      fl_line(ox+i-1,oy+ly-oiy,ox+i,oy+ly-iy);
   oiy=iy;
};} {}
  }
  Function {~FormantFilterGraph()} {} {
    code {delete(graphpoints);} {}
  }
  decl {FilterParams *pars;} {}
  decl {int oldx,oldy;} {}
  decl {int *nvowel,*nformant;} {}
  decl {REALTYPE *graphpoints;} {}
} 

class FilterUI {: {public Fl_Group,PresetsUI_}
} {
  Function {FilterUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {pars=NULL;
velsnsamp=NULL;
velsns=NULL;
nvowel=0;nformant=0;nseqpos=0;} {}
  }
  Function {~FilterUI()} {} {
    code {filterui->hide();
formantparswindow->hide();
hide();
//delete (filterui);
delete (formantparswindow);} {}
  }
  Function {make_window()} {} {
    Fl_Window filterui {
      xywh {211 312 275 75} type Double color 50 labelfont 1 hide
      class Fl_Group
    } {
      Fl_Group filterparamswindow {
        label {Filter Parameters}
        xywh {0 0 275 75} box PLASTIC_UP_BOX color 183 labeltype ENGRAVED_LABEL labelsize 11 align 17
      } {
        Fl_Choice analogfiltertypechoice {
          label FilterType
          callback {pars->Ptype=(int)o->value();
pars->changed=true;}
          tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
          code1 {o->value(pars->Ptype);}
        } {
          menuitem {} {
            label LPF1
            xywh {40 40 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label HPF1
            xywh {50 50 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label LPF2
            xywh {60 60 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label HPF2
            xywh {70 70 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label BPF2
            xywh {82 82 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label NF2
            xywh {94 94 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label PkF2
            xywh {104 104 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label LSh2
            xywh {114 114 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label HSh2
            xywh {124 124 100 20} labelfont 1 labelsize 10
          }
        }
        Fl_Choice svfiltertypechoice {
          label FilterType
          callback {pars->Ptype=(int)o->value();
pars->changed=true;}
          tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
          code1 {o->value(pars->Ptype);}
        } {
          menuitem {} {
            label 1LPF
            xywh {134 134 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label 1HPF
            xywh {144 144 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label 1BPF
            xywh {154 154 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label 1NF
            xywh {164 164 100 20} labelfont 1 labelsize 10
          }
        }
        Fl_Choice filtertype {
          label Category
          callback {switchcategory((int)o->value());
pars->changed=true;}
          tooltip {The Category of the Filter (Analog/Formantic/etc.)} xywh {10 20 60 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
          code0 {o->value(pars->Pcategory);}
        } {
          menuitem {} {
            label Analog
            xywh {50 50 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label Formant
            xywh {60 60 100 20} labelfont 1 labelsize 10
          }
          menuitem {} {
            label StVarF
            xywh {70 70 100 20} labelfont 1 labelsize 10
          }
        }
        Fl_Dial cfreqdial {
          label {C.Freq}
          callback {pars->Pfreq=(int)o->value();}
          tooltip {Center Frequency of the Filter or the base position in the vowel's sequence} xywh {75 25 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->value(pars->Pfreq);}
          class WidgetPDial
        }
        Fl_Dial qdial {
          label Q
          callback {pars->Pq=(int)o->value();
formantfiltergraph->redraw();}
          tooltip {Filter resonance or bandwidth} xywh {110 25 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->value(pars->Pq);}
          class WidgetPDial
        }
        Fl_Dial freqtrdial {
          label {freq.tr.}
          callback {pars->Pfreqtrack=(int) o->value();}
          tooltip {Filter frequency tracking (left is negative, middle is 0, and right is positive)} xywh {215 25 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->value(pars->Pfreqtrack);}
          class WidgetPDial
        }
        Fl_Dial vsnsadial {
          label {V.SnsA.}
          callback {if (velsnsamp!=NULL) *velsnsamp=(int)o->value();}
          tooltip {Velocity sensing amount of the Filter} xywh {145 25 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          class WidgetPDial
        }
        Fl_Dial vsnsdial {
          label {V.Sns.}
          callback {if (velsns!=NULL) *velsns=(int)o->value();}
          tooltip {Velocity Sensing Function of the Filter} xywh {180 25 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          class WidgetPDial
        }
        Fl_Dial gaindial {
          label gain
          callback {pars->Pgain=(int)o->value();
formantfiltergraph->redraw();
pars->changed=true;}
          tooltip {Filter output gain/damp} xywh {250 35 20 20} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
          code0 {o->value(pars->Pgain);}
          class WidgetPDial
        }
        Fl_Choice stcounter {
          label St
          callback {pars->Pstages=(int)o->value();
formantfiltergraph->redraw();
pars->changed=true;} open
          tooltip {Filter stages (in order to increase dB/oct. value and the order of the filter)} xywh {235 5 35 15} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10
          code1 {for (int i=0;i<MAX_FILTER_STAGES;i++) {char tmp[10];snprintf(tmp,10,"%dx",i+1);o->add(tmp);};}
          code2 {o->value(pars->Pstages);}
        } {}
      }
      Fl_Button editbutton {
        label Edit
        callback {formantparswindow->show();}
        xywh {15 40 50 25} box PLASTIC_UP_BOX labelfont 1 labelsize 12
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(pars);}
        xywh {186 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(pars,this);}
        xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
      }
    }
  }
  Function {make_formant_window()} {} {
    Fl_Window formantparswindow {
      label {Formant Filter Parameters}
      xywh {47 301 700 205} type Double hide
    } {
      Fl_Group {} {
        xywh {485 47 105 113} box THIN_UP_BOX
      } {
        Fl_Counter {} {
          label {Formant }
          callback {nformant=(int) o->value();
update_formant_window();
formantfiltergraph->redraw();}
          xywh {545 80 40 15} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textsize 10
          code0 {o->bounds(0,FF_MAX_FORMANTS-1);}
          code1 {o->value(nformant);}
        }
        Fl_Counter {} {
          label {Vowel no.}
          callback {nvowel=(int) o->value();
update_formant_window();
formantfiltergraph->redraw();}
          xywh {545 55 40 20} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textfont 1 textsize 12
          code0 {o->bounds(0,FF_MAX_VOWELS-1);}
          code1 {o->value(nvowel);}
        }
        Fl_Group formantparsgroup {
          xywh {490 105 95 50} box ENGRAVED_FRAME
        } {
          Fl_Dial formant_freq_dial {
            label freq
            callback {pars->Pvowels[nvowel].formants[nformant].freq=(int) o->value();
formantfiltergraph->redraw();
pars->changed=true;}
            tooltip {Formant frequency} xywh {495 115 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
            class WidgetPDial
          }
          Fl_Dial formant_q_dial {
            label Q
            callback {pars->Pvowels[nvowel].formants[nformant].q=(int) o->value();
formantfiltergraph->redraw();
pars->changed=true;}
            tooltip {Formant's Q} xywh {525 115 24 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
            class WidgetPDial
          }
          Fl_Dial formant_amp_dial {
            label amp
            callback {pars->Pvowels[nvowel].formants[nformant].amp=(int) o->value();
formantfiltergraph->redraw();
pars->changed=true;}
            tooltip {Formant amplitude} xywh {555 115 24 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1
            class WidgetPDial
          }
        }
      }
      Fl_Group {} {
        xywh {590 47 100 113} box THIN_UP_BOX
      } {
        Fl_Counter {} {
          label {Seq.Size}
          callback {pars->Psequencesize=(int) o->value();
update_formant_window();
pars->changed=true;}
          xywh {595 62 55 20} type Simple labelfont 1 labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 12
          code0 {o->bounds(1,FF_MAX_SEQUENCE-1);}
          code1 {o->value(pars->Psequencesize);}
        }
        Fl_Counter {} {
          label {S.Pos.}
          callback {nseqpos=(int) o->value();
update_formant_window();
pars->changed=true;}
          tooltip {Current position from the sequence} xywh {595 97 40 15} type Simple labelfont 1 labelsize 10 align 9 minimum 0 maximum 127 step 1 textsize 10
          code0 {o->bounds(0,FF_MAX_SEQUENCE-2);}
          code1 {o->value(nseqpos);}
        }
        Fl_Counter vowel_counter {
          label Vowel
          callback {pars->Psequence[nseqpos].nvowel=(int) o->value();
pars->changed=true;}
          xywh {640 97 40 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textsize 11
          code0 {o->bounds(0,FF_MAX_VOWELS-1);}
        }
        Fl_Check_Button {} {
          label {Neg.Input}
          callback {pars->Psequencereversed=(int) o->value();
pars->changed=true;}
          tooltip {Negate the input from LFO/envelopes/etc.} xywh {625 132 60 20} down_box DOWN_BOX labelsize 10
          code0 {o->value(pars->Psequencereversed);}
        }
        Fl_Dial strchdial {
          label Strch
          callback {pars->Psequencestretch=(int) o->value();
pars->changed=true;}
          tooltip {Sequence Stretch} xywh {595 130 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1
          code0 {o->value(pars->Psequencestretch);}
          class WidgetPDial
        }
      }
      Fl_Counter {} {
        label {Num.Formants}
        callback {pars->Pnumformants=(int) o->value();
update_formant_window();
pars->changed=true;
formantfiltergraph->redraw();}
        xywh {485 15 65 20} type Simple labelfont 1 labelsize 11 align 5 minimum 0 maximum 127 step 1
        code0 {o->bounds(1,FF_MAX_FORMANTS);}
        code1 {o->value(pars->Pnumformants);}
      }
      Fl_Dial frsldial {
        label {Fr.Sl.}
        callback {pars->Pformantslowness=(int) o->value();
pars->changed=true;}
        tooltip {Formant's Slowness (Morphing)} xywh {565 15 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 align 1 maximum 127 step 1
        code0 {o->value(pars->Pformantslowness);}
        class WidgetPDial
      }
      Fl_Value_Output centerfreqvo {
        label {C.f.}
        callback {o->value(pars->getcenterfreq()/1000.0);}
        tooltip {Center Frequency (kHz)} xywh {515 164 33 18} when 3 minimum 1 maximum 10 step 0.01 value 1 textfont 1
        code0 {o->value(pars->getcenterfreq()/1000.0);}
      }
      Fl_Value_Output octavesfreqvo {
        label {Oct.}
        callback {o->value(pars->getoctavesfreq());}
        tooltip {No. of octaves} xywh {515 182 33 18} when 3 minimum 1 maximum 127 step 1 value 5 textfont 1
        code0 {o->value(pars->getoctavesfreq());}
      }
      Fl_Slider cfknob {
        callback {pars->Pcenterfreq=(int)o->value();
centerfreqvo->do_callback();
formantfiltergraph->redraw();
pars->changed=true;}
        xywh {551 167 84 15} type {Horz Knob} box FLAT_BOX maximum 127
        code0 {o->value(pars->Pcenterfreq);}
      }
      Fl_Slider octknob {
        callback {pars->Poctavesfreq=(int)o->value();
octavesfreqvo->do_callback();
formantfiltergraph->redraw();}
        xywh {551 185 84 15} type {Horz Knob} box FLAT_BOX maximum 127
        code0 {o->value(pars->Poctavesfreq);}
      }
      Fl_Box formantfiltergraph {
        xywh {5 5 475 195} box BORDER_BOX
        code0 {o->init(pars,&nvowel,&nformant);}
        class FormantFilterGraph
      }
      Fl_Dial wvknob {
        label {Vw.Cl.}
        callback {pars->Pvowelclearness=(int) o->value();
pars->changed=true;}
        tooltip {Vowel "clearness" (how the mixed vowels are avoided)} xywh {600 15 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 align 1 maximum 127 step 1
        code0 {o->value(pars->Pvowelclearness);}
        class WidgetPDial
      }
      Fl_Button {} {
        label Close
        callback {formantparswindow->hide();}
        xywh {645 180 50 25} box THIN_UP_BOX
      }
      Fl_Button {} {
        label C
        callback {presetsui->copy(pars,nvowel);}
        xywh {635 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
      Fl_Button {} {
        label P
        callback {presetsui->paste(pars,this,nvowel);}
        xywh {665 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7
      }
      Fl_Box {} {
        label Vowel
        xywh {635 10 55 15}
      }
    }
  }
  Function {update_formant_window()} {} {
    code {formant_freq_dial->value(pars->Pvowels[nvowel].formants[nformant].freq);
formant_q_dial->value(pars->Pvowels[nvowel].formants[nformant].q);
formant_amp_dial->value(pars->Pvowels[nvowel].formants[nformant].amp);
if (nformant<pars->Pnumformants) formantparsgroup->activate();
	else formantparsgroup->deactivate();

if (nseqpos<pars->Psequencesize) vowel_counter->activate();
	else vowel_counter->deactivate();


vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {}
  }
  Function {refresh()} {} {
    code {update_formant_window();
formantfiltergraph->redraw();

if (pars->Pcategory==0) svfiltertypechoice->value(pars->Ptype);
if (pars->Pcategory==2) analogfiltertypechoice->value(pars->Ptype);

filtertype->value(pars->Pcategory);

cfreqdial->value(pars->Pfreq);
qdial->value(pars->Pq);

freqtrdial->value(pars->Pfreqtrack);
gaindial->value(pars->Pgain);

stcounter->value(pars->Pstages);

int categ=pars->Pcategory;
if ((categ==0)||(categ==2)) {
	if (categ==0) {
           analogfiltertypechoice->show();
           svfiltertypechoice->hide();
        } else {
           svfiltertypechoice->show();
           analogfiltertypechoice->hide();
        };
	editbutton->hide();
        formantparswindow->hide();
        cfreqdial->label("C.freq");
} else {
	analogfiltertypechoice->hide();
	svfiltertypechoice->hide();
	editbutton->show();
        cfreqdial->label("BS.pos");
};

filterparamswindow->redraw();} {selected
    }
  }
  Function {init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_)} {} {
    code {pars=filterpars_;
velsnsamp=velsnsamp_;
velsns=velsns_;

make_window();
end();
make_formant_window();


filterui->resize(this->x(),this->y(),this->w(),this->h());


if (velsnsamp==NULL){
	vsnsadial->deactivate();
	vsnsadial->value(127);
   } else vsnsadial->value(*velsnsamp);

if (velsns==NULL){
	vsnsdial->deactivate();
	vsnsdial->value(127);
   } else vsnsdial->value(*velsns);

switchcategory(pars->Pcategory);


formantparswindow->label(this->label());

update_formant_window();} {}
  }
  Function {switchcategory(int newcat)} {} {
    code {if (pars->Pcategory!=newcat){
    pars->Pgain=64;
    gaindial->value(64);
    analogfiltertypechoice->value(0);
    analogfiltertypechoice->do_callback();
    svfiltertypechoice->value(0);
    svfiltertypechoice->do_callback();
};
pars->Pcategory=newcat;

refresh();} {}
  }
  Function {use_for_dynamic_filter()} {} {
    code {freqtrdial->deactivate();
gaindial->when(0);

cfknob->when(FL_WHEN_RELEASE);
octknob->when(FL_WHEN_RELEASE);

frsldial->when(0);
wvknob->when(0);
formant_freq_dial->when(0);
formant_q_dial->when(0);
formant_amp_dial->when(0);
strchdial->when(0);} {}
  }
  decl {FilterParams *pars;} {}
  decl {unsigned char *velsnsamp,*velsns;} {}
  decl {int nvowel,nformant,nseqpos;} {}
}