From 5242882a4efec0ab92506aeb3469e27fc78f1524 Mon Sep 17 00:00:00 2001 From: c vw Date: Sun, 23 May 2021 12:23:12 +0200 Subject: [PATCH] Include RECEIVER in parameter list of cw_audio_write() --- audio.c | 4 +--- audio.h | 2 +- portaudio.c | 3 +-- transmitter.c | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/audio.c b/audio.c index a9bb39c..ff200fa 100644 --- 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 234c184..5f6832d 100644 --- 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(); diff --git a/portaudio.c b/portaudio.c index dfb4e89..c68d1f7 100644 --- a/portaudio.c +++ b/portaudio.c @@ -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; diff --git a/transmitter.c b/transmitter.c index ec74483..e2a74ac 100644 --- a/transmitter.c +++ b/transmitter.c @@ -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 -- 2.45.2