mirror of
https://github.com/JvanKatwijk/dab-cmdline
synced 2025-10-05 23:52:50 +02:00
some edits
This commit is contained in:
@@ -21,8 +21,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __SDRPLAY_HANDLER_V3__
|
||||
#define __SDRPLAY_HANDLER_V3__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <thread>
|
||||
@@ -46,11 +45,11 @@ public:
|
||||
|
||||
~sdrplayHandler_v3 ();
|
||||
bool restartReader (int32_t);
|
||||
void stopReader (void);
|
||||
void stopReader ();
|
||||
int32_t getSamples (std::complex<float> *, int32_t);
|
||||
int32_t Samples (void);
|
||||
void resetBuffer (void);
|
||||
int16_t bitDepth (void);
|
||||
int32_t Samples ();
|
||||
void resetBuffer ();
|
||||
int16_t bitDepth ();
|
||||
// The following items should be visible from outsize
|
||||
// the callback functions refer to them
|
||||
RingBuffer<std::complex<float>> _I_Buffer;
|
||||
@@ -76,5 +75,4 @@ private:
|
||||
int16_t antenna;
|
||||
int16_t nrBits;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -28,19 +28,19 @@
|
||||
* The class is the abstract sink for the data generated
|
||||
* It will handle the "dumping" though
|
||||
*/
|
||||
audioBase::audioBase (void):
|
||||
audioBase::audioBase ():
|
||||
converter_16 (16000, 48000, 2 * 1600),
|
||||
converter_24 (24000, 48000, 2 * 2400),
|
||||
converter_32 (32000, 48000, 4 * 3200) {
|
||||
}
|
||||
|
||||
audioBase::~audioBase (void) {
|
||||
audioBase::~audioBase () {
|
||||
}
|
||||
|
||||
void audioBase::restart (void) {
|
||||
void audioBase::restart () {
|
||||
}
|
||||
|
||||
void audioBase::stop (void) {
|
||||
void audioBase::stop () {
|
||||
}
|
||||
//
|
||||
// This one is a hack for handling different baudrates coming from
|
||||
@@ -52,12 +52,15 @@ void audioBase::audioOut (int16_t *buffer,
|
||||
case 16000:
|
||||
audioOut_16000 (buffer, amount / 2);
|
||||
return;
|
||||
|
||||
case 24000:
|
||||
audioOut_24000 (buffer, amount / 2);
|
||||
return;
|
||||
|
||||
case 32000:
|
||||
audioOut_32000 (buffer, amount / 2);
|
||||
return;
|
||||
|
||||
default:
|
||||
case 48000:
|
||||
audioOut_48000 (buffer, amount / 2);
|
||||
|
@@ -21,8 +21,8 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_BASE__
|
||||
#define __AUDIO_BASE__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <samplerate.h>
|
||||
#include "newconverter.h"
|
||||
@@ -36,10 +36,10 @@ using namespace std;
|
||||
|
||||
class audioBase {
|
||||
public:
|
||||
audioBase (void);
|
||||
virtual ~audioBase (void);
|
||||
virtual void stop (void);
|
||||
virtual void restart (void);
|
||||
audioBase ();
|
||||
virtual ~audioBase ();
|
||||
virtual void stop ();
|
||||
virtual void restart ();
|
||||
void audioOut (int16_t *, int32_t, int32_t);
|
||||
private:
|
||||
void audioOut_16000 (int16_t *, int32_t);
|
||||
@@ -52,5 +52,5 @@ private:
|
||||
protected:
|
||||
virtual void audioOutput (float *, int32_t);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program of the DAB library
|
||||
* This file is part of the DAB library
|
||||
*
|
||||
* DAB library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -28,7 +28,7 @@
|
||||
audioSink::audioSink (int16_t latency,
|
||||
std::string soundChannel,
|
||||
bool *err):
|
||||
audioBase () {
|
||||
audioBase () {
|
||||
int32_t i;
|
||||
this -> latency = latency;
|
||||
this -> CardRate = 48000;
|
||||
@@ -144,7 +144,7 @@ int16_t odev = 0, i;
|
||||
return true;
|
||||
}
|
||||
|
||||
void audioSink::restart (void) {
|
||||
void audioSink::restart () {
|
||||
PaError err;
|
||||
|
||||
if (!Pa_IsStreamStopped (ostream))
|
||||
@@ -157,7 +157,7 @@ PaError err;
|
||||
writerRunning = true;
|
||||
}
|
||||
|
||||
void audioSink::stop (void) {
|
||||
void audioSink::stop () {
|
||||
if (Pa_IsStreamStopped (ostream))
|
||||
return;
|
||||
|
||||
@@ -231,7 +231,7 @@ const PaDeviceInfo *deviceInfo;
|
||||
return "";
|
||||
}
|
||||
|
||||
int16_t audioSink::invalidDevice (void) {
|
||||
int16_t audioSink::invalidDevice () {
|
||||
return numofDevices + 128;
|
||||
}
|
||||
|
||||
@@ -239,15 +239,15 @@ bool audioSink::isValidDevice (int16_t dev) {
|
||||
return 0 <= dev && dev < numofDevices;
|
||||
}
|
||||
|
||||
bool audioSink::selectDefaultDevice (void) {
|
||||
bool audioSink::selectDefaultDevice () {
|
||||
return selectDevice ("default");
|
||||
}
|
||||
|
||||
int32_t audioSink::cardRate (void) {
|
||||
int32_t audioSink::cardRate () {
|
||||
return 48000;
|
||||
}
|
||||
|
||||
int16_t audioSink::numberofDevices (void) {
|
||||
int16_t audioSink::numberofDevices () {
|
||||
return numofDevices;
|
||||
}
|
||||
|
||||
|
@@ -22,8 +22,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_SINK__
|
||||
#define __AUDIO_SINK__
|
||||
#pragma once
|
||||
|
||||
#include <portaudio.h>
|
||||
#include <stdio.h>
|
||||
#include "audio-base.h"
|
||||
@@ -33,17 +33,17 @@
|
||||
class audioSink : public audioBase {
|
||||
public:
|
||||
audioSink (int16_t, std::string, bool *);
|
||||
~audioSink (void);
|
||||
void stop (void);
|
||||
void restart (void);
|
||||
~audioSink ();
|
||||
void stop ();
|
||||
void restart ();
|
||||
bool selectDevice (const std::string);
|
||||
bool selectDefaultDevice (void);
|
||||
bool selectDefaultDevice ();
|
||||
private:
|
||||
int16_t numberofDevices (void);
|
||||
int16_t numberofDevices ();
|
||||
const char *outputChannelwithRate (int16_t, int32_t);
|
||||
int16_t invalidDevice (void);
|
||||
int16_t invalidDevice ();
|
||||
bool isValidDevice (int16_t);
|
||||
int32_t cardRate (void);
|
||||
int32_t cardRate ();
|
||||
|
||||
bool OutputrateIsSupported (int16_t, int32_t);
|
||||
void audioOutput (float *, int32_t);
|
||||
@@ -68,5 +68,3 @@ static int paCallback_o (const void *input,
|
||||
void *userData);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program for the DAB library
|
||||
* This file is part of the DAB library
|
||||
*
|
||||
* DAB library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
fileSink::fileSink (std::string fileName, bool *success) {
|
||||
SF_INFO sf_info;
|
||||
fprintf (stderr, "fase 1\n");
|
||||
|
||||
sf_info. samplerate = 48000;
|
||||
sf_info. channels = 2;
|
||||
sf_info. format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
||||
@@ -40,18 +40,18 @@ SF_INFO sf_info;
|
||||
}
|
||||
fprintf (stderr, "Opened %s\n", fileName. c_str ());
|
||||
*success = true;
|
||||
audioOK = *success;
|
||||
audioOK = *success;
|
||||
}
|
||||
|
||||
fileSink::~fileSink (void) {
|
||||
fileSink::~fileSink () {
|
||||
if (audioOK)
|
||||
sf_close (outputFile);
|
||||
}
|
||||
|
||||
void fileSink::stop (void) {
|
||||
void fileSink::stop () {
|
||||
}
|
||||
|
||||
void fileSink::restart (void) {
|
||||
void fileSink::restart () {
|
||||
}
|
||||
|
||||
void fileSink::audioOutput (float *buffer, int32_t amount) {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the main program of the DAB library
|
||||
* This file is part of the DAB library
|
||||
*
|
||||
* DAB library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -45,7 +45,7 @@ int err;
|
||||
inp = 0;
|
||||
}
|
||||
|
||||
newConverter::~newConverter (void) {
|
||||
newConverter::~newConverter () {
|
||||
src_delete (converter);
|
||||
delete [] inBuffer;
|
||||
delete [] outBuffer;
|
||||
@@ -79,7 +79,7 @@ int res;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t newConverter::getOutputsize (void) {
|
||||
int32_t newConverter::getOutputsize () {
|
||||
return outputLimit;
|
||||
}
|
||||
|
||||
|
@@ -37,5 +37,5 @@ FIND_LIBRARY(
|
||||
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3f DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
|
||||
MARK_AS_ADVANCED(FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS FFTW3F_THREADS_LIBRARIES)
|
@@ -66,8 +66,10 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __RINGBUFFER
|
||||
#define __RINGBUFFER
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -135,15 +137,13 @@ volatile uint32_t readIndex;
|
||||
char *buffer;
|
||||
public:
|
||||
RingBuffer (uint32_t elementCount) {
|
||||
if (((elementCount - 1) & elementCount) != 0)
|
||||
elementCount = 2 * 16384; /* default */
|
||||
|
||||
bufferSize = elementCount;
|
||||
bufferSize = checkVal (elementCount);
|
||||
buffer = new char [2 * bufferSize * sizeof (elementtype)];
|
||||
writeIndex = 0;
|
||||
readIndex = 0;
|
||||
smallMask = (elementCount)- 1;
|
||||
bigMask = (elementCount * 2) - 1;
|
||||
smallMask = (bufferSize)- 1;
|
||||
bigMask = (bufferSize * 2) - 1;
|
||||
}
|
||||
|
||||
~RingBuffer () {
|
||||
@@ -316,6 +316,14 @@ int32_t skipDataInBuffer (uint32_t n_values) {
|
||||
return n_values;
|
||||
}
|
||||
|
||||
int32_t checkVal (int32_t V) {
|
||||
if ((V & (V - 1)) == 0)
|
||||
return V;
|
||||
int val = 1;
|
||||
while (val < V)
|
||||
val <<= 1;
|
||||
return val;
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
@@ -20,8 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __AUDIO_BACKEND__
|
||||
#define __AUDIO_BACKEND__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <thread>
|
||||
@@ -73,5 +72,3 @@ private:
|
||||
backendBase *our_backendBase;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -21,8 +21,7 @@
|
||||
*
|
||||
*/
|
||||
#
|
||||
#ifndef __BACKEND_BASE__
|
||||
#define __BACKEND_BASE__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -33,9 +32,8 @@
|
||||
|
||||
class backendBase {
|
||||
public:
|
||||
backendBase (void);
|
||||
virtual ~backendBase (void);
|
||||
backendBase ();
|
||||
virtual ~backendBase ();
|
||||
virtual void addtoFrame (uint8_t *);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -22,8 +22,7 @@
|
||||
* This charset handling was kindly added by Przemyslaw Wegrzyn
|
||||
* all rights acknowledged
|
||||
*/
|
||||
#ifndef __CHARSETS_H__
|
||||
#define __CHARSETS_H__
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
@@ -49,5 +48,3 @@ typedef enum {
|
||||
std::string toStringUsingCharset(const char* buffer,
|
||||
CharacterSet charset, int size = -1);
|
||||
|
||||
#endif // CHARSETS_H
|
||||
|
||||
|
@@ -20,8 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __DATA_BACKEND__
|
||||
#define __DATA_BACKEND__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <thread>
|
||||
@@ -41,8 +40,8 @@ public:
|
||||
dataBackend (packetdata *, API_struct *, void *);
|
||||
~dataBackend ();
|
||||
int32_t process (int16_t *, int16_t);
|
||||
void stopRunning (void);
|
||||
void start (void);
|
||||
void stopRunning ();
|
||||
void start ();
|
||||
private:
|
||||
int16_t fragmentSize;
|
||||
int16_t bitRate;
|
||||
@@ -67,5 +66,3 @@ void run (void);
|
||||
backendBase *our_backendBase;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -25,8 +25,8 @@
|
||||
// within the DAB/DAB+ sdr-j receiver software
|
||||
// all rights are acknowledged.
|
||||
//
|
||||
#ifndef FIRECODE_CHECKER
|
||||
#define FIRECODE_CHECKER
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -42,5 +42,3 @@ private:
|
||||
static const uint8_t g[16];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -2,13 +2,9 @@
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* Many of the ideas as implemented in DAB-library are derived from
|
||||
* other work, made available through the GNU general Public License.
|
||||
* All copyrights of the original authors are recognized.
|
||||
*
|
||||
* DAB-library 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
|
||||
@@ -24,8 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __GALOIS
|
||||
#define __GALOIS
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -54,5 +49,4 @@ public:
|
||||
uint16_t inverse_poly (uint16_t a);
|
||||
uint16_t inverse_power (uint16_t a);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -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 <stdint.h>
|
||||
#include "galois.h"
|
||||
@@ -40,4 +39,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
|
||||
|
@@ -20,28 +20,24 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __VIRTUAL_BACKEND__
|
||||
#define __VIRTUAL_BACKEND__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define CUSize (4 * 16)
|
||||
|
||||
class virtualBackend {
|
||||
public:
|
||||
virtualBackend (int16_t, int16_t);
|
||||
virtual ~virtualBackend (void);
|
||||
virtual ~virtualBackend ();
|
||||
virtual int32_t process (int16_t *, int16_t);
|
||||
virtual void stopRunning (void);
|
||||
virtual void stop (void);
|
||||
int16_t startAddr (void);
|
||||
int16_t Length (void);
|
||||
virtual void stopRunning ();
|
||||
virtual void stop ();
|
||||
int16_t startAddr ();
|
||||
int16_t Length ();
|
||||
protected:
|
||||
int16_t startAddress;
|
||||
int16_t segmentLength;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -23,8 +23,7 @@
|
||||
// Common definitions and includes for
|
||||
// the DAB decoder
|
||||
|
||||
#ifndef __DAB_CONSTANTS__
|
||||
#define __DAB_CONSTANTS__
|
||||
#pragma once
|
||||
#
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
@@ -51,8 +50,8 @@
|
||||
#undef min
|
||||
#undef max
|
||||
extern "C" {
|
||||
void sleep(int);
|
||||
void usleep(int usec);
|
||||
void sleep (int);
|
||||
void usleep (int usec);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
@@ -126,7 +125,10 @@ float re = real (z);
|
||||
float im = imag (z);
|
||||
if (re < 0) re = - re;
|
||||
if (im < 0) im = - im;
|
||||
return re + im;
|
||||
if (re > im)
|
||||
return re + 0.5 * im;
|
||||
else
|
||||
return im + 0.5 * re;
|
||||
}
|
||||
//
|
||||
|
||||
@@ -345,5 +347,4 @@ uint16_t genpoly = 0x1021;
|
||||
crc = ~((msg [len] << 8) | msg [len + 1]) & 0xFFFF;
|
||||
return (crc ^ accumulator) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -21,8 +21,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __DAB_PROCESSOR__
|
||||
#define __DAB_PROCESSOR__
|
||||
#pragma once
|
||||
/*
|
||||
*
|
||||
*/
|
||||
@@ -58,21 +57,23 @@ public:
|
||||
bool signalSeemsGood ();
|
||||
void show_Corrector (int);
|
||||
// inheriting from our delegates
|
||||
void setSelectedService (std::string);
|
||||
uint8_t kindofService (std::string);
|
||||
void dataforAudioService (std::string, audiodata *);
|
||||
void dataforAudioService (std::string,
|
||||
void setSelectedService (const std::string &);
|
||||
uint8_t kindofService (const std::string &);
|
||||
void dataforAudioService (const std::string &,
|
||||
audiodata *);
|
||||
void dataforAudioService (const std::string &,
|
||||
audiodata *, int16_t);
|
||||
void dataforDataService (std::string, packetdata *);
|
||||
void dataforDataService (std::string,
|
||||
void dataforDataService (const std::string &,
|
||||
packetdata *);
|
||||
void dataforDataService (const std::string &,
|
||||
packetdata *, int16_t);
|
||||
int32_t get_SId (std::string s);
|
||||
int32_t get_SId (const std::string &s);
|
||||
std::string get_serviceName (int32_t);
|
||||
void set_audioChannel (audiodata *);
|
||||
void set_dataChannel (packetdata *);
|
||||
std::string get_ensembleName (void);
|
||||
void clearEnsemble (void);
|
||||
void reset_msc (void);
|
||||
std::string get_ensembleName ();
|
||||
void clearEnsemble ();
|
||||
void reset_msc ();
|
||||
private:
|
||||
deviceHandler *inputDevice;
|
||||
dabParams params;
|
||||
@@ -102,7 +103,6 @@ private:
|
||||
int32_t carrierDiff;
|
||||
bool wasSecond (int16_t, dabParams *);
|
||||
int tii_counter;
|
||||
virtual void run (void);
|
||||
virtual void run ();
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
@@ -20,8 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __FIB_PROCESSOR__
|
||||
#define __FIB_PROCESSOR__
|
||||
#pragma once
|
||||
#
|
||||
//
|
||||
#include <stdint.h>
|
||||
@@ -92,19 +91,21 @@ class fib_processor {
|
||||
public:
|
||||
fib_processor (API_struct *,
|
||||
void *);
|
||||
~fib_processor (void);
|
||||
~fib_processor ();
|
||||
void process_FIB (uint8_t *, uint16_t);
|
||||
|
||||
void setupforNewFrame (void);
|
||||
void clearEnsemble (void);
|
||||
bool syncReached (void);
|
||||
void setupforNewFrame ();
|
||||
void clearEnsemble ();
|
||||
bool syncReached ();
|
||||
std::string nameFor (int32_t);
|
||||
int32_t SIdFor (std::string &);
|
||||
uint8_t kindofService (std::string &);
|
||||
void dataforAudioService (std::string &, audiodata *);
|
||||
void dataforDataService (std::string &, packetdata *);
|
||||
void dataforAudioService (std::string &, audiodata *, int16_t);
|
||||
void dataforDataService (std::string &, packetdata *, int16_t);
|
||||
int32_t SIdFor (const std::string &);
|
||||
uint8_t kindofService (const std::string &);
|
||||
void dataforAudioService (const std::string &, audiodata *);
|
||||
void dataforDataService (const std::string &, packetdata *);
|
||||
void dataforAudioService (const std::string &,
|
||||
audiodata *, int16_t);
|
||||
void dataforDataService (const std::string &,
|
||||
packetdata *, int16_t);
|
||||
|
||||
std::complex<float>
|
||||
get_coordinates (int16_t, int16_t, bool *);
|
||||
@@ -184,5 +185,3 @@ private:
|
||||
void changeinConfiguration (void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -24,8 +24,7 @@
|
||||
/*
|
||||
* FIC data
|
||||
*/
|
||||
#ifndef __FIC_HANDLER__
|
||||
#define __FIC_HANDLER__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -42,19 +41,21 @@ class ficHandler: public viterbiSpiral {
|
||||
public:
|
||||
ficHandler (API_struct *,
|
||||
void *);
|
||||
~ficHandler (void);
|
||||
~ficHandler ();
|
||||
void process_ficBlock (std::vector<int16_t>, int16_t);
|
||||
void clearEnsemble (void);
|
||||
bool syncReached (void);
|
||||
int16_t get_ficRatio (void);
|
||||
void clearEnsemble ();
|
||||
bool syncReached ();
|
||||
int16_t get_ficRatio ();
|
||||
std::string nameFor (int32_t);
|
||||
int32_t SIdFor (std::string &);
|
||||
uint8_t kindofService (std::string &);
|
||||
void dataforDataService (std::string &, packetdata *, int);
|
||||
void dataforAudioService (std::string &, audiodata *, int);
|
||||
int32_t SIdFor (const std::string &);
|
||||
uint8_t kindofService (const std::string &);
|
||||
void dataforDataService (const std::string &,
|
||||
packetdata *, int);
|
||||
void dataforAudioService (const std::string &,
|
||||
audiodata *, int);
|
||||
//
|
||||
int32_t get_CIFcount (void);
|
||||
void reset (void);
|
||||
int32_t get_CIFcount ();
|
||||
void reset ();
|
||||
|
||||
private:
|
||||
fib_processor fibProcessor;
|
||||
@@ -78,6 +79,3 @@ private:
|
||||
void show_ficCRC (bool);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2016, 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
@@ -18,11 +18,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DAB-library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#
|
||||
#ifndef __FREQ_INTERLEAVER__
|
||||
#define __FREQ_INTERLEAVER__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "dab-constants.h"
|
||||
#include "dab-params.h"
|
||||
@@ -35,7 +34,7 @@
|
||||
class interLeaver {
|
||||
public:
|
||||
interLeaver (uint8_t);
|
||||
~interLeaver (void);
|
||||
~interLeaver ();
|
||||
int16_t mapIn (int16_t);
|
||||
private:
|
||||
dabParams params;
|
||||
@@ -44,5 +43,3 @@ private:
|
||||
int16_t *permTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -20,8 +20,7 @@
|
||||
* along with DAB-library; 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 <stdint.h>
|
||||
#include <vector>
|
||||
@@ -40,7 +39,8 @@ public:
|
||||
RingBuffer<std::complex<float>> *);
|
||||
~ofdmDecoder (void);
|
||||
void processBlock_0 (std::complex<float> *);
|
||||
void decode (std::complex<float> *, int32_t n, int16_t *);
|
||||
void decode (std::complex<float> *,
|
||||
int32_t n, int16_t *);
|
||||
private:
|
||||
dabParams params;
|
||||
fft_handler my_fftHandler;
|
||||
@@ -52,12 +52,9 @@ private:
|
||||
int32_t T_g;
|
||||
int32_t carriers;
|
||||
int32_t nrBlocks;
|
||||
int16_t getMiddle (void);
|
||||
int16_t getMiddle ();
|
||||
std::vector <complex<float> > phaseReference;
|
||||
std::complex<float> *fft_buffer;
|
||||
int32_t blockIndex;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -21,8 +21,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __PHASEREFERENCE__
|
||||
#define __PHASEREFERENCE__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -35,7 +34,7 @@
|
||||
class phaseReference : public phaseTable {
|
||||
public:
|
||||
phaseReference (uint8_t, int16_t);
|
||||
~phaseReference (void);
|
||||
~phaseReference ();
|
||||
int32_t findIndex (std::complex<float> *, int);
|
||||
int16_t estimateOffset (std::complex<float> *);
|
||||
private:
|
||||
@@ -49,5 +48,4 @@ private:
|
||||
fft_handler my_fftHandler;
|
||||
std::complex<float> *fft_buffer;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -18,11 +18,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DAB-library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#
|
||||
#ifndef __PHASE_TABLE__
|
||||
#define __PHASE_TABLE__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -38,13 +36,12 @@ struct phasetableElement {
|
||||
class phaseTable {
|
||||
public:
|
||||
phaseTable (int16_t);
|
||||
~phaseTable (void);
|
||||
float get_Phi (int32_t);
|
||||
~phaseTable ();
|
||||
float get_Phi (int32_t);
|
||||
private:
|
||||
|
||||
struct phasetableElement *currentTable;
|
||||
int16_t Mode;
|
||||
int32_t h_table (int32_t i, int32_t j);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -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
|
||||
@@ -43,7 +42,7 @@ public:
|
||||
deviceHandler *theRig,
|
||||
RingBuffer<std::complex<float>> *spectrumBuffer);
|
||||
|
||||
~sampleReader (void);
|
||||
~sampleReader ();
|
||||
void setRunning (bool b);
|
||||
float get_sLevel (void);
|
||||
void reset (void);
|
||||
@@ -64,4 +63,3 @@ private:
|
||||
int32_t corrector;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -21,8 +21,7 @@
|
||||
* 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"
|
||||
@@ -32,8 +31,8 @@
|
||||
class TII_Detector {
|
||||
public:
|
||||
TII_Detector (uint8_t dabMode);
|
||||
~TII_Detector();
|
||||
void reset();
|
||||
~TII_Detector ();
|
||||
void reset ();
|
||||
void addBuffer (std::vector<std::complex<float>>);
|
||||
uint16_t processNULL ();
|
||||
|
||||
@@ -51,5 +50,4 @@ private:
|
||||
std::vector<float> window;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -1,6 +1,26 @@
|
||||
|
||||
#ifndef __TIMESYNCER__
|
||||
#define __TIMESYNCER__
|
||||
#
|
||||
/*
|
||||
* Copyright (C) 2014
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB library
|
||||
* DAB library 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.
|
||||
*
|
||||
* DAB library 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 DAB library; 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"
|
||||
|
||||
@@ -13,12 +33,12 @@ class sampleReader;
|
||||
class timeSyncer {
|
||||
public:
|
||||
timeSyncer (sampleReader *mr);
|
||||
~timeSyncer (void);
|
||||
~timeSyncer ();
|
||||
int sync (int, int);
|
||||
private:
|
||||
sampleReader *myReader;
|
||||
int32_t syncBufferIndex = 0;
|
||||
const int32_t syncBufferSize = 4096;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -4,24 +4,25 @@
|
||||
* 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
|
||||
* This file is part of the dab library
|
||||
|
||||
* dab library 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,
|
||||
* dab library 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
|
||||
* along with dab library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __BANDHANDLER__
|
||||
#define __BANDHANDLER__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
//
|
||||
@@ -33,11 +34,10 @@
|
||||
|
||||
class bandHandler {
|
||||
public:
|
||||
bandHandler (void);
|
||||
~bandHandler (void);
|
||||
int32_t Frequency (uint8_t band, std::string Channel);
|
||||
std::string nextChannel (uint8_t dabBand, std::string Channel);
|
||||
bandHandler ();
|
||||
~bandHandler ();
|
||||
int32_t Frequency (uint8_t band, std::string Channel);
|
||||
std::string nextChannel (uint8_t dabBand, std::string Channel);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -2,43 +2,42 @@
|
||||
/*
|
||||
* Copyright (C) 2013, 2014, 2015, 2016, 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the Qt-DAB (formerly SDR-J, JSDR).
|
||||
* This file is part of the DAB library
|
||||
*
|
||||
* Qt-DAB is free software; you can redistribute it and/or modify
|
||||
* DAB library 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,
|
||||
* DAB library 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
|
||||
* along with DAB ;ibrary; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __DAB_PARAMS__
|
||||
#define __DAB_PARAMS__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class dabParams {
|
||||
public:
|
||||
dabParams (uint8_t);
|
||||
~dabParams (void);
|
||||
int16_t get_dabMode (void);
|
||||
int16_t get_L (void);
|
||||
int16_t get_carriers (void);
|
||||
int16_t get_T_null (void);
|
||||
int16_t get_T_s (void);
|
||||
int16_t get_T_u (void);
|
||||
int16_t get_T_g (void);
|
||||
int32_t get_T_F (void);
|
||||
int32_t get_carrierDiff (void);
|
||||
dabParams (uint8_t);
|
||||
~dabParams ();
|
||||
int16_t get_dabMode ();
|
||||
int16_t get_L ();
|
||||
int16_t get_carriers ();
|
||||
int16_t get_T_null ();
|
||||
int16_t get_T_s ();
|
||||
int16_t get_T_u ();
|
||||
int16_t get_T_g ();
|
||||
int32_t get_T_F ();
|
||||
int32_t get_carrierDiff ();
|
||||
private:
|
||||
uint8_t dabMode;
|
||||
int16_t L;
|
||||
@@ -51,5 +50,3 @@ private:
|
||||
int16_t carrierDiff;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -1,6 +1,27 @@
|
||||
#
|
||||
#ifndef __SEMAPHORE
|
||||
#define __SEMAPHORE
|
||||
/*
|
||||
* Copyright (C) 2014
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB library
|
||||
* DAB library 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.
|
||||
*
|
||||
* DAB library 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 DAB library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
@@ -12,15 +33,15 @@ private:
|
||||
condition_variable cv;
|
||||
int count;
|
||||
public:
|
||||
Semaphore (int count_ = 0) : count {count_} {}
|
||||
Semaphore (int count_ = 0) : count {count_} {}
|
||||
|
||||
void Release (void) {
|
||||
void Release () {
|
||||
std::unique_lock<mutex>lck (mtx);
|
||||
++count;
|
||||
cv. notify_one ();
|
||||
}
|
||||
|
||||
void acquire (void) {
|
||||
void acquire () {
|
||||
unique_lock <mutex> lck (mtx);
|
||||
while (count == 0) {
|
||||
cv. wait (lck);
|
||||
@@ -40,4 +61,3 @@ bool tryAcquire (int delay) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
@@ -20,8 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __EEP_PROTECTION__
|
||||
#define __EEP_PROTECTION__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -31,9 +30,8 @@
|
||||
class eep_protection: public protection {
|
||||
public:
|
||||
eep_protection (int16_t, int16_t);
|
||||
~eep_protection (void);
|
||||
~eep_protection ();
|
||||
bool deconvolve (int16_t *, int32_t, uint8_t *);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 20014 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* Many of the ideas as implemented in DAB-cmdline are derived from
|
||||
@@ -22,11 +22,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DAB-library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ENSEMBLE_HANDLER__
|
||||
#define __ENSEMBLE_HANDLER__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -36,22 +34,21 @@
|
||||
|
||||
class ensembleHandler {
|
||||
public:
|
||||
ensembleHandler (void);
|
||||
~ensembleHandler (void);
|
||||
ensembleHandler ();
|
||||
~ensembleHandler ();
|
||||
void addtoEnsemble (const std::string &, int32_t);
|
||||
void nameforEnsemble (int id, const std::string &s);
|
||||
std::string nameofEnsemble (void);
|
||||
bool ensembleExists (void);
|
||||
std::string nameofEnsemble ();
|
||||
bool ensembleExists ();
|
||||
std::string findService (const std::string &);
|
||||
std::string findService (int32_t);
|
||||
std::string getProgram (int16_t);
|
||||
void clearEnsemble (void);
|
||||
std::list<std::string> data (void);
|
||||
int size (void);
|
||||
void clearEnsemble ();
|
||||
std::list<std::string> data ();
|
||||
int size ();
|
||||
private:
|
||||
std::list<std::string> stationList;
|
||||
std::string ensembleName;
|
||||
bool ensembleFound = false;
|
||||
std::mutex locker;
|
||||
};
|
||||
#endif
|
||||
|
@@ -21,8 +21,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __FFT_HANDLER__
|
||||
#define __FFT_HANDLER__
|
||||
#pragma once
|
||||
//
|
||||
// Simple wrapper around fftwf
|
||||
#include "dab-constants.h"
|
||||
@@ -33,10 +32,10 @@
|
||||
class fft_handler {
|
||||
public:
|
||||
fft_handler (uint8_t);
|
||||
~fft_handler (void);
|
||||
complex<float> *getVector (void);
|
||||
void do_FFT (void);
|
||||
void do_iFFT (void);
|
||||
~fft_handler ();
|
||||
complex<float> *getVector ();
|
||||
void do_FFT ();
|
||||
void do_iFFT ();
|
||||
private:
|
||||
dabParams p;
|
||||
int32_t fftSize;
|
||||
@@ -44,5 +43,4 @@ private:
|
||||
fftwf_plan plan;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2016
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
@@ -18,15 +18,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DAB-library; 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 <stdint.h>
|
||||
|
||||
int8_t *get_PCodes (int16_t);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -22,8 +22,7 @@
|
||||
*
|
||||
* Simple base class for combining uep and eep deconvolvers
|
||||
*/
|
||||
#ifndef __PROTECTION__
|
||||
#define __PROTECTION__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
@@ -34,7 +33,7 @@ class protection: public viterbiSpiral {
|
||||
//class protection: public viterbiHandler {
|
||||
public:
|
||||
protection (int16_t, int16_t);
|
||||
virtual ~protection (void);
|
||||
virtual ~protection ();
|
||||
virtual bool deconvolve (int16_t *, int32_t, uint8_t *);
|
||||
protected:
|
||||
int16_t bitRate;
|
||||
@@ -42,5 +41,4 @@ protected:
|
||||
std::vector<uint8_t> indexTable;
|
||||
std::vector<int16_t> viterbiBlock;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -4,22 +4,24 @@
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the Qt-DAB
|
||||
* This file is part of the DAB library
|
||||
*
|
||||
* Qt-DAB is free software; you can redistribute it and/or modify
|
||||
* DAB library 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,
|
||||
* DAB library 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
|
||||
* along with DAB library; 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>
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013 .. 2017
|
||||
* Jan van Katwijk (J.vanKatwijk@gmail.com)
|
||||
* Lazy Chair Programming
|
||||
* Lazy Chair Computing
|
||||
*
|
||||
* This file is part of the DAB-library
|
||||
* DAB-library is free software; you can redistribute it and/or modify
|
||||
@@ -20,8 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#
|
||||
#ifndef __UEP_PROTECTION__
|
||||
#define __UEP_PROTECTION__
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -29,10 +28,9 @@
|
||||
|
||||
class uep_protection: public protection {
|
||||
public:
|
||||
uep_protection (int16_t, int16_t);
|
||||
~uep_protection (void);
|
||||
uep_protection (int16_t, int16_t);
|
||||
~uep_protection ();
|
||||
bool deconvolve (int16_t *, int32_t, uint8_t *);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -21,8 +21,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __VITERBI_HANDLER__
|
||||
#define __VITERBI_HANDLER__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -30,7 +29,7 @@ class viterbiHandler {
|
||||
|
||||
public:
|
||||
viterbiHandler (int);
|
||||
~viterbiHandler (void);
|
||||
~viterbiHandler ();
|
||||
void deconvolve (int16_t *, uint8_t *);
|
||||
private:
|
||||
int costTable [16];
|
||||
@@ -42,6 +41,3 @@ private:
|
||||
int **history;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -140,7 +140,7 @@ void WriteAudioMuxLengthBytes () {
|
||||
aac_quality = 0;
|
||||
}
|
||||
|
||||
mp4Processor::~mp4Processor (void) {
|
||||
mp4Processor::~mp4Processor () {
|
||||
}
|
||||
//
|
||||
// we add vector for vector to the superframe. Once we have
|
||||
|
@@ -73,7 +73,7 @@
|
||||
stop ();
|
||||
}
|
||||
|
||||
void dabProcessor::start (void) {
|
||||
void dabProcessor::start () {
|
||||
if (running. load ())
|
||||
return;
|
||||
threadHandle = std::thread (&dabProcessor::run, this);
|
||||
@@ -87,7 +87,7 @@ void dabProcessor::start (void) {
|
||||
* and sending them to the ofdmDecoder who will transfer the results
|
||||
* Finally, estimating the small freqency error
|
||||
*/
|
||||
void dabProcessor::run (void) {
|
||||
void dabProcessor::run () {
|
||||
std::complex<float> FreqCorr;
|
||||
timeSyncer myTimeSyncer (&myReader);
|
||||
int32_t i;
|
||||
@@ -285,12 +285,12 @@ SyncOnPhase:
|
||||
// fprintf (stderr, "dabProcessor is shutting down\n");
|
||||
}
|
||||
|
||||
void dabProcessor:: reset (void) {
|
||||
void dabProcessor:: reset () {
|
||||
stop ();
|
||||
start ();
|
||||
}
|
||||
|
||||
void dabProcessor::stop (void) {
|
||||
void dabProcessor::stop () {
|
||||
if (running. load ()) {
|
||||
running. store (false);
|
||||
myReader. setRunning (false);
|
||||
@@ -311,38 +311,44 @@ void dabProcessor::show_Corrector (int freqOffset) {
|
||||
freqOffset, userData);
|
||||
}
|
||||
|
||||
bool dabProcessor::signalSeemsGood (void) {
|
||||
bool dabProcessor::signalSeemsGood () {
|
||||
return isSynced;
|
||||
}
|
||||
//
|
||||
// to be handled by delegates
|
||||
uint8_t dabProcessor::kindofService (std::string s) {
|
||||
return my_ficHandler. kindofService (s);
|
||||
uint8_t dabProcessor::kindofService (const std::string &s) {
|
||||
std::string ss = s;
|
||||
return my_ficHandler. kindofService (ss);
|
||||
}
|
||||
|
||||
void dabProcessor::dataforAudioService (std::string s,audiodata *dd) {
|
||||
my_ficHandler. dataforAudioService (s, dd, 0);
|
||||
void dabProcessor::dataforAudioService (const std::string &s,
|
||||
audiodata *dd) {
|
||||
std::string ss = s;
|
||||
my_ficHandler. dataforAudioService (ss, dd, 0);
|
||||
}
|
||||
|
||||
void dabProcessor::dataforAudioService (std::string s,
|
||||
void dabProcessor::dataforAudioService (const std::string &s,
|
||||
audiodata *d, int16_t c) {
|
||||
my_ficHandler. dataforAudioService (s, d, c);
|
||||
std:string ss = s;
|
||||
my_ficHandler. dataforAudioService (ss, d, c);
|
||||
}
|
||||
|
||||
void dabProcessor::dataforDataService (std::string s,
|
||||
void dabProcessor::dataforDataService (const std::string &s,
|
||||
packetdata *d, int16_t c) {
|
||||
my_ficHandler. dataforDataService (s, d, c);
|
||||
std::string ss = s;
|
||||
my_ficHandler. dataforDataService (ss, d, c);
|
||||
}
|
||||
|
||||
int32_t dabProcessor::get_SId (std::string s) {
|
||||
return my_ficHandler. SIdFor (s);
|
||||
int32_t dabProcessor::get_SId (const std::string &s) {
|
||||
std::string ss = s;
|
||||
return my_ficHandler. SIdFor (ss);
|
||||
}
|
||||
|
||||
std::string dabProcessor::get_serviceName (int32_t SId) {
|
||||
return my_ficHandler. nameFor (SId);
|
||||
}
|
||||
|
||||
void dabProcessor::reset_msc (void) {
|
||||
void dabProcessor::reset_msc () {
|
||||
my_mscHandler. reset ();
|
||||
}
|
||||
|
||||
@@ -355,7 +361,7 @@ void dabProcessor::set_dataChannel (packetdata *d) {
|
||||
my_mscHandler. set_dataChannel (d);
|
||||
}
|
||||
|
||||
void dabProcessor::clearEnsemble (void) {
|
||||
void dabProcessor::clearEnsemble () {
|
||||
my_ficHandler. reset ();
|
||||
}
|
||||
|
||||
|
@@ -111,7 +111,7 @@
|
||||
reset ();
|
||||
}
|
||||
|
||||
fib_processor::~fib_processor (void) {
|
||||
fib_processor::~fib_processor () {
|
||||
}
|
||||
//
|
||||
// FIB's are segments of 256 bits. When here, they already
|
||||
@@ -1121,7 +1121,7 @@ char label [17];
|
||||
|
||||
// tricky: the names in the directoty contain spaces at the end
|
||||
static
|
||||
int compareNames (std::string in, std::string ref) {
|
||||
int compareNames (const std::string in, const std::string ref) {
|
||||
|
||||
if (ref == in)
|
||||
return FULL_MATCH;
|
||||
@@ -1170,7 +1170,7 @@ int16_t i;
|
||||
// However, in case of servicenames where one is a prefix
|
||||
// of the other, the full match should have precedence over the
|
||||
// prefix match
|
||||
serviceId *fib_processor::findServiceId (std::string serviceName) {
|
||||
serviceId *fib_processor::findServiceId (const std::string serviceName) {
|
||||
int16_t i;
|
||||
int indexforprefixMatch = -1;
|
||||
|
||||
@@ -1300,14 +1300,14 @@ int16_t firstFree = -1;
|
||||
ServiceComps [firstFree]. is_madePublic = false;
|
||||
}
|
||||
|
||||
void fib_processor::setupforNewFrame (void) {
|
||||
void fib_processor::setupforNewFrame () {
|
||||
int16_t i;
|
||||
isSynced = false;
|
||||
for (i = 0; i < 64; i ++)
|
||||
ServiceComps [i]. inUse = false;
|
||||
}
|
||||
|
||||
void fib_processor::clearEnsemble (void) {
|
||||
void fib_processor::clearEnsemble () {
|
||||
int16_t i;
|
||||
|
||||
setupforNewFrame ();
|
||||
@@ -1323,7 +1323,7 @@ int16_t i;
|
||||
firstTime = true;
|
||||
}
|
||||
|
||||
std::string fib_processor::nameFor (int32_t serviceId) {
|
||||
std::string fib_processor::nameFor (const int32_t serviceId) {
|
||||
int16_t i;
|
||||
|
||||
for (i = 0; i < 64; i ++) {
|
||||
@@ -1340,7 +1340,7 @@ int16_t i;
|
||||
return "no service found";
|
||||
}
|
||||
|
||||
int32_t fib_processor::SIdFor (std::string &name) {
|
||||
int32_t fib_processor::SIdFor (const std::string &name) {
|
||||
int16_t i;
|
||||
int serviceIndex = -1;
|
||||
|
||||
@@ -1368,7 +1368,7 @@ int serviceIndex = -1;
|
||||
}
|
||||
//
|
||||
// Here we look for a primary service only
|
||||
uint8_t fib_processor::kindofService (std::string &s) {
|
||||
uint8_t fib_processor::kindofService (const std::string &s) {
|
||||
int16_t i, j;
|
||||
int16_t service = UNKNOWN_SERVICE;
|
||||
int32_t selectedService = -1;
|
||||
@@ -1423,11 +1423,12 @@ int serviceIndex = -1;
|
||||
return service;
|
||||
}
|
||||
|
||||
void fib_processor::dataforDataService (std::string &s, packetdata *d) {
|
||||
void fib_processor::dataforDataService (const std::string &s,
|
||||
packetdata *d) {
|
||||
dataforDataService (s, d, 0);
|
||||
}
|
||||
|
||||
void fib_processor::dataforDataService (std::string &s,
|
||||
void fib_processor::dataforDataService (const std::string &s,
|
||||
packetdata *d,
|
||||
int16_t compnr) {
|
||||
int16_t j;
|
||||
@@ -1472,11 +1473,12 @@ serviceId *selectedService;
|
||||
fibLocker. unlock ();
|
||||
}
|
||||
|
||||
void fib_processor::dataforAudioService (std::string &s, audiodata *d) {
|
||||
void fib_processor::dataforAudioService (const std::string &s,
|
||||
audiodata *d) {
|
||||
dataforAudioService (s, d, 0);
|
||||
}
|
||||
|
||||
void fib_processor::dataforAudioService (std::string &s,
|
||||
void fib_processor::dataforAudioService (const std::string &s,
|
||||
audiodata *d, int16_t compnr) {
|
||||
int16_t j;
|
||||
serviceId *selectedService;
|
||||
@@ -1536,14 +1538,14 @@ void fib_processor::nameofEnsemble (int id, const std::string &s) {
|
||||
isSynced = true;
|
||||
}
|
||||
|
||||
void fib_processor::changeinConfiguration (void) {
|
||||
void fib_processor::changeinConfiguration () {
|
||||
}
|
||||
|
||||
bool fib_processor::syncReached (void) {
|
||||
bool fib_processor::syncReached () {
|
||||
return isSynced;
|
||||
}
|
||||
|
||||
void fib_processor::reset (void) {
|
||||
void fib_processor::reset () {
|
||||
dateFlag = false;
|
||||
clearEnsemble ();
|
||||
}
|
||||
|
@@ -206,7 +206,7 @@ void ficHandler::clearEnsemble (void) {
|
||||
fibProtector. unlock ();
|
||||
}
|
||||
|
||||
uint8_t ficHandler::kindofService (std::string &s) {
|
||||
uint8_t ficHandler::kindofService (const std::string &s) {
|
||||
uint8_t result;
|
||||
fibProtector. lock ();
|
||||
result = fibProcessor. kindofService (s);
|
||||
@@ -214,28 +214,30 @@ uint8_t result;
|
||||
return result;
|
||||
}
|
||||
|
||||
void ficHandler::dataforAudioService (std::string &s, audiodata *d, int c) {
|
||||
void ficHandler::dataforAudioService (const std::string &s,
|
||||
audiodata *d, int c) {
|
||||
fibProtector. lock ();
|
||||
fibProcessor. dataforAudioService (s, d, c);
|
||||
fibProtector. unlock ();
|
||||
}
|
||||
|
||||
void ficHandler::dataforDataService (std::string &s, packetdata *d, int c) {
|
||||
void ficHandler::dataforDataService (const std::string &s,
|
||||
packetdata *d, int c) {
|
||||
fibProtector. lock ();
|
||||
fibProcessor. dataforDataService (s, d, c);
|
||||
fibProtector. unlock ();
|
||||
}
|
||||
|
||||
int32_t ficHandler::get_CIFcount (void) {
|
||||
int32_t ficHandler::get_CIFcount () {
|
||||
// no lock, because using std::atomic<> in fib_processor class
|
||||
return fibProcessor. get_CIFcount();
|
||||
}
|
||||
|
||||
int16_t ficHandler::get_ficRatio (void) {
|
||||
int16_t ficHandler::get_ficRatio () {
|
||||
return ficRatio;
|
||||
}
|
||||
|
||||
bool ficHandler::syncReached (void) {
|
||||
bool ficHandler::syncReached () {
|
||||
return fibProcessor. syncReached ();
|
||||
}
|
||||
|
||||
@@ -243,7 +245,7 @@ std::string ficHandler::nameFor (int32_t serviceId) {
|
||||
return fibProcessor. nameFor (serviceId);
|
||||
}
|
||||
|
||||
int32_t ficHandler::SIdFor (std::string &name) {
|
||||
int32_t ficHandler::SIdFor (const std::string &name) {
|
||||
return fibProcessor. SIdFor (name);
|
||||
}
|
||||
|
||||
@@ -260,7 +262,7 @@ void ficHandler::show_ficCRC (bool b) {
|
||||
}
|
||||
}
|
||||
|
||||
void ficHandler::reset (void) {
|
||||
void ficHandler::reset () {
|
||||
fibProcessor. reset ();
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@
|
||||
cnt = 0;
|
||||
}
|
||||
|
||||
ofdmDecoder::~ofdmDecoder (void) {
|
||||
ofdmDecoder::~ofdmDecoder () {
|
||||
}
|
||||
|
||||
void ofdmDecoder::processBlock_0 (std::complex<float> *buffer) {
|
||||
|
Reference in New Issue
Block a user