45 lines
724 B
C
45 lines
724 B
C
#define VOICE_OSCILLATORS 4
|
|
#define VOICE_FILTERS 2
|
|
#define NUM_LFO 4
|
|
|
|
enum {
|
|
PAN_FIXED,
|
|
PAN_OSC,
|
|
PAN_LFO,
|
|
};
|
|
|
|
struct voice_param_t
|
|
{
|
|
uint8_t pan_type;
|
|
union {
|
|
float pan;
|
|
uint8_t pan_osc;
|
|
uint8_t pan_lfo;
|
|
} u;
|
|
|
|
struct control_t shape;
|
|
struct control_t level;
|
|
struct control_t freq_mult;
|
|
struct control_t phase;
|
|
|
|
struct envelope_t env;
|
|
};
|
|
|
|
struct voice_t
|
|
{
|
|
bool playing;
|
|
uint8_t note;
|
|
uint32_t sample;
|
|
uint32_t released;
|
|
|
|
double velocity;
|
|
|
|
struct osc_t osc[VOICE_OSCILLATORS];
|
|
|
|
//struct filter_t fil[VOICE_FILTERS];
|
|
struct bw_filter_t bw[VOICE_FILTERS];
|
|
};
|
|
|
|
void voice_init(struct voice_t *voice, double freq);
|
|
void voice_run(struct voice_t *voice, uint32_t samples, float *left, float *right);
|