1
0
mirror of https://github.com/JvanKatwijk/qt-dab.git synced 2025-10-06 00:02:40 +02:00

adding V6

This commit is contained in:
JvanKatwijk
2023-09-20 21:17:22 +02:00
parent 775dc3d941
commit 457bdb7b0c
233 changed files with 43266 additions and 4541 deletions

18
.gitignore vendored
View File

@@ -1,21 +1,21 @@
qt-dab-s4/.qmake.stash
qt-dab-s5/.qmake.stash
qt-dab-s4/linux-bin
qt-dab-s4/build
qt-dab-s4/Makefile
qt-dab-s4/Output
qt-dab-s5/linux-bin
qt-dab-s5/.qmake.stash
qt-dab-s5/build
qt-dab-s5/Makefile
qt-dab-s5/Output
dab-mini/linux-bin
dab-mini/Output
dab-mini/build
dab-mini/Makefile
dab-2/linux-bin
dab-2/Output
dab-2/build
dab-2/Makefile
obsolete/
qt-dab-s6/linux-bin
qt-dab-s6/.qmake.stash
qt-dab-s6/build
qt-dab-s6/Makefile
qt-dab-s6/Output

BIN
DABplus_Logo_Colour_sRGB.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

View File

@@ -1,25 +1,20 @@
# Qt-DAB-5 [![Build Status](https://travis-ci.com/JvanKatwijk/qt-dab.svg?branch=master)](https://travis-ci.com/JvanKatwijk/qt-dab)
# Qt-DAB-6 [![Build Status](https://travis-ci.com/JvanKatwijk/qt-dab.svg?branch=master)](https://travis-ci.com/JvanKatwijk/qt-dab)
**Qt-DAB-4** and **Qt-DAB-5** is software for Linux, Windows, MacOS and Raspberry Pi for listening to terrestrial **Digital Audio Broadcasting (DAB and DAB+)**.
**Qt-DAB-4**, **Qt-DAB-5** and **Qt-DAB-6** is software for Linux, Windows, MacOS and Raspberry Pi for listening to terrestrial **Digital Audio Broadcasting (DAB and DAB+)**.
-------------------------------------------------------------------
New in 4.7 and 5.4
![6.0](/qt-dab-logo.png?raw=true)
![6.0](/DABplus_Logo_Colour_sRGB.png?raw=true)
-------------------------------------------------------------------
Apart from fixing a few minor errors and restructuring some parts
of the software, the main change in these versions - compared to previous
ones - is handling the "history".
In previous versions, each service (name) encountered was added
to a history list, in this version the history list is replaced
by a "scan list". The scan list is filled when scanning (single scan).
The configuration widget has a selector for choosing that on a
new scan the list is cleared (the default).
New - compared to the history list - is that a mouse click right
on an element in the scan list, the service name is added to the
presets. Of course, a mouse click left will select the service.
Next to the versions 4.7 and 5.4 there is a third - slightly experimental -
version, with the labeling 6.0.
The difference between 5.X and 6.0 is the formation
of a *single* widget for the various displays.
![6.0](/qt-dab-6.0.png?raw=true)
Table of Contents
=================================================================

Binary file not shown.

View File

@@ -384,6 +384,7 @@ std::vector<parameter *> theParameters;
void etiGenerator::process_subCh (int nr, parameter *p,
protection *prot,
uint8_t *desc) {
(void)nr;
std::unique_ptr<uint8_t[]> outVector { new uint8_t[24 * p->bitRate] };
if (!outVector) {
std::cerr << "process_subCh - alloc fail";
@@ -411,11 +412,13 @@ void etiGenerator::process_subCh (int nr, parameter *p,
}
void etiGenerator::postProcess (uint8_t *theVector, int32_t offset){
(void)theVector;
(void)offset;
}
bool etiGenerator::start_etiGenerator (const QString &f) {
reset ();
etiFile = fopen (f. toUtf8 (). data (), "w");
etiFile = fopen (f. toUtf8 (). data (), "wb");
return etiFile != nullptr;
}

View File

@@ -30,13 +30,17 @@
fftHandler::fftHandler (int size, bool dir) {
this -> size = size;
this -> dir = dir;
#ifdef __KISS_FFT__
fftVector_in = new kiss_fft_cpx [size];
fftVector_out = new kiss_fft_cpx [size];
plan = kiss_fft_alloc (size, dir, nullptr, nullptr);
#elif __FFTW3__
fftVector = (std::complex<float> *)
fftwf_malloc (sizeof (std::complex<float>)* size);
#ifdef USE_DOUBLE
fftVector = (Complex *)
fftw_malloc (sizeof (Complex) * size);
plan = fftw_plan_dft_1d (size,
reinterpret_cast <fftw_complex *>(fftVector),
reinterpret_cast <fftw_complex *>(fftVector),
FFTW_FORWARD, FFTW_ESTIMATE);
#else
fftVector = (Complex *)
fftwf_malloc (sizeof (Complex) * size);
plan = fftwf_plan_dft_1d (size,
reinterpret_cast <fftwf_complex *>(fftVector),
reinterpret_cast <fftwf_complex *>(fftVector),
@@ -45,64 +49,44 @@
}
fftHandler::~fftHandler () {
#ifdef __KISS_FFT__
delete fftVector_in;
delete fftVector_out;
#elif __FFTW3__
#ifdef USE_DOUBLE
fftw_destroy_plan (plan);
fftw_free (fftVector);
#else
fftwf_destroy_plan (plan);
fftwf_free (fftVector);
#endif
}
void fftHandler::fft (std::vector<std::complex<float>> &v) {
#ifdef __KISS_FFT__
for (int i = 0; i < size; i ++) {
fftVector_in [i]. r = real (v [i]);
fftVector_in [i]. i = imag (v [i]);
}
kiss_fft (plan, fftVector_in, fftVector_out);
for (int i = 0; i < size; i ++) {
v [i] = std::complex<float> (fftVector_out [i]. r,
fftVector_out [i]. i);
}
#elif __FFTW3__
void fftHandler::fft (std::vector<Complex> &v) {
if (dir)
for (int i = 0; i < size; i ++)
fftVector [i] = conj (v [i]);
else
for (int i = 0; i < size; i ++)
fftVector [i] = v [i];
#ifdef USE_DOUBLE
fftw_execute (plan);
#else
fftwf_execute (plan);
#endif
if (dir)
for (int i = 0; i < size; i ++)
v [i] = conj (fftVector [i]);
else
for (int i = 0; i < size; i ++)
v [i] = fftVector [i];
#else
Fft_transform (v. data (), size, dir);
#endif
}
void fftHandler::fft (std::complex<float> *v) {
#ifdef __KISS_FFT__
for (int i = 0; i < size; i ++) {
fftVector_in [i]. r = real (v [i]);
fftVector_in [i]. i = imag (v [i]);
}
kiss_fft (plan, fftVector_in, fftVector_out);
for (int i = 0; i < size; i ++) {
v [i] = std::complex<float> (fftVector_out [i]. r,
fftVector_out [i]. i);
}
#elif __FFTW3__
void fftHandler::fft (Complex *v) {
for (int i = 0; i < size; i ++)
fftVector [i] = v [i];
#ifdef USE_DOUBLE
fftw_execute (plan);
#else
fftwf_execute (plan);
#endif
for (int i = 0; i < size; i ++)
v [i] = fftVector [i];
#else
Fft_transform (v, size, dir);
#endif
}

View File

@@ -21,32 +21,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __FFT_HANDLER__
#define __FFT_HANDLER__
#pragma once
#include <complex>
#include <vector>
#include "kiss_fft.h"
#ifdef __FFTW3__
#include <fftw3.h>
#endif
#include "dab-constants.h"
class fftHandler {
public:
fftHandler (int size, bool);
~fftHandler ();
void fft (std::vector<std::complex<float>> &);
void fft (std::complex<float> *);
void fft (std::vector<Complex> &);
void fft (Complex *);
private:
int size;
bool dir;
#ifdef __KISS_FFT__
kiss_fft_cfg plan;
kiss_fft_cpx *fftVector_in;
kiss_fft_cpx *fftVector_out;
#elif __FFTW3__
#ifdef USE_DOUBLR
fftw_plan plan;
#else
fftwf_plan plan;
std::complex<float> *fftVector;
#endif
Complex *fftVector;
};
#endif

View File

@@ -5,6 +5,7 @@
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -20,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __FAAD_DECODER__
#define __FAAD_DECODER__
#pragma once
#include <QObject>
#include "neaacdec.h"
#include "ringbuffer.h"
@@ -64,5 +65,3 @@ bool initialize (stream_parms *);
signals:
void newAudio (int, int);
};
#endif

View File

@@ -23,8 +23,7 @@
* Use the fdk-aac library.
*/
#ifdef __WITH_FDK_AAC__
#ifndef __FDK_AAC__
#define __FDK_AAC__
#pragma once
#include <QObject>
#include <stdint.h>
@@ -69,4 +68,3 @@ signals:
};
#endif
#endif

View File

@@ -26,8 +26,7 @@
// for use in the sdr-j DAB/DAB+ receiver
// all rights remain where they belong
#ifndef __MP2PROCESSOR__
#define __MP2PROCESSOR__
#pragma once
#include <utility>
#include <cstdio>
@@ -98,5 +97,4 @@ signals:
void newAudio (int, int);
void isStereo (bool);
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __MP4PROCESSOR__
#define __MP4PROCESSOR__
#pragma once
/*
* Handling superframes for DAB+ and delivering
* frames into the ffmpeg or faad decoding library
@@ -105,6 +104,3 @@ signals:
void show_emptyLabel (const QString &);
};
#endif

View File

@@ -28,8 +28,7 @@
** $Id: neaacdec.h,v 1.13 2009/01/26 23:51:15 menno Exp $
**/
#ifndef __NEAACDEC_H__
#define __NEAACDEC_H__
#pragma once
#ifdef __cplusplus
extern "C" {
@@ -262,4 +261,3 @@ char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
}
#endif /* __cplusplus */
#endif

View File

@@ -5,6 +5,7 @@
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -19,8 +20,8 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __BACKEND_DECONVOLVER__
#define __BACKEND_DECONVOLVER__
#pragma once
#include "dab-constants.h"
class protection;
@@ -35,5 +36,3 @@ private:
protection * protectionHandler;
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __BACKEND_DRIVER__
#define __BACKEND_DRIVER__
#pragma once
#include <vector>
#include <utility>
@@ -45,5 +44,3 @@ private:
frameProcessor * theProcessor;
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __BACKEND__
#define __BACKEND__
#pragma once
#include <QSemaphore>
#include <vector>
@@ -88,5 +87,3 @@ void run();
std::vector<uint8_t> disperseVector;
};
#endif

View File

@@ -1,29 +1,29 @@
#
/*
* Copyright (C) 2013
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
* Lazy Chair Computing
*
* This file is part of the SDR-J (JSDR).
* SDR-J is free software; you can redistribute it and/or modify
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* This charset handling was kindly added by Przemyslaw Wegrzyn
* all rights acknowledged
*/
#ifndef __CHARSETS_H
#define __CHARSETS_H
#pragma once
#include <QString>
@@ -46,5 +46,4 @@ typedef enum {
*/
QString toQStringUsingCharset(const char* buffer, CharacterSet charset, int size = -1);
#endif // CHARSETS_H

View File

@@ -1,33 +1,29 @@
#
/*
* Copyright (C) 2010, 2011, 2012
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
* Lazy Chair Computing
*
* This file is part of the SDR-J.
* Many of the ideas as implemented in SDR-J are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
* This file is part of Qt-DAB
*
* SDR-J is free software; you can redistribute it and/or modify
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// special instantiation for pairs of int16_t
// to be used for the faad decoder
#ifndef __CONVERTER_2
#define __CONVERTER_2
#pragma once
//
// Very straightforward fractional resampler
#include "dab-constants.h"
@@ -151,5 +147,3 @@ int32_t getOutputSize (void) {
}
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __DATA_PROCESSOR__
#define __DATA_PROCESSOR__
#pragma once
#include <vector>
#include "frame-processor.h"
@@ -69,5 +68,4 @@ signals:
void show_mscErrors (int);
};
#endif

View File

@@ -22,6 +22,8 @@
*/
#pragma once
#include <QObject>
#include <stdio.h>
#include <stdint.h>

View File

@@ -27,8 +27,7 @@
*
\******************************************************************************/
#ifndef _EPGDEC_H
#define _EPGDEC_H
#pragma once
#include <cstdint>
#include <vector>
#include <qdom.h>
@@ -78,5 +77,3 @@ protected:
int iYear, iDay, iMonth;
};
#endif

View File

@@ -4,24 +4,25 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the SDR-J (JSDR).
* SDR-J is free software; you can redistribute it and/or modify
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __IP_DATAHANDLER__
#define __IP_DATAHANDLER__
#pragma once
#include "dab-constants.h"
#include "virtual-datahandler.h"
#include <vector>
@@ -45,7 +46,3 @@ signals:
void writeDatagram (int);
};
#endif

View File

@@ -4,24 +4,25 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the SDR-J (JSDR).
* SDR-J is free software; you can redistribute it and/or modify
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef JOURNALINE_DATAHANDLER
#define JOURNALINE_DATAHANDLER
#pragma once
#include "dab-constants.h"
#include "virtual-datahandler.h"
#include "dabdatagroupdecoder.h"
@@ -39,7 +40,3 @@ private:
DAB_DATAGROUP_DECODER_data myCallBack;
};
#endif

