Skip to content

Commit

Permalink
some mods
Browse files Browse the repository at this point in the history
  • Loading branch information
JvanKatwijk committed Feb 26, 2023
1 parent f00feec commit 5f6ba97
Show file tree
Hide file tree
Showing 20 changed files with 236 additions and 350 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@

FM receiver V3.1
FM receiver V3.15
-------------------------

SOFTWARE UNDER CONSTRUCTION

The software is contnuously changing since I am restructuring some parts
Be advised NOT to use these sources now

========================================================================

Some significant modifications were made by Thomas Neder, apart from the
Expand Down Expand Up @@ -53,7 +48,7 @@ you are in.
Furthermore, the control widget contains a widget, *Combinear* on the
picture, that can be used to dynamically set another "skin"

The filtering, i.e. separation between transmissions close to each other
The inputfiltering, i.e. separation between transmissions close to each other
in frequency, or even with (slightly) overlapping frequencies,
is improved.
The filter is pretty strong, but that also means that the filter requires
Expand Down
Binary file removed fft.o
Binary file not shown.
4 changes: 2 additions & 2 deletions forms/radio.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@
<item>
<widget class="QPushButton" name="btnRestartPSS">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Restarts the PSS (Perfect Stereo Separation) analyzer&lt;/p&gt;&lt;p&gt;This could be important when the analyzing failed if too little Stereo difference signal was existing while analyzing before (e.g, only a new report without music).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Restarts the PSS (Perfect Stereo Separation) analyzer&lt;/p&gt;&lt;p&gt;This could be important when the analyzing failed if too little Stereo difference signal was existing while analyzing before (e.g, only a news report without music).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Restart PSS analyzer</string>
Expand Down Expand Up @@ -1625,7 +1625,7 @@
<item>
<widget class="QComboBox" name="fmRdsSelector">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select RDS decoding:&lt;/p&gt;&lt;p&gt;RDS OFF: RDS is off at all&lt;/p&gt;&lt;p&gt;RDS 1: RDS works with a matched filter recognition based on cuteSDR&lt;br/&gt;&lt;br/&gt;RDS 2: RDS works with Matched Filter contributed by Tomneda&lt;br/&gt;&lt;br/&gt;RDS 2: RDS works with a classic approach of detecting the phases of the RDS signal&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;The state, i.e. the setting of the selector, is maintained between program invocations&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select RDS decoding:&lt;/p&gt;&lt;p&gt;RDS OFF: RDS is off at all&lt;/p&gt;&lt;p&gt;RDS 1: RDS works with a matched filter recognition based on cuteSDR&lt;br/&gt;&lt;br/&gt;RDS 2: RDS-2 works with matched Filter and time synchronizer contributed by Tomneda&lt;br/&gt;&lt;br/&gt;RDS 2: RDS works with a classic approach of detecting the phases of the RDS signal&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;The state, i.e. the setting of the selector, is maintained between program invocations&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
Expand Down
2 changes: 1 addition & 1 deletion includes/fm-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* 2) Check different station with the IQ balance slider whether the signal get minimal at center "0" position
* 3) You can also see in the RDS IQ scope the remaing phase (Costas Loop is switched off)
*/
//#define DO_STEREO_SEPARATION_TEST
#define DO_STEREO_SEPARATION_TEST

