mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-12 16:57:23 -05:00
Merge pull request #2 from lwvmobile/rtl-sdr
Attempt to make the rtl-sdr branch the main branch
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
language: cpp
|
||||
|
||||
dist: trusty
|
||||
dist: bionic
|
||||
sudo: false
|
||||
|
||||
compiler:
|
||||
@@ -14,6 +14,7 @@ addons:
|
||||
- libmbe-dev
|
||||
- libsndfile1-dev
|
||||
- libitpp-dev
|
||||
- librtlsdr-dev
|
||||
- portaudio19-dev
|
||||
|
||||
before_script:
|
||||
|
||||
@@ -10,9 +10,12 @@ find_package(LibSndFile REQUIRED)
|
||||
find_package(MBE REQUIRED)
|
||||
find_package(ITPP REQUIRED)
|
||||
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})
|
||||
set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY})
|
||||
include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR} ${CURSES_INCLUDE_DIR})
|
||||
set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY} ${CURSES_LIBRARY})
|
||||
|
||||
if(PORTAUDIO_FOUND)
|
||||
include_directories(SYSTEM ${PORTAUDIO_INCLUDE_DIRS})
|
||||
@@ -20,9 +23,20 @@ if(PORTAUDIO_FOUND)
|
||||
add_definitions(-DUSE_PORTAUDIO)
|
||||
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 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)
|
||||
list(APPEND SRCS "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c")
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
[](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
|
||||
tap audio and synthesize the decoded speech. Speech
|
||||
synthesis requires mbelib, which is a separate package.
|
||||
|
||||
16
cmake/FindCURSES.cmake
Normal file
16
cmake/FindCURSES.cmake
Normal 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)
|
||||
@@ -12,5 +12,5 @@ SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile)
|
||||
FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LIBSNDFILE DEFAULT_MSG LIBSNDFILE_LIBRARY
|
||||
LIBSNDFILE_INCLUDE_DIR)
|
||||
find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_LIBRARY
|
||||
LIBSNDFILE_INCLUDE_DIR)
|
||||
|
||||
29
cmake/FindRTLSDR.cmake
Normal file
29
cmake/FindRTLSDR.cmake
Normal 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)
|
||||
6
debian/control
vendored
6
debian/control
vendored
@@ -2,8 +2,8 @@ Source: dsd
|
||||
Section: hamradio
|
||||
Priority: optional
|
||||
Maintainer: Jared Szechy <jared.szechy@gmail.com>
|
||||
Build-Depends: debhelper (>= 9), libmbe-dev, libitpp-dev, libsndfile1-dev,
|
||||
portaudio19-dev, cmake, git, help2man
|
||||
Build-Depends: debhelper (>= 9), libmbe-dev, libitpp-dev, librtlsdr-dev
|
||||
libsndfile1-dev, portaudio19-dev, cmake, git, help2man
|
||||
Standards-Version: 4.1.4
|
||||
Homepage: https://github.com/szechyjs/dsd
|
||||
Vcs-Git: https://github.com/szechyjs/dsd.git
|
||||
@@ -17,4 +17,4 @@ Pre-Depends: ${misc:Pre-Depends}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Digital Speech Decoder
|
||||
DSD is able to decode several digital voice formats from discriminator tap
|
||||
audio and synthesize the decoded speech.
|
||||
audio and synthesize the decoded speech.
|
||||
|
||||
10
debian/copyright
vendored
10
debian/copyright
vendored
@@ -20,6 +20,14 @@ Files: src/dstar_header.c include/dstar_header.h include/fcs.h
|
||||
Copyright: Copyright (C) 2010 by Kristoff Bonne, ON1ARF
|
||||
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
|
||||
Copyright: Copyright (C) 2011 by Jonathan Naylor, G4KLX
|
||||
License: GPL-2
|
||||
@@ -103,4 +111,4 @@ License: BSL-1.0
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -58,10 +58,16 @@
|
||||
#define PA_LATENCY_OUT 0.100
|
||||
#endif
|
||||
|
||||
#ifdef USE_RTLSDR
|
||||
#include <rtl-sdr.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* global variables
|
||||
*/
|
||||
extern int exitflag;
|
||||
|
||||
static volatile int exitflag;
|
||||
//volatile int exitflag; //didn't work, couldn't build, multiple definitions of exitflag
|
||||
|
||||
|
||||
typedef struct
|
||||
@@ -85,7 +91,9 @@ typedef struct
|
||||
#ifdef USE_PORTAUDIO
|
||||
PaStream* audio_in_pa_stream;
|
||||
#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];
|
||||
int audio_out_fd;
|
||||
SNDFILE *audio_out_file;
|
||||
@@ -129,6 +137,8 @@ typedef struct
|
||||
int delay;
|
||||
int use_cosine_filter;
|
||||
int unmute_encrypted_p25;
|
||||
int rtl_dev_index;
|
||||
int rtl_gain_value;
|
||||
} dsd_opts;
|
||||
|
||||
typedef struct
|
||||
@@ -317,4 +327,15 @@ void processDSTAR_HD (dsd_opts * opts, dsd_state * state);
|
||||
short dmr_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
|
||||
|
||||
103
src/dsd_audio.c
103
src/dsd_audio.c
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "dsd.h"
|
||||
|
||||
|
||||
void
|
||||
processAudio (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
@@ -164,7 +163,7 @@ writeSynthesizedVoice (dsd_opts * opts, dsd_state * state)
|
||||
// for(n=0; n<160; n++)
|
||||
// printf("%d ", ((short*)(state->audio_out_temp_buf))[n]);
|
||||
// printf("\n");
|
||||
|
||||
|
||||
aout_buf_p = aout_buf;
|
||||
state->audio_out_temp_buf_p = state->audio_out_temp_buf;
|
||||
|
||||
@@ -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
|
||||
playSynthesizedVoice (dsd_opts * opts, dsd_state * state)
|
||||
@@ -309,7 +386,7 @@ int getPADevice(char* dev, int input, PaStream** stream)
|
||||
printf( "ERROR: Requested device %d is larger than number of devices.\n", devnum );
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
const PaDeviceInfo *deviceInfo = Pa_GetDeviceInfo( devnum );
|
||||
|
||||
/* print device name */
|
||||
@@ -500,6 +577,10 @@ openAudioInDevice (dsd_opts * opts)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
else if(strncmp(opts->audio_in_dev, "rtl", 3) == 0)
|
||||
{
|
||||
opts->audio_in_type = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct stat stat_buf;
|
||||
@@ -529,9 +610,9 @@ openAudioInDevice (dsd_opts * opts)
|
||||
#ifdef SOLARIS
|
||||
sample_info_t aset, aget;
|
||||
int rgain;
|
||||
|
||||
|
||||
rgain = 64;
|
||||
|
||||
|
||||
if (opts->split == 1)
|
||||
{
|
||||
opts->audio_in_fd = open (opts->audio_in_dev, O_RDONLY);
|
||||
@@ -545,10 +626,10 @@ openAudioInDevice (dsd_opts * opts)
|
||||
printf ("Error, couldn't open %s\n", opts->audio_in_dev);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
// get current
|
||||
ioctl (opts->audio_in_fd, AUDIO_GETINFO, &aset);
|
||||
|
||||
|
||||
aset.record.sample_rate = SAMPLE_RATE_IN;
|
||||
aset.play.sample_rate = SAMPLE_RATE_IN;
|
||||
aset.record.channels = 1;
|
||||
@@ -559,7 +640,7 @@ openAudioInDevice (dsd_opts * opts)
|
||||
aset.play.encoding = AUDIO_ENCODING_LINEAR;
|
||||
aset.record.port = AUDIO_LINE_IN;
|
||||
aset.record.gain = rgain;
|
||||
|
||||
|
||||
if (ioctl (opts->audio_in_fd, AUDIO_SETINFO, &aset) == -1)
|
||||
{
|
||||
printf ("Error setting sample device parameters\n");
|
||||
@@ -569,7 +650,7 @@ openAudioInDevice (dsd_opts * opts)
|
||||
|
||||
#if defined(BSD) && !defined(__APPLE__)
|
||||
int fmt;
|
||||
|
||||
|
||||
if (opts->split == 1)
|
||||
{
|
||||
opts->audio_in_fd = open (opts->audio_in_dev, O_RDONLY);
|
||||
@@ -578,13 +659,13 @@ openAudioInDevice (dsd_opts * opts)
|
||||
{
|
||||
opts->audio_in_fd = open (opts->audio_in_dev, O_RDWR);
|
||||
}
|
||||
|
||||
|
||||
if (opts->audio_in_fd == -1)
|
||||
{
|
||||
printf ("Error, couldn't open %s\n", opts->audio_in_dev);
|
||||
opts->audio_out = 0;
|
||||
}
|
||||
|
||||
|
||||
fmt = 0;
|
||||
if (ioctl (opts->audio_in_fd, SNDCTL_DSP_RESET) < 0)
|
||||
{
|
||||
|
||||
@@ -211,7 +211,8 @@ closeMbeOutFile (dsd_opts * opts, dsd_state * state)
|
||||
fclose (opts->mbe_out_f);
|
||||
opts->mbe_out_f = NULL;
|
||||
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);
|
||||
#ifdef _WIN32
|
||||
sprintf (shell, "move %s %s", opts->mbe_out_path, new_path);
|
||||
|
||||
@@ -31,7 +31,7 @@ printFrameInfo (dsd_opts * opts, dsd_state * state)
|
||||
level = (int) state->max / 164;
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
printf ("inlvl: %2i%% ", level);
|
||||
//printf ("inlvl: %2i%% ", level);
|
||||
}
|
||||
if (state->nac != 0)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
level = (int) state->max / 164;
|
||||
printf ("inlvl: %2i%% ", level);
|
||||
//printf ("inlvl: %2i%% ", level);
|
||||
}
|
||||
}
|
||||
state->nac = 0;
|
||||
@@ -112,7 +112,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
level = (int) state->max / 164;
|
||||
printf ("inlvl: %2i%% ", level);
|
||||
//printf ("inlvl: %2i%% ", level);
|
||||
}
|
||||
}
|
||||
state->nac = 0;
|
||||
@@ -134,7 +134,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
level = (int) state->max / 164;
|
||||
printf ("inlvl: %2i%% ", level);
|
||||
//printf ("inlvl: %2i%% ", level);
|
||||
}
|
||||
}
|
||||
state->nac = 0;
|
||||
@@ -156,7 +156,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
level = (int) state->max / 164;
|
||||
printf ("inlvl: %2i%% ", level);
|
||||
//printf ("inlvl: %2i%% ", level);
|
||||
}
|
||||
}
|
||||
state->nac = 0;
|
||||
@@ -179,7 +179,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
level = (int) state->max / 164;
|
||||
printf ("inlvl: %2i%% ", level);
|
||||
//printf ("inlvl: %2i%% ", level);
|
||||
}
|
||||
}
|
||||
if ((state->synctype == 11) || (state->synctype == 12))
|
||||
@@ -233,7 +233,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->verbose > 0)
|
||||
{
|
||||
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))
|
||||
|
||||
@@ -16,27 +16,73 @@
|
||||
*/
|
||||
|
||||
#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
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
printf ("o: %4i ", offset);
|
||||
printw("o: %4i ", offset);
|
||||
}
|
||||
if (opts->verbose > 1)
|
||||
{
|
||||
printf ("mod: %s ", modulation);
|
||||
printw("mod: %s ", modulation);
|
||||
}
|
||||
if (opts->verbose > 2)
|
||||
{
|
||||
printf ("g: %f ", state->aout_gain);
|
||||
printw("g: %f ", state->aout_gain);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
int
|
||||
@@ -100,6 +146,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
||||
if ((opts->symboltiming == 1) && (state->carrier == 1))
|
||||
{
|
||||
printf ("\nSymbol Timing:\n");
|
||||
//printw("\nSymbol Timing:\n");
|
||||
}
|
||||
while (sync == 0)
|
||||
{
|
||||
@@ -489,8 +536,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
sprintf (state->ftype, " ProVoice ");
|
||||
if (opts->errorbars == 1)
|
||||
//if (opts->errorbars == 1 && (time(NULL) - now) > 2 )
|
||||
{
|
||||
printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation);
|
||||
now = time(NULL);
|
||||
}
|
||||
state->lastsynctype = 14;
|
||||
return (14);
|
||||
@@ -503,8 +552,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
sprintf (state->ftype, " ProVoice ");
|
||||
if (opts->errorbars == 1)
|
||||
//if (opts->errorbars == 1 && (time(NULL) - now) > 2 )
|
||||
{
|
||||
printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation);
|
||||
now = time(NULL);
|
||||
}
|
||||
state->lastsynctype = 15;
|
||||
return (15);
|
||||
@@ -819,6 +870,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
||||
if ((opts->errorbars == 1) && (opts->verbose > 1) && (state->carrier == 1))
|
||||
{
|
||||
printf ("Sync: no sync\n");
|
||||
printf("Press CTRL + C to close.\n"); //Kindly remind user to double tap CTRL + C
|
||||
}
|
||||
noCarrier (opts, state);
|
||||
return (-1);
|
||||
|
||||
188
src/dsd_main.c
188
src/dsd_main.c
@@ -28,7 +28,18 @@
|
||||
#include "p25p1_heuristics.h"
|
||||
#include "pa_devs.h"
|
||||
|
||||
int exitflag = 0;
|
||||
#include <locale.h>
|
||||
#include <ncurses.h>
|
||||
char * FM_banner[9] = {
|
||||
" CTRL + C twice to exit",
|
||||
"██████╗ ██████╗██████╗ ███████╗███╗ ███╗███████╗",
|
||||
"██╔══██╗██╔════╝██╔══██╗ ██╔════╝████╗ ████║██╔════╝",
|
||||
"██║ ██║╚█████╗ ██║ ██║ █████╗ ██╔████╔██║█████╗ ",
|
||||
"██║ ██║ ╚═══██╗██║ ██║ ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
|
||||
"██████╔╝██████╔╝██████╔╝ ██║ ██║ ╚═╝ ██║███████╗",
|
||||
"╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝",
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
comp (const void *a, const void *b)
|
||||
@@ -80,6 +91,11 @@ noCarrier (dsd_opts * opts, dsd_state * state)
|
||||
sprintf (state->algid, "________");
|
||||
sprintf (state->keyid, "________________");
|
||||
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
|
||||
@@ -142,6 +158,8 @@ initOpts (dsd_opts * opts)
|
||||
opts->delay = 0;
|
||||
opts->use_cosine_filter = 1;
|
||||
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
|
||||
@@ -267,15 +285,21 @@ usage ()
|
||||
printf (" -z <num> Frame rate for datascope\n");
|
||||
printf ("\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 (" -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 (" -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 ("\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 (" -B <num> Serial port baud rate (default=115200)\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 (" -f1 Decode only P25 Phase 1\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 (" -fp Decode only ProVoice*\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 );
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while starting the portaudio input stream\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
//fprintf( stderr, "An error occured while starting the portaudio input stream\n" );
|
||||
//fprintf( stderr, "Error number: %d\n", err );
|
||||
//fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_RTLSDR
|
||||
if(opts->audio_in_type == 3)
|
||||
{
|
||||
open_rtlsdr_stream(opts);
|
||||
}
|
||||
#endif
|
||||
while (1)
|
||||
{
|
||||
@@ -378,9 +408,9 @@ cleanupAndExit (dsd_opts * opts, dsd_state * state)
|
||||
err = Pa_CloseStream( opts->audio_in_pa_stream );
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while closing the portaudio input stream\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
//fprintf( stderr, "An error occured while closing the portaudio input stream\n" );
|
||||
//fprintf( stderr, "Error number: %d\n", err );
|
||||
//fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
}
|
||||
}
|
||||
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 );
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while closing the portaudio output stream\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
//fprintf( stderr, "An error occured while closing the portaudio output stream\n" );
|
||||
//fprintf( stderr, "Error number: %d\n", err );
|
||||
//fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
}
|
||||
err = Pa_CloseStream( opts->audio_out_pa_stream );
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while closing the portaudio output stream\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
//fprintf( stderr, "An error occured while closing the portaudio output stream\n" );
|
||||
//fprintf( stderr, "Error number: %d\n", err );
|
||||
//fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
}
|
||||
}
|
||||
err = Pa_Terminate();
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while terminating portaudio\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
//fprintf( stderr, "An error occured while terminating portaudio\n" );
|
||||
//fprintf( stderr, "Error number: %d\n", err );
|
||||
//fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_RTLSDR
|
||||
if(opts->audio_in_type == 3)
|
||||
{
|
||||
// TODO: cleanup demod threads
|
||||
cleanup_rtlsdr_stream();
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("\n");
|
||||
printf("Total audio errors: %i\n", state->debug_audio_errors);
|
||||
printf("Total header errors: %i\n", state->debug_header_errors);
|
||||
@@ -448,6 +486,61 @@ sigfun (int sig)
|
||||
{
|
||||
exitflag = 1;
|
||||
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
|
||||
@@ -461,7 +554,12 @@ main (int argc, char **argv)
|
||||
char versionstr[25];
|
||||
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);
|
||||
|
||||
initOpts (&opts);
|
||||
@@ -470,7 +568,7 @@ main (int argc, char **argv)
|
||||
exitflag = 0;
|
||||
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;
|
||||
switch (c)
|
||||
@@ -507,6 +605,9 @@ main (int argc, char **argv)
|
||||
opts.unmute_encrypted_p25 = 1;
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
sscanf (optarg, "%i", &opts.rtlsdr_ppm_error);
|
||||
break;
|
||||
case 'q':
|
||||
opts.errorbars = 0;
|
||||
opts.verbose = 0;
|
||||
@@ -528,6 +629,18 @@ main (int argc, char **argv)
|
||||
case 'v':
|
||||
sscanf (optarg, "%d", &opts.verbose);
|
||||
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':
|
||||
sscanf (optarg, "%d", &opts.scoperate);
|
||||
opts.errorbars = 0;
|
||||
@@ -542,6 +655,7 @@ main (int argc, char **argv)
|
||||
case 'i':
|
||||
strncpy(opts.audio_in_dev, optarg, 1023);
|
||||
opts.audio_in_dev[1023] = '\0';
|
||||
//printf("audio_in_dev = %s\n", opts.audio_in_dev);
|
||||
break;
|
||||
case 'o':
|
||||
strncpy(opts.audio_out_dev, optarg, 1023);
|
||||
@@ -552,6 +666,10 @@ main (int argc, char **argv)
|
||||
opts.mbe_out_dir[1023] = '\0';
|
||||
printf ("Writing mbe data files to directory %s\n", opts.mbe_out_dir);
|
||||
break;
|
||||
case 'c':
|
||||
opts.rtlsdr_center_freq = (uint32_t)atofs(optarg);
|
||||
printf("Tuning to frequency: %i\n", opts.rtlsdr_center_freq);
|
||||
break;
|
||||
case 'g':
|
||||
sscanf (optarg, "%f", &opts.audio_gain);
|
||||
if (opts.audio_gain < (float) 0 )
|
||||
@@ -815,9 +933,9 @@ main (int argc, char **argv)
|
||||
PaError err = Pa_Initialize();
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while initializing portaudio\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
//fprintf( stderr, "An error occured while initializing portaudio\n" );
|
||||
//fprintf( stderr, "Error number: %d\n", err );
|
||||
//fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
exit(err);
|
||||
}
|
||||
}
|
||||
@@ -851,7 +969,25 @@ main (int argc, char **argv)
|
||||
openAudioOutDevice (&opts, SAMPLE_RATE_OUT);
|
||||
}
|
||||
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
|
||||
{
|
||||
opts.split = 0;
|
||||
@@ -865,10 +1001,12 @@ main (int argc, char **argv)
|
||||
{
|
||||
playMbeFiles (&opts, &state, argc, argv);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
liveScanner (&opts, &state);
|
||||
}
|
||||
cleanupAndExit (&opts, &state);
|
||||
endwin();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
printf ("%s", state->err_str);
|
||||
//printw("%s", state->err_str);
|
||||
}
|
||||
|
||||
state->debug_audio_errors += state->errs2;
|
||||
|
||||
@@ -88,18 +88,25 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
|
||||
cleanupAndExit (opts, state);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else if (opts->audio_in_type == 2)
|
||||
{
|
||||
#ifdef USE_PORTAUDIO
|
||||
PaError err = Pa_ReadStream( opts->audio_in_pa_stream, &sample, 1 );
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while using the portaudio input stream\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
}
|
||||
PaError err = Pa_ReadStream( opts->audio_in_pa_stream, &sample, 1 );
|
||||
if( err != paNoError )
|
||||
{
|
||||
fprintf( stderr, "An error occured while using the portaudio input stream\n" );
|
||||
fprintf( stderr, "Error number: %d\n", err );
|
||||
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
|
||||
}
|
||||
#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
|
||||
state->debug_sample_index++;
|
||||
|
||||
151
src/provoice.c
151
src/provoice.c
@@ -5,25 +5,28 @@ void
|
||||
processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
int i, j, dibit;
|
||||
|
||||
//char datestr[32];
|
||||
char imbe7100_fr1[7][24];
|
||||
char imbe7100_fr2[7][24];
|
||||
const int *w, *x;
|
||||
//struct tm timep;
|
||||
|
||||
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++)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
// lid
|
||||
@@ -31,22 +34,22 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
// imbe frames 1,2 first half
|
||||
@@ -59,14 +62,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -74,14 +77,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -89,14 +92,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -104,25 +107,25 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
// spacer bits
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
printf (" ");
|
||||
//printf ("%i", dibit);
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
// imbe frames 1,2 second half
|
||||
@@ -131,14 +134,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
@@ -147,14 +150,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -162,14 +165,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -177,14 +180,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 5;
|
||||
x -= 5;
|
||||
@@ -192,14 +195,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
@@ -208,14 +211,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -223,14 +226,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -238,14 +241,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 5;
|
||||
x -= 5;
|
||||
@@ -253,14 +256,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1);
|
||||
@@ -269,23 +272,23 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
// spacer bits
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
printf (" ");
|
||||
//printf ("%i", dibit);
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
// imbe frames 3,4 first half
|
||||
@@ -297,14 +300,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -312,28 +315,28 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
}
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -341,25 +344,25 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
// spacer bits
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
printf ("_");
|
||||
//printf ("%i", dibit);
|
||||
//printf ("_");
|
||||
#endif
|
||||
|
||||
// imbe frames 3,4 second half
|
||||
@@ -367,14 +370,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
@@ -382,14 +385,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -397,14 +400,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -412,14 +415,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 5;
|
||||
x -= 5;
|
||||
@@ -427,14 +430,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
@@ -443,14 +446,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 6;
|
||||
x -= 6;
|
||||
@@ -458,14 +461,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -473,14 +476,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr1[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("_");
|
||||
//printf ("_");
|
||||
#endif
|
||||
w -= 5;
|
||||
x -= 5;
|
||||
@@ -488,14 +491,14 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
imbe7100_fr2[*w][*x] = dibit;
|
||||
w++;
|
||||
x++;
|
||||
}
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf (" ");
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1);
|
||||
@@ -504,12 +507,12 @@ processProVoice (dsd_opts * opts, dsd_state * state)
|
||||
// spacer bits
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
//printf ("%i", dibit);
|
||||
#endif
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef PROVOICE_DUMP
|
||||
printf ("%i", dibit);
|
||||
printf (" ");
|
||||
//printf ("%i", dibit);
|
||||
//printf (" ");
|
||||
#endif
|
||||
|
||||
if (opts->errorbars == 1)
|
||||
|
||||
1148
src/rtl_sdr_fm.cpp
Normal file
1148
src/rtl_sdr_fm.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user