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

Function test24Bit44100WithInteger

tests/WavLoadingTests.cpp:386–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384 //=============================================================
385 template <typename T>
386 void test24Bit44100WithInteger (bool expectFailure = false)
387 {
388 AudioFile<T> audioFile;
389
390 if (expectFailure)
391 audioFile.shouldLogErrorsToConsole (false);
392
393 bool loadedOK = audioFile.load (projectBuildDirectory + "/test-audio/wav_stereo_24bit_44100.wav");
394
395 if (expectFailure)
396 {
397 CHECK_EQ (loadedOK, false);
398 return;
399 }
400
401 CHECK (loadedOK);
402 CHECK_EQ (audioFile.getNumSamplesPerChannel(), wav_stereo_24bit_44100::numSamplesPerChannel);
403 CHECK_EQ (audioFile.getBitDepth(), wav_stereo_24bit_44100::bitDepth);
404 CHECK_EQ (audioFile.getSampleRate(), wav_stereo_24bit_44100::sampleRate);
405 CHECK_EQ (audioFile.getNumChannels(), static_cast<int> (wav_stereo_24bit_44100::testBuffer.size()));
406
407 int offset = std::is_signed_v<T> ? 0 : 8388608;
408
409 for (size_t i = 0; i < wav_stereo_24bit_44100::testBuffer[0].size(); i++)
410 {
411 for (int k = 0; k < audioFile.getNumChannels(); k++)
412 {
413 CHECK (audioFile.samples[k][i] == doctest::Approx (wav_stereo_24bit_44100::testBuffer[k][i] * 8388607 + offset).epsilon (0.00001));
414 }
415 }
416 }
417
418 //=============================================================
419 TEST_CASE ("WavLoadingTests_Stereo_24bit_44100_integers")

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected