Invalid WAV files should always be logged and not played

This commit is contained in:
Ken Cooke 2017-12-14 10:20:46 -08:00
parent a75010fb94
commit b6a88bbdda

View file

@ -96,9 +96,13 @@ void SoundProcessor::run() {
QByteArray outputAudioByteArray;
int sampleRate = interpretAsWav(rawAudioByteArray, outputAudioByteArray);
if (sampleRate != 0) {
downSample(outputAudioByteArray, sampleRate);
if (sampleRate == 0) {
qCDebug(audio) << "Unsupported WAV file type";
emit onError(300, "Failed to load sound file, reason: unsupported WAV file type");
return;
}
downSample(outputAudioByteArray, sampleRate);
} else if (fileName.endsWith(RAW_EXTENSION)) {
// check if this was a stereo raw file
// since it's raw the only way for us to know that is if the file was called .stereo.raw