From 819e6392cd6b0166fd2bcda30f9dd110e3a6ae4e 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. (cherry picked from commit 6e64bcfc42595fb2a3a554614fccb5305f8bb4d4) --- src/core/sample_buffer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/sample_buffer.cpp b/src/core/sample_buffer.cpp index 566d2178c..31be999e6 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 * @@ -184,7 +184,8 @@ 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" ); @@ -192,6 +193,15 @@ void sampleBuffer::update( bool _keep_settings ) 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 if( m_frames == 0 ) { m_frames = decodeSampleSF( f, buf, channels,