View File

@@ -23,8 +23,7 @@
* MOT handling is a crime, here we have a single class responsible
* for handling a MOT directory
*/
#ifndef __MOT_DIRECTORY__
#define __MOT_DIRECTORY__
#pragma once
#include "mot-object.h"
#include <QString>
@@ -67,5 +66,3 @@ private:
std::vector<motComponentType> motComponents;
};
#endif

View File

@@ -20,8 +20,8 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __MOT_HANDLER__
#define __MOT_HANDLER__
#pragma once
#include "dab-constants.h"
#include "virtual-datahandler.h"
#include <vector>
@@ -42,5 +42,3 @@ private:
int orderNumber;
motDirectory *theDirectory;
};
#endif

View File

@@ -21,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __MOT_OBJECT__
#define __MOT_OBJECT__
#pragma once
#include "dab-constants.h"
#include "mot-content-types.h"
#include <QObject>
@@ -70,5 +70,3 @@ signals:
void handle_motObject (QByteArray, QString, int, bool);
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PAD_HANDLER_H
#define __PAD_HANDLER_H
#pragma once
#include <QObject>
#include <cstring>
@@ -71,4 +70,3 @@ signals:
void show_motHandling (bool);
};
#endif

View File

@@ -4,7 +4,8 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -19,8 +20,8 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __TDC_DATAHANDLER__
#define __TDC_DATAHANDLER__
#pragma once
#include "dab-constants.h"
#include <vector>
#include "virtual-datahandler.h"
@@ -45,7 +46,6 @@ private:
signals:
void bytesOut (int, int);
};
#endif

View File

@@ -4,7 +4,8 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -18,15 +19,13 @@
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __VIRTUAL_DATAHANDLER__
#define __VIRTUAL_DATAHANDLER__
#pragma once
#include "dab-constants.h"
#include <QObject>
#include <vector>
class virtual_dataHandler:public QObject {
Q_OBJECT
public:
@@ -35,7 +34,6 @@ virtual ~virtual_dataHandler () {}
virtual
void add_mscDatagroup (std::vector<uint8_t>) {}
};
#endif

View File

@@ -25,8 +25,7 @@
// within the DAB/DAB+ sdr-j receiver software
// all rights are acknowledged.
//
#ifndef FIRECODE_CHECKER
#define FIRECODE_CHECKER
#pragma once
#include <cstdint>
@@ -42,5 +41,3 @@ private:
static const uint8_t g[16];
};
#endif

View File

@@ -5,6 +5,7 @@
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -20,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __FRAME_PROCESSOR__
#define __FRAME_PROCESSOR__
#pragma once
#include <vector>
#include <cstdint>
#include <cstdio>
@@ -38,5 +39,3 @@ virtual void addtoFrame (std::vector<uint8_t> ) {
fprintf (stderr, "in frameprocessor\n");
}
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __GALOIS
#define __GALOIS
#pragma once
#include <cstdint>
#include <vector>
@@ -52,5 +51,4 @@ public:
uint16_t inverse_poly (uint16_t a);
uint16_t inverse_power (uint16_t a);
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __MSC_HANDLER__
#define __MSC_HANDLER__
#pragma once
#ifdef __MSC_THREAD__
#include <QThread>
@@ -103,6 +102,3 @@ private:
#endif
};
#endif

View File

@@ -4,8 +4,7 @@
* May be used under the terms of the GNU General Public License (GPL)
*/
#ifndef __REED_SOLOMON
#define __REED_SOLOMON
#pragma once
#include <cstdint>
#include "galois.h"
@@ -41,4 +40,3 @@ int16_t dec (const uint8_t *data_in, uint8_t *data_out, int16_t cutlen);
void enc (const uint8_t *data_in, uint8_t *data_out, int16_t cutlen);
};
#endif

View File

@@ -25,8 +25,7 @@
// In the SDR-J DAB+ software, we use a - slighty altered -
// version of the dabp_rscodec as found in GnuRadio.
// For the Galois fields, we use a different implementation
#ifndef RSCODEC
#define RSCODEC
#pragma once
#include <cstdint>
#include <cstdint>
@@ -107,5 +106,3 @@ private:
void create_polynomials (int start_j); // initialize the generator polynomial g
};
#endif // DABP_RSCODE

View File

@@ -1,6 +1,5 @@
#ifndef __COUNTRY_CODES_H
#define __COUNTRY_CODES_H
#pragma once
#include <cstdint>
@@ -75,4 +74,3 @@ struct country_codes {
{0x00, 0x0, " "}
};
#endif

View File

@@ -24,8 +24,8 @@
// Common definitions and includes for
// the DAB decoder
#ifndef __DAB_CONSTANTS__
#define __DAB_CONSTANTS__
#pragma once
#include <QString>
#include <cmath>
#include <cstdint>
@@ -52,6 +52,12 @@ typedef void *HINSTANCE;
#endif
#ifdef USE_DOUBLE
typedef std::complex<double> Complex;
#else
typedef std::complex<float> Complex;
#endif
#ifndef M_PI
# define M_PI 3.14159265358979323846 /* pi */
#endif
@@ -65,7 +71,7 @@ using namespace std;
#define MHz(x) (KHz (x) * 1000)
#define mHz(x) (kHz (x) * 1000)
#define CURRENT_VERSION "5.3"
#define CURRENT_VERSION "5.4"
#define DAB 0100
#define DAB_PLUS 0101
@@ -402,4 +408,4 @@ uint16_t genpoly = 0x1021;
return (crc ^ accumulator) == 0;
}
#endif
//#endif

View File

