From b703eab295330e6f81564fbb39a10a1a2fdd2f54 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sun, 27 Dec 2009 11:30:35 +0000 Subject: moved old qt4 branch --- .../synti/zynaddsubfx/UI/FilterUI.fl | 624 +++++++++++++++++++++ 1 file changed, 624 insertions(+) create mode 100644 muse_qt4_evolution/synti/zynaddsubfx/UI/FilterUI.fl (limited to 'muse_qt4_evolution/synti/zynaddsubfx/UI/FilterUI.fl') diff --git a/muse_qt4_evolution/synti/zynaddsubfx/UI/FilterUI.fl b/muse_qt4_evolution/synti/zynaddsubfx/UI/FilterUI.fl new file mode 100644 index 00000000..44b50b94 --- /dev/null +++ b/muse_qt4_evolution/synti/zynaddsubfx/UI/FilterUI.fl @@ -0,0 +1,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 } {public +} + +decl {\#include } {public +} + +decl {\#include "../globals.h"} {public +} + +decl {\#include } {public +} + +decl {\#include "../Params/FilterParams.h"} {public +} + +decl {\#include } {public +} + +decl {\#include } {public +} + +decl {\#include } {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 (lyPnumformants){ + 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=0)&&(oiy>=0)&&(iyhide(); +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;iadd(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 (nformantPnumformants) formantparsgroup->activate(); + else formantparsgroup->deactivate(); + +if (nseqposPsequencesize) 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;} {} +} -- cgit v1.2.3