zynaddsubfx

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

commit 3ac1ca266104a9d85e9aad0919c700f79cbeabbd
parent 19e1ae3af916ba0f7cdeadf12158389513ce062a
Author: Christopher A. Oliver <[email protected]>
Date:   Sun, 18 Oct 2015 00:34:08 -0400

Add tipwins to sliders that otherwise say nothing.
Connect Prand slider to backend.

Diffstat:
Msrc/UI/ADnoteUI.fl | 16++++++++++++----
Msrc/UI/Fl_Osc_Slider.H | 4++--
Msrc/UI/Fl_Osc_TSlider.H | 2+-
Msrc/UI/Fl_Osc_TSlider.cpp | 2+-
Msrc/UI/Fl_Osc_VSlider.H | 3---
Msrc/UI/Fl_Osc_VSlider.cpp | 2+-
Msrc/UI/MasterUI.fl | 13++++++++-----
Msrc/UI/OscilGenUI.fl | 114++++++++++++++++++++++++++++++++++---------------------------------------------
Msrc/UI/PADnoteUI.fl | 2+-
Msrc/UI/ResonanceUI.fl | 8++++----
Msrc/UI/SUBnoteUI.fl | 56+++++++++++++++++++++++++++++++++++++-------------------
11 files changed, 116 insertions(+), 106 deletions(-)

diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -369,8 +369,12 @@ oscedit=new OscilEditor(true, loc+"FMSmp/", osc_i);} callback {oscFM->phase=64-(int) o->value(); fmoscil->redraw();} xywh {645 415 105 15} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->init("PFMoscilphase", 'i');} - class Fl_Osc_Slider + code0 { + o->init("PFMoscilphase", 'i'); + o->setTransform(180.0/64, 0); + o->setRounding(1); + } + class Fl_Osc_TSlider } Fl_Choice extFMoscil { label Use @@ -551,8 +555,12 @@ o->redraw();} callback {osc->phase=64-(int) o->value(); voiceoscil->redraw();} xywh {10 435 65 10} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->init("Poscilphase", 'i');} - class Fl_Osc_Slider + code0 { + o->init("Poscilphase", 'i'); + o->setTransform(180.0/64, 0); + o->setRounding(1); + } + class Fl_Osc_TSlider } Fl_Check_Button {} { label {R.} diff --git a/src/UI/Fl_Osc_Slider.H b/src/UI/Fl_Osc_Slider.H @@ -24,10 +24,10 @@ class Fl_Osc_Slider:public Fl_Slider, public Fl_Osc_Widget int handle(int ev, int X, int Y, int W, int H); int handle(int ev); - void cb(void); + virtual void cb(void); static void _cb(Fl_Widget *w, void *); float reset_value; - private: + protected: char osc_type; std::pair<Fl_Callback*, void*> cb_data; }; diff --git a/src/UI/Fl_Osc_TSlider.H b/src/UI/Fl_Osc_TSlider.H @@ -10,7 +10,7 @@ class Fl_Osc_TSlider:public Fl_Osc_Slider Fl_Osc_TSlider(int x, int y, int w, int h, const char *label = 0); ~Fl_Osc_TSlider(); int handle(int event); - void set_transform(float scale = 1.0, float offset = 0.0); + void setTransform(float scale = 1.0, float offset = 0.0); float transform(float x); void setRounding(unsigned int digits = 0); private: diff --git a/src/UI/Fl_Osc_TSlider.cpp b/src/UI/Fl_Osc_TSlider.cpp @@ -53,7 +53,7 @@ int Fl_Osc_TSlider::handle(int event) return super; } -void Fl_Osc_TSlider::set_transform(float scale, float offset) +void Fl_Osc_TSlider::setTransform(float scale, float offset) { value_offset = offset; value_scale = scale; diff --git a/src/UI/Fl_Osc_VSlider.H b/src/UI/Fl_Osc_VSlider.H @@ -30,7 +30,4 @@ class Fl_Osc_VSlider:public Fl_Osc_Slider protected: void draw(void); - private: - char osc_type; - std::pair<Fl_Callback*, void*> cb_data; }; diff --git a/src/UI/Fl_Osc_VSlider.cpp b/src/UI/Fl_Osc_VSlider.cpp @@ -10,7 +10,7 @@ #include <sstream> Fl_Osc_VSlider::Fl_Osc_VSlider(int X, int Y, int W, int H, const char *label) - :Fl_Osc_Slider(X,Y,W,H,label), cb_data(NULL, NULL) + :Fl_Osc_Slider(X,Y,W,H,label) { //bounds(0.0f,1.0f); Fl_Slider::callback(Fl_Osc_Slider::_cb); diff --git a/src/UI/MasterUI.fl b/src/UI/MasterUI.fl @@ -64,6 +64,9 @@ decl {\#include "Fl_Osc_Dial.H"} {private local decl {\#include "Osc_DataModel.h"} {private local } +decl {\#include "Fl_Osc_TSlider.H"} {private local +} + decl {\#include "VuMasterMeter.h"} {public local } @@ -146,11 +149,11 @@ bankui->show();} Fl_Slider partvolume { xywh {10 65 30 110} type {Vert Knob} box NO_BOX minimum 127 maximum 0 step 1 value 127 code0 {o->init("Pvolume", 'i');} - class Fl_Osc_Slider + class Fl_Osc_TSlider } Fl_Dial partpanning { xywh {20 180 30 30} maximum 127 step 1 - code0 {o->init("Ppanning");} + code0 {o->init("Ppanning");o->reset_value=64;} class Fl_Osc_Dial } Fl_Button {} { @@ -471,7 +474,7 @@ if (fl_choice("The file *might* exist. \\nOverwrite it?","No","Yes",NULL)) { Fl_Dial mastervolumedial { label {Master Volume} tooltip {Master Volume} xywh {15 32 55 55} box ROUND_UP_BOX labelsize 9 align 130 maximum 127 step 1 - code2 {o->init("volume");} + code2 {o->init("volume"); o->selection_color(FL_RED);} class Fl_Osc_Dial } Fl_Counter masterkeyshiftcounter { @@ -1051,8 +1054,8 @@ bankui->show();} Fl_Slider partpanning { label Pan xywh {185 95 145 15} type {Horz Knob} box NO_BOX labelsize 11 maximum 127 step 1 value 64 - code0 {o->init("Ppanning",'i');} - class Fl_Osc_Slider + code0 {o->init("Ppanning",'i'); o->reset_value=64;} + class Fl_Osc_TSlider } Fl_Choice partrcv { label {Midi Channel Receive} diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl @@ -59,7 +59,10 @@ decl {\#include "Fl_Osc_Choice.H"} {public local decl {\#include "Fl_Osc_Counter.H"} {public local } -decl {\#include "Fl_Osc_Slider.H"} {public local +decl {\#include "Fl_Osc_TSlider.H"} {public local +} + +decl {\#include "Fl_Osc_VSlider.H"} {public local } decl {\#include "PresetsUI.h"} {public local @@ -68,42 +71,27 @@ decl {\#include "PresetsUI.h"} {public local decl {\#include <FL/fl_draw.H>} {public local } -class PSlider {: {public Fl_Slider, public Fl_Osc_Widget} +class OGSlider {: {public Fl_Osc_TSlider} } { - Function {PSlider(int x,int y, int w, int h, const char *label=0):Fl_Slider(x,y,w,h,label)} {open - } { - code {phase=false;} {} - } - Function {handle(int event)} {open return_type int - } { - code {int X=x(),Y=y(),W=w(),H=h(); - -if ((!Fl::event_buttons())|| (event==0)||(Fl::event_shift()==0)) return(Fl_Slider::handle(event)); - -if (!Fl::event_inside(X,Y,W,H)) { - if (event==FL_DRAG){ - Fl_Slider::handle(FL_RELEASE); - Fl_Slider::handle(FL_LEAVE); - deactivate(); - activate(); - return(1); - }else{ - return(Fl_Slider::handle(event)); - }; -} else { - //Fl_Slider::handle(FL_FOCUS); - Fl_Slider::handle(FL_PUSH); -}; + Function {OGSlider(int x,int y, int w, int h, const char *label=0) + :Fl_Osc_TSlider(x,y,w,h,label)} {open + } { code {phase=false; } {} } -return(1);} {} - } Function {OSC_value(char c)} {open return_type void - } { - code {if(phase) - value(c); -else - value(127-c);} {} - } + } { code {value(phase ? c : 127-c); + selection_color(value() == reset_value ? 0 : 222); + redraw(); + } {} } + + Function {cb(void)} {open return_type void + } { code { + selection_color(value() == reset_value ? 0 : 222); + if(cb_data.first) cb_data.first(this, cb_data.second); + } {} } + + Function {update(void)} {open return_type void + } { code {} {} } + decl {bool phase;} {public local } } @@ -117,16 +105,15 @@ class Oscilharmonic {: {public Fl_Group} class Fl_Osc_Group visible } { Fl_Slider mag { - callback {int x=64; -if (Fl::event_button3()) o->value(x); - else x=128-(int)o->value(); -if (x==64) o->selection_color(0); - else o->selection_color(222); + callback {int x=127-(int)o->value(); +//if (x==64) o->selection_color(0); +// else o->selection_color(222); o->osc->writeValue(o->loc+"magnitude"+to_s(n), (char)x); if (x==64) { o->osc->writeValue(o->loc+"phase"+to_s(n), (char)64); phase->value(64); + phase->selection_color(0); } o->osc->requestValue(o->loc+"prepare"); o->osc->requestValue(o->loc+"spectrum"); @@ -136,14 +123,11 @@ display->redraw();} xywh {0 15 15 115} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64 code0 {o->phase=false;//o->value(127-oscil->Phmag[n]);} code1 {//if (oscil->Phmag[n]==64) o->selection_color(0);} - class PSlider + class OGSlider } Fl_Slider phase { - callback {int x=64; -if (Fl::event_button3()) o->value(x); - else x=(int)o->value(); - -o->osc->writeValue(o->loc+"phase"+to_s(n), (char) x); + callback { +o->osc->writeValue(o->loc+"phase"+to_s(n), (char) o->value()); o->osc->requestValue(o->loc+"prepare"); o->osc->requestValue(o->loc+"spectrum"); o->osc->requestValue(o->loc+"waveform"); @@ -151,7 +135,7 @@ o->osc->requestValue(o->loc+"waveform"); display->redraw();} xywh {0 135 15 75} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64 code0 {o->phase=true;//o->value(oscil->Phphase[n]);} - class PSlider + class OGSlider } Fl_Box {} { xywh {15 70 5 5} box FLAT_BOX color 45 @@ -187,8 +171,13 @@ loc = loc_; make_window(); mag->osc = osc; mag->loc = loc; +mag->reset_value = 63; +mag->setTransform(-1, 63); phase->osc = osc; phase->loc = loc; +phase->reset_value = 64; +phase->setRounding(1); +phase->setTransform(-180.0/64, 180.0); osc->createLink(loc+"magnitude"+to_s(n), mag); osc->createLink(loc+"phase"+to_s(n), phase); @@ -201,11 +190,7 @@ harmonic->show();} {} } { code {osc->requestValue(loc+"magnitude"+to_s(n));//mag->value(127-oscil->Phmag[n]); osc->requestValue(loc+"phase"+to_s(n));//phase->value(oscil->Phphase[n]); - -if (mag->value()==64) - mag->selection_color(0); -else - mag->selection_color(222);} {} +} {} } Function {~Oscilharmonic()} {open } { @@ -265,10 +250,10 @@ class OscilEditor {open : {public PresetsUI_} } Fl_Value_Slider rndslider { label rnd - callback {(void)o;//oscil->Prand=(int)o->value()+64; -oscildisplaygroup->redraw();} + callback {} tooltip {Oscilator 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 - code0 {(void)o;//if (oscil->ADvsPAD) o->hide();} + code0 {(void)o->init("Prand");//if (oscil->ADvsPAD) o->hide();} + class Fl_Osc_VSlider } Fl_Group {} {open xywh {15 35 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 @@ -494,8 +479,8 @@ redrawoscil();} label {Use as base} callback {osc->requestValue(loc+"use-as-base"); if (autoclearbutton->value()){ - for (int i=0;i<(MAX_AD_HARMONICS - 1);i++){ - h[i]->mag->value(64); + for (int i=1;i<(MAX_AD_HARMONICS - 1);i++){ + h[i]->mag->value(63); h[i]->mag->do_callback(); h[i]->phase->value(64); h[i]->phase->do_callback(); @@ -505,6 +490,8 @@ if (autoclearbutton->value()){ h[0]->mag->value(0); h[0]->mag->do_callback(); + h[0]->phase->value(64); + h[0]->phase->do_callback(); wshbutton->value(0); wshbutton->do_callback(); fltbutton->value(0); @@ -528,19 +515,16 @@ redrawoscil();} label Clear callback {if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return; -for (int i=0;i<(MAX_AD_HARMONICS - 1);i++){ - h[i]->mag->value(64); +for (int i=1;i<(MAX_AD_HARMONICS - 1);i++){ + h[i]->mag->value(63); h[i]->mag->do_callback(); h[i]->phase->value(64); h[i]->phase->do_callback(); }; h[0]->mag->value(0); h[0]->mag->do_callback(); - -//for (int i=0;i<(MAX_AD_HARMONICS - 1);i++){ -// if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0); -// else h[i]->mag->selection_color(222); -//}; +h[0]->phase->value(64); +h[0]->phase->do_callback(); //harmonics->redraw(); osc->requestValue(loc+"prepare"); @@ -839,10 +823,10 @@ redrawoscil();} class Fl_Osc_Dial } Fl_Slider adhrpar { - code0 {o->init("Padaptiveharmonicspar");} + code0 {o->init("Padaptiveharmonicspar");o->reset_value=50;} callback {redrawoscil();} xywh {675 450 55 10} type {Horz Knob} box NO_BOX maximum 100 step 1 value 50 - class Fl_Osc_Slider + class Fl_Osc_TSlider } } Fl_Group {} { diff --git a/src/UI/PADnoteUI.fl b/src/UI/PADnoteUI.fl @@ -32,7 +32,7 @@ decl {\#include <string.h>} {private local decl {\#include <string>} {public local } -decl {\#include "Fl_Osc_Slider.H"} {public local +decl {\#include "Fl_Osc_TSlider.H"} {public local } decl {\#include "Fl_Osc_VSlider.H"} {public local diff --git a/src/UI/ResonanceUI.fl b/src/UI/ResonanceUI.fl @@ -41,7 +41,7 @@ decl {\#include "Fl_Osc_Button.H"} {public local decl {\#include "Fl_Osc_Check.H"} {public local } -decl {\#include "Fl_Osc_Roller.H"} {public local +decl {\#include "Fl_Osc_Slider.H"} {public local } decl {\#include "Fl_Osc_Output.H"} {public local @@ -99,12 +99,12 @@ redrawPADnoteApply();} code0 {o->init("Penabled");} class Fl_Osc_Check } - Fl_Roller maxdb { + Fl_Slider maxdb { callback {maxdbvo->value(o->value()); redrawPADnoteApply();} xywh {90 282 84 15} type Horizontal minimum 1 maximum 90 step 1 value 30 - code0 {o->init("PmaxdB");} - class Fl_Osc_Roller + code0 {o->init("PmaxdB", 'i'); o->reset_value = 30;} + class Fl_Osc_Slider } Fl_Value_Output maxdbvo { label {Max.} diff --git a/src/UI/SUBnoteUI.fl b/src/UI/SUBnoteUI.fl @@ -23,6 +23,9 @@ decl {\#include "../globals.h"} {public local decl {\#include "Fl_Osc_VSlider.H"} {public local } +decl {\#include "Fl_Osc_TSlider.H"} {public local +} + decl {\#include "Fl_Osc_Dial.H"} {public local } @@ -41,6 +44,27 @@ decl {\#include "../Params/SUBnoteParameters.h"} {public local decl {\#include "PresetsUI.h"} {public local } +class SUBSlider {: {public Fl_Osc_TSlider} +} { + Function {SUBSlider(int x,int y, int w, int h, const char *label=0) + :Fl_Osc_TSlider(x,y,w,h,label)} {open + } { code {}} + Function {OSC_value(char c)} {open return_type void + } { code { + value(127-c); + selection_color(value() == reset_value ? 0 : 222); + } {} } + Function {cb(void)} {open return_type void + } { + code { + selection_color(value() == reset_value ? 0 : 222); + oscWrite(ext, "c", (int)(127-Fl_Slider::value())); + if(cb_data.first) + cb_data.first(this, cb_data.second); +} {} + } +} + class PPSlider {: {public Fl_Slider, public Fl_Osc_Widget} } { Function {PPSlider(int x,int y, int w, int h, const char *label=0):Fl_Slider(x,y,w,h,label),Fl_Osc_Widget(this)} {open @@ -110,23 +134,12 @@ class SUBnoteharmonic {: {public Fl_Osc_Group} class Fl_Osc_Group } { Fl_Slider mag { - callback {//TODO consider unifying this with the OscilGenUI display stuff - int x=0; -if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value(); - else o->value(127-x); - o->osc->writeValue(o->loc + o->ext, (char) x); -if (x==0) o->selection_color(0); - else o->selection_color(222);} - tooltip {harmonic's magnitude} xywh {0 15 10 135} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 127 - class PPSlider + tooltip {harmonic's magnitude} xywh {0 15 10 135} type {Vert Knob} box FLAT_BOX selection_color 0 maximum 127 step 1 value 127 + class SUBSlider } Fl_Slider bw { - callback {int x=64; -if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value(); - else o->value(x); - o->osc->writeValue(o->loc + o->ext, (char) x)}; tooltip {harmonic's bandwidth} xywh {0 157 10 130} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - class PPSlider + class SUBSlider } Fl_Box {} { xywh {10 219 5 5} box FLAT_BOX color 45 @@ -151,10 +164,14 @@ if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value(); code {n=n_; make_window(); harmonic->show(); +mag->reset_value=127; mag->ext = "Phmag" + to_s(n); mag->oscRegister(mag->ext.c_str()); +mag->setTransform(-1, 127); +bw->reset_value=63; bw->ext = "Phrelbw" + to_s(n); bw->oscRegister(bw->ext.c_str()); +bw->setTransform(-1, 63); osc->requestValue(base+"Phrelbw"+to_s(n)); end();} {} @@ -362,11 +379,12 @@ freqsettingsui->redraw();} Fl_Button {} { label Clear callback {o->oscWrite("clear"); - for (int i=0;i<MAX_SUB_HARMONICS;i++){ - h[i]->mag->value(127); - h[i]->bw->value(64); + for (int i=1;i<MAX_SUB_HARMONICS;i++){ + h[i]->mag->oscWrite(h[i]->mag->ext, "c", 0); + h[i]->bw->oscWrite(h[i]->bw->ext, "c", 64); }; -h[0]->mag->value(0); +h[0]->mag->oscWrite(h[0]->mag->ext, "c", 127); +h[0]->bw->oscWrite(h[0]->bw->ext, "c", 64); SUBparameters->redraw();} tooltip {Clear the harmonics} xywh {445 446 70 20} box THIN_UP_BOX labelfont 1 labelsize 11 class Fl_Osc_Button @@ -401,7 +419,7 @@ bandwidthsettingsui->redraw();} label {B.Width Scale} 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 code0 {o->init("Pbwscale",'i');} - class Fl_Osc_Slider + class Fl_Osc_TSlider } } Fl_Group globalfiltergroup {