From 6c358a842baaf6d211a5c8c1717d815e7813ed96 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 11 Jul 2021 18:45:38 +0800 Subject: First commit Now I have a kind of piano like instrument. A violin-like instrument is being constructed. --- instrument.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 instrument.h (limited to 'instrument.h') diff --git a/instrument.h b/instrument.h new file mode 100644 index 0000000..0ab12c9 --- /dev/null +++ b/instrument.h @@ -0,0 +1,33 @@ +#ifndef INSTRUMENT_H +#define INSTRUMENT_H +#include "util.h" + +struct Instrument_s; + +typedef struct Instrument_s Instrument; + +typedef WaveFrag (*sound_t)(void *, Volume v, Hertz h, Seconds s); +typedef WaveFrag (*merger_t)(void *, WaveFrag *, LENT, int); + +WaveFrag make_sound(Instrument * in, Volume v, Hertz h, Seconds s); + +WaveFrag piano_sound(void * in, Volume v, Hertz h, Seconds s); + +/* Need this so that we can let instruments control reverberation, + say. */ + +U_ATTR WaveFrag merge_waves(Instrument *in, WaveFrag *frags, LENT len, int step); + +/* Various instruments */ + +Instrument *make_piano(); + +void destroy_piano(Instrument *in); + +/* Violin */ + +Instrument * make_violin(); + +void destroy_violin(Instrument *in); + +#endif -- cgit v1.2.3-18-g5258