zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 9a2a7babd63280fc1d13dcfba461bb77ed0af918
parent fae7b68f5bb13d0ec2276d11149588c167d16eaf
Author: paulnasca <paulnasca>
Date:   Fri,  2 Jul 2004 16:49:35 +0000

*** empty log message ***

Diffstat:
MChangeLog | 2++
Msrc/Effects/DynamicFilter.C | 10+++++++---
Msrc/Params/FilterParams.C | 1+
Msrc/Params/FilterParams.h | 2++
Msrc/UI/EffUI.fl | 23++++++++---------------
Msrc/UI/FilterUI.fl | 82++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
Msrc/UI/MasterUI.fl | 8++++----
Msrc/UI/WidgetPDial.fl | 26++++++++++++++++----------
8 files changed, 96 insertions(+), 58 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -601,3 +601,5 @@ - Inceput sa scriu un nou efect (DynamicFilter) 01 Iul 2004 - Corectata o mica eroare la EffectUI care facea ca efectele sa nu apara activate - Continuat de scris la DynamicFiter (mai este doar de salvat parametrii si de auto-update la filtru) +02 Iul 2004 - Continuat la DynamicFilter (adaugata auto-update) + diff --git a/src/Effects/DynamicFilter.C b/src/Effects/DynamicFilter.C @@ -50,6 +50,12 @@ DynamicFilter::~DynamicFilter(){ */ void DynamicFilter::out(REALTYPE *smpsl,REALTYPE *smpsr){ int i; + + if (filterpars->changed){ + filterpars->changed=false; + cleanup(); + }; + REALTYPE lfol,lfor; lfo.effectlfoout(&lfol,&lfor); lfol*=depth*5.0;lfor*=depth*5.0; @@ -69,9 +75,7 @@ void DynamicFilter::out(REALTYPE *smpsl,REALTYPE *smpsr){ ms2=ms2*(1.0-ampsmooth2)+ms1*ampsmooth2; ms3=ms3*(1.0-ampsmooth2)+ms2*ampsmooth2; ms4=ms4*(1.0-ampsmooth2)+ms3*ampsmooth2; - REALTYPE rms=sqrt(ms4)*ampsns; -// printf("(%g,%g) %g \n",ampsmooth,ampsmooth2,rms); - + REALTYPE rms=(sqrt(ms4)-0.25)*ampsns; REALTYPE frl=filterl->getrealfreq(freq+lfol+rms); REALTYPE frr=filterr->getrealfreq(freq+lfor+rms); diff --git a/src/Params/FilterParams.C b/src/Params/FilterParams.C @@ -30,6 +30,7 @@ FilterParams::FilterParams(unsigned char Ptype_,unsigned char Pfreq_,unsigned c Dfreq=Pfreq_; Dq=Pq_; + changed=false; defaults(); }; diff --git a/src/Params/FilterParams.h b/src/Params/FilterParams.h @@ -81,6 +81,8 @@ class FilterParams{ REALTYPE getformantfreq(unsigned char freq); REALTYPE getformantamp(unsigned char amp); REALTYPE getformantq(unsigned char q); + + bool changed; private: //stored default parameters diff --git a/src/UI/EffUI.fl b/src/UI/EffUI.fl @@ -152,7 +152,7 @@ return(log(freq/20.0)/log(1000.0));} {} decl {int maxdB;} {} } -class EffUI {open : {public Fl_Group} +class EffUI {: {public Fl_Group} } { Function {EffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { code {eff=NULL; @@ -1194,29 +1194,24 @@ refresh(eff);} open } Function {make_filter_window()} {} { Fl_Window filterwindow { - label {Filter Parameters for DynFilter Eff.} - xywh {212 170 290 115} type Double hide + label {Filter Parameters for DynFilter Eff.} selected + xywh {212 170 290 110} type Double hide } { Fl_Group {} { label {DynFilter effect - Filter} open xywh {5 5 275 75} box FLAT_BOX color 50 align 144 code0 {o->init(eff->filterpars,NULL,NULL);} + code1 {o->use_for_dynamic_filter();} class FilterUI } {} Fl_Button {} { - label Apply - callback {eff->cleanup();} - tooltip {apply the filter settings} xywh {5 85 70 25} box THIN_UP_BOX - } - Fl_Button {} { label Close callback {filterwindow->hide();} - xywh {210 85 70 25} box THIN_UP_BOX + xywh {105 85 70 20} box THIN_UP_BOX } } } - Function {init(EffectMgr *eff_)} {open - } { + Function {init(EffectMgr *eff_)} {} { code {eff=eff_; make_null_window(); @@ -1244,8 +1239,7 @@ effdynamicfilterwindow->position(px,py); refresh(eff);} {} } - Function {refresh(EffectMgr *eff_)} {open - } { + Function {refresh(EffectMgr *eff_)} {} { code {eff=eff_; this->hide(); @@ -1390,8 +1384,7 @@ switch(eff->geteffect()){ break; }; -this->show();} {selected - } +this->show();} {} } decl {EffectMgr *eff;} {} decl {int eqband;} {} diff --git a/src/UI/FilterUI.fl b/src/UI/FilterUI.fl @@ -163,7 +163,7 @@ delete (formantparswindow);} {} } Function {make_window()} {} { Fl_Window filterui { - xywh {365 269 275 75} type Double color 50 labelfont 1 hide + xywh {303 417 275 75} type Double color 50 labelfont 1 hide class Fl_Group } { Fl_Group filterparamswindow { @@ -172,7 +172,8 @@ delete (formantparswindow);} {} } { Fl_Choice analogfiltertypechoice { label FilterType - callback {pars->Ptype=(int)o->value();} + 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);} } { @@ -215,7 +216,8 @@ delete (formantparswindow);} {} } Fl_Choice svfiltertypechoice { label FilterType - callback {pars->Ptype=(int)o->value();} + 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);} } { @@ -238,7 +240,8 @@ delete (formantparswindow);} {} } Fl_Choice {} { label Category - callback {switchcategory((int)o->value());} + 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);} } { @@ -270,7 +273,7 @@ formantfiltergraph->redraw();} code0 {o->value(pars->Pq);} class WidgetPDial } - Fl_Dial {} { + 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 @@ -280,7 +283,8 @@ formantfiltergraph->redraw();} Fl_Counter stcounter { label {St.} callback {pars->Pstages=(int)o->value(); -formantfiltergraph->redraw();} +formantfiltergraph->redraw(); +pars->changed=true;} tooltip {Additional filter stages (in order to increase dB/oct. value and the order of the filter)} xywh {225 5 40 15} type Simple labelsize 10 align 4 minimum 1 maximum 127 step 1 textfont 1 textsize 12 code0 {o->bounds(0,MAX_FILTER_STAGES-1);} code1 {o->value(pars->Pstages);} @@ -300,7 +304,8 @@ formantfiltergraph->redraw();} Fl_Dial gaindial { label gain callback {pars->Pgain=(int)o->value(); -formantfiltergraph->redraw();} +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 @@ -316,7 +321,7 @@ formantfiltergraph->redraw();} Function {make_formant_window()} {} { Fl_Window formantparswindow { label {Formant Filter Parameters} - xywh {41 226 710 205} type Double hide + xywh {47 301 710 205} type Double hide } { Fl_Group {} { xywh {485 47 105 113} box THIN_UP_BOX @@ -345,21 +350,24 @@ formantfiltergraph->redraw();} Fl_Dial formant_freq_dial { label freq callback {pars->Pvowels[nvowel].formants[nformant].freq=(int) o->value(); -formantfiltergraph->redraw();} +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();} +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();} +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 } @@ -371,7 +379,8 @@ formantfiltergraph->redraw();} Fl_Counter {} { label {Seq.Size} callback {pars->Psequencesize=(int) o->value(); -update_formant_window();} +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);} @@ -379,26 +388,30 @@ update_formant_window();} Fl_Counter {} { label {S.Pos.} callback {nseqpos=(int) o->value(); -update_formant_window();} +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();} + 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();} + 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 {} { + Fl_Dial strchdial { label Strch - callback {pars->Psequencestretch=(int) o->value();} + 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 @@ -408,15 +421,16 @@ update_formant_window();} 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 {} { + Fl_Dial frsldial { label {Fr.Sl.} - callback {pars->Pformantslowness=(int) o->value();} + 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 @@ -433,14 +447,15 @@ formantfiltergraph->redraw();} 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 {} { + Fl_Slider cfknob { callback {pars->Pcenterfreq=(int)o->value(); centerfreqvo->do_callback(); -formantfiltergraph->redraw();} +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 {} { + Fl_Slider octknob { callback {pars->Poctavesfreq=(int)o->value(); octavesfreqvo->do_callback(); formantfiltergraph->redraw();} @@ -452,9 +467,10 @@ formantfiltergraph->redraw();} code0 {o->init(pars,&nvowel,&nformant);} class FormantFilterGraph } - Fl_Dial {} { + Fl_Dial wvknob { label {Vw.Cl.} - callback {pars->Pvowelclearness=(int) o->value();} + 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 @@ -538,7 +554,21 @@ if ((newcat==0)||(newcat==2)) { cfreqdial->label("BS.pos"); }; -filterparamswindow->redraw();} {selected +filterparamswindow->redraw();} {} + } + 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);} {selected } } decl {FilterParams *pars;} {} diff --git a/src/UI/MasterUI.fl b/src/UI/MasterUI.fl @@ -769,8 +769,8 @@ pthread_mutex_unlock(&master->mutex);} xywh {0 80 390 160} } { Fl_Group {} { - label {System Effects} open - xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 20 align 25 hide + label {System Effects} open selected + xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 20 align 25 } { Fl_Counter syseffnocounter { label {Sys.Effect No.} @@ -851,7 +851,7 @@ swapeffwindow->show();} } Fl_Group {} { label {Insertion Effects} - xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 20 align 25 + xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 20 align 25 hide } { Fl_Button {} { label {Swap/Copy...} @@ -872,7 +872,7 @@ if (master->Pinsparts[ninseff]!=-1) { } else { insefftype->deactivate(); inseffectui->deactivate(); -};} selected +};} xywh {5 120 80 20} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 127 step 1 textfont 1 code0 {o->bounds(0,NUM_INS_EFX-1);} code1 {o->value(ninseff);} diff --git a/src/UI/WidgetPDial.fl b/src/UI/WidgetPDial.fl @@ -25,24 +25,32 @@ class WidgetPDial {: {public Fl_Dial} } Function {handle(int event)} {return_type int } { - code {switch (event){ + code {double dragsize,v; +int my; + +switch (event){ case FL_PUSH:oldvalue=value(); case FL_DRAG: - int my=-(Fl::event_y()-y()-h()/2); + my=-(Fl::event_y()-y()-h()/2); - double dragsize=200.0; + dragsize=200.0; if (Fl::event_state(FL_BUTTON1)==0) dragsize*=10; - double v=oldvalue+my/dragsize*(maximum()-minimum()); + v=oldvalue+my/dragsize*(maximum()-minimum()); if (v<minimum()) v=minimum(); else if (v>maximum()) v=maximum(); value(v); value_damage(); - do_callback(); + if (this->when()!=0) do_callback(); return(1); break; +case FL_RELEASE: + if (this->when()==0) do_callback(); + return(1); + break; }; -return(0);} {} +return(0);} {selected + } } Function {drawgradient(int cx,int cy,int sx,double m1,double m2)} {return_type void } { @@ -52,8 +60,7 @@ return(0);} {} fl_arc(cx+sx/2-i/2,cy+sx/2-i/2,i,i,0,360); };} {} } - Function {draw()} {open - } { + Function {draw()} {} { code {int cx=x(),cy=y(),sx=w(),sy=h(); @@ -113,8 +120,7 @@ fl_push_matrix(); fl_end_polygon(); -fl_pop_matrix();} {selected - } +fl_pop_matrix();} {} } Function {pdialcolor(int r,int g,int b)} {} { code {if (active_r()) fl_color(r,g,b);