mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
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:
parent
d45f47caa0
commit
608a4fddd4
11
soundin.cpp
11
soundin.cpp
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user