A number of minor cleanup efforts:

1. F1 accesses User's Guide for v1.2.
2. Larger font for "S" on the ui->readFreq button.
3. Finish removing the no-longer-used #ifdef's relaied to psk_reporter calls.
4. Set m_ntx=6 (Tx message #6) at program startup.
5. Remove obsolete file soundin_1.cpp.
6. Update credits displayed in the "About" window and in User's Guide.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3527 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-08-06 17:22:33 +00:00
parent d35696155c
commit 37a1f23491
6 changed files with 37 additions and 340 deletions

Binary file not shown.

View File

@ -13,8 +13,8 @@ CAboutDlg::CAboutDlg(QWidget *parent, QString Revision) :
m_Str += "Amateur Radio communication. <br><br>"; m_Str += "Amateur Radio communication. <br><br>";
m_Str += "Copyright 2001-2013 by Joe Taylor, K1JT -- with grateful <br>"; m_Str += "Copyright 2001-2013 by Joe Taylor, K1JT -- with grateful <br>";
m_Str += "acknowledgment for contributions from AC6SL, AE4JY, <br>"; m_Str += "acknowledgment for contributions from AC6SL, AE4JY, <br>";
m_Str += "G4KLA, G4WJS, K3WYC, KA6MAL, KA9Q, PY2SDR, VK3ACF, <br>"; m_Str += "DJ0OT, G4KLA, G4WJS, K3WYC, KA6MAL, KA9Q, KK1D, <br>";
m_Str += "VK4BDJ, and W4TV.<br>"; m_Str += "PY2SDR, VK3ACF, VK4BDJ, and W4TV.<br>";
ui->labelTxt->setText(m_Str); ui->labelTxt->setText(m_Str);
} }

View File

