mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-31 13:10:19 -04:00 
			
		
		
		
	Merge changes from branches/wsjtx_w back into branches/wsjtx.
Note to developers: Not sure about the makefiles... git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3835 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									9a51f29123
								
							
						
					
					
						commit
						86591544f0
					
				
							
								
								
									
										290
									
								
								Modulator.cpp
									
									
									
									
									
								
							
							
						
						
									
										290
									
								
								Modulator.cpp
									
									
									
									
									
								
							| @ -1,17 +1,12 @@ | ||||
| #include "Modulator.hpp" | ||||
| 
 | ||||
| #include <limits> | ||||
| 
 | ||||
| #include <qmath.h> | ||||
| #include <QDateTime> | ||||
| #include <QDebug> | ||||
| 
 | ||||
| #include "mainwindow.h" | ||||
| 
 | ||||
| extern float gran();		// Noise generator (for tests only)
 | ||||
| 
 | ||||
| // MUST be an integral factor of 2^16
 | ||||
| #define RAMP_INCREMENT 64 | ||||
| extern float gran();		   // Noise generator (for tests only)
 | ||||
| #define RAMP_INCREMENT 64  // MUST be an integral factor of 2^16
 | ||||
| 
 | ||||
| #if defined (WSJT_SOFT_KEYING) | ||||
| # define SOFT_KEYING true | ||||
| @ -26,65 +21,66 @@ double const Modulator::m_twoPi = 2.0 * 3.141592653589793238462; | ||||
| //    m_nspd=3072;                           //18.75 WPM
 | ||||
| unsigned const Modulator::m_nspd = 2048 + 512; // 22.5 WPM
 | ||||
| 
 | ||||
| Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds, QObject * parent) | ||||
| Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds, \ | ||||
|                       QObject * parent) | ||||
|   : AudioDevice (parent) | ||||
|   , m_phi (0.0) | ||||
|   , m_framesSent (0) | ||||
|   , m_frameRate (frameRate) | ||||
|   , m_period (periodLengthInSeconds) | ||||
|   , m_framesSent (0) | ||||
|   , m_state (Idle) | ||||
|   , m_tuning (false) | ||||
|   , m_muted (false) | ||||
|   , m_phi (0.) | ||||
| { | ||||
|   qsrand (QDateTime::currentMSecsSinceEpoch()); // Initialize random seed
 | ||||
| } | ||||
| 
 | ||||
| void Modulator::open (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, Channel channel, bool synchronize, double dBSNR) | ||||
| void Modulator::open (unsigned symbolsLength, double framesPerSymbol, \ | ||||
|          unsigned frequency, Channel channel, bool synchronize, double dBSNR) | ||||
| { | ||||
|   // Time according to this computer which becomes our base time
 | ||||
|   qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000; | ||||
| 
 | ||||
|   qDebug () << "Modulator: Using soft keying for CW is " << SOFT_KEYING;; | ||||
| //  qDebug () << "Modulator: Using soft keying for CW is " << SOFT_KEYING;;
 | ||||
| 
 | ||||
|   m_symbolsLength = symbolsLength; | ||||
| 
 | ||||
|   m_framesSent = 0; | ||||
|   m_isym0 = std::numeric_limits<unsigned>::max (); // ensure we set up first symbol tone
 | ||||
|   m_isym0 = std::numeric_limits<unsigned>::max (); // Arbitrary big number
 | ||||
|   m_addNoise = dBSNR < 0.; | ||||
|   m_nsps = framesPerSymbol; | ||||
|   m_frequency = frequency; | ||||
|   m_amp = std::numeric_limits<qint16>::max (); | ||||
| 
 | ||||
|   // noise generator parameters
 | ||||
|   if (m_addNoise) | ||||
|     { | ||||
|       m_snr = qPow (10.0, 0.05 * (dBSNR - 6.0)); | ||||
|       m_fac = 3000.0; | ||||
|       if (m_snr > 1.0) | ||||
| 	{ | ||||
| 	  m_fac = 3000.0 / m_snr; | ||||
| 	} | ||||
|     } | ||||
|   if (m_addNoise) { | ||||
|     m_snr = qPow (10.0, 0.05 * (dBSNR - 6.0)); | ||||
|     m_fac = 3000.0; | ||||
|     if (m_snr > 1.0) m_fac = 3000.0 / m_snr; | ||||
|   } | ||||
| 
 | ||||
|   unsigned mstr = ms0 % (1000 * m_period); // ms in period
 | ||||
|   m_ic = (mstr / 1000) * m_frameRate; // we start exactly N seconds
 | ||||
| 				      // into period where N is the
 | ||||
| 				      // next whole second
 | ||||
|               // into period where N is the next whole second
 | ||||
| 
 | ||||
|   m_silentFrames = 0; | ||||
|   if (synchronize && !m_tuning)	// calculate number of silent frames to send
 | ||||
|     { | ||||
|       m_silentFrames = m_ic + m_frameRate - (mstr * m_frameRate / 1000); | ||||
|     } | ||||
|   // calculate number of silent frames to send
 | ||||
|   if (synchronize && !m_tuning)	{ | ||||
|     m_silentFrames = m_ic + m_frameRate - (mstr * m_frameRate / 1000); | ||||
|   } | ||||
| 
 | ||||
| //  qDebug () << "Modulator: starting at " << m_ic / m_frameRate << " sec, sending " << m_silentFrames << " silent frames";
 | ||||
| 
 | ||||
|   AudioDevice::open (QIODevice::ReadOnly, channel); | ||||
|   Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ? Synchronizing : Active)); | ||||
|   Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ? | ||||
|         Synchronizing : Active)); | ||||
| } | ||||
| 
 | ||||
| qint64 Modulator::readData (char * data, qint64 maxSize) | ||||
| { | ||||
|   static int j0=-1; | ||||
|   static double toneFrequency0; | ||||
|   double toneFrequency; | ||||
| 
 | ||||
|   if(maxSize==0) return 0; | ||||
|   Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ()))); // no torn frames
 | ||||
|   Q_ASSERT (isOpen ()); | ||||
| @ -94,142 +90,131 @@ qint64 Modulator::readData (char * data, qint64 maxSize) | ||||
|   qint16 * end (samples + numFrames * (bytesPerFrame () / sizeof (qint16))); | ||||
| 
 | ||||
| //  qDebug () << "Modulator: " << numFrames << " requested, m_ic = " << m_ic << ", tune mode is " << m_tuning;
 | ||||
| 
 | ||||
| //  qDebug() << "C" << maxSize << numFrames << bytesPerFrame();
 | ||||
