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

Function test8Bit44100WithInteger

tests/AiffLoadingTests.cpp:212–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210 //=============================================================
211 template <typename T>
212 void test8Bit44100WithInteger (bool expectFailure = false)
213 {
214 AudioFile<T> audioFile;
215 bool loadedOK = audioFile.load (projectBuildDirectory + "/test-audio/aiff_stereo_8bit_44100.aif");
216
217 CHECK (loadedOK);
218 CHECK_EQ (audioFile.getNumSamplesPerChannel(), aiff_stereo_8bit_44100::numSamplesPerChannel);
219 CHECK_EQ (audioFile.getBitDepth(), aiff_stereo_8bit_44100::bitDepth);
220 CHECK_EQ (audioFile.getSampleRate(), aiff_stereo_8bit_44100::sampleRate);
221 CHECK_EQ (audioFile.getNumChannels(), aiff_stereo_8bit_44100::numChannels);
222
223 int offset = std::is_signed_v<T> ? 0 : 128;
224
225 for (size_t i = 0; i < aiff_stereo_8bit_44100::testBuffer[0].size(); i++)
226 {
227 for (int k = 0; k < audioFile.getNumChannels(); k++)
228 {
229 CHECK (audioFile.samples[k][i] == doctest::Approx (aiff_stereo_8bit_44100::testBuffer[k][i] * 127 + offset).epsilon (0.01));
230 }
231 }
232 }
233
234 //=============================================================
235 TEST_CASE ("AiffLoadingTests_Stereo_8bit_44100_integers")

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