aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/wave.h
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-03-25 13:58:16 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2016-03-27 17:56:04 +0200
commit1146537d849c30aa20a4cb742cdd18654f041a8d (patch)
tree9cdc0a47669fc5d4ece4c77972308a7f1de81048 /src/common/wave.h
parent0aa749d27b1c95997a6e324694a7e624988faacc (diff)
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.
Diffstat (limited to 'src/common/wave.h')
-rw-r--r--src/common/wave.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/wave.h b/src/common/wave.h
new file mode 100644
index 0000000..b9575d6
--- /dev/null
+++ b/src/common/wave.h
@@ -0,0 +1,19 @@
+
+typedef struct wave_rec {
+ FILE *fp;
+ int samplerate;
+ uint32_t written; /* how much samples written */
+} wave_rec_t;
+
+typedef struct wave_play {
+ FILE *fp;
+ uint32_t left; /* how much samples left */
+} wave_play_t;
+
+int wave_create_record(wave_rec_t *rec, const char *filename, int samplerate);
+int wave_create_playback(wave_play_t *play, const char *filename, int samplerate);
+int wave_read(wave_play_t *play, int16_t *samples, int length);
+int wave_write(wave_rec_t *rec, int16_t *samples, int length);
+void wave_destroy_record(wave_rec_t *rec);
+void wave_destroy_playback(wave_play_t *play);
+