|   switch (m_state) | ||||
|     { | ||||
|     case Synchronizing: | ||||
|       { | ||||
| 	if (m_silentFrames)	// send silence up to first second
 | ||||
| 	  { | ||||
| 	    numFrames = qMin (m_silentFrames, numFrames); | ||||
| 	    for ( ; samples != end; samples = load (0, samples)) // silence
 | ||||
| 	      { | ||||
|   { | ||||
|   case Synchronizing: | ||||
|   { | ||||
|     if (m_silentFrames)	{  // send silence up to first second
 | ||||
|       numFrames = qMin (m_silentFrames, numFrames); | ||||
|       for ( ; samples != end; samples = load (0, samples)) { // silence
 | ||||
| 	      } | ||||
| 	    m_silentFrames -= numFrames; | ||||
| 	    return numFrames * bytesPerFrame (); | ||||
| 	  } | ||||
|       m_silentFrames -= numFrames; | ||||
|       return numFrames * bytesPerFrame (); | ||||
|     } | ||||
| 
 | ||||
| 	Q_EMIT stateChanged ((m_state = Active)); | ||||
| 	m_ramp = 0;		// prepare for CW wave shaping
 | ||||
|       } | ||||
|     Q_EMIT stateChanged ((m_state = Active)); | ||||
|     m_ramp = 0;		// prepare for CW wave shaping
 | ||||
|   } | ||||
|       // fall through
 | ||||
| 
 | ||||
|     case Active: | ||||
|       { | ||||
| 	unsigned isym (m_tuning ? 0 : m_ic / (4.0 * m_nsps)); // Actual fsample=48000
 | ||||
|   case Active: | ||||
|   { | ||||
|     unsigned isym (m_tuning ? 0 : m_ic / (4.0 * m_nsps)); // Actual fsample=48000
 | ||||
|     if (isym >= m_symbolsLength && icw[0] > 0) { // start CW condition
 | ||||
|       // Output the CW ID
 | ||||
|       m_dphi = m_twoPi * m_frequency / m_frameRate; | ||||
|       unsigned const ic0 = m_symbolsLength * 4 * m_nsps; | ||||
|       unsigned j (0); | ||||
|       qint64 framesGenerated (0); | ||||
| 
 | ||||
| 	if (isym >= m_symbolsLength && icw[0] > 0) // start CW condition
 | ||||
| 	  { | ||||
| 	    // Output the CW ID
 | ||||
| 	    m_dphi = m_twoPi * m_frequency / m_frameRate; | ||||
|       while (samples != end) { | ||||
|         m_phi += m_dphi; | ||||
|         if (m_phi > m_twoPi) m_phi -= m_twoPi; | ||||
| 
 | ||||
| 	    unsigned const ic0 = m_symbolsLength * 4 * m_nsps; | ||||
| 	    unsigned j (0); | ||||
| 	    qint64 framesGenerated (0); | ||||
|         qint16 sample ((SOFT_KEYING ? qAbs (m_ramp - 1) : | ||||
|                                       (m_ramp ? 32767 : 0)) * qSin (m_phi)); | ||||
| 
 | ||||
| 	    while (samples != end) | ||||
| 	      { | ||||
| 		m_phi += m_dphi; | ||||
| 		if (m_phi > m_twoPi) | ||||
| 		  { | ||||
| 		    m_phi -= m_twoPi; | ||||
| 		  } | ||||
|         j = (m_ic - ic0 - 1) / m_nspd + 1; | ||||
|         bool l0 (icw[j] && icw[j] <= 1); // first element treated specially as it's a count
 | ||||
|         j = (m_ic - ic0) / m_nspd + 1; | ||||
| 
 | ||||
| 		qint16 sample ((SOFT_KEYING ? qAbs (m_ramp - 1) : (m_ramp ? 32767 : 0)) * qSin (m_phi)); | ||||
|         if ((m_ramp != 0 && m_ramp != std::numeric_limits<qint16>::min ()) || | ||||
|             !!icw[j] != l0) { | ||||
|           if (!!icw[j] != l0) { | ||||
|             Q_ASSERT (m_ramp == 0 || m_ramp == std::numeric_limits<qint16>::min ()); | ||||
|           } | ||||
|           m_ramp += RAMP_INCREMENT; // ramp
 | ||||
|         } | ||||
| 
 | ||||
| 		j = (m_ic - ic0 - 1) / m_nspd + 1; | ||||
| 		bool l0 (icw[j] && icw[j] <= 1); // first element treated specially as it's a count
 | ||||
| 		j = (m_ic - ic0) / m_nspd + 1; | ||||
|         if (j < NUM_CW_SYMBOLS) { // stop condition
 | ||||
|           // if (!m_ramp && !icw[j])
 | ||||
|           //   {
 | ||||
|           // 	sample = 0;
 | ||||
|           //   }
 | ||||
| 
 | ||||
| 		if ((m_ramp != 0 && m_ramp != std::numeric_limits<qint16>::min ()) || !!icw[j] != l0) | ||||
| 		  { | ||||
| 		    if (!!icw[j] != l0) | ||||
| 		      { | ||||
| 			Q_ASSERT (m_ramp == 0 || m_ramp == std::numeric_limits<qint16>::min ()); | ||||
| 		      } | ||||
| 		    m_ramp += RAMP_INCREMENT; // ramp
 | ||||
| 		  } | ||||
|           samples = load (postProcessSample (sample), samples); | ||||
|           ++framesGenerated; | ||||
|           ++m_ic; | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
| 		if (j < NUM_CW_SYMBOLS) // stop condition
 | ||||
| 		  { | ||||
| 		    // if (!m_ramp && !icw[j])
 | ||||
| 		    //   {
 | ||||
| 		    // 	sample = 0;
 | ||||
| 		    //   }
 | ||||
|       if (j > static_cast<unsigned> (icw[0])) { | ||||
|         Q_EMIT stateChanged ((m_state = Idle)); | ||||
|       } | ||||
| 
 | ||||
| 		    samples = load (postProcessSample (sample), samples); | ||||
| 
 | ||||
| 		    ++framesGenerated; | ||||
| 		    ++m_ic; | ||||
| 		  } | ||||
| 	      } | ||||
| 
 | ||||
| 	    if (j > static_cast<unsigned> (icw[0])) | ||||
| 	      { | ||||
| 		Q_EMIT stateChanged ((m_state = Idle)); | ||||
| 	      } | ||||
| 
 | ||||
| 	    m_framesSent += framesGenerated; | ||||
| 	    return framesGenerated * bytesPerFrame (); | ||||
| 	  } | ||||
| 
 | ||||
| 	double const baud (12000.0 / m_nsps); | ||||
|       m_framesSent += framesGenerated; | ||||
|       return framesGenerated * bytesPerFrame (); | ||||
|     } | ||||
| 
 | ||||
|     double const baud (12000.0 / m_nsps); | ||||
| 	// fade out parameters (no fade out for tuning)
 | ||||
| 	unsigned const i0 = m_tuning ? 999 * m_nsps : (m_symbolsLength - 0.017) * 4.0 * m_nsps; | ||||
| 	unsigned const i1 = m_tuning ? 999 * m_nsps : m_symbolsLength * 4.0 * m_nsps; | ||||
|     unsigned const i0 = m_tuning ? 999 * m_nsps : | ||||
|                                    (m_symbolsLength - 0.017) * 4.0 * m_nsps; | ||||
|     unsigned const i1 = m_tuning ? 999 * m_nsps : | ||||
|                                    m_symbolsLength * 4.0 * m_nsps; | ||||
| 
 | ||||
| 	for (unsigned i = 0; i < numFrames; ++i) | ||||
| 	  { | ||||
| 	    isym = m_tuning ? 0 : m_ic / (4.0 * m_nsps); //Actual fsample=48000
 | ||||
| 	    if (isym != m_isym0) | ||||
| 	      { | ||||
| 		double toneFrequency = m_frequency + itone[isym] * baud; | ||||
| 		m_dphi = m_twoPi * toneFrequency / m_frameRate; | ||||
| 		m_isym0 = isym; | ||||
| 	      } | ||||
| 	    m_phi += m_dphi; | ||||
| 	    if (m_phi > m_twoPi) | ||||
| 	      { | ||||
| 		m_phi -= m_twoPi; | ||||
| 	      } | ||||
| 	    if (m_ic > i0) | ||||
| 	      { | ||||
| 		m_amp = 0.98 * m_amp; | ||||
| 	      } | ||||
| 	    if (m_ic > i1) | ||||
| 	      { | ||||
| 		m_amp = 0.0; | ||||
| 	      } | ||||
|     for (unsigned i = 0; i < numFrames; ++i) { | ||||
|       isym = m_tuning ? 0 : m_ic / (4.0 * m_nsps); //Actual fsample=48000
 | ||||
|       if (isym != m_isym0) { | ||||
|         if(m_toneSpacing==0.0) { | ||||
|           toneFrequency0=m_frequency + itone[isym]*baud; | ||||
|         } else { | ||||
|           toneFrequency0=m_frequency + itone[isym]*m_toneSpacing; | ||||
|         } | ||||
|         m_dphi = m_twoPi * toneFrequency0 / m_frameRate; | ||||
|         m_isym0 = isym; | ||||
|       } | ||||
| 
 | ||||
| 	    samples = load (postProcessSample (m_amp * qSin (m_phi)), samples); | ||||
|       int j=m_ic/480; | ||||
|       if(m_fSpread>0.0 and j!=j0) { | ||||
|         float x1=(float)rand()/RAND_MAX; | ||||
|         float x2=(float)rand()/RAND_MAX; | ||||
|         toneFrequency = toneFrequency0 + 0.5*m_fSpread*(x1+x2-1.0); | ||||
|         m_dphi = m_twoPi * toneFrequency / m_frameRate; | ||||
|         j0=j; | ||||
|       } | ||||
| 
 | ||||
|       m_phi += m_dphi; | ||||
|       if (m_phi > m_twoPi) m_phi -= m_twoPi; | ||||
|       if (m_ic > i0) m_amp = 0.98 * m_amp; | ||||
|       if (m_ic > i1) m_amp = 0.0; | ||||
| 
 | ||||
|       samples = load (postProcessSample (m_amp * qSin (m_phi)), samples); | ||||
| 	    ++m_ic; | ||||
| 	  } | ||||
| 
 | ||||
| 	if (m_amp == 0.0) // TODO G4WJS: compare double with zero might not be wise
 | ||||
| 	  { | ||||
| 	    if (icw[0] == 0) | ||||
| 	      { | ||||
| 		// no CW ID to send
 | ||||
| 		Q_EMIT stateChanged ((m_state = Idle)); | ||||
| 		m_framesSent += numFrames; | ||||
| 		return numFrames * bytesPerFrame (); | ||||
| 	      } | ||||
|     if (m_amp == 0.0) { // TODO G4WJS: compare double with zero might not be wise
 | ||||
| 	    if (icw[0] == 0) { | ||||
|         // no CW ID to send
 | ||||
|         Q_EMIT stateChanged ((m_state = Idle)); | ||||
|         m_framesSent += numFrames; | ||||
|         return numFrames * bytesPerFrame (); | ||||
|       } | ||||
| 
 | ||||
| 	    m_phi = 0.0; | ||||
| 	  } | ||||
|       m_phi = 0.0; | ||||
|     } | ||||
| 
 | ||||
| 	// done for this chunk - continue on next call
 | ||||
| 	m_framesSent += numFrames; | ||||
| 	return numFrames * bytesPerFrame (); | ||||
|       } | ||||
|       Q_EMIT stateChanged ((m_state = Idle)); | ||||
|       // fall through
 | ||||
|     m_framesSent += numFrames; | ||||
|     return numFrames * bytesPerFrame (); | ||||
|   } | ||||
|     Q_EMIT stateChanged ((m_state = Idle)); | ||||
|     // fall through
 | ||||
| 
 | ||||
|     case Idle: | ||||
|       break; | ||||
|     } | ||||
|   case Idle: | ||||
|     break; | ||||
|   } | ||||
| 
 | ||||
|   Q_ASSERT (Idle == m_state); | ||||
|   return 0; | ||||
| @ -237,22 +222,17 @@ qint64 Modulator::readData (char * data, qint64 maxSize) | ||||
| 
 | ||||
| qint16 Modulator::postProcessSample (qint16 sample) const | ||||
| { | ||||
|   if (m_muted)			// silent frame
 | ||||
|     { | ||||
|   if (m_muted) {  // silent frame
 | ||||
|       sample = 0; | ||||
|   } else if (m_addNoise) {  // Test frame, we'll add noise
 | ||||
|     qint32 s = m_fac * (gran () + sample * m_snr / 32768.0); | ||||
|     if (s > std::numeric_limits<qint16>::max ()) { | ||||
|       s = std::numeric_limits<qint16>::max (); | ||||
|     } | ||||
|   else if (m_addNoise) | ||||
|     { | ||||
|       qint32 s = m_fac * (gran () + sample * m_snr / 32768.0); | ||||
|       if (s > std::numeric_limits<qint16>::max ()) | ||||
| 	{ | ||||
| 	  s = std::numeric_limits<qint16>::max (); | ||||
| 	} | ||||
|       if (s < std::numeric_limits<qint16>::min ()) | ||||
| 	{ | ||||
| 	  s = std::numeric_limits<qint16>::min (); | ||||
| 	} | ||||
|       sample = s; | ||||
|     if (s < std::numeric_limits<qint16>::min ()) { | ||||
|       s = std::numeric_limits<qint16>::min (); | ||||
|     } | ||||
|     sample = s; | ||||
|   } | ||||
|   return sample; | ||||
| } | ||||
|  | ||||
| @ -35,6 +35,7 @@ public: | ||||
|   bool isMuted () const {return m_muted;} | ||||
|   unsigned frequency () const {return m_frequency;} | ||||
|   bool isActive () const {return m_state != Idle;} | ||||
|   void setWide9(double d1, double d2) {m_toneSpacing=d1; m_fSpread=d2;} | ||||
| 
 | ||||
| protected: | ||||
|   qint64 readData (char * data, qint64 maxSize); | ||||
| @ -66,22 +67,28 @@ private: | ||||
|   static double const m_twoPi; | ||||
|   static unsigned const m_nspd;	// CW ID WPM factor
 | ||||
| 
 | ||||
|   int m_frameRate; | ||||
|   int m_period; | ||||
|   double m_nsps; | ||||
|   double volatile m_frequency; | ||||
|   double m_snr; | ||||
|   qint64 m_silentFrames; | ||||
|   qint64 m_framesSent; | ||||
|   ModulatorState volatile m_state; | ||||
|   bool volatile m_tuning; | ||||
|   bool volatile m_muted; | ||||
|   bool m_addNoise; | ||||
|   double m_phi; | ||||
|   double m_dphi; | ||||
|   double m_amp; | ||||
|   unsigned m_ic; | ||||
|   double m_nsps; | ||||
|   double volatile m_frequency; | ||||
|   double m_snr; | ||||
|   double m_fac; | ||||
|   double m_toneSpacing; | ||||
|   double m_fSpread; | ||||
| 
 | ||||
|   qint64 m_silentFrames; | ||||
|   qint64 m_framesSent; | ||||
| 
 | ||||
|   int m_frameRate; | ||||
|   int m_period; | ||||
|   ModulatorState volatile m_state; | ||||
| 
 | ||||
|   bool volatile m_tuning; | ||||
|   bool volatile m_muted; | ||||
|   bool m_addNoise; | ||||
| 
 | ||||
|   unsigned m_ic; | ||||
|   unsigned m_isym0; | ||||
|   qint16 m_ramp; | ||||
| }; | ||||
|  | ||||
| @ -29,4 +29,10 @@ extern struct FortranCommon { | ||||
|   char datetime[20]; | ||||
| } jt9com_; | ||||
| 
 | ||||
| extern "C" { | ||||
| extern struct { | ||||
|   float syellow[NSMAX]; | ||||
| } jt9w_; | ||||
| } | ||||
| 
 | ||||
| #endif // COMMONS_H
 | ||||
|  | ||||
							
								
								
									
										40
									
								
								devsetup.cpp
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								devsetup.cpp
									
									
									
									
									
								
							| @ -5,6 +5,7 @@ | ||||
| #include <iterator> | ||||
| #include <algorithm> | ||||
| #include <tr1/functional> | ||||
| #include <qmath.h> | ||||
| 
 | ||||
| #include <QDebug> | ||||
| #include <QSettings> | ||||
| @ -85,10 +86,13 @@ void DevSetup::initDlg() | ||||
|   ui->pttMethodComboBox->setCurrentIndex(m_pttMethodIndex); | ||||
|   ui->saveDirEntry->setText(m_saveDir); | ||||
|   ui->cbID73->setChecked(m_After73); | ||||
|   ui->cbDisplayAstroData->setChecked(m_bAstroData); | ||||
|   ui->cbPSKReporter->setChecked(m_pskReporter); | ||||
|   ui->cbSplit->setChecked(m_bSplit and m_catEnabled); | ||||
|   ui->cbXIT->setChecked(m_bXIT); | ||||
|   ui->cbXIT->setVisible(false); | ||||
|   ui->dtMinSpinBox->setValue(m_DTmin); | ||||
|   ui->dtMaxSpinBox->setValue(m_DTmax); | ||||
| 
 | ||||
|   enableWidgets(); | ||||
| 
 | ||||
| @ -99,6 +103,9 @@ void DevSetup::initDlg() | ||||
|   ui->handshakeComboBox->setCurrentIndex(m_handshakeIndex); | ||||
|   ui->rbData->setChecked(m_pttData); | ||||
|   ui->pollSpinBox->setValue(m_poll); | ||||
|   ui->cbEMEband->setCurrentIndex(m_EMEbandIndex); | ||||
|   ui->cbBWmult->setCurrentIndex(m_toneMultIndex); | ||||
|   ui->astroFontSpinBox->setValue(m_astroFont); | ||||
| 
 | ||||
|   // PY2SDR -- Per OS serial port names
 | ||||
|   m_tmp=m_pttPort; | ||||
| @ -708,3 +715,36 @@ void DevSetup::enumerateRigs () | ||||
|   ui->rigComboBox->addItem ("Ham Radio Deluxe", 9999); | ||||
|   ui->rigComboBox->setCurrentIndex (ui->rigComboBox->findData (m_rig)); | ||||
| } | ||||
| 
 | ||||
| void DevSetup::on_cbEMEband_activated(int index) | ||||
| { | ||||
|   m_EMEbandIndex=index; | ||||
|   m_EMEband=ui->cbEMEband->itemText(index).toInt(); | ||||
| } | ||||
| 
 | ||||
| void DevSetup::on_cbBWmult_activated(int index) | ||||
| { | ||||
|   m_toneMultIndex=index; | ||||
|   m_toneMult=pow(2,index); | ||||
| } | ||||
| 
 | ||||
| void DevSetup::on_dtMinSpinBox_valueChanged(double arg1) | ||||
| { | ||||
|   m_DTmin=arg1; | ||||
| } | ||||
| 
 | ||||
| void DevSetup::on_dtMaxSpinBox_valueChanged(double arg1) | ||||
| { | ||||
|   m_DTmax=arg1; | ||||
| } | ||||
| 
 | ||||
| void DevSetup::on_astroFontSpinBox_valueChanged(int arg1) | ||||
| { | ||||
|   if(arg1==-999) m_astroFont=18;   //silence compiler warning
 | ||||
|   m_astroFont=ui->astroFontSpinBox->value(); | ||||
| } | ||||
| 
 | ||||
| void DevSetup::on_cbDisplayAstroData_toggled(bool checked) | ||||
| { | ||||
|   m_bAstroData=checked; | ||||
| } | ||||
|  | ||||
							
								
								
									
										27
									
								
								devsetup.h
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								devsetup.h
									
									
									
									
									
								
							| @ -32,6 +32,9 @@ public: | ||||
| 
 | ||||
|   void initDlg(); | ||||
| 
 | ||||
|   float   m_DTmin; | ||||
|   float   m_DTmax; | ||||
| 
 | ||||
|   qint32  m_idInt; | ||||
|   qint32  m_pttMethodIndex; | ||||
|   qint32  m_pttPort; | ||||
| @ -48,17 +51,22 @@ public: | ||||
|   qint32  m_test; | ||||
|   qint32  m_poll; | ||||
|   qint32  m_tmp; | ||||
|   qint32  m_EMEband; | ||||
|   qint32  m_EMEbandIndex; | ||||
|   qint32  m_toneMult; | ||||
|   qint32  m_toneMultIndex; | ||||
|   qint32  m_astroFont; | ||||
| 
 | ||||
|   typedef QList<QAudioDeviceInfo> AudioDevices; | ||||
|   AudioDevices m_audioInputDevices; /* available input devices */ | ||||
|   AudioDevices m_audioOutputDevices; /* available output devices */ | ||||
|   QAudioDeviceInfo m_audioInputDevice; /* selected input device */ | ||||
|   QAudioDeviceInfo m_audioOutputDevice; /* selected output device */ | ||||
|   bool    m_restartSoundIn; | ||||
|   bool    m_restartSoundOut; | ||||
|   AudioDevices m_audioInputDevices;         // available input devices
 | ||||
|   AudioDevices m_audioOutputDevices;        // available output devices
 | ||||
|   QAudioDeviceInfo m_audioInputDevice;      // selected input device
 | ||||
|   QAudioDeviceInfo m_audioOutputDevice;     // selected output device
 | ||||
|   AudioDevice::Channel m_audioInputChannel; | ||||
|   AudioDevice::Channel m_audioOutputChannel; | ||||
| 
 | ||||
|   bool    m_restartSoundIn; | ||||
|   bool    m_restartSoundOut; | ||||
|   bool    m_pskReporter; | ||||
|   bool    m_firstCall; | ||||
|   bool    m_catEnabled; | ||||
| @ -69,6 +77,7 @@ public: | ||||
|   bool    m_pttData; | ||||
|   bool    m_bSplit; | ||||
|   bool    m_bXIT; | ||||
|   bool    m_bAstroData; | ||||
| 
 | ||||
|   QString m_myCall; | ||||
|   QString m_myGrid; | ||||
| @ -112,6 +121,12 @@ private slots: | ||||
|   void on_pttMethodComboBox_currentIndexChanged(int index); | ||||
|   void on_cbSplit_toggled(bool checked); | ||||
|   void on_cbXIT_toggled(bool checked); | ||||
|   void on_cbEMEband_activated(int index); | ||||
|   void on_cbBWmult_activated(int index); | ||||
|   void on_dtMinSpinBox_valueChanged(double arg1); | ||||
|   void on_dtMaxSpinBox_valueChanged(double arg1); | ||||
|   void on_astroFontSpinBox_valueChanged(int arg1); | ||||
|   void on_cbDisplayAstroData_toggled(bool checked); | ||||
| 
 | ||||
| private: | ||||
|   void loadAudioDevices (AudioDevices const&, QComboBox *, QAudioDeviceInfo const&, QAudioDeviceInfo const&); | ||||
|  | ||||
							
								
								
									
										224
									
								
								devsetup.ui
									
									
									
									
									
								
							
							
						
						
									
										224
									
								
								devsetup.ui
									
									
									
									
									
								
							| @ -1868,7 +1868,7 @@ | ||||
|            <rect> | ||||
|             <x>0</x> | ||||
|             <y>0</y> | ||||
|             <width>308</width> | ||||
|             <width>510</width> | ||||
|             <height>449</height> | ||||
|            </rect> | ||||
|           </property> | ||||
| @ -2522,6 +2522,228 @@ | ||||
|        </item> | ||||
|       </layout> | ||||
|      </widget> | ||||
|      <widget class="QWidget" name="tab_4"> | ||||
|       <attribute name="title"> | ||||
|        <string>JT9W</string> | ||||
|       </attribute> | ||||
|       <widget class="QWidget" name=""> | ||||
|        <property name="geometry"> | ||||
|         <rect> | ||||
|          <x>140</x> | ||||
|          <y>101</y> | ||||
|          <width>202</width> | ||||
|          <height>161</height> | ||||
|         </rect> | ||||
|        </property> | ||||
|        <layout class="QGridLayout" name="gridLayout_4"> | ||||
|         <item row="0" column="0"> | ||||
|          <widget class="QLabel" name="label_8"> | ||||
|           <property name="text"> | ||||
|            <string>Band (MHz):</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="0" column="1"> | ||||
|          <widget class="QComboBox" name="cbEMEband"> | ||||
|           <property name="currentIndex"> | ||||
|            <number>9</number> | ||||
|           </property> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>50</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>144</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>222</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>432</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>903</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>1296</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>2320</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>3400</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>5760</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>10368</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>24192</string> | ||||
|            </property> | ||||
|           </item> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="1" column="0"> | ||||
|          <widget class="QLabel" name="label_26"> | ||||
|           <property name="text"> | ||||
|            <string>BW Mult:</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="1" column="1"> | ||||
|          <widget class="QComboBox" name="cbBWmult"> | ||||
|           <property name="currentIndex"> | ||||
|            <number>5</number> | ||||
|           </property> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>1</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>2</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>4</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>8</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>16</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>32</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>64</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>128</string> | ||||
|            </property> | ||||
|           </item> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="2" column="0"> | ||||
|          <widget class="QLabel" name="label_27"> | ||||
|           <property name="text"> | ||||
|            <string>DT min (s):</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="2" column="1"> | ||||
|          <widget class="QDoubleSpinBox" name="dtMinSpinBox"> | ||||
|           <property name="decimals"> | ||||
|            <number>1</number> | ||||
|           </property> | ||||
|           <property name="minimum"> | ||||
|            <double>-2.500000000000000</double> | ||||
|           </property> | ||||
|           <property name="maximum"> | ||||
|            <double>5.000000000000000</double> | ||||
|           </property> | ||||
|           <property name="singleStep"> | ||||
|            <double>0.100000000000000</double> | ||||
|           </property> | ||||
|           <property name="value"> | ||||
|            <double>-2.500000000000000</double> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="3" column="0"> | ||||
|          <widget class="QLabel" name="label_28"> | ||||
|           <property name="text"> | ||||
|            <string>DT max (s):</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="3" column="1"> | ||||
|          <widget class="QDoubleSpinBox" name="dtMaxSpinBox"> | ||||
|           <property name="decimals"> | ||||
|            <number>1</number> | ||||
|           </property> | ||||
|           <property name="minimum"> | ||||
|            <double>-2.500000000000000</double> | ||||
|           </property> | ||||
|           <property name="maximum"> | ||||
|            <double>5.000000000000000</double> | ||||
|           </property> | ||||
|           <property name="singleStep"> | ||||
|            <double>0.100000000000000</double> | ||||
|           </property> | ||||
|           <property name="value"> | ||||
|            <double>5.000000000000000</double> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="4" column="0"> | ||||
|          <widget class="QLabel" name="label_29"> | ||||
|           <property name="text"> | ||||
|            <string>Astro Font Size:</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="4" column="1"> | ||||
|          <widget class="QSpinBox" name="astroFontSpinBox"> | ||||
|           <property name="minimum"> | ||||
|            <number>14</number> | ||||
|           </property> | ||||
|           <property name="maximum"> | ||||
|            <number>18</number> | ||||
|           </property> | ||||
|           <property name="singleStep"> | ||||
|            <number>2</number> | ||||
|           </property> | ||||
|           <property name="value"> | ||||
|            <number>18</number> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="5" column="0" colspan="2"> | ||||
|          <widget class="QCheckBox" name="cbDisplayAstroData"> | ||||
|           <property name="text"> | ||||
|            <string>Display Astronomical Data on startup</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|        </layout> | ||||
|       </widget> | ||||
|      </widget> | ||||
|     </widget> | ||||
|    </item> | ||||
|    <item> | ||||
|  | ||||
| @ -3,25 +3,15 @@ | ||||
| #   C> make > junk1 2>&1
 | ||||
| 
 | ||||
| # Set paths
 | ||||
| EXE_DIR = ..\..\wsjtx_install | ||||
| QT_DIR = c:/QtSDK/Desktop/Qt/4.7.4/mingw | ||||
| EXE_DIR = ../../wsjtx_install | ||||
| 
 | ||||
| #INCPATH = -I'${QT_DIR}/include/QtCore' \
 | ||||
| #	 -I'${QT_DIR}/include' \
 | ||||
| #	 -I'${QT_DIR}/include/ActiveQt' \
 | ||||
| #	 -I'release' -I'.' -I'${QT_DIR}/mkspecs/win32-g++'
 | ||||
| 
 | ||||
| INCPATH = -I'${QT_DIR}/include/QtCore' \
 | ||||
| 	-I'${QT_DIR}/include' \
 | ||||
| INCPATH = -I'C:/wsjt-env/Qt5/5.2.1/mingw48_32/include/QtCore' \
 | ||||
| 	-I'C:/wsjt-env/Qt5/5.2.1/mingw48_32/include/'  | ||||
| 
 | ||||
| # Compilers
 | ||||
| CC = gcc | ||||
| CXX = g++ | ||||
| FC = g95 | ||||
| AR = ar | ||||
| RANLIB = ranlib | ||||
| CP = cp | ||||
| MKDIR = mkdir -p | ||||
| 
 | ||||
| FFLAGS = -O2 -fbounds-check -Wall -Wno-precision-loss -fno-second-underscore | ||||
| CFLAGS = -I. -fbounds-check -mno-stack-arg-probe | ||||
| @ -38,14 +28,14 @@ CFLAGS = -I. -fbounds-check -mno-stack-arg-probe | ||||
| %.o: %.F90 | ||||
| 	${FC} ${FFLAGS} -c $< | ||||
| 
 | ||||
| all:    libjt9.a jt9sim.exe jt9.exe jt9code.exe jt65code.exe jt65.exe | ||||
| all:    libjt9.a libastro.a jt9.exe jt9code.exe jt65code.exe  | ||||
| 
 | ||||
| OBJS1 = pctile.o graycode.o sort.o ssort.o chkmsg.o \
 | ||||
| 	unpackmsg.o igray.o unpackcall.o unpackgrid.o \
 | ||||
| 	grid2k.o unpacktext.o getpfx2.o packmsg.o deg2grid.o \
 | ||||
| 	packtext.o getpfx1.o packcall.o k2grid.o packgrid.o \
 | ||||
| 	nchar.o four2a.o grid2deg.o pfxdump.o f77_wisdom.o \
 | ||||
| 	symspec.o analytic.o db.o genjt9.o \
 | ||||
| 	symspec.o analytic.o db.o genjt9.o flat1.o smo.o \
 | ||||
| 	packbits.o unpackbits.o encode232.o interleave9.o \
 | ||||
| 	entail.o fano232.o gran.o sync9.o decode9.o \
 | ||||
| 	fil3.o decoder.o grid2n.o n2grid.o timer.o \
 | ||||
| @ -60,16 +50,16 @@ OBJS1 = pctile.o graycode.o sort.o ssort.o chkmsg.o \ | ||||
| 	flat3.o polfit.o determ.o baddata.o | ||||
| 
 | ||||
| libjt9.a: $(OBJS1) | ||||
| 	${AR} cr libjt9.a $(OBJS1)  | ||||
| 	${RANLIB} libjt9.a | ||||
| 	ar cr libjt9.a $(OBJS1)  | ||||
| 	ranlib libjt9.a | ||||
| 
 | ||||
| OBJS2 = jt9.o jt9a.o jt9b.o jt9c.o ipcomm.o sec_midn.o usleep.o | ||||
| LIBS2 = -L'${QT_DIR}/lib' -lQt5Core | ||||
| LIBS2 = -L'C:/wsjt-env/Qt5/5.2.1/mingw48_32/lib' -lQt5Core | ||||
| jt9.exe: $(OBJS2) libjt9.a | ||||
| 	$(CXX) -o jt9.exe -static $(OBJS2) $(LIBS2) libjt9.a \
 | ||||
| 	../libfftw3f_win.a -lgfortran | ||||
| 	-$(MKDIR) $(EXE_DIR) | ||||
| 	${CP} jt9.exe $(EXE_DIR) | ||||
| 	../libfftw3f_win.a c:/MinGW/lib/libf95.a | ||||
| 	mkdir -p $(EXE_DIR) | ||||
| 	cp jt9.exe $(EXE_DIR) | ||||
| 
 | ||||
| OBJS3 = jt9sim.o  | ||||
| jt9sim.exe: $(OBJS3) libjt9.a | ||||
| @ -78,16 +68,24 @@ jt9sim.exe: $(OBJS3) libjt9.a | ||||
| OBJS4 = jt9code.o  | ||||
| jt9code.exe: $(OBJS4) libjt9.a | ||||
| 	$(FC) -o jt9code.exe $(OBJS4) libjt9.a | ||||
| 	$(CP) jt9code.exe $(EXE_DIR) | ||||
| 	cp jt9code.exe $(EXE_DIR) | ||||
| 
 | ||||
| OBJS5 = jt65.o  | ||||
| jt65.exe: $(OBJS5) libjt9.a  | ||||
| 	$(FC) -o jt65.exe $(OBJS5) libjt9.a ../libfftw3f_win.a | ||||
| 
 | ||||
| OBJS7 = astrosub.o astro0.o astro.o tm2.o grid2deg.o sun.o moondop.o \
 | ||||
| 	coord.o dot.o moon2.o tmoonsub.o toxyz.o geocentric.o \
 | ||||
| 	dcoord.o | ||||
| 
 | ||||
| libastro.a: $(OBJS7) | ||||
| 	ar cr libastro.a $(OBJS7) | ||||
| 	ranlib libastro.a | ||||
| 
 | ||||
| OBJS6 = jt65code.o | ||||
| jt65code.exe: $(OBJS6) libjt9.a | ||||
| 	$(FC) -o jt65code.exe $(OBJS6) libjt9.a | ||||
| 	$(CP) jt65code.exe $(EXE_DIR) | ||||
| 	cp jt65code.exe $(EXE_DIR) | ||||
| 
 | ||||
| sync9.o: sync9.f90 jt9sync.f90 | ||||
| 	$(FC) $(FFLAGS) -c sync9.f90 | ||||
|  | ||||
| @ -37,7 +37,7 @@ subroutine decoder(ss,id2) | ||||
| 
 | ||||
|   ntol65=20 | ||||
|   done65=.false. | ||||
|   if(nmode.ge.65 .and. ntxmode.eq.65) then | ||||
|   if((nmode.eq.65 .or. nmode.eq.65+9) .and. ntxmode.eq.65) then | ||||
|      if(newdat.ne.0) dd(1:npts65)=id2(1:npts65) | ||||
|      nf1=nfa | ||||
|      nf2=nfb | ||||
|  | ||||
| @ -1,30 +1,27 @@ | ||||
| subroutine flat1(psavg,s2,nh,nsteps,nhmax,nsmax) | ||||
| subroutine flat1(savg,iz,nsmo,syellow) | ||||
| 
 | ||||
|   real psavg(nh) | ||||
|   real s2(nhmax,nsmax) | ||||
|   real x(8192),tmp(33) | ||||
|   real savg(iz) | ||||
|   real syellow(iz) | ||||
|   real x(8192) | ||||
| 
 | ||||
|   nsmo=33 | ||||
|   ia=nsmo/2 + 1 | ||||
|   ib=nh - nsmo/2 - 1 | ||||
|   do i=ia,ib | ||||
|      call pctile(psavg(i-nsmo/2),nsmo,50,x(i)) | ||||
|   ib=iz - nsmo/2 - 1 | ||||
|   nstep=20 | ||||
|   nh=nstep/2 | ||||
|   do i=ia,ib,nstep | ||||
|      call pctile(savg(i-nsmo/2),nsmo,50,x(i)) | ||||
|      x(i-nh:i+nh-1)=x(i) | ||||
|   enddo | ||||
|   do i=1,ia-1 | ||||
|      x(i)=x(ia) | ||||
|   enddo | ||||
|   do i=ib+1,nh | ||||
|   do i=ib+1,iz | ||||
|      x(i)=x(ib) | ||||
|   enddo | ||||
| 
 | ||||
|   do i=1,nh | ||||
|      psavg(i)=psavg(i)/x(i) | ||||
|      do j=1,nsteps | ||||
|         s2(i,j)=s2(i,j)/x(i) | ||||
|      enddo | ||||
|   enddo | ||||
|   x0=0.001*maxval(x(1:iz)) | ||||
|   syellow(1:iz)=savg(1:iz)/(x(1:iz)+x0) | ||||
| 
 | ||||
|   return | ||||
| end subroutine flat1 | ||||
| 
 | ||||
|        | ||||
|  | ||||
| @ -22,11 +22,13 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nflatten,pxdb,s,df3,ihsym,npts8) | ||||
|   real*4 s(NSMAX) | ||||
|   real*4 ssum(NSMAX) | ||||
|   real*4 xc(0:MAXFFT3-1) | ||||
|   real*4 tmp(NSMAX) | ||||
|   complex cx(0:MAXFFT3/2) | ||||
|   integer*2 id2 | ||||
|   common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat,         & | ||||
|        ntr,mousefqso,newdat,npts8a,nfa,nfsplit,nfb,ntol,kin,nzhsym,         & | ||||
|        nsave,nagain,ndepth,ntxmode,nmode,junk(5) | ||||
|   common/jt9w/syellow(NSMAX) | ||||
|   data rms/999.0/,k0/99999999/,nfft3z/0/ | ||||
|   equivalence (xc,cx) | ||||
|   save | ||||
| @ -99,6 +101,20 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nflatten,pxdb,s,df3,ihsym,npts8) | ||||
| 
 | ||||
|   savg=ssum/ihsym | ||||
| 
 | ||||
|   if(mod(n,10).eq.0) then | ||||
|      mode4=36 | ||||
|      nsmo=min(10*mode4,150) | ||||
|      nsmo=4*nsmo | ||||
|      call flat1(savg,iz,nsmo,syellow) | ||||
|      if(mode4.ge.9) call smo(syellow,iz,tmp,mode4) | ||||
|      ia=500./df3 | ||||
|      ib=2700.0/df3 | ||||
|      smin=minval(syellow(ia:ib)) | ||||
|      smax=maxval(syellow(1:iz)) | ||||
|      syellow=(50.0/(smax-smin))*(syellow-smin) | ||||
|      where(syellow<0) syellow=0. | ||||
|   endif | ||||
| 
 | ||||
|   if(nflatten.ne.0) then | ||||
|      call flat3(s,iz,nfa,nfb,3,1.0,s) | ||||
|      call flat3(savg,iz,nfa,nfb,3,1.0,savg) | ||||
|  | ||||
							
								
								
									
										123
									
								
								mainwindow.cpp
									
									
									
									
									
								
							
							
						
						
									
										123
									
								
								mainwindow.cpp
									
									
									
									
									
								
							| @ -1,4 +1,5 @@ | ||||
| //------------------------------------------------------------ MainWindow
 | ||||
| //----------------------------------------------------------- MainWindow
 | ||||
| 
 | ||||
| #include "mainwindow.h" | ||||
| #include "ui_mainwindow.h" | ||||
| 
 | ||||
| @ -9,6 +10,7 @@ | ||||
| #include "devsetup.h" | ||||
| #include "plotter.h" | ||||
| #include "about.h" | ||||
| #include "astro.h" | ||||
| #include "widegraph.h" | ||||
| #include "sleep.h" | ||||
| #include "getfile.h" | ||||
| @ -27,7 +29,7 @@ qint32  g_COMportOpen; | ||||
| qint32  g_iptt; | ||||
| static int nc1=1; | ||||
| wchar_t buffer[256]; | ||||
| 
 | ||||
| Astro*  g_pAstro = NULL; | ||||
| 
 | ||||
| Rig* rig = NULL; | ||||
| QTextEdit* pShortcuts; | ||||
| @ -35,7 +37,7 @@ QTextEdit* pPrefixes; | ||||
| QTcpSocket* commanderSocket = new QTcpSocket(0); | ||||
| 
 | ||||
| QString rev="$Rev$"; | ||||
| QString Program_Title_Version="  WSJT-X   v1.3, r" + rev.mid(6,4) + | ||||
| QString Program_Title_Version="  WSJT-X   v1.4, r" + rev.mid(6,4) + | ||||
|                               "    by K1JT"; | ||||
| 
 | ||||
| //--------------------------------------------------- MainWindow constructor
 | ||||
| @ -48,7 +50,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the | ||||
|   ui(new Ui::MainWindow), | ||||
|   m_wideGraph (new WideGraph (settings)), | ||||
|   m_logDlg (new LogQSO (settings, this)), | ||||
|   m_detector (RX_SAMPLE_RATE, NTMAX/2, 6912/2, downSampleFactor), | ||||
|   m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, downSampleFactor), | ||||
|   m_audioInputDevice (QAudioDeviceInfo::defaultInputDevice ()), // start with default
 | ||||
|   m_modulator (TX_SAMPLE_RATE, NTMAX / 2), | ||||
|   m_audioOutputDevice (QAudioDeviceInfo::defaultOutputDevice ()), // start with default
 | ||||
| @ -64,7 +66,6 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the | ||||
|   connect (this, &MainWindow::finished, this, &MainWindow::close); | ||||
| 
 | ||||
|   // start audio thread and hook up slots & signals for shutdown management
 | ||||
| 
 | ||||
|   // these objects need to be in the audio thread so that invoking
 | ||||
|   // their slots is done in a thread safe way
 | ||||
|   m_soundOutput.moveToThread (&m_audioThread); | ||||
| @ -125,6 +126,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the | ||||
| 
 | ||||
|   QActionGroup* modeGroup = new QActionGroup(this); | ||||
|   ui->actionJT9_1->setActionGroup(modeGroup); | ||||
|   ui->actionJT9W_1->setActionGroup(modeGroup); | ||||
|   ui->actionJT65->setActionGroup(modeGroup); | ||||
|   ui->actionJT9_JT65->setActionGroup(modeGroup); | ||||
| 
 | ||||
| @ -272,6 +274,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the | ||||
|   m_QSOText.clear(); | ||||
|   m_CATerror=false; | ||||
|   decodeBusy(false); | ||||
|   m_toneSpacing=0; | ||||
| 
 | ||||
|   signalMeter = new SignalMeter(ui->meterFrame); | ||||
|   signalMeter->resize(50, 160); | ||||
| @ -370,8 +373,11 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the | ||||
|   genStdMsgs(m_rpt); | ||||
|   m_ntx=6; | ||||
|   ui->txrb6->setChecked(true); | ||||
|   if(m_mode!="JT9" and m_mode!="JT65" and m_mode!="JT9+JT65") m_mode="JT9"; | ||||
|   if(m_mode!="JT9" and m_mode!="JT9W-1" and m_mode!="JT65" and | ||||
|       m_mode!="JT9+JT65") m_mode="JT9"; | ||||
|   on_actionWide_Waterfall_triggered();                   //###
 | ||||
| //  on_actionAstronomical_data_triggered();
 | ||||
|   if(m_bAstroData) on_actionAstronomical_data_triggered(); | ||||
|   m_wideGraph->setRxFreq(m_rxFreq); | ||||
|   m_wideGraph->setTxFreq(m_txFreq); | ||||
|   m_wideGraph->setLockTxFreq(m_lockTxFreq); | ||||
| @ -383,6 +389,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the | ||||
|           SLOT(setFreq4(int,int))); | ||||
| 
 | ||||
