30 lines
457 B
C
30 lines
457 B
C
#ifndef NOTE_H
|
|
#define NOTE_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
WAVE_NONE,
|
|
WAVE_SINE,
|
|
WAVE_SQUARE,
|
|
WAVE_SAW,
|
|
WAVE_TRIANGLE
|
|
} Waveform;
|
|
|
|
typedef struct {
|
|
float phase;
|
|
float freq;
|
|
float gain;
|
|
float attack_ms;
|
|
float release_ms;
|
|
float filter_cutoff;
|
|
float lp;
|
|
bool is_playing;
|
|
Waveform form;
|
|
} Note;
|
|
|
|
void play_note(Note *note, int16_t *buffer, int buffer_size);
|
|
|
|
#endif // NOTE_H
|