1. Finish implementing a monochrome waterfall palette.

2. Update credits displayed in the "About" window.
3. Working on audio input via the QAudio library.  Not yet finished!


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3513 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-07-31 15:46:28 +00:00
parent a8491db120
commit 871f486848
5 changed files with 45 additions and 40 deletions

View File

@ -13,7 +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, and VK4BDJ.<br>"; m_Str += "G4KLA, G4WJS, K3WYC, KA6MAL, KA9Q, PY2SDR, VK3ACF, <br>";
m_Str += "and VK4BDJ.<br>";
ui->labelTxt->setText(m_Str); ui->labelTxt->setText(m_Str);
} }

View File

@ -1,7 +1,6 @@
#ifndef COMMONS_H #ifndef COMMONS_H
#define COMMONS_H #define COMMONS_H
//#define NSMAX 1365
#define NSMAX 6827 #define NSMAX 6827
#define NTMAX 120 #define NTMAX 120

View File

@ -488,29 +488,28 @@ void CPlotter::setPalette(QString palette) //setPalette()
return; return;
} }
QFile f; FILE* fp=NULL;
if(palette=="Blue") f.setFileName("blue.dat"); if(palette=="Blue") fp=fopen("blue.dat","r");
if(palette=="AFMHot") f.setFileName("afmhot.dat"); if(palette=="AFMHot") fp=fopen("afmhot.dat","r");
if(palette=="Gray1") f.setFileName("gray1.dat"); if(palette=="Gray1") fp=fopen("gray1.dat","r");
if(f.open(QIODevice::ReadOnly)) { if(fp==NULL) {
QTextStream in(&f);
int n,r,g,b;
float xr,xg,xb;
for(int i=0; i<256; i++) {
in >> n >> xr >> xg >> xb;
r=255.0*xr + 0.5;
g=255.0*xg + 0.5;
b=255.0*xb + 0.5;
m_ColorTbl[i].setRgb(r,g,b);
}
f.close();
} else {
QMessageBox msgBox0; QMessageBox msgBox0;
QString t="Error: Cannot find requested palette file."; QString t="Error: Cannot find requested palette file.";
msgBox0.setText(t); msgBox0.setText(t);
msgBox0.exec(); msgBox0.exec();
return; return;
} }
int n,r,g,b;
float xr,xg,xb;
for(int i=0; i<256; i++) {
int nn=fscanf(fp,"%d%f%f%f",&n,&xr,&xg,&xb);
r=255.0*xr + 0.5;
g=255.0*xg + 0.5;
b=255.0*xb + 0.5;
m_ColorTbl[i].setRgb(r,g,b);
if(nn==-999999) i++; //Silence compiler warning
}
} }
double CPlotter::fGreen() double CPlotter::fGreen()

View File

