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

Function test24Bit44100WithInteger

tests/AiffLoadingTests.cpp:306–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304 //=============================================================
305 template <typename T>
306 void test24Bit44100WithInteger (bool expectFailure = false)
307 {
308 AudioFile<T> audioFile;
309
310 if (expectFailure)
311 audioFile.shouldLogErrorsToConsole (false);
312
313 bool loadedOK = audioFile.load (projectBuildDirectory + "/test-audio/aiff_stereo_24bit_44100.aif");
314
315 if (expectFailure)
316 {
317 REQUIRE_EQ (loadedOK, false);
318 return;
319 }
320
321 CHECK (loadedOK);
322 CHECK_EQ (audioFile.getNumSamplesPerChannel(), aiff_stereo_24bit_44100::numSamplesPerChannel);
323 CHECK_EQ (audioFile.getBitDepth(), aiff_stereo_24bit_44100::bitDepth);
324 CHECK_EQ (audioFile.getSampleRate(), aiff_stereo_24bit_44100::sampleRate);
325 CHECK_EQ (audioFile.getNumChannels(), aiff_stereo_24bit_44100::numChannels);
326
327 int offset = std::is_signed_v<T> ? 0 : 8388608;
328
329 for (size_t i = 0; i < aiff_stereo_24bit_44100::testBuffer[0].size(); i++)
330 {
331 for (int k = 0; k < audioFile.getNumChannels(); k++)
332 {
333 CHECK (audioFile.samples[k][i] == doctest::Approx (aiff_stereo_24bit_44100::testBuffer[k][i] * 8388607 + offset).epsilon (0.00001));
334 }
335 }
336 }
337
338 //=============================================================
339 TEST_CASE ("AiffLoadingTests_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