Merge pull request #2 from lwvmobile/rtl-sdr

Attempt to make the rtl-sdr branch the main branch
This commit is contained in:
lwvmobile
2022-01-29 22:42:00 -05:00
committed by GitHub
18 changed files with 1668 additions and 141 deletions

View File

@@ -1,6 +1,6 @@
language: cpp language: cpp
dist: trusty dist: bionic
sudo: false sudo: false
compiler: compiler:
@@ -14,6 +14,7 @@ addons:
- libmbe-dev - libmbe-dev
- libsndfile1-dev - libsndfile1-dev
- libitpp-dev - libitpp-dev
- librtlsdr-dev
- portaudio19-dev - portaudio19-dev
before_script: before_script:

View File

@@ -10,9 +10,12 @@ find_package(LibSndFile REQUIRED)
find_package(MBE REQUIRED) find_package(MBE REQUIRED)
find_package(ITPP REQUIRED) find_package(ITPP REQUIRED)
find_package(LibPortAudio) find_package(LibPortAudio)
find_package(RTLSDR)
#more fucking around
find_package(Curses REQUIRED)
include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR}) include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR} ${CURSES_INCLUDE_DIR})
set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY}) set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY} ${CURSES_LIBRARY})
if(PORTAUDIO_FOUND) if(PORTAUDIO_FOUND)
include_directories(SYSTEM ${PORTAUDIO_INCLUDE_DIRS}) include_directories(SYSTEM ${PORTAUDIO_INCLUDE_DIRS})
@@ -20,9 +23,20 @@ if(PORTAUDIO_FOUND)
add_definitions(-DUSE_PORTAUDIO) add_definitions(-DUSE_PORTAUDIO)
endif(PORTAUDIO_FOUND) endif(PORTAUDIO_FOUND)
if(RTLSDR_FOUND)
find_package(Threads)
include_directories(SYSTEM ${RTLSDR_INCLUDE_DIRS})
list(APPEND LIBS ${RTLSDR_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_definitions(-DUSE_RTLSDR)
endif(RTLSDR_FOUND)
FILE(GLOB SRCS src/*.c src/*.cpp) FILE(GLOB SRCS src/*.c src/*.cpp)
FILE(GLOB HEADERS include/*.h include/*.hpp) FILE(GLOB HEADERS include/*.h include/*.hpp)
if(NOT RTLSDR_FOUND)
list(REMOVE_ITEM SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/rtl_sdr_fm.cpp)
endif(NOT RTLSDR_FOUND)
configure_file("src/git_ver.c.in" "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c" @ONLY) configure_file("src/git_ver.c.in" "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c" @ONLY)
list(APPEND SRCS "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c") list(APPEND SRCS "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c")

View File

@@ -1,6 +1,13 @@
[![Build Status](https://travis-ci.org/szechyjs/dsd.svg?branch=master)](https://travis-ci.org/szechyjs/dsd) [![Build Status](https://travis-ci.org/szechyjs/dsd.svg?branch=master)](https://travis-ci.org/szechyjs/dsd)
# Digital Speech Decoder 1.7.0-dev # Digital Speech Decoder - Florida Man Edition
This version of DSD shouldn't be used by anybody wanting a stable DSD experience, please see the original version for that.
Also, please don't submit bug reports to the links on this page, those will direct them to the original version. Links will be updated at a later date.
The purpose of this is to experiment with the RTL code and other things, and is purely for academic research into the inner workings of DSD. Basically, its for me to poke around with and see what I can manage to break.
##
DSD is able to decode [several digital voice formats](https://github.com/szechyjs/dsd/wiki/Supported-formats) from discriminator DSD is able to decode [several digital voice formats](https://github.com/szechyjs/dsd/wiki/Supported-formats) from discriminator
tap audio and synthesize the decoded speech. Speech tap audio and synthesize the decoded speech. Speech
synthesis requires mbelib, which is a separate package. synthesis requires mbelib, which is a separate package.

16
cmake/FindCURSES.cmake Normal file
View File

@@ -0,0 +1,16 @@
# - Try to find NCURSES
# Once done this will define
#
# ITPP_FOUND - System has ITPP
# ITPP_INCLUDE_DIR - The ITPP include directory
# ITPP_LIBRARY - The library needed to use ITPP
#
set(CURSES_LIBRARY "/opt/lib/libncurses.so")
set(CURSES_INCLUDE_PATH "/opt/include")
find_path(CURSES_INCLUDE_DIR /usr/ncurses.h)
set(CURSES_NAMES ${CURSES_NAMES} curses.h curses curses5w curses6w curses6 curses5 libncursesw)
FIND_LIBRARY(CURSES_LIBRARY NAMES ${CURSES_NAMES})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CURSES DEFAULT_MSG NCURSES_LIBRARY CURSES_INCLUDE_DIR)

View File

@@ -12,5 +12,5 @@ SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile)
FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES}) FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES})
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBSNDFILE DEFAULT_MSG LIBSNDFILE_LIBRARY find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_LIBRARY
LIBSNDFILE_INCLUDE_DIR) LIBSNDFILE_INCLUDE_DIR)

29
cmake/FindRTLSDR.cmake Normal file
View File

@@ -0,0 +1,29 @@
# - Try to find rtlsdr - the hardware driver for the realtek chip in the dvb receivers
# Once done this will define
# RTLSDR_FOUND - System has rtlsdr
# RTLSDR_LIBRARIES - The rtlsdr libraries
# RTLSDR_INCLUDE_DIRS - The rtlsdr include directories
# RTLSDR_LIB_DIRS - The rtlsdr library directories
if (NOT RTLSDR_FOUND)
find_package(PkgConfig)
pkg_check_modules(RTLSDR_PKG librtlsdr)
set(RTLSDR_DEFINITIONS ${PC_RTLSDR_CFLAGS_OTHER})
find_path(RTLSDR_INCLUDE_DIR
NAMES rtl-sdr.h
HINTS ${RTLSDR_PKG_INCLUDE_DIRS})
find_library(RTLSDR_LIBRARY
NAMES rtlsdr
HINTS ${RTLSDR_PKG_LIBRARY_DIRS})
set(RTLSDR_LIBRARIES ${RTLSDR_LIBRARY})
set(RTLSDR_INCLUDE_DIRS ${RTLSDR_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(RTLSDR DEFAULT_MSG RTLSDR_LIBRARY RTLSDR_INCLUDE_DIR)
mark_as_advanced(RTLSDR_INCLUDE_DIR RTLSDR_LIBRARY)
endif (NOT RTLSDR_FOUND)

4
debian/control vendored
View File

@@ -2,8 +2,8 @@ Source: dsd
Section: hamradio Section: hamradio
Priority: optional Priority: optional
Maintainer: Jared Szechy <jared.szechy@gmail.com> Maintainer: Jared Szechy <jared.szechy@gmail.com>
Build-Depends: debhelper (>= 9), libmbe-dev, libitpp-dev, libsndfile1-dev, Build-Depends: debhelper (>= 9), libmbe-dev, libitpp-dev, librtlsdr-dev
portaudio19-dev, cmake, git, help2man libsndfile1-dev, portaudio19-dev, cmake, git, help2man
Standards-Version: 4.1.4 Standards-Version: 4.1.4
Homepage: https://github.com/szechyjs/dsd Homepage: https://github.com/szechyjs/dsd
Vcs-Git: https://github.com/szechyjs/dsd.git Vcs-Git: https://github.com/szechyjs/dsd.git

8
debian/copyright vendored
View File

@@ -20,6 +20,14 @@ Files: src/dstar_header.c include/dstar_header.h include/fcs.h
Copyright: Copyright (C) 2010 by Kristoff Bonne, ON1ARF Copyright: Copyright (C) 2010 by Kristoff Bonne, ON1ARF
License: GPL-2 License: GPL-2
Files: src/rtl_sdr_fm.cpp
Copyright: Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
Copyright (C) 2012 by Hoernchen <la@tfc-server.de>
Copyright (C) 2012 by Kyle Keen <keenerd@gmail.com>
Copyright (C) 2013 by Elias Oenal <EliasOenal@gmail.com>
Copyright (C) 2014 by Kyle Keen <keenerd@gmail.com>
License: GPL-2
Files: include/descramble.h Files: include/descramble.h
Copyright: Copyright (C) 2011 by Jonathan Naylor, G4KLX Copyright: Copyright (C) 2011 by Jonathan Naylor, G4KLX
License: GPL-2 License: GPL-2

View File

@@ -58,10 +58,16 @@
#define PA_LATENCY_OUT 0.100 #define PA_LATENCY_OUT 0.100
#endif #endif
#ifdef USE_RTLSDR
#include <rtl-sdr.h>
#endif
/* /*
* global variables * global variables
*/ */
extern int exitflag;
static volatile int exitflag;
//volatile int exitflag; //didn't work, couldn't build, multiple definitions of exitflag
typedef struct typedef struct
@@ -85,7 +91,9 @@ typedef struct
#ifdef USE_PORTAUDIO #ifdef USE_PORTAUDIO
PaStream* audio_in_pa_stream; PaStream* audio_in_pa_stream;
#endif #endif
int audio_in_type; // 0 for device, 1 for file, 2 for portaudio uint32_t rtlsdr_center_freq;
int rtlsdr_ppm_error;
int audio_in_type; // 0 for device, 1 for file, 2 for portaudio, 3 for rtlsdr
char audio_out_dev[1024]; char audio_out_dev[1024];
int audio_out_fd; int audio_out_fd;
SNDFILE *audio_out_file; SNDFILE *audio_out_file;
@@ -129,6 +137,8 @@ typedef struct
int delay; int delay;
int use_cosine_filter; int use_cosine_filter;
int unmute_encrypted_p25; int unmute_encrypted_p25;
int rtl_dev_index;
int rtl_gain_value;
} dsd_opts; } dsd_opts;
typedef struct typedef struct
@@ -317,4 +327,15 @@ void processDSTAR_HD (dsd_opts * opts, dsd_state * state);
short dmr_filter(short sample); short dmr_filter(short sample);
short nxdn_filter(short sample); short nxdn_filter(short sample);
#ifdef __cplusplus
extern "C" {
#endif
void open_rtlsdr_stream(dsd_opts *opts);
void cleanup_rtlsdr_stream();
void get_rtlsdr_sample(int16_t *sample);
void rtlsdr_sighandler();
#ifdef __cplusplus
}
#endif
#endif // DSD_H #endif // DSD_H

View File

@@ -17,7 +17,6 @@
#include "dsd.h" #include "dsd.h"
void void
processAudio (dsd_opts * opts, dsd_state * state) processAudio (dsd_opts * opts, dsd_state * state)
{ {
@@ -214,6 +213,84 @@ writeSynthesizedVoice (dsd_opts * opts, dsd_state * state)
*/ */
} }
//Test playing raw audio HERE
//get_rtlsdr_sample(&sample);
void
playRawAudio (dsd_opts * opts, dsd_state * state)
{
ssize_t result;
//if (state->audio_out_idx > opts->delay)
if (opts->audio_in_type == 3) //if set to rtl_fm, maybe it shouldn't matter but for now, using this
{
// output synthesized speech to sound card
if(opts->audio_out_type == 2)
{
#ifdef USE_PORTAUDIO
PaError err = paNoError;
do
{
long available = Pa_GetStreamWriteAvailable( opts->audio_out_pa_stream );
if(available < 0)
err = available;
//printf("Frames available: %d\n", available);
if( err != paNoError )
break;
if(available > SAMPLE_RATE_OUT * PA_LATENCY_OUT)
{
//It looks like this might not be needed for very small latencies. However, it's definitely needed for a bit larger ones.
//When PA_LATENCY_OUT == 0.500 I get output buffer underruns if I don't use this. With PA_LATENCY_OUT <= 0.100 I don't see those happen.
//But with PA_LATENCY_OUT < 0.100 I run the risk of choppy audio and stream errors.
printf("\nSyncing voice output stream\n");
err = Pa_StopStream( opts->audio_out_pa_stream );
if( err != paNoError )
break;
}
err = Pa_IsStreamActive( opts->audio_out_pa_stream );
if(err == 0)
{
printf("Start voice output stream\n");
err = Pa_StartStream( opts->audio_out_pa_stream );
}
else if(err == 1)
{
err = paNoError;
}
if( err != paNoError )
break;
//printf("write stream %d\n", state->audio_out_idx);
err = Pa_WriteStream( opts->audio_out_pa_stream, (state->audio_out_buf_p - state->audio_out_idx), state->audio_out_idx );
if( err != paNoError )
break;
} while(0);
if( err != paNoError )
{
fprintf( stderr, "An error occured while using the portaudio output stream\n" );
fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
}
#endif
}
else
result = write (opts->audio_out_fd, (state->audio_out_buf_p - state->audio_out_idx), (state->audio_out_idx * 2));
state->audio_out_idx = 0;
}
if (state->audio_out_idx2 >= 800000)
{
state->audio_out_float_buf_p = state->audio_out_float_buf + 100;
state->audio_out_buf_p = state->audio_out_buf + 100;
memset (state->audio_out_float_buf, 0, 100 * sizeof (float));
memset (state->audio_out_buf, 0, 100 * sizeof (short));
state->audio_out_idx2 = 0;
}
}
//end test raw audio
void void
playSynthesizedVoice (dsd_opts * opts, dsd_state * state) playSynthesizedVoice (dsd_opts * opts, dsd_state * state)
@@ -500,6 +577,10 @@ openAudioInDevice (dsd_opts * opts)
exit(1); exit(1);
#endif #endif
} }
else if(strncmp(opts->audio_in_dev, "rtl", 3) == 0)
{
opts->audio_in_type = 3;
}
else else
{ {
struct stat stat_buf; struct stat stat_buf;

View File

@@ -211,7 +211,8 @@ closeMbeOutFile (dsd_opts * opts, dsd_state * state)
fclose (opts->mbe_out_f); fclose (opts->mbe_out_f);
opts->mbe_out_f = NULL; opts->mbe_out_f = NULL;
strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep); strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep);
sprintf (newfilename, "nac%X-%s-tg%i%s", state->nac, datestr, talkgroup, ext); //sprintf (newfilename, "nac%X-%s-tg%i%s", state->nac, datestr, talkgroup, ext);
sprintf (newfilename, "%s%s", datestr, ext); //this one
sprintf (new_path, "%s%s", opts->mbe_out_dir, newfilename); sprintf (new_path, "%s%s", opts->mbe_out_dir, newfilename);
#ifdef _WIN32 #ifdef _WIN32
sprintf (shell, "move %s %s", opts->mbe_out_path, new_path); sprintf (shell, "move %s %s", opts->mbe_out_path, new_path);

