PluginInterfaces.h 3.3 KB

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