Синхронная передача звука в приложении Qt на Maemo (N900) - PullRequest
1 голос
/ 05 февраля 2011

Интересно, возможно ли выполнять потоковую передачу голоса на телефоне N900?Мне нужно буферизовать голосовые сэмплы с микрофона и одновременно передавать голос из другого буфера на динамик?Вы думаете, это возможно и как?Теперь я использую файлы для записи и воспроизведения аудио.но это не синхронизировано.

запись:

 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);

Мне нужно буферизовать голосовые сэмплы с микрофона и одновременно передавать голос из другого буферак оратору.как я могу это сделать?

...