Skip to content

Commit

Permalink
Clear WavSupport error messages (#1266)
Browse files Browse the repository at this point in the history
The WavSupport error messages didn't show the bad wav which was
being loaded, making mysterious problems like the one in #1259
undiagnosable. Add the file to each promptError.

Closes #1259
  • Loading branch information
baconpaul authored Nov 1, 2019
1 parent 9eeaf90 commit 5072e64
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/common/WavSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ void SurgeStorage::load_wt_wav_portable(std::string fn, Wavetable *wt)
hds += fread(wav, 1, 4, fp);
if (hds != 12)
{
Surge::UserInteractions::promptError("File does not contain valid RIFF header chunk",
std::ostringstream oss;
oss << "File does not contain a valid RIFF header chunk. file='" << fn << "'";
Surge::UserInteractions::promptError(oss.str(),
uitag );
return;
}
Expand All @@ -88,7 +90,7 @@ void SurgeStorage::load_wt_wav_portable(std::string fn, Wavetable *wt)
{
std::ostringstream oss;
oss << "File is not a standard RIFF/WAVE file. Header is: [" << riff[0] << riff[1] << riff[2]
<< riff[3] << " " << wav[0] << wav[1] << wav[2] << wav[3] << ".";
<< riff[3] << " " << wav[0] << wav[1] << wav[2] << wav[3] << ". file='" << fn << "'";
Surge::UserInteractions::promptError(oss.str(), uitag );
return;
}
Expand Down Expand Up @@ -168,7 +170,8 @@ void SurgeStorage::load_wt_wav_portable(std::string fn, Wavetable *wt)
oss << "Sorry, Surge only supports 16-bit PCM or 32-bit IEEE float mono (single channel) wav files. "
<< " You provided a wav with format=" << audioFormat << " (" << fname << ") "
<< " bitsPerSample=" << bitsPerSample
<< " and channels=" << numChannels << (numChannels == 2 ? " (stereo)" : "" );
<< " and channels=" << numChannels << (numChannels == 2 ? " (stereo)" : "" )
<< ". file='" << fn << "'";

Surge::UserInteractions::promptError( oss.str(), uitag );
return;
Expand Down Expand Up @@ -375,7 +378,7 @@ void SurgeStorage::load_wt_wav_portable(std::string fn, Wavetable *wt)
{
std::ostringstream oss;
oss << "Sorry, Surge only supports power-of-2-samplecount wavetables up to 4096 with at least 3 loops at this time. "
<< " You provided a wavetable with " << loopCount << " loops of " << loopLen << " samples.";
<< " You provided a wavetable with " << loopCount << " loops of " << loopLen << " samples. file='" << fn << "'";
Surge::UserInteractions::promptError( oss.str(), uitag );

if (wavdata) free(wavdata);
Expand Down Expand Up @@ -419,7 +422,8 @@ void SurgeStorage::load_wt_wav_portable(std::string fn, Wavetable *wt)
oss << "Sorry, Surge only supports 16-bit PCM or 32-bit IEEE float mono wav files. "
<< " You provided a wav with format=" << audioFormat
<< " bitsPerSample=" << bitsPerSample
<< " and numChannels=" << numChannels;
<< " and numChannels=" << numChannels
<< ". file='" << fn << "'";

Surge::UserInteractions::promptError( oss.str(), uitag );

Expand Down

0 comments on commit 5072e64

Please sign in to comment.