EnvelopeFreeEdit.h (1661B)
1 /* 2 ZynAddSubFX - a software synthesizer 3 4 EnvelopeFreeEdit.h - Envelope Edit 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 #include <FL/Fl_Box.H> 14 #include "../Params/EnvelopeParams.h" 15 #include "Fl_Osc_Widget.H" 16 17 18 //Define the types of envelope (TODO a properly located enum) 19 //TODO check if ASR should be ASR *OR* ADR 20 21 #define ENV_ADSR 1 22 //#define ENV_ADSR 2 23 #define ENV_ASR 3 24 #define ENV_ADSR_FILTER 4 25 #define ENV_ADSR_BW 5 26 27 class EnvelopeFreeEdit : public Fl_Box, public Fl_Osc_Widget 28 { 29 public: 30 EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0); 31 void init(void); 32 void setpair(Fl_Box *pair_); 33 int handle(int event) override; 34 35 void draw(void) override; 36 void OSC_raw(const char *msg) override; 37 void update(void) override; 38 void rebase(std::string new_base) override; 39 40 41 int lastpoint; 42 43 //How many points 44 char Penvpoints; 45 private: 46 int getpointx(int n) const; 47 int getpointy(int n) const; 48 int getnearest(int x,int y) const; 49 float getdt(int i) const; 50 51 Fl_Box *pair; //XXX what the heck is this? 52 53 //cursor state 54 int currentpoint, cpx, cpy, cpdt, cpval; 55 56 //The Points 57 char Penvdt[MAX_ENVELOPE_POINTS]; 58 char Penvval[MAX_ENVELOPE_POINTS]; 59 //The Sustain point 60 char Penvsustain; 61 int mod_state; 62 };