usynth

simple midi synth for sndio
git clone git://nsmpr.xyz/usynth.git
Log | Files | Refs

fm.h (587B)


      1 typedef struct Voice Voice;
      2 struct Voice {
      3 	int id;
      4 	int status;
      5 	uint8_t key;
      6 	uint8_t channel;
      7 	uint8_t note;
      8 	uint8_t velocity;
      9 	uint8_t pressure;
     10 	struct op_state op[2];
     11 };
     12 
     13 typedef struct Channel Channel;
     14 struct Channel {
     15 	uint8_t program;
     16 	uint8_t pressure;
     17 	uint8_t control[128];
     18 	int16_t pitch;
     19 };
     20 
     21 static Channel fm_channels[16];
     22 static Voice fm_voices[32];
     23 
     24 int64_t fm_synth(Voice*);
     25 int16_t fm_mix(void);
     26 
     27 void fm_fillbuf(int16_t*, size_t);
     28 void fm_init(void);
     29 void fm_key_on(uint8_t*);
     30 void fm_key_off(uint8_t*);
     31 void fm_ctl_change(uint8_t*);
     32 void fm_prog_change(uint8_t*);
     33