tweaks to help debug some freedv audio issues
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 17 Jun 2015 07:59:06 +0000 (07:59 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 17 Jun 2015 07:59:06 +0000 (07:59 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2200 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/CMakeLists.txt
codec2-dev/src/codec2_cohpsk.h
codec2-dev/src/cohpsk.c
codec2-dev/src/freedv_api.c
codec2-dev/src/freedv_rx.c

index dac874ae209ce8280f568b54c3173a70358403a6..d0df3f54d39c980924c59fd62e942215e80b7613 100644 (file)
@@ -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
+
 )
 
 #
index 2b578601691c6d924555c0f70c103a042342246a..cea97ab69253b4ac4be6b40d38a987af0035d574 100644 (file)
@@ -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
index a8ec0c227eaecde979a7e9b2b1a31e44a4df91b4..4c3231e402a02bd97d56bc48504a5f46612c3f9c 100644 (file)
@@ -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;
+}
+
+
index efb69192bfba95dc3096e62cd172223ebe8c17d1..5d672beb98ccda45f207a9faa8739eb654bd104c 100644 (file)
@@ -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; i<nin_prev; i++)
                 speech_out[i] = FDMDV_SCALE*demod_in[i].real;
+            //fprintf(stderr, "%d %d %d\n", nin_prev, speech_out[0], speech_out[nin_prev-1]);
             nout = nin_prev;
         }
     }
@@ -600,7 +602,7 @@ int freedv_comprx(struct freedv *f, short speech_out[], COMP demod_in[]) {
             /* this lets us "hear" whats going on, e.g. during tuning */
             /* need to linearly interp as Fs in and out slightly different */
 
-            for(i=0, t=0.0; i<f->n_speech_samples; i++, t+=f->modem_sample_rate/FS) {
+            for(i=0, t=0.0; i<f->n_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]);
         }
      }
 
index eb1d8d916cadffa7f60c8730382dc7d8d2935469..285b619ebf7ade128b3978b4e0788a834835ff8d 100644 (file)
@@ -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);