qtexttospeech.sip 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // qtexttospeech.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtTextToSpeech Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QTextToSpeech : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qtexttospeech.h>
  25. %End
  26. %ConvertToSubClassCode
  27. static struct class_graph {
  28. const char *name;
  29. sipTypeDef **type;
  30. int yes, no;
  31. } graph[] = {
  32. {sipName_QTextToSpeech, &sipType_QTextToSpeech, -1, -1},
  33. };
  34. int i = 0;
  35. sipType = NULL;
  36. do
  37. {
  38. struct class_graph *cg = &graph[i];
  39. if (cg->name != NULL && sipCpp->inherits(cg->name))
  40. {
  41. sipType = *cg->type;
  42. i = cg->yes;
  43. }
  44. else
  45. i = cg->no;
  46. }
  47. while (i >= 0);
  48. %End
  49. public:
  50. enum class BoundaryHint
  51. {
  52. Default,
  53. Immediate,
  54. Word,
  55. Sentence,
  56. %If (Qt_6_6_0 -)
  57. Utterance,
  58. %End
  59. };
  60. enum class ErrorReason
  61. {
  62. NoError,
  63. Initialization,
  64. Configuration,
  65. Input,
  66. Playback,
  67. };
  68. enum State
  69. {
  70. Ready,
  71. Speaking,
  72. Paused,
  73. Error,
  74. %If (Qt_6_6_0 -)
  75. Synthesizing,
  76. %End
  77. };
  78. QTextToSpeech(const QString &engine, const QVariantMap &params, QObject *parent /TransferThis/ = 0);
  79. explicit QTextToSpeech(QObject *parent /TransferThis/ = 0);
  80. QTextToSpeech(const QString &engine, QObject *parent /TransferThis/ = 0);
  81. virtual ~QTextToSpeech();
  82. bool setEngine(const QString &engine, const QVariantMap &params = QVariantMap());
  83. QString engine() const;
  84. QTextToSpeech::ErrorReason errorReason() const;
  85. QString errorString() const;
  86. QTextToSpeech::State state() const;
  87. QList<QLocale> availableLocales() const;
  88. QLocale locale() const;
  89. QVoice voice() const;
  90. QList<QVoice> availableVoices() const;
  91. double rate() const;
  92. double pitch() const;
  93. double volume() const;
  94. static QStringList availableEngines();
  95. public slots:
  96. void say(const QString &text);
  97. void stop(QTextToSpeech::BoundaryHint boundaryHint = QTextToSpeech::BoundaryHint::Default);
  98. void pause(QTextToSpeech::BoundaryHint boundaryHint = QTextToSpeech::BoundaryHint::Default);
  99. void resume();
  100. void setLocale(const QLocale &locale);
  101. void setRate(double rate);
  102. void setPitch(double pitch);
  103. void setVolume(double volume);
  104. void setVoice(const QVoice &voice);
  105. signals:
  106. void stateChanged(QTextToSpeech::State state);
  107. void localeChanged(const QLocale &locale);
  108. void rateChanged(double rate);
  109. void pitchChanged(double pitch);
  110. void volumeChanged(double volume);
  111. void voiceChanged(const QVoice &voice);
  112. void engineChanged(const QString &engine);
  113. void errorOccurred(QTextToSpeech::ErrorReason error, const QString &errorString);
  114. public:
  115. %If (Qt_6_6_0 -)
  116. enum class Capability
  117. {
  118. None,
  119. Speak,
  120. PauseResume,
  121. WordByWordProgress,
  122. Synthesize,
  123. };
  124. %End
  125. %If (Qt_6_6_0 -)
  126. typedef QFlags<QTextToSpeech::Capability> Capabilities;
  127. %End
  128. %If (Qt_6_6_0 -)
  129. QTextToSpeech::Capabilities engineCapabilities() const;
  130. %End
  131. public slots:
  132. %If (Qt_6_6_0 -)
  133. qsizetype enqueue(const QString &text);
  134. %End
  135. signals:
  136. %If (Qt_6_6_0 -)
  137. void sayingWord(const QString &word, qsizetype id, qsizetype start, qsizetype length);
  138. %End
  139. %If (Qt_6_6_0 -)
  140. void aboutToSynthesize(qsizetype id);
  141. %End
  142. };