/* * Filename: envelope.h * * Description: * * * Version: * Created: Wed Oct 30 17:15:02 2019 * Revision: None * Author: Rachel Fae Fox (foxiepaws),fox@foxiepa.ws * */ #ifndef _H_ENVELOPE #define _H_ENVELOPE #include #include "../common.h" typedef enum EnvState {_e_off,_e_attack, _e_attackrelease, _e_decay, _e_sustain,_e_release, _e_finished} EnvState; typedef struct Envelope { // these values are in samples. unsigned int attack; unsigned int decay; unsigned int release; float sustain_level; float max_level; float min_level; float level; bool gate; unsigned long t; EnvState envstate; bool ar; bool sustain; float(*process)(struct Envelope *,EngineState *); } Envelope; float envelope_process(Envelope *self, EngineState *t); Envelope* envelope_new(); #endif