1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-08-07 22:59:50 +00:00

Remove BBGE_BUILD_FMODEX option (always defined)

This commit is contained in:
Nicolas Braud-Santoni 2016-05-05 15:44:00 +02:00
parent 91c493344d
commit 0f39b825e1
No known key found for this signature in database
GPG key ID: 06EA317DE11BD278
2 changed files with 9 additions and 87 deletions

View file

@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Base.h" #include "Base.h"
#include "PackRead.h" #include "PackRead.h"
#if defined(BBGE_BUILD_FMODEX)
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE #ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
#include "FmodOpenALBridge.h" #include "FmodOpenALBridge.h"
#else #else
@ -34,10 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma comment(lib, "fmodex_vc.lib") #pragma comment(lib, "fmodex_vc.lib")
#endif #endif
#endif #endif
#endif
#ifdef BBGE_BUILD_FMODEX
#endif
SoundManager *sound = 0; SoundManager *sound = 0;
@ -49,7 +45,6 @@ std::string fileType = ".ogg";
namespace SoundCore namespace SoundCore
{ {
#ifdef BBGE_BUILD_FMODEX
typedef std::map<std::string, FMOD::Sound*> SoundMap; typedef std::map<std::string, FMOD::Sound*> SoundMap;
SoundMap soundMap; SoundMap soundMap;
@ -111,7 +106,6 @@ namespace SoundCore
} }
fadeChs.push_back(fadeCh); fadeChs.push_back(fadeCh);
} }
#endif
} }
using namespace SoundCore; using namespace SoundCore;
@ -201,7 +195,6 @@ FMOD_RESULT F_CALLBACK myseek(void *handle, unsigned int pos, void *userdata)
void SoundManager::pause() void SoundManager::pause()
{ {
#ifdef BBGE_BUILD_FMODEX
debugLog("SoundManager::pause"); debugLog("SoundManager::pause");
debugLog("mus"); debugLog("mus");
@ -225,12 +218,10 @@ void SoundManager::pause()
checkError(); checkError();
debugLog("done"); debugLog("done");
#endif
} }
void SoundManager::resume() void SoundManager::resume()
{ {
#ifdef BBGE_BUILD_FMODEX
debugLog("SoundManager::resume"); debugLog("SoundManager::resume");
debugLog("mus"); debugLog("mus");
@ -254,7 +245,6 @@ void SoundManager::resume()
checkError(); checkError();
debugLog("done"); debugLog("done");
#endif
} }
Buffer SoundManager::getBuffer(const std::string &name) Buffer SoundManager::getBuffer(const std::string &name)
@ -286,7 +276,6 @@ SoundManager::SoundManager(const std::string &defaultDevice)
loadProgressCallback = NULL; loadProgressCallback = NULL;
#ifdef BBGE_BUILD_FMODEX
int channels = 128; int channels = 128;
@ -415,7 +404,6 @@ SoundManager::SoundManager(const std::string &defaultDevice)
} }
#endif
enabled = true; enabled = true;
@ -439,7 +427,6 @@ void SoundManager::toggleEffectMusic(SoundEffectType effect, bool on)
{ {
if (!enabled) return; if (!enabled) return;
#ifdef BBGE_BUILD_FMODEX
bool active = false; bool active = false;
@ -455,7 +442,6 @@ void SoundManager::toggleEffectMusic(SoundEffectType effect, bool on)
break; break;
} }
#endif
} }
@ -516,13 +502,6 @@ void SoundManager::setMusicFader(float v, float t)
*/ */
musVol.interpolateTo(Vector(musVol.x, v, musVol.z), t); musVol.interpolateTo(Vector(musVol.x, v, musVol.z), t);
#ifdef BBGE_BUILD_FMODEX
/*
result = group_mus->setVolume(musVol.x*musVol.y*v);
checkError();
*/
#endif
} }
void SoundManager::error(const std::string &errMsg) void SoundManager::error(const std::string &errMsg)
@ -550,17 +529,13 @@ SoundManager::~SoundManager()
} }
soundMap.clear(); soundMap.clear();
#ifdef BBGE_BUILD_FMODEX
SoundCore::system->release(); SoundCore::system->release();
#endif
} }
void SoundManager::stopAllSfx() void SoundManager::stopAllSfx()
{ {
#ifdef BBGE_BUILD_FMODEX
if (group_sfx) if (group_sfx)
group_sfx->stop(); group_sfx->stop();
#endif
} }
void SoundManager::stopAll() void SoundManager::stopAll()
@ -608,19 +583,16 @@ bool SoundManager::isPaused()
if (!enabled) return paused; if (!enabled) return paused;
#ifdef BBGE_BUILD_FMODEX
result = masterChannelGroup->getPaused(&paused); result = masterChannelGroup->getPaused(&paused);
checkError(); checkError();
#endif
return paused; return paused;
} }
void SoundManager::clearFadingSfx() void SoundManager::clearFadingSfx()
{ {
#ifdef BBGE_BUILD_FMODEX
SoundCore::FadeChs::iterator i = fadeChs.begin(); SoundCore::FadeChs::iterator i = fadeChs.begin();
for (; i != fadeChs.end(); i++) for (; i != fadeChs.end(); i++)
@ -634,7 +606,6 @@ void SoundManager::clearFadingSfx()
} }
SoundCore::fadeChs.clear(); SoundCore::fadeChs.clear();
#endif
} }
@ -648,7 +619,6 @@ void SoundManager::update(float dt)
musVol.update(dt); musVol.update(dt);
#ifdef BBGE_BUILD_FMODEX
if (musicChannel) if (musicChannel)
{ {
@ -754,15 +724,12 @@ void SoundManager::update(float dt)
SoundCore::system->update(); SoundCore::system->update();
#endif
#if defined(BBGE_BUILD_FMODEX)
if (wasPlayingVoice && !isPlayingVoice()) if (wasPlayingVoice && !isPlayingVoice())
{ {
wasPlayingVoice = false; wasPlayingVoice = false;
onVoiceEnded(); onVoiceEnded();
} }
#endif
} }
void SoundManager::fadeMusic(SoundFadeType sft, float t) void SoundManager::fadeMusic(SoundFadeType sft, float t)
@ -771,7 +738,6 @@ void SoundManager::fadeMusic(SoundFadeType sft, float t)
{ {
case SFT_CROSS: case SFT_CROSS:
{ {
#ifdef BBGE_BUILD_FMODEX
if (musicChannel2) if (musicChannel2)
{ {
musicChannel2->stop(); musicChannel2->stop();
@ -790,16 +756,13 @@ void SoundManager::fadeMusic(SoundFadeType sft, float t)
musicFader2Volume = musVol.y; musicFader2Volume = musVol.y;
musicFader2Time = musicFader2Timer = t; musicFader2Time = musicFader2Timer = t;
#endif
} }
break; break;
case SFT_OUT: case SFT_OUT:
setMusicFader(0, t); setMusicFader(0, t);
#ifdef BBGE_BUILD_FMODEX
stopMusicOnFadeOut = true; stopMusicOnFadeOut = true;
#endif
break; break;
default: default:
//setMusMul(0, t); //setMusMul(0, t);
@ -809,7 +772,6 @@ void SoundManager::fadeMusic(SoundFadeType sft, float t)
bool SoundManager::isPlayingMusic() bool SoundManager::isPlayingMusic()
{ {
#ifdef BBGE_BUILD_FMODEX
if (musicChannel) if (musicChannel)
{ {
@ -818,7 +780,6 @@ bool SoundManager::isPlayingMusic()
return b; return b;
} }
#endif
return false; return false;
@ -828,12 +789,10 @@ void SoundManager::setMusicVolume(float v)
{ {
musVol.x = v; musVol.x = v;
#ifdef BBGE_BUILD_FMODEX
result = group_mus->setVolume(v); result = group_mus->setVolume(v);
checkError(); checkError();
#endif
} }
void SoundManager::setSfxVolume(float v) void SoundManager::setSfxVolume(float v)
@ -850,15 +809,12 @@ void SoundManager::setVoiceVolume(float v)
{ {
voxVol.x = v; voxVol.x = v;
#ifdef BBGE_BUILD_FMODEX
result = group_vox->setVolume(v); result = group_vox->setVolume(v);
checkError(); checkError();
#endif
} }
bool SoundManager::isPlayingVoice() bool SoundManager::isPlayingVoice()
{ {
#ifdef BBGE_BUILD_FMODEX
if (voiceChannel) if (voiceChannel)
{ {
@ -878,7 +834,6 @@ bool SoundManager::isPlayingVoice()
return b; return b;
} }
#endif
return false; return false;
} }
@ -949,12 +904,10 @@ bool SoundManager::playVoice(const std::string &name, SoundVoiceType svt, float
if (playNow) if (playNow)
{ {
#ifdef BBGE_BUILD_FMODEX
if (voiceStream) if (voiceStream)
{ {
stopVoice(); stopVoice();
} }
#endif
debugLog("play now"); debugLog("play now");
@ -975,7 +928,6 @@ bool SoundManager::playVoice(const std::string &name, SoundVoiceType svt, float
} }
} }
#ifdef BBGE_BUILD_FMODEX
// FMOD_DEFAULT uses the defaults. These are the same as FMOD_LOOP_OFF | FMOD_2D | FMOD_HARDWARE. // FMOD_DEFAULT uses the defaults. These are the same as FMOD_LOOP_OFF | FMOD_2D | FMOD_HARDWARE.
@ -1057,7 +1009,6 @@ bool SoundManager::playVoice(const std::string &name, SoundVoiceType svt, float
wasPlayingVoice = true; wasPlayingVoice = true;
} }
#endif
lastVoice = n; lastVoice = n;
event_playVoice.call(); event_playVoice.call();
@ -1073,7 +1024,6 @@ void SoundManager::updateChannelVolume(void *ch, float v)
float SoundManager::getVoiceTime() float SoundManager::getVoiceTime()
{ {
#ifdef BBGE_BUILD_FMODEX
if (isPlayingVoice()) if (isPlayingVoice())
{ {
@ -1082,7 +1032,6 @@ float SoundManager::getVoiceTime()
return float(position) * 0.001f; return float(position) * 0.001f;
} }
#endif
return 0; return 0;
} }
@ -1091,7 +1040,6 @@ void *SoundManager::playSfx(const PlaySfx &play)
{ {
if (!enabled) return 0; if (!enabled) return 0;
#ifdef BBGE_BUILD_FMODEX
FMOD::Channel *channel = 0; FMOD::Channel *channel = 0;
FMOD::Sound *sound = 0; FMOD::Sound *sound = 0;
@ -1164,7 +1112,6 @@ void *SoundManager::playSfx(const PlaySfx &play)
checkError(); checkError();
return channel; return channel;
#endif
return 0; return 0;
@ -1244,7 +1191,6 @@ bool SoundManager::playMusic(const std::string &name, SoundLoopType slt, SoundFa
lastMusic = name; lastMusic = name;
stringToLower(lastMusic); stringToLower(lastMusic);
#ifdef BBGE_BUILD_FMODEX
if (sft == SFT_CROSS) if (sft == SFT_CROSS)
{ {
@ -1338,7 +1284,6 @@ bool SoundManager::playMusic(const std::string &name, SoundLoopType slt, SoundFa
{ {
debugLog("Failed to create music stream: " + fn); debugLog("Failed to create music stream: " + fn);
} }
#endif
return true; return true;
} }
@ -1346,7 +1291,6 @@ bool SoundManager::playMusic(const std::string &name, SoundLoopType slt, SoundFa
void SoundManager::stopMusic() void SoundManager::stopMusic()
{ {
#ifdef BBGE_BUILD_FMODEX
if (musicChannel) if (musicChannel)
{ {
musicChannel->stop(); musicChannel->stop();
@ -1359,14 +1303,12 @@ void SoundManager::stopMusic()
musicStream = 0; musicStream = 0;
musicChannel = 0; musicChannel = 0;
} }
#endif
playingMusicOnce = false; playingMusicOnce = false;
lastMusic = ""; lastMusic = "";
} }
void SoundManager::stopSfx(void *channel) void SoundManager::stopSfx(void *channel)
{ {
#ifdef BBGE_BUILD_FMODEX
if (!channel) return; if (!channel) return;
FMOD::Channel *ch = (FMOD::Channel*)channel; FMOD::Channel *ch = (FMOD::Channel*)channel;
if (ch) if (ch)
@ -1375,12 +1317,10 @@ void SoundManager::stopSfx(void *channel)
checkError(); checkError();
ch = 0; ch = 0;
} }
#endif
} }
void SoundManager::fadeSfx(void *channel, SoundFadeType sft, float t) void SoundManager::fadeSfx(void *channel, SoundFadeType sft, float t)
{ {
#ifdef BBGE_BUILD_FMODEX
if (!channel) return; if (!channel) return;
if (sft == SFT_OUT) if (sft == SFT_OUT)
{ {
@ -1396,13 +1336,11 @@ void SoundManager::fadeSfx(void *channel, SoundFadeType sft, float t)
SoundCore::addFadeCh(f); SoundCore::addFadeCh(f);
} }
} }
#endif
} }
void SoundManager::stopVoice() void SoundManager::stopVoice()
{ {
#ifdef BBGE_BUILD_FMODEX
if (voiceChannel) if (voiceChannel)
{ {
bool playing = false; bool playing = false;
@ -1423,7 +1361,6 @@ void SoundManager::stopVoice()
voiceStream = 0; voiceStream = 0;
} }
onVoiceEnded(); onVoiceEnded();
#endif
} }
@ -1506,7 +1443,6 @@ Buffer SoundManager::loadSoundIntoBank(const std::string &filename, const std::s
stringToLower(name); stringToLower(name);
#ifdef BBGE_BUILD_FMODEX
FMOD::Sound * sound = SoundCore::soundMap[name]; FMOD::Sound * sound = SoundCore::soundMap[name];
@ -1533,11 +1469,8 @@ Buffer SoundManager::loadSoundIntoBank(const std::string &filename, const std::s
} }
return sound; return sound;
#endif
#ifdef BBGE_BUILD_FMODEX
#endif
return Buffer(); return Buffer();
} }
@ -1546,9 +1479,7 @@ Buffer SoundManager::loadLocalSound(const std::string &filename)
{ {
Buffer b = loadSoundIntoBank(filename, localSoundPath, fileType, SFXLOAD_LOCAL); Buffer b = loadSoundIntoBank(filename, localSoundPath, fileType, SFXLOAD_LOCAL);
#ifdef BBGE_BUILD_FMODEX
return b; return b;
#endif
return BBGE_AUDIO_NOCHANNEL; return BBGE_AUDIO_NOCHANNEL;
} }
@ -1576,7 +1507,6 @@ void SoundManager::setModSpeed(float speed)
void SoundManager::clearLocalSounds() void SoundManager::clearLocalSounds()
{ {
#ifdef BBGE_BUILD_FMODEX
for (LocalSounds::iterator i = localSounds.begin(); i != localSounds.end(); i++) for (LocalSounds::iterator i = localSounds.begin(); i != localSounds.end(); i++)
{ {
std::string snd = (*i); std::string snd = (*i);
@ -1586,12 +1516,10 @@ void SoundManager::clearLocalSounds()
soundMap[snd] = 0; soundMap[snd] = 0;
} }
localSounds.clear(); localSounds.clear();
#endif
} }
bool SoundManager::checkError() bool SoundManager::checkError()
{ {
#ifdef BBGE_BUILD_FMODEX
if (result != FMOD_OK) if (result != FMOD_OK)
{ {
std::ostringstream os; std::ostringstream os;
@ -1633,7 +1561,6 @@ bool SoundManager::checkError()
debugLog(os.str()); debugLog(os.str());
return true; return true;
} }
#endif
return false; return false;
} }

View file

@ -29,18 +29,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define BBGE_BUILD_FMODEX #define BBGE_BUILD_FMODEX
#ifdef BBGE_BUILD_FMODEX
const int BBGE_AUDIO_NOCHANNEL = 0; const int BBGE_AUDIO_NOCHANNEL = 0;
#endif
const int BBGE_AUDIO_LOOPINFINITE = -1; const int BBGE_AUDIO_LOOPINFINITE = -1;
const int BBGE_AUDIO_LOOPNONE = 0; const int BBGE_AUDIO_LOOPNONE = 0;
namespace SoundCore namespace SoundCore
{ {
#ifdef BBGE_BUILD_FMODEX
typedef void *Buffer; typedef void *Buffer;
#endif
} }
enum SoundEffectType enum SoundEffectType