Browse Source

Correct surround sound test

pull/177/head
Alice 10 years ago
parent
commit
f21d15795d
  1. 14
      src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp
  2. 0
      src/MagnumPlugins/WavAudioImporter/Test/surround51Channel16.wav
  3. 8
      src/MagnumPlugins/WavAudioImporter/WavImporter.cpp

14
src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp

@ -67,7 +67,7 @@ class WavImporterTest: public TestSuite::Tester {
void stereo32f(); void stereo32f();
void stereo64f(); void stereo64f();
void surround616(); void surround51Channel16();
void debugAudioFormat(); void debugAudioFormat();
}; };
@ -98,7 +98,7 @@ WavImporterTest::WavImporterTest() {
&WavImporterTest::mono32f, &WavImporterTest::mono32f,
&WavImporterTest::stereo32f, &WavImporterTest::stereo32f,
&WavImporterTest::stereo64f, &WavImporterTest::stereo64f,
&WavImporterTest::surround616, &WavImporterTest::surround51Channel16,
&WavImporterTest::debugAudioFormat}); &WavImporterTest::debugAudioFormat});
} }
@ -136,7 +136,7 @@ void WavImporterTest::unsupportedChannelCount() {
WavImporter importer; WavImporter importer;
CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "unsupportedChannelCount.wav"))); CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "unsupportedChannelCount.wav")));
CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported channel count 6 with 8 bits per sample\n"); CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): PCM with unsupported channel count 6 with 8 bits per sample\n");
} }
void WavImporterTest::invalidPadding() { void WavImporterTest::invalidPadding() {
@ -281,7 +281,7 @@ void WavImporterTest::stereo12() {
WavImporter importer; WavImporter importer;
CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo12.wav"))); CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo12.wav")));
CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported channel count 2 with 12 bits per sample\n"); CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 12 bits per sample\n");
} }
void WavImporterTest::stereo16() { void WavImporterTest::stereo16() {
@ -303,7 +303,7 @@ void WavImporterTest::stereo24() {
WavImporter importer; WavImporter importer;
CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo24.wav"))); CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo24.wav")));
CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported channel count 2 with 24 bits per sample\n"); CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 24 bits per sample\n");
} }
void WavImporterTest::mono32f() { void WavImporterTest::mono32f() {
@ -349,13 +349,13 @@ void WavImporterTest::stereo64f() {
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
void WavImporterTest::surround616() { void WavImporterTest::surround51Channel16() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
WavImporter importer; WavImporter importer;
CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "surround616.wav"))); CORRADE_VERIFY(!importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "surround51Channel16.wav")));
CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::Extensible\n"); CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::Extensible\n");
} }

0
src/MagnumPlugins/WavAudioImporter/Test/surround616.wav → src/MagnumPlugins/WavAudioImporter/Test/surround51Channel16.wav

8
src/MagnumPlugins/WavAudioImporter/WavImporter.cpp

@ -131,7 +131,7 @@ void WavImporter::doOpenData(Containers::ArrayView<const char> data) {
else if(formatChunk->numChannels == 2 && formatChunk->bitsPerSample == 16) else if(formatChunk->numChannels == 2 && formatChunk->bitsPerSample == 16)
_format = Buffer::Format::Stereo16; _format = Buffer::Format::Stereo16;
else { else {
Error() << "Audio::WavImporter::openData(): unsupported channel count" Error() << "Audio::WavImporter::openData(): PCM with unsupported channel count"
<< formatChunk->numChannels << "with" << formatChunk->bitsPerSample << formatChunk->numChannels << "with" << formatChunk->bitsPerSample
<< "bits per sample"; << "bits per sample";
return; return;
@ -148,7 +148,7 @@ void WavImporter::doOpenData(Containers::ArrayView<const char> data) {
else if(formatChunk->numChannels == 2 && formatChunk->bitsPerSample == 64) else if(formatChunk->numChannels == 2 && formatChunk->bitsPerSample == 64)
_format = Buffer::Format::StereoDouble; _format = Buffer::Format::StereoDouble;
else { else {
Error() << "Audio::WavImporter::openData(): unsupported channel count" Error() << "Audio::WavImporter::openData(): IEEE with unsupported channel count"
<< formatChunk->numChannels << "with" << formatChunk->bitsPerSample << formatChunk->numChannels << "with" << formatChunk->bitsPerSample
<< "bits per sample"; << "bits per sample";
return; return;
@ -161,7 +161,7 @@ void WavImporter::doOpenData(Containers::ArrayView<const char> data) {
else if(formatChunk->numChannels == 2) else if(formatChunk->numChannels == 2)
_format = Buffer::Format::StereoALaw; _format = Buffer::Format::StereoALaw;
else { else {
Error() << "Audio::WavImporter::openData(): unsupported channel count" Error() << "Audio::WavImporter::openData(): ALaw with unsupported channel count"
<< formatChunk->numChannels << "with" << formatChunk->bitsPerSample << formatChunk->numChannels << "with" << formatChunk->bitsPerSample
<< "bits per sample"; << "bits per sample";
return; return;
@ -174,7 +174,7 @@ void WavImporter::doOpenData(Containers::ArrayView<const char> data) {
else if(formatChunk->numChannels == 2) else if(formatChunk->numChannels == 2)
_format = Buffer::Format::StereoMuLaw; _format = Buffer::Format::StereoMuLaw;
else { else {
Error() << "Audio::WavImporter::openData(): unsupported channel count" Error() << "Audio::WavImporter::openData(): ULaw with unsupported channel count"
<< formatChunk->numChannels << "with" << formatChunk->bitsPerSample << formatChunk->numChannels << "with" << formatChunk->bitsPerSample
<< "bits per sample"; << "bits per sample";
return; return;

Loading…
Cancel
Save