aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authordvdli <dvdli@google.com>2021-01-12 14:53:42 +0800
committerdvdli <dvdli@google.com>2021-01-12 15:55:49 +0800
commit855354a87d2983e190088bc5330c129094b900ca (patch)
tree40c092f7c992e9c6f83edcaf41e9cb0706698890 /examples
parent565fc0e3da9bf0ccea99eb4386a4890cdba56134 (diff)
remove pcm_prepare in pcm_open
For the dynamic pcm device, it is valid to specify the backend after opening it. However, it is invalid to call prepare on a dynamic pcm device without connecting any backend device. We should not do pcm_prepare in pcm_open. See also: Issue #197
Diffstat (limited to 'examples')
-rw-r--r--examples/pcm-readi.c1
-rw-r--r--examples/pcm-writei.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/examples/pcm-readi.c b/examples/pcm-readi.c
index 8722b41..dc18b63 100644
--- a/examples/pcm-readi.c
+++ b/examples/pcm-readi.c
@@ -29,6 +29,7 @@ static size_t read_frames(void **frames)
fprintf(stderr, "failed to open PCM\n");
return 0;
}
+ pcm_prepare(pcm);
unsigned int frame_size = pcm_frames_to_bytes(pcm, 1);
unsigned int frames_per_sec = pcm_get_rate(pcm);
diff --git a/examples/pcm-writei.c b/examples/pcm-writei.c
index 19eafac..46b1a3d 100644
--- a/examples/pcm-writei.c
+++ b/examples/pcm-writei.c
@@ -70,6 +70,7 @@ static int write_frames(const void * frames, size_t byte_count){
fprintf(stderr, "failed to open PCM\n");
return -1;
}
+ pcm_prepare(pcm);
unsigned int frame_count = pcm_bytes_to_frames(pcm, byte_count);