WSJT-X/soundin.h
Bill Somerville 688943e779 Fix audio input rate issue on Windows Vista
Windows Vista has a broken rate converter which gets invoked when an
input audio stream at 48kHz sampel rate is requested. I've no idea why
our application can't get exclusive access to the audio input device
and have a unconverted stream direct at 48kHz.

To get around this our down sampling filter for audio input from 48kHz
to 12kHz is disaabled by default on Windows Vista, instead we request
a 12kHz stream and process it directly.

This default behviour can be overriden by specifying the following
settings value:

[Tune]
Audio\DisableInputResampling=false

This settings value defaults to true on Windows Vista and false
everywhere else so normally needn't be present.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3588 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-10-04 19:00:29 +00:00

46 lines
941 B
C++

#ifndef SOUNDIN_H__
#define SOUNDIN_H__
#include <QObject>
#include <QString>
#include <QScopedPointer>
#include <QAudioInput>
class QAudioDeviceInfo;
class QAudioInput;
class QIODevice;
// Gets audio data from sound sample source and passes it to a sink device
class SoundInput : public QObject
{
Q_OBJECT;
private:
Q_DISABLE_COPY (SoundInput);
public:
SoundInput (QObject * parent = 0)
: QObject (parent)
{
}
~SoundInput ();
private:
Q_SIGNAL void error (QString message) const;
Q_SIGNAL void status (QString message) const;
// sink must exist from the start call to any following stop () call
Q_SLOT void start(QAudioDeviceInfo const&, unsigned channels, int framesPerBuffer, QIODevice * sink, unsigned downSampleFactor);
Q_SLOT void stop();
// used internally
Q_SLOT void handleStateChanged (QAudio::State) const;
bool audioError () const;
QScopedPointer<QAudioInput> m_stream;
};
#endif