@@ -20,8 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __MOT_CONTENT_TYPE__
#define __MOT_CONTENT_TYPE__
#pragma once
// Content type codes, reference:
// https://www.etsi.org/deliver/etsi_ts/101700_101799/101756/01.06.01_60/ts_101756v010601p.pdf page 20.
@@ -102,5 +101,3 @@ inline uint8_t getContentSubType(MOTContentType ct) {
(ct & MOTCTSubTypeMask)
);
}
#endif

View File

@@ -1,55 +0,0 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the SDR-J
* SDR-J is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __CHANNEL_H
#define __CHANNEL_H
#ifdef __WITH_JAN__
#include <Eigen/Dense>
#include <QString>
#include "dab-constants.h"
#include <vector>
using namespace Eigen;
// The processor for estimating the channel(s) of a single
// symbol
class channel {
public:
channel (std::vector<std::complex<float>> &, int, int);
~channel ();
void estimate (std::complex<float> *, std::complex<float> *);
private:
int16_t numberofCarriers;
int16_t numberofPilots;
int16_t numberofTaps;
int16_t fftSize;
typedef Matrix<std::complex<float>, Dynamic, Dynamic> MatrixXd;
typedef Matrix<std::complex<float>, Dynamic, 1> Vector;
MatrixXd F_p;
MatrixXd S_p;
MatrixXd S_pxF_p;
std::vector<int16_t> pilotTable;
};
#endif
#endif

68
includes/ofdm/correlator.h Executable file
View File

@@ -0,0 +1,68 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#pragma once
#include <QObject>
#include <cstdio>
#include <cstdint>
#include <vector>
#include "fft-handler.h"
#include "phasetable.h"
#include "dab-constants.h"
#include "dab-params.h"
#include "process-params.h"
#include "ringbuffer.h"
#include "fft-handler.h"
class RadioInterface;
class correlator : public QObject, public phaseTable {
Q_OBJECT
public:
correlator (RadioInterface *,
processParams *);
~correlator ();
int32_t findIndex (std::vector<Complex>, int);
// This one is used in the ofdm decoder
private:
std::vector<Complex> refTable;
dabParams params;
RingBuffer<float> *response;
int16_t depth;
int32_t T_u;
int32_t T_g;
int16_t carriers;
int32_t fft_counter;
int32_t framesperSecond;
int32_t displayCounter;
fftHandler fft_forward;
fftHandler fft_backwards;
signals:
void showCorrelation (int, int, QVector<int>);
};
//#endif

View File

@@ -28,8 +28,7 @@
* Definition of the "configuration" as maintained during reception of
* a channel
*/
#ifndef __FIB_CONFIG__
#define __FIB_CONFIG__
#pragma once
class service {
public:
@@ -197,4 +196,3 @@ serviceComponentDescriptor serviceComps [64];
Cluster clusterTable [128];
};
#endif

75
includes/ofdm/estimator.h Executable file
View File

@@ -0,0 +1,75 @@
#
/*
* Copyright (C) 2013 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#pragma once
#include <QObject>
#include <cstdio>
#include <cstdint>
#include <vector>
#include <Eigen/Dense>
#include <QString>
#include "dab-constants.h"
#include <vector>
#include "fft-handler.h"
#include "phasetable.h"
#include "dab-constants.h"
#include "dab-params.h"
#include "process-params.h"
#include "ringbuffer.h"
class RadioInterface;
using namespace Eigen;
class estimator : public QObject, public phaseTable {
Q_OBJECT
public:
estimator (RadioInterface *,
processParams *);
~estimator ();
void estimate (std::vector<Complex>,
std::vector<Complex> &);
// This one is used in the ofdm decoder
private:
fftHandler *fft_forward;
dabParams params;
std::vector<Complex> refTable;
int32_t T_u;
int32_t T_g;
int16_t carriers;
int16_t numberofCarriers;
int16_t numberofPilots;
int16_t numberofTaps;
int16_t fftSize;
typedef Matrix<Complex, Dynamic, Dynamic> MatrixXd;
typedef Matrix<Complex, Dynamic, 1> Vector;
MatrixXd F_p;
MatrixXd S_p;
MatrixXd S_pxF_p;
std::vector<int16_t> pilotTable;
signals:
void showCorrelation (int, int, QVector<int>);
};

View File

@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __FIB_DECODER__
#define __FIB_DECODER__
#
#pragma once
//
#include <cstdint>
#include <cstdio>
@@ -208,5 +206,4 @@ signals:
void nrServices (int);
};
#endif

View File

@@ -24,8 +24,7 @@
/*
* FIC data
*/
#ifndef __FIC_HANDLER_H
#define __FIC_HANDLER_H
#pragma once
#include <QObject>
#include <QMutex>
@@ -79,6 +78,5 @@ signals:
void show_ficSuccess (bool);
};
#endif

View File

@@ -21,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __FREQ_INTERLEAVER__
#define __FREQ_INTERLEAVER__
#pragma once
#include <cstdint>
#include <vector>
#include "dab-constants.h"
@@ -46,5 +46,4 @@ private:
std::vector<int16_t> permTable;
};
#endif

View File

@@ -1,6 +1,6 @@
#
/*
* Copyright (C) 2013 .. 2017
* Copyright (C) 2013 .. 2023
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
@@ -20,36 +20,38 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ELAD_READER__
#define __ELAD_READER__
#
#pragma once
#include <QThread>
#include <stdio.h>
#include <QObject>
#include <cstdio>
#include <cstdint>
#include <vector>
#include "fft-handler.h"
#include "phasetable.h"
#include "dab-constants.h"
#include "dab-params.h"
#include "process-params.h"
#include "ringbuffer.h"
#include <atomic>
class eladFiles;
class eladReader:public QThread {
class RadioInterface;
class freqSyncer : public QObject, public phaseTable {
Q_OBJECT
public:
eladReader (eladFiles *,
FILE *,
RingBuffer<uint8_t> *);
~eladReader ();
void startReader ();
void stopReader ();
freqSyncer (RadioInterface *,
processParams *);
~freqSyncer ();
int16_t estimate_CarrierOffset (std::vector<std::complex<float>>);
private:
virtual void run ();
FILE *filePointer;
RingBuffer<uint8_t> *theBuffer;
uint64_t period;
std::atomic<bool> running;
int64_t fileLength;
eladFiles *parent;
signals:
void setProgress (int);
std::vector<std::complex<float>> refTable;
dabParams params;
std::vector<float> phaseDifferences;
int16_t diff_length;
int32_t T_u;
int32_t T_g;
int16_t carriers;
fftHandler fft_forward;
};
#endif
//#endif

View File

@@ -20,8 +20,7 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __OFDM_DECODER__
#define __OFDM_DECODER__
#pragma once
#include "dab-constants.h"
#include <QObject>
@@ -41,10 +40,10 @@ public:
ofdmDecoder (RadioInterface *,
uint8_t,
int16_t,
RingBuffer<std::complex<float>> * iqBuffer = nullptr);
RingBuffer<Complex> * iqBuffer = nullptr);
~ofdmDecoder ();
void processBlock_0 (std::vector<std::complex<float> >);
void decode (std::vector<std::complex<float>> &,
void processBlock_0 (std::vector<Complex >);
void decode (std::vector<Complex> &,
int32_t n, std::vector<int16_t> &);
void stop ();
void reset ();
@@ -53,14 +52,14 @@ private:
dabParams params;
interLeaver myMapper;
fftHandler fft;
RingBuffer<std::complex<float>> *iqBuffer;
float computeQuality (std::complex<float> *);
float compute_timeOffset (std::complex<float> *,
std::complex<float> *);
float compute_clockOffset (std::complex<float> *,
std::complex<float> *);
float compute_frequencyOffset (std::complex<float> *,
std::complex<float> *);
RingBuffer<Complex> *iqBuffer;
float computeQuality (Complex *);
float compute_timeOffset (Complex *,
Complex *);
float compute_clockOffset (Complex *,
Complex *);
float compute_frequencyOffset (Complex *,
Complex *);
int32_t T_s;
int32_t T_u;
int32_t T_g;
@@ -76,5 +75,4 @@ signals:
void showQuality (float, float, float);
};
#endif

View File

@@ -21,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __PHASEREFERENCE__
#define __PHASEREFERENCE__
#pragma once
#include <QObject>
#include <cstdio>
#include <cstdint>
@@ -45,14 +45,14 @@ public:
phaseReference (RadioInterface *,
processParams *);
~phaseReference ();
int32_t findIndex (std::vector<std::complex<float>>, int);
int16_t estimate_CarrierOffset (std::vector<std::complex<float>>);
float phase (std::vector<std::complex<float>>&, int);
int32_t findIndex (std::vector<Complex>, int);
int16_t estimate_CarrierOffset (std::vector<Complex>);
float phase (std::vector<Complex>&, int);
#ifdef __WITH_JAN__
void estimate (std::vector<std::complex<float>>);
void estimate (std::vector<Complex>);
#endif
// This one is used in the ofdm decoder
std::vector<std::complex<float>> refTable;
std::vector<Complex> refTable;
private:
dabParams params;
#ifdef __WITH_JAN__
@@ -76,5 +76,4 @@ private:
signals:
void showCorrelation (int, int, QVector<int>);
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __PHASE_TABLE__
#define __PHASE_TABLE__
#pragma once
#include <cstdio>
#include <cstdint>
@@ -46,5 +45,4 @@ private:
int16_t Mode;
int32_t h_table (int32_t i, int32_t j);
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __SAMPLE_READER__
#define __SAMPLE_READER__
#pragma once
/*
* Reading the samples from the input device. Since it has its own
* "state", we embed it into its own class
@@ -47,13 +46,13 @@ Q_OBJECT
public:
sampleReader (RadioInterface *mr,
deviceHandler *theRig,
RingBuffer<std::complex<float>> *spectrumBuffer = nullptr);
RingBuffer<Complex> *spectrumBuffer = nullptr);
~sampleReader();
void setRunning (bool b);
float get_sLevel ();
std::complex<float> getSample (int32_t);
void getSamples (std::vector<std::complex<float>> &v,
Complex getSample (int32_t);
void getSamples (std::vector<Complex> &v,
int index,
int32_t n, int32_t phase);
void startDumping (SNDFILE *);
@@ -61,8 +60,8 @@ public:
private:
RadioInterface *myRadioInterface;
deviceHandler *theRig;
RingBuffer<std::complex<float>> *spectrumBuffer;
std::vector<std::complex<float>> localBuffer;
RingBuffer<Complex> *spectrumBuffer;
std::vector<Complex> localBuffer;
int32_t localCounter;
int32_t bufferSize;
int32_t currentPhase;
@@ -81,4 +80,3 @@ signals:
void show_Corrector (int);
};
#endif

View File

@@ -21,35 +21,39 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __TII_DETECTOR__
#define __TII_DETECTOR__
#pragma once
#include <cstdint>
#include "dab-params.h"
#include <complex>
#include <vector>
#include "fft-handler.h"
class TII_Detector {
public:
TII_Detector (uint8_t dabMode, int16_t);
~TII_Detector();
~TII_Detector ();
void reset ();
void setMode (bool);
void addBuffer (std::vector<std::complex<float>>);
void addBuffer (std::vector<Complex>);
uint16_t processNULL ();
private:
void collapse (std::complex<float> *,
fftHandler *my_fftHandler;
void collapse (Complex *,
float *);
bool detectMode_new;
int16_t depth;
uint8_t invTable [256];
dabParams params;
int16_t T_u;
int16_t carriers;
std::vector<std::complex<float> > theBuffer;
bool detectMode_new;
int16_t depth;
uint8_t invTable [256];
dabParams params;
int16_t T_u;
int16_t carriers;
std::vector<Complex > theBuffer;
#if USE_DOUBLE
std::vector<double> window;
#else
std::vector<float> window;
#endif
};
#endif

View File

@@ -20,8 +20,7 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __TIMESYNCER__
#define __TIMESYNCER__
#pragma once
#include "dab-constants.h"
@@ -41,5 +40,4 @@ private:
int32_t syncBufferIndex = 0;
const int32_t syncBufferSize = 4096;
};
#endif

View File

@@ -4,10 +4,7 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB (formerly SDR-J, JSDR).
* Many of the ideas as implemented in Qt-DAB are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are acknowledged.
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,10 +19,9 @@
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __QT_AUDIO__
#define __QT_AUDIO__
#pragma once
#include <stdio.h>
#include <QAudioOutput>
#include <QTimer>
@@ -54,4 +50,3 @@ private:
private slots:
void handleStateChanged (QAudio::State newState);
};
#endif

View File

@@ -1,14 +1,10 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB (formerly SDR-J, JSDR).
* Many of the ideas as implemented in Qt-DAB are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are acknowledged.
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __QT_AUDIODEVICE__
#define __QT_AUDIODEVICE__
#pragma once
#include <QIODevice>
#include <QObject>
@@ -48,5 +43,3 @@ public:
private:
RingBuffer<float> *Buffer;
};
#endif

View File

@@ -21,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __AUDIO_BASE_H
#define __AUDIO_BASE_H
#pragma once
#include "dab-constants.h"
#include <cstdio>
#include <samplerate.h>
@@ -59,5 +59,4 @@ private:
protected:
virtual void audioOutput (float *, int32_t);
};
#endif

View File

@@ -22,8 +22,8 @@
*
*/
#ifndef __AUDIO_SINK
#define __AUDIO_SINK
#pragma once
#include <QString>
#include <vector>
#include "dab-constants.h"
@@ -81,5 +81,4 @@ static int paCallback_o (const void *input,
void *userData);
};
#endif