View File

@@ -31,7 +31,7 @@ printFrameInfo (dsd_opts * opts, dsd_state * state)
level = (int) state->max / 164; level = (int) state->max / 164;
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
printf ("inlvl: %2i%% ", level); //printf ("inlvl: %2i%% ", level);
} }
if (state->nac != 0) if (state->nac != 0)
{ {
@@ -89,7 +89,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
level = (int) state->max / 164; level = (int) state->max / 164;
printf ("inlvl: %2i%% ", level); //printf ("inlvl: %2i%% ", level);
} }
} }
state->nac = 0; state->nac = 0;
@@ -112,7 +112,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
level = (int) state->max / 164; level = (int) state->max / 164;
printf ("inlvl: %2i%% ", level); //printf ("inlvl: %2i%% ", level);
} }
} }
state->nac = 0; state->nac = 0;
@@ -134,7 +134,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
level = (int) state->max / 164; level = (int) state->max / 164;
printf ("inlvl: %2i%% ", level); //printf ("inlvl: %2i%% ", level);
} }
} }
state->nac = 0; state->nac = 0;
@@ -156,7 +156,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
level = (int) state->max / 164; level = (int) state->max / 164;
printf ("inlvl: %2i%% ", level); //printf ("inlvl: %2i%% ", level);
} }
} }
state->nac = 0; state->nac = 0;
@@ -179,7 +179,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
level = (int) state->max / 164; level = (int) state->max / 164;
printf ("inlvl: %2i%% ", level); //printf ("inlvl: %2i%% ", level);
} }
} }
if ((state->synctype == 11) || (state->synctype == 12)) if ((state->synctype == 11) || (state->synctype == 12))
@@ -233,7 +233,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
level = (int) state->max / 164; level = (int) state->max / 164;
printf ("inlvl: %2i%% ", level); //printf ("inlvl: %2i%% ", level);
} }
} }
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))

View File

@@ -16,27 +16,73 @@
*/ */
#include "dsd.h" #include "dsd.h"
#include <locale.h>
#include <ncurses.h>
time_t now;
char * getTime(void) //get pretty hh:mm:ss timestamp
{
time_t t = time(NULL);
char * curr;
char * stamp = asctime(localtime( & t));
curr = strtok(stamp, " ");
curr = strtok(NULL, " ");
curr = strtok(NULL, " ");
curr = strtok(NULL, " ");
return curr;
}
char * getDate(void) {
char datename[32];
char * curr2;
struct tm * to;
time_t t;
t = time(NULL);
to = localtime( & t);
strftime(datename, sizeof(datename), "%Y-%m-%d", to);
curr2 = strtok(datename, " ");
return curr2;
}
void void
printFrameSync (dsd_opts * opts, dsd_state * state, char *frametype, int offset, char *modulation) printFrameSync (dsd_opts * opts, dsd_state * state, char *frametype, int offset, char *modulation)
{ {
//char datestr[32];
//struct tm timep;
//erase();
//attron(COLOR_PAIR(4));
//for (short int i = 0; i < 7; i++) {
//printw("%s \n", FM_banner2[i]);}
//attroff(COLOR_PAIR(4));
if (opts->verbose > 0) if (opts->verbose > 0)
{ {
printf ("Sync: %s ", frametype); //strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep);
//printf ("Sync: %s ", frametype);
//printf ("%s %s Sync: %s ", getDate(), getTime(), frametype);
printf ("%s Sync: %s ", getTime(), frametype);
printw("%s Sync: %s ", getTime(), frametype);
} }
if (opts->verbose > 2) if (opts->verbose > 2)
{ {
printf ("o: %4i ", offset); printf ("o: %4i ", offset);
printw("o: %4i ", offset);
} }
if (opts->verbose > 1) if (opts->verbose > 1)
{ {
printf ("mod: %s ", modulation); printf ("mod: %s ", modulation);
printw("mod: %s ", modulation);
} }
if (opts->verbose > 2) if (opts->verbose > 2)
{ {
printf ("g: %f ", state->aout_gain); printf ("g: %f ", state->aout_gain);
printw("g: %f ", state->aout_gain);
} }
refresh();
} }
int int
@@ -100,6 +146,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
if ((opts->symboltiming == 1) && (state->carrier == 1)) if ((opts->symboltiming == 1) && (state->carrier == 1))
{ {
printf ("\nSymbol Timing:\n"); printf ("\nSymbol Timing:\n");
//printw("\nSymbol Timing:\n");
} }
while (sync == 0) while (sync == 0)
{ {
@@ -489,8 +536,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->min = ((state->min) + lmin) / 2; state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, " ProVoice "); sprintf (state->ftype, " ProVoice ");
if (opts->errorbars == 1) if (opts->errorbars == 1)
//if (opts->errorbars == 1 && (time(NULL) - now) > 2 )
{ {
printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation); printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation);
now = time(NULL);
} }
state->lastsynctype = 14; state->lastsynctype = 14;
return (14); return (14);
@@ -503,8 +552,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->min = ((state->min) + lmin) / 2; state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, " ProVoice "); sprintf (state->ftype, " ProVoice ");
if (opts->errorbars == 1) if (opts->errorbars == 1)
//if (opts->errorbars == 1 && (time(NULL) - now) > 2 )
{ {
printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation); printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation);
now = time(NULL);
} }
state->lastsynctype = 15; state->lastsynctype = 15;
return (15); return (15);
@@ -819,6 +870,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
if ((opts->errorbars == 1) && (opts->verbose > 1) && (state->carrier == 1)) if ((opts->errorbars == 1) && (opts->verbose > 1) && (state->carrier == 1))
{ {
printf ("Sync: no sync\n"); printf ("Sync: no sync\n");
printf("Press CTRL + C to close.\n"); //Kindly remind user to double tap CTRL + C
} }
noCarrier (opts, state); noCarrier (opts, state);
return (-1); return (-1);

