Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/buffers.cc')
-rw-r--r--src/audio/buffers.cc32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/audio/buffers.cc b/src/audio/buffers.cc
index 41103ad..99c9e2e 100644
--- a/src/audio/buffers.cc
+++ b/src/audio/buffers.cc
@@ -9,6 +9,7 @@
#include "audio/audio.h"
#include "audio/buffers.h"
#include "audio/pcm.h"
+#include "audio/vorbisfile.h"
#include "audio/wavfile.h"
#include "sys/sys.h"
@@ -66,9 +67,36 @@ size_t Buffers::load(std::string name)
return 0;
}
- // load wav file
- PCM *pcm = Wav::load(name);
+ std::string filename;
+
+ PCM *pcm = 0;
+
+ // try the .oga version
+ if (!pcm) {
+ filename.assign("sounds/");
+ filename.append(name);
+ filename.append(".oga");
+ pcm = Vorbis::load(filename);
+ }
+
+ // try the .oga version
+ if (!pcm) {
+ filename.assign("sounds/");
+ filename.append(name);
+ filename.append(".ogg");
+ pcm = Vorbis::load(filename);
+ }
+
+ // try the .wav version
+ if (!pcm) {
+ filename.assign("sounds/");
+ filename.append(name);
+ filename.append(".wav");
+ pcm = Wav::load(filename);
+ }
+
if (!pcm) {
+ con_warn << "Could not open sound " << name << std::endl;
registry[name] = 0;
return 0;
}