View File

@@ -22,8 +22,7 @@
*
*/
#ifndef __FIR_LOWPASSFILTER__
#define __FIR_LOWPASSFILTER__
#pragma once
#include "dab-constants.h"
#include <vector>
@@ -47,5 +46,3 @@ private:
float frequency;
};
#endif

View File

@@ -5,6 +5,7 @@
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -18,10 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __NEW_CONVERTER__
#define __NEW_CONVERTER__
#pragma once
#include <cmath>
#include <complex>
@@ -53,8 +52,6 @@ public:
bool convert (std::complex<float> v,
std::complex<float> *out, int32_t *amount);
int32_t getOutputsize();
int32_t getOutputsize();
};
#endif

View File

@@ -2,30 +2,26 @@
/*
* Copyright (C) 2011, 2012, 2013
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
* Lazy Chair Computing
*
* This file is part of the SDR-J.
* Many of the ideas as implemented in SDR-J are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
* This file is part of Qt-DAB
*
* SDR-J is free software; you can redistribute it and/or modify
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __RTP_STREAMER
#define __RTP_STREAMER
#pragma once
#include <dab-constants.h>
#include <QString>
@@ -50,8 +46,8 @@ public:
private:
QString theName;
int32_t thePort;
RingBuffer<float> *theBuffer;
RingBuffer<float> *inBuffer;
RingBuffer<float> *theBuffer;
RingBuffer<float> *inBuffer;
RTPSession session;
RTPSessionParams sessionparams;
RTPUDPv4TransmissionParams transparams;
@@ -64,5 +60,4 @@ RingBuffer<float> *inBuffer;
int mapTable_int [481];
float mapTable_float [481];
};
#endif

View File

@@ -5,9 +5,6 @@
* Lazy Chair Computing
*
* This file is part of the Qt-DAB.
* Many of the ideas as implemented in Qt-DAB are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __TCP_STREAMER__
#define __TCP_STREAMER__
#pragma once
#include "dab-constants.h"
#include "ringbuffer.h"
@@ -57,5 +53,3 @@ public slots:
signals:
void handleSamples (void);
};
#endif

View File

@@ -4,7 +4,8 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB.
* This file is part of Qt-DAB.
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -20,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __EEP_PROTECTION__
#define __EEP_PROTECTION__
#pragma once
#include <vector>
#include <cstdio>
@@ -34,5 +34,3 @@ public:
~eep_protection ();
};
#endif

View File

@@ -1,31 +1,30 @@
#
/*
* Copyright (C) 2013
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
* Lazy Chair Computing
*
* This file is part of the SDR-J (JSDR).
* SDR-J is free software; you can redistribute it and/or modify
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#
#ifndef PROTTABLES
#define PROTTABLES
#pragma once
#include <cstdint>
int8_t *get_PCodes (int16_t);
#endif

View File

@@ -4,7 +4,8 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB.
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -21,13 +22,11 @@
*
* Simple base class for combining uep and eep deconvolvers
*/
#ifndef __PROTECTION__
#define __PROTECTION__
#pragma once
#include <cstdint>
#include <vector>
#include "viterbi-spiral.h"
//#include "viterbi-handler.h"
extern uint8_t PI_X [];
@@ -43,5 +42,4 @@ protected:
std::vector<int16_t> viterbiBlock;
};
#endif

View File

@@ -5,6 +5,7 @@
* Lazy Chair Computing
*
* This file is part of the Qt-DAB program
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -20,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __UEP_PROTECTION__
#define __UEP_PROTECTION__
#pragma once
#include <vector>
#include <cstdio>
@@ -34,5 +34,4 @@ public:
~uep_protection ();
};
#endif

View File

@@ -22,8 +22,7 @@
*/
//
#ifndef __AUDIO_DISPLAY_H
#define __AUDIO_DISPLAY_H
#pragma once
#include <QSettings>
#include "dab-constants.h"
@@ -78,8 +77,6 @@ private:
float get_db (float);
int32_t normalizer;
private slots:
void rightMouseClick (const QPointF &);
void rightMouseClick (const QPointF &);
};
#endif

View File

@@ -20,8 +20,7 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __IQDISPLAY__
#define __IQDISPLAY__
#pragma once
#include "dab-constants.h"
#include <vector>
@@ -65,5 +64,3 @@ private:
void setPoint (int, int, int);
private slots:
};
#endif

View File

