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

Function test16Bit44100WithInteger

tests/AiffLoadingTests.cpp:253–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251 //=============================================================
252 template <typename T>
253 void test16Bit44100WithInteger (bool expectFailure = false)
254 {
255 AudioFile<T> audioFile;
256
257 if (expectFailure)
258 audioFile.shouldLogErrorsToConsole (false);
259
260 bool loadedOK = audioFile.load (projectBuildDirectory + "/test-audio/aiff_stereo_16bit_44100.aif");
261
262 if (expectFailure)
263 {
264 CHECK_EQ (loadedOK, false);
265 return;
266 }
267
268 CHECK (loadedOK);
269 CHECK_EQ (audioFile.getNumSamplesPerChannel(), aiff_stereo_16bit_44100::numSamplesPerChannel);
270 CHECK_EQ (audioFile.getBitDepth(), aiff_stereo_16bit_44100::bitDepth);
271 CHECK_EQ (audioFile.getSampleRate(), aiff_stereo_16bit_44100::sampleRate);
272 CHECK_EQ (audioFile.getNumChannels(), aiff_stereo_16bit_44100::numChannels);
273
274 int offset = std::is_signed_v<T> ? 0 : 32768;
275
276 for (size_t i = 0; i < aiff_stereo_16bit_44100::testBuffer[0].size(); i++)
277 {
278 for (int k = 0; k < audioFile.getNumChannels(); k++)
279 {
280 CHECK (audioFile.samples[k][i] == doctest::Approx (aiff_stereo_16bit_44100::testBuffer[k][i] * 32767 + offset).epsilon (0.0001));
281 }
282 }
283 }
284
285 //=============================================================
286 TEST_CASE ("AiffLoadingTests_Stereo_16bit_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