Pass JT9W tone spacing to Modulator via a signal/slot as it is

crossing a thread boundary.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3995 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-04-08 11:56:29 +00:00
parent 61f44b94d2
commit 9433201694
4 changed files with 10 additions and 7 deletions

View File

@ -29,6 +29,8 @@ Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds, QObjec
, m_stream {nullptr} , m_stream {nullptr}
, m_quickClose {false} , m_quickClose {false}
, m_phi {0.0} , m_phi {0.0}
, m_toneSpacing {0.0}
, m_fSpread {0.0}
, m_frameRate {frameRate} , m_frameRate {frameRate}
, m_period {periodLengthInSeconds} , m_period {periodLengthInSeconds}
, m_state {Idle} , m_state {Idle}
@ -40,7 +42,7 @@ Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds, QObjec
// seed // seed
} }
void Modulator::start (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, SoundOutput * stream, Channel channel, bool synchronize, double dBSNR) void Modulator::start (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, double toneSpacing, SoundOutput * stream, Channel channel, bool synchronize, double dBSNR)
{ {
Q_ASSERT (stream); Q_ASSERT (stream);
@ -62,6 +64,7 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol, unsigned
m_nsps = framesPerSymbol; m_nsps = framesPerSymbol;
m_frequency = frequency; m_frequency = frequency;
m_amp = std::numeric_limits<qint16>::max (); m_amp = std::numeric_limits<qint16>::max ();
m_toneSpacing = toneSpacing;
// noise generator parameters // noise generator parameters
if (m_addNoise) { if (m_addNoise) {

View File

@ -30,9 +30,9 @@ public:
bool isMuted () const {return m_muted;} bool isMuted () const {return m_muted;}
unsigned frequency () const {return m_frequency;} unsigned frequency () const {return m_frequency;}
bool isActive () const {return m_state != Idle;} bool isActive () const {return m_state != Idle;}
void setWide9(double d1, double d2) {m_toneSpacing=d1; m_fSpread=d2;} void setSpread(double s) {m_fSpread=s;}
Q_SLOT void start (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, SoundOutput *, Channel = Mono, bool synchronize = true, double dBSNR = 99.); Q_SLOT void start (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, double toneSpacing, SoundOutput *, Channel = Mono, bool synchronize = true, double dBSNR = 99.);
Q_SLOT void stop (bool quick = false); Q_SLOT void stop (bool quick = false);
Q_SLOT void tune (bool newState = true); Q_SLOT void tune (bool newState = true);
Q_SLOT void mute (bool newState = true) {m_muted = newState;} Q_SLOT void mute (bool newState = true) {m_muted = newState;}

View File

@ -1667,7 +1667,7 @@ void MainWindow::startTx2()
double snr=99.0; double snr=99.0;
QString t=ui->tx5->currentText(); QString t=ui->tx5->currentText();
if(t.mid(0,1)=="#") fSpread=t.mid(1,5).toDouble(); if(t.mid(0,1)=="#") fSpread=t.mid(1,5).toDouble();
m_modulator.setWide9(m_toneSpacing, fSpread); m_modulator.setSpread(fSpread);
t=ui->tx6->text(); t=ui->tx6->text();
if(t.mid(0,1)=="#") snr=t.mid(1,5).toDouble(); if(t.mid(0,1)=="#") snr=t.mid(1,5).toDouble();
if(snr>0.0 or snr < -50.0) snr=99.0; if(snr>0.0 or snr < -50.0) snr=99.0;
@ -2841,11 +2841,11 @@ void MainWindow::transmit (double snr)
{ {
if (m_modeTx == "JT65") if (m_modeTx == "JT65")
{ {
Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, m_txFreq - m_XIT, &m_soundOutput, m_config.audio_output_channel (), true, snr); Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, m_txFreq - m_XIT, m_toneSpacing, &m_soundOutput, m_config.audio_output_channel (), true, snr);
} }
else else
{ {
Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, m_txFreq - m_XIT, &m_soundOutput, m_config.audio_output_channel (), true, snr); Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, m_txFreq - m_XIT, m_toneSpacing, &m_soundOutput, m_config.audio_output_channel (), true, snr);
} }
} }

View File

@ -192,7 +192,7 @@ private:
Q_SIGNAL void transmitFrequency (unsigned) const; Q_SIGNAL void transmitFrequency (unsigned) const;
Q_SIGNAL void endTransmitMessage (bool quick = false) const; Q_SIGNAL void endTransmitMessage (bool quick = false) const;
Q_SIGNAL void tune (bool = true) const; Q_SIGNAL void tune (bool = true) const;
Q_SIGNAL void sendMessage (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, SoundOutput *, AudioDevice::Channel = AudioDevice::Mono, bool synchronize = true, double dBSNR = 99.) const; Q_SIGNAL void sendMessage (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, double toneSpacing, SoundOutput *, AudioDevice::Channel = AudioDevice::Mono, bool synchronize = true, double dBSNR = 99.) const;
Q_SIGNAL void outAttenuationChanged (qreal) const; Q_SIGNAL void outAttenuationChanged (qreal) const;
private: private: