I wonder if it is possible to perform voice streaming on N900 phone? I need to buffer voice samples from the micrphone and symultanously send voice from other buffer to speaker? Do you thing it is possible and how? now i am using files to record and play audio. but this is not synchronized.
recording:
outputFile.setFileName("/tmp/test.raw");
outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
qDebug() << info.availableDevices(QAudio::AudioInput).at(1).deviceName();
if (!info.isFormatSupported(format)) {
qWarning() << "Default format not supported - trying to use nearest";
format = info.nearestFormat(format);
}
/////////////////////////////
audio = new QAudioInput(info,format, this);
QTimer::singleShot(5000, this, SLOT(stopRecording()));
audio->start(&outputFile);
palying:
inputFile.setFileName("/tmp/test.raw");
inputFile.open( QIODevice::ReadOnly );
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
if (!info.isFormatSupported(format)) {
qWarning()<<"raw audio format not supported by backend, cannot play audio.";
format = info.nearestFormat(format);
}
audio2 = new QAudioOutput(format, this);
connect(audio2,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
audio2->start(&inputFile);
I need to buffer voice samples from the micrphone and symultanously send voice from other buffer to speaker. how i can do this?