Newer
Older
music / app / src / main / cpp / effects / Envelope.h
  1. #ifndef MUSIC_ENVELOPE_H
  2. #define MUSIC_ENVELOPE_H
  3.  
  4. class Envelope;
  5.  
  6. #include <cstdint>
  7. #include "../AudioHost.h"
  8. #include "Processable.h"
  9.  
  10. enum EnvelopePhase {
  11. NONE, ATTACK, DELAY, SUSTAIN, RELEASE,
  12. };
  13.  
  14. class Envelope : public Processable {
  15. private:
  16. EnvelopePhase phase;
  17. float attackIncrement, delayIncrement, releaseIncrement;
  18. float value = 0;
  19. public:
  20. float attack = 0.05, delay = 0.2, sustain = 0.75, release = 1;
  21.  
  22. void initialize(AudioHost *host);
  23.  
  24. void startNote();
  25.  
  26. void endNote();
  27.  
  28. void doRender(uint32_t sampleCount);
  29. };
  30.  
  31.  
  32. #endif