eliminat tot el define NO_AUDIO del codi
This commit is contained in:
@@ -13,9 +13,7 @@
|
||||
#include "asset.h" // Para Asset
|
||||
#include "color.h" // Para Color
|
||||
#include "version.h" // Para Version::APP_NAME y Version::GIT_HASH
|
||||
#ifndef NO_AUDIO
|
||||
#include "external/jail_audio.h" // Para JA_LoadMusic, JA_LoadSound, JA_DeleteMusic, JA_DeleteSound
|
||||
#endif
|
||||
#include "lang.h" // Para getText
|
||||
#include "param.h" // Para Param, param, ParamResource, ParamGame
|
||||
#include "resource_helper.h" // Para ResourceHelper
|
||||
@@ -325,7 +323,6 @@ auto Resource::getDemoData(int index) -> DemoData & {
|
||||
|
||||
auto Resource::loadSoundLazy(const std::string &name) -> JA_Sound_t * {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading sound lazily: %s", name.c_str());
|
||||
#ifndef NO_AUDIO
|
||||
auto sound_list = Asset::get()->getListByType(Asset::Type::SOUND);
|
||||
for (const auto &file : sound_list) {
|
||||
if (getFileName(file) == name) {
|
||||
@@ -333,13 +330,11 @@ auto Resource::loadSoundLazy(const std::string &name) -> JA_Sound_t * {
|
||||
return JA_LoadSound(audio_path.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto Resource::loadMusicLazy(const std::string &name) -> JA_Music_t * {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading music lazily: %s", name.c_str());
|
||||
#ifndef NO_AUDIO
|
||||
auto music_list = Asset::get()->getListByType(Asset::Type::MUSIC);
|
||||
for (const auto &file : music_list) {
|
||||
if (getFileName(file) == name) {
|
||||
@@ -347,7 +342,6 @@ auto Resource::loadMusicLazy(const std::string &name) -> JA_Music_t * {
|
||||
return JA_LoadMusic(audio_path.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -426,10 +420,8 @@ auto Resource::loadAnimationLazy(const std::string &name) -> AnimationsFileBuffe
|
||||
|
||||
// Vacia todos los vectores de recursos
|
||||
void Resource::clear() {
|
||||
#ifndef NO_AUDIO
|
||||
clearSounds();
|
||||
clearMusics();
|
||||
#endif
|
||||
textures_.clear();
|
||||
text_files_.clear();
|
||||
texts_.clear();
|
||||
@@ -449,10 +441,8 @@ void Resource::load() {
|
||||
screen->setVSync(false);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES");
|
||||
#ifndef NO_AUDIO
|
||||
loadSounds(); // Carga sonidos
|
||||
loadMusics(); // Carga músicas
|
||||
#endif
|
||||
loadTextures(); // Carga texturas
|
||||
loadTextFiles(); // Carga ficheros de texto
|
||||
loadAnimations(); // Carga animaciones
|
||||
@@ -485,12 +475,8 @@ void Resource::loadSounds() {
|
||||
for (const auto &l : list) {
|
||||
auto name = getFileName(l);
|
||||
updateLoadingProgress(name);
|
||||
#ifndef NO_AUDIO
|
||||
std::string audio_path = createTempAudioFile(l, temp_audio_files_);
|
||||
sounds_.emplace_back(name, JA_LoadSound(audio_path.c_str()));
|
||||
#else
|
||||
sounds_.emplace_back(name, nullptr);
|
||||
#endif
|
||||
printWithDots("Sound : ", name, "[ LOADED ]");
|
||||
}
|
||||
}
|
||||
@@ -504,12 +490,8 @@ void Resource::loadMusics() {
|
||||
for (const auto &l : list) {
|
||||
auto name = getFileName(l);
|
||||
updateLoadingProgress(name);
|
||||
#ifndef NO_AUDIO
|
||||
std::string audio_path = createTempAudioFile(l, temp_audio_files_);
|
||||
musics_.emplace_back(name, JA_LoadMusic(audio_path.c_str()));
|
||||
#else
|
||||
musics_.emplace_back(name, nullptr);
|
||||
#endif
|
||||
printWithDots("Music : ", name, "[ LOADED ]");
|
||||
}
|
||||
}
|
||||
@@ -739,9 +721,7 @@ void Resource::createText() {
|
||||
void Resource::clearSounds() {
|
||||
for (auto &sound : sounds_) {
|
||||
if (sound.sound != nullptr) {
|
||||
#ifndef NO_AUDIO
|
||||
JA_DeleteSound(sound.sound);
|
||||
#endif
|
||||
sound.sound = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -752,9 +732,7 @@ void Resource::clearSounds() {
|
||||
void Resource::clearMusics() {
|
||||
for (auto &music : musics_) {
|
||||
if (music.music != nullptr) {
|
||||
#ifndef NO_AUDIO
|
||||
JA_DeleteMusic(music.music);
|
||||
#endif
|
||||
music.music = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user