aboutsummaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c
index f7a51a5..710c10c 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -32,6 +32,12 @@ int audio_play(char *buf)
}
}
+ if(pa_simple_flush(play, &error) < 0)
+ {
+ fprintf(stderr, __FILE__": pa_simple_flush() failed: %s\n", pa_strerror(error));
+ goto finish;
+ }
+
if(pa_simple_write(play, buf, REC_CAP, &error) < 0) {
fprintf(stderr, __FILE__": pa_simple_write() failed: %s\n", pa_strerror(error));
goto finish;
@@ -64,6 +70,11 @@ int audio_record(char *buf)
}
}
+ if(pa_simple_flush(rec, &error) < 0) {
+ fprintf(stderr, __FILE__": pa_simple_flush() failed: %s\n", pa_strerror(error));
+ goto finish;
+ }
+
if (pa_simple_read(rec, buf, REC_CAP, &error) < 0) {
fprintf(stderr, __FILE__": pa_simple_read() failed: %s\n", pa_strerror(error));
goto finish;