File indexing completed on 2024-05-12 04:44:40
0001 class SpeechToText 0002 { 0003 Q_OBJECT 0004 public: 0005 SpeechToText(); 0006 0007 private slots: 0008 void processCaptureData(); 0009 0010 private: 0011 PcmCapture *m_capture; 0012 }; 0013 0014 SpeechToText::SpeechToText(); 0015 { 0016 // imagining Phonon API that's not there yet... 0017 m_capture = new PcmCapture(Phonon::Communication, this); 0018 Q_ASSERT(qobject_cast<QIODevice *>(m_capture)); 0019 Q_ASSERT(!m_capture->isOpen()); 0020 // hmm, probably not good to do this: 0021 if (!m_capture->open(PcmFormat(PcmFormat::NativeByteOrder, 16, 1, 48000, PcmFormat::DisallowSoftResampling))) { 0022 // handle error possibly trying a different format 0023 // (read m_capture->errorString()) 0024 return; 0025 } 0026 0027 connect(m_capture, SIGNAL(readyRead()), SLOT(processCaptureData())); 0028 } 0029 0030 void SpeechToText::processCaptureData() 0031 { 0032 const int toProcess = m_capture->bytesAvailable(); 0033 const QByteArray = 0034 }