Lines Matching refs:testio
51 struct test_iodev *testio = (struct test_iodev *)iodev; in frames_queued() local
54 if (testio->fd < 0) in frames_queued()
56 ioctl(testio->fd, FIONREAD, &available); in frames_queued()
58 return available / testio->fmt_bytes; in frames_queued()
68 struct test_iodev *testio = (struct test_iodev *)iodev; in close_dev() local
70 byte_buffer_destroy(&testio->audbuff); in close_dev()
71 testio->audbuff = NULL; in close_dev()
78 struct test_iodev *testio = (struct test_iodev *)iodev; in configure_dev() local
84 testio->fmt_bytes = cras_get_format_bytes(iodev->format); in configure_dev()
85 testio->audbuff = byte_buffer_create(TEST_BUFFER_SIZE * in configure_dev()
86 testio->fmt_bytes); in configure_dev()
95 struct test_iodev *testio = (struct test_iodev *)iodev; in get_buffer() local
99 buff = buf_read_pointer_size(testio->audbuff, &readable); in get_buffer()
110 struct test_iodev *testio = (struct test_iodev *)iodev; in put_buffer() local
113 buf_increment_read(testio->audbuff, frames * testio->fmt_bytes); in put_buffer()
122 struct test_iodev *testio = (struct test_iodev *)iodev; in get_buffer_fd_read() local
127 if (testio->fd < 0) { in get_buffer_fd_read()
132 write_ptr = buf_write_pointer_size(testio->audbuff, &avail); in get_buffer_fd_read()
133 avail = MIN(avail, *frames * testio->fmt_bytes); in get_buffer_fd_read()
134 nread = read(testio->fd, write_ptr, avail); in get_buffer_fd_read()
137 audio_thread_rm_callback(testio->fd); in get_buffer_fd_read()
138 close(testio->fd); in get_buffer_fd_read()
139 testio->fd = -1; in get_buffer_fd_read()
142 buf_increment_write(testio->audbuff, nread); in get_buffer_fd_read()
143 *frames = nread / testio->fmt_bytes; in get_buffer_fd_read()
156 static void play_file_as_hotword(struct test_iodev *testio, const char *path) in play_file_as_hotword() argument
158 if (testio->fd >= 0) { in play_file_as_hotword()
162 testio->fd); in play_file_as_hotword()
163 close(testio->fd); in play_file_as_hotword()
166 testio->fd = open(path, O_RDONLY); in play_file_as_hotword()
167 buf_reset(testio->audbuff); in play_file_as_hotword()
177 struct test_iodev *testio; in test_iodev_create() local
184 testio = calloc(1, sizeof(*testio)); in test_iodev_create()
185 if (testio == NULL) in test_iodev_create()
187 iodev = &testio->base; in test_iodev_create()
189 testio->fd = -1; in test_iodev_create()
232 struct test_iodev *testio = (struct test_iodev *)iodev; in test_iodev_destroy() local
237 free(testio); in test_iodev_destroy()
240 unsigned int test_iodev_add_samples(struct test_iodev *testio, in test_iodev_add_samples() argument
247 write_ptr = buf_write_pointer_size(testio->audbuff, &avail); in test_iodev_add_samples()
249 memcpy(write_ptr, samples, count * testio->fmt_bytes); in test_iodev_add_samples()
250 buf_increment_write(testio->audbuff, count * testio->fmt_bytes); in test_iodev_add_samples()
259 struct test_iodev *testio = (struct test_iodev *)iodev; in test_iodev_command() local
266 play_file_as_hotword(testio, (char *)data); in test_iodev_command()