diff options
| author | hibby <d@vehibberd.com> | 2018-02-16 15:18:44 +0000 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2018-02-16 15:18:44 +0000 |
| commit | 368f5331a7641772aa7e0cd1feea57d09a394a36 (patch) | |
| tree | b421ac60cc6eb726896ea268ea24e47fc4ce7c88 /soundin.cpp | |
| parent | 71c717edc92fa771c857b3c2e5ed65f523f68f90 (diff) | |
| parent | 37f727ac0746fd85504aa46c1f023c09b3eff33a (diff) | |
Update upstream source from tag 'upstream/1.8.0+repack'
Update to upstream version '1.8.0+repack'
with Debian dir a83ef78cb70a32d1211871fdc08f3ffa295e45a8
Diffstat (limited to 'soundin.cpp')
| -rw-r--r-- | soundin.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/soundin.cpp b/soundin.cpp index a93fb49d..3da3bdd0 100644 --- a/soundin.cpp +++ b/soundin.cpp @@ -3,6 +3,7 @@ #include <QAudioDeviceInfo> #include <QAudioFormat> #include <QAudioInput> +#include <QSysInfo> #include <QDebug> #include "moc_soundin.cpp" @@ -49,24 +50,26 @@ void SoundInput::start(QAudioDeviceInfo const& device, int framesPerBuffer, Audi m_sink = sink; QAudioFormat format (device.preferredFormat()); +// qDebug () << "Preferred audio input format:" << format; format.setChannelCount (AudioDevice::Mono == channel ? 1 : 2); format.setCodec ("audio/pcm"); format.setSampleRate (12000 * downSampleFactor); format.setSampleType (QAudioFormat::SignedInt); format.setSampleSize (16); - + format.setByteOrder (QAudioFormat::Endian (QSysInfo::ByteOrder)); if (!format.isValid ()) { Q_EMIT error (tr ("Requested input audio format is not valid.")); return; } - // this function lies! - // if (!device.isFormatSupported (format)) - // { - // Q_EMIT error (tr ("Requested input audio format is not supported on device.")); - // return; - // } + if (!device.isFormatSupported (format)) + { +// qDebug () << "Nearest supported audio format:" << device.nearestFormat (format); + Q_EMIT error (tr ("Requested input audio format is not supported on device.")); + return; + } +// qDebug () << "Selected audio input format:" << format; m_stream.reset (new QAudioInput {device, format}); if (audioError ()) @@ -99,6 +102,7 @@ void SoundInput::suspend () void SoundInput::resume () { +// qDebug() << "Resume" << fmod(0.001*QDateTime::currentMSecsSinceEpoch(),6.0); if (m_sink) { m_sink->reset (); |
