zynaddsubfx

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

MicrotonalUI.fl (9000B)


      1 # data file for the Fltk User Interface Designer (fluid)
      2 version 1.0106 
      3 header_name {.h} 
      4 code_name {.cc}
      5 decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} 
      6 
      7 decl {//License: GNU GPL version 2 or later} {} 
      8 
      9 decl {\#include <stdlib.h>} {public
     10 } 
     11 
     12 decl {\#include <stdio.h>} {public
     13 } 
     14 
     15 decl {\#include <string.h>} {public
     16 } 
     17 
     18 decl {\#include <FL/Fl_File_Chooser.H>} {public
     19 } 
     20 
     21 decl {\#include <FL/fl_ask.H>} {public
     22 } 
     23 
     24 decl {\#include "Fl_Osc_Pane.H"} {public
     25 }
     26 
     27 decl {\#include "Fl_Osc_Value.H"} {public
     28 }
     29 
     30 decl {\#include "Fl_Osc_Check.H"} {public
     31 }
     32 
     33 decl {\#include "Fl_Osc_Counter.H"} {public
     34 }
     35 
     36 decl {\#include "Fl_Osc_Input.H"} {public
     37 }
     38 
     39 decl {\#include "Fl_Osc_Output.H"} {public
     40 }
     41 
     42 decl {\#include "../Misc/Microtonal.h"} {public
     43 } 
     44 
     45 class MicrotonalUI {} {
     46   Function {make_window(Fl_Osc_Interface *osc, std::string base)} {} {
     47     Fl_Window microtonaluiwindow {
     48       label Scales
     49       xywh {99 164 405 450} type Double hide
     50       class Fl_Osc_Window
     51     } {
     52       Fl_Box {} {
     53         xywh {0 0 0 0}
     54         code0 {microtonaluiwindow->init(osc, base);}
     55       }
     56       Fl_Group {} {
     57         tooltip {Center where the note's freqs. are turned upside-down} xywh {249 2 155 45} box ENGRAVED_FRAME
     58       } {
     59         Fl_Check_Button {} {
     60           label {Invert keys}
     61           callback {if (o->value()==0) centerinvertcounter->deactivate();
     62    else centerinvertcounter->activate();}
     63           tooltip {Turn upside-down the note frequencies} xywh {254 13 55 30} down_box DOWN_BOX labelfont 1 labelsize 11 align 148
     64           code0 {o->init("Pinvertupdown");}
     65           class Fl_Osc_Check
     66         }
     67         Fl_Counter centerinvertcounter {
     68           label Center
     69           xywh {319 13 80 20} labelfont 1 labelsize 11 align 130 minimum 0 maximum 127 step 1 textfont 1
     70           code0 {o->lstep(12/*microtonal->getoctavesize()*/);}
     71           code1 {o->init("Pinvertupdowncenter");}
     72           class Fl_Osc_Counter
     73         }
     74       }
     75       Fl_Group microtonalgroup {selected
     76         xywh {3 49 402 398} box ENGRAVED_FRAME
     77       } {
     78         Fl_Button applybutton {
     79           label Retune
     80           callback {apply();}
     81           tooltip {Retune the synth accorging to the inputs from "Tunings" and "Keyboard Mappings"} xywh {8 413 107 28} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13
     82         }
     83         Fl_Value_Output octavesizeoutput {
     84           label {nts./oct.}
     85           tooltip {Notes/Octave} xywh {150 423 35 17} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1
     86           code0 {o->init("octavesize");}
     87           class Fl_Osc_Output
     88         }
     89         Fl_Input nameinput {
     90           label {Name:}
     91           xywh {8 64 285 25} labelfont 1 labelsize 11 align 5
     92           code0 {o->maximum_size(MICROTONAL_MAX_NAME_LEN);}
     93           code1 {o->init("Pname");}
     94           class Fl_Osc_Input
     95         }
     96         Fl_Input tuningsinput {
     97           label {Tunings:}
     98           xywh {8 144 182 264} type Multiline labelfont 1 labelsize 11 align 5 when 2
     99           code0 {o->init("tunings");}
    100           class Fl_Osc_Input
    101         }
    102         Fl_Input commentinput {
    103           label {Comment:}
    104           xywh {8 104 391 25} labelfont 1 labelsize 11 align 5
    105           code0 {o->maximum_size(MICROTONAL_MAX_NAME_LEN);}
    106           code1 {o->init("Pcomment");}
    107           class Fl_Osc_Input
    108         }
    109         Fl_Counter {} {
    110           label Shift
    111           xywh {313 69 70 20} type Simple labelsize 11 align 1 minimum -64 maximum 63 step 1 textfont 1
    112           code0 {o->init("Pscaleshift");}
    113           class Fl_Osc_Counter
    114         }
    115         Fl_Button {} {
    116           label {Import .SCL file}
    117           callback {const char *filename;
    118 filename=fl_file_chooser("Open:","(*.scl)",NULL,0);
    119 if (filename==NULL) return;
    120 osc->write("/load_scl", "s", filename);
    121 if (true) {
    122        updateTuningsInput();
    123        nameinput->update();
    124        commentinput->update();
    125        tuningsinput->position(0);
    126        octavesizeoutput->update();
    127      }
    128      }
    129           tooltip {Inport Scala .scl file (tunings)} xywh {243 411 84 15} box THIN_UP_BOX labelfont 1 labelsize 10
    130         }
    131         Fl_Group keymappinggroup {
    132           label {Keyboard Mapping} open
    133           xywh {193 144 206 264} box ENGRAVED_BOX labelfont 1 labelsize 11
    134         } {
    135           Fl_Input mappinginput {
    136             xywh {250 147 146 258} type Multiline labelfont 1 labelsize 11 align 5 when 2
    137             code0 {o->init("mapping");}
    138             class Fl_Osc_Input
    139           }
    140           Fl_Counter firstnotecounter {
    141             label {First note}
    142             tooltip {First MIDI note number} xywh {199 195 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 11
    143             code0 {o->init("Pfirstkey");}
    144             class Fl_Osc_Counter
    145           }
    146           Fl_Counter lastnotecounter {
    147             label {Last note}
    148             tooltip {Last MIDI note number} xywh {199 225 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 127 textfont 1 textsize 11
    149             code0 {o->init("Plastkey");}
    150             class Fl_Osc_Counter
    151           }
    152           Fl_Counter middlenotecounter {
    153             label {Midle note}
    154             tooltip {Midle note (where scale degree 0 is mapped to)} xywh {199 267 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 60 textfont 1 textsize 11
    155             code0 {o->init("Pmiddlenote");}
    156             class Fl_Osc_Counter
    157           }
    158           Fl_Value_Output mapsizeoutput {
    159             label {Map Size}
    160             xywh {201 382 44 20} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1
    161             code0 {o->init("Pmapsize");}
    162             class Fl_Osc_Output
    163           }
    164         }
    165         Fl_Check_Button mappingenabledbutton {
    166           label ON
    167           callback {if (o->value()==0) keymappinggroup->deactivate();
    168  else keymappinggroup->activate();
    169 o->show();}
    170           tooltip {Enable the Mapping (otherwise the mapping is linear)} xywh {198 150 48 21} box FLAT_BOX down_box DOWN_BOX labelfont 1
    171           code0 {o->init("Pmappingenabled");}
    172           class Fl_Osc_Check
    173         }
    174         Fl_Button {} {
    175           label {Import .kbm file}
    176           callback {
    177           const char *filename;
    178 filename=fl_file_chooser("Open:","(*.kbm)",NULL,0);
    179 if (filename==NULL) return;
    180 osc->write("/load_kbm", "s", filename);
    181 if (true) {
    182        updateMappingInput();
    183        mappinginput->position(0);
    184        mapsizeoutput->update();
    185        firstnotecounter->update();
    186        lastnotecounter->update();
    187        middlenotecounter->update();
    188        mappingenabledbutton->update();
    189        afreqinput->update();
    190        anotecounter->update();
    191      }}
    192           tooltip {Inport Scala .kbm file (keyboard mapping)} xywh {243 428 84 16} box THIN_UP_BOX labelfont 1 labelsize 10
    193         }
    194       }
    195       Fl_Group {} {
    196         xywh {108 2 140 45} box ENGRAVED_FRAME
    197       } {
    198         Fl_Counter anotecounter {
    199           label {"A" Note}
    200           callback {
    201           /*if (microtonal->getnotefreq(o->value() / 12.0f,0)<0.0) o->textcolor(FL_RED);
    202  else o->textcolor(FL_BLACK);*/
    203 
    204 o->redraw();}
    205           tooltip {The "A" note (the reference note for which freq. ("A" freq) is given, default=69)} xywh {173 17 65 20} labelfont 1 labelsize 10 align 129 minimum 0 maximum 127 step 1 value 69 textfont 1 textsize 10
    206           code0 {o->lstep(12);}
    207           code1 {o->init("PAnote");}
    208           class Fl_Osc_Counter
    209         }
    210         Fl_Value_Input afreqinput {
    211           label {"A" Freq.}
    212           tooltip {The freq. of "A" note (default=440.0)} xywh {110 17 61 20} labelfont 1 labelsize 10 align 1 minimum 1 maximum 20000 step 0.001 value 440 textfont 1 textsize 10
    213           code0 {o->init("PAfreq");}
    214           class Fl_Osc_Value
    215         }
    216       }
    217       Fl_Button {} {
    218         label Close
    219         callback {microtonaluiwindow->hide();}
    220         xywh {333 413 67 28} box THIN_UP_BOX
    221       }
    222       Fl_Check_Button {} {
    223         label {Enable Microtonal}
    224         callback {if (o->value()==0) microtonalgroup->deactivate();
    225    else microtonalgroup->activate();}
    226         xywh {3 3 102 45} box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11 align 148
    227         code0 {o->init("Penabled");}
    228         class Fl_Osc_Check
    229       }
    230     }
    231   }
    232   Function {updateTuningsInput()} {} {
    233     code {tuningsinput->update();} {}
    234   }
    235   Function {updateMappingInput()} {} {
    236     code { mappinginput->update(); } {}
    237   }
    238   Function {MicrotonalUI(Fl_Osc_Interface *osc_, std::string base)} {} {
    239     code {osc=osc_;make_window(osc, base);} {}
    240   }
    241   Function {~MicrotonalUI()} {} {
    242     code {microtonaluiwindow->hide();
    243 delete(microtonaluiwindow);} {}
    244   }
    245   Function {show()} {} {
    246     code {microtonaluiwindow->show();} {}
    247   }
    248   Function {apply()} {} {
    249     code {
    250     osc->write("/microtonal/tunings", "s", tuningsinput->value());
    251     osc->write("/microtonal/mapping", "s", mappinginput->value());
    252     octavesizeoutput->update();
    253     mapsizeoutput->update();
    254     anotecounter->update();
    255     } {}
    256   }
    257   decl {Fl_Osc_Interface *osc;} {private local
    258   }
    259 }