@ -3,7 +3,6 @@
#include <stdexcept> #include <stdexcept>
#define FRAMES_PER_BUFFER 1024 #define FRAMES_PER_BUFFER 1024
//#define NSMAX 1365
#define NSMAX 6827 #define NSMAX 6827
#define NTMAX 120 #define NTMAX 120
@ -191,7 +190,6 @@ void SoundInput::setMonitoring(bool b)
#include <stdexcept> #include <stdexcept>
#define FRAMES_PER_BUFFER 1024 #define FRAMES_PER_BUFFER 1024
//#define NSMAX 1365
#define NSMAX 6827 #define NSMAX 6827
#define NTMAX 120 #define NTMAX 120
@ -216,7 +214,7 @@ extern struct {
int nsave; int nsave;
int nagain; int nagain;
int ndepth; int ndepth;
int ntxmode; int ntxmode;
int nmode; int nmode;
char datetime[20]; char datetime[20];
} jt9com_; } jt9com_;
@ -246,7 +244,8 @@ SoundInput::SoundInput()
m_monitoring(false), m_monitoring(false),
m_intervalTimer(this) m_intervalTimer(this)
{ {
connect(&m_intervalTimer, SIGNAL(timeout()), this,SLOT(intervalNotify())); // qDebug() << "A";
connect(&m_intervalTimer, SIGNAL(timeout()), this,SLOT(intervalNotify()));
} }
void SoundInput::start(qint32 device) void SoundInput::start(qint32 device)
@ -266,6 +265,7 @@ void SoundInput::start(qint32 device)
m_InDevices = DeviceInfo.availableDevices(QAudio::AudioInput); m_InDevices = DeviceInfo.availableDevices(QAudio::AudioInput);
inputDevice = m_InDevices.at(0); inputDevice = m_InDevices.at(0);
//### //###
// qDebug() << "B" << m_InDevices.length() << inputDevice.deviceName();
const char* pcmCodec = "audio/pcm"; const char* pcmCodec = "audio/pcm";
QAudioFormat audioFormat = inputDevice.preferredFormat(); QAudioFormat audioFormat = inputDevice.preferredFormat();
@ -275,19 +275,22 @@ void SoundInput::start(qint32 device)
audioFormat.setSampleType(QAudioFormat::SignedInt); audioFormat.setSampleType(QAudioFormat::SignedInt);
audioFormat.setSampleSize(16); audioFormat.setSampleSize(16);
// qDebug() << "C" << audioFormat << audioFormat.isValid();
if (!audioFormat.isValid()) { if (!audioFormat.isValid()) {
emit error(tr("Requested audio format is not available.")); emit error(tr("Requested audio format is not available."));
return; return;
} }
audioInput = new QAudioInput(inputDevice, audioFormat); audioInput = new QAudioInput(inputDevice, audioFormat);
// audioInput2=audioInput; // qDebug() << "D" << audioInput->error() << QAudio::NoError;
if (audioInput->error() != QAudio::NoError) { if (audioInput->error() != QAudio::NoError) {
emit error(reportAudioError(audioInput->error())); emit error(reportAudioError(audioInput->error()));
return; return;
} }
stream = audioInput->start(); stream = audioInput->start();
// qDebug() << "E" << stream->errorString();
m_ntr0 = 99; // initial value higher than any expected m_ntr0 = 99; // initial value higher than any expected
m_nBusy = 0; m_nBusy = 0;
@ -305,7 +308,8 @@ void SoundInput::intervalNotify()
int ntr = nsec % m_TRperiod; int ntr = nsec % m_TRperiod;
static int k=0; static int k=0;
// Reset buffer pointer and symbol number at start of minute // qDebug() << "a" << ms << nsec;
// Reset buffer pointer and symbol number at start of minute
if(ntr < m_ntr0 or !m_monitoring or m_nsps!=m_nsps0) { if(ntr < m_ntr0 or !m_monitoring or m_nsps!=m_nsps0) {
m_nstep0=0; m_nstep0=0;
m_nsps0=m_nsps; m_nsps0=m_nsps;
@ -314,30 +318,26 @@ void SoundInput::intervalNotify()
} }
// int k=m_callbackData.kin; // int k=m_callbackData.kin;
// How many new samples have been acquired? // How many new samples are available?
const qint32 bytesReady = audioInput->bytesReady(); const qint32 bytesReady = audioInput->bytesReady();
Q_ASSERT(bytesReady >= 0); // qDebug() << "b" << bytesReady;
Q_ASSERT(bytesReady >= 0);
Q_ASSERT(bytesReady % 2 == 0); Q_ASSERT(bytesReady % 2 == 0);
if (bytesReady == 0) { if (bytesReady == 0) {
return; return;
} }
qint32 bytesRead; qint32 bytesRead;
qint16 buf0[4096]; bytesRead = stream->read((char*)&jt9com_.d2[k], bytesReady); // Get the new samples
bytesRead = stream->read((char*)buf0, bytesReady); // Get the new samples k += bytesRead/2;
Q_ASSERT(bytesRead <= bytesReady); // qDebug() << "c" << bytesReady << bytesRead;
Q_ASSERT(bytesRead <= bytesReady);
if (bytesRead < 0) { if (bytesRead < 0) {
emit error(tr("audio stream QIODevice::read returned -1.")); emit error(tr("audio stream QIODevice::read returned -1."));
return; return;
} }
Q_ASSERT(bytesRead % 2 == 0); 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) { if(m_monitoring) {
int kstep=m_nsps/2; int kstep=m_nsps/2;
m_step=(k-1)/kstep; m_step=(k-1)/kstep;
@ -362,7 +362,13 @@ SoundInput::~SoundInput()
} }
*/ */
} }
/*
// memcpy(jt9com_.d2[k],buf0,bytesRead);
// k+=bytesRead/2;
for(int i=0; i<bytesRead/2; i++) {
jt9com_.d2[k++]=buf0[i];
}
*/
void SoundInput::stop() void SoundInput::stop()
{ {
m_intervalTimer.stop(); m_intervalTimer.stop();

View File

@ -16,7 +16,7 @@ VERSION = 1.1
TEMPLATE = app TEMPLATE = app
#DEFINES = QT4 #DEFINES = QT4
DEFINES = QT5 DEFINES = QT5
#DEFINES += QAUDIO_INPUT DEFINES += QAUDIO_INPUT
win32 { win32 {
DEFINES += WIN32 DEFINES += WIN32