View File

@@ -28,7 +28,18 @@
#include "p25p1_heuristics.h" #include "p25p1_heuristics.h"
#include "pa_devs.h" #include "pa_devs.h"
int exitflag = 0; #include <locale.h>
#include <ncurses.h>
char * FM_banner[9] = {
" CTRL + C twice to exit",
"██████╗ ██████╗██████╗    ███████╗███╗ ███╗███████╗",
"██╔══██╗██╔════╝██╔══██╗   ██╔════╝████╗ ████║██╔════╝",
"██║ ██║╚█████╗ ██║ ██║   █████╗ ██╔████╔██║█████╗ ",
"██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
"██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗",
"╚═════╝ ╚═════╝ ╚═════╝    ╚═╝ ╚═╝ ╚═╝╚══════╝",
};
int int
comp (const void *a, const void *b) comp (const void *a, const void *b)
@@ -80,6 +91,11 @@ noCarrier (dsd_opts * opts, dsd_state * state)
sprintf (state->algid, "________"); sprintf (state->algid, "________");
sprintf (state->keyid, "________________"); sprintf (state->keyid, "________________");
mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced); mbe_initMbeParms (state->cur_mp, state->prev_mp, state->prev_mp_enhanced);
//test below
//uint16_t sample;
//get_rtlsdr_sample(&sample);
//Pa_StartStream(sample);
//end test
} }
void void
@@ -142,6 +158,8 @@ initOpts (dsd_opts * opts)
opts->delay = 0; opts->delay = 0;
opts->use_cosine_filter = 1; opts->use_cosine_filter = 1;
opts->unmute_encrypted_p25 = 0; opts->unmute_encrypted_p25 = 0;
opts->rtl_dev_index = 0; //choose which device we want by index number
opts->rtl_gain_value = 0; //set actual gain and not automatic gain
} }
void void
@@ -267,15 +285,21 @@ usage ()
printf (" -z <num> Frame rate for datascope\n"); printf (" -z <num> Frame rate for datascope\n");
printf ("\n"); printf ("\n");
printf ("Input/Output options:\n"); printf ("Input/Output options:\n");
printf (" -i <device> Audio input device (default is /dev/audio, - for piped stdin)\n"); printf (" -i <device> Audio input device (default is /dev/audio, - for piped stdin, rtl for rtl device)\n");
printf (" -o <device> Audio output device (default is /dev/audio)\n"); printf (" -o <device> Audio output device (default is /dev/audio)\n");
printf (" -d <dir> Create mbe data files, use this directory\n"); printf (" -d <dir> Create mbe data files, use this directory\n");
printf (" -r <files> Read/Play saved mbe data from file(s)\n"); printf (" -r <files> Read/Play saved mbe data from file(s)\n");
printf (" -g <num> Audio output gain (default = 0 = auto, disable = -1)\n"); printf (" -g <num> Audio output gain (default = 0 = auto, disable = -1)\n");
printf (" -n Do not send synthesized speech to audio output device\n"); printf (" -n Do not send synthesized speech to audio output device\n");
printf (" -w <file> Output synthesized speech to a .wav file\n"); printf (" -w <file> Output synthesized speech to a .wav file\n");
printf (" -a Display port audio devices\n"); printf (" -a Display port audio devices\n");
printf ("\n"); printf ("\n");
printf ("RTL-SDR options:\n");
printf (" -c <hertz> RTL-SDR tune to frequency\n");
printf (" -P <num> RTL-SDR ppm error (default = 0)\n");
printf (" -D <num> RTL-SDR Device Index Number\n");
printf (" -G <num> RTL-SDR Device Gain (0-49) (default = 0 Auto Gain)\n");
printf ("\n");
printf ("Scanner control options:\n"); printf ("Scanner control options:\n");
printf (" -B <num> Serial port baud rate (default=115200)\n"); printf (" -B <num> Serial port baud rate (default=115200)\n");
printf (" -C <device> Serial port for scanner control (default=/dev/ttyUSB0)\n"); printf (" -C <device> Serial port for scanner control (default=/dev/ttyUSB0)\n");
@@ -285,7 +309,7 @@ usage ()
printf (" -fa Auto-detect frame type (default)\n"); printf (" -fa Auto-detect frame type (default)\n");
printf (" -f1 Decode only P25 Phase 1\n"); printf (" -f1 Decode only P25 Phase 1\n");
printf (" -fd Decode only D-STAR\n"); printf (" -fd Decode only D-STAR\n");
printf (" -fi Decode only NXDN48* (6.25 kHz) / IDAS*\n"); printf (" -fi Decode only NXDN48* (6.25 kHz) / IDAS*\n");
printf (" -fn Decode only NXDN96 (12.5 kHz)\n"); printf (" -fn Decode only NXDN96 (12.5 kHz)\n");
printf (" -fp Decode only ProVoice*\n"); printf (" -fp Decode only ProVoice*\n");
printf (" -fr Decode only DMR/MOTOTRBO\n"); printf (" -fr Decode only DMR/MOTOTRBO\n");
@@ -322,12 +346,18 @@ liveScanner (dsd_opts * opts, dsd_state * state)
PaError err = Pa_StartStream( opts->audio_in_pa_stream ); PaError err = Pa_StartStream( opts->audio_in_pa_stream );
if( err != paNoError ) if( err != paNoError )
{ {
fprintf( stderr, "An error occured while starting the portaudio input stream\n" ); //fprintf( stderr, "An error occured while starting the portaudio input stream\n" );
fprintf( stderr, "Error number: %d\n", err ); //fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); //fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
return; return;
} }
} }
#endif
#ifdef USE_RTLSDR
if(opts->audio_in_type == 3)
{
open_rtlsdr_stream(opts);
}
#endif #endif
while (1) while (1)
{ {
@@ -378,9 +408,9 @@ cleanupAndExit (dsd_opts * opts, dsd_state * state)
err = Pa_CloseStream( opts->audio_in_pa_stream ); err = Pa_CloseStream( opts->audio_in_pa_stream );
if( err != paNoError ) if( err != paNoError )
{ {
fprintf( stderr, "An error occured while closing the portaudio input stream\n" ); //fprintf( stderr, "An error occured while closing the portaudio input stream\n" );
fprintf( stderr, "Error number: %d\n", err ); //fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); //fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
} }
} }
if(opts->audio_out_pa_stream != NULL) if(opts->audio_out_pa_stream != NULL)
@@ -390,28 +420,36 @@ cleanupAndExit (dsd_opts * opts, dsd_state * state)
err = Pa_StopStream( opts->audio_out_pa_stream ); err = Pa_StopStream( opts->audio_out_pa_stream );
if( err != paNoError ) if( err != paNoError )
{ {
fprintf( stderr, "An error occured while closing the portaudio output stream\n" ); //fprintf( stderr, "An error occured while closing the portaudio output stream\n" );
fprintf( stderr, "Error number: %d\n", err ); //fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); //fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
} }
err = Pa_CloseStream( opts->audio_out_pa_stream ); err = Pa_CloseStream( opts->audio_out_pa_stream );
if( err != paNoError ) if( err != paNoError )
{ {
fprintf( stderr, "An error occured while closing the portaudio output stream\n" ); //fprintf( stderr, "An error occured while closing the portaudio output stream\n" );
fprintf( stderr, "Error number: %d\n", err ); //fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); //fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
} }
} }
err = Pa_Terminate(); err = Pa_Terminate();
if( err != paNoError ) if( err != paNoError )
{ {
fprintf( stderr, "An error occured while terminating portaudio\n" ); //fprintf( stderr, "An error occured while terminating portaudio\n" );
fprintf( stderr, "Error number: %d\n", err ); //fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); //fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
} }
} }
#endif #endif
#ifdef USE_RTLSDR
if(opts->audio_in_type == 3)
{
// TODO: cleanup demod threads
cleanup_rtlsdr_stream();
}
#endif
printf("\n"); printf("\n");
printf("Total audio errors: %i\n", state->debug_audio_errors); printf("Total audio errors: %i\n", state->debug_audio_errors);
printf("Total header errors: %i\n", state->debug_header_errors); printf("Total header errors: %i\n", state->debug_header_errors);
@@ -448,6 +486,61 @@ sigfun (int sig)
{ {
exitflag = 1; exitflag = 1;
signal (SIGINT, SIG_DFL); signal (SIGINT, SIG_DFL);
#ifdef USE_RTLSDR
rtlsdr_sighandler();
#endif
}
//LEH version of sigfun
/*
void sigfun (int sig)
{
UNUSED_VARIABLE(sig); //what is this and where is it defined?
exitflag = 1;
signal (SIGINT, SIG_DFL);
}
//another LEH thing to free allocated memory
void freeAllocatedMemory(dsd_opts * opts, dsd_state * state)
{
UNUSED_VARIABLE(opts);
// Free allocated memory //
free(state->prev_mp_enhanced);
free(state->prev_mp);
free(state->cur_mp);
free(state->audio_out_float_buf);
free(state->audio_out_buf);
free(state->dibit_buf);
}
*/
//end LEH version of sigfun
double atofs(char *s)
{
char last;
int len;
double suff = 1.0;
len = strlen(s);
last = s[len-1];
s[len-1] = '\0';
switch (last) {
case 'g':
case 'G':
suff *= 1e3;
case 'm':
case 'M':
suff *= 1e3;
case 'k':
case 'K':
suff *= 1e3;
suff *= atof(s);
s[len-1] = last;
return suff;
}
s[len-1] = last;
return atof(s);
} }
int int
@@ -461,7 +554,12 @@ main (int argc, char **argv)
char versionstr[25]; char versionstr[25];
mbe_printVersion (versionstr); mbe_printVersion (versionstr);
printf ("Digital Speech Decoder 1.7.0-dev (build:%s)\n", GIT_TAG);
for (short int i = 0; i < 7; i++) {
printf("%s \n", FM_banner[i]);
}
//printf ("Digital Speech Decoder 1.7.0-dev (build:%s)\n", GIT_TAG);
printf ("Digital Speech Decoder: Florida Man Edition\n");
printf ("mbelib version %s\n", versionstr); printf ("mbelib version %s\n", versionstr);
initOpts (&opts); initOpts (&opts);
@@ -470,7 +568,7 @@ main (int argc, char **argv)
exitflag = 0; exitflag = 0;
signal (SIGINT, sigfun); signal (SIGINT, sigfun);
while ((c = getopt (argc, argv, "haep:qstv:z:i:o:d:g:nw:B:C:R:f:m:u:x:A:S:M:rl")) != -1) while ((c = getopt (argc, argv, "haep:P:qstv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:rl")) != -1)
{ {
opterr = 0; opterr = 0;
switch (c) switch (c)
@@ -507,6 +605,9 @@ main (int argc, char **argv)
opts.unmute_encrypted_p25 = 1; opts.unmute_encrypted_p25 = 1;
} }
break; break;
case 'P':
sscanf (optarg, "%i", &opts.rtlsdr_ppm_error);
break;
case 'q': case 'q':
opts.errorbars = 0; opts.errorbars = 0;
opts.verbose = 0; opts.verbose = 0;
@@ -528,6 +629,18 @@ main (int argc, char **argv)
case 'v': case 'v':
sscanf (optarg, "%d", &opts.verbose); sscanf (optarg, "%d", &opts.verbose);
break; break;
case 'G': //Set rtl device gain
sscanf (optarg, "%d", &opts.rtl_gain_value); //multiple value by ten to make it consitent with the way rtl_fm really works
//opts->audio_in_type = 3; //set to use RTL this way and maybe ditch the other shitty way
break;
case 'D': //Set rtl device index number
sscanf (optarg, "%d", &opts.rtl_dev_index);
//opts->audio_in_type = 3; //set to use RTL this way and maybe ditch the other shitty way
break;
case 'z': case 'z':
sscanf (optarg, "%d", &opts.scoperate); sscanf (optarg, "%d", &opts.scoperate);
opts.errorbars = 0; opts.errorbars = 0;
@@ -542,6 +655,7 @@ main (int argc, char **argv)
case 'i': case 'i':
strncpy(opts.audio_in_dev, optarg, 1023); strncpy(opts.audio_in_dev, optarg, 1023);
opts.audio_in_dev[1023] = '\0'; opts.audio_in_dev[1023] = '\0';
//printf("audio_in_dev = %s\n", opts.audio_in_dev);
break; break;
case 'o': case 'o':
strncpy(opts.audio_out_dev, optarg, 1023); strncpy(opts.audio_out_dev, optarg, 1023);
@@ -552,6 +666,10 @@ main (int argc, char **argv)
opts.mbe_out_dir[1023] = '\0'; opts.mbe_out_dir[1023] = '\0';
printf ("Writing mbe data files to directory %s\n", opts.mbe_out_dir); printf ("Writing mbe data files to directory %s\n", opts.mbe_out_dir);
break; break;
case 'c':
opts.rtlsdr_center_freq = (uint32_t)atofs(optarg);
printf("Tuning to frequency: %i\n", opts.rtlsdr_center_freq);
break;
case 'g': case 'g':
sscanf (optarg, "%f", &opts.audio_gain); sscanf (optarg, "%f", &opts.audio_gain);
if (opts.audio_gain < (float) 0 ) if (opts.audio_gain < (float) 0 )
@@ -815,9 +933,9 @@ main (int argc, char **argv)
PaError err = Pa_Initialize(); PaError err = Pa_Initialize();
if( err != paNoError ) if( err != paNoError )
{ {
fprintf( stderr, "An error occured while initializing portaudio\n" ); //fprintf( stderr, "An error occured while initializing portaudio\n" );
fprintf( stderr, "Error number: %d\n", err ); //fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); //fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
exit(err); exit(err);
} }
} }
@@ -851,7 +969,25 @@ main (int argc, char **argv)
openAudioOutDevice (&opts, SAMPLE_RATE_OUT); openAudioOutDevice (&opts, SAMPLE_RATE_OUT);
} }
openAudioInDevice (&opts); openAudioInDevice (&opts);
setlocale(LC_ALL, "");
//sleep(3);
//initscr(); //Initialize NCURSES screen window
start_color();
init_pair(1, COLOR_YELLOW, COLOR_BLACK); //Yellow/Amber for frame sync/control channel, NV style
init_pair(2, COLOR_RED, COLOR_BLACK); //Red for Terminated Calls
init_pair(3, COLOR_GREEN, COLOR_BLACK); //Green for Active Calls
init_pair(4, COLOR_CYAN, COLOR_BLACK); //Cyan for Site Extra and Patches
init_pair(5, COLOR_MAGENTA, COLOR_BLACK); //Magenta for no frame sync/signal
noecho();
cbreak();
erase();
for (short int i = 0; i < 7; i++) {
printw("%s \n", FM_banner[i]); }
attroff(COLOR_PAIR(4));
refresh();
printf("Press CTRL + C twice to close.\n"); //Kindly remind user to double tap CTRL + C
} }
else else
{ {
opts.split = 0; opts.split = 0;
@@ -865,10 +1001,12 @@ main (int argc, char **argv)
{ {
playMbeFiles (&opts, &state, argc, argv); playMbeFiles (&opts, &state, argc, argv);
} }
else else
{ {
liveScanner (&opts, &state); liveScanner (&opts, &state);
} }
cleanupAndExit (&opts, &state); cleanupAndExit (&opts, &state);
endwin();
return (0); return (0);
} }

