2012-09-02 23:17:59 +02:00
|
|
|
#ifndef SYNTH_H
|
|
|
|
#define SYNTH_H
|
|
|
|
|
|
|
|
#define SYNTH_BUFSIZE (16)
|
|
|
|
#define SYNTH_BUFMASK (0b00001111)
|
|
|
|
|
2012-10-07 02:04:16 +02:00
|
|
|
enum {
|
|
|
|
WAVE_OFF, WAVE_PULSE, WAVE_SAW, WAVE_NOISE
|
|
|
|
};
|
2012-09-02 23:17:59 +02:00
|
|
|
|
|
|
|
typedef struct {
|
2012-10-07 02:04:16 +02:00
|
|
|
uint8_t note;
|
|
|
|
uint8_t inst_nr;
|
2012-09-02 23:17:59 +02:00
|
|
|
uint8_t pos;
|
|
|
|
|
|
|
|
uint16_t phase;
|
|
|
|
uint16_t pulse_width;
|
|
|
|
|
2012-10-07 02:04:16 +02:00
|
|
|
uint8_t level; // envelop level
|
2012-09-02 23:17:59 +02:00
|
|
|
|
|
|
|
} synth_channel_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2012-10-07 02:04:16 +02:00
|
|
|
uint16_t pulse_width;
|
|
|
|
uint8_t pulse_sweep;
|
|
|
|
uint8_t wave_table_pos;
|
|
|
|
uint8_t decay;
|
2012-09-02 23:17:59 +02:00
|
|
|
|
|
|
|
} synth_instrument_t;
|
|
|
|
|
|
|
|
void synth_init(void);
|
|
|
|
void synth_poll(void);
|
|
|
|
|
|
|
|
#endif
|