SUBnoteUI.fl (17204B)
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 <stdlib.h>} {public local 12 } 13 14 decl {\#include <stdio.h>} {public local 15 } 16 17 decl {\#include <string.h>} {public local 18 } 19 20 decl {\#include "../globals.h"} {public local 21 } 22 23 decl {\#include "Fl_Osc_VSlider.H"} {public local 24 } 25 26 decl {\#include "Fl_Osc_TSlider.H"} {public local 27 } 28 29 decl {\#include "Fl_Osc_Dial.H"} {public local 30 } 31 32 decl {\#include "EnvelopeUI.h"} {public local 33 } 34 35 decl {\#include "FilterUI.h"} {public local 36 } 37 38 decl {\#include "../Misc/Util.h"} {public local 39 } 40 41 decl {\#include "../Params/SUBnoteParameters.h"} {public local 42 } 43 44 decl {\#include "PresetsUI.h"} {public local 45 } 46 47 class SUBSlider {: {public Fl_Osc_TSlider} 48 } { 49 Function {SUBSlider(int x,int y, int w, int h, const char *label=0) 50 :Fl_Osc_TSlider(x,y,w,h,label)} {open 51 } { code {} {}} 52 Function {OSC_value(int c)} {open return_type void 53 } { code { 54 value(127-c); 55 selection_color(value() == reset_value ? 0 : 222); 56 } {} } 57 Function {cb(void)} {open return_type void 58 } { 59 code { 60 selection_color(value() == reset_value ? 0 : 222); 61 oscWrite(ext, "i", (int)(127-Fl_Slider::value())); 62 if(cb_data.first) 63 cb_data.first(this, cb_data.second); 64 } {} 65 } 66 } 67 68 class SUBnoteharmonic {: {public Fl_Osc_Group} 69 } { 70 Function {make_window()} {private 71 } { 72 Fl_Window harmonic { 73 xywh {329 403 90 305} type Double hide 74 class Fl_Osc_Group 75 } { 76 Fl_Slider mag { 77 tooltip {harmonic's magnitude} xywh {0 15 10 135} type {Vert Knob} box FLAT_BOX selection_color 0 maximum 127 step 1 value 127 78 class SUBSlider 79 } 80 Fl_Slider bw { 81 tooltip {harmonic's bandwidth} xywh {0 157 10 130} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 82 class SUBSlider 83 } 84 Fl_Box {} { 85 xywh {10 219 5 5} box FLAT_BOX color 45 86 code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();} 87 } 88 Fl_Box {} { 89 label 01 90 xywh {0 288 10 15} labelfont 1 labelsize 9 align 20 91 code0 {char tmp[12];snprintf(tmp,sizeof(tmp),"%d",n+1);o->label(strdup(tmp));} 92 } 93 Fl_Box {} { 94 label 01 95 xywh {0 0 10 15} labelfont 1 labelsize 9 align 20 96 code0 {char tmp[12];snprintf(tmp,sizeof(tmp),"%d",n+1);o->label(strdup(tmp));} 97 } 98 } 99 } 100 Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {} { 101 code {n=0;} {} 102 } 103 Function {init(int n_)} {} { 104 code {n=n_; 105 make_window(); 106 harmonic->show(); 107 mag->reset_value=127; 108 mag->ext = "Phmag" + to_s(n); 109 mag->oscRegister(mag->ext.c_str()); 110 mag->set_transform([](float x){return 127.0f - x;}); 111 bw->reset_value=63; 112 bw->ext = "Phrelbw" + to_s(n); 113 bw->oscRegister(bw->ext.c_str()); 114 bw->set_transform([](float x){return 63.0f - x;}); 115 osc->requestValue(base+"Phrelbw"+to_s(n)); 116 117 end();} {} 118 } 119 Function {refresh()} {} { 120 code {// request values for the widgets 121 mag->oscWrite(mag->ext); 122 bw->oscWrite(bw->ext);} {} 123 } 124 Function {~SUBnoteharmonic()} {} { 125 code {harmonic->hide(); 126 hide(); 127 //delete(harmonic);} {} 128 } 129 decl {int n;} {private local 130 } 131 } 132 133 class SUBnoteUI {open : {public PresetsUI_} 134 } { 135 Function {make_window()} {open 136 } { 137 Fl_Window SUBparameters { 138 label {SUBsynth Parameters} open 139 xywh {542 511 735 475} type Double 140 class Fl_Osc_Window visible 141 } { 142 Fl_Box {} { 143 xywh {0 0 0 0} box FLAT_BOX color 45 144 code0 {SUBparameters->init(osc, loc);} 145 } 146 Fl_Scroll {} { 147 label scroll open 148 xywh {5 140 434 330} type HORIZONTAL box FLAT_BOX labeltype NO_LABEL 149 } { 150 Fl_Pack harmonics {open 151 xywh {5 145 425 325} type HORIZONTAL 152 code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(i);}} 153 } {} 154 } 155 Fl_Button {} { 156 label Close 157 callback {SUBparameters->hide();} 158 xywh {670 446 60 25} box THIN_UP_BOX 159 } 160 Fl_Group {} { 161 label AMPLITUDE open 162 xywh {5 5 215 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 163 } { 164 Fl_Value_Slider vol { 165 label Vol 166 tooltip Volume xywh {10 25 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 167 code0 {o->init("PVolume");o->reset_value=96;} 168 class Fl_Osc_VSlider 169 } 170 Fl_Value_Slider vsns { 171 label {V.Sns} 172 tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 173 code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=90;} 174 class Fl_Osc_VSlider 175 } 176 Fl_Dial pan { 177 label Pan 178 tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 179 code0 {o->init("PPanning");o->reset_value=64;} 180 class Fl_Osc_Dial 181 } 182 Fl_Group ampenv { 183 label {SUBsynth - Amplitude Envelope} open 184 xywh {10 65 205 70} box FLAT_BOX color 51 align 144 185 code0 {o->init(ENV_ADSR, osc, loc, "AmpEnvelope/");} 186 class EnvelopeUI 187 } {} 188 } 189 Fl_Group {} { 190 xywh {495 406 235 35} box UP_FRAME 191 } { 192 Fl_Counter filterstages { 193 label {Filter Stages} 194 tooltip {How many times the noise is filtered} xywh {515 421 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10 195 code0 {o->init("Pnumstages");} 196 class Fl_Osc_Counter 197 } 198 Fl_Choice magtype { 199 label {Mag.Type} 200 xywh {585 421 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 201 code0 {o->init("Phmagtype");} 202 class Fl_Osc_Choice 203 } { 204 MenuItem {} { 205 label Linear 206 xywh {20 20 100 20} labelfont 1 labelsize 11 207 } 208 MenuItem {} { 209 label {-40dB} 210 xywh {30 30 100 20} labelfont 1 labelsize 11 211 } 212 MenuItem {} { 213 label {-60dB} 214 xywh {40 40 100 20} labelfont 1 labelsize 11 215 } 216 MenuItem {} { 217 label {-80dB} 218 xywh {50 50 100 20} labelfont 1 labelsize 11 219 } 220 MenuItem {} { 221 label {-100dB} 222 xywh {60 60 100 20} labelfont 1 labelsize 11 223 } 224 } 225 Fl_Choice start { 226 label Start selected 227 xywh {670 420 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 228 code0 {o->init("Pstart");} 229 class Fl_Osc_Choice 230 } { 231 MenuItem {} { 232 label Zero 233 xywh {30 30 100 20} labelfont 1 labelsize 11 234 } 235 MenuItem {} { 236 label RND 237 xywh {40 40 100 20} labelfont 1 labelsize 11 238 } 239 MenuItem {} { 240 label {Max.} 241 xywh {50 50 100 20} labelfont 1 labelsize 11 242 } 243 } 244 } 245 Fl_Group freqsettingsui { 246 label FREQUENCY open 247 xywh {440 5 295 146} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 248 } { 249 Fl_Group freqenvelopegroup { 250 label {SUBsynth - Frequency Envelope} open 251 xywh {445 75 205 70} box FLAT_BOX color 51 align 144 252 code0 {o->init(ENV_ASR, osc, loc, "FreqEnvelope/");} 253 class EnvelopeUI 254 } {} 255 Fl_Check_Button freqee { 256 label Enabled 257 callback {if (o->value()==0) freqenvelopegroup->deactivate(); 258 else freqenvelopegroup->activate(); 259 o->show(); 260 freqsettingsui->redraw();} 261 xywh {445 77 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 262 code0 {o->init("PFreqEnvelopeEnabled");} 263 class Fl_Osc_Check 264 } 265 Fl_Counter octave { 266 label Octave 267 tooltip Octave xywh {670 58 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 268 code0 {o->init("octave");} 269 class Fl_Osc_Counter 270 } 271 Fl_Counter coarsedet { 272 label {Coarse Det.} 273 tooltip {Coarse Detune} xywh {655 125 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 274 code0 {o->init("coarsedetune");} 275 code3 {o->lstep(10);} 276 class Fl_Osc_Counter 277 } 278 Fl_Slider detune { 279 callback {o->oscWrite("detunevalue");} 280 tooltip {Fine Detune (cents)} xywh {495 27 230 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 281 code0 {o->init("PDetune",'i');} 282 class Fl_Osc_Slider 283 } 284 Fl_Value_Output detunevalueoutput { 285 label Detune 286 xywh {448 27 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 287 code0 {o->init("detunevalue");} 288 class Fl_Osc_Output 289 } 290 Fl_Dial bendadjdial { 291 label Bend 292 tooltip {How the frequency varies according to the pitch wheel} xywh {448 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 293 code0 {o->init("PBendAdjust"); o->reset_value=24;o->set_transform([](float x){return x/24.0f;});o->set_rounding(2);} 294 class Fl_Osc_Dial 295 } 296 Fl_Dial offsethzdial { 297 label Offset 298 tooltip {Offset of frequency in Hz} xywh {500 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 299 code0 {o->init("POffsetHz"); o->set_rounding(2); o->set_transform([](float x){x/=64; return 15*(x*sqrtf(fabsf(x)));});} 300 class Fl_Osc_Dial 301 } 302 Fl_Check_Button hz440 { 303 label 440Hz 304 callback {if (o->value()==0) fixedfreqetdial->deactivate(); 305 else fixedfreqetdial->activate();} 306 tooltip {set the base frequency to 440Hz} xywh {555 53 50 15} down_box DOWN_BOX labelfont 1 labelsize 10 307 code0 {o->init("Pfixedfreq");} 308 class Fl_Osc_Check 309 } 310 Fl_Dial fixedfreqetdial { 311 label {Eq.T.} 312 tooltip {How the frequency varies according to the keyboard (leftmost for fixed frequency)} xywh {610 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 313 code0 {o->init("PfixedfreqET");} 314 class Fl_Osc_Dial 315 } 316 Fl_Choice detunetype { 317 label {Detune Type} 318 callback {o->oscWrite("detunevalue");} open 319 xywh {655 94 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 320 code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} 321 code1 {o->init("PDetuneType",1);} 322 class Fl_Osc_Choice 323 } {} 324 } 325 Fl_Check_Button stereo { 326 label Stereo 327 xywh {440 406 55 35} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 328 code0 {o->init("Pstereo");} 329 class Fl_Osc_Check 330 } 331 Fl_Button {} { 332 label Clear 333 callback {o->oscWrite("clear"); 334 for (int i=1;i<MAX_SUB_HARMONICS;i++){ 335 h[i]->mag->oscWrite(h[i]->mag->ext, "i", 0); 336 h[i]->bw->oscWrite(h[i]->bw->ext, "i", 64); 337 }; 338 h[0]->mag->oscWrite(h[0]->mag->ext, "i", 127); 339 h[0]->bw->oscWrite(h[0]->bw->ext, "i", 64); 340 SUBparameters->redraw();} 341 tooltip {Clear the harmonics} xywh {445 446 70 25} box THIN_UP_BOX 342 class Fl_Osc_Button 343 } 344 Fl_Group bandwidthsettingsui { 345 label BANDWIDTH 346 xywh {220 5 220 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 347 } { 348 Fl_Group bandwidthenvelopegroup { 349 label {SUBsynth - BandWidth Envelope} open 350 xywh {225 65 205 70} box FLAT_BOX color 51 align 144 351 code0 {o->init(ENV_ADSR_BW, osc, loc, "BandWidthEnvelope/");} 352 class EnvelopeUI 353 } {} 354 Fl_Check_Button bwee { 355 label Enabled 356 callback {if (o->value()==0) bandwidthenvelopegroup->deactivate(); 357 else bandwidthenvelopegroup->activate(); 358 o->show(); 359 bandwidthsettingsui->redraw();} 360 xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 361 code0 {o->init("PBandWidthEnvelopeEnabled");} 362 class Fl_Osc_Check 363 } 364 Fl_Value_Slider bandwidth { 365 label {Band Width} 366 xywh {225 40 115 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 maximum 127 step 1 367 code0 {o->init("Pbandwidth");o->reset_value=40;} 368 class Fl_Osc_VSlider 369 } 370 Fl_Value_Slider bwidthscale { 371 label {B.Width Scale} 372 tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1 373 code0 {o->init("Pbwscale",'i');} 374 class Fl_Osc_TSlider 375 } 376 } 377 Fl_Group globalfiltergroup { 378 label FILTER 379 xywh {440 221 290 185} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 380 } { 381 Fl_Group filterenv { 382 label {SUBsynth - Filter Envelope} open 383 xywh {445 331 275 70} box FLAT_BOX color 51 align 144 384 code0 {o->init(ENV_ADSR_FILTER, osc, loc, "GlobalFilterEnvelope/");} 385 class EnvelopeUI 386 } {} 387 Fl_Group filterui { 388 label {SUBsynthl - Filter} open 389 xywh {445 246 275 75} box FLAT_BOX color 50 align 144 390 code0 {o->init(loc + "PGlobalFilter" , osc, loc, "GlobalFilter/");} 391 class FilterUI 392 } {} 393 } 394 Fl_Check_Button filtere { 395 label Enabled 396 callback {if (o->value()==0) globalfiltergroup->deactivate(); 397 else globalfiltergroup->activate(); 398 o->show(); 399 globalfiltergroup->redraw();} 400 xywh {445 226 85 20} down_box DOWN_BOX labelfont 1 labelsize 11 401 code0 {o->init("PGlobalFilterEnabled");} 402 class Fl_Osc_Check 403 } 404 Fl_Button {} { 405 label C 406 callback {presetsui->copy(loc);} 407 xywh {600 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 408 } 409 Fl_Button {} { 410 label P 411 callback {presetsui->paste(loc,this);} 412 xywh {630 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 413 } 414 Fl_Group {} { 415 label OVERTONES open 416 xywh {440 151 220 70} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 417 } { 418 Fl_Choice spreadtype { 419 label OvertonesPosition 420 xywh {450 190 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10 421 code0 {o->init("POvertoneSpread.type");} 422 class Fl_Osc_Choice 423 } { 424 MenuItem {} { 425 label Harmonic 426 xywh {0 0 34 20} labelfont 1 labelsize 11 427 } 428 MenuItem {} { 429 label ShiftU 430 xywh {10 10 34 20} labelfont 1 labelsize 11 431 } 432 MenuItem {} { 433 label ShiftL 434 xywh {20 20 34 20} labelfont 1 labelsize 11 435 } 436 MenuItem {} { 437 label PowerU 438 xywh {20 20 34 20} labelfont 1 labelsize 11 439 } 440 MenuItem {} { 441 label PowerL 442 xywh {30 30 34 20} labelfont 1 labelsize 11 443 } 444 MenuItem {} { 445 label Sine 446 xywh {40 40 34 20} labelfont 1 labelsize 11 447 } 448 MenuItem {} { 449 label Power 450 xywh {50 50 34 20} labelfont 1 labelsize 11 451 } 452 MenuItem {} { 453 label Shift 454 xywh {20 20 34 20} labelfont 1 labelsize 11 455 } 456 } 457 Fl_Dial spreadpar1 { 458 label Par1 459 xywh {548 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 460 code0 {o->init("POvertoneSpread.par1");} 461 class Fl_Osc_Dial 462 } 463 Fl_Dial spreadpar2 { 464 label Par2 465 xywh {583 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 466 code0 {o->init("POvertoneSpread.par2");} 467 class Fl_Osc_Dial 468 } 469 Fl_Dial spreadpar3 { 470 label ForceH 471 xywh {618 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 472 code0 {o->init("POvertoneSpread.par3");} 473 class Fl_Osc_Dial 474 } 475 } 476 } 477 } 478 Function {refresh()} {} { 479 code { 480 SUBparameters->update(); 481 for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh(); 482 //globalfiltergroup->redraw(); 483 //ampenv->refresh(); 484 //bandwidthenvelopegroup->refresh(); 485 //freqenvelopegroup->refresh(); 486 //filterui->refresh(); 487 //filterenv->refresh();} {} 488 } 489 Function {SUBnoteUI(Fl_Osc_Interface *osc_, std::string loc_)} {} { 490 code {osc = osc_; 491 loc = loc_; 492 make_window();} {} 493 } 494 Function {~SUBnoteUI()} {} { 495 code {//for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]); 496 SUBparameters->hide(); 497 delete(SUBparameters);} {} 498 } 499 decl {Fl_Osc_Interface *osc;} {private local 500 } 501 decl {std::string loc;} {private local 502 } 503 decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {private local 504 } 505 }