View File

@@ -135,6 +135,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
if (opts->errorbars == 1) if (opts->errorbars == 1)
{ {
printf ("%s", state->err_str); printf ("%s", state->err_str);
//printw("%s", state->err_str);
} }
state->debug_audio_errors += state->errs2; state->debug_audio_errors += state->errs2;

View File

@@ -88,18 +88,25 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
cleanupAndExit (opts, state); cleanupAndExit (opts, state);
} }
} }
else else if (opts->audio_in_type == 2)
{ {
#ifdef USE_PORTAUDIO #ifdef USE_PORTAUDIO
PaError err = Pa_ReadStream( opts->audio_in_pa_stream, &sample, 1 ); PaError err = Pa_ReadStream( opts->audio_in_pa_stream, &sample, 1 );
if( err != paNoError ) if( err != paNoError )
{ {
fprintf( stderr, "An error occured while using the portaudio input stream\n" ); fprintf( stderr, "An error occured while using the portaudio input stream\n" );
fprintf( stderr, "Error number: %d\n", err ); fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
} }
#endif #endif
} }
else if (opts->audio_in_type == 3)
{
#ifdef USE_RTLSDR
// TODO: need to read demodulated stream here
get_rtlsdr_sample(&sample);
#endif
}
#ifdef TRACE_DSD #ifdef TRACE_DSD
state->debug_sample_index++; state->debug_sample_index++;

