WSJT-X/soundin_1.h
Joe Taylor 3fcb73b107 1. Refactoring of code so as to move audio input from a separate thread to
the main GUI thread (thanks to G4WJS).

2.. Also, for the record, some example code for using QAudioInput instead 
of PortAudio.  This code is not presently active, and will need to be 
changed to accommodate the changes in #1, above.  But the basic ideas 
are here...


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3509 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-07-30 00:51:42 +00:00

54 lines
1.1 KiB
C++

#ifndef SOUNDIN_H
#define SOUNDIN_H
#include <QtCore>
#include <QDebug>
#include <QAudioDeviceInfo>
#include <QAudioInput>
#include <valarray>
// Thread gets audio data from soundcard and signals when a buffer of
// specified size is available.
class SoundInThread : public QThread
{
Q_OBJECT
bool quitExecution; // if true, thread exits gracefully
QMutex quitExecutionMutex; // protects the quitExecution variable
QAudioDeviceInfo inputDevice; // audioinput device name
protected:
virtual void run();
public:
bool m_dataSinkBusy;
SoundInThread():
quitExecution(false),
m_dataSinkBusy(false)
{
}
void setInputDevice(qint32 n);
void setMonitoring(bool b);
void setPeriod(int ntrperiod, int nsps);
int mstep();
signals:
void readyForFFT(int k);
void error(const QString& message);
void status(const QString& message);
public slots:
void quit();
private:
qint32 m_step;
qint32 m_nDevIn;
qint32 m_TRperiod;
qint32 m_TRperiod0;
qint32 m_nsps;
bool m_monitoring;
};
#endif // SOUNDIN_H