michael@0: #ifdef NDEBUG michael@0: #undef NDEBUG michael@0: #endif michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: #define LOG(msg) fprintf(stderr, "%s\n", msg); michael@0: michael@0: int main(int argc, char * argv[]) michael@0: { michael@0: cubeb * ctx = NULL; michael@0: int rv; michael@0: uint32_t max_channels; michael@0: uint32_t preferred_rate; michael@0: uint32_t latency_ms; michael@0: michael@0: LOG("latency_test start"); michael@0: rv = cubeb_init(&ctx, "Cubeb audio test"); michael@0: assert(rv == CUBEB_OK && "Cubeb init failed."); michael@0: LOG("cubeb_init ok"); michael@0: michael@0: rv = cubeb_get_max_channel_count(ctx, &max_channels); michael@0: assert(rv == CUBEB_OK && "Could not query the max channe count."); michael@0: assert(max_channels > 0 && "Invalid max channel count."); michael@0: LOG("cubeb_get_max_channel_count ok"); michael@0: michael@0: rv = cubeb_get_preferred_sample_rate(ctx, &preferred_rate); michael@0: assert(rv == CUBEB_OK && "Could not query the preferred sample rate."); michael@0: assert(preferred_rate && "Invalid preferred sample rate."); michael@0: LOG("cubeb_get_preferred_sample_rate ok"); michael@0: michael@0: cubeb_stream_params params = { michael@0: CUBEB_SAMPLE_FLOAT32NE, michael@0: preferred_rate, michael@0: max_channels michael@0: }; michael@0: rv = cubeb_get_min_latency(ctx, params, &latency_ms); michael@0: assert(rv == CUBEB_OK && "Could not query the minimal latency."); michael@0: assert(latency_ms && "Invalid minimal latency."); michael@0: LOG("cubeb_get_min_latency ok"); michael@0: michael@0: cubeb_destroy(ctx); michael@0: LOG("cubeb_destroy ok"); michael@0: michael@0: return EXIT_SUCCESS; michael@0: }