@ -138,6 +138,11 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QString *thekey, \
font.setWeight(fontWeight2); font.setWeight(fontWeight2);
ui->decodedTextBrowser->setFont(font); ui->decodedTextBrowser->setFont(font);
ui->decodedTextBrowser2->setFont(font); ui->decodedTextBrowser2->setFont(font);
font=ui->readFreq->font();
font.setFamily("helvetica");
font.setPointSize(9);
font.setWeight(75);
ui->readFreq->setFont(font);
QTimer *guiTimer = new QTimer(this); QTimer *guiTimer = new QTimer(this);
connect(guiTimer, SIGNAL(timeout()), this, SLOT(guiUpdate())); connect(guiTimer, SIGNAL(timeout()), this, SLOT(guiUpdate()));
@ -293,6 +298,8 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QString *thekey, \
border-color: black; min-width: 5em; padding: 3px;}"; border-color: black; min-width: 5em; padding: 3px;}";
genStdMsgs(m_rpt); 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!="JT65" and m_mode!="JT9+JT65") m_mode="JT9";
on_actionWide_Waterfall_triggered(); //### on_actionWide_Waterfall_triggered(); //###
g_pWideGraph->setRxFreq(m_rxFreq); g_pWideGraph->setRxFreq(m_rxFreq);
@ -350,25 +357,8 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QString *thekey, \
ui->decodedTextLabel->setText(t); ui->decodedTextLabel->setText(t);
ui->decodedTextLabel2->setText(t); ui->decodedTextLabel2->setText(t);
/*
#ifdef WIN32
if(m_pskReporter) {
rc=ReporterInitialize(NULL,NULL);
if(rc==0) {
m_pskReporterInit=true;
} else {
m_pskReporterInit=false;
rc=ReporterGetInformation(buffer,256);
msgBox(QString::fromStdWString(buffer));
}
}
#endif
#ifdef UNIX
*/
psk_Reporter = new PSK_Reporter(this); psk_Reporter = new PSK_Reporter(this);
psk_Reporter->setLocalStation(m_myCall,m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) ); psk_Reporter->setLocalStation(m_myCall,m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
//#endif
m_logBook.init(); m_logBook.init();
@ -814,33 +804,11 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
ui->bandComboBox->clear(); ui->bandComboBox->clear();
ui->bandComboBox->addItems(dlg.m_bandDescription); ui->bandComboBox->addItems(dlg.m_bandDescription);
ui->bandComboBox->setCurrentIndex(m_band); ui->bandComboBox->setCurrentIndex(m_band);
/*
#ifdef WIN32
if(dlg.m_pskReporter!=m_pskReporter) {
if(dlg.m_pskReporter) {
int rc=ReporterInitialize(NULL,NULL);
if(rc==0) {
m_pskReporterInit=true;
} else {
m_pskReporterInit=false;
rc=ReporterGetInformation(buffer,256);
msgBox(QString::fromStdWString(buffer));
}
} else {
rc=ReporterUninitialize();
m_pskReporterInit=false;
}
}
#endif
*/
m_pskReporter=dlg.m_pskReporter; m_pskReporter=dlg.m_pskReporter;
//#ifdef UNIX
if(m_pskReporter) { if(m_pskReporter) {
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) ); psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
} }
//#endif
m_After73=dlg.m_After73; m_After73=dlg.m_After73;
@ -862,6 +830,8 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
if(dlg.m_bSplit!=m_bSplit or dlg.m_bXIT!=m_bXIT) { if(dlg.m_bSplit!=m_bSplit or dlg.m_bXIT!=m_bXIT) {
m_bSplit=dlg.m_bSplit; m_bSplit=dlg.m_bSplit;
if(m_bSplit) ui->readFreq->setText("S");
if(!m_bSplit) ui->readFreq->setText("");
m_bXIT=dlg.m_bXIT; m_bXIT=dlg.m_bXIT;
if(m_bSplit or m_bXIT) setXIT(m_txFreq); if(m_bSplit or m_bXIT) setXIT(m_txFreq);
if(m_bRigOpen and !m_bSplit) { if(m_bRigOpen and !m_bSplit) {
@ -1154,7 +1124,7 @@ void MainWindow::msgBox(QString t) //msgBox
void MainWindow::on_actionOnline_Users_Guide_triggered() //Display manual void MainWindow::on_actionOnline_Users_Guide_triggered() //Display manual
{ {
QDesktopServices::openUrl(QUrl( QDesktopServices::openUrl(QUrl(
"http://www.physics.princeton.edu/pulsar/K1JT/WSJT-X_Users_Guide_v1.1.1.pdf", "http://www.physics.princeton.edu/pulsar/K1JT/WSJT-X_Users_Guide_v1.2.pdf",
QUrl::TolerantMode)); QUrl::TolerantMode));
} }
@ -1595,30 +1565,6 @@ void MainWindow::readFromStdout() //readFromStdout
wchar_t tremote[256]; wchar_t tremote[256];
remote.toWCharArray(tremote); remote.toWCharArray(tremote);
/*
#ifdef WIN32
if(m_pskReporterInit and b and !m_diskData and okToPost) {
QString local="station_callsign#" + m_myCall + "#" +
"my_gridsquare#" + m_myGrid + "#";
if (m_antDescription[m_band]!="")
local += "my_antenna#" + m_antDescription[m_band] + "#";
local += "programid#WSJT-X#programversion#" + rev.mid(6,4) + "##";
wchar_t tlocal[256];
local.toWCharArray(tlocal);
int flags=REPORTER_SOURCE_AUTOMATIC;
rc=ReporterSeenCallsign(tremote,tlocal,flags);
if(rc!=0) {
ReporterGetInformation(buffer,256);
}
rc=ReporterTickle();
if(rc!=0) {
rc=ReporterGetInformation(buffer,256);
}
}
#else
*/
if(m_pskReporter and b and !m_diskData and okToPost) { if(m_pskReporter and b and !m_diskData and okToPost) {
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) ); psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
QString freq = QString::number(nfreq); QString freq = QString::number(nfreq);
@ -1628,7 +1574,6 @@ void MainWindow::readFromStdout() //readFromStdout
QString::number(QDateTime::currentDateTime().toTime_t())); QString::number(QDateTime::currentDateTime().toTime_t()));
} }
} }
//#endif
} }
} }
} }
@ -2822,9 +2767,7 @@ void MainWindow::on_bandComboBox_activated(int index)
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm") out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
<< " " << m_dialFreq << " MHz " << m_mode << endl; << " " << m_dialFreq << " MHz " << m_mode << endl;
f2.close(); f2.close();
#ifdef UNIX
psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) ); psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) );
#endif
} }
void MainWindow::on_actionPrompt_to_log_QSO_triggered(bool checked) void MainWindow::on_actionPrompt_to_log_QSO_triggered(bool checked)
@ -3045,10 +2988,6 @@ void MainWindow::rigOpen()
border-width: 0px; border-radius: 5px;}"); border-width: 0px; border-radius: 5px;}");
} }
QFont font=ui->readFreq->font();
font.setPointSize(9);
font.setWeight(75);
ui->readFreq->setFont(font);
if(m_bSplit) ui->readFreq->setText("S"); if(m_bSplit) ui->readFreq->setText("S");
if(!m_bSplit) ui->readFreq->setText(""); if(!m_bSplit) ui->readFreq->setText("");
} else { } else {

View File

@ -1214,7 +1214,16 @@ p, li { white-space: pre-wrap; }
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -1345,7 +1354,7 @@ p, li { white-space: pre-wrap; }
<string/> <string/>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
<attribute name="buttonGroup"> <attribute name="buttonGroup">
<string notr="true">buttonGroup</string> <string notr="true">buttonGroup</string>
@ -1687,6 +1696,9 @@ p, li { white-space: pre-wrap; }
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup"> <attribute name="buttonGroup">
<string notr="true">buttonGroup</string> <string notr="true">buttonGroup</string>
</attribute> </attribute>
@ -1757,7 +1769,16 @@ p, li { white-space: pre-wrap; }
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -2202,7 +2223,7 @@ p, li { white-space: pre-wrap; }
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>760</width> <width>760</width>
<height>22</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">

View File

@ -1,210 +0,0 @@
#include "soundin.h"
#include <stdexcept>
#define FRAMES_PER_BUFFER 1024
//#define NSMAX 1365
#define NSMAX 6827
#define NTMAX 120
extern "C" {
#include <portaudio.h>
extern struct {
float ss[184*NSMAX]; //This is "common/jt9com/..." in fortran
float savg[NSMAX];
// float c0[2*NTMAX*1500];
short int d2[NTMAX*12000];
int nutc; //UTC as integer, HHMM
int ndiskdat; //1 ==> data read from *.wav file
int ntrperiod; //TR period (seconds)
int mousefqso; //User-selected QSO freq (kHz)
int newdat; //1 ==> new data, must do long FFT
int npts8; //npts in c0() array
int nfa; //Low decode limit (Hz)
int nfb; //High decode limit (Hz)
int ntol; //+/- decoding range around fQSO (Hz)
int kin;
int nzhsym;
int nsave;
int nagain;
int ndepth;
int ntxmode;
int nmode;
char datetime[20];
} jt9com_;
}
QString reportAudioError(QAudio::Error audioError)
{
switch (audioError) {
case QAudio::NoError: Q_ASSERT(false);
case QAudio::OpenError: return QObject::tr(
"An error opening the audio device has occurred.");
case QAudio::IOError: return QObject::tr(
"An error occurred during read/write of audio device.");
case QAudio::UnderrunError: return QObject::tr(
"Audio data not being fed to the audio device fast enough.");
case QAudio::FatalError: return QObject::tr(
"Non-recoverable error, audio device not usable at this time.");
}
Q_ASSERT(false);
return "";
}
typedef struct
{
int kin; //Parameters sent to/from the portaudio callback function
int ncall;
bool bzero;
bool monitoring;
} paUserData;
void SoundInThread::run() //SoundInThread::run()
{
quitExecution = false;
//---------------------------------------------------- Soundcard Setup
quitExecutionMutex.lock();
quitExecution = false;
quitExecutionMutex.unlock();
//### Temporary: hardwired device selection
QAudioDeviceInfo DeviceInfo;
QList<QAudioDeviceInfo> m_InDevices;
QAudioDeviceInfo m_InDeviceInfo;
m_InDevices = DeviceInfo.availableDevices(QAudio::AudioInput);
inputDevice = m_InDevices.at(0);
//###
const char* pcmCodec = "audio/pcm";
QAudioFormat audioFormat = inputDevice.preferredFormat();
audioFormat.setChannelCount(1);
audioFormat.setCodec(pcmCodec);
audioFormat.setSampleRate(12000);
audioFormat.setSampleType(QAudioFormat::SignedInt);
audioFormat.setSampleSize(16);
if (!audioFormat.isValid()) {
emit error(tr("Requested audio format is not available."));
return;
}
QAudioInput audioInput(inputDevice, audioFormat);
if (audioInput.error() != QAudio::NoError) {
emit error(reportAudioError(audioInput.error()));
return;
}
QIODevice* stream = audioInput.start();
bool qe = quitExecution;
static int ntr0=99;
int k=0;
int nsec;
int ntr;
int nBusy=0;
int nstep0=0;
int nsps0=0;
qint16 buf0[4096];
//---------------------------------------------- Soundcard input loop
while (!qe) {
quitExecutionMutex.lock();
qe = quitExecution;
quitExecutionMutex.unlock();
if (qe) break;
// Error checking...
if (audioInput.error() != QAudio::NoError) {
emit error(reportAudioError(audioInput.error()));
return;
}
// udata.monitoring=m_monitoring;
qint64 ms = QDateTime::currentMSecsSinceEpoch();
ms=ms % 86400000;
nsec = ms/1000; // Time according to this computer
ntr = nsec % m_TRperiod;
// Reset buffer pointer and symbol number at start of minute
if(ntr < ntr0 or !m_monitoring or m_nsps!=nsps0) {
nstep0=0;
nsps0=m_nsps;
// udata.bzero=true;
k=0;
}
// k=udata.kin;
// How many new samples have been acquired?
const qint32 bytesReady = audioInput.bytesReady();
Q_ASSERT(bytesReady >= 0);
Q_ASSERT(bytesReady % 2 == 0);
if (bytesReady == 0) {
msleep(50);
continue;
}
// Get the new samples
qint32 bytesRead;
bytesRead = stream->read((char*)buf0, bytesReady);
Q_ASSERT(bytesRead <= bytesReady);
if (bytesRead < 0) {
emit error(tr("audio stream QIODevice::read returned -1."));
return;
}
Q_ASSERT(bytesRead % 2 == 0);
// memcpy(jt9com_.d2[k],buf0,bytesRead);
// k+=bytesRead/2;
for(int i=0; i<bytesRead/2; i++) {
jt9com_.d2[k++]=buf0[i];
}
if(m_monitoring) {
int kstep=m_nsps/2;
m_step=(k-1)/kstep;
if(m_step != nstep0) {
if(m_dataSinkBusy) {
nBusy++;
} else {
emit readyForFFT(k-1); //Signal to compute new FFTs
}
nstep0=m_step;
}
}
msleep(100);
ntr0=ntr;
}
// Pa_StopStream(inStream);
// Pa_CloseStream(inStream);
}
void SoundInThread::setInputDevice(int n) //setInputDevice()
{
if (isRunning()) return;
this->m_nDevIn=n;
}
void SoundInThread::quit() //quit()
{
quitExecution = true;
}
void SoundInThread::setMonitoring(bool b) //setMonitoring()
{
m_monitoring = b;
}
void SoundInThread::setPeriod(int ntrperiod, int nsps)
{
m_TRperiod=ntrperiod;
m_nsps=nsps;
}
int SoundInThread::mstep()
{
return m_step;
}

View File

@ -1,53 +0,0 @@
#ifndef SOUNDIN_H
#define SOUNDIN_H
#include <QtCore>
#include <QDebug>
#include <QAudioDeviceInfo>
#include <QAudioInput>
#include <valarray>
// Thread gets audio data from soundcard and signals when a buffer of
// specified size is available.
class SoundInThread : public QThread
{
Q_OBJECT
bool quitExecution; // if true, thread exits gracefully
QMutex quitExecutionMutex; // protects the quitExecution variable
QAudioDeviceInfo inputDevice; // audioinput device name
protected:
virtual void run();
public:
bool m_dataSinkBusy;
SoundInThread():
quitExecution(false),
m_dataSinkBusy(false)
{
}
void setInputDevice(qint32 n);
void setMonitoring(bool b);
void setPeriod(int ntrperiod, int nsps);
int mstep();
signals:
void readyForFFT(int k);
void error(const QString& message);
void status(const QString& message);
public slots:
void quit();
private:
qint32 m_step;
qint32 m_nDevIn;
qint32 m_TRperiod;
qint32 m_TRperiod0;
qint32 m_nsps;
bool m_monitoring;
};
#endif // SOUNDIN_H