PluginInterfaces.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 PLUGININTERFACES_H
  19. #define PLUGININTERFACES_H
  20. #include <QStringList>
  21. #include <QtPlugin>
  22. class QAction;
  23. #include "Utils.h"
  24. struct selectionRange {
  25. int start;
  26. int end;
  27. };
  28. class IController {
  29. public:
  30. virtual void startPlayback(float pos) = 0;
  31. virtual void stopPlayback() = 0;
  32. virtual void logError(const QString& error) = 0;
  33. virtual void logDebug(const QString& debug) = 0;
  34. virtual void logSuccess(const QString& success) = 0;
  35. virtual void addPluginAction(QAction* action) = 0;
  36. virtual int sampleRate() = 0;
  37. virtual void startOfflinePlayback(const QString& fileName) = 0;
  38. };
  39. struct synthPoint
  40. {
  41. float x;
  42. float y;
  43. };
  44. struct synthNote {
  45. float rest;
  46. float lenght;
  47. float start;
  48. int pitch;
  49. QString lyric;
  50. QList <synthPoint> dyn;
  51. QList <synthPoint> pit;
  52. QStringList pho; // TODO fill
  53. };
  54. class IScore {
  55. public:
  56. virtual int getNoteCount() = 0;
  57. virtual synthNote getNote(int index) = 0;
  58. };
  59. class IPreviewSynth {
  60. public:
  61. virtual ~IPreviewSynth() {}
  62. virtual QString name() = 0;
  63. virtual QString description() = 0;
  64. virtual QString version() = 0;
  65. virtual void setup(IController* ctrl) = 0;
  66. virtual void readData(float* data, int length) = 0;
  67. virtual void start(float fractionalMidiNumber) = 0;
  68. virtual void stop() = 0;
  69. };
  70. class ISynth {
  71. public:
  72. virtual ~ISynth() {}
  73. // startup
  74. virtual QString name() = 0;
  75. virtual QString description() = 0;
  76. virtual QString version() = 0;
  77. virtual void setup(IController* ctrl) = 0;
  78. // synth backend
  79. virtual bool setCacheDir(QString cacheDir) = 0;
  80. virtual bool setVoicePath(QString voicePath) = 0;
  81. virtual bool synthesize(IScore* score) = 0;
  82. virtual bool synthIsRealtime() = 0;
  83. virtual int readData(float* data, int size) = 0;
  84. // nlp frontend
  85. virtual QString getTranscription(QString) = 0;
  86. virtual bool doPhonemeTransformation(QStringList&) = 0;
  87. };
  88. #define c_isynth_comname "moe.ecantorix.qtau.ISynth"
  89. #define c_ipreviewsynth_comname "moe.ecantorix.qtau.IPreviewSynth"
  90. Q_DECLARE_INTERFACE(ISynth, c_isynth_comname)
  91. Q_DECLARE_INTERFACE(IPreviewSynth, c_ipreviewsynth_comname)
  92. #endif // PLUGININTERFACES_H