zynaddsubfx

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

Fl_Osc_Dial.H (1665B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   Fl_Osc_Dial.H - OSC Controlled Knob
      5   Copyright (C) 2016 Mark McCurry
      6 
      7   This program is free software; you can redistribute it and/or
      8   modify it under the terms of the GNU General Public License
      9   as published by the Free Software Foundation; either version 2
     10   of the License, or (at your option) any later version.
     11 */
     12 #pragma once
     13 #include <FL/Fl_Dial.H>
     14 #include "WidgetPDial.h"
     15 #include "Fl_Osc_Widget.H"
     16 #include <string>
     17 
     18 class Fl_Osc_Dial:public WidgetPDial, public Fl_Osc_Widget
     19 {
     20 
     21     public:
     22         Fl_Osc_Dial(int X, int Y, int W, int H, const char *label = NULL);
     23         virtual ~Fl_Osc_Dial(void);
     24 
     25         //Hack to get non-local controls up and running
     26         void alt_init(std::string base, std::string path_);
     27 
     28 
     29         //Normal Initialization
     30         void init(std::string path);
     31         //void OSC_value(float);
     32         void OSC_value(int);
     33         void OSC_value(char);
     34         void OSC_value(float);
     35         using Fl_Osc_Widget::OSC_value;
     36 
     37         //Refetch parameter information
     38         void update(void);
     39         void callback(Fl_Callback *cb, void *p = NULL);
     40 
     41         //Midi learn handler
     42         int handle(int);
     43 
     44         void mark_dead(void);
     45         virtual void rebase(std::string new_base) override;
     46 
     47         void cb(void);
     48 
     49         //! normally, it's all uchar. this hack makes it a float dial
     50         void make_float() { dataType = dataTypeT::type_float; }
     51     private:
     52         enum class dataTypeT
     53         {
     54             type_uchar, type_float
     55         } dataType = dataTypeT::type_uchar;
     56         bool alt_style;
     57         bool dead;
     58         std::pair<Fl_Callback*, void*> cb_data;
     59 };