#define SRATE 48000.0 #define SFREQ (1/SRATE) #define SMAX 32767.0 #define ABUFSZ 1024 typedef signed short sample; typedef struct Abuf Abuf; struct Abuf { uchar buf[ABUFSZ]; int fd, p; }; void ainit(Abuf *ab, int fd); void aput(Abuf *ab, signed short n); int aget(Abuf *ab, sample *n); void aputd(Abuf *ab, double n); int agetd(Abuf *ab, double *n); void aflush(Abuf *ab); double miditofreq(int note); double miditophase(int note); double voltomul(int level);