aboutsummaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-17 23:04:12 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-17 23:04:12 +0300
commit7e64d0c78e8a21f2ede7eab1303758391001c0dc (patch)
treea01e44b12d66de3e4fbc5cf5ab20f439fc8d6fc8 /src/audio.c
parentb1b7c92aa96af5502f276819b628b05d54f4655c (diff)
many changes in progess
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;