zynaddsubfx

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

Fl_Osc_Slider.H (1461B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   Fl_Osc_Slider.H - OSC Based Slider
      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_Slider.H>
     14 #include "Fl_Osc_Widget.H"
     15 #include <string>
     16 
     17 class Fl_Osc_Slider:public Fl_Slider, public Fl_Osc_Widget
     18 {
     19     public:
     20         Fl_Osc_Slider(int X, int Y, int W, int H, const char *label = NULL);
     21        // string name,
     22         //        const char *metadata);
     23 
     24         virtual ~Fl_Osc_Slider(void);
     25         void OSC_value(int) override;
     26         void OSC_value(float) override;
     27         void OSC_value(char) override;
     28         void init(std::string, char type = 'f');
     29 
     30         //Refetch parameter information
     31         void update(void);
     32         void callback(Fl_Callback *cb, void *p = NULL);
     33         
     34         //MIDI Learn
     35         int handle(int ev, int X, int Y, int W, int H);
     36         int handle(int ev);
     37 
     38         virtual void cb(void);
     39         static void _cb(Fl_Widget *w, void *);
     40         float reset_value;
     41     protected:
     42         char osc_type;
     43         std::pair<Fl_Callback*, void*> cb_data;
     44 
     45     private:
     46         float old_value;
     47         int mod_state;
     48         int slow_state;
     49         int start_pos;
     50         bool just_pushed;
     51     float denominator;
     52 };