aboutsummaryrefslogtreecommitdiffstats
path: root/src/radio/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/radio/radio.c')
-rw-r--r--src/radio/radio.c164
1 files changed, 91 insertions, 73 deletions
diff --git a/src/radio/radio.c b/src/radio/radio.c
index e56ea8e..dcc0b4d 100644
--- a/src/radio/radio.c
+++ b/src/radio/radio.c
@@ -25,7 +25,7 @@
#include <errno.h>
#include <pthread.h>
#include "../libsample/sample.h"
-#include "../libdebug/debug.h"
+#include "../liblogging/logging.h"
#include "../libsound/sound.h"
#include "../libclipper/clipper.h"
#include "radio.h"
@@ -38,14 +38,14 @@
static char freq_name[2][64];
-int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, const char *tx_wave_file, const char *rx_wave_file, const char *tx_audiodev, const char *rx_audiodev, enum modulation modulation, double bandwidth, double deviation, double modulation_index, double time_constant_us, double volume, int stereo, int rds, int rds2)
+int radio_init(radio_t *radio, int buffer_size, int samplerate, double frequency, const char *tx_wave_file, const char *rx_wave_file, const char *tx_audiodev, const char *rx_audiodev, enum modulation modulation, double bandwidth, double deviation, double modulation_index, double time_constant_us, double volume, int stereo, int rds, int rds2)
{
int rc = -EINVAL;
clipper_init(CLIP_POINT);
memset(radio, 0, sizeof(*radio));
- radio->latspl = latspl;
+ radio->buffer_size = buffer_size;
radio->volume = volume;
radio->stereo = stereo;
radio->rds = rds;
@@ -75,7 +75,7 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
radio->signal_bandwidth = bandwidth;
break;
case MODULATION_NONE:
- PDEBUG(DRADIO, DEBUG_ERROR, "Wrong modulation, please fix!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Wrong modulation, please fix!\n");
goto error;
}
@@ -85,12 +85,12 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
radio->tx_audio_channels = 0;
rc = wave_create_playback(&radio->wave_tx_play, tx_wave_file, &_samplerate, &radio->tx_audio_channels, 1.0);
if (rc < 0) {
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to create WAVE playback instance!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Failed to create WAVE playback instance!\n");
goto error;
}
if (radio->tx_audio_channels != 1 && radio->tx_audio_channels != 2)
{
- PDEBUG(DRADIO, DEBUG_ERROR, "WAVE file must have one or two channels!\n");
+ LOGP(DRADIO, LOGL_ERROR, "WAVE file must have one or two channels!\n");
goto error;
}
radio->tx_audio_samplerate = _samplerate;
@@ -100,18 +100,18 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
/* open audio device */
radio->tx_audio_samplerate = 48000;
radio->tx_audio_channels = (stereo) ? 2 : 1;
- radio->tx_sound = sound_open(tx_audiodev, NULL, NULL, NULL, radio->tx_audio_channels, 0.0, radio->tx_audio_samplerate, radio->latspl, 1.0, 0.0, 2.0);
+ radio->tx_sound = sound_open(SOUND_DIR_PLAY, tx_audiodev, NULL, NULL, NULL, radio->tx_audio_channels, 0.0, radio->tx_audio_samplerate, radio->buffer_size, 1.0, 1.0, 0.0, 2.0);
if (!radio->tx_sound) {
rc = -EIO;
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to open sound device!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Failed to open sound device!\n");
goto error;
}
- jitter_create(&radio->tx_dejitter[0], radio->tx_audio_samplerate / 5);
- jitter_create(&radio->tx_dejitter[1], radio->tx_audio_samplerate / 5);
+ jitter_create(&radio->tx_dejitter[0], "left", radio->tx_audio_samplerate, 0.050, 0.500, JITTER_FLAG_NONE);
+ jitter_create(&radio->tx_dejitter[1], "right", radio->tx_audio_samplerate, 0.050, 0.500, JITTER_FLAG_NONE);
radio->tx_audio_mode = AUDIO_MODE_AUDIODEV;
#else
rc = -ENOTSUP;
- PDEBUG(DRADIO, DEBUG_ERROR, "No sound card support compiled in!\n");
+ LOGP(DRADIO, LOGL_ERROR, "No sound card support compiled in!\n");
goto error;
#endif
} else {
@@ -124,7 +124,7 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
radio->testtone[0] = calloc(radio->testtone_length * 2, sizeof(sample_t));
if (!radio->testtone[0]) {
rc = -ENOMEM;
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to allocate test sound buffer!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Failed to allocate test sound buffer!\n");
goto error;
}
radio->testtone[1] = radio->testtone[0] + radio->testtone_length;
@@ -153,7 +153,7 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
radio->rx_audio_channels = (radio->stereo) ? 2 : 1;
rc = wave_create_record(&radio->wave_rx_rec, rx_wave_file, radio->rx_audio_samplerate, radio->rx_audio_channels, 1.0);
if (rc < 0) {
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to create WAVE record instance!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Failed to create WAVE record instance!\n");
goto error;
}
radio->rx_audio_mode |= AUDIO_MODE_WAVEFILE;
@@ -164,42 +164,44 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
radio->rx_audio_samplerate = 48000;
radio->rx_audio_channels = (stereo) ? 2 : 1;
/* check if we use same device */
- if (radio->tx_sound && !strcmp(tx_audiodev, rx_audiodev))
- radio->rx_sound = radio->tx_sound;
- else
- radio->rx_sound = sound_open(rx_audiodev, NULL, NULL, NULL, radio->rx_audio_channels, 0.0, radio->rx_audio_samplerate, radio->latspl, 1.0, 0.0, 2.0);
+ radio->rx_sound = sound_open(SOUND_DIR_REC, rx_audiodev, NULL, NULL, NULL, radio->rx_audio_channels, 0.0, radio->rx_audio_samplerate, radio->buffer_size, 1.0, 1.0, 0.0, 2.0);
if (!radio->rx_sound) {
rc = -EIO;
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to open sound device!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Failed to open sound device!\n");
goto error;
}
- jitter_create(&radio->rx_dejitter[0], radio->rx_audio_samplerate / 5);
- jitter_create(&radio->rx_dejitter[1], radio->rx_audio_samplerate / 5);
+ jitter_create(&radio->rx_dejitter[0], "left", radio->rx_audio_samplerate, 0.050, 0.500, JITTER_FLAG_NONE);
+ jitter_create(&radio->rx_dejitter[1], "right", radio->rx_audio_samplerate, 0.050, 0.500, JITTER_FLAG_NONE);
radio->rx_audio_mode |= AUDIO_MODE_AUDIODEV;
#else
rc = -ENOTSUP;
- PDEBUG(DRADIO, DEBUG_ERROR, "No sound card support compiled in!\n");
+ LOGP(DRADIO, LOGL_ERROR, "No sound card support compiled in!\n");
goto error;
#endif
}
+ /* if no sink was selected, we use dummy settings */
+ if (!rx_wave_file && !rx_audiodev) {
+ radio->rx_audio_samplerate = 48000;
+ radio->rx_audio_channels = (stereo) ? 2 : 1;
+ }
/* check if sample rate is too low */
if (radio->tx_audio_samplerate > radio->signal_samplerate) {
rc = -EINVAL;
- PDEBUG(DRADIO, DEBUG_ERROR, "You have selected a signal processing sample rate of %.0f. Your audio sample rate is %.0f.\n", radio->signal_samplerate, radio->tx_audio_samplerate);
- PDEBUG(DRADIO, DEBUG_ERROR, "Please select a sample rate that is higher or equal the audio sample rate!\n");
+ LOGP(DRADIO, LOGL_ERROR, "You have selected a signal processing sample rate of %.0f. Your audio sample rate is %.0f.\n", radio->signal_samplerate, radio->tx_audio_samplerate);
+ LOGP(DRADIO, LOGL_ERROR, "Please select a sample rate that is higher or equal the audio sample rate!\n");
goto error;
}
if (radio->rx_audio_samplerate > radio->signal_samplerate) {
rc = -EINVAL;
- PDEBUG(DRADIO, DEBUG_ERROR, "You have selected a signal processing sample rate of %.0f. Your audio sample rate is %.0f.\n", radio->signal_samplerate, radio->rx_audio_samplerate);
- PDEBUG(DRADIO, DEBUG_ERROR, "Please select a sample rate that is higher or equal the audio sample rate!\n");
+ LOGP(DRADIO, LOGL_ERROR, "You have selected a signal processing sample rate of %.0f. Your audio sample rate is %.0f.\n", radio->signal_samplerate, radio->rx_audio_samplerate);
+ LOGP(DRADIO, LOGL_ERROR, "Please select a sample rate that is higher or equal the audio sample rate!\n");
goto error;
}
if (radio->signal_samplerate < radio->signal_bandwidth * 2 / 0.75) {
rc = -EINVAL;
- PDEBUG(DRADIO, DEBUG_ERROR, "You have selected a signal processing sample rate of %.0f. Your signal's bandwidth %.0f.\n", radio->signal_samplerate, radio->signal_bandwidth);
- PDEBUG(DRADIO, DEBUG_ERROR, "Your signal processing sample rate must be at least one third greater than the signal's double bandwidth. Use at least %.0f.\n", radio->signal_bandwidth * 2.0 / 0.75);
+ LOGP(DRADIO, LOGL_ERROR, "You have selected a signal processing sample rate of %.0f. Your signal's bandwidth %.0f.\n", radio->signal_samplerate, radio->signal_bandwidth);
+ LOGP(DRADIO, LOGL_ERROR, "Your signal processing sample rate must be at least one third greater than the signal's double bandwidth. Use at least %.0f.\n", radio->signal_bandwidth * 2.0 / 0.75);
goto error;
}
@@ -239,7 +241,7 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
if (time_constant_us > 0.0) {
radio->emphasis = 1;
/* time constant */
- PDEBUG(DRADIO, DEBUG_INFO, "Using emphasis cut-off at %.0f Hz.\n", timeconstant2cutoff(time_constant_us));
+ LOGP(DRADIO, LOGL_INFO, "Using emphasis cut-off at %.0f Hz.\n", timeconstant2cutoff(time_constant_us));
rc = init_emphasis(&radio->fm_emphasis[0], radio->signal_samplerate, timeconstant2cutoff(time_constant_us), DC_CUTOFF, radio->audio_bandwidth);
if (rc < 0)
goto error;
@@ -291,54 +293,54 @@ int radio_init(radio_t *radio, int latspl, int samplerate, double frequency, con
}
if (radio->tx_audio_mode)
- PDEBUG(DRADIO, DEBUG_INFO, "Bandwidth of audio source is %.0f Hz.\n", radio->tx_audio_samplerate / 2.0);
+ LOGP(DRADIO, LOGL_INFO, "Bandwidth of audio source is %.0f Hz.\n", radio->tx_audio_samplerate / 2.0);
if (radio->rx_audio_mode)
- PDEBUG(DRADIO, DEBUG_INFO, "Bandwidth of audio sink is %.0f Hz.\n", radio->rx_audio_samplerate / 2.0);
- PDEBUG(DRADIO, DEBUG_INFO, "Bandwidth of audio signal is %.0f Hz.\n", radio->audio_bandwidth);
- PDEBUG(DRADIO, DEBUG_INFO, "Bandwidth of modulated signal is %.0f Hz.\n", radio->signal_bandwidth);
+ LOGP(DRADIO, LOGL_INFO, "Bandwidth of audio sink is %.0f Hz.\n", radio->rx_audio_samplerate / 2.0);
+ LOGP(DRADIO, LOGL_INFO, "Bandwidth of audio signal is %.0f Hz.\n", radio->audio_bandwidth);
+ LOGP(DRADIO, LOGL_INFO, "Bandwidth of modulated signal is %.0f Hz.\n", radio->signal_bandwidth);
if (radio->tx_audio_mode)
- PDEBUG(DRADIO, DEBUG_INFO, "Sample rate of audio source is %.0f Hz.\n", radio->tx_audio_samplerate);
+ LOGP(DRADIO, LOGL_INFO, "Sample rate of audio source is %.0f Hz.\n", radio->tx_audio_samplerate);
if (radio->rx_audio_mode)
- PDEBUG(DRADIO, DEBUG_INFO, "Sample rate of audio sink is %.0f Hz.\n", radio->rx_audio_samplerate);
- PDEBUG(DRADIO, DEBUG_INFO, "Sample rate of signal is %.0f Hz.\n", radio->signal_samplerate);
+ LOGP(DRADIO, LOGL_INFO, "Sample rate of audio sink is %.0f Hz.\n", radio->rx_audio_samplerate);
+ LOGP(DRADIO, LOGL_INFO, "Sample rate of signal is %.0f Hz.\n", radio->signal_samplerate);
/* one or two audio channels */
if (radio->tx_audio_channels != 1 && radio->tx_audio_channels != 2)
{
- PDEBUG(DRADIO, DEBUG_ERROR, "Wrong number of audio channels, please fix!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Wrong number of audio channels, please fix!\n");
goto error;
}
/* audio buffers: how many sample for audio (rounded down) */
- int tx_size = (int)((double)latspl / radio->tx_resampler[0].factor);
- int rx_size = (int)((double)latspl / radio->rx_resampler[0].factor);
+ int tx_size = (int)((double)buffer_size / radio->tx_resampler[0].factor);
+ int rx_size = (int)((double)buffer_size / radio->rx_resampler[0].factor);
if (tx_size > rx_size)
radio->audio_buffer_size = tx_size;
else
radio->audio_buffer_size = rx_size;
radio->audio_buffer = calloc(radio->audio_buffer_size * 2, sizeof(*radio->audio_buffer));
if (!radio->audio_buffer) {
- PDEBUG(DRADIO, DEBUG_ERROR, "No memory!!\n");
+ LOGP(DRADIO, LOGL_ERROR, "No memory!!\n");
rc = -ENOMEM;
goto error;
}
/* signal buffers */
- radio->signal_buffer_size = latspl;
+ radio->signal_buffer_size = buffer_size;
radio->signal_buffer = calloc(radio->signal_buffer_size * 3, sizeof(*radio->signal_buffer));
radio->signal_power_buffer = calloc(radio->signal_buffer_size, sizeof(*radio->signal_power_buffer));
if (!radio->signal_buffer || !radio->signal_power_buffer) {
- PDEBUG(DRADIO, DEBUG_ERROR, "No memory!!\n");
+ LOGP(DRADIO, LOGL_ERROR, "No memory!!\n");
rc = -ENOMEM;
goto error;
}
/* temporary I/Q/carrier buffers, used while demodulating */
- radio->I_buffer = calloc(latspl, sizeof(*radio->I_buffer));
- radio->Q_buffer = calloc(latspl, sizeof(*radio->Q_buffer));
- radio->carrier_buffer = calloc(latspl, sizeof(*radio->carrier_buffer));
+ radio->I_buffer = calloc(buffer_size, sizeof(*radio->I_buffer));
+ radio->Q_buffer = calloc(buffer_size, sizeof(*radio->Q_buffer));
+ radio->carrier_buffer = calloc(buffer_size, sizeof(*radio->carrier_buffer));
if (!radio->I_buffer || !radio->Q_buffer || !radio->carrier_buffer) {
- PDEBUG(DRADIO, DEBUG_ERROR, "No memory!!\n");
+ LOGP(DRADIO, LOGL_ERROR, "No memory!!\n");
rc = -ENOMEM;
goto error;
}
@@ -437,16 +439,17 @@ int radio_tx(radio_t *radio, float *baseband, int signal_num)
sample_t *audio_samples[2];
sample_t *signal_samples[3];
uint8_t *signal_power;
+ jitter_frame_t *jf;
- if (signal_num > radio->latspl) {
- PDEBUG(DRADIO, DEBUG_ERROR, "signal_num > latspl, please fix!.\n");
+ if (signal_num > radio->buffer_size) {
+ LOGP(DRADIO, LOGL_ERROR, "signal_num > buffer_size, please fix!.\n");
abort();
}
/* audio buffers: how many sample for audio (rounded down) */
audio_num = (int)((double)signal_num / radio->tx_resampler[0].factor);
if (audio_num > radio->audio_buffer_size) {
- PDEBUG(DRADIO, DEBUG_ERROR, "audio_num > audio_buffer_size, please fix!.\n");
+ LOGP(DRADIO, LOGL_ERROR, "audio_num > audio_buffer_size, please fix!.\n");
abort();
}
audio_samples[0] = radio->audio_buffer;
@@ -455,7 +458,7 @@ int radio_tx(radio_t *radio, float *baseband, int signal_num)
/* signal buffers: a bit more samples to be safe */
signal_num = (int)((double)audio_num * radio->tx_resampler[0].factor + 0.5) + 10;
if (signal_num > radio->signal_buffer_size) {
- PDEBUG(DRADIO, DEBUG_ERROR, "signal_num > signal_buffer_size, please fix!.\n");
+ LOGP(DRADIO, LOGL_ERROR, "signal_num > signal_buffer_size, please fix!.\n");
abort();
}
signal_samples[0] = radio->signal_buffer;
@@ -474,7 +477,7 @@ int radio_tx(radio_t *radio, float *baseband, int signal_num)
wave_destroy_playback(&radio->wave_tx_play);
rc = wave_create_playback(&radio->wave_tx_play, radio->tx_wave_file, &_samplerate, &radio->tx_audio_channels, 1.0);
if (rc < 0) {
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to re-open wave file.\n");
+ LOGP(DRADIO, LOGL_ERROR, "Failed to re-open wave file.\n");
return rc;
}
}
@@ -483,17 +486,25 @@ int radio_tx(radio_t *radio, float *baseband, int signal_num)
case AUDIO_MODE_AUDIODEV:
rc = sound_read(radio->tx_sound, audio_samples, radio->audio_buffer_size, radio->tx_audio_channels, NULL);
if (rc < 0) {
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to read from sound device (rc = %d)!\n", audio_num);
+ LOGP(DRADIO, LOGL_ERROR, "Failed to read from sound device (rc = %d)!\n", audio_num);
if (rc == -EPIPE)
- PDEBUG(DRADIO, DEBUG_ERROR, "Trying to recover.\n");
+ LOGP(DRADIO, LOGL_ERROR, "Trying to recover.\n");
else
return 0;
}
- jitter_save(&radio->tx_dejitter[0], audio_samples[0], rc);
- jitter_load(&radio->tx_dejitter[0], audio_samples[0], audio_num);
+ jf = jitter_frame_alloc(NULL, NULL, (uint8_t *)audio_samples[0], rc * sizeof(*(audio_samples[0])), 0, radio->tx_sequence[0], radio->tx_timestamp[0], 123);
+ if (jf)
+ jitter_save(&radio->tx_dejitter[0], jf);
+ radio->tx_sequence[0] += 1;
+ radio->tx_timestamp[0] += rc;
+ jitter_load_samples(&radio->tx_dejitter[0], (uint8_t *)audio_samples[0], audio_num, sizeof(*(audio_samples[0])), NULL, NULL);
if (radio->tx_audio_channels == 2) {
- jitter_save(&radio->tx_dejitter[1], audio_samples[1], rc);
- jitter_load(&radio->tx_dejitter[1], audio_samples[1], audio_num);
+ jf = jitter_frame_alloc(NULL, NULL, (uint8_t *)audio_samples[1], rc * sizeof(*(audio_samples[1])), 0, radio->tx_sequence[1], radio->tx_timestamp[1], 123);
+ if (jf)
+ jitter_save(&radio->tx_dejitter[1], jf);
+ radio->tx_sequence[1] += 1;
+ radio->tx_timestamp[1] += rc;
+ jitter_load_samples(&radio->tx_dejitter[1], (uint8_t *)audio_samples[1], audio_num, sizeof(*(audio_samples[1])), NULL, NULL);
}
break;
#endif
@@ -505,7 +516,7 @@ int radio_tx(radio_t *radio, float *baseband, int signal_num)
}
break;
default:
- PDEBUG(DRADIO, DEBUG_ERROR, "Wrong audio mode, please fix!\n");
+ LOGP(DRADIO, LOGL_ERROR, "Wrong audio mode, please fix!\n");
return -EINVAL;
}
@@ -549,9 +560,10 @@ int radio_tx(radio_t *radio, float *baseband, int signal_num)
}
/* upsample */
- signal_num = samplerate_upsample(&radio->tx_resampler[0], audio_samples[0], audio_num, signal_samples[0]);
+ signal_num = samplerate_upsample_output_num(&radio->tx_resampler[0], audio_num);
+ samplerate_upsample(&radio->tx_resampler[0], audio_samples[0], audio_num, signal_samples[0], signal_num);
if (radio->stereo)
- samplerate_upsample(&radio->tx_resampler[1], audio_samples[1], audio_num, signal_samples[1]);
+ samplerate_upsample(&radio->tx_resampler[1], audio_samples[1], audio_num, signal_samples[1], signal_num);
/* prepare baseband */
memset(baseband, 0, sizeof(float) * 2 * signal_num);
@@ -610,14 +622,15 @@ int radio_rx(radio_t *radio, float *baseband, int signal_num)
int audio_num;
sample_t *samples[3];
double p;
+ jitter_frame_t *jf;
- if (signal_num > radio->latspl) {
- PDEBUG(DRADIO, DEBUG_ERROR, "signal_num > latspl, please fix!.\n");
+ if (signal_num > radio->buffer_size) {
+ LOGP(DRADIO, LOGL_ERROR, "signal_num > buffer_size, please fix!.\n");
abort();
}
if (signal_num > radio->signal_buffer_size) {
- PDEBUG(DRADIO, DEBUG_ERROR, "signal_num > signal_buffer_size, please fix!.\n");
+ LOGP(DRADIO, LOGL_ERROR, "signal_num > signal_buffer_size, please fix!.\n");
abort();
}
samples[0] = radio->signal_buffer;
@@ -722,27 +735,32 @@ int radio_rx(radio_t *radio, float *baseband, int signal_num)
wave_write(&radio->wave_rx_rec, samples, audio_num);
#ifdef HAVE_ALSA
if ((radio->rx_audio_mode & AUDIO_MODE_AUDIODEV)) {
- jitter_save(&radio->rx_dejitter[0], samples[0], audio_num);
- if (radio->rx_audio_channels == 2)
- jitter_save(&radio->rx_dejitter[1], samples[1], audio_num);
+ jf = jitter_frame_alloc(NULL, NULL, (uint8_t *)samples[0], audio_num * sizeof(*(samples[0])), 0, radio->rx_sequence[0], radio->rx_timestamp[0], 123);
+ if (jf)
+ jitter_save(&radio->rx_dejitter[0], jf);
+ radio->rx_sequence[0] += 1;
+ radio->rx_timestamp[0] += audio_num;
+ if (radio->rx_audio_channels == 2) {
+ jf = jitter_frame_alloc(NULL, NULL, (uint8_t *)samples[1], audio_num * sizeof(*(samples[1])), 0, radio->rx_sequence[1], radio->rx_timestamp[1], 123);
+ if (jf)
+ jitter_save(&radio->rx_dejitter[1], jf);
+ radio->rx_sequence[1] += 1;
+ radio->rx_timestamp[1] += audio_num;
+ }
audio_num = sound_get_tosend(radio->rx_sound, radio->signal_buffer_size);
- jitter_load(&radio->rx_dejitter[0], samples[0], audio_num);
+ jitter_load_samples(&radio->rx_dejitter[0], (uint8_t *)samples[0], audio_num, sizeof(*samples), NULL, NULL);
if (radio->rx_audio_channels == 2)
- jitter_load(&radio->rx_dejitter[1], samples[1], audio_num);
+ jitter_load_samples(&radio->rx_dejitter[1], (uint8_t *)samples[1], audio_num, sizeof(*samples), NULL, NULL);
audio_num = sound_write(radio->rx_sound, samples, NULL, audio_num, NULL, NULL, radio->rx_audio_channels);
if (audio_num < 0) {
- PDEBUG(DRADIO, DEBUG_ERROR, "Failed to write to sound device (rc = %d)!\n", audio_num);
+ LOGP(DRADIO, LOGL_ERROR, "Failed to write to sound device (rc = %d)!\n", audio_num);
if (audio_num == -EPIPE)
- PDEBUG(DRADIO, DEBUG_ERROR, "Trying to recover.\n");
+ LOGP(DRADIO, LOGL_ERROR, "Trying to recover.\n");
else
return 0;
}
}
#endif
- if (!radio->rx_audio_mode) {
- PDEBUG(DRADIO, DEBUG_ERROR, "Wrong audio mode, please fix!\n");
- return -EINVAL;
- }
return signal_num;
}