MCPcopy Create free account
hub / github.com/adamstark/AudioFile / test8Bit44100WithInteger

Function test8Bit44100WithInteger

tests/WavLoadingTests.cpp:293–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291 //=============================================================
292 template <typename T>
293 void test8Bit44100WithInteger()
294 {
295 AudioFile<T> audioFile;
296 bool loadedOK = audioFile.load (projectBuildDirectory + "/test-audio/wav_stereo_8bit_44100.wav");
297
298 CHECK (loadedOK);
299 CHECK_EQ (audioFile.getNumSamplesPerChannel(), wav_stereo_8bit_44100::numSamplesPerChannel);
300 CHECK_EQ (audioFile.getBitDepth(), wav_stereo_8bit_44100::bitDepth);
301 CHECK_EQ (audioFile.getSampleRate(), wav_stereo_8bit_44100::sampleRate);
302 CHECK_EQ (audioFile.getNumChannels(), static_cast<int> (wav_stereo_8bit_44100::testBuffer.size()));
303
304 int offset = std::is_signed_v<T> ? 0 : 128;
305
306 for (size_t i = 0; i < wav_stereo_8bit_44100::testBuffer[0].size(); i++)
307 {
308 for (int k = 0; k < audioFile.getNumChannels(); k++)
309 {
310 REQUIRE_EQ (audioFile.samples[k][i], doctest::Approx (wav_stereo_8bit_44100::testBuffer[k][i] * 127 + offset).epsilon (0.01));
311 }
312 }
313 }
314 //=============================================================
315 TEST_CASE ("WavLoadingTests_Stereo_8bit_44100_integers")
316 {

Callers

nothing calls this directly

Calls 6

ApproxFunction · 0.85
loadMethod · 0.80
getBitDepthMethod · 0.80
getSampleRateMethod · 0.80
getNumChannelsMethod · 0.80

Tested by

no test coverage detected