VoiceDefESPEAK.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Copyright 2011-2020 Tobias "Tomoko" Platen
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef VOICEDEF_ESPEAK_H
  15. #define VOICEDEF_ESPEAK_H
  16. #include <sekai/VoiceSampler.h>
  17. #include <string>
  18. #include <vector>
  19. struct segment
  20. {
  21. uint8_t type;
  22. uint32_t start;
  23. uint32_t length;
  24. };
  25. struct pho_event
  26. {
  27. std::string code;
  28. uint32_t type;
  29. uint32_t start;
  30. };
  31. class VoiceDefESPEAK : public VoiceDef {
  32. public:
  33. VoiceDefESPEAK(std::string path);
  34. virtual ~VoiceDefESPEAK();
  35. void getImpulseResponse(float pos, float *impulseResponse,
  36. int *impulseResponseLength,float morph);
  37. float getLength();
  38. int getSamplerate() { return _samplerate; }
  39. virtual std::string getPhoLine(int index);
  40. private:
  41. std::vector<short> _samples;
  42. std::vector<pho_event> _pho_events;
  43. std::vector<segment> _segments;
  44. uint32_t _samplerate = 0;
  45. uint32_t _period = 0;
  46. };
  47. // realtime_demo needs upgrade
  48. #endif