Skip to content

Commit

Permalink
changes in epg handling
Browse files Browse the repository at this point in the history
  • Loading branch information
JvanKatwijk committed Apr 5, 2022
1 parent 60208d9 commit 60f4c1d
Show file tree
Hide file tree
Showing 29 changed files with 703 additions and 501 deletions.
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ Note:

Qt_5= /usr/lib/arm-linux-gnueabihf/qt5
export QT_PLUGIN_PATH=$Qt_5/plugins


-----------------------------------------------------------------
Difference between 4.351 and previous versions
Expand Down Expand Up @@ -580,19 +579,15 @@ Pluto device and stereo FM transmission
-----------------------------------------------------------------------

As (probably) known, the **Adalm Pluto** device has receive and transmit
capabilities. In a previous project, an extension was made to a
dab-cmdline version using the Adalm pluto device,
to allow the transmission on FM of a preselected
service.

As an exercise - and slightly experimental - the functionality was
added to qt-dab.

If - on configuration - **pluto-rxtx** is included as device rather than
**pluto**, and if pluto-rxtx is selected as (input)device on the main
widget, the audio
of the selected service, augmented with the text of the dynamic label
encoded as RDS signal, will be transmitted on a specified frequency.
capabilities. For configuring pluto there are three options:

* pluto, whichn requires the support libraries to be installed;

* pluto-2, which - as most other device handlers - will try to read in the required functions from the library when selected, and

* pluto-rxtx, which supports transmitting the audio as received from a DAB sevrice in FM stereo on a user specified frequency. It requires the libad9361 and libiio to be installed.

The precompiled versions were configured with "pluto-2".

As default, the transmit frequency is 110 MHz, however, the user can specify
the frequency (obviously within the range supported by the Adalm-Pluto)
Expand Down
36 changes: 17 additions & 19 deletions dab-maxi/dab-streamer/dab-streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
* Jan van Katwijk ([email protected])
* Lazy Chair Computer
*
* This file is part of dab-2-fm
* This file is part of Qt-DAB
*
* dab-2-fm 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.
*
* dab-2-fm 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 dab-2-fm; 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
*
* rds encoding is heavily based on the "fmstation"
Expand All @@ -29,8 +29,6 @@
#include <signal.h>
#include <stdlib.h>
#include <stdint.h>
//#include <sndfile.h>
//#include <samplerate.h>
#include <math.h>
#include <atomic>
#include <sys/time.h>
Expand All @@ -50,10 +48,9 @@ struct timeval tv;
dabStreamer::dabStreamer (int inRate,
int outRate,
plutoHandler *generator):
lowPassFilter (11, 15000, inRate),
pcmBuffer (8 * 32768),
rdsBuffer (256),
lowPassFilter (11, 15000, inRate) {

rdsBuffer (2 * 256) {
this -> inRate = inRate;
this -> outRate = outRate;
this -> generator = generator;
Expand Down Expand Up @@ -112,7 +109,7 @@ void dabStreamer::audioOutput (float *v, int amount) {
float lBuffer [2 * amount];

while (pcmBuffer. GetRingBufferWriteAvailable () < 2 * amount)
usleep (400);
usleep (1000);
for (int i = 0; i < amount; i ++) {
std::complex<float> x = std::complex<float> (v [2 * i],
v [2 * i + 1]);
Expand Down Expand Up @@ -171,10 +168,11 @@ uint64_t nextStop;

while (running. load () &&
(pcmBuffer. GetRingBufferReadAvailable () < inRate / 10)) {
std::complex<float> filler [48];
memset (filler, 0, 48 * sizeof (std::complex<float>));
usleep (1000);
// std::complex<float> filler [48];
// memset (filler, 0, 48 * sizeof (std::complex<float>));
usleep (10000);
}

if (!running. load ())
break;
readCount = pcmBuffer. getDataFromBuffer (lBuf, inRate / 10);
Expand Down Expand Up @@ -249,10 +247,6 @@ int i;
double symclk = sinTable [ind_4];
double bit_d = 0;

//#define MANCH_ENCODE(clk, bit) (((clk ^ bit) << 1) | ((clk ^ 0x1 ^ bit)))

//#define NRZ(in) (double)(((int)((in) & 0x1) << 1) - 1)

if ((symclk_p <= 0) && (symclk > 0)) {
e = group -> bits [bpos]^ prev_e;
m = MANCH_ENCODE (symclk_b, e);
Expand Down Expand Up @@ -280,7 +274,6 @@ int i;
//
// sound elements are preempted
samp_s = preemp (samp_s);

double lpr = (samp_s.l + samp_s.r);
double lmr = (samp_s.l - samp_s.r);

Expand All @@ -307,7 +300,12 @@ int i;
if (nextPhase < 0)
nextPhase += 2 * M_PI;
int index = nextPhase / (2 * M_PI) * outRate;
generator -> sendSample (oscillatorTable [index]);
//
// there might be an issue with the resulting index, nextPhase
// may be nan, inf, or just too large
int aa = index % outRate;
if (aa == index)
generator -> sendSample (oscillatorTable [index]);
pos++;
}
}
Expand Down
17 changes: 8 additions & 9 deletions dab-maxi/dab-streamer/dab-streamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,38 @@
* Jan van Katwijk ([email protected])
* Lazy Chair Computing
*
* This file is part of the dab streamer
* This file is part of Qt-DAB
*
* dab streamer 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.
*
* dab streamer 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 dab-streamer; 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
*
* rds encoding is heavily based on the "fmstation"
* from Jan Roemisch (github.com/maxx23), all rights acknowledged
*/

#ifndef __DAB_STREAMER__
#define __DAB_STREAMER__
#ifndef __DAB_STREAMER_H
#define __DAB_STREAMER_H

#include <thread>
#include <stdint.h>
#include <stdio.h>
//#include <sndfile.h>
#include <complex>
#include <atomic>
#include "ringbuffer.h"
#include "audio-base.h"
#include "ringbuffer.h"
#include "lowpass-filter.h"
#include "fir-filters.h"
#include <string>

class plutoHandler;
Expand Down Expand Up @@ -139,9 +138,9 @@ class dabStreamer : public audioBase {
void addRds (const std::string);
void stop (void);
private:
LowPassFIR lowPassFilter;
RingBuffer<float> pcmBuffer;
RingBuffer<char> rdsBuffer;
LowPassFIR lowPassFilter;
void run (void);
std::thread threadHandle;
int inRate;
Expand Down
52 changes: 0 additions & 52 deletions dab-maxi/dab-streamer/file-driver.cpp

This file was deleted.

49 changes: 0 additions & 49 deletions dab-maxi/dab-streamer/file-driver.h

This file was deleted.

Loading

0 comments on commit 60f4c1d

Please sign in to comment.