zynaddsubfx

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

FormantFilterGraph.H (2038B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   FormantFilterGraph.H - OSC Formant Filter Graph View
      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 
     14 #include <FL/Fl.H>
     15 #include "Fl_Osc_Widget.H"
     16 #include "WidgetPDial.h"
     17 #include "../globals.h"
     18 #include <FL/Fl_Group.H>
     19 #include "../Params/FilterParams.h"
     20 #include <FL/Fl_Box.H>
     21 #include <FL/fl_draw.H>
     22 #include <FL/fl_ask.H>
     23 #include "common.H"
     24 
     25 class FilterParams;
     26 
     27 class FormantFilterGraph : public Fl_Box, public Fl_Osc_Widget {
     28     public:
     29         FormantFilterGraph(int x,int y, int w, int h, const char *label=0);
     30         void init(int *nvowel_, int *nformant_);
     31         void draw_freq_line(float freq,int type);
     32         void draw();
     33         virtual ~FormantFilterGraph(void);
     34 
     35         void OSC_value(int x, const char *) override;
     36         void OSC_value(unsigned x, void *v) override;
     37 
     38         void rebase(std::string new_base) override;
     39 
     40         void updateVowel(int);
     41         void updateFormant(int);
     42 
     43         void update(void);
     44 
     45     private:
     46         int *nvowel,*nformant;
     47         float *graphpoints;
     48 
     49         struct {
     50             struct {
     51                 unsigned char loc;
     52                 unsigned char freq, amp, q; //frequency,amplitude,Q
     53             } formants[FF_MAX_FORMANTS];
     54         } Pvowels[FF_MAX_VOWELS];
     55 
     56         int Pnumformants;
     57         int Pstages;
     58         int Pcenterfreq;
     59         int Pgain;
     60 
     61         int Pq;
     62         int Poctavesfreq;
     63 
     64 
     65         float getfreqx(float);
     66 
     67         float getfreqpos(float);
     68         float getformantfreq(unsigned char);
     69         float getformantamp(unsigned char);
     70         float getoctavesfreq(void);
     71         float getcenterfreq(void);
     72         float getgain(void);
     73         float getq(void);
     74         float getformantq(unsigned char q);
     75         void formantfilterH(int, int, float*);
     76 };