mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 14:48: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
0a7adf9b44
commit
3d9f96ea6b
11
soundin.cpp
11
soundin.cpp
@ -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;
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user