@@ -1,31 +1,27 @@
#
/*
* Copyright (C) 2008, 2009, 2010
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
* Lazy Chair Computing
*
* This file is part of the SDR-J.
* Many of the ideas as implemented in SDR-J are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
* This file is part of Qt-DAB
*
* SDR-J is free software; you can redistribute it and/or modify
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __SCOPES
#define __SCOPES
#pragma once
#include <QObject>
#include <QStackedWidget>
@@ -142,5 +138,3 @@ signals:
void leftClicked (int);
void rightClicked (int);
};
#endif

View File

@@ -1,31 +1,27 @@
#
/*
* Copyright (C) 2010, 2011, 2012
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Programming
* Lazy Chair Computing
*
* This file is part of the SDR-J.
* Many of the ideas as implemented in SDR-J are derived from
* other work, made available through the GNU general Public License.
* All copyrights of the original authors are recognized.
* This file is part of Qt-DAB
*
* SDR-J is free software; you can redistribute it and/or modify
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SDR-J is distributed in the hope that it will be useful,
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SDR-J; if not, write to the Free Software
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SPECTROGRAM_H
#define __SPECTROGRAM_H
#pragma once
#include <cstdio>
#include <cstdlib>
@@ -101,5 +97,3 @@ double value (double x, double y) const {
};
#endif

View File

@@ -1,6 +1,5 @@
#ifndef __ITU_Region_1__
#define __ITU_Region_1__
#pragma once
#include <QString>
#include <stdint.h>
@@ -8,7 +7,6 @@
QString find_Country (uint8_t ecc, uint8_t countryId);
QString find_ITU_code (uint8_t ecc, uint8_t countryId);
#endif

View File

@@ -4,8 +4,7 @@
// a Java discussion on the net
// http://www.java-gaming.org/index.php?topic=14647.0
#ifndef __COMP_ATAN
#define __COMP_ATAN
#pragma once
#include <math.h>
#include <stdio.h>
@@ -31,5 +30,3 @@ private:
float *ATAN2_TABLE_NNX;
float Stretch;
};
#endif

View File

@@ -21,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __BANDHANDLER__
#define __BANDHANDLER__
#pragma once
#include <cstdint>
#include <QComboBox>
#include <QObject>
@@ -70,5 +70,4 @@ private:
void file_skipList (const QString &);
void updateEntry (const QString &);
};
#endif

View File

@@ -1,6 +1,5 @@
#ifndef __BANDPASSFIR__
#define __BANDPASSFIR__
#pragma once
/*
* The bandfilter is for the complex domain.
* We create a lowpass filter, which stretches over the
@@ -27,4 +26,4 @@ private:
std::complex<float> *kernel;
std::complex<float> *buffer;
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __COLOR_SELECTOR__
#define __COLOR_SELECTOR__
#pragma once
#
#include <QDialog>
#include <QLabel>
@@ -47,5 +46,4 @@ private slots:
void select_color (QModelIndex);
};
#endif

View File

@@ -20,8 +20,7 @@
* along with dab-scanner; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CONTENT_TABLE_H
#define __CONTENT_TABLE_H
#pragma once
#include <QWidget>
#include <QObject>
@@ -67,4 +66,3 @@ signals:
void goService (const QString &);
};
#endif

View File

@@ -4,7 +4,7 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB (formerly SDR-J, JSDR).
* This file is part of the Qt-DAB decoder
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +20,8 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __COORDINATES_H
#define __COORDINATES_H
#pragma once
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
@@ -49,6 +49,4 @@ private slots:
void handle_acceptButton () ;
};
#endif

View File

@@ -4,7 +4,7 @@
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB (formerly SDR-J, JSDR).
* This file is part of the Qt-DAB decoder
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __DAB_PARAMS__
#define __DAB_PARAMS__
#pragma once
#include <cstdint>
@@ -53,5 +52,4 @@ private:
int16_t CIFs;
};
#endif

View File

@@ -1,6 +1,5 @@
#ifndef __DL_CACHE_H
#define __DL_CACHE_H
#pragma once
#include <QString>
#include <vector>
@@ -48,4 +47,4 @@ bool addifNew (const QString &s) {
return false;
}
};
#endif

View File

@@ -20,8 +20,7 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ELEMENT_SELECTOR__
#define __ELEMENT_SELECTOR__
#pragma once
#
#include <QDialog>
#include <QLabel>
@@ -46,5 +45,3 @@ private slots:
void collectData ();
};
#endif

View File

@@ -20,8 +20,7 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __FIND_FILENAMES_H
#define __FIND_FILENAMES_H
#pragma once
//
// just a convenience class to pack a number of functions
// dealing with getting a filename
@@ -54,4 +53,3 @@ const QString findskipFile_fileName ();
QString find_eti_fileName (const QString &, const QString &);
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __HTTP_HANDLER_H
#define __HTTP_HANDLER_H
#pragma once
#include <QObject>
#include <thread>
@@ -90,4 +89,3 @@ signals:
void terminating ();
};
#endif

View File

@@ -20,8 +20,8 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __MAPPORT_HANDLER_H
#define __MAPPORT_HANDLER_H
#pragma once
#include <QDialog>
#include <QLabel>
#include <QPushButton>
@@ -43,6 +43,3 @@ private slots:
void handle_acceptButton ();
};
#endif

View File

@@ -20,8 +20,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PRESET_HANDLER__
#define __PRESET_HANDLER__
#pragma once
#include <QString>
#include <QtXml>
#include <QFile>
@@ -50,4 +50,3 @@ private:
QString fileName;
};
#endif

View File

@@ -20,8 +20,7 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PRESET_COMBOBOX__
#define __PRESET_COMBOBOX__
#pragma once
#include <QEvent>
#include <QComboBox>
@@ -39,4 +38,3 @@ public:
bool eventFilter (QObject *o, QEvent *e);
};
#endif

View File

@@ -1,6 +1,5 @@
#
#ifndef __PROCESS_PARAMS__
#define __PROCESS_PARAMS__
#pragma once
#include <stdint.h>
#include <complex>
@@ -24,5 +23,4 @@ public:
RingBuffer<uint8_t> *frameBuffer;
};
#endif

View File

@@ -65,8 +65,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __RINGBUFFER__
#define __RINGBUFFER__
#pragma once
#include <cstdlib>
#include <cstdio>
#include <cstring>
@@ -328,5 +328,4 @@ int32_t skipDataInBuffer (uint32_t n_values) {
}
};
#endif

View File

@@ -20,8 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __SCANLIST_HANDLER__
#define __SCANLIST_HANDLER__
#pragma once
#include "radio.h"
#include <QListView>
@@ -51,5 +50,4 @@ private:
QString fileName;
};
#endif

View File

@@ -1,6 +1,5 @@
#ifndef __SCHEDULE_SELECTOR__
#define __SCHEDULE_SELECTOR__
#pragma once
#
#include <QDialog>
#include <QLabel>
@@ -25,5 +24,3 @@ private slots:
void selectService (QModelIndex);
};
#endif

View File

@@ -19,8 +19,7 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __SCHEDULER__
#define __SCHEDULER__
#pragma once
#include <QWidget>
#include <QScrollArea>
@@ -60,5 +59,3 @@ private:
QString fileName;
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#
#ifndef __SKIN_HANDLER__
#define __SKIN_HANDLER__
#pragma once
#
#include <QDialog>
#include <QLabel>
@@ -46,5 +45,4 @@ private slots:
void select_skin (QModelIndex);
};
#endif

View File

@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __TIMETABLE_HANDLER__
#define __TIMETABLE_HANDLER__
#pragma once
#include "radio.h"
#include <QListView>
@@ -45,5 +44,3 @@ private:
RadioInterface *radio;
};
#endif

View File

@@ -20,8 +20,8 @@
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __UPLOAD_HANDLER_H
#define __UPLOAD_HANDLER_H
#pragma once
#include <QDialog>
#include <QLabel>
#include <QPushButton>
@@ -44,6 +44,3 @@ private slots:
void handle_noButton ();
};
#endif

297
new-display/display-widget.cpp Executable file
View File

@@ -0,0 +1,297 @@
#
/*
* Copyright (C) 2016 .. 2023
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <QSettings>
#include "display-widget.h"
#include "spectrum-scope.h"
#include "null-scope.h"
#include "correlation-scope.h"
#include "waterfall-scope.h"
#include "iqdisplay.h"
displayWidget::displayWidget (RadioInterface *mr,
QSettings *dabSettings):
myFrame (nullptr),
theFFT (4 * 512, false) {
this -> dabSettings = dabSettings;
dabSettings -> beginGroup ("displayWidget");
int x = dabSettings -> value ("position-x", 100). toInt ();
int y = dabSettings -> value ("position-y", 100). toInt ();
int w = dabSettings -> value ("width", 150). toInt ();
int h = dabSettings -> value ("height", 120). toInt ();
dabSettings -> endGroup ();
setupUi (&myFrame);
myFrame. resize (QSize (w, h));
myFrame. move (QPoint (x, y));
myFrame. show ();
//
// the "workers"
mySpectrumScope = new spectrumScope (spectrumDisplay,
512, dabSettings);
spectrumAmplitude -> setValue (50);
myWaterfallScope = new waterfallScope (waterfallDisplay,
512, 50);
myNullScope = new nullScope (nullDisplay,
512, dabSettings);
myCorrelationScope = new correlationScope (correlationDisplay,
256, dabSettings);
correlationLength -> setValue (500);
myTII_Scope = new spectrumScope (tiiDisplay,
512, dabSettings);
myIQDisplay = new IQDisplay (iqDisplay, 512);
dabSettings -> beginGroup ("displayWidget");
currentTab = dabSettings -> value ("tabSettings", 0). toInt ();
dabSettings -> endGroup ();
tabWidget -> setCurrentIndex (currentTab);
connect (tabWidget, SIGNAL (currentChanged (int)),
this, SLOT (switch_tab (int)));
}
displayWidget::~displayWidget () {
dabSettings -> beginGroup ("displayWidget");
dabSettings -> setValue ("position-x", myFrame. pos (). x ());
dabSettings -> setValue ("position-y", myFrame. pos (). y ());
QSize size = myFrame. size ();
dabSettings -> setValue ("width", size. width ());
dabSettings -> setValue ("height", size. height ());
dabSettings -> endGroup ();
myFrame. hide ();
delete mySpectrumScope;
delete myWaterfallScope;
delete myNullScope;
delete myCorrelationScope;
delete myTII_Scope;
delete myIQDisplay;
}
void displayWidget::switch_tab (int t) {
currentTab = t;
dabSettings -> beginGroup ("displayWidget");
dabSettings -> setValue ("tabSettings", t);
dabSettings -> endGroup ();
myWaterfallScope -> cleanUp ();
}
int displayWidget::get_tab () {
return currentTab == 0 ? SHOW_SPECTRUM :
currentTab == 1 ? SHOW_CORRELATION :
currentTab == 2 ? SHOW_NULL : SHOW_TII;
}
///////////////////////////////////////////////////////////////////////
// entries
///////////////////////////////////////////////////////////////////////
//
// for "spectrum" we get a segment of 2048 timedomain samples
// we take the fft and average a little
void displayWidget::showSpectrum (std::vector<Complex> &v, int freq) {
int l = v. size ();
double X_axis [512];
double Y_value [512];
static double avg [4 * 512];
if (currentTab != SHOW_SPECTRUM)
return;
theFFT. fft (v);
for (int i = 0; i < v. size () / 2; i ++) {
avg [i] = 0.5 * avg [i] + 0.5 * abs (v [l / 2 + i]);
avg [l / 2 + i] = 0.5 * avg [l / 2 + i] + 0.5 * abs (v [i]);
}
for (int i = 0; i < 512; i ++) {
X_axis [i] = (int)((freq - 1536000 / 2 + i * 1536000.0 / 512) / 1000);
Y_value [i] = 0;
for (int j = 0; j < 4; j ++)
Y_value [i] += avg [4 * i + j];
Y_value [i] = get_db (Y_value [i] / 4);
}
mySpectrumScope -> display (X_axis, Y_value, freq,
spectrumAmplitude -> value ());
for (int i = 0; i < 512; i ++)
Y_value [i] = (Y_value [i] - get_db (0)) / 6;
myWaterfallScope -> display (X_axis, Y_value,
waterfallSlider -> value (),
freq / 1000);
}
//
// for "null" we get a segment of 1024 timedomain samples
// (the amplitudes!)
// that can be displayed directly
void displayWidget::show_null (Complex *v, int amount) {
if (currentTab != SHOW_NULL)
return;
if (amount < 1024)
return;
for (int i = 0; i < 512; i ++)
v [i] = (v [2 * i] + v [2 * i + 1]) / 2.0f;
myNullScope -> display (v, amount);
double X_axis [512];
double Y_value [512];
float MMax = 0;
for (int i = 0; i < 512; i ++) {
X_axis [i] = 256 + i;
Y_value [i] = abs (v [i]);
if (Y_value [i] > MMax)
MMax = Y_value [i];
}
for (int i = 0; i < 512; i ++)
Y_value [i] *= 50.0 / MMax;
myWaterfallScope -> display (X_axis, Y_value,
waterfallSlider -> value (), 256);
}
//
// for "corr" we get a segment of 1024 float values,
// with as second parameter a list of indices with maximum values
void displayWidget::showCorrelation (std::vector<float> &v,
QVector<int> &ww) {
if (currentTab != SHOW_CORRELATION)
return;
myCorrelationScope -> display (v,correlationLength -> value ());
if (ww. size () > 0) {
QString t = "best matches ";
for (int i = 0; i < ww. size (); i ++)
t = t + " " + QString::number (ww [i]);
correlationsVector -> setText (t);
}
if (v. size () < 512)
return;
double X_axis [512];
double Y_value [512];
float MMax = 0;
for (int i = v. size () / 2 - 256; i < v. size () / 2 + 256; i ++) {
X_axis [i - v. size () / 2 + 256] = i;
Y_value [i - v. size () / 2 + 256] = v [i];
if (v [i] > MMax)
MMax = v [i];
}
for (int i = 0; i < 512; i ++)
Y_value [i] *= 50.0 / MMax;
myWaterfallScope -> display (X_axis, Y_value,
waterfallSlider -> value (),
v. size () / 2);
}
//
// for "tii" we get a segment of 2048 time domain samples,
// we take an FFT, do some averaging and display
void displayWidget::show_tii (std::vector<Complex> v, int freq) {
int l = v. size ();
double X_axis [512];
double Y_value [512];
static double avg [4 * 512];
if (currentTab != SHOW_TII)
return;
theFFT. fft (v);
for (int i = 0; i < v. size () / 2; i ++) {
avg [i] = 0.5 * avg [i] + 0.5 * abs (v [l / 2 + i]);
avg [l / 2 + i] = 0.5 * avg [l / 2 + i] + 0.5 * abs (v [i]);
}
for (int i = 0; i < 512; i ++) {
X_axis [i] = (int) ((freq - 1536000 / 2 + i * 1536000.0 / 512) / 1000);
Y_value [i] = 0;
for (int j = 0; j < 4; j ++)
Y_value [i] += avg [4 * i + j];
Y_value [i] = get_db (Y_value [i]);
}
myTII_Scope -> display (X_axis, Y_value, freq,
spectrumAmplitude -> value ());
for (int i = 0; i < 512; i ++)
Y_value [i] = (Y_value [i] - get_db (0)) / 6;
myWaterfallScope -> display (X_axis, Y_value,
waterfallSlider -> value (),
freq / 1000);
}
//
// for IQ we get a segment of 512 complex v alues, i.e. the
// decoded values
void displayWidget::showIQ (std::vector<Complex> Values) {
int sliderValue = scopeSlider -> value ();
float avg = 0;
if (Values. size () < 512)
return;
for (int i = 0; i < 512; i ++) {
float x = abs (Values [i]);
if (!std::isnan (x) && !std::isinf (x))
avg += x;
}
avg /= Values. size ();
myIQDisplay -> DisplayIQ (Values. data (), 512, sliderValue / avg);
}
void displayWidget:: showQuality (float q, float timeOffset,
float freqOffset) {
if (myFrame. isHidden ())
return;
quality_display -> display (q);
timeOffsetDisplay -> display (timeOffset);
frequencyOffsetDisplay -> display (freqOffset);
}
void displayWidget::show_snr (float snr) {
if (myFrame. isHidden ())
return;
snrDisplay -> display (snr);
}
void displayWidget::show_correction (int c) {
if (myFrame. isHidden ())
return;
correctorDisplay -> display (c);
}
void displayWidget::show_clockErr (int e) {
if (!myFrame. isHidden ())
clockError -> display (e);
}
void displayWidget::showFrequency (float f) {
frequencyDisplay -> display (f);
}
void displayWidget::show () {
myFrame. show ();
}
void displayWidget::hide () {
myFrame. hide ();
}
bool displayWidget::isHidden () {
return myFrame. isHidden ();
}

89
new-display/display-widget.h Executable file
View File

@@ -0,0 +1,89 @@
#
/*
* Copyright (C) 2016 .. 2024
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include "dab-constants.h"
#include <QObject>
#include <qwt.h>
#include <qwt_plot.h>
#include <QVector>
#include "fft-handler.h"
#include "ui_scopewidget.h"
#define SHOW_SPECTRUM 0
#define SHOW_CORRELATION 1
#define SHOW_NULL 2
#define SHOW_TII 3
class RadioInterface;
class QSettings;
class spectrumScope;
class waterfallScope;
class nullScope;
class correlationScope;
class IQDisplay;
class displayWidget: public QObject, public Ui_scopeWidget {
Q_OBJECT
public:
displayWidget (RadioInterface *,
QSettings *);
~displayWidget ();
int get_tab ();
void showSpectrum (std::vector<Complex> &, int);
void show_null (Complex *, int);
void showCorrelation (std::vector<float> &,
QVector<int> &);
void show_tii (std::vector<Complex>, int);
void showIQ (std::vector<Complex>);
void showQuality (float, float, float);
void show_snr (float);
void show_correction (int);
void show_clockErr (int);
void showFrequency (float);
void show ();
void hide ();
bool isHidden ();
private:
QFrame myFrame;
fftHandler theFFT;
QSettings *dabSettings;
spectrumScope *mySpectrumScope;
waterfallScope *myWaterfallScope;
nullScope *myNullScope;
correlationScope *myCorrelationScope;
spectrumScope *myTII_Scope;
IQDisplay *myIQDisplay;
int currentTab;
private slots:
void switch_tab (int);
};

View File

@@ -0,0 +1,181 @@
#
/*
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "correlation-scope.h"
#include <QSettings>
#include <QColor>
#include <QPen>
#include "color-selector.h"
correlationScope::correlationScope (QwtPlot *corrGrid,
int displaySize,
QSettings *s) :
spectrumCurve ("") {
QString colorString = "black";
bool brush;
this -> dabSettings = s;
this -> displaySize = displaySize;
dabSettings -> beginGroup ("correlationScope");
colorString = dabSettings -> value ("displayColor",
"black"). toString();
displayColor = QColor (colorString);
colorString = dabSettings -> value ("gridColor",
"white"). toString();
gridColor = QColor (colorString);
colorString = dabSettings -> value ("curveColor",
"white"). toString();
curveColor = QColor (colorString);
brush = dabSettings -> value ("brush", 0). toInt () == 1;
dabSettings -> endGroup ();
plotgrid = corrGrid;
plotgrid -> setCanvasBackground (displayColor);
grid = new QwtPlotGrid;
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMajPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMajorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> enableXMin (true);
grid -> enableYMin (true);
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMinPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMinorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> attach (plotgrid);
lm_picker = new QwtPlotPicker (plotgrid -> canvas ());
QwtPickerMachine *lpickerMachine =
new QwtPickerClickPointMachine ();
lm_picker -> setStateMachine (lpickerMachine);
lm_picker -> setMousePattern (QwtPlotPicker::MouseSelect1,
Qt::RightButton);
connect (lm_picker, SIGNAL (selected (const QPointF&)),
this, SLOT (rightMouseClick (const QPointF &)));
//
// set the length of the display
spectrumCurve. setPen (QPen(curveColor, 2.0));
spectrumCurve. setOrientation (Qt::Horizontal);
spectrumCurve. setBaseline (0);
if (brush) {
QBrush ourBrush (curveColor);
ourBrush. setStyle (Qt::Dense3Pattern);
spectrumCurve. setBrush (ourBrush);
}
spectrumCurve. attach (plotgrid);
plotgrid -> enableAxis (QwtPlot::yLeft);
}
correlationScope::~correlationScope () {
}
void correlationScope::display (std::vector<float> &v, int amount) {
double X_axis [amount];
double Y_value [amount];
double Max = -200;
int teller = 0;
int input = v. size ();
if (amount < 256)
return;
for (int i = input / 2 - amount / 2;
i < input / 2 + amount / 2; i ++) {
X_axis [teller] = i;
Y_value [teller] = get_db (v [i]);
if (Y_value [teller] > Max)
Max = Y_value [teller];
teller ++;
}
plotgrid -> setAxisScale (QwtPlot::xBottom,
(double)X_axis [0],
X_axis [amount - 1]);
plotgrid -> enableAxis (QwtPlot::xBottom);
plotgrid -> setAxisScale (QwtPlot::yLeft,
get_db (0), get_db (0) + 5 * Max);
// get_db (0), 0);
spectrumCurve. setBaseline (get_db (0));
Y_value [0] = get_db (0);
Y_value [amount - 1] = get_db (0);
spectrumCurve. setSamples (X_axis, Y_value, amount);
plotgrid -> replot ();
}
float correlationScope::get_db (float x) {
return 20 * log10 ((x + 1) / (float)(512));
}
void correlationScope::rightMouseClick (const QPointF &point) {
colorSelector *selector;
int index;
(void)point;
selector = new colorSelector ("display color");
index = selector -> QDialog::exec ();
QString displayColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
selector = new colorSelector ("grid color");
index = selector -> QDialog::exec ();
QString gridColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
selector = new colorSelector ("curve color");
index = selector -> QDialog::exec ();
QString curveColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
dabSettings -> beginGroup ("correlationScope");
dabSettings -> setValue ("displayColor", displayColor);
dabSettings -> setValue ("gridColor", gridColor);
dabSettings -> setValue ("curveColor", curveColor);
dabSettings -> endGroup ();
this -> displayColor = QColor (displayColor);
this -> gridColor = QColor (gridColor);
this -> curveColor = QColor (curveColor);
spectrumCurve. setPen (QPen(this -> curveColor, 2.0));
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMajPen (QPen(this -> gridColor, 0, Qt::DotLine));
#else
grid -> setMajorPen (QPen(this -> gridColor, 0, Qt::DotLine));
#endif
grid -> enableXMin (true);
grid -> enableYMin (true);
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMinPen (QPen(this -> gridColor, 0, Qt::DotLine));
#else
grid -> setMinorPen (QPen(this -> gridColor, 0, Qt::DotLine));
#endif
plotgrid -> setCanvasBackground (this -> displayColor);
}

View File

@@ -0,0 +1,74 @@
#
/*
* Copyright (C) 2014 .. 2017
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB.
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include "dab-constants.h"
#include <QFrame>
#include <QSettings>
#include <QObject>
#include <qwt.h>
#include <qwt_plot.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_curve.h>
#include <qwt_color_map.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_textlabel.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_layout.h>
#include <qwt_picker_machine.h>
#include <qwt_scale_widget.h>
#include <QBrush>
#include <QVector>
class RadioInterface;
class correlationScope: public QObject {
Q_OBJECT
public:
correlationScope (QwtPlot *rig,
int displaySize,
QSettings *);
~correlationScope ();
void display (std::vector<float> &v,
int length);
private:
QwtPlotCurve spectrumCurve;
QSettings *dabSettings;
QwtPlotPicker *lm_picker;
QColor displayColor;
QColor gridColor;
QColor curveColor;
int plotLength;
QwtPlot *plotgrid;
QwtPlotGrid *grid;
int displaySize;
float get_db (float);
private slots:
void rightMouseClick (const QPointF &);
};

111
new-display/scopes/iqdisplay.cpp Executable file
View File

@@ -0,0 +1,111 @@
#
/*
* Copyright (C) 2016 .. 2023
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "iqdisplay.h"
#include "spectrogramdata.h"
/*
* iq circle plotter
*/
SpectrogramData *IQData = nullptr;
static std::complex<int> Points [4 * 512];
IQDisplay::IQDisplay (QwtPlot *plot, int16_t x):
QwtPlotSpectrogram() {
QwtLinearColorMap *colorMap = new QwtLinearColorMap (Qt::black, Qt::white);
(void)x;
setRenderThreadCount (1);
Radius = 100;
plotgrid = plot;
x_amount = 4 * 512;
CycleCount = 0;
this -> setColorMap (colorMap);
plotData. resize (2 * Radius * 2 * Radius);
plot2. resize (2 * Radius * 2 * Radius);
memset (plotData. data(), 0,
2 * 2 * Radius * Radius * sizeof (double));
IQData = new SpectrogramData (plot2. data(),
0,
2 * Radius,
2 * Radius,
2 * Radius,
50.0);
for (int i = 0; i < x_amount; i ++)
Points [i] = std::complex<int> (0, 0);
this -> setData (IQData);
plot -> enableAxis (QwtPlot::xBottom, false);
plot -> enableAxis (QwtPlot::yLeft, false);
this -> setDisplayMode (QwtPlotSpectrogram::ImageMode, true);
plotgrid -> replot();
}
IQDisplay::~IQDisplay () {
this -> detach();
// delete IQData;
}
void IQDisplay::setPoint (int x, int y, int val) {
plotData [(x + Radius - 1) * 2 * Radius + y + Radius - 1] = val;
}
void IQDisplay::DisplayIQ (std::complex<float> *z,
int amount, float scale) {
//
// clean the screen
for (int i = 0; i < x_amount; i ++) {
int a = real (Points [i]);
int b = imag (Points [i]);
setPoint (a, b, 0);
}
for (int i = 0; i < 512; i ++) {
int x = (int)(scale * real (z [i]));
int y = (int)(scale * imag (z [i]));
if (x >= Radius - 1)
x = Radius - 2;
if (y >= Radius - 1)
y = Radius - 2;
if (x <= - Radius + 1)
x = -Radius + 2;
if (y <= - Radius + 1)
y = - Radius + 2;;
Points [4 * i] = std::complex<int> (x, y);
setPoint (x, y, 100);
Points [4 * i + 1] = std::complex<int> (x + 1, y);
setPoint (x + 1, y, 100);
Points [4 * i + 2] = std::complex<int> (x, y + 1);
setPoint (x, y + 1, 100);
Points [4 * i + 3] = std::complex<int> (x + 1, y + 1);
setPoint (x + 1, y + 1, 100);
}
memcpy (plot2. data(), plotData. data (),
2 * 2 * Radius * Radius * sizeof (double));
this -> detach();
this -> setData (IQData);
this -> setDisplayMode (QwtPlotSpectrogram::ImageMode, true);
this -> attach (plotgrid);
plotgrid -> replot ();
}

