QAudioOutput错误:snd_pcm_hw_params_set_buffer_time_near:err = -22

时间:2014-04-09 14:27:55

标签: c++ qt qt4 blackberry-10 alsa

我使用以下代码播放WAV文件:

inputFile.setFileName("/accounts/1000/appdata/com.example.SoundR.testDev_mple_SoundRe6609254/data/tracks/rec.wav");
inputFile.open(QIODevice::ReadOnly);

QAudioFormat format;
// Set up the format, eg.
format.setSampleRate(16000);
format.setChannelCount(1);
format.setSampleSize(16);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::UnSignedInt);

QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
if (!info.isFormatSupported(format)) {
    qWarning() << "Raw audio format not supported by backend, cannot play audio.";
    format = info.nearestFormat(format);
}

audioOutput = new QAudioOutput(format, this);

connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
connect(audioOutput, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));

audioOutput->start(&inputFile);

但是我收到了一个错误:

"QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = -22" 

我是从this tutorial得到的。

0 个答案:

没有答案