I need to process audio data in realtime (without writing to drive as in examples). For this purpose I use QAudioInput from QtMultimedia (Qt 4.7.3, Mac OS X 10.5.8) which works in a "push" mode:
QAudioInput* m_pStream = new QAudioInput(Format, this);
connect(m_pBuffer, SIGNAL(readyRead()), this, SLOT(SendData()));
QAudioInput* m_pStream = new QAudioInput(Format, this);
QIODevice* m_pBuffer = m_pStream->start();
connect(m_pBuffer, SIGNAL(readyRead()), this, SLOT(SendData()));
To copy to clipboard, switch view to plain text mode
Slot SendData reads buffer and sends data to the processing algorithm:
void CQtAudioStream::SendData()
{
Q_ASSERT(m_pBuffer);
emit SendAudioBuffer(m_pBuffer->readAll().data());
}
void CQtAudioStream::SendData()
{
Q_ASSERT(m_pBuffer);
emit SendAudioBuffer(m_pBuffer->readAll().data());
}
To copy to clipboard, switch view to plain text mode
The problem is readyRead() signal emits only once from m_pBuffer device. What should I do to reemit it?
Bookmarks