From f75d57cada720c4b8b8c63861c39152acaeeea5d Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Fri, 22 Nov 2019 09:26:17 +0100
Subject: [PATCH] audio interface

---
 transmitter.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/transmitter.c b/transmitter.c
index a2b3340..bf41168 100644
--- a/transmitter.c
+++ b/transmitter.c
@@ -52,6 +52,7 @@
 #include "freedv.h"
 #endif
 #include "audio_waterfall.h"
+#include "audio.h"
 #include "ext.h"
 
 double getNextSideToneSample();
@@ -96,8 +97,6 @@ static int cw_shape = 0;
 extern double cwramp48[];		// see cwramp.c, for 48 kHz sample rate
 extern double cwramp192[];		// see cwramp.c, for 192 kHz sample rate
 
-extern void cw_audio_write(double sample);
-
 static void init_analyzer(TRANSMITTER *tx);
 
 static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) {
@@ -1070,7 +1069,7 @@ static void full_tx_buffer(TRANSMITTER *tx) {
 
 void add_mic_sample(TRANSMITTER *tx,short mic_sample) {
   int mode=tx->mode;
-  double sample;
+  float cwsample;
   double mic_sample_double, ramp;
   int i,s;
   int updown;
@@ -1122,8 +1121,8 @@ void add_mic_sample(TRANSMITTER *tx,short mic_sample) {
 	// store the ramp value in cw_shape_buffer, but also use it for shaping the "local"
 	// side tone
 	ramp=cwramp48[cw_shape];
-	sample=0.0078 * getNextSideToneSample() * cw_keyer_sidetone_volume * ramp;
-	cw_audio_write(sample);
+	cwsample=0.0078 * getNextSideToneSample() * cw_keyer_sidetone_volume * ramp;
+	cw_audio_write(cwsample);
         cw_shape_buffer48[tx->samples]=ramp;
 	//
 	// In the new protocol, we MUST maintain a constant flow of audio samples to the radio
@@ -1138,7 +1137,7 @@ void add_mic_sample(TRANSMITTER *tx,short mic_sample) {
 	//
         if (protocol == NEW_PROTOCOL) {
  	    s=0;
- 	    if (!cw_keyer_internal || CAT_cw_is_active) s=(int) (sample * 32767.0);
+ 	    if (!cw_keyer_internal || CAT_cw_is_active) s=(int) (cwsample * 32767.0);
 	    new_protocol_cw_audio_samples(s, s);
 	    s=4*cw_shape;
 	    i=4*tx->samples;
-- 
2.45.2