common code: Add feature to record received audio and replay it

-W <file.wav> writes a wave file of received audio
-R <file.wav> reads a wave file to feed into decoder

This way you can record a phone and later debug without a phone
and radio equipment.
This commit is contained in:
Andreas Eversberg
2016-03-25 13:58:16 +01:00
parent 0aa749d27b
commit 1146537d84
16 changed files with 386 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
#include "sound.h"
#include "wave.h"
#include "samplerate.h"
#include "jitter.h"
#include "loss.h"
@@ -21,6 +22,10 @@ typedef struct sender {
/* loopback test */
int loopback; /* 0 = off, 1 = internal, 2 = external */
/* record and playback */
wave_rec_t wave_rec; /* wave recording */
wave_play_t wave_play; /* wave playback */
/* audio buffer for audio to send to transmitter (also used as loopback buffer) */
jitter_t audio;
@@ -42,7 +47,7 @@ typedef struct sender {
/* list of all senders */
extern sender_t *sender_head;
int sender_create(sender_t *sender, const char *sounddev, int samplerate, int kanal, int loopback, double loss_volume, int use_pilot_signal);
int sender_create(sender_t *sender, const char *sounddev, int samplerate, const char *write_wave, const char *read_wave, int kanal, int loopback, double loss_volume, int use_pilot_signal);
void sender_destroy(sender_t *sender);
void sender_send(sender_t *sender, int16_t *samples, int count);
void sender_receive(sender_t *sender, int16_t *samples, int count);