From 6e64bcfc42595fb2a3a554614fccb5305f8bb4d4 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 22 Aug 2010 02:18:34 +0200 Subject: [PATCH] SampleBuffer: for OGG files try with OGG Vorbis decoder first This is workaround for a bug in libsndfile or our libsndfile decoder causing some OGG files to be distorted. Therefore try the OGG Vorbis decoder first if filename extension matches "ogg". Closes #2957937. --- src/core/sample_buffer.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/sample_buffer.cpp b/src/core/sample_buffer.cpp index 4051524fa..58aed02c1 100644 --- a/src/core/sample_buffer.cpp +++ b/src/core/sample_buffer.cpp @@ -1,7 +1,7 @@ /* * sample_buffer.cpp - container-class sampleBuffer * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -201,13 +201,21 @@ void sampleBuffer::update( bool _keep_settings ) sample_rate_t samplerate = engine::getMixer()->baseSampleRate(); m_frames = 0; - if( QFileInfo( file ).size() > 100*1024*1024 ) + const QFileInfo fileInfo( file ); + if( fileInfo.size() > 100*1024*1024 ) { qWarning( "refusing to load sample files bigger " "than 100 MB" ); } else { +#ifdef LMMS_HAVE_OGGVORBIS + // workaround for a bug in libsndfile or our libsndfile decoder + // causing some OGG files to be distorted -> try with OGG Vorbis + // decoder first if filename extension matches "ogg" + if( m_frames == 0 && fileInfo.suffix() == "ogg" ) + m_frames = decodeSampleOGGVorbis( f, buf, channels, samplerate ); +#endif // PCM wave if( m_frames == 0 ) m_frames = decodeSampleSF( f, buf, channels, samplerate );