|   if(m_mode=="JT9") on_actionJT9_1_triggered(); | ||||
|   if(m_mode=="JT9W-1") on_actionJT9W_1_triggered(); | ||||
|   if(m_mode=="JT65") on_actionJT65_triggered(); | ||||
|   if(m_mode=="JT9+JT65") on_actionJT9_JT65_triggered(); | ||||
| 
 | ||||
| @ -461,6 +468,10 @@ void MainWindow::writeSettings() | ||||
|   m_settings->setValue("TxFirst",m_txFirst); | ||||
|   m_settings->setValue("DXcall",ui->dxCallEntry->text()); | ||||
|   m_settings->setValue("DXgrid",ui->dxGridEntry->text()); | ||||
|   if(g_pAstro!=NULL and g_pAstro->isVisible()) { | ||||
|     m_astroGeom = g_pAstro->geometry(); | ||||
|     m_settings->setValue("AstroGeom",m_astroGeom); | ||||
|   } | ||||
|   m_settings->endGroup(); | ||||
| 
 | ||||
|   m_settings->beginGroup("Common"); | ||||
| @ -469,6 +480,7 @@ void MainWindow::writeSettings() | ||||
|   m_settings->setValue("IDint",m_idInt); | ||||
|   m_settings->setValue("PTTmethod",m_pttMethodIndex); | ||||
|   m_settings->setValue("PTTport",m_pttPort); | ||||
|   m_settings->setValue("AstroFont",m_astroFont); | ||||
|   m_settings->setValue("SaveDir",m_saveDir); | ||||
|   m_settings->setValue("SoundInName", m_audioInputDevice.deviceName ()); | ||||
|   m_settings->setValue("SoundOutName", m_audioOutputDevice.deviceName ()); | ||||
| @ -489,6 +501,7 @@ void MainWindow::writeSettings() | ||||
|   m_settings->setValue("OutAttenuation", ui->outAttenuation->value ()); | ||||
|   m_settings->setValue("PSKReporter",m_pskReporter); | ||||
|   m_settings->setValue("After73",m_After73); | ||||
|   m_settings->setValue("DisplayAstro",m_bAstroData); | ||||
|   m_settings->setValue("Macros",m_macro); | ||||
|   //Band Settings
 | ||||