View File

@@ -5,25 +5,28 @@ void
processProVoice (dsd_opts * opts, dsd_state * state) processProVoice (dsd_opts * opts, dsd_state * state)
{ {
int i, j, dibit; int i, j, dibit;
//char datestr[32];
char imbe7100_fr1[7][24]; char imbe7100_fr1[7][24];
char imbe7100_fr2[7][24]; char imbe7100_fr2[7][24];
const int *w, *x; const int *w, *x;
//struct tm timep;
if (opts->errorbars == 1) if (opts->errorbars == 1)
{ {
printf ("VOICE e:"); //strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep);
//printf ("%s VOICE e:", datestr);
//printf ("VOICE e:");
} }
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
// lid // lid
@@ -31,22 +34,22 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
// imbe frames 1,2 first half // imbe frames 1,2 first half
@@ -59,14 +62,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -74,14 +77,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
} }
@@ -89,14 +92,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -104,25 +107,25 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
// spacer bits // spacer bits
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
printf (" "); //printf (" ");
#endif #endif
// imbe frames 1,2 second half // imbe frames 1,2 second half
@@ -131,14 +134,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@@ -147,14 +150,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -162,14 +165,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
} }
@@ -177,14 +180,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 5; w -= 5;
x -= 5; x -= 5;
@@ -192,14 +195,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
@@ -208,14 +211,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -223,14 +226,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
} }
@@ -238,14 +241,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 5; w -= 5;
x -= 5; x -= 5;
@@ -253,14 +256,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1); processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1);
@@ -269,23 +272,23 @@ processProVoice (dsd_opts * opts, dsd_state * state)
// spacer bits // spacer bits
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
printf (" "); //printf (" ");
#endif #endif
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
// imbe frames 3,4 first half // imbe frames 3,4 first half
@@ -297,14 +300,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -312,28 +315,28 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
} }
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -341,25 +344,25 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
// spacer bits // spacer bits
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
printf ("_"); //printf ("_");
#endif #endif
// imbe frames 3,4 second half // imbe frames 3,4 second half
@@ -367,14 +370,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
@@ -382,14 +385,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -397,14 +400,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
} }
@@ -412,14 +415,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 5; w -= 5;
x -= 5; x -= 5;
@@ -427,14 +430,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
@@ -443,14 +446,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 6; w -= 6;
x -= 6; x -= 6;
@@ -458,14 +461,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
} }
@@ -473,14 +476,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr1[*w][*x] = dibit; imbe7100_fr1[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("_"); //printf ("_");
#endif #endif
w -= 5; w -= 5;
x -= 5; x -= 5;
@@ -488,14 +491,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
{ {
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
imbe7100_fr2[*w][*x] = dibit; imbe7100_fr2[*w][*x] = dibit;
w++; w++;
x++; x++;
} }
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf (" "); //printf (" ");
#endif #endif
processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1); processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1);
@@ -504,12 +507,12 @@ processProVoice (dsd_opts * opts, dsd_state * state)
// spacer bits // spacer bits
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
#endif #endif
dibit = getDibit (opts, state); dibit = getDibit (opts, state);
#ifdef PROVOICE_DUMP #ifdef PROVOICE_DUMP
printf ("%i", dibit); //printf ("%i", dibit);
printf (" "); //printf (" ");
#endif #endif
if (opts->errorbars == 1) if (opts->errorbars == 1)

1148
src/rtl_sdr_fm.cpp Normal file

File diff suppressed because it is too large Load Diff