diff options
author | Michael Maltese <[email protected]> | 2017-04-01 18:31:06 -0700 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2017-04-13 09:22:09 +1200 |
commit | 72a9685857b157b697508e21b529f01c5ac7ebaf (patch) | |
tree | 01da27a1db39ca65ee13e5b75eecaca9163a029c /test | |
parent | 2bb3e25537042ad113f02f36bd1080dc8abeb3b4 (diff) | |
download | cubeb-72a9685857b157b697508e21b529f01c5ac7ebaf.tar.gz cubeb-72a9685857b157b697508e21b529f01c5ac7ebaf.zip |
tests: Remove code preferring floats on Win32
The WASAPI backend supports S16, same as the other backends.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_audio.cpp | 10 | ||||
-rw-r--r-- | test/test_overload_callback.cpp | 4 | ||||
-rw-r--r-- | test/test_sanity.cpp | 12 | ||||
-rw-r--r-- | test/test_tone.cpp | 17 |
4 files changed, 1 insertions, 42 deletions
diff --git a/test/test_audio.cpp b/test/test_audio.cpp index 5b628be..a4db1e3 100644 --- a/test/test_audio.cpp +++ b/test/test_audio.cpp @@ -87,12 +87,6 @@ int supports_float32(string backend_id) && backend_id != "audiotrack"; } -/* The WASAPI backend only supports float. */ -int supports_int16(string backend_id) -{ - return backend_id != "wasapi"; -} - /* Some backends don't have code to deal with more than mono or stereo. */ int supports_channel_count(string backend_id, int nchannels) { @@ -117,7 +111,6 @@ int run_test(int num_channels, layout_info layout, int sampling_rate, int is_flo const char * backend_id = cubeb_get_backend_id(ctx); if ((is_float && !supports_float32(backend_id)) || - (!is_float && !supports_int16(backend_id)) || !supports_channel_count(backend_id, num_channels)) { /* don't treat this as a test failure. */ return CUBEB_OK; @@ -168,8 +161,7 @@ int run_panning_volume_test(int is_float) const char * backend_id = cubeb_get_backend_id(ctx); - if ((is_float && !supports_float32(backend_id)) || - (!is_float && !supports_int16(backend_id))) { + if ((is_float && !supports_float32(backend_id))) { /* don't treat this as a test failure. */ return CUBEB_OK; } diff --git a/test/test_overload_callback.cpp b/test/test_overload_callback.cpp index 0d90d07..ff1410e 100644 --- a/test/test_overload_callback.cpp +++ b/test/test_overload_callback.cpp @@ -18,11 +18,7 @@ #include "common.h" #define SAMPLE_FREQUENCY 48000 -#if (defined(_WIN32) || defined(__WIN32__)) -#define STREAM_FORMAT CUBEB_SAMPLE_FLOAT32LE -#else #define STREAM_FORMAT CUBEB_SAMPLE_S16LE -#endif std::atomic<bool> load_callback{ false }; diff --git a/test/test_sanity.cpp b/test/test_sanity.cpp index 7a78c1e..96994bf 100644 --- a/test/test_sanity.cpp +++ b/test/test_sanity.cpp @@ -19,11 +19,7 @@ #define STREAM_LATENCY 100 * STREAM_RATE / 1000 #define STREAM_CHANNELS 1 #define STREAM_LAYOUT CUBEB_LAYOUT_MONO -#if (defined(_WIN32) || defined(__WIN32__)) -#define STREAM_FORMAT CUBEB_SAMPLE_FLOAT32LE -#else #define STREAM_FORMAT CUBEB_SAMPLE_S16LE -#endif int is_windows_7() { @@ -61,11 +57,7 @@ test_data_callback(cubeb_stream * stm, void * user_ptr, const void * /*inputbuff { EXPECT_TRUE(stm && user_ptr == &dummy && outputbuffer && nframes > 0); assert(outputbuffer); -#if (defined(_WIN32) || defined(__WIN32__)) - memset(outputbuffer, 0, nframes * sizeof(float)); -#else memset(outputbuffer, 0, nframes * sizeof(short)); -#endif total_frames_written += nframes; if (delay_callback) { @@ -545,11 +537,7 @@ test_drain_data_callback(cubeb_stream * stm, void * user_ptr, const void * /*inp } /* once drain has started, callback must never be called again */ EXPECT_TRUE(do_drain != 2); -#if (defined(_WIN32) || defined(__WIN32__)) - memset(outputbuffer, 0, nframes * sizeof(float)); -#else memset(outputbuffer, 0, nframes * sizeof(short)); -#endif total_frames_written += nframes; return nframes; } diff --git a/test/test_tone.cpp b/test/test_tone.cpp index c2188c5..65c23c9 100644 --- a/test/test_tone.cpp +++ b/test/test_tone.cpp @@ -19,11 +19,7 @@ #include "common.h" #define SAMPLE_FREQUENCY 48000 -#if (defined(_WIN32) || defined(__WIN32__)) -#define STREAM_FORMAT CUBEB_SAMPLE_FLOAT32LE -#else #define STREAM_FORMAT CUBEB_SAMPLE_S16LE -#endif /* store the phase of the generated waveform */ struct cb_user_data { @@ -33,11 +29,7 @@ struct cb_user_data { long data_cb_tone(cubeb_stream *stream, void *user, const void* /*inputbuffer*/, void *outputbuffer, long nframes) { struct cb_user_data *u = (struct cb_user_data *)user; -#if (defined(_WIN32) || defined(__WIN32__)) - float *b = (float *)outputbuffer; -#else short *b = (short *)outputbuffer; -#endif float t1, t2; int i; @@ -49,21 +41,12 @@ long data_cb_tone(cubeb_stream *stream, void *user, const void* /*inputbuffer*/, /* North American dial tone */ t1 = sin(2*M_PI*(i + u->position)*350/SAMPLE_FREQUENCY); t2 = sin(2*M_PI*(i + u->position)*440/SAMPLE_FREQUENCY); -#if (defined(_WIN32) || defined(__WIN32__)) - b[i] = 0.5 * t1; - b[i] += 0.5 * t2; -#else b[i] = (SHRT_MAX / 2) * t1; b[i] += (SHRT_MAX / 2) * t2; -#endif /* European dial tone */ /* t1 = sin(2*M_PI*(i + u->position)*425/SAMPLE_FREQUENCY); -#if (defined(_WIN32) || defined(__WIN32__)) - b[i] = t1; -#else b[i] = SHRT_MAX * t1; -#endif */ } /* remember our phase to avoid clicking on buffer transitions */ |