|   m_settings->setValue("BandFrequencies",m_dFreq); | ||||
| @ -531,6 +544,11 @@ void MainWindow::writeSettings() | ||||
|   m_settings->setValue("UseXIT",m_bXIT); | ||||
|   m_settings->setValue("XIT",m_XIT); | ||||
|   m_settings->setValue("Plus2kHz",m_plus2kHz); | ||||
|   m_settings->setValue("EMEbandIndex",m_EMEbandIndex); | ||||
|   m_settings->setValue("ToneMultIndex",m_toneMultIndex); | ||||
|   m_settings->setValue("DTmin",m_DTmin); | ||||
|   m_settings->setValue("DTmax",m_DTmax); | ||||
| 
 | ||||
|   m_settings->endGroup(); | ||||
| } | ||||
| 
 | ||||
| @ -542,6 +560,7 @@ void MainWindow::readSettings() | ||||
|   restoreState (m_settings->value ("state", saveState ()).toByteArray ()); | ||||
|   ui->dxCallEntry->setText(m_settings->value("DXcall","").toString()); | ||||
|   ui->dxGridEntry->setText(m_settings->value("DXgrid","").toString()); | ||||
|   m_astroGeom = m_settings->value("AstroGeom", QRect(71,390,227,403)).toRect(); | ||||
|   m_path = m_settings->value("MRUdir", m_appDir + "/save").toString(); | ||||
|   m_txFirst = m_settings->value("TxFirst",false).toBool(); | ||||
|   ui->txFirstCheckBox->setChecked(m_txFirst); | ||||
| @ -554,6 +573,7 @@ void MainWindow::readSettings() | ||||
|   m_idInt=m_settings->value("IDint",0).toInt(); | ||||
|   m_pttMethodIndex=m_settings->value("PTTmethod",1).toInt(); | ||||
|   m_pttPort=m_settings->value("PTTport",0).toInt(); | ||||
|   m_astroFont=m_settings->value("AstroFont",18).toInt(); | ||||
|   m_saveDir=m_settings->value("SaveDir",m_appDir + "/save").toString(); | ||||
| 
 | ||||
