From bf0290d8cc6fe6779b847c2ee8f06ad4c3e99685 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Wed, 17 Jun 2015 07:59:06 +0000 Subject: [PATCH] tweaks to help debug some freedv audio issues git-svn-id: https://svn.code.sf.net/p/freetel/code@2200 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/CMakeLists.txt | 5 +++++ codec2-dev/src/codec2_cohpsk.h | 1 + codec2-dev/src/cohpsk.c | 9 +++++++++ codec2-dev/src/freedv_api.c | 5 ++++- codec2-dev/src/freedv_rx.c | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/codec2-dev/src/CMakeLists.txt b/codec2-dev/src/CMakeLists.txt index dac874ae..d0df3f54 100644 --- a/codec2-dev/src/CMakeLists.txt +++ b/codec2-dev/src/CMakeLists.txt @@ -217,6 +217,11 @@ set(CODEC2_PUBLIC_HEADERS codec2_fm.h codec2_fifo.h comp.h + modem_stats.h + kiss_fft.h + freedv_api.h + varicode.h + ) # diff --git a/codec2-dev/src/codec2_cohpsk.h b/codec2-dev/src/codec2_cohpsk.h index 2b578601..cea97ab6 100644 --- a/codec2-dev/src/codec2_cohpsk.h +++ b/codec2-dev/src/codec2_cohpsk.h @@ -48,5 +48,6 @@ void cohpsk_mod(struct COHPSK *cohpsk, COMP tx_fdm[], int tx_bits[]); void cohpsk_clip(COMP tx_fdm[]); void cohpsk_demod(struct COHPSK *cohpsk, float rx_bits[], int *sync, COMP rx_fdm[], int *nin_frame); void cohpsk_get_demod_stats(struct COHPSK *cohpsk, struct MODEM_STATS *stats); +void cohpsk_set_verbose(struct COHPSK *coh, int verbose); #endif diff --git a/codec2-dev/src/cohpsk.c b/codec2-dev/src/cohpsk.c index a8ec0c22..4c3231e4 100644 --- a/codec2-dev/src/cohpsk.c +++ b/codec2-dev/src/cohpsk.c @@ -1123,3 +1123,12 @@ void cohpsk_get_demod_stats(struct COHPSK *coh, struct MODEM_STATS *stats) } } } + + +void cohpsk_set_verbose(struct COHPSK *coh, int verbose) +{ + assert(coh != NULL); + coh->verbose = verbose; +} + + diff --git a/codec2-dev/src/freedv_api.c b/codec2-dev/src/freedv_api.c index efb69192..5d672beb 100644 --- a/codec2-dev/src/freedv_api.c +++ b/codec2-dev/src/freedv_api.c @@ -541,8 +541,10 @@ int freedv_comprx(struct freedv *f, short speech_out[], COMP demod_in[]) { else { /* if not in sync pass through analog samples */ /* this lets us "hear" whats going on, e.g. during tuning */ + for(i=0; in_speech_samples; i++, t+=f->modem_sample_rate/FS) { + for(i=0, t=0.0; in_speech_samples; i++, t+=(float)f->modem_sample_rate/FS) { t1 = floor(t); t2 = ceil(t); a = t - t1; b = t2 - t1; @@ -608,6 +610,7 @@ int freedv_comprx(struct freedv *f, short speech_out[], COMP demod_in[]) { speech_out[i] = FDMDV_SCALE*s; } nout = f->n_speech_samples; + //fprintf(stderr, "%d %d %d\n", f->n_speech_samples, speech_out[0], speech_out[nin_prev-1]); } } diff --git a/codec2-dev/src/freedv_rx.c b/codec2-dev/src/freedv_rx.c index eb1d8d91..285b619e 100644 --- a/codec2-dev/src/freedv_rx.c +++ b/codec2-dev/src/freedv_rx.c @@ -92,6 +92,7 @@ int main(int argc, char *argv[]) { } freedv = freedv_open(mode); + cohpsk_set_verbose(freedv->cohpsk, 1); assert(freedv != NULL); speech_out = (short*)malloc(sizeof(short)*freedv->n_speech_samples); -- 2.25.1