/*
 * envgen.h - Envelope generator code 
 */

#define ENV_OFF     0
#define ENV_ATTACK  1
#define ENV_DECAY   2
#define ENV_SUSTAIN 3
#define ENV_RELEASE 4
#define ENV_FINISH  5

typedef struct {
  unsigned long time; /* samples/time to reach full value */
  long value;         /* value */
} envelope_stage;
 
typedef struct {
  int stage;            /* Which stage the envelope is in */

  unsigned long evpos;  /* Where the envelope is at timewise */
  long curvalue;        /* current value */

  envelope_stage stages[6];

} envelope;


