[Qt-interest] High CPU Usage With QAudioOutput
Barnes, Clifton A.
cabarnes at indesign-llc.com
Wed Apr 6 16:27:16 CEST 2011
On Wednesday, April 06, 2011 9:42 AM Gabriel M. Beddingfield wrote:
> That's correct. In the future, Qt is spinning off
> modules... so the QtMultimedia classes (like QAudioOutput)
> will now be part of the QtMobility module instead of Qt
> You said that you were passing a .wav file to the
> QAudioOutput... but I don't think this is correct. It is
> expecting a RAW PCM stream, and you need to set the format.
> However, a .wav file has metadata etc.
> Also, if you don't properly set your audio format... you
> could be getting extra resampling or sample conversions.
Maybe there is an issue then with passing the wrong kind of file.
It does seem to play correctly though. I am using a QFile with
the .wav file passed into the constructor. I then pass the
address of the QFile to the QAudioOutput::start method.
aplay prints the following when running 'aplay file.wav':
Signed 16 bit Little Endian, Rate 16000 Hz, Mono
I'm using the following to set the format:
QAudioFormat format; // Class variable
format.setFrequency(16000);
format.setChannels(1);
format.setSampleSize(16);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::SignedInt);
I then pass that format object to the QAudioOutput constructor.
Is there an issue with these settings?
Clif
More information about the Qt-interest-old
mailing list