aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_devices.cpp
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2018-01-18 13:22:23 +0100
committerGitHub <[email protected]>2018-01-18 13:22:23 +0100
commited3ded8db67159e7a697c06be82e8a711a0a9ecd (patch)
tree5bffe3f1f41283ce3197dc6ef2418aa8236d1ab3 /test/test_devices.cpp
parent550c96fafec7f1eb7b0a537039fa4207bfff147a (diff)
downloadcubeb-ed3ded8db67159e7a697c06be82e8a711a0a9ecd.tar.gz
cubeb-ed3ded8db67159e7a697c06be82e8a711a0a9ecd.zip
Don't enumerate private aggregate devices in cubeb_audiounit.cpp (#400)
Diffstat (limited to 'test/test_devices.cpp')
-rw-r--r--test/test_devices.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test_devices.cpp b/test/test_devices.cpp
index 5177961..93c8692 100644
--- a/test/test_devices.cpp
+++ b/test/test_devices.cpp
@@ -15,6 +15,17 @@
#include "cubeb/cubeb.h"
#include "common.h"
+long data_cb_duplex(cubeb_stream * stream, void * user, const void * inputbuffer, void * outputbuffer, long nframes)
+{
+ // noop, unused
+ return 0;
+}
+
+void state_cb_duplex(cubeb_stream * stream, void * /*user*/, cubeb_state state)
+{
+ // noop, unused
+}
+
static void
print_device_info(cubeb_device_info * info, FILE * f)
{
@@ -164,4 +175,32 @@ TEST(cubeb, enumerate_devices)
fprintf(stdout, "Found %zu output devices\n", collection.count);
print_device_collection(&collection, stdout);
cubeb_device_collection_destroy(ctx, &collection);
+
+ uint32_t count_before_creating_duplex_stream;
+ r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection);
+ ASSERT_EQ(r, CUBEB_OK) << "Error enumerating devices " << r;
+ count_before_creating_duplex_stream = collection.count;
+ cubeb_device_collection_destroy(ctx, &collection);
+
+ cubeb_stream * stream;
+ cubeb_stream_params input_params;
+ cubeb_stream_params output_params;
+
+ input_params.format = output_params.format = CUBEB_SAMPLE_FLOAT32NE;
+ input_params.rate = output_params.rate = 48000;
+ input_params.channels = output_params.channels = 1;
+ input_params.layout = output_params.layout = CUBEB_LAYOUT_MONO;
+
+ r = cubeb_stream_init(ctx, &stream, "Cubeb duplex",
+ NULL, &input_params, NULL, &output_params,
+ 1024, data_cb_duplex, state_cb_duplex, nullptr);
+
+ ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream";
+
+ r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection);
+ ASSERT_EQ(r, CUBEB_OK) << "Error enumerating devices " << r;
+ ASSERT_EQ(count_before_creating_duplex_stream, collection.count);
+ cubeb_device_collection_destroy(ctx, &collection);
+
+ cubeb_stream_destroy(stream);
}