zynaddsubfx

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

OscilGenUI.fl (33824B)


      1 # data file for the Fltk User Interface Designer (fluid)
      2 version 1.0300 
      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 "../Synth/OscilGen.h"} {public local
     12 } 
     13 
     14 decl {\#include "../Misc/Util.h"} {public local
     15 } 
     16 
     17 decl {\#include "ResonanceUI.h"} {public local
     18 } 
     19 
     20 decl {\#include "Fl_Oscilloscope.h"} {public local
     21 } 
     22 
     23 decl {\#include "Fl_OscilSpectrum.h"} {public local
     24 } 
     25 
     26 decl {\#include "Fl_Osc_Interface.h"} {public local
     27 } 
     28 
     29 decl {\#include <FL/Fl_Box.H>} {public local
     30 } 
     31 
     32 decl {\#include <FL/Fl_Group.H>} {public local
     33 } 
     34 
     35 decl {\#include <FL/Fl_Slider.H>} {public local
     36 } 
     37 
     38 decl {\#include <math.h>} {private local
     39 } 
     40 
     41 decl {\#include <stdio.h>} {private local
     42 } 
     43 
     44 decl {\#include <stdlib.h>} {private local
     45 } 
     46 
     47 decl {\#include <string.h>} {private local
     48 } 
     49 
     50 decl {\#include "Fl_Osc_Pane.H"} {public local
     51 } 
     52 
     53 decl {\#include "Fl_Osc_Dial.H"} {public local
     54 } 
     55 
     56 decl {\#include "Fl_Osc_Choice.H"} {public local
     57 } 
     58 
     59 decl {\#include "Fl_Osc_Counter.H"} {public local
     60 } 
     61 
     62 decl {\#include "Fl_Osc_TSlider.H"} {public local
     63 } 
     64 
     65 decl {\#include "Fl_Osc_VSlider.H"} {public local
     66 } 
     67 
     68 decl {\#include "PresetsUI.h"} {public local
     69 } 
     70 
     71 decl {\#include <FL/fl_draw.H>} {public local
     72 } 
     73 
     74 decl {using namespace zyn;} {public local
     75 }
     76 
     77 class OGSlider {: {public Fl_Osc_TSlider}
     78 } {
     79   Function {OGSlider(int x,int y, int w, int h, const char *label=0)
     80   :Fl_Osc_TSlider(x,y,w,h,label)} {open
     81   } { code {phase=false; } {} }
     82 
     83   Function {OSC_value(char c)} {open return_type void
     84   } { code {
     85   value(phase ? c : 127-c);
     86   selection_color(value() == reset_value ? 0 : 222);
     87   redraw();
     88   } {} }
     89   
     90   Function {OSC_value(int c)} {open return_type void
     91   } { code {
     92   value(phase ? c : 127-c);
     93   selection_color(value() == reset_value ? 0 : 222);
     94   redraw();
     95   } {} }
     96 
     97   Function {cb(void)} {open return_type void
     98   } { code {
     99   selection_color(value() == reset_value ? 0 : 222);
    100   if(cb_data.first) cb_data.first(this, cb_data.second);
    101   } {} }
    102   
    103   Function {update(void)} {open return_type void
    104   } { code {} {} }
    105   
    106   decl {bool phase;} {public local
    107   }
    108 } 
    109 class OGWaveChoice {: {public Fl_Osc_Choice}
    110 } {
    111    Function {OGWaveChoice(int x,int y, int w, int h, const char *label=0)
    112    :Fl_Osc_Choice(x,y,w,h,label)} {open
    113    } { code {} {}}
    114    Function {OSC_value(int i)} {open return_type void
    115    } { code { value(i == 127 ? size()-2 : i);
    116    ogui->setbfmodstatus(i); } {} }
    117    Function {cb(void)} {open return_type void
    118    } {
    119     code {
    120         int v = Fl_Osc_Choice::value();
    121 	if (value() < size()-2)
    122 	    oscWrite(ext, "i", v);
    123 	else
    124 	    oscWrite(ext);
    125 	if(cb_data.first)
    126 	    cb_data.first(this, cb_data.second);
    127 } {}}
    128 
    129   decl { class OscilEditor *ogui;} { public }
    130 
    131 }
    132 
    133 class Oscilharmonic {: {public Fl_Group}
    134 } {
    135   Function {make_window()} {open private
    136   } {
    137     Fl_Window harmonic {open
    138       private xywh {467 756 100 225} type Double box NO_BOX
    139       class Fl_Osc_Group visible
    140     } {
    141       Fl_Slider mag {
    142         callback {int x=127-(int)o->value();
    143 //if (x==64) o->selection_color(0);
    144 //    else o->selection_color(222);
    145 
    146  o->osc->writeValue(o->loc+"magnitude"+to_s(n), (char)x);
    147  if (x==64) {
    148     o->osc->writeValue(o->loc+"phase"+to_s(n), (char)64);
    149     phase->value(64);
    150     phase->selection_color(0);
    151  }
    152  o->osc->requestValue(o->loc+"spectrum");
    153  o->osc->requestValue(o->loc+"waveform");
    154 
    155 display->redraw();}
    156         xywh {0 15 15 115} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64
    157         code0 {o->phase=false;o->ext = "magnitude"+to_s(n);//o->value(127-oscil->Phmag[n]);}
    158         code1 {//if (oscil->Phmag[n]==64) o->selection_color(0);}
    159         class OGSlider
    160       }
    161       Fl_Slider phase {
    162         callback {
    163 o->osc->writeValue(o->loc+"phase"+to_s(n), (char) o->value());
    164 o->osc->requestValue(o->loc+"spectrum");
    165 o->osc->requestValue(o->loc+"waveform");
    166 
    167 display->redraw();}
    168         xywh {0 135 15 75} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64
    169         code0 {o->phase=true;o->ext = "phase"+to_s(n);//o->value(oscil->Phphase[n]);}
    170         class OGSlider
    171       }
    172       Fl_Box {} {
    173         xywh {15 70 5 5} box FLAT_BOX color 45
    174       }
    175       Fl_Box {} {
    176         xywh {15 170 5 5} box FLAT_BOX color 45
    177       }
    178       Fl_Box {} {
    179         label 01
    180         xywh {0 210 20 15} labelfont 1 labelsize 9 align 20
    181         code0 {char tmp[12];snprintf(tmp,sizeof(tmp),"%d",n+1);o->label(strdup(tmp));}
    182       }
    183       Fl_Box {} {
    184         label 01
    185         xywh {0 0 20 15} labelfont 1 labelsize 9 align 20
    186         code0 {char tmp[12];snprintf(tmp,sizeof(tmp),"%d",n+1);o->label(strdup(tmp));}
    187       }
    188     }
    189   }
    190   Function {Oscilharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    191     code {n=0;
    192 display=NULL;} {}
    193   }
    194   Function {init(int n_,Fl_Group *display_, std::string loc_, Fl_Osc_Interface *osc_)} {open
    195   } {
    196     code {assert(osc_);
    197 assert(!loc_.empty());
    198 
    199 n=n_;
    200 display=display_;
    201 osc = osc_;
    202 loc = loc_;
    203 make_window();
    204 mag->osc = osc;
    205 mag->loc = loc;
    206 mag->reset_value = 63;
    207 mag->set_transform([](float x){return 63.0f - x;});
    208 phase->osc = osc;
    209 phase->loc = loc;
    210 phase->reset_value = 64;
    211 phase->set_rounding(1);
    212 phase->set_transform([](float x){return 180*(1 - x/64.0f);});
    213 
    214 osc->createLink(loc+"magnitude"+to_s(n), mag);
    215 osc->createLink(loc+"phase"+to_s(n), phase);
    216 osc->requestValue(loc+"magnitude"+to_s(n));
    217 osc->requestValue(loc+"phase"+to_s(n));
    218 end();
    219 harmonic->show();} {}
    220   }
    221   Function {refresh()} {open
    222   } {
    223     code {osc->requestValue(loc+"magnitude"+to_s(n));//mag->value(127-oscil->Phmag[n]);
    224 osc->requestValue(loc+"phase"+to_s(n));//phase->value(oscil->Phphase[n]);
    225 } {}
    226   }
    227   Function {~Oscilharmonic()} {open
    228   } {
    229     code {osc->removeLink(loc+"magnitude"+to_s(n), mag);
    230 osc->removeLink(loc+"phase"+to_s(n), phase);
    231 
    232 harmonic->hide();
    233 delete harmonic;} {}
    234   }
    235   decl {Fl_Group *display;} {private local
    236   }
    237   decl {int n;} {private local
    238   }
    239   decl {Fl_Osc_Interface *osc;} {private local
    240   }
    241   decl {std::string loc;} {private local
    242   }
    243 } 
    244 class OscilEditor {open : {public PresetsUI_}
    245 } {
    246   Function {make_window()} {open
    247   } {
    248     Fl_Window osceditUI {
    249       label {ADsynth Oscillator Editor} open
    250       xywh {52 100 735 595} type Double
    251       code0 {(void)o;//if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor");} visible
    252     } {
    253       Fl_Group dummy {open
    254         xywh {0 0 735 595} box FLAT_BOX
    255         class Fl_Osc_Group
    256       } {
    257         Fl_Button applybutton {
    258           label Apply
    259           callback {
    260           //call PADnoteParameters' "prepare" port, which computes the whole
    261           //PAD synth wave table
    262           dummy->osc->requestValue(loc+"../prepare");}
    263           xywh {305 285 60 20} box THIN_UP_BOX labelfont 1
    264           code0 {if(adnotep) o->hide();}
    265           code1 {dummy->base = loc;}
    266           code2 {dummy->osc = osc;}
    267         }
    268         Fl_Group oscildisplaygroup {open
    269           xywh {10 10 360 300} box UP_FRAME
    270         } {
    271           Fl_Group {} {open
    272             xywh {15 90 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
    273             code0 {oscilo=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
    274             code1 {oscilo->parent(o);oscilo->init(false);}
    275           } {}
    276           Fl_Box {} {
    277             label Oscillator
    278             xywh {125 15 110 20} labelfont 1
    279           }
    280           Fl_Value_Slider rndslider {
    281             label rnd
    282             callback {}
    283             tooltip {Oscillator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {145 290 100 10} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1
    284             code0 {(void)o->init("Prand"); if (!adnotep) o->hide();}
    285 	    class Fl_Osc_VSlider
    286           }
    287           Fl_Group {} {open
    288             xywh {15 35 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
    289             code0 {oscils=new Fl_OscilSpectrum(o->x(),o->y(),o->w(),o->h(),"");}
    290             code1 {oscils->parent(o);oscils->init(false);}
    291           } {}
    292           Fl_Group {} {open
    293             xywh {251 282 115 25} box UP_FRAME
    294             code0 {if (!adnotep) o->hide();}
    295           } {
    296             Fl_Choice hrndtype {
    297               label {H.rnd}
    298               tooltip {Harmonic Amplitude Randomness} xywh {286 287 50 15} down_box BORDER_BOX labelsize 10 textsize 10
    299               code0 {o->init("Pamprandtype");}
    300               class Fl_Osc_Choice
    301             } {
    302               MenuItem {} {
    303                 label None
    304                 xywh {65 65 100 20} labelfont 1 labelsize 10
    305               }
    306               MenuItem {} {
    307                 label Pow
    308                 xywh {75 75 100 20} labelfont 1 labelsize 10
    309               }
    310               MenuItem {} {
    311                 label Sin
    312                 xywh {85 85 100 20} labelfont 1 labelsize 10
    313               }
    314             }
    315             Fl_Dial hrnddial {
    316               tooltip {Oscillator's spectrum adjust parameter} xywh {345 285 18 18} maximum 127 step 1
    317               code0 {o->init("Pamprandpower");o->reset_value=64;}
    318               class Fl_Osc_Dial
    319             }
    320           }
    321           Fl_Choice magtype {
    322             label {Mag.Type}
    323             callback {redrawoscil();}
    324             xywh {75 285 65 20} down_box BORDER_BOX labelsize 11 when 1 textsize 11
    325             code0 {o->init("Phmagtype");}
    326             class Fl_Osc_Choice
    327           } {
    328             MenuItem {} {
    329               label Linear
    330               xywh {10 10 100 20} labelfont 1 labelsize 11
    331             }
    332             MenuItem {} {
    333               label {-40dB}
    334               xywh {20 20 100 20} labelfont 1 labelsize 11
    335             }
    336             MenuItem {} {
    337               label {-60dB}
    338               xywh {30 30 100 20} labelfont 1 labelsize 11
    339             }
    340             MenuItem {} {
    341               label {-80dB}
    342               xywh {40 40 100 20} labelfont 1 labelsize 11
    343             }
    344             MenuItem {} {
    345               label {-100dB}
    346               xywh {50 50 100 20} labelfont 1 labelsize 11
    347             }
    348           }
    349         }
    350         Fl_Group basefuncdisplaygroup {open
    351           xywh {370 10 360 300} box UP_FRAME
    352           code0 {o->base = loc;}
    353           code1 {o->osc = osc; bftype->ogui = this;}
    354           code2 {assert(osc);}
    355           class Fl_Osc_Group
    356         } {
    357           Fl_Group {} {
    358             xywh {375 90 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
    359             code0 {oscilo_base=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
    360             code1 {oscilo_base->parent(o);oscilo_base->init(true);}
    361           } {}
    362           Fl_Dial bfpar {
    363             callback {redrawoscil(); if(bfparval){bfparval->value(o->value());}}
    364             tooltip {Base Function Parameter} xywh {525 285 20 20} minimum -64 maximum 63 step 1
    365             code0 {o->init("Pbasefuncpar");}
    366             class Fl_Osc_Dial
    367           }
    368           Fl_Choice bftype {
    369             label {Base.F..}
    370             callback {basefuncdisplaygroup->redraw();
    371 redrawoscil();
    372 
    373 if(!basefuncmodulation) return;
    374 setbfmodstatus(o->value());
    375 }
    376             xywh {375 290 90 15} down_box BORDER_BOX labelsize 10 align 5 when 1 textsize 11
    377             class OGWaveChoice
    378           } {
    379             MenuItem {} {
    380               label Sine
    381               xywh {15 15 100 20} labelfont 1 labelsize 11
    382             }
    383             MenuItem {} {
    384               label Triangle
    385               xywh {25 25 100 20} labelfont 1 labelsize 11
    386             }
    387             MenuItem {} {
    388               label Pulse
    389               xywh {35 35 100 20} labelfont 1 labelsize 11
    390             }
    391             MenuItem {} {
    392               label Saw
    393               xywh {45 45 100 20} labelfont 1 labelsize 11
    394             }
    395             MenuItem {} {
    396               label Power
    397               xywh {55 55 100 20} labelfont 1 labelsize 11
    398             }
    399             MenuItem {} {
    400               label Gauss
    401               xywh {55 55 100 20} labelfont 1 labelsize 11
    402             }
    403             MenuItem {} {
    404               label Diode
    405               xywh {65 65 100 20} labelfont 1 labelsize 11
    406             }
    407             MenuItem {} {
    408               label AbsSine
    409               xywh {75 75 100 20} labelfont 1 labelsize 11
    410             }
    411             MenuItem {} {
    412               label PulseSine
    413               xywh {85 85 100 20} labelfont 1 labelsize 11
    414             }
    415             MenuItem {} {
    416               label StrchSine
    417               xywh {95 95 100 20} labelfont 1 labelsize 11
    418             }
    419             MenuItem {} {
    420               label Chirp
    421               xywh {105 105 100 20} labelfont 1 labelsize 11
    422             }
    423             MenuItem {} {
    424               label AbsStrSine
    425               xywh {107 107 100 20} labelfont 1 labelsize 11
    426             }
    427             MenuItem {} {
    428               label Chebyshev
    429               xywh {117 117 100 20} labelfont 1 labelsize 11
    430             }
    431             MenuItem {} {
    432               label Sqr
    433               xywh {127 127 100 20} labelfont 1 labelsize 11
    434             }
    435             MenuItem {} {
    436               label Spike
    437               xywh {127 127 100 20} labelfont 1 labelsize 11
    438             }
    439             MenuItem {} {
    440               label Circle
    441               xywh {127 127 100 20} labelfont 1 labelsize 11
    442             }
    443             MenuItem {} {
    444               label PowerSinus
    445               xywh {127 127 100 20} labelfont 1 labelsize 11
    446             }
    447 	    MenuItem {} {
    448 	      label User
    449 	      xywh {127 127 100 20} labelfont 1 labelsize 11 hide
    450 	    }
    451           }
    452           Fl_Box {} {
    453             label {Base Func.}
    454             xywh {485 15 110 20} labelfont 1
    455           }
    456           Fl_Group {} {open
    457             xywh {375 35 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
    458             code0 {oscils_base=new Fl_OscilSpectrum (o->x(),o->y(),o->w(),o->h(),"");}
    459             code1 {oscils_base->parent(o);oscils_base->init(true);}
    460           } {}
    461           Fl_Value_Output bfparval {
    462             label {Par.}
    463             xywh {495 290 25 15} labelsize 12 minimum -63 maximum 63 step 1
    464             code0 {o->value(bfpar->value());}
    465 
    466           }
    467           Fl_Group basefuncmodulation {open
    468             xywh {555 281 169 25} box UP_FRAME
    469             code0 {}
    470             } {
    471             Fl_Choice bfmodtype {
    472               label {B.F.Mod.}
    473               callback {basefuncdisplaygroup->redraw();
    474 redrawoscil();}
    475               tooltip {Base function modulation} xywh {604 286 50 15} down_box BORDER_BOX labelsize 10 when 1 textsize 10
    476               code0 {o->init("Pbasefuncmodulation");}
    477               class Fl_Osc_Choice
    478             } {
    479               MenuItem {} {
    480                 label None
    481                 xywh {55 55 100 20} labelfont 1 labelsize 10
    482               }
    483               MenuItem {} {
    484                 label Rev
    485                 xywh {65 65 100 20} labelfont 1 labelsize 10
    486               }
    487               MenuItem {} {
    488                 label Sine
    489                 xywh {75 75 100 20} labelfont 1 labelsize 10
    490               }
    491               MenuItem {} {
    492                 label Pow
    493                 xywh {85 85 100 20} labelfont 1 labelsize 10
    494               }
    495               MenuItem {} {
    496                 label Chop
    497                 xywh {95 95 100 20} labelfont 1 labelsize 10
    498               }
    499             }
    500             Fl_Dial bfmodpar1 {
    501               callback {redrawoscil();}
    502               tooltip {Oscillator's modulation parameter 1} xywh {664 286 15 15} maximum 127 step 1
    503               code0 {o->init("Pbasefuncmodulationpar1");o->reset_value=64;}
    504               class Fl_Osc_Dial
    505             }
    506             Fl_Dial bfmodpar2 {
    507               callback {redrawoscil();}
    508               tooltip {Oscillator's modulation parameter 2} xywh {684 286 15 15} maximum 127 step 1
    509               code0 {o->init("Pbasefuncmodulationpar2");o->reset_value=64;}
    510               class Fl_Osc_Dial
    511             }
    512             Fl_Dial bfmodpar3 {
    513               callback {redrawoscil();} selected
    514               tooltip {Oscillator's modulation parameter 3} xywh {704 286 15 15} maximum 127 step 1
    515               code0 {o->init("Pbasefuncmodulationpar3");o->reset_value=32;}
    516               class Fl_Osc_Dial
    517             }
    518           }
    519         }
    520         Fl_Button {} {
    521           label {Use as base}
    522           callback {osc->requestValue(loc+"use-as-base");
    523 if (autoclearbutton->value()){
    524    for (int i=1;i<(MAX_AD_HARMONICS - 1);i++){
    525       h[i]->mag->value(63);
    526       h[i]->mag->do_callback();
    527       h[i]->phase->value(64);
    528       h[i]->phase->do_callback();
    529    };
    530 
    531    harmonicshiftcounter->value(0);
    532 
    533    h[0]->mag->value(0);
    534    h[0]->mag->do_callback();
    535    h[0]->phase->value(64);
    536    h[0]->phase->do_callback();
    537    wshbutton->value(0);
    538    wshbutton->do_callback();
    539    fltbutton->value(0);
    540    fltbutton->do_callback();
    541    sabutton->value(0);
    542    sabutton->do_callback();
    543    bfmodtype->value(0);
    544    bfmodtype->do_callback();
    545 };
    546 
    547  osc->requestValue(loc+"prepare");
    548  bftype->update();
    549 
    550 basefuncdisplaygroup->redraw();
    551 redrawoscil();}
    552           tooltip {Use this Oscillator as base function} xywh {10 318 85 20} box THIN_UP_BOX labelfont 1 labelsize 11
    553         }
    554         Fl_Button {} {
    555           label Close
    556           callback {osceditUI->hide();}
    557           xywh {673 570 62 25} box THIN_UP_BOX
    558         }
    559         Fl_Button {} {
    560           label Clear
    561           callback {if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return;
    562 
    563 for (int i=1;i<(MAX_AD_HARMONICS - 1);i++){
    564     h[i]->mag->value(63);
    565     h[i]->mag->do_callback();
    566     h[i]->phase->value(64);
    567     h[i]->phase->do_callback();
    568 };
    569 h[0]->mag->value(0);
    570 h[0]->mag->do_callback();
    571 h[0]->phase->value(64);
    572 h[0]->phase->do_callback();
    573 
    574 //harmonics->redraw();
    575 osc->requestValue(loc+"prepare");
    576 redrawoscil();}
    577           xywh {675 510 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
    578         }
    579         Fl_Group {} {
    580           xywh {140 313 150 30} box UP_FRAME
    581         } {
    582           Fl_Choice wshbutton {
    583             label {Wsh.}
    584             callback {basefuncdisplaygroup->redraw();
    585 redrawoscil();}
    586             tooltip {Waveshaping function} xywh {170 320 55 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
    587             code0 {o->init("Pwaveshapingfunction");}
    588             class Fl_Osc_Choice
    589           } {
    590             MenuItem {} {
    591               label None
    592               xywh {30 30 100 20} labelfont 1 labelsize 10
    593             }
    594             MenuItem {} {
    595               label Atan
    596               xywh {40 40 100 20} labelfont 1 labelsize 10
    597             }
    598             MenuItem {} {
    599               label Asym1
    600               xywh {50 50 100 20} labelfont 1 labelsize 10
    601             }
    602             MenuItem {} {
    603               label Pow
    604               xywh {60 60 100 20} labelfont 1 labelsize 10
    605             }
    606             MenuItem {} {
    607               label Sine
    608               xywh {70 70 100 20} labelfont 1 labelsize 10
    609             }
    610             MenuItem {} {
    611               label Qnts
    612               xywh {80 80 100 20} labelfont 1 labelsize 10
    613             }
    614             MenuItem {} {
    615               label Zigzg
    616               xywh {90 90 100 20} labelfont 1 labelsize 10
    617             }
    618             MenuItem {} {
    619               label Lmt
    620               xywh {100 100 100 20} labelfont 1 labelsize 10
    621             }
    622             MenuItem {} {
    623               label LmtU
    624               xywh {110 110 100 20} labelfont 1 labelsize 10
    625             }
    626             MenuItem {} {
    627               label LmtL
    628               xywh {120 120 100 20} labelfont 1 labelsize 10
    629             }
    630             MenuItem {} {
    631               label ILmt
    632               xywh {132 132 100 20} labelfont 1 labelsize 10
    633             }
    634             MenuItem {} {
    635               label Clip
    636               xywh {142 142 100 20} labelfont 1 labelsize 10
    637             }
    638             MenuItem {} {
    639               label Asym2
    640               xywh {90 90 100 20} labelfont 1 labelsize 10
    641             }
    642             MenuItem {} {
    643               label Pow2
    644               xywh {100 100 100 20} labelfont 1 labelsize 10
    645             }
    646             MenuItem {} {
    647               label Sgm
    648               xywh {95 95 100 20} labelfont 1 labelsize 10
    649             }
    650             MenuItem {} {
    651               label Tanh
    652               xywh {105 105 100 20} labelfont 1 labelsize 10
    653             }
    654             MenuItem {} {
    655               label Cubic
    656               xywh {115 115 100 20} labelfont 1 labelsize 10
    657             }
    658             MenuItem {} {
    659               label Square
    660               xywh {205 125 100 20} labelfont 1 labelsize 10
    661             }
    662           }
    663           Fl_Dial wshpar {
    664             callback {redrawoscil();if(wsparval){wsparval->value(o->value());}}
    665             tooltip {Waveshaping Parameter} xywh {265 318 20 20} minimum -64 maximum 63 step 1
    666             code0 {o->init("Pwaveshaping");}
    667             class Fl_Osc_Dial
    668           }
    669           Fl_Value_Output wsparval {
    670             xywh {233 321 25 15} labelsize 12 minimum -63 maximum 63 step 1
    671             code0 {o->value(wshpar->value());}
    672           }
    673         }
    674         Fl_Check_Button autoclearbutton {
    675           label {Clr.}
    676           tooltip {Auto clear when using the oscillator as base function} xywh {98 318 40 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10
    677         }
    678         Fl_Group {} {
    679           xywh {290 313 155 30} box UP_FRAME
    680         } {
    681           Fl_Choice fltbutton {
    682             label Filter
    683             callback {redrawoscil();}
    684             tooltip {Oscillator's filter type} xywh {320 318 50 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
    685             code0 {o->init("Pfiltertype");}
    686             class Fl_Osc_Choice
    687           } {
    688             MenuItem {} {
    689               label None
    690               xywh {40 40 100 20} labelfont 1 labelsize 10
    691             }
    692             MenuItem {} {
    693               label LP1
    694               xywh {50 50 100 20} labelfont 1 labelsize 10
    695             }
    696             MenuItem {} {
    697               label HP1a
    698               xywh {60 60 100 20} labelfont 1 labelsize 10
    699             }
    700             MenuItem {} {
    701               label HP1b
    702               xywh {70 70 100 20} labelfont 1 labelsize 10
    703             }
    704             MenuItem {} {
    705               label BP1
    706               xywh {80 80 100 20} labelfont 1 labelsize 10
    707             }
    708             MenuItem {} {
    709               label BS1
    710               xywh {90 90 100 20} labelfont 1 labelsize 10
    711             }
    712             MenuItem {} {
    713               label LP2
    714               xywh {60 60 100 20} labelfont 1 labelsize 10
    715             }
    716             MenuItem {} {
    717               label HP2
    718               xywh {70 70 100 20} labelfont 1 labelsize 10
    719             }
    720             MenuItem {} {
    721               label BP2
    722               xywh {70 70 100 20} labelfont 1 labelsize 10
    723             }
    724             MenuItem {} {
    725               label BS2
    726               xywh {80 80 100 20} labelfont 1 labelsize 10
    727             }
    728             MenuItem {} {
    729               label Cos
    730               xywh {80 80 100 20} labelfont 1 labelsize 10
    731             }
    732             MenuItem {} {
    733               label Sin
    734               xywh {90 90 100 20} labelfont 1 labelsize 10
    735             }
    736             MenuItem {} {
    737               label LSh
    738               xywh {100 100 100 20} labelfont 1 labelsize 10
    739             }
    740             MenuItem {} {
    741               label S
    742               xywh {110 110 100 20} labelfont 1 labelsize 10
    743             }
    744           }
    745           Fl_Dial filtervalue1 {
    746             callback {redrawoscil();}
    747             tooltip {Oscillator's filter parameter1} xywh {372 318 20 20} maximum 127 step 1
    748             code0 {o->init("Pfilterpar1");o->reset_value=64;}
    749             class Fl_Osc_Dial
    750           }
    751           Fl_Check_Button filterpref {
    752             label p
    753             callback {redrawoscil();}
    754             tooltip {Apply the filter before the waveshaping} xywh {420 318 20 20} down_box DOWN_BOX labelsize 10 align 24
    755           }
    756           Fl_Dial filtervalue2 {
    757             callback {redrawoscil();}
    758             tooltip {Oscillator's filter parameter2} xywh {395 318 20 20} maximum 127 step 1
    759             code0 {o->init("Pfilterpar2");o->reset_value=64;}
    760             class Fl_Osc_Dial
    761           }
    762         }
    763         Fl_Group {} {
    764           xywh {595 313 135 30} box UP_FRAME
    765         } {
    766           Fl_Choice sabutton {
    767             label {Sp.adj.}
    768             callback {redrawoscil();}
    769             tooltip {Oscillator's spectrum adjust} xywh {635 318 60 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
    770             code0 {o->init("Psatype");}
    771             class Fl_Osc_Choice
    772           } {
    773             MenuItem {} {
    774               label None
    775               xywh {60 60 100 20} labelfont 1 labelsize 10
    776             }
    777             MenuItem {} {
    778               label Pow
    779               xywh {70 70 100 20} labelfont 1 labelsize 10
    780             }
    781             MenuItem {} {
    782               label ThrsD
    783               xywh {80 80 100 20} labelfont 1 labelsize 10
    784             }
    785             MenuItem {} {
    786               label ThrsU
    787               xywh {90 90 100 20} labelfont 1 labelsize 10
    788             }
    789           }
    790           Fl_Dial sadjpar {
    791             callback {redrawoscil();}
    792             tooltip {Oscillator's spectrum adjust parameter} xywh {700 318 20 20} maximum 127 step 1
    793             code0 {o->init("Psapar");o->reset_value=64;}
    794             class Fl_Osc_Dial
    795           }
    796         }
    797         Fl_Group {} {
    798           xywh {670 345 65 65} box UP_FRAME
    799         } {
    800           Fl_Counter harmonicshiftcounter {
    801             label {Harmonic Shift}
    802             callback {redrawoscil();}
    803             code0 {o->init("Pharmonicshift");}
    804             xywh {675 370 55 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10
    805             class Fl_Osc_Counter
    806           }
    807           Fl_Check_Button harmonicshiftpre {
    808             label preH
    809             callback {redrawoscil();}
    810             code0 {o->init("Pharmonicshiftfirst");}
    811             tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {695 390 34 15} down_box DOWN_BOX labelsize 10 align 24
    812             class Fl_Osc_Check
    813           }
    814           Fl_Button {} {
    815             label R
    816             callback {//oscil->Pharmonicshift=0;
    817 harmonicshiftcounter->value(0);
    818 redrawoscil();}
    819             xywh {675 390 20 15} box THIN_UP_BOX labelfont 1 labelsize 10
    820           }
    821         }
    822         Fl_Group {} {
    823           xywh {670 415 65 90} box UP_FRAME
    824         } {
    825           Fl_Choice adhrtype {
    826             label {Adpt.Harm.}
    827             callback {redrawoscil();}
    828             tooltip {The type of the addaptive harmonics} xywh {675 430 55 15} down_box BORDER_BOX labelsize 10 align 129 when 3 textsize 10
    829             code0 {o->init("Padaptiveharmonics");}
    830             class Fl_Osc_Choice
    831           } {
    832             MenuItem {} {
    833               label OFF
    834               xywh {85 85 100 20} labelfont 1 labelsize 10
    835             }
    836             MenuItem {} {
    837               label ON
    838               xywh {95 95 100 20} labelfont 1 labelsize 10
    839             }
    840             MenuItem {} {
    841               label Square
    842               xywh {105 105 100 20} labelfont 1 labelsize 10
    843             }
    844             MenuItem {} {
    845               label 2xSub
    846               xywh {115 115 100 20} labelfont 1 labelsize 10
    847             }
    848             MenuItem {} {
    849               label 2xAdd
    850               xywh {125 125 100 20} labelfont 1 labelsize 10
    851             }
    852             MenuItem {} {
    853               label 3xSub
    854               xywh {125 125 100 20} labelfont 1 labelsize 10
    855             }
    856             MenuItem {} {
    857               label 3xAdd
    858               xywh {135 135 100 20} labelfont 1 labelsize 10
    859             }
    860             MenuItem {} {
    861               label 4xSub
    862               xywh {135 135 100 20} labelfont 1 labelsize 10
    863             }
    864             MenuItem {} {
    865               label 4xAdd
    866               xywh {145 145 100 20} labelfont 1 labelsize 10
    867             }
    868           }
    869           Fl_Dial adhrpow {
    870             label pow
    871             callback {redrawoscil();}
    872             tooltip {Adaptive harmonics power} xywh {705 465 25 25} labelsize 10 maximum 200 step 1
    873             code0 {o->init("Padaptiveharmonicspower");o->reset_value=100;}
    874             class Fl_Osc_Dial
    875           }
    876           Fl_Dial adhrbf {
    877             label baseF
    878             callback {redrawoscil();}
    879             tooltip {Adaptive harmonics base frequency} xywh {675 465 25 25} labelsize 10 maximum 255 step 1
    880             code0 {o->init("Padaptiveharmonicsbasefreq");o->reset_value=128;}
    881             class Fl_Osc_Dial
    882           }
    883           Fl_Slider adhrpar {
    884             code0 {o->init("Padaptiveharmonicspar", 'i');o->reset_value=50;}
    885             callback {redrawoscil();}
    886             xywh {675 450 55 10} type {Horz Knob} box NO_BOX maximum 100 step 1 value 50
    887             class Fl_Osc_TSlider
    888           }
    889         }
    890         Fl_Group {} {
    891           xywh {445 313 150 30} box UP_FRAME
    892         } {
    893           Fl_Choice modtype {
    894             label {Mod.}
    895             callback {redrawoscil();}
    896             tooltip modulation xywh {475 320 50 15} down_box BORDER_BOX labelsize 10 when 1 textsize 10
    897             code0 {o->init("Pmodulation");}
    898             class Fl_Osc_Choice
    899           } {
    900             MenuItem {} {
    901               label None
    902               xywh {65 65 100 20} labelfont 1 labelsize 10
    903             }
    904             MenuItem {} {
    905               label Rev
    906               xywh {75 75 100 20} labelfont 1 labelsize 10
    907             }
    908             MenuItem {} {
    909               label Sine
    910               xywh {85 85 100 20} labelfont 1 labelsize 10
    911             }
    912             MenuItem {} {
    913               label Pow
    914               xywh {95 95 100 20} labelfont 1 labelsize 10
    915             }
    916           }
    917           Fl_Dial modpar1 {
    918             callback {redrawoscil();}
    919             tooltip {Oscillator's modulation parameter 1} xywh {535 320 15 15} maximum 127 step 1
    920             code0 {o->init("Pmodulationpar1");o->reset_value=64;}
    921             class Fl_Osc_Dial
    922           }
    923           Fl_Dial modpar2 {
    924             callback {redrawoscil();}
    925             tooltip {Oscillator's modulation parameter 2} xywh {555 320 15 15} maximum 127 step 1
    926             code0 {o->init("Pmodulationpar2");o->reset_value=64;}
    927             class Fl_Osc_Dial
    928           }
    929           Fl_Dial modpar3 {
    930             callback {redrawoscil();}
    931             tooltip {Oscillator's modulation parameter 3} xywh {575 320 15 15} maximum 127 step 1
    932             code0 {o->init("Pmodulationpar3");o->reset_value=32;}
    933             class Fl_Osc_Dial
    934           }
    935         }
    936         Fl_Button {} {
    937           label Sine
    938           callback {if (!fl_choice("Convert to SINE?","No","Yes",NULL)) return;
    939 
    940 osc->requestValue(loc+"convert2sine");
    941 bftype->update();
    942 bfpar->value(0);
    943 bfpar->do_callback();
    944 
    945 redrawoscil();
    946 refresh();}
    947           xywh {675 530 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
    948         }
    949         Fl_Button {} {
    950           label C
    951           callback {presetsui->copy(dummy->loc());}
    952           xywh {675 550 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
    953         }
    954         Fl_Button {} {
    955           label P
    956           callback {presetsui->paste(dummy->loc(), this);}
    957           xywh {705 550 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
    958         }
    959         Fl_Scroll _this_has_to_be_the_last {
    960           xywh {10 345 660 250} type HORIZONTAL box FLAT_BOX
    961         } {
    962           Fl_Pack harmonics {open
    963             xywh {15 350 650 225} type HORIZONTAL
    964             code0 {for (int i=0;i<(MAX_AD_HARMONICS - 1);i++){h[i]=new Oscilharmonic(0,0,20,o->h(),"");h[i]->init(i,oscildisplaygroup,loc,osc);}}
    965           } {}
    966         }
    967       }
    968     }
    969   }
    970   Function {OscilEditor(bool adnotep_, std::string loc_, Fl_Osc_Interface *osc_)} {open
    971   } {
    972     code { assert(osc_);
    973 assert(!loc_.empty());
    974 
    975 initialized = false;
    976 
    977 adnotep = adnotep_;
    978 osc = osc_;
    979 loc = loc_;
    980 
    981 oscilo = NULL;
    982 oscilo_base = NULL;
    983 oscils = NULL;
    984 oscils_base = NULL;
    985 
    986 osceditUI = NULL;
    987 dummy = NULL;
    988 applybutton = NULL;
    989 oscildisplaygroup = NULL;
    990 rndslider = NULL;
    991 hrndtype = NULL;
    992 magtype = NULL;
    993 basefuncdisplaygroup = NULL;
    994 bfpar = NULL;
    995 bftype = NULL;
    996 make_window();
    997 if(!adnotep)
    998     osceditUI->label("PADsynth Harmonic Content Editor");
    999 bftype->init("Pcurrentbasefunc");
   1000 initialized = true;
   1001 
   1002 refresh();
   1003 osceditUI->show();} {}
   1004   }
   1005   Function {~OscilEditor()} {open
   1006   } {
   1007     code {osceditUI->hide();
   1008 for (int i=0; i<(MAX_AD_HARMONICS - 1); ++i)
   1009     delete h[i];
   1010 
   1011 delete oscilo;
   1012 delete oscilo_base;
   1013 delete oscils;
   1014 delete oscils_base;
   1015 delete osceditUI;} {}
   1016   }
   1017   Function {refresh()} {} {
   1018     code {magtype->update();
   1019 
   1020     for (int i=0;i<(MAX_AD_HARMONICS - 1);i++) h[i]->refresh();
   1021 
   1022     osc->requestValue(loc+"prepare");
   1023 
   1024     basefuncdisplaygroup->redraw();
   1025 redrawoscil();} {}
   1026   }
   1027   Function {redrawoscil()} {open
   1028   } {
   1029     code {
   1030     if(!initialized) //Must have been called during initialization
   1031         return;
   1032     //get data from backend
   1033 osc->requestValue(loc+"prepare");
   1034 oscilo->update();
   1035 oscils->update();
   1036 oscilo_base->update();
   1037 oscils_base->update();} {}
   1038   }
   1039   Function {setbfmodstatus(int menuentry)} {open
   1040   } {
   1041     code {
   1042     switch (menuentry){
   1043     case 0:
   1044          bfpar->deactivate();
   1045          bfparval->deactivate();
   1046          basefuncmodulation->deactivate();
   1047          break;
   1048     case 127:
   1049          bfpar->deactivate();
   1050          bfparval->deactivate();
   1051          basefuncmodulation->activate();
   1052          break;
   1053     default:
   1054          bfpar->activate();
   1055          bfparval->activate();
   1056          basefuncmodulation->activate();
   1057     }
   1058     } {} }
   1059 
   1060   decl {Oscilharmonic *h[(MAX_AD_HARMONICS - 1)];} {private local
   1061   }
   1062   decl {std::string loc;} {private local
   1063   }
   1064   decl {Fl_Osc_Interface *osc;} {private local
   1065   }
   1066   decl {Fl_Oscilloscope *oscilo, *oscilo_base;} {private local
   1067   }
   1068   decl {Fl_OscilSpectrum *oscils, *oscils_base;} {private local
   1069   }
   1070   decl {bool adnotep;} {private local
   1071   }
   1072   decl {bool initialized;} {private local
   1073   }
   1074 }