From a02b3fd87f0da4bc4bdec0491eefe6186f817846 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sat, 26 May 2007 21:12:39 +0000 Subject: [PATCH] fix looping for normal .ogg SVN-Revision: 5047 --- src/audio/sound_file.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/audio/sound_file.cpp b/src/audio/sound_file.cpp index f77601f99..2495bbbb0 100644 --- a/src/audio/sound_file.cpp +++ b/src/audio/sound_file.cpp @@ -371,6 +371,10 @@ SoundFile* load_music_file(const std::string& filename) music->get("file", raw_music_file); music->get("loop-begin", loop_begin); music->get("loop-at", loop_at); + + if(loop_begin < 0) { + throw std::runtime_error("can't loop from negative value"); + } std::string basedir = FileSystem::dirname(filename); raw_music_file = FileSystem::normalize(basedir + raw_music_file); @@ -407,7 +411,7 @@ SoundFile* load_sound_file(const std::string& filename) if(strncmp(magic, "RIFF", 4) == 0) return new WavSoundFile(file); else if(strncmp(magic, "OggS", 4) == 0) - return new OggSoundFile(file, -1, 0); + return new OggSoundFile(file, 0, -1); else throw std::runtime_error("Unknown file format"); } catch(std::exception& e) { -- 2.11.0