Minor code cleanup.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3511 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-07-31 00:03:26 +00:00
parent d45f47caa0
commit 608a4fddd4
3 changed files with 8 additions and 13 deletions

View File

@ -77,7 +77,7 @@ SoundInput::SoundInput()
m_monitoring(false),
m_intervalTimer(this)
{
connect(&m_intervalTimer, &QTimer::timeout, this, &SoundInput::intervalNotify);
connect(&m_intervalTimer, SIGNAL(timeout()), this,SLOT(intervalNotify()));
}
void SoundInput::start(qint32 device)
@ -246,7 +246,7 @@ SoundInput::SoundInput()
m_monitoring(false),
m_intervalTimer(this)
{
connect(&m_intervalTimer, &QTimer::timeout, this, &SoundInput::intervalNotify);
connect(&m_intervalTimer, SIGNAL(timeout()), this,SLOT(intervalNotify()));
}
void SoundInput::start(qint32 device)
@ -319,14 +319,12 @@ void SoundInput::intervalNotify()
Q_ASSERT(bytesReady >= 0);
Q_ASSERT(bytesReady % 2 == 0);
if (bytesReady == 0) {
// msleep(50);
return;
}
// Get the new samples
qint32 bytesRead;
qint16 buf0[4096];
bytesRead = stream->read((char*)buf0, bytesReady);
bytesRead = stream->read((char*)buf0, bytesReady); // Get the new samples
Q_ASSERT(bytesRead <= bytesReady);
if (bytesRead < 0) {
emit error(tr("audio stream QIODevice::read returned -1."));
@ -342,14 +340,11 @@ void SoundInput::intervalNotify()
if(m_monitoring) {
int kstep=m_nsps/2;
// m_step=k/kstep;
m_step=(k-1)/kstep;
if(m_step != m_nstep0) {
if(m_dataSinkBusy) {
m_nBusy++;
} else {
// m_dataSinkBusy=true;
// emit readyForFFT(k); //Signal to compute new FFTs
emit readyForFFT(k-1); //Signal to compute new FFTs
}
m_nstep0=m_step;

View File

@ -109,7 +109,7 @@ public slots:
private:
bool m_dataSinkBusy;
double m_SamFacIn; //(Input sample rate)/12000.0
double m_SamFacIn; //(Input sample rate)/12000.0
qint32 m_step;
qint32 m_TRperiod;
qint32 m_TRperiod0;
@ -122,17 +122,17 @@ private:
int m_nsps0;
QTimer m_intervalTimer;
QAudioDeviceInfo inputDevice; // audioinput device name
QAudioDeviceInfo inputDevice; // audioinput device name
QAudioInput* audioInput;
QIODevice* stream;
struct CallbackData
{
int kin; //Parameters sent to/from the portaudio callback function
int kin;
int ncall;
bool bzero;
bool monitoring;
} m_callbackData;
} m_callbackData; //Parameters sent to/from the Notify function
};
#endif // SOUNDIN_H
#endif // QAUDIO_INPUT

View File

@ -16,7 +16,7 @@ VERSION = 1.1
TEMPLATE = app
#DEFINES = QT4
DEFINES = QT5
#DEFINES += QAUDIO_INPUT
DEFINES += QAUDIO_INPUT
win32 {
DEFINES += WIN32