66
new-display/scopes/iqdisplay.h Executable file
View File

@@ -0,0 +1,66 @@
#
/*
* Copyright (C) 2016 .. 2023
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include "dab-constants.h"
#include <vector>
#include <qwt.h>
#include <qwt_slider.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_grid.h>
#include <qwt_dial.h>
#include <qwt_dial_needle.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_color_map.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_scale_widget.h>
#include <qwt_scale_draw.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_layout.h>
#include "dab-constants.h"
/*
* for the waterfall display
*/
class IQDisplay: public QObject, public QwtPlotSpectrogram {
Q_OBJECT
public:
IQDisplay (QwtPlot *, int16_t);
~IQDisplay();
void DisplayIQ (std::complex<float> *, int, float);
private:
int32_t x_amount;
std::vector<double> plotData;
std::vector<double> plot2;
// std::vector<complex<int> > Points;
// std::complex<int> *Points;
QwtPlot *plotgrid;
int _OutputRate;
int Radius;
int CycleCount;
void setPoint (int, int, int);
private slots:
};

164
new-display/scopes/null-scope.cpp Executable file
View File

@@ -0,0 +1,164 @@
#
/*
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "null-scope.h"
#include <QSettings>
#include <QColor>
#include <QPen>
#include "color-selector.h"
nullScope::nullScope (QwtPlot *nullScope,
int displaySize,
QSettings *dabSettings):
spectrumCurve ("") {
QString colorString = "black";
//bool brush;
this -> dabSettings = dabSettings;
dabSettings -> beginGroup ("nullScope");
colorString = dabSettings -> value ("displayColor",
"black"). toString();
displayColor = QColor (colorString);
colorString = dabSettings -> value ("gridColor",
"white"). toString();
gridColor = QColor (colorString);
colorString = dabSettings -> value ("curveColor",
"white"). toString();
curveColor = QColor (colorString);
// brush = dabSettings -> value ("brush", 0). toInt () == 1;
dabSettings -> endGroup ();
plotgrid = nullScope;
plotgrid -> setCanvasBackground (displayColor);
grid = new QwtPlotGrid;
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMajPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMajorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> enableXMin (true);
grid -> enableYMin (true);
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMinPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMinorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> attach (plotgrid);
lm_picker = new QwtPlotPicker (nullScope -> canvas ());
QwtPickerMachine *lpickerMachine =
new QwtPickerClickPointMachine ();
lm_picker -> setStateMachine (lpickerMachine);
lm_picker -> setMousePattern (QwtPlotPicker::MouseSelect1,
Qt::RightButton);
connect (lm_picker, SIGNAL (selected (const QPointF&)),
this, SLOT (rightMouseClick (const QPointF &)));
spectrumCurve. setPen (QPen(curveColor, 2.0));
spectrumCurve. setOrientation (Qt::Horizontal);
spectrumCurve. setBaseline (0);
spectrumCurve. attach (plotgrid);
}
nullScope::~nullScope () {
delete grid;
}
void nullScope::display (Complex *V, int amount) {
float max = 0;
double X_axis [512];
double Y_values [512];
for (int i = 0; i < 512; i ++) {
X_axis [i] = i;
Y_values [i] = abs (V [i]);
if (abs (V [i]) > max)
max = abs (V [i]);
}
plotgrid -> setAxisScale (QwtPlot::xBottom,
(double)X_axis [0],
X_axis [512 - 1]);
plotgrid -> enableAxis (QwtPlot::xBottom);
plotgrid -> setAxisScale (QwtPlot::yLeft,
0, 1.5 * max );
spectrumCurve. setBaseline (0);
Y_values [0] = 0;
Y_values [amount - 1] = 0;
spectrumCurve. setSamples (X_axis, Y_values, 512);
plotgrid -> replot ();
}
void nullScope::rightMouseClick (const QPointF &point) {
colorSelector *selector;
int index;
(void) point;
selector = new colorSelector ("display color");
index = selector -> QDialog::exec ();
QString displayColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
selector = new colorSelector ("grid color");
index = selector -> QDialog::exec ();
QString gridColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
selector = new colorSelector ("curve color");
index = selector -> QDialog::exec ();
QString curveColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
dabSettings -> beginGroup ("nullScope");
dabSettings -> setValue ("displayColor", displayColor);
dabSettings -> setValue ("gridColor", gridColor);
dabSettings -> setValue ("curveColor", curveColor);
dabSettings -> endGroup ();
this -> displayColor = QColor (displayColor);
this -> gridColor = QColor (gridColor);
this -> curveColor = QColor (curveColor);
spectrumCurve. setPen (QPen (this -> curveColor, 2.0));
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMajPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#else
grid -> setMajorPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#endif
grid -> enableXMin (true);
grid -> enableYMin (true);
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMinPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#else
grid -> setMinorPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#endif
plotgrid -> setCanvasBackground (this -> displayColor);
}

70
new-display/scopes/null-scope.h Executable file
View File

@@ -0,0 +1,70 @@
#
/*
* Copyright (C) 2016 .. 2023
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include "dab-constants.h"
#include <QObject>
#include <qwt.h>
#include <qwt_plot.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_curve.h>
#include <qwt_color_map.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_textlabel.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_layout.h>
#include <qwt_picker_machine.h>
#include <qwt_scale_widget.h>
#include <QBrush>
#include <QTimer>
class RadioInterface;
class QSettings;
class nullScope: public QObject {
Q_OBJECT
public:
nullScope (QwtPlot *,
int,
QSettings *);
~nullScope ();
void display (Complex * , int);
private:
QwtPlotCurve spectrumCurve;
QSettings *dabSettings;
QColor displayColor;
QColor gridColor;
QColor curveColor;
QwtPlot *plotgrid;
QwtPlotGrid *grid;
QwtPlotPicker *lm_picker;
private slots:
void rightMouseClick (const QPointF &);
};

View File

@@ -0,0 +1,99 @@
#
/*
* Copyright (C) 2016 .. 2022
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#pragma once
#include <cstdio>
#include <cstdlib>
#include <qwt_interval.h>
#include <QPen>
//
// Qwt 6.2 is different from the 6.1 version, these mods
// seem to work
//#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
# include <qwt_raster_data.h>
//#else
//# include <qwt_matrix_raster_data.h>
//#endif
//#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
class SpectrogramData: public QwtRasterData {
//#else
//class SpectrogramData: public QwtMatrixRasterData {
//#endif
public:
double *data; // pointer to actual data
int left; // index of left most element in raster
int width; // raster width
int height; // rasterheigth
int datawidth; // width of matrix
int dataheight; // for now == rasterheigth
double max;
SpectrogramData (double *data, int left, int width, int height,
int datawidth, double max):
//#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
QwtRasterData () {
//#else
// QwtMatrixRasterData () {
//#endif
this -> data = data;
this -> left = left;
this -> width = width;
this -> height = height;
this -> datawidth = datawidth;
this -> dataheight = height;
this -> max = max;
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
setInterval (Qt::XAxis, QwtInterval (left, left + width));
setInterval (Qt::YAxis, QwtInterval (0, height));
setInterval (Qt::ZAxis, QwtInterval (0, max));
#endif
}
void initRaster (const QRectF &x, const QSize &raster) {
(void)x;
(void)raster;
}
QwtInterval interval (Qt::Axis x) const {
if (x == Qt::XAxis)
return QwtInterval (left, left + width);
if (x == Qt::YAxis)
return QwtInterval (0, height);
return QwtInterval (0, max);
}
~SpectrogramData() {
}
double value (double x, double y) const {
//fprintf (stderr, "x = %f, y = %f\n", x, y);
x = x - left;
x = x / width * (datawidth - 1);
y = y / height * (dataheight - 1);
return data [(int)y * datawidth + (int)x];
}
};

View File

@@ -0,0 +1,177 @@
#
/*
* Copyright (C) 2016 .. 2023
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
* This file is part of the Qt-DAB
*
* Qt-DAB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Qt-DAB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Qt-DAB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "spectrum-scope.h"
#include <QSettings>
#include <QColor>
#include <QPen>
#include "color-selector.h"
spectrumScope::spectrumScope (QwtPlot *dabScope,
int displaySize,
QSettings *dabSettings):
spectrumCurve ("") {
QString colorString = "black";
bool brush;
this -> dabSettings = dabSettings;
this -> displaySize = displaySize;
dabSettings -> beginGroup ("spectrumScope");
colorString = dabSettings -> value ("displayColor",
"black"). toString();
displayColor = QColor (colorString);
colorString = dabSettings -> value ("gridColor",
"white"). toString();
gridColor = QColor (colorString);
colorString = dabSettings -> value ("curveColor",
"white"). toString();
curveColor = QColor (colorString);
brush = dabSettings -> value ("brush", 0). toInt () == 1;
dabSettings -> endGroup ();
plotgrid = dabScope;
plotgrid -> setCanvasBackground (displayColor);
grid = new QwtPlotGrid;
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMajPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMajorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> enableXMin (true);
grid -> enableYMin (true);
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMinPen (QPen(gridColor, 0, Qt::DotLine));
#else
grid -> setMinorPen (QPen(gridColor, 0, Qt::DotLine));
#endif
grid -> attach (plotgrid);
lm_picker = new QwtPlotPicker (dabScope -> canvas ());
QwtPickerMachine *lpickerMachine =
new QwtPickerClickPointMachine ();
lm_picker -> setStateMachine (lpickerMachine);
lm_picker -> setMousePattern (QwtPlotPicker::MouseSelect1,
Qt::RightButton);
connect (lm_picker, SIGNAL (selected (const QPointF&)),
this, SLOT (rightMouseClick (const QPointF &)));
spectrumCurve. setPen (QPen(curveColor, 2.0));
spectrumCurve. setOrientation (Qt::Horizontal);
spectrumCurve. setBaseline (get_db (0));
if (brush) {
QBrush ourBrush (curveColor);
ourBrush. setStyle (Qt::Dense3Pattern);
spectrumCurve. setBrush (ourBrush);
}
spectrumCurve. attach (plotgrid);
Marker = new QwtPlotMarker();
Marker -> setLineStyle (QwtPlotMarker::VLine);
Marker -> setLinePen (QPen (Qt::red));
Marker -> attach (plotgrid);
plotgrid -> enableAxis (QwtPlot::yLeft);
normalizer = 512;
}
spectrumScope::~spectrumScope () {
delete Marker;
delete grid;
}
void spectrumScope::display (double *X_axis, double *Y_value,
int freq, int Amp) {
float Max = Amp / 100.0 * (-get_db (0));
plotgrid -> setAxisScale (QwtPlot::xBottom,
(double)X_axis [0],
X_axis [displaySize - 1]);
plotgrid -> enableAxis (QwtPlot::xBottom);
plotgrid -> setAxisScale (QwtPlot::yLeft,
get_db (0), get_db (0) + 2.5 * Max);
spectrumCurve. setBaseline (get_db (0));
Y_value [0] = get_db (0);
Y_value [displaySize - 1] = get_db (0);
spectrumCurve. setSamples (X_axis, Y_value, 512);
Marker -> setXValue (0);
plotgrid -> replot ();
}
void spectrumScope::rightMouseClick (const QPointF &point) {
colorSelector *selector;
int index;
(void) point;
selector = new colorSelector ("display color");
index = selector -> QDialog::exec ();
QString displayColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
selector = new colorSelector ("grid color");
index = selector -> QDialog::exec ();
QString gridColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
selector = new colorSelector ("curve color");
index = selector -> QDialog::exec ();
QString curveColor = selector -> getColor (index);
delete selector;
if (index == 0)
return;
dabSettings -> beginGroup ("spectrumScope");
dabSettings -> setValue ("displayColor", displayColor);
dabSettings -> setValue ("gridColor", gridColor);
dabSettings -> setValue ("curveColor", curveColor);
dabSettings -> endGroup ();
this -> displayColor = QColor (displayColor);
this -> gridColor = QColor (gridColor);
this -> curveColor = QColor (curveColor);
spectrumCurve. setPen (QPen (this -> curveColor, 2.0));
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMajPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#else
grid -> setMajorPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#endif
grid -> enableXMin (true);
grid -> enableYMin (true);
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0601)
grid -> setMinPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#else
grid -> setMinorPen (QPen(this -> gridColor, 0,
Qt::DotLine));
#endif
plotgrid -> setCanvasBackground (this -> displayColor);
}
float spectrumScope::get_db (float x) {
return 20 * log10 ((x + 1) / (float)(normalizer));
}

Some files were not shown because too many files have changed in this diff Show More