Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EnvelopeFreeEdit.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. EnvelopeFreeEdit.h - Envelope Edit View
  4. Copyright (C) 2016 Mark McCurry
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. */
  10. #pragma once
  11. #include <FL/Fl_Box.H>
  12. #include "../Params/EnvelopeParams.h"
  13. #include "Fl_Osc_Widget.H"
  14. //Define the types of envelope (TODO a properly located enum)
  15. //TODO check if ASR should be ASR *OR* ADR
  16. #define ENV_ADSR 1
  17. //#define ENV_ADSR 2
  18. #define ENV_ASR 3
  19. #define ENV_ADSR_FILTER 4
  20. #define ENV_ADSR_BW 5
  21. class EnvelopeFreeEdit : public Fl_Box, public Fl_Osc_Widget
  22. {
  23. public:
  24. EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0);
  25. void init(void);
  26. void setpair(Fl_Box *pair_);
  27. int handle(int event) override;
  28. void draw(void) override;
  29. void OSC_raw(const char *msg) override;
  30. void update(void) override;
  31. void rebase(std::string new_base) override;
  32. int lastpoint;
  33. //How many points
  34. char Penvpoints;
  35. private:
  36. int getpointx(int n) const;
  37. int getpointy(int n) const;
  38. int getnearest(int x,int y) const;
  39. float getdt(int i) const;
  40. Fl_Box *pair; //XXX what the heck is this?
  41. //cursor state
  42. int currentpoint, cpx, cpy, cpdt, cpval;
  43. //The Points
  44. char Penvdt[MAX_ENVELOPE_POINTS];
  45. char Penvval[MAX_ENVELOPE_POINTS];
  46. //The Sustain point
  47. char Penvsustain;
  48. int button_state;
  49. int mod_state;
  50. };