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:
Bill Somerville 2014-04-03 20:06:30 +00:00
parent 25d0429b36
commit da419014e0
4 changed files with 26 additions and 67 deletions

View File

@ -90,7 +90,6 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
int fQSO, int nsetftx, int ntxFreq) int fQSO, int nsetftx, int ntxFreq)
{ {
static int ntxFreq0=-99; static int ntxFreq0=-99;
static bool astroBusy=false;
double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx; double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx;
double ramoon,decmoon,dgrd,poloffset,xnr,techo; double ramoon,decmoon,dgrd,poloffset,xnr,techo;
int ntsky,ndop,ndop00; int ntsky,ndop,ndop00;
@ -108,15 +107,10 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
int nfreq=10368; int nfreq=10368;
if(nfreq<10 or nfreq > 50000) nfreq=144; if(nfreq<10 or nfreq > 50000) nfreq=144;
if(!astroBusy) { astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(),
astroBusy=true; hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon,
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon,
astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(), &dgrd, &poloffset, &xnr, &techo, 6, 6);
hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon,
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon,
&dgrd, &poloffset, &xnr, &techo, 6, 6);
astroBusy=false;
}
QString message; QString message;
{ {

View File

@ -92,7 +92,6 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
m_dialFreq {0}, m_dialFreq {0},
m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, downSampleFactor), m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, downSampleFactor),
m_modulator (TX_SAMPLE_RATE, NTMAX / 2), m_modulator (TX_SAMPLE_RATE, NTMAX / 2),
m_soundOutput (&m_modulator),
m_audioThread {new QThread}, m_audioThread {new QThread},
m_appDir {QApplication::applicationDirPath ()}, m_appDir {QApplication::applicationDirPath ()},
mem_jt9 {shdmem}, mem_jt9 {shdmem},

View File

@ -46,46 +46,34 @@ bool SoundOutput::audioError () const
return result; 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) void SoundOutput::setFormat (QAudioDeviceInfo const& device, unsigned channels, unsigned msBuffered)
{ {
Q_ASSERT (0 < channels && channels < 3); Q_ASSERT (0 < channels && channels < 3);
if (!m_stream || device != m_currentDevice || QAudioFormat format (device.preferredFormat ());
channels != static_cast<unsigned> (m_stream->format ().channelCount ()))
format.setChannelCount (channels);
format.setCodec ("audio/pcm");
format.setSampleRate (48000);
format.setSampleType (QAudioFormat::SignedInt);
format.setSampleSize (16);
if (!format.isValid ())
{ {
QAudioFormat format (device.preferredFormat ()); Q_EMIT error (tr ("Requested output audio format is not valid."));
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();
} }
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 // This buffer size is critical since for proper sound streaming. If
@ -153,21 +141,17 @@ void SoundOutput::handleStateChanged (QAudio::State newState)
{ {
case QAudio::IdleState: case QAudio::IdleState:
Q_EMIT status (tr ("Idle")); Q_EMIT status (tr ("Idle"));
m_active = false;
break; break;
case QAudio::ActiveState: case QAudio::ActiveState:
m_active = true;
Q_EMIT status (tr ("Sending")); Q_EMIT status (tr ("Sending"));
break; break;
case QAudio::SuspendedState: case QAudio::SuspendedState:
m_active = true;
Q_EMIT status (tr ("Suspended")); Q_EMIT status (tr ("Suspended"));
break; break;
case QAudio::StoppedState: case QAudio::StoppedState:
m_active = false;
if (audioError ()) if (audioError ())
{ {
Q_EMIT status (tr ("Error")); Q_EMIT status (tr ("Error"));
@ -179,11 +163,3 @@ void SoundOutput::handleStateChanged (QAudio::State newState)
break; break;
} }
} }
SoundOutput::~SoundOutput ()
{
if (m_stream)
{
m_stream->stop ();
}
}

View File

@ -16,14 +16,7 @@ class SoundOutput
{ {
Q_OBJECT; Q_OBJECT;
Q_PROPERTY(bool running READ isRunning);
Q_PROPERTY(unsigned attenuation READ attenuation WRITE setAttenuation RESET resetAttenuation);
public: public:
SoundOutput (QIODevice * source);
~SoundOutput ();
bool isRunning() const {return m_active;}
qreal attenuation () const; qreal attenuation () const;
QAudioOutput * stream () {return m_stream.data ();} QAudioOutput * stream () {return m_stream.data ();}
@ -46,9 +39,6 @@ private Q_SLOTS:
private: private:
QScopedPointer<QAudioOutput> m_stream; QScopedPointer<QAudioOutput> m_stream;
bool volatile m_active;
QAudioDeviceInfo m_currentDevice;
qreal m_volume; qreal m_volume;
}; };