summaryrefslogtreecommitdiffstats
path: root/src/audio/oal
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-01-07 21:01:44 +0100
committerSergeanur <s.anureev@yandex.ua>2021-01-07 21:13:46 +0100
commitef13866af6e08797030865a33a1d5ba260a833bf (patch)
treedf0b001d6d4b5e98e83488fac1b26f9632346e10 /src/audio/oal
parentmissing changes (diff)
downloadre3-ef13866af6e08797030865a33a1d5ba260a833bf.tar
re3-ef13866af6e08797030865a33a1d5ba260a833bf.tar.gz
re3-ef13866af6e08797030865a33a1d5ba260a833bf.tar.bz2
re3-ef13866af6e08797030865a33a1d5ba260a833bf.tar.lz
re3-ef13866af6e08797030865a33a1d5ba260a833bf.tar.xz
re3-ef13866af6e08797030865a33a1d5ba260a833bf.tar.zst
re3-ef13866af6e08797030865a33a1d5ba260a833bf.zip
Diffstat (limited to 'src/audio/oal')
-rw-r--r--src/audio/oal/stream.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index f9c02821..8c7b3232 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -4,20 +4,23 @@
#include "stream.h"
#include "sampman.h"
-#ifdef AUDIO_OPUS
-#include <opusfile.h>
-#else
#ifdef _WIN32
#ifdef AUDIO_OAL_USE_SNDFILE
#pragma comment( lib, "libsndfile-1.lib" )
#endif
+#ifdef AUDIO_OAL_USE_MPG123
#pragma comment( lib, "libmpg123-0.lib" )
#endif
+#endif
#ifdef AUDIO_OAL_USE_SNDFILE
#include <sndfile.h>
#endif
+#ifdef AUDIO_OAL_USE_MPG123
#include <mpg123.h>
#endif
+#ifdef AUDIO_OAL_USE_OPUS
+#include <opusfile.h>
+#endif
#ifndef _WIN32
#include "crossplatform.h"
@@ -81,7 +84,6 @@ public:
CSortStereoBuffer SortStereoBuffer;
-#ifndef AUDIO_OPUS
class CImaADPCMDecoder
{
const uint16 StepTable[89] = {
@@ -461,11 +463,9 @@ public:
};
#endif
-#ifdef _WIN32
+#ifdef AUDIO_OAL_USE_MPG123
// fuzzy seek eliminates stutter when playing ADF but spams errors a lot (nothing breaks though)
#define MP3_USE_FUZZY_SEEK
-#endif // _WIN32
-
class CMP3File : public IDecoder
{
@@ -567,6 +567,7 @@ public:
}
};
+#endif
#define VAG_LINE_SIZE (0x10)
#define VAG_SAMPLES_IN_LINE (28)
@@ -804,7 +805,7 @@ public:
return bufSizePerChannel * m_nChannels;
}
};
-#else
+#ifdef AUDIO_OAL_USE_OPUS
class COpusFile : public IDecoder
{
OggOpusFile *m_FileH;
@@ -902,14 +903,14 @@ public:
void CStream::Initialise()
{
-#ifndef AUDIO_OPUS
+#ifdef AUDIO_OAL_USE_MPG123
mpg123_init();
#endif
}
void CStream::Terminate()
{
-#ifndef AUDIO_OPUS
+#ifdef AUDIO_OAL_USE_MPG123
mpg123_exit();
#endif
}
@@ -942,19 +943,20 @@ CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBU
DEV("Stream %s\n", m_aFilename);
-#ifndef AUDIO_OPUS
- if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".mp3")], ".mp3"))
- m_pSoundFile = new CMP3File(m_aFilename);
- else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".wav")], ".wav"))
+ if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".wav")], ".wav"))
#ifdef AUDIO_OAL_USE_SNDFILE
m_pSoundFile = new CSndFile(m_aFilename);
#else
m_pSoundFile = new CWavFile(m_aFilename);
#endif
+#ifdef AUDIO_OAL_USE_MPG123
+ else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".mp3")], ".mp3"))
+ m_pSoundFile = new CMP3File(m_aFilename);
+#endif
else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".vb")], ".VB"))
m_pSoundFile = new CVbFile(m_aFilename, overrideSampleRate);
-#else
- if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".opus")], ".opus"))
+#ifdef AUDIO_OAL_USE_OPUS
+ else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".opus")], ".opus"))
m_pSoundFile = new COpusFile(m_aFilename);
#endif
else