#ifndef __FREEBSD__
#include <malloc.h>
Expand Down
27 changes: 12 additions & 15 deletions includes/fm/fm-processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Q_OBJECT
AF_DIFF, AF_MONO_FILTERED, AF_LEFT_FILTERED,
AF_RIGHT_FILTERED, RDS_INPUT, RDS_DEMOD };
enum class ESqMode { OFF, NSQ, LSQ };
enum Channels { S_STEREO, S_STEREO_SWAPPED, S_LEFT,
enum Channels { S_STEREO, S_STEREO_SWAPPED, S_LEFT,
S_RIGHT, S_LEFTplusRIGHT,
S_LEFTminusRIGHT, S_LEFTminusRIGHT_Test };
struct SMetaData {
Expand Down Expand Up @@ -150,7 +150,7 @@ Q_OBJECT
void setTestTone (const bool iTTEnabled);
void setDispDelay (const int iDelay);

DSPFLOAT get_demodDcComponent ();
float get_demodDcComponent ();
void startScanning ();
void stopScanning ();
void set_squelchValue (int16_t);
Expand All @@ -176,7 +176,7 @@ Q_OBJECT
DecimatingFIR fmBand_1;
DecimatingFIR fmBand_2;
fftFilter fmAudioFilter;
fftFilter fmFilter;
fftFilter inputFilter;
pilotRecovery pilotRecover;
PerfectStereoSeparation pPSS;
fftFilter rdsBandPassFilter;
Expand All @@ -186,9 +186,9 @@ Q_OBJECT
fm_Demodulator *theDemodulator;
float rdsPhaseBuffer [RDS_SAMPLE_DELAY];
int rdsPhaseIndex;
std::atomic<bool> fmFilterOn;
std::atomic<bool> newAudioFilter;
int audioFrequency;
std::atomic<bool> inputFilterOn;
std::atomic<bool> newInputFilter;

int displaySize;
int spectrumSize;
Expand All @@ -199,23 +199,24 @@ Q_OBJECT
int32_t fmRate; // typ. 192 kSpS = InputRate / 12
int32_t workingRate; // typ. 48 kSpS
int32_t audioRate; // typ. 48 kSpS
int lowPassFrequency;
std::atomic<bool> fmAudioFilterActive;
int32_t fmBandwidth;
int32_t fmFilterDegree;

int32_t repeatRate;
int ptyLocale;
bool lfBuffer_newFlag;
RingBuffer<std::complex<float>> *hfBuffer;
RingBuffer<std::complex<float>> *lfBuffer;
RingBuffer<std::complex<float>> *iqBuffer;
std::vector<std::complex<float>> spectrumBuffer_lf;
bool scanning;
int16_t thresHold;

ESqMode squelchMode;
std::vector<std::complex<float>> spectrumBuffer_lf;
double *displayBuffer_lf;
int32_t loFrequency;
std::atomic<bool> running;
int32_t fmBandwidth;
int32_t fmFilterDegree;
std::atomic<bool> newFilter;
bool autoMono;
bool pssActive;

Expand All @@ -224,7 +225,6 @@ Q_OBJECT

bool dumping;
SNDFILE *dumpFile;
int32_t decimatingScale;

int32_t myCount;
DSPFLOAT Lgain;
Expand Down Expand Up @@ -264,11 +264,8 @@ Q_OBJECT
DSPCOMPLEX lastAudioSample;
DSPFLOAT deemphAlpha;
DSPFLOAT volumeFactor;
std::atomic<bool> fmAudioFilterActive;


DSPFLOAT panorama;
int16_t balance;
DSPFLOAT leftChannel; // -(balance - 50.0) / 100.0;;
DSPFLOAT rightChannel; // (balance + 50.0) / 100.0;;
FM_Mode fmModus;
Expand All @@ -284,7 +281,7 @@ Q_OBJECT
int32_t spectrumSampleRate;
int32_t zoomFactor;

SMetaData metaData {};
SMetaData metaData {};

signals:
void setPLLisLocked (bool);
Expand Down
20 changes: 9 additions & 11 deletions includes/output/audiosink.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@
/*
* Copyright (C) 2009, 2010, 2011
* 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 the fm software
*
* SDR-J is free software; you can redistribute it and/or modify
* fm software 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,
* fm software 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 fm software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef __AUDIO_SINK
#define __AUDIO_SINK
#ifndef __AUDIO_SINK_H
#define __AUDIO_SINK_H
#include "fm-constants.h"
#include <sndfile.h>
#include <portaudio.h>
#include "ringbuffer.h"
#include <QString>

#define LOWLATENCY 0100
#define HIGHLATENCY 0200
Expand All @@ -40,7 +38,7 @@ class audioSink {
audioSink (int32_t, int32_t);
~audioSink (void);
int16_t numberofDevices (void);
const char *outputChannelwithRate (int16_t, int32_t);
QString outputChannelwithRate (int16_t, int32_t);
void stop (void);
void restart (void);
int32_t putSample (DSPCOMPLEX);
Expand Down
7 changes: 3 additions & 4 deletions includes/rds/rds-decoder-1.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
#include <cmath>
#include <vector>
#include <fstream>
#include "rds-group.h"
#include "rds-blocksynchronizer.h"
#include "rds-groupdecoder.h"
#include "iir-filters.h"
#include "fir-filters.h"

class RadioInterface;

class rdsDecoder_1 : public QObject {
Q_OBJECT
public:
Expand All @@ -44,9 +43,9 @@ Q_OBJECT
~rdsDecoder_1 ();
bool doDecode (float, uint8_t *);
private:
RadioInterface *myRadioInterface;
BandPassIIR sharpFilter;
LowPassFIR rdsFilter;
RadioInterface *myRadioInterface;

bool previousBit;
std::vector<float> rdsBuffer;
Expand Down
3 changes: 0 additions & 3 deletions includes/rds/rds-decoder-2.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ Q_OBJECT
DSPCOMPLEX & oZ);
RadioInterface *myRadioInterface;
int sampleRate;
RDSGroup *my_rdsGroup;
rdsBlockSynchronizer *my_rdsBlockSync;
rdsGroupDecoder *my_rdsGroupDecoder;
std::vector<float> my_matchedFltKernelVec;
std::vector<DSPCOMPLEX> my_matchedFltBuf;
int16_t my_matchedFltBufIdx;
Expand Down
2 changes: 2 additions & 0 deletions includes/rds/rds-decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "rds-blocksynchronizer.h"
#include "rds-groupdecoder.h"
#include "costas.h"
#include "agc.h"

class RadioInterface;
class rdsDecoder_1;
Expand Down Expand Up @@ -73,6 +74,7 @@ Q_OBJECT
rdsGroupDecoder my_rdsGroupDecoder;
rdsBlockSynchronizer my_rdsBlockSync;
Costas my_costas;
AGC my_AGC;
rdsDecoder_1 *decoder_1;
rdsDecoder_2 *decoder_2;
rdsDecoder_3 *decoder_3;
Expand Down
2 changes: 1 addition & 1 deletion includes/various/iir-filters.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class LowPassIIR : public Basic_IIR {
public:
LowPassIIR (int16_t, int32_t, int32_t, int16_t);
LowPassIIR (int16_t, int16_t, int32_t, int32_t, int32_t);
~LowPassIIR (void);
~LowPassIIR ();
};

class HighPassIIR : public Basic_IIR {
Expand Down
9 changes: 4 additions & 5 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int32_t opt;
/*
* The default values
*/
QSettings *ISettings; /* .ini file */
QSettings *ISettings; /* .ini file */
int32_t outputRate = 48000;
RadioInterface *myRadioInterface;
QString iniFile = QDir::homePath ();
Expand Down Expand Up @@ -75,9 +75,10 @@ ThemeChoser themeChooser;
QGuiApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
#endif

QString styleSheetText = ISettings -> value ("styleSheet", ""). toString();
QString styleSheetText =
ISettings -> value ("styleSheet", ""). toString();
int styleSheet = themeChooser.
get_idx_of_sheet_name (styleSheetText);
get_idx_of_sheet_name (styleSheetText);

themeChooser. set_curr_style_sheet_idx (styleSheet);

Expand All @@ -94,10 +95,8 @@ ThemeChoser themeChooser;

a.setWindowIcon (QIcon (":fm-icon.ico"));
exitCode = a. exec ();
//#ifdef __MINGW32__
delete myRadioInterface;
myRadioInterface = nullptr;
//#endif
} while (exitCode == PROGRAM_RESTART_EXIT_CODE );

/*
Expand Down
Loading

0 comments on commit 5f6ba97

Please sign in to comment.