Now displaying 2d spectrum or "PSK spectrum".

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/jtms3@2509 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-07-13 13:37:50 +00:00
parent 945b6ef048
commit f8ce364920
6 changed files with 49 additions and 14 deletions

View File

@ -6,9 +6,12 @@
extern "C" {
extern struct { //This is "common/mscom/..." in Fortran
short int d2[30*48000]; //Raw data
short int d2[30*48000]; //Raw data from soundcard
float s1[215];
float s2[215];
int kin;
int ndiskdat;
int kline;
} mscom_;
}

View File

@ -8,7 +8,7 @@ subroutine specjtms(k,px,pxsmo,spk0,f0)
real x(MAXFFT)
complex cx(MAXFFT),cx2(MAXFFT)
logical first
common/mscom/id(1440000),s1(215),s2(215)
common/mscom/id(1440000),s1(215),s2(215),kin,ndiskdat,kline
data first/.true./
save
@ -80,9 +80,10 @@ subroutine specjtms(k,px,pxsmo,spk0,f0)
endif
enddo
spk0=0.5*db(spk0) - 7.0
kline=k/2048
! write(14,3001) k/2048,spk0,f0,phi0
!3001 format(i8,3f12.3)
call flush(14)
! call flush(14)
return
end subroutine specjtms

View File

@ -420,7 +420,7 @@ void MainWindow::dataSink(int k)
float pxave=10.0*log10(sqave/2048.0) - 23.0;
specjtms_(&k,&px,&pxsmo,&spk0,&f0);
if(spk0 > 3.0) qDebug() << (k-2048.0)/48000.0 << spk0 << f0;
// if(spk0 > 3.0) qDebug() << (k-2048.0)/48000.0 << spk0 << f0;
QString t;
t.sprintf(" Rx noise: %5.1f ",pxave);
lab2->setText(t);

View File

@ -77,8 +77,7 @@ void CPlotter::paintEvent(QPaintEvent *) // paintEvent()
int h = (m_Size.height()-60)/2;
painter.drawPixmap(0,0,m_ScalePixmap);
painter.drawPixmap(0,30,m_WaterfallPixmap);
m_2Dspec=true;
if(m_2Dspec) {
if(true) {
// painter.drawPixmap(0,h+30,m_ScalePixmap);
painter.drawPixmap(0,h+60,m_2DPixmap);
m_paintEventBusy=false;
@ -111,26 +110,54 @@ void CPlotter::draw(float green[], int ig) //draw()
{
int i,j,w,h;
float y;
int y1;
w = m_WaterfallPixmap.width();
h = m_WaterfallPixmap.height();
double gain = pow(10.0,0.05*(m_plotGain+7));
//move current data down one line
//(must do this before attaching a QPainter object)
m_WaterfallPixmap.scroll(0,1,0,0,w,h);
m_ZoomWaterfallPixmap.scroll(0,1,0,0, w, h);
memmove(&m_zwf[32768],m_zwf,32768*(h-1));
//move current data down one line
//(must do this before attaching a QPainter object)
// m_WaterfallPixmap.scroll(0,1,0,0,w,h);
// m_ZoomWaterfallPixmap.scroll(0,1,0,0, w, h);
// memmove(&m_zwf[32768],m_zwf,32768*(h-1));
QPainter painter1(&m_WaterfallPixmap);
QPainter painter2D(&m_2DPixmap);
painter2D.setPen(Qt::green);
QRect tmp(0,0,w,h);
painter2D.fillRect(tmp,Qt::black);
QPoint LineBuf[MAX_SCREENSIZE];
j=0;
for(i=0; i<256; i++) { //Zero the histograms
m_hist1[i]=0;
m_hist2[i]=0;
}
int kline=mscom_.kline;
for(i=0; i<h; i++) {
if(2*i < 215) {
if(m_2Dspec) {
y=10.0*log10(0.5*(mscom_.s2[2*i-1] + mscom_.s2[2*i]));
y1 = 5.0*gain*(y + 13 - m_plotZero);
} else {
y=10.0*log10(0.5*(mscom_.s1[2*i-1] + mscom_.s1[2*i]));
y1 = 5.0*gain*(y + 55 - m_plotZero);
}
} else {
y1=0;
}
if (y1<0) y1=0;
if (y1>254) y1=254;
m_hist1[y1]++;
painter1.setPen(m_ColorTbl[y1]);
painter1.drawPoint(kline,h-i);
}
painter2D.setPen(Qt::green);
j=0;
for(i=0; i<ig; i++) {
y = green[i];
painter1.drawPoint(i,0);

View File

@ -8,7 +8,11 @@ extern "C" {
#include <portaudio.h>
extern struct {
short int d2[30*48000]; //This is "common/mscom/..." in fortran
float s1[215];
float s2[215];
int kin;
int ndiskdat;
int kline;
} mscom_;
}

View File

@ -283,7 +283,7 @@
<item>
<widget class="QCheckBox" name="cbSpec2d">
<property name="text">
<string>2D Spectrum</string>
<string>PSK Spectrum</string>
</property>
</widget>
</item>