]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Include RECEIVER in parameter list of cw_audio_write()
authorc vw <dl1ycf@darc.de>
Sun, 23 May 2021 10:23:12 +0000 (12:23 +0200)
committerc vw <dl1ycf@darc.de>
Sun, 23 May 2021 10:23:12 +0000 (12:23 +0200)
audio.c
audio.h
portaudio.c
transmitter.c

diff --git a/audio.c b/audio.c
index a9bb39cda5298b6d053d7a552fd9a2d0263393f8..ff200fabe6c587d352882dc07309e018ca15879e 100644 (file)
--- a/audio.c
+++ b/audio.c
@@ -320,7 +320,7 @@ g_print("audio_close_input: free mic buffer\n");
 // Note that when sending the buffer, delay "jumps" by the buffer size
 //
 
-int cw_audio_write(float sample){
+int cw_audio_write(RECEIVER *rx, float sample){
   snd_pcm_sframes_t delay;
   long rc;
   float *float_buffer;
@@ -329,8 +329,6 @@ int cw_audio_write(float sample){
   static int count=0;
   int    short_audio_buffer_size;
        
-  RECEIVER *rx = active_receiver;
   g_mutex_lock(&rx->local_audio_mutex);
   if(rx->playback_handle!=NULL && rx->local_audio_buffer!=NULL) {
 
diff --git a/audio.h b/audio.h
index 234c184e7d9cb85424132a3ae2dd7140a4adc8bf..5f6832df105351ef2dcaac6f7cd230d9e6cc2533 100644 (file)
--- a/audio.h
+++ b/audio.h
@@ -42,7 +42,7 @@ extern void audio_close_input();
 extern int audio_open_output(RECEIVER *rx);
 extern void audio_close_output(RECEIVER *rx);
 extern int audio_write(RECEIVER *rx,float left_sample,float right_sample);
-extern int cw_audio_write(float sample);
+extern int cw_audio_write(RECEIVER *rx, float sample);
 extern void audio_get_cards();
 char * audio_get_error_string(int err);
 float  audio_get_next_mic_sample();
index dfb4e896d4b34436621cd1cae5c7cad0a33f212a..c68d1f718c169002594c52f86c9b66bd16e9d4cb 100644 (file)
@@ -577,8 +577,7 @@ int audio_write (RECEIVER *rx, float left, float right)
 //
 // Thus we have an active latency management.
 //
-int cw_audio_write(float sample) {
-  RECEIVER *rx = active_receiver;
+int cw_audio_write(RECEIVER *rx, float sample) {
   float *buffer = rx->local_audio_buffer;
   int oldpt, newpt;
   static int count=0;
index ec7448370e2f8610ec852827ba4f335370b26a49..e2a74ac56d9b5a9558e37d53d828ca0526a062b5 100644 (file)
@@ -1422,7 +1422,7 @@ void add_mic_sample(TRANSMITTER *tx,float mic_sample) {
        // side tone
        ramp=cwramp48[cw_shape];
        cwsample=0.00197 * getNextSideToneSample() * cw_keyer_sidetone_volume * ramp;
-       cw_audio_write(cwsample);
+       cw_audio_write(active_receiver, cwsample);
         cw_shape_buffer48[tx->samples]=ramp;
        //
        // In the new protocol, we MUST maintain a constant flow of audio samples to the radio