SampleBuffer - message box upon decode sample fail

When SampleBuffer can't decode an audio sample, it explains why
in a friendly message box, instead of silently failing.
This commit is contained in:
Andrew Kelley
2009-07-15 08:20:06 -07:00
parent 4877f93583
commit 0390d4aadb

View File

@@ -193,27 +193,26 @@ void sampleBuffer::update( bool _keep_settings )
"than 100 MB" );
}
else
{
if( m_frames == 0 )
{
m_frames = decodeSampleSF( f, buf, channels,
samplerate );
}
{
if( m_frames == 0 )
{
m_frames = decodeSampleSF( f, buf, channels,
samplerate );
}
#ifdef LMMS_HAVE_OGGVORBIS
if( m_frames == 0 )
{
m_frames = decodeSampleOGGVorbis( f, buf, channels,
samplerate );
}
if( m_frames == 0 )
{
m_frames = decodeSampleOGGVorbis( f, buf, channels,
samplerate );
}
#endif
if( m_frames == 0 )
{
m_frames = decodeSampleDS( f, buf, channels,
samplerate );
}
if( m_frames == 0 )
{
m_frames = decodeSampleDS( f, buf, channels,
samplerate );
}
delete[] f;
delete[] f;
}
if( m_frames > 0 && buf != NULL )
@@ -263,6 +262,17 @@ void sampleBuffer::update( bool _keep_settings )
m_frames = 1;
m_loopStartFrame = m_startFrame = 0;
m_loopEndFrame = m_endFrame = 1;
QString decoders = tr( "wav, ogg, mp3" );
QMessageBox::information( NULL,
QObject::tr( "Unrecognized audio format" ),
QObject::tr( "None of the available audio decoders "
"recognized the format you are trying to load. Try "
"converting the file to a format LMMS understands.\n\n"
"Your file: %1\n"
"Available decoders: %2\n").arg( file, decoders ),
QMessageBox::Ok | QMessageBox::Default );
}
}
else