No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

oscillator.h 470B

1234567891011121314151617181920212223
  1. #ifndef OSCILLATOR_H_
  2. #define OSCILLATOR_H_
  3. #include "types.h"
  4. struct Oscillator {
  5. fixed phase, sub_phase; // fixed 16.16
  6. fixed freq; // fixed 16.16
  7. fixed period; // period in samples, fixed 16.16
  8. enum {
  9. Rectangle,
  10. Triangle
  11. } type;
  12. uint8_t sub_oct; // 0-2
  13. uint8_t pulse_width; // 0 - 127
  14. };
  15. int16_t oscillator_render_sample(struct Oscillator *osc);
  16. void oscillator_set_freq(struct Oscillator *osc, float freq); // fixed 16.16
  17. #endif /* OSCILLATOR_H_ */