From ebb79d0ea6ca9b7f9455fc372a714d668f4dee11 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 4 Mar 2015 18:54:57 -0700 Subject: [PATCH] Use cached song length instead of hitting the disk to read the music file. --- src/Song.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Song.cpp b/src/Song.cpp index 420a81828e..28268eaa35 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -536,7 +536,14 @@ void Song::TidyUpData( bool fromCache, bool /* duringCache */ ) } // This must be done before radar calculation. - if( HasMusic() ) + if(m_fMusicLengthSeconds > 0.0f || lastSecond > -1.0f) + { + if(m_fMusicLengthSeconds == 0.0f) + { + m_fMusicLengthSeconds= lastSecond; + } + } + else if(HasMusic()) { RString error; RageSoundReader *Sample = RageSoundReader_FileReader::OpenFile( GetMusicPath(), error ); @@ -575,7 +582,7 @@ void Song::TidyUpData( bool fromCache, bool /* duringCache */ ) m_fMusicLengthSeconds); } - if(!m_PreviewFile.empty()) + if(!m_PreviewFile.empty() && m_fMusicSampleStartSeconds == -1) { RString error; RageSoundReader* sample= RageSoundReader_FileReader::OpenFile(GetPreviewMusicPath(), error);