|   { | ||||
| @ -591,7 +611,7 @@ void MainWindow::readSettings() | ||||
| 
 | ||||
|   m_mode=m_settings->value("Mode","JT9").toString(); | ||||
|   m_modeTx=m_settings->value("ModeTx","JT9").toString(); | ||||
|   if(m_modeTx=="JT9") ui->pbTxMode->setText("Tx JT9  @"); | ||||
|   if(m_modeTx.mid(0,3)=="JT9") ui->pbTxMode->setText("Tx JT9  @"); | ||||
|   if(m_modeTx=="JT65") ui->pbTxMode->setText("Tx JT65  #"); | ||||
|   ui->actionNone->setChecked(m_settings->value("SaveNone",true).toBool()); | ||||
|   ui->actionSave_decoded->setChecked(m_settings->value( | ||||
| @ -617,6 +637,7 @@ void MainWindow::readSettings() | ||||
|   ui->actionMonitor_OFF_at_startup->setChecked(m_monitorStartOFF); | ||||
|   m_pskReporter=m_settings->value("PSKReporter",false).toBool(); | ||||
|   m_After73=m_settings->value("After73",false).toBool(); | ||||
|   m_bAstroData=m_settings->value("DisplayAstro",false).toBool(); | ||||
|   m_macro=m_settings->value("Macros","TNX 73 GL").toStringList(); | ||||
|   //Band Settings
 | ||||
|   m_dFreq=m_settings->value("BandFrequencies","").toStringList(); | ||||
| @ -676,6 +697,10 @@ void MainWindow::readSettings() | ||||
|   m_XIT=m_settings->value("XIT",0).toInt(); | ||||
| 	m_plus2kHz=m_settings->value("Plus2kHz",false).toBool(); | ||||
| 	ui->cbPlus2kHz->setChecked(m_plus2kHz); | ||||
|   m_EMEbandIndex=m_settings->value("EMEbandIndex",0).toInt(); | ||||
|   m_toneMultIndex=m_settings->value("ToneMultIndex",0).toInt(); | ||||
|   m_DTmin=m_settings->value("DTmin",-2.5).toFloat(); | ||||
|   m_DTmax=m_settings->value("DTmax",5.0).toFloat(); | ||||
|   m_settings->endGroup(); | ||||
| 
 | ||||
|   // use these initialisation settings to tune the audio o/p bufefr
 | ||||
| @ -768,6 +793,7 @@ void MainWindow::on_actionDeviceSetup_triggered()               //Setup Dialog | ||||
|   dlg.m_idInt=m_idInt; | ||||
|   dlg.m_pttMethodIndex=m_pttMethodIndex; | ||||
|   dlg.m_pttPort=m_pttPort; | ||||
|   dlg.m_astroFont=m_astroFont; | ||||
|   dlg.m_saveDir=m_saveDir; | ||||
|   dlg.m_audioInputDevice = m_audioInputDevice; | ||||
|   dlg.m_audioOutputDevice = m_audioOutputDevice; | ||||
| @ -775,6 +801,7 @@ void MainWindow::on_actionDeviceSetup_triggered()               //Setup Dialog | ||||
|   dlg.m_audioOutputChannel = m_audioOutputChannel; | ||||
|   dlg.m_pskReporter=m_pskReporter; | ||||
|   dlg.m_After73=m_After73; | ||||
|   dlg.m_bAstroData=m_bAstroData; | ||||
|   dlg.m_macro=m_macro; | ||||
|   dlg.m_dFreq=m_dFreq; | ||||
|   dlg.m_antDescription=m_antDescription; | ||||
| @ -797,6 +824,10 @@ void MainWindow::on_actionDeviceSetup_triggered()               //Setup Dialog | ||||
|   dlg.m_poll=m_poll; | ||||
|   dlg.m_bSplit=m_bSplit; | ||||
|   dlg.m_bXIT=m_bXIT; | ||||
|   dlg.m_EMEbandIndex=m_EMEbandIndex; | ||||
|   dlg.m_toneMultIndex=m_toneMultIndex; | ||||
|   dlg.m_DTmin=m_DTmin; | ||||
|   dlg.m_DTmax=m_DTmax; | ||||
| 
 | ||||
|   if(m_bRigOpen) { | ||||
|     rig->close(); | ||||
| @ -815,6 +846,10 @@ void MainWindow::on_actionDeviceSetup_triggered()               //Setup Dialog | ||||
|     m_idInt=dlg.m_idInt; | ||||
|     m_pttMethodIndex=dlg.m_pttMethodIndex; | ||||
|     m_pttPort=dlg.m_pttPort; | ||||
|     m_astroFont=dlg.m_astroFont; | ||||
|     if(g_pAstro!=NULL and g_pAstro->isVisible()) { | ||||
|       g_pAstro->setFontSize(m_astroFont); | ||||
|     } | ||||
|     m_saveDir=dlg.m_saveDir; | ||||
|     m_audioInputDevice = dlg.m_audioInputDevice; | ||||
|     m_audioOutputDevice = dlg.m_audioOutputDevice; | ||||
| @ -841,18 +876,22 @@ void MainWindow::on_actionDeviceSetup_triggered()               //Setup Dialog | ||||
|     m_bRTS=dlg.m_bRTS; | ||||
|     m_pttData=dlg.m_pttData; | ||||
|     m_poll=dlg.m_poll; | ||||
|     m_EMEbandIndex=dlg.m_EMEbandIndex; | ||||
|     m_toneMultIndex=dlg.m_toneMultIndex; | ||||
|     if(m_mode=="JT9W-1") m_toneSpacing=pow(2,m_toneMultIndex)*12000.0/6912.0; | ||||
|     m_DTmin=dlg.m_DTmin; | ||||
|     m_DTmax=dlg.m_DTmax; | ||||
| 
 | ||||
| 	//Band Settings
 | ||||
|     ui->bandComboBox->clear(); | ||||
|     ui->bandComboBox->addItems(dlg.m_bandDescription); | ||||
|     ui->bandComboBox->setCurrentIndex(m_band); | ||||
|     m_pskReporter=dlg.m_pskReporter; | ||||
| 
 | ||||
|     if(m_pskReporter) { | ||||
|       psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) ); | ||||
|     } | ||||
| 
 | ||||
|     m_After73=dlg.m_After73; | ||||
|     m_bAstroData=dlg.m_bAstroData; | ||||
| 
 | ||||
|     if(dlg.m_restartSoundIn) { | ||||
|       Q_EMIT stopAudioInputStream (); | ||||
| @ -1114,6 +1153,7 @@ void MainWindow::closeEvent(QCloseEvent * e) | ||||
| { | ||||
|   writeSettings (); | ||||
|   OnExit(); | ||||
|   delete g_pAstro;                        //Is there a better way ?
 | ||||
|   QMainWindow::closeEvent (e); | ||||
| } | ||||
| 
 | ||||
| @ -1160,6 +1200,20 @@ void MainWindow::on_actionWide_Waterfall_triggered()      //Display Waterfalls | ||||
|   m_wideGraph->show(); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionAstronomical_data_triggered() | ||||
| { | ||||
|   if(g_pAstro==NULL) { | ||||
|     g_pAstro = new Astro(0); | ||||
|     g_pAstro->setWindowTitle("Astronomical Data"); | ||||
|     Qt::WindowFlags flags = Qt::Dialog | Qt::WindowCloseButtonHint | | ||||
|         Qt::WindowMinimizeButtonHint; | ||||
|     g_pAstro->setWindowFlags(flags); | ||||
|     g_pAstro->setGeometry(m_astroGeom); | ||||
|   } | ||||
|   g_pAstro->setFontSize(m_astroFont); | ||||
|   g_pAstro->show(); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionOpen_triggered()                     //Open File
 | ||||
| { | ||||
|   m_monitoring=false; | ||||
| @ -1174,6 +1228,7 @@ void MainWindow::on_actionOpen_triggered()                     //Open File | ||||
|     if(i>=0) { | ||||
|       lab1->setStyleSheet("QLabel{background-color: #66ff66}"); | ||||
|       lab1->setText(" " + fname.mid(i,15) + " "); | ||||
| //      lab1->setText(" " + fname + " ");
 | ||||
|     } | ||||
|     on_stopButton_clicked(); | ||||
|     m_diskData=true; | ||||
| @ -1187,7 +1242,7 @@ void MainWindow::on_actionOpen_next_in_directory_triggered()   //Open Next | ||||
|   int i,len; | ||||
|   QFileInfo fi(m_path); | ||||
|   QStringList list; | ||||
|   list= fi.dir().entryList().filter(".wav"); | ||||
|   list= fi.dir().entryList().filter(".wav",Qt::CaseInsensitive); | ||||
|   for (i = 0; i < list.size()-1; ++i) { | ||||
|     if(i==list.size()-2) m_loopall=false; | ||||
|     len=list.at(i).length(); | ||||
| @ -1375,8 +1430,9 @@ void MainWindow::decode()                                       //decode() | ||||
|   jt9com_.ntxmode=9; | ||||
|   if(m_modeTx=="JT65") jt9com_.ntxmode=65; | ||||
|   jt9com_.nmode=9; | ||||
|   if(m_mode=="JT9W-1") jt9com_.nmode=91; | ||||
|   if(m_mode=="JT65") jt9com_.nmode=65; | ||||
|   if(m_mode=="JT9+JT65") jt9com_.nmode=9+65; | ||||
|   if(m_mode=="JT9+JT65") jt9com_.nmode=9+65;  // = 74
 | ||||
|   jt9com_.ntrperiod=m_TRperiod; | ||||
|   m_nsave=0; | ||||
|   if(m_saveDecoded) m_nsave=2; | ||||
| @ -1406,6 +1462,7 @@ void MainWindow::jt9_error(QProcess::ProcessError e) | ||||
| { | ||||
|   if(!m_killAll) { | ||||
|     msgBox("Error starting or running\n" + m_appDir + "/jt9 -s"); | ||||
|     qDebug() << e;                           // silence compiler warning
 | ||||
|     exit(1); | ||||
|   } | ||||
| } | ||||
| @ -1758,6 +1815,11 @@ void MainWindow::guiUpdate() | ||||
| 
 | ||||
|   if(nsec != m_sec0) {                                     //Once per second
 | ||||
|     QDateTime t = QDateTime::currentDateTimeUtc(); | ||||
|     int fQSO=125; | ||||
|     m_azelDir=m_appDir; | ||||
|     if(g_pAstro!=NULL) g_pAstro->astroUpdate(t, m_myGrid, m_hisGrid, fQSO, | ||||
|                           m_setftx, m_txFreq, m_azelDir); | ||||
| 
 | ||||
|     if(m_transmitting) { | ||||
|       if(nsendingsh==1) { | ||||
|         lab1->setStyleSheet("QLabel{background-color: #66ffff}"); | ||||
| @ -1807,8 +1869,13 @@ void MainWindow::guiUpdate() | ||||
| void MainWindow::startTx2() | ||||
| { | ||||
|   if (!m_modulator.isActive ()) { | ||||
|     QString t=ui->tx6->text(); | ||||
|     double snr=t.mid(1,5).toDouble(); | ||||
|     m_fSpread=0.0; | ||||
|     double snr=99.0; | ||||
|     QString t=ui->tx5->text(); | ||||
|     if(t.mid(0,1)=="#") m_fSpread=t.mid(1,5).toDouble(); | ||||
|     m_modulator.setWide9(m_toneSpacing, m_fSpread); | ||||
|     t=ui->tx6->text(); | ||||
|     if(t.mid(0,1)=="#") snr=t.mid(1,5).toDouble(); | ||||
|     if(snr>0.0 or snr < -50.0) snr=99.0; | ||||
|     transmit (snr); | ||||
|     signalMeter->setValue(0); | ||||
| @ -2472,6 +2539,7 @@ void MainWindow::on_actionJT9_1_triggered() | ||||
|   m_TRperiod=60; | ||||
|   m_nsps=6912; | ||||
|   m_hsymStop=173; | ||||
|   m_toneSpacing=0.0; | ||||
|   lab2->setStyleSheet("QLabel{background-color: #ff6ec7}"); | ||||
|   lab2->setText(m_mode); | ||||
|   ui->actionJT9_1->setChecked(true); | ||||
| @ -2481,6 +2549,24 @@ void MainWindow::on_actionJT9_1_triggered() | ||||
|   ui->pbTxMode->setEnabled(false); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionJT9W_1_triggered() | ||||
| { | ||||
|   m_mode="JT9W-1"; | ||||
|   if(m_modeTx!="JT9") on_pbTxMode_clicked(); | ||||
|   statusChanged(); | ||||
|   m_TRperiod=60; | ||||
|   m_nsps=6912; | ||||
|   m_hsymStop=173; | ||||
|   m_toneSpacing=pow(2,m_toneMultIndex)*12000.0/6912.0; | ||||
|   lab2->setStyleSheet("QLabel{background-color: #ff6ec7}"); | ||||
|   lab2->setText(m_mode); | ||||
|   ui->actionJT9W_1->setChecked(true); | ||||
|   m_wideGraph->setPeriod(m_TRperiod,m_nsps); | ||||
|   m_wideGraph->setMode(m_mode); | ||||
|   m_wideGraph->setModeTx(m_modeTx); | ||||
|   ui->pbTxMode->setEnabled(false); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionJT65_triggered() | ||||
| { | ||||
|   m_mode="JT65"; | ||||
| @ -3066,13 +3152,18 @@ void MainWindow::transmit (double snr) | ||||
| { | ||||
|   if (m_modeTx == "JT65") | ||||
|     { | ||||
|       Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), m_audioOutputChannel, true, snr); | ||||
|       Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, | ||||
|                           m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), | ||||
|                           m_audioOutputChannel, true, snr); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), m_audioOutputChannel, true, snr); | ||||
|       Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, | ||||
|                           m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), | ||||
|                           m_audioOutputChannel, true, snr); | ||||
|     } | ||||
|   Q_EMIT startAudioOutputStream (m_audioOutputDevice, AudioDevice::Mono == m_audioOutputChannel ? 1 : 2, m_msAudioOutputBuffered); | ||||
|   Q_EMIT startAudioOutputStream (m_audioOutputDevice, | ||||
|   AudioDevice::Mono == m_audioOutputChannel ? 1 : 2, m_msAudioOutputBuffered); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_outAttenuation_valueChanged (int a) | ||||
|  | ||||
							
								
								
									
										13
									
								
								mainwindow.h
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								mainwindow.h
									
									
									
									
									
								
							| @ -179,8 +179,10 @@ private slots: | ||||
|   void on_actionTx2QSO_triggered(bool checked);   | ||||
|   void on_cbPlus2kHz_toggled(bool checked); | ||||
|   void on_outAttenuation_valueChanged (int); | ||||
|   void on_actionAstronomical_data_triggered(); | ||||
|   void on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered(); | ||||
|   void getpfx(); | ||||
|   void on_actionJT9W_1_triggered(); | ||||
| 
 | ||||
| private: | ||||
|   Q_SIGNAL void startAudioOutputStream (QAudioDeviceInfo, unsigned channels, unsigned msBuffered); | ||||
| @ -210,6 +212,11 @@ private: | ||||
|     QScopedPointer<LogQSO> m_logDlg; | ||||
| 
 | ||||
|     double  m_dialFreq; | ||||
|     double  m_toneSpacing; | ||||
|     double  m_fSpread; | ||||
| 
 | ||||
|     float   m_DTmin; | ||||
|     float   m_DTmax; | ||||
| 
 | ||||
|     qint64  m_msErase; | ||||
|     qint64  m_secBandChanged; | ||||
| @ -266,6 +273,9 @@ private: | ||||
|     qint32  m_poll; | ||||
|     qint32  m_fMax; | ||||
|     qint32  m_bad; | ||||
|     qint32  m_EMEbandIndex; | ||||
|     qint32  m_toneMultIndex; | ||||
|     qint32  m_astroFont; | ||||
| 
 | ||||
|     bool    m_monitoring; | ||||
|     bool    m_btxok;		//True if OK to transmit
 | ||||
| @ -318,6 +328,7 @@ private: | ||||
|     bool    m_bSplit; | ||||
|     bool    m_bXIT; | ||||
|     bool    m_plus2kHz; | ||||
|     bool    m_bAstroData; | ||||
| 
 | ||||
|     char    m_decoded[80]; | ||||
| 
 | ||||
| @ -376,6 +387,7 @@ private: | ||||
|     QString m_cmnd; | ||||
|     QString m_msgSent0; | ||||
|     QString m_fileToSave; | ||||
|     QString m_azelDir; | ||||
| 
 | ||||
|     QStringList m_macro; | ||||
|     QStringList m_dFreq;           // per band frequency in MHz as a string
 | ||||
| @ -388,6 +400,7 @@ private: | ||||
|     QHash<QString,bool> m_sfx; | ||||
| 
 | ||||
|     QDateTime m_dateTimeQSO; | ||||
|     QRect   m_astroGeom; | ||||
| 
 | ||||
|     QSharedMemory *mem_jt9; | ||||
|  // Multiple instances:
 | ||||
|  | ||||
| @ -2135,28 +2135,6 @@ p, li { white-space: pre-wrap; } | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="2" column="7"> | ||||
|        <widget class="QPushButton" name="pbR2T"> | ||||
|         <property name="sizePolicy"> | ||||
|          <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||||
|           <horstretch>0</horstretch> | ||||
|           <verstretch>0</verstretch> | ||||
|          </sizepolicy> | ||||
|         </property> | ||||
|         <property name="maximumSize"> | ||||
|          <size> | ||||
|           <width>48</width> | ||||
|           <height>16777215</height> | ||||
|          </size> | ||||
|         </property> | ||||
|         <property name="toolTip"> | ||||
|          <string>Set Tx frequency to Rx Frequency</string> | ||||
|         </property> | ||||
|         <property name="text"> | ||||
|          <string>Tx<Rx</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="3" column="7"> | ||||
|        <widget class="QPushButton" name="pbT2R"> | ||||
|         <property name="sizePolicy"> | ||||
| @ -2179,6 +2157,28 @@ p, li { white-space: pre-wrap; } | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="2" column="7"> | ||||
|        <widget class="QPushButton" name="pbR2T"> | ||||
|         <property name="sizePolicy"> | ||||
|          <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||||
|           <horstretch>0</horstretch> | ||||
|           <verstretch>0</verstretch> | ||||
|          </sizepolicy> | ||||
|         </property> | ||||
|         <property name="maximumSize"> | ||||
|          <size> | ||||
|           <width>48</width> | ||||
|           <height>16777215</height> | ||||
|          </size> | ||||
|         </property> | ||||
|         <property name="toolTip"> | ||||
|          <string>Set Tx frequency to Rx Frequency</string> | ||||
|         </property> | ||||
|         <property name="text"> | ||||
|          <string>Tx<Rx</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="4" column="6"> | ||||
|        <widget class="QCheckBox" name="cbTxLock"> | ||||
|         <property name="toolTip"> | ||||
| @ -2306,6 +2306,7 @@ p, li { white-space: pre-wrap; } | ||||
|     </property> | ||||
|     <addaction name="actionWide_Waterfall"/> | ||||
|     <addaction name="separator"/> | ||||
|     <addaction name="actionAstronomical_data"/> | ||||
|    </widget> | ||||
|    <widget class="QMenu" name="menuDecode"> | ||||
|     <property name="title"> | ||||
| @ -2340,6 +2341,7 @@ p, li { white-space: pre-wrap; } | ||||
|     <addaction name="actionJT9_1"/> | ||||
|     <addaction name="actionJT65"/> | ||||
|     <addaction name="actionJT9_JT65"/> | ||||
|     <addaction name="actionJT9W_1"/> | ||||
|    </widget> | ||||
|    <addaction name="menuFile"/> | ||||
|    <addaction name="menuSetup"/> | ||||
| @ -2652,6 +2654,19 @@ p, li { white-space: pre-wrap; } | ||||
|     <string>Show DXCC entity and worked B4 status</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionAstronomical_data"> | ||||
|    <property name="text"> | ||||
|     <string>Astronomical data</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionJT9W_1"> | ||||
|    <property name="checkable"> | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>JT9W-1</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionShort_list_of_add_on_prefixes_and_suffixes"> | ||||
|    <property name="text"> | ||||
|     <string>Short list of add-on prefixes and suffixes</string> | ||||
|  | ||||
							
								
								
									
										18
									
								
								plotter.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								plotter.cpp
									
									
									
									
									
								
							| @ -96,7 +96,11 @@ void CPlotter::draw(float swide[])             //draw() | ||||
|   m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2); | ||||
|   QPainter painter2D(&m_2DPixmap); | ||||
| 
 | ||||
|   painter2D.setPen(Qt::green); | ||||
|   if(m_bLinearAvg) { | ||||
|     painter2D.setPen(Qt::yellow); | ||||
|   } else { | ||||
|     painter2D.setPen(Qt::green); | ||||
|   } | ||||
| 
 | ||||
|   QPoint LineBuf[MAX_SCREENSIZE]; | ||||
|   j=0; | ||||
| @ -122,8 +126,18 @@ void CPlotter::draw(float swide[])             //draw() | ||||
|         sum+=jt9com_.savg[j++]; | ||||
|       } | ||||
|       y2=gain*6.0*log10(sum/m_binsPerPixel) - 10.0; | ||||
|       y2 += m_plotZero; | ||||
|     } | ||||
|     y2 += m_plotZero; | ||||
| 
 | ||||
|     if(m_bLinearAvg) { | ||||
|       float sum=0.0; | ||||
|       int j=j0+m_binsPerPixel*i; | ||||
|       for(int k=0; k<m_binsPerPixel; k++) { | ||||
|         sum+=jt9w_.syellow[j++]; | ||||
|       } | ||||
|       y2=sum/m_binsPerPixel * (0.2*m_h/50.0) - 20.0; | ||||
|     } | ||||
| 
 | ||||
|     if(i==iz-1) painter2D.drawPolyline(LineBuf,j); | ||||
|     LineBuf[j].setX(i); | ||||
|     LineBuf[j].setY(m_h-(y2+0.8*m_h)); | ||||
|  | ||||
| @ -33,6 +33,7 @@ public: | ||||
| 
 | ||||
|   bool    m_bCurrent; | ||||
|   bool    m_bCumulative; | ||||
|   bool    m_bLinearAvg; | ||||
|   bool    m_lockTxFreq; | ||||
| 
 | ||||
|   float   m_fSpan; | ||||
|  | ||||
							
								
								
									
										15
									
								
								soundout.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								soundout.cpp
									
									
									
									
									
								
							| @ -52,11 +52,13 @@ SoundOutput::SoundOutput (QIODevice * source) | ||||
|   Q_ASSERT (source); | ||||
| } | ||||
| 
 | ||||
| void SoundOutput::startStream (QAudioDeviceInfo const& device, unsigned channels, unsigned msBuffered) | ||||
| void SoundOutput::startStream (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 ())) | ||||
|   if (!m_stream || device != m_currentDevice || | ||||
|       channels != static_cast<unsigned> (m_stream->format ().channelCount ())) | ||||
|     { | ||||
|       QAudioFormat format (device.preferredFormat ()); | ||||
| 
 | ||||
| @ -79,9 +81,11 @@ void SoundOutput::startStream (QAudioDeviceInfo const& device, unsigned channels | ||||
|       m_stream->setVolume (m_volume); | ||||
|       m_stream->setNotifyInterval(100); | ||||
| 
 | ||||
|       connect (m_stream.data(), &QAudioOutput::stateChanged, this, &SoundOutput::handleStateChanged); | ||||
|       connect (m_stream.data(), &QAudioOutput::stateChanged, this, \ | ||||
|                &SoundOutput::handleStateChanged); | ||||
| 
 | ||||
|       m_currentDevice = device; | ||||
| //      qDebug() << "A" << m_volume << m_stream->notifyInterval();
 | ||||
|     } | ||||
| 
 | ||||
|   //
 | ||||
| @ -97,7 +101,10 @@ void SoundOutput::startStream (QAudioDeviceInfo const& device, unsigned channels | ||||
|   // we have to set this before every start on the stream because the
 | ||||
|   // Windows implementation seems to forget the buffer size after a
 | ||||
|   // stop.
 | ||||
|   m_stream->setBufferSize (m_stream->format ().bytesForDuration ((msBuffered ? msBuffered : MS_BUFFERED) * 1000)); | ||||
|   m_stream->setBufferSize (m_stream->format().bytesForDuration( | ||||
|                              (msBuffered ? msBuffered : MS_BUFFERED) * 1000)); | ||||
| //  qDebug() << "B" << m_stream->bufferSize() << m_stream->periodSize() << m_stream->notifyInterval();
 | ||||
| 
 | ||||
|   m_stream->start (m_source); | ||||
|   audioError (); | ||||
| } | ||||
|  | ||||
| @ -44,8 +44,10 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : | ||||
|   ui->waterfallAvgSpinBox->setValue(m_waterfallAvg); | ||||
|   ui->widePlot->m_bCurrent=m_settings->value("Current",false).toBool(); | ||||
|   ui->widePlot->m_bCumulative=m_settings->value("Cumulative",true).toBool(); | ||||
|   ui->widePlot->m_bLinearAvg=m_settings->value("LinearAvg",false).toBool(); | ||||
|   if(ui->widePlot->m_bCurrent) ui->spec2dComboBox->setCurrentIndex(0); | ||||
|   if(ui->widePlot->m_bCumulative) ui->spec2dComboBox->setCurrentIndex(1); | ||||
|   if(ui->widePlot->m_bLinearAvg) ui->spec2dComboBox->setCurrentIndex(2); | ||||
|   int nbpp=m_settings->value("BinsPerPixel",2).toInt(); | ||||
|   ui->widePlot->setBinsPerPixel(nbpp); | ||||
|   ui->widePlot->setStartFreq(m_settings->value("StartFreq",0).toInt()); | ||||
| @ -94,6 +96,7 @@ void WideGraph::saveSettings() | ||||
|   m_settings->setValue ("WaterfallAvg", ui->waterfallAvgSpinBox->value ()); | ||||
|   m_settings->setValue ("Current", ui->widePlot->m_bCurrent); | ||||
|   m_settings->setValue ("Cumulative", ui->widePlot->m_bCumulative); | ||||
|   m_settings->setValue ("LinearAvg", ui->widePlot->m_bLinearAvg); | ||||
|   m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ()); | ||||
|   m_settings->setValue ("StartFreq", ui->widePlot->startFreq ()); | ||||
|   m_settings->setValue ("WaterfallPalette", m_waterfallPalette); | ||||
| @ -278,8 +281,10 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(const QString &arg1) | ||||
| { | ||||
|   ui->widePlot->m_bCurrent=false; | ||||
|   ui->widePlot->m_bCumulative=false; | ||||
|   ui->widePlot->m_bLinearAvg=false; | ||||
|   if(arg1=="Current") ui->widePlot->m_bCurrent=true; | ||||
|   if(arg1=="Cumulative") ui->widePlot->m_bCumulative=true; | ||||
|   if(arg1=="Linear Avg") ui->widePlot->m_bLinearAvg=true; | ||||
| } | ||||
| 
 | ||||
| void WideGraph::on_fMinSpinBox_valueChanged(int n) | ||||
|  | ||||
| @ -70,6 +70,11 @@ | ||||
|            <string>Cumulative</string> | ||||
|           </property> | ||||
|          </item> | ||||
|          <item> | ||||
|           <property name="text"> | ||||
|            <string>Linear Avg</string> | ||||
|           </property> | ||||
|          </item> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item row="1" column="2"> | ||||
|  | ||||
| @ -2,8 +2,8 @@ | ||||
| AppName=wsjtx | ||||
| AppVerName=wsjtx Version 1.3 r3673 | ||||
| AppCopyright=Copyright (C) 2001-2014 by Joe Taylor, K1JT | ||||
| DefaultDirName=c:\wsjtx | ||||
| DefaultGroupName=wsjtx | ||||
| DefaultDirName=c:\wsjtx_w | ||||
| DefaultGroupName=wsjtx_w | ||||
| 
 | ||||
| [Files] | ||||
| Source: "c:\Users\joe\wsjt\wsjtx_install\wsjtx.exe";                     DestDir: "{app}" | ||||
| @ -25,6 +25,6 @@ Source: "c:\Users\joe\wsjt\wsjtx_install\platforms\qwindows.dll";        DestDir | ||||
| Source: "c:\Users\joe\wsjt\wsjtx_install\Palettes\*.pal";                DestDir: "{app}\Palettes"; | ||||
| 
 | ||||
| [Icons] | ||||
| Name: "{group}\wsjtx1.3";        Filename: "{app}\wsjtx.exe";   WorkingDir: {app}; IconFilename: {app}\wsjt.ico | ||||
| Name: "{userdesktop}\wsjtx1.3";  Filename: "{app}\wsjtx.exe";   WorkingDir: {app}; IconFilename: {app}\wsjt.ico | ||||
| Name: "{group}\wsjtx_w";        Filename: "{app}\wsjtx.exe";   WorkingDir: {app}; IconFilename: {app}\wsjt.ico | ||||
| Name: "{userdesktop}\wsjtx_w";  Filename: "{app}\wsjtx.exe";   WorkingDir: {app}; IconFilename: {app}\wsjt.ico | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										51
									
								
								wsjtx.pro
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								wsjtx.pro
									
									
									
									
									
								
							| @ -37,47 +37,27 @@ QMAKE_EXTRA_COMPILERS += gfortran | ||||
| # | ||||
| # Order matters here as the link is in this order so referrers need to be after referred | ||||
| # | ||||
| SOURCES += \ | ||||
| 	logbook/adif.cpp \ | ||||
| 	logbook/countrydat.cpp \ | ||||
| 	logbook/countriesworked.cpp \ | ||||
| 	logbook/logbook.cpp \ | ||||
| 	rigclass.cpp \ | ||||
| 	psk_reporter.cpp \ | ||||
| 	Modulator.cpp \ | ||||
| 	Detector.cpp \ | ||||
| 	logqso.cpp \ | ||||
| 	displaytext.cpp \ | ||||
| 	getfile.cpp \ | ||||
| 	soundout.cpp \ | ||||
| 	soundin.cpp \ | ||||
| 	meterwidget.cpp \ | ||||
| 	signalmeter.cpp \ | ||||
| 	plotter.cpp \ | ||||
| 	widegraph.cpp \ | ||||
| 	devsetup.cpp \ | ||||
| 	about.cpp \ | ||||
| 	mainwindow.cpp \ | ||||
| 	main.cpp \ | ||||
|     decodedtext.cpp | ||||
| SOURCES += logbook/adif.cpp logbook/countrydat.cpp astro.cpp \ | ||||
|   logbook/countriesworked.cpp logbook/logbook.cpp rigclass.cpp \ | ||||
|   psk_reporter.cpp Modulator.cpp Detector.cpp logqso.cpp \ | ||||
|   displaytext.cpp getfile.cpp soundout.cpp soundin.cpp \ | ||||
|   meterwidget.cpp signalmeter.cpp plotter.cpp widegraph.cpp \ | ||||
|   devsetup.cpp about.cpp mainwindow.cpp main.cpp decodedtext.cpp | ||||
| 
 | ||||
| win32 { | ||||
| SOURCES += killbyname.cpp | ||||
| } | ||||
| 
 | ||||
| HEADERS  += mainwindow.h plotter.h soundin.h soundout.h \ | ||||
| HEADERS  += mainwindow.h plotter.h soundin.h soundout.h astro.h \ | ||||
|             about.h devsetup.h widegraph.h getfile.h \ | ||||
|             commons.h sleep.h displaytext.h logqso.h \ | ||||
|             AudioDevice.hpp Detector.hpp Modulator.hpp psk_reporter.h rigclass.h \ | ||||
|     signalmeter.h \ | ||||
|     meterwidget.h \ | ||||
|     logbook/logbook.h \ | ||||
|     logbook/countrydat.h \ | ||||
|     logbook/countriesworked.h \ | ||||
|     logbook/adif.h | ||||
|             AudioDevice.hpp Detector.hpp Modulator.hpp \ | ||||
|             psk_reporter.h rigclass.h signalmeter.h \ | ||||
|             meterwidget.h logbook/logbook.h logbook/countrydat.h \ | ||||
|             logbook/countriesworked.h logbook/adif.h | ||||
| 
 | ||||
| 
 | ||||
| FORMS    += mainwindow.ui about.ui devsetup.ui widegraph.ui \ | ||||
| FORMS    += mainwindow.ui about.ui devsetup.ui widegraph.ui astro.ui \ | ||||
|     logqso.ui | ||||
| 
 | ||||
| RC_FILE = wsjtx.rc | ||||
| @ -89,10 +69,11 @@ LIBS += -lfftw3f `$$F90 -print-file-name=libgfortran.so` | ||||
| } | ||||
| 
 | ||||
| win32 { | ||||
| INCLUDEPATH += ../../hamlib-1.2.15.3/include | ||||
| LIBS += ../../hamlib-1.2.15.3/src/.libs/libhamlib.dll.a | ||||
| #LIBS += ../../hamlib-1.2.15.3/lib/gcc/libhamlib.dll.a | ||||
| INCLUDEPATH += /wsjt-env//hamlib/include | ||||
| LIBS += /wsjt-env/hamlib/lib/gcc/libhamlib.dll.a | ||||
| #LIBS += ../wsjtx/lib/libjt9.a | ||||
| LIBS += ../wsjtx/lib/libjt9.a | ||||
| LIBS += ../wsjtx/lib/libastro.a | ||||
| LIBS += ../wsjtx/libfftw3f_win.a | ||||
| LIBS += ../wsjtx/libpskreporter.a | ||||
| LIBS += ../wsjtx/libHRDInterface001.a | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user