Phonon

speechtotext.cpp
1class SpeechToText
2{
3 Q_OBJECT
4 public:
5 SpeechToText();
6
7 private slots:
8 void processCaptureData();
9
10 private:
11 PcmCapture *m_capture;
12};
13
14SpeechToText::SpeechToText();
15{
16 // imagining Phonon API that's not there yet...
17 m_capture = new PcmCapture(Phonon::Communication, this);
18 Q_ASSERT(qobject_cast<QIODevice *>(m_capture));
19 Q_ASSERT(!m_capture->isOpen());
20 // hmm, probably not good to do this:
21 if (!m_capture->open(PcmFormat(PcmFormat::NativeByteOrder, 16, 1, 48000, PcmFormat::DisallowSoftResampling))) {
22 // handle error possibly trying a different format
23 // (read m_capture->errorString())
24 return;
25 }
26
27 connect(m_capture, SIGNAL(readyRead()), SLOT(processCaptureData()));
28}
29
30void SpeechToText::processCaptureData()
31{
32 const int toProcess = m_capture->bytesAvailable();
33 const QByteArray =
34}
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:49:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.