File indexing completed on 2024-12-22 04:40:15
0001 /* 0002 SPDX-FileCopyrightText: 2010-2022 Mladen Milinkovic <max@smoothware.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef POCKETSPHINXPLUGIN_H 0008 #define POCKETSPHINXPLUGIN_H 0009 0010 #include "speechprocessor/speechplugin.h" 0011 0012 typedef struct ps_decoder_s ps_decoder_t; 0013 typedef struct cmd_ln_s cmd_ln_t; 0014 typedef struct SpeexPreprocessState_ SpeexPreprocessState; 0015 0016 namespace SubtitleComposer { 0017 class PocketSphinxPlugin : public SpeechPlugin 0018 { 0019 Q_OBJECT 0020 0021 Q_PLUGIN_METADATA(IID SpeechPlugin_iid) 0022 Q_INTERFACES(SubtitleComposer::SpeechPlugin) 0023 0024 public: 0025 PocketSphinxPlugin(); 0026 0027 QWidget * newConfigWidget(QWidget *parent) override; 0028 KCoreConfigSkeleton * config() const override; 0029 0030 private: 0031 const QString & name() override; 0032 0033 const WaveFormat & waveFormat() const override; 0034 bool init() override; 0035 void cleanup() override; 0036 0037 void processSamples(const void *sampleData, qint32 sampleCount) override; 0038 void processComplete() override; 0039 0040 void processUtterance(); 0041 0042 private: 0043 cmd_ln_t *m_psConfig; 0044 ps_decoder_t *m_psDecoder; 0045 qint32 m_psFrameRate; 0046 0047 QString m_lineText; 0048 int m_lineIn; 0049 int m_lineOut; 0050 0051 bool m_utteranceStarted; 0052 bool m_speechStarted; 0053 }; 0054 } 0055 0056 #endif // POCKETSPHINXPLUGIN_H