diff options
author | Alex Chronopoulos <[email protected]> | 2019-09-30 13:25:50 +0300 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2019-10-01 10:44:25 +1300 |
commit | 0551bc71d01778a814c8bc5bb86cd5e8429acc26 (patch) | |
tree | 7b6b0e66541938111b6bf3458cc85a249c4c4e61 /tools | |
parent | 789eeee00e793c26fa95a1ee4822edad4288c067 (diff) | |
download | cubeb-0551bc71d01778a814c8bc5bb86cd5e8429acc26.tar.gz cubeb-0551bc71d01778a814c8bc5bb86cd5e8429acc26.zip |
tool: get the max number of output channels.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cubeb-test.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/cubeb-test.cpp b/tools/cubeb-test.cpp index dde034e..ff4d463 100644 --- a/tools/cubeb-test.cpp +++ b/tools/cubeb-test.cpp @@ -58,6 +58,7 @@ public: void set_latency_frames(uint32_t latency_frames); uint64_t get_stream_position() const; uint32_t get_stream_latency() const; + uint32_t get_max_channel_count() const; long user_data_cb(cubeb_stream* stm, void* user, const void* input_buffer, void* output_buffer, long nframes); @@ -100,6 +101,7 @@ bool cubeb_client::init(char const * backend_name) { fprintf(stderr, "Could not init cubeb\n"); return false; } + fprintf(stderr, "Init cubeb backend: %s\n", cubeb_get_backend_id(context)); return true; } @@ -202,6 +204,16 @@ uint32_t cubeb_client::get_stream_latency() const { return latency; } +uint32_t cubeb_client::get_max_channel_count() const { + uint32_t channels = 0; + int rv = cubeb_get_max_channel_count(context, &channels); + if (rv != CUBEB_OK) { + fprintf(stderr, "Could not get max channel count\n"); + return 0; + } + return channels; +} + bool cubeb_client::destroy_stream() const { cubeb_stream_destroy(stream); return true; @@ -341,10 +353,11 @@ void print_help() { "0: change log level to disabled\n" "1: change log level to normal\n" "2: change log level to verbose\n" + "c: get max number of channels\n" "p: start a initialized stream\n" "s: stop a started stream\n" "d: force stream to drain\n" - "c: get stream position (client thread)\n" + "f: get stream position (client thread)\n" "i: change device type to input\n" "o: change device type to output\n" "a: change device type to input and output\n" @@ -412,6 +425,9 @@ bool choose_action(cubeb_client& cl, operation_data * op, int c) { } else if (c == 'd') { cl.force_drain(); } else if (c == 'c') { + uint32_t channel_count = cl.get_max_channel_count(); + fprintf(stderr, "max channel count (default output device): %u\n", channel_count); + } else if (c == 'f') { uint64_t pos = cl.get_stream_position(); uint64_t latency = cl.get_stream_latency(); fprintf(stderr, "stream position %" PRIu64 " (latency %" PRIu64 ")\n", pos, latency); |