ecantorix_synth.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. This file is part of QTau
  3. Copyright (C) 2013-2018 Tobias "Tomoko" Platen <tplaten@posteo.de>
  4. Copyright (C) 2013 digited <https://github.com/digited>
  5. Copyright (C) 2010-2013 HAL@ShurabaP <https://github.com/haruneko>
  6. QTau is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. SPDX-License-Identifier: GPL-3.0+
  17. */
  18. #ifndef ECANTORIX_SYNTH_H
  19. #define ECANTORIX_SYNTH_H
  20. #include "PluginInterfaces.h"
  21. #include <QJsonArray>
  22. #include <QList>
  23. #include <QMap>
  24. #include "sekai/VVDReader.h"
  25. #include "jack/ringbuffer.h"
  26. #include <sinsy/ringbuffer.h>
  27. #include <QProcess>
  28. class eCantorixSynth : public QObject, public ISynth
  29. {
  30. Q_OBJECT
  31. Q_PLUGIN_METADATA(IID c_isynth_comname FILE "ecantorix_synth.json")
  32. Q_INTERFACES(ISynth)
  33. int _jack_samplerate=0;
  34. QProcess* _synthprocess=nullptr;
  35. QString _cacheDir;
  36. QString _voiceName;
  37. QMap<QString,QString> _voices;
  38. QString _internalVoice;
  39. bool _isRealtime=false;//sound is not ok if realtime is enabled, this needs to be investigated
  40. QJsonArray _score;
  41. IController* _ctrl=nullptr;
  42. RingBuffer* _rb=nullptr;
  43. public:
  44. eCantorixSynth() {}
  45. //plugin loading
  46. QString name() override;
  47. QString description() override;
  48. QString version() override;
  49. void setup(IController *ctrl) override;
  50. //synth base
  51. bool setCacheDir(QString cacheDir) override;
  52. bool setScore(const QJsonArray&) override;
  53. bool synthesize() override;
  54. bool synthIsRealtime() override;
  55. int readData(float *data, int size) override;
  56. //lyricizer
  57. QString getTranscription(QString txt) override;
  58. bool doPhonemeTransformation(QStringList& lyrics) override;
  59. //voice manager
  60. bool setVoice(QString voiceName) override;
  61. QStringList listVoices() override;
  62. private:
  63. void builduScore(); //build microscore for sinsyNG
  64. signals:
  65. void signalStatus(int status);
  66. void logError(QString error);
  67. void logSuccess(QString success);
  68. void logDebug(QString debug);
  69. public slots:
  70. void synthprocess_finished(int exitCode, QProcess::ExitStatus exitStatus);
  71. void on_logError(QString error);
  72. void on_logSuccess(QString success);
  73. void on_logDebug(QString debug);
  74. };
  75. #define SETSEEK 1
  76. #endif // LESYNTH_H