synth.hpp 764 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef SYNTH
  2. #define SYNTH
  3. #include <sekai/VVDReader.h>
  4. #include <sekai/WorldSynth2.h>
  5. #include <vector>
  6. struct segment
  7. {
  8. float* x;
  9. float* y;
  10. int count;
  11. };
  12. class Synth
  13. {
  14. public:
  15. Synth();
  16. ~Synth();
  17. void init(int samplerate,int buffer_size);
  18. void noteOn(int notenum,int velocity);
  19. void noteOff(int notenum);
  20. void fill(float* samples,int count);
  21. private:
  22. //synth
  23. int samplerate;
  24. int buffer_size;
  25. WorldSynth2* synth;
  26. VVDReader* reader;
  27. float* vvddata;
  28. //input handling
  29. int notenum;
  30. int current_oto;
  31. std::vector<segment*> segments;
  32. bool enabled;
  33. segment* getCurrentSegment(int pos);
  34. float getCurrentF0(int pos);
  35. };
  36. #endif