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 0a7adf9b44
commit 3d9f96ea6b
3 changed files with 8 additions and 13 deletions

View File

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

View File

@ -128,11 +128,11 @@ private:
struct CallbackData struct CallbackData
{ {
int kin; //Parameters sent to/from the portaudio callback function int kin;
int ncall; int ncall;
bool bzero; bool bzero;
bool monitoring; bool monitoring;
} m_callbackData; } m_callbackData; //Parameters sent to/from the Notify function
}; };
#endif // SOUNDIN_H #endif // SOUNDIN_H
#endif // QAUDIO_INPUT #endif // QAUDIO_INPUT

View File

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