mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Squashed yet more compiler warnings.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3979 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
b17ff13e89
commit
db0ba3940d
14
astro.cpp
14
astro.cpp
@ -90,7 +90,6 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
||||
int fQSO, int nsetftx, int ntxFreq)
|
||||
{
|
||||
static int ntxFreq0=-99;
|
||||
static bool astroBusy=false;
|
||||
double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx;
|
||||
double ramoon,decmoon,dgrd,poloffset,xnr,techo;
|
||||
int ntsky,ndop,ndop00;
|
||||
@ -108,15 +107,10 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
|
||||
int nfreq=10368;
|
||||
if(nfreq<10 or nfreq > 50000) nfreq=144;
|
||||
|
||||
if(!astroBusy) {
|
||||
astroBusy=true;
|
||||
|
||||
astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(),
|
||||
hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon,
|
||||
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon,
|
||||
&dgrd, &poloffset, &xnr, &techo, 6, 6);
|
||||
astroBusy=false;
|
||||
}
|
||||
astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(),
|
||||
hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon,
|
||||
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon,
|
||||
&dgrd, &poloffset, &xnr, &techo, 6, 6);
|
||||
|
||||
QString message;
|
||||
{
|
||||
|
@ -92,7 +92,6 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
|
||||
m_dialFreq {0},
|
||||
m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, downSampleFactor),
|
||||
m_modulator (TX_SAMPLE_RATE, NTMAX / 2),
|
||||
m_soundOutput (&m_modulator),
|
||||
m_audioThread {new QThread},
|
||||
m_appDir {QApplication::applicationDirPath ()},
|
||||
mem_jt9 {shdmem},
|
||||
|
68
soundout.cpp
68
soundout.cpp
@ -46,46 +46,34 @@ bool SoundOutput::audioError () const
|
||||
return result;
|
||||
}
|
||||
|
||||
SoundOutput::SoundOutput (QIODevice * source)
|
||||
: m_active (false)
|
||||
, m_currentDevice (QAudioDeviceInfo::defaultOutputDevice ())
|
||||
{
|
||||
Q_ASSERT (source);
|
||||
}
|
||||
|
||||
void SoundOutput::setFormat (QAudioDeviceInfo const& device, unsigned channels, unsigned msBuffered)
|
||||
{
|
||||
Q_ASSERT (0 < channels && channels < 3);
|
||||
|
||||
if (!m_stream || device != m_currentDevice ||
|
||||
channels != static_cast<unsigned> (m_stream->format ().channelCount ()))
|
||||
QAudioFormat format (device.preferredFormat ());
|
||||
|
||||
format.setChannelCount (channels);
|
||||
format.setCodec ("audio/pcm");
|
||||
format.setSampleRate (48000);
|
||||
format.setSampleType (QAudioFormat::SignedInt);
|
||||
format.setSampleSize (16);
|
||||
if (!format.isValid ())
|
||||
{
|
||||
QAudioFormat format (device.preferredFormat ());
|
||||
|
||||
format.setChannelCount (channels);
|
||||
format.setCodec ("audio/pcm");
|
||||
format.setSampleRate (48000);
|
||||
format.setSampleType (QAudioFormat::SignedInt);
|
||||
format.setSampleSize (16);
|
||||
if (!format.isValid ())
|
||||
{
|
||||
Q_EMIT error (tr ("Requested output audio format is not valid."));
|
||||
}
|
||||
if (!device.isFormatSupported (format))
|
||||
{
|
||||
Q_EMIT error (tr ("Requested output audio format is not supported on device."));
|
||||
}
|
||||
|
||||
m_stream.reset (new QAudioOutput (device, format));
|
||||
audioError ();
|
||||
m_stream->setVolume (m_volume);
|
||||
m_stream->setNotifyInterval(100);
|
||||
|
||||
connect (m_stream.data(), &QAudioOutput::stateChanged, this, &SoundOutput::handleStateChanged);
|
||||
|
||||
m_currentDevice = device;
|
||||
// qDebug() << "A" << m_volume << m_stream->notifyInterval();
|
||||
Q_EMIT error (tr ("Requested output audio format is not valid."));
|
||||
}
|
||||
if (!device.isFormatSupported (format))
|
||||
{
|
||||
Q_EMIT error (tr ("Requested output audio format is not supported on device."));
|
||||
}
|
||||
|
||||
m_stream.reset (new QAudioOutput (device, format));
|
||||
audioError ();
|
||||
m_stream->setVolume (m_volume);
|
||||
m_stream->setNotifyInterval(100);
|
||||
|
||||
connect (m_stream.data(), &QAudioOutput::stateChanged, this, &SoundOutput::handleStateChanged);
|
||||
|
||||
// qDebug() << "A" << m_volume << m_stream->notifyInterval();
|
||||
|
||||
//
|
||||
// This buffer size is critical since for proper sound streaming. If
|
||||
@ -153,21 +141,17 @@ void SoundOutput::handleStateChanged (QAudio::State newState)
|
||||
{
|
||||
case QAudio::IdleState:
|
||||
Q_EMIT status (tr ("Idle"));
|
||||
m_active = false;
|
||||
break;
|
||||
|
||||
case QAudio::ActiveState:
|
||||
m_active = true;
|
||||
Q_EMIT status (tr ("Sending"));
|
||||
break;
|
||||
|
||||
case QAudio::SuspendedState:
|
||||
m_active = true;
|
||||
Q_EMIT status (tr ("Suspended"));
|
||||
break;
|
||||
|
||||
case QAudio::StoppedState:
|
||||
m_active = false;
|
||||
if (audioError ())
|
||||
{
|
||||
Q_EMIT status (tr ("Error"));
|
||||
@ -179,11 +163,3 @@ void SoundOutput::handleStateChanged (QAudio::State newState)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SoundOutput::~SoundOutput ()
|
||||
{
|
||||
if (m_stream)
|
||||
{
|
||||
m_stream->stop ();
|
||||
}
|
||||
}
|
||||
|
10
soundout.h
10
soundout.h
@ -16,14 +16,7 @@ class SoundOutput
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
Q_PROPERTY(bool running READ isRunning);
|
||||
Q_PROPERTY(unsigned attenuation READ attenuation WRITE setAttenuation RESET resetAttenuation);
|
||||
|
||||
public:
|
||||
SoundOutput (QIODevice * source);
|
||||
~SoundOutput ();
|
||||
|
||||
bool isRunning() const {return m_active;}
|
||||
qreal attenuation () const;
|
||||
QAudioOutput * stream () {return m_stream.data ();}
|
||||
|
||||
@ -46,9 +39,6 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
QScopedPointer<QAudioOutput> m_stream;
|
||||
|
||||
bool volatile m_active;
|
||||
QAudioDeviceInfo m_currentDevice;
|
||||
qreal m_volume;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user