FilterUI.fl (18661B)
1 # data file for the Fltk User Interface Designer (fluid) 2 version 1.0302 3 header_name {.h} 4 code_name {.cc} 5 decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local 6 } 7 8 decl {//License: GNU GPL version 2 or later} {private local 9 } 10 11 decl {\#include "Fl_Osc_Dial.H"} {public local 12 } 13 14 decl {\#include "Fl_Osc_Choice.H"} {public local 15 } 16 17 decl {\#include "Fl_Osc_Check.H"} {public local 18 } 19 20 decl {\#include "Fl_Osc_Counter.H"} {public local 21 } 22 23 decl {\#include "Fl_Osc_Output.H"} {public local 24 } 25 26 decl {\#include "Fl_Osc_Slider.H"} {public local 27 } 28 29 decl {\#include "Fl_Osc_Pane.H"} {public local 30 } 31 32 decl {\#include <cmath>} {private local 33 } 34 35 decl {\#include <stdio.h>} {private global 36 } 37 38 decl {\#include <stdlib.h>} {private global 39 } 40 41 decl {\#include "../globals.h"} {public local 42 } 43 44 decl {\#include "../Misc/Util.h"} {public local 45 } 46 47 decl {\#include <FL/Fl_Group.H>} {public local 48 } 49 50 decl {\#include "../Params/FilterParams.h"} {public local 51 } 52 53 decl {\#include <FL/Fl_Box.H>} {public local 54 } 55 56 decl {\#include <FL/fl_draw.H>} {public local 57 } 58 59 decl {\#include <FL/fl_ask.H>} {public local 60 } 61 62 decl {\#include "PresetsUI.h"} {public local 63 } 64 65 decl {\#include "common.H"} {public local 66 } 67 68 decl {\#include "FormantFilterGraph.H"} {public local 69 } 70 71 decl {using namespace zyn;} {public local 72 } 73 74 class FilterUI {open : {public Fl_Osc_Group,PresetsUI_} 75 } { 76 Function {FilterUI(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h)} {} { 77 code {nvowel=0;nformant=0;nseqpos=0;(void)label;} {} 78 } 79 Function {~FilterUI()} {} { 80 code {filterui->hide(); 81 formantparswindow->hide(); 82 hide(); 83 //delete (filterui); 84 delete (formantparswindow);} {} 85 } 86 Function {make_window()} {open 87 } { 88 Fl_Window filterui {open 89 xywh {516 484 275 70} type Double color 50 labelfont 1 90 class Fl_Osc_Group visible 91 } { 92 Fl_Button {} { 93 label P 94 callback {presetsui->paste(filterui->loc(),this);} 95 xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 96 } 97 Fl_Group filterparamswindow { 98 label {Filter Parameters} 99 xywh {0 0 275 75} box UP_FRAME color 183 labeltype ENGRAVED_LABEL labelsize 10 align 17 100 code0 {set_module_parameters( o );} 101 } { 102 Fl_Choice analogfiltertypechoice { 103 label FilterType 104 tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 105 code1 {o->init("Ptype");} 106 class Fl_Osc_Choice 107 } { 108 MenuItem {} { 109 label LPF1 110 xywh {40 40 100 20} labelfont 1 labelsize 10 111 } 112 MenuItem {} { 113 label HPF1 114 xywh {50 50 100 20} labelfont 1 labelsize 10 115 } 116 MenuItem {} { 117 label LPF2 118 xywh {60 60 100 20} labelfont 1 labelsize 10 119 } 120 MenuItem {} { 121 label HPF2 122 xywh {70 70 100 20} labelfont 1 labelsize 10 123 } 124 MenuItem {} { 125 label BPF2 126 xywh {82 82 100 20} labelfont 1 labelsize 10 127 } 128 MenuItem {} { 129 label NF2 130 xywh {94 94 100 20} labelfont 1 labelsize 10 131 } 132 MenuItem {} { 133 label PkF2 134 xywh {104 104 100 20} labelfont 1 labelsize 10 135 } 136 MenuItem {} { 137 label LSh2 138 xywh {114 114 100 20} labelfont 1 labelsize 10 139 } 140 MenuItem {} { 141 label HSh2 142 xywh {124 124 100 20} labelfont 1 labelsize 10 143 } 144 } 145 Fl_Choice svfiltertypechoice { 146 label FilterType 147 tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 148 code1 {o->init("Ptype");} 149 class Fl_Osc_Choice 150 } { 151 MenuItem {} { 152 label 1LPF 153 xywh {134 134 100 20} labelfont 1 labelsize 10 154 } 155 MenuItem {} { 156 label 1HPF 157 xywh {144 144 100 20} labelfont 1 labelsize 10 158 } 159 MenuItem {} { 160 label 1BPF 161 xywh {154 154 100 20} labelfont 1 labelsize 10 162 } 163 MenuItem {} { 164 label 1NF 165 xywh {164 164 100 20} labelfont 1 labelsize 10 166 } 167 } Fl_Choice moogfiltertypechoice { 168 label FilterType 169 tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 170 code1 {o->init("Ptype");} 171 class Fl_Osc_Choice 172 } { 173 MenuItem {} { 174 label LP 175 xywh {134 134 100 20} labelfont 1 labelsize 10 176 } 177 MenuItem {} { 178 label HP 179 xywh {144 144 100 20} labelfont 1 labelsize 10 180 } 181 MenuItem {} { 182 label BP 183 xywh {154 154 100 20} labelfont 1 labelsize 10 184 } 185 } 186 Fl_Choice filtertype { 187 label Category 188 callback {refresh();} 189 tooltip {The Category of the Filter (Analog/Formantic/etc.)} xywh {10 20 60 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 190 code0 {o->init("Pcategory");} 191 class Fl_Osc_Choice 192 } { 193 MenuItem {} { 194 label Analog 195 xywh {50 50 100 20} labelfont 1 labelsize 10 196 } 197 MenuItem {} { 198 label Formant 199 xywh {60 60 100 20} labelfont 1 labelsize 10 200 } 201 MenuItem {} { 202 label StVarF 203 xywh {70 70 100 20} labelfont 1 labelsize 10 204 } 205 MenuItem {} { 206 label Moog 207 xywh {80 80 100 20} labelfont 1 labelsize 10 208 } 209 } 210 Fl_Dial cfreqdial { 211 label {C.Freq} 212 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 10 maximum 127 step 1 213 code0 {o->init("Pfreq");} 214 class Fl_Osc_Dial 215 } 216 Fl_Dial qdial { 217 label Q 218 callback {formantfiltergraph->redraw();} 219 tooltip {Filter resonance or bandwidth} xywh {110 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 220 code0 {o->init("Pq");} 221 class Fl_Osc_Dial 222 } 223 Fl_Dial freqtrdial { 224 label {freq.tr.} 225 tooltip {Filter frequency tracking (left is negative, middle is 0, and right is positive)} xywh {215 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 226 code0 {o->init("Pfreqtrack");} 227 class Fl_Osc_Dial 228 } 229 Fl_Dial vsnsadial { 230 label {V.SnsA.} 231 tooltip {Velocity sensing amount of the Filter} xywh {145 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 232 code0 {if(!alt_root.empty()) o->alt_init(alt_root, "VelocityScale"); } 233 code1 {else {o->deactivate(); o->value(127);o->mark_dead();}} 234 class Fl_Osc_Dial 235 } 236 Fl_Dial vsnsdial { 237 label {V.Sns.} 238 tooltip {Velocity Sensing Function of the Filter} xywh {180 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 239 code0 {if(!alt_root.empty()) o->alt_init(alt_root, "VelocityScaleFunction"); } 240 code1 {else {o->deactivate(); o->value(127);o->mark_dead();}} 241 class Fl_Osc_Dial 242 } 243 Fl_Dial gaindial { 244 label gain 245 callback {formantfiltergraph->redraw();} 246 tooltip {Filter output gain/damp} xywh {250 35 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 247 code0 {o->init("Pgain");} 248 class Fl_Osc_Dial 249 } 250 Fl_Choice stcounter { 251 label St 252 callback {formantfiltergraph->redraw();} open 253 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 254 code1 {for (int i=0;i<MAX_FILTER_STAGES;i++) {char tmp[10];snprintf(tmp,10,"%dx",i+1);o->add(tmp);};} 255 code2 {o->init("Pstages");} 256 class Fl_Osc_Choice 257 } {} 258 } 259 Fl_Button editbutton { 260 label Edit 261 callback {formantparswindow->show();} 262 xywh {15 40 50 25} labelfont 1 labelsize 11 263 } 264 Fl_Button {} { 265 label C 266 callback {presetsui->copy(filterui->loc());} 267 xywh {186 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 268 } 269 Fl_Button {} { 270 label P 271 callback {presetsui->paste(filterui->loc(),this);} 272 xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 273 } 274 } 275 } 276 Function {make_formant_window()} {open 277 } { 278 Fl_Window formantparswindow { 279 label {Formant Filter Parameters} open 280 xywh {536 611 700 205} type Double 281 class Fl_Osc_Window visible 282 } { 283 Fl_Button {} { 284 label P 285 callback {presetsui->paste(filterui->loc(),this,nvowel);} 286 xywh {665 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 287 code0 {formantparswindow->osc = osc;} 288 code1 {formantparswindow->base = loc();} 289 } 290 Fl_Group {} {open 291 xywh {485 47 105 113} box THIN_UP_BOX 292 class Fl_Osc_Group 293 } { 294 Fl_Counter {} { 295 label {Formant } 296 callback {nformant=(int) o->value(); 297 formantparsgroup->reext("Pvowels"+to_s(nvowel)+"/Pformants"+to_s(nformant)+"/"); 298 update_formant_window(); 299 formantfiltergraph->redraw();} 300 xywh {545 80 40 15} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textsize 10 301 code0 {o->bounds(0,FF_MAX_FORMANTS-1);} 302 code1 {o->value(nformant);} 303 } 304 Fl_Counter {} { 305 label {Vowel no.} 306 callback {nvowel=(int) o->value(); 307 formantparsgroup->reext("Pvowels"+to_s(nvowel)+"/Pformants"+to_s(nformant)+"/"); 308 update_formant_window(); 309 formantfiltergraph->redraw();} 310 xywh {545 55 40 20} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textfont 1 textsize 11 311 code0 {o->bounds(0,FF_MAX_VOWELS-1);} 312 code1 {o->value(nvowel);} 313 } 314 Fl_Group formantparsgroup {open 315 xywh {490 105 95 50} box ENGRAVED_FRAME 316 class Fl_Osc_Group 317 } { 318 Fl_Box {} { 319 label dummy selected 320 xywh {515 130 35 16} hide deactivate 321 code0 {formantparsgroup->ext = "Pvowels0/Pformants0/";} 322 } 323 Fl_Dial formant_freq_dial { 324 label freq 325 callback {formantfiltergraph->update();} 326 tooltip {Formant frequency} xywh {495 115 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 327 code0 {//TODO get widget renaming working here!!!} 328 code1 {o->init("freq");} 329 class Fl_Osc_Dial 330 } 331 Fl_Dial formant_q_dial { 332 label Q 333 callback {formantfiltergraph->update();} 334 tooltip {Formant's Q} xywh {525 115 24 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 335 code0 {o->init("q");} 336 class Fl_Osc_Dial 337 } 338 Fl_Dial formant_amp_dial { 339 label amp 340 callback {formantfiltergraph->update();} 341 tooltip {Formant amplitude} xywh {555 115 24 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 342 code0 {o->init("amp");} 343 class Fl_Osc_Dial 344 } 345 } 346 } 347 Fl_Group {} {open 348 xywh {590 47 100 113} box THIN_UP_BOX 349 class Fl_Osc_Group 350 } { 351 Fl_Counter sequencesize { 352 label {Seq.Size} 353 callback {update_formant_window();} 354 xywh {595 62 55 20} type Simple labelfont 1 labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 11 355 code0 {o->bounds(1,FF_MAX_SEQUENCE-1);} 356 code1 {o->init("Psequencesize");} 357 class Fl_Osc_Counter 358 } 359 Fl_Counter {} { 360 label {S.Pos.} 361 callback {nseqpos = o->value();update_formant_window();vowel_counter->oscMove("vowel_seq"+to_s(nseqpos));} 362 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 363 code0 {o->bounds(0,FF_MAX_SEQUENCE-2);} 364 code1 {o->value(nseqpos);} 365 } 366 Fl_Counter vowel_counter { 367 label Vowel 368 callback {(void)o;//pars->Psequence[nseqpos].nvowel=(int) o->value(); pars->changed=true;} 369 xywh {640 97 40 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textsize 10 370 code0 {o->bounds(0,FF_MAX_VOWELS-1);} 371 code1 {o->init("vowel_seq0");} 372 class Fl_Osc_Counter 373 } 374 Fl_Check_Button {} { 375 label {Neg.Input} 376 tooltip {Negate the input from LFO/envelopes/etc.} xywh {625 132 60 20} down_box DOWN_BOX labelsize 10 377 code0 {o->init("Psequencereversed");} 378 class Fl_Osc_Check 379 } 380 Fl_Dial strchdial { 381 label Strch 382 tooltip {Sequence Stretch} xywh {595 130 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 383 code0 {o->init("Psequencestretch");} 384 class Fl_Osc_Dial 385 } 386 } 387 Fl_Counter numformants { 388 label {Num.Formants} 389 callback {update_formant_window(); 390 formantfiltergraph->redraw();} 391 xywh {485 15 65 20} type Simple labelfont 0 labelsize 10 align 5 minimum 0 maximum 127 step 1 392 code0 {o->bounds(1,FF_MAX_FORMANTS);} 393 code1 {o->init("Pnumformants");} 394 class Fl_Osc_Counter 395 } 396 Fl_Dial frsldial { 397 label {Fr.Sl.} 398 tooltip {Formant's Slowness (Morphing)} xywh {565 15 25 25} box ROUND_UP_BOX labelfont 0 labelsize 10 align 1 maximum 127 step 1 399 code0 {o->init("Pformantslowness");} 400 class Fl_Osc_Dial 401 } 402 Fl_Value_Output centerfreqvo { 403 label {C.f.} 404 callback {o->value(o->newvalue()/1000.0);} 405 tooltip {Center Frequency (kHz)} xywh {511 164 40 18} when 3 minimum 1 maximum 10 step 0.01 value 1 textfont 1 textsize 11 labelsize 13 406 code0 {o->init("centerfreq");} 407 class Fl_Osc_Output 408 } 409 Fl_Value_Output octavesfreqvo { 410 label {Oct.} 411 callback {o->value(o->newvalue());} 412 tooltip {No. of octaves} xywh {511 182 40 18} when 3 minimum 1 maximum 127 step 0.01 value 5 textfont 1 textsize 11 labelsize 13 413 code0 {o->init("octavesfreq");} 414 class Fl_Osc_Output 415 } 416 Fl_Slider cfknob { 417 callback {centerfreqvo->update();} 418 xywh {555 167 84 15} type {Horz Knob} box FLAT_BOX maximum 127 419 code0 {o->init("Pcenterfreq", 'i');} 420 class Fl_Osc_Slider 421 } 422 Fl_Slider octknob { 423 callback {octavesfreqvo->update();} 424 xywh {555 185 84 15} type {Horz Knob} box FLAT_BOX maximum 127 425 code0 {o->init("Poctavesfreq", 'i');} 426 class Fl_Osc_Slider 427 } 428 Fl_Box formantfiltergraph { 429 xywh {5 5 475 195} box BORDER_BOX 430 code0 {o->init(&nvowel,&nformant);} 431 class FormantFilterGraph 432 } 433 Fl_Dial wvknob { 434 label {Vw.Cl.} 435 tooltip {Vowel "clearness" (how the mixed vowels are avoided)} xywh {600 15 25 25} box ROUND_UP_BOX labelfont 0 labelsize 10 align 1 maximum 127 step 1 436 code0 {o->init("Pvowelclearness");} 437 class Fl_Osc_Dial 438 } 439 Fl_Button {} { 440 label Close 441 callback {formantparswindow->hide();} 442 xywh {645 180 50 25} box THIN_UP_BOX 443 } 444 Fl_Button {} { 445 label C 446 callback {presetsui->copy(filterui->loc(),nvowel);} 447 xywh {635 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 448 } 449 Fl_Box {} { 450 label Vowel 451 xywh {635 6 55 15} labelfont 1 452 } 453 } 454 } 455 Function {update_formant_window()} {open 456 } { 457 code {//formant_freq_dial->value(pars->Pvowels[nvowel].formants[nformant].freq); 458 //formant_q_dial->value(pars->Pvowels[nvowel].formants[nformant].q); 459 //formant_amp_dial->value(pars->Pvowels[nvowel].formants[nformant].amp); 460 if (nformant<numformants->value()) formantparsgroup->activate(); 461 else formantparsgroup->deactivate(); 462 463 if (nseqpos<sequencesize->value()) vowel_counter->activate(); 464 else vowel_counter->deactivate(); 465 466 467 //vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {} 468 } 469 Function {refresh()} {open 470 } { 471 code {update_formant_window(); 472 formantfiltergraph->redraw(); 473 const int Pcategory = filtertype->value(); 474 const int Ptype = analogfiltertypechoice->value(); 475 476 const int categ=Pcategory; 477 478 if (categ == 3) { 479 stcounter->hide(); // not (yet?) implemented for moog filter 480 } 481 else { 482 stcounter->show(); 483 } 484 485 switch(categ) 486 { 487 case 2: svfiltertypechoice->value(Ptype); break; 488 case 0: analogfiltertypechoice->value(Ptype); break; 489 case 3: moogfiltertypechoice->value(Ptype); break; 490 } 491 492 analogfiltertypechoice->hide(); 493 svfiltertypechoice->hide(); 494 moogfiltertypechoice->hide(); 495 496 if ((categ==0)||(categ==2)||(categ==3)) { 497 switch (categ) 498 { 499 case 0: analogfiltertypechoice->show(); break; 500 case 2: svfiltertypechoice->show(); break; 501 case 3: moogfiltertypechoice->show(); break; 502 } 503 editbutton->hide(); 504 formantparswindow->hide(); 505 cfreqdial->label("C.freq"); 506 } else { 507 editbutton->show(); 508 cfreqdial->label("BS.pos"); 509 }; 510 511 filterparamswindow->redraw();} {} 512 } 513 Function {rebase(std::string new_base)} {open 514 } { 515 code { 516 formantparswindow->rebase(new_base+"VoiceFilter/"); 517 Fl_Osc_Group::rebase(new_base); 518 } {} 519 } 520 Function {init(std::string alt_root_, Fl_Osc_Interface *osc_, std::string base_, std::string ext_)} {} { 521 code {alt_root = alt_root_; 522 osc = osc_; 523 base = base_; 524 ext = ext_; 525 526 assert(osc); 527 528 make_window(); 529 end(); 530 make_formant_window(); 531 532 533 filterui->resize(this->x(),this->y(),this->w(),this->h()); 534 535 switchcategory(0); 536 537 formantparswindow->label(this->label()); 538 539 update_formant_window();} {} 540 } 541 Function {switchcategory(int newcat)} {open 542 } { 543 code { 544 //TODO update Pgain & filter type on switch Pgain=64; 545 (void) newcat; 546 refresh();} {} 547 } 548 Function {use_for_dynamic_filter()} {open 549 } { 550 code {freqtrdial->deactivate(); 551 gaindial->when(0); 552 553 cfknob->when(FL_WHEN_RELEASE); 554 octknob->when(FL_WHEN_RELEASE); 555 556 frsldial->when(0); 557 wvknob->when(0); 558 formant_freq_dial->when(0); 559 formant_q_dial->when(0); 560 formant_amp_dial->when(0); 561 strchdial->when(0);} {} 562 } 563 decl {std::string alt_root;} {private local 564 } 565 decl {int nvowel,nformant,nseqpos;} {private local 566 } 567 }