treballant en la classe Audio
This commit is contained in:
@@ -18,13 +18,13 @@
|
||||
#include <string> // Para operator+, allocator, char_traits
|
||||
#include <vector> // Para vector
|
||||
#include "asset.h" // Para Asset, AssetType
|
||||
#include "audio.h" // Para Audio
|
||||
#include "credits.h" // Para Credits
|
||||
#include "game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_MOD...
|
||||
#include "hiscore_table.h" // Para HiScoreTable
|
||||
#include "input.h" // Para Input, InputAction
|
||||
#include "instructions.h" // Para Instructions
|
||||
#include "intro.h" // Para Intro
|
||||
#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundVolume
|
||||
#include "lang.h" // Para Code, loadFromFile
|
||||
#include "logo.h" // Para Logo
|
||||
#include "manage_hiscore_table.h" // Para ManageHiScoreTable
|
||||
@@ -93,7 +93,7 @@ void Director::init()
|
||||
// Inicializa y crea el resto de objetos
|
||||
lang::loadFromFile(getLangFile(static_cast<lang::Code>(options.game.language)));
|
||||
Screen::init();
|
||||
initJailAudio();
|
||||
Audio::init();
|
||||
Resource::init();
|
||||
Input::init(Asset::get()->get("gamecontrollerdb.txt"));
|
||||
bindInputs();
|
||||
@@ -110,14 +110,13 @@ void Director::close()
|
||||
{
|
||||
saveOptionsFile(Asset::get()->get("config.txt"));
|
||||
|
||||
Asset::destroy();
|
||||
Resource::destroy();
|
||||
Input::destroy();
|
||||
Screen::destroy();
|
||||
Notifier::destroy();
|
||||
OnScreenHelp::destroy();
|
||||
|
||||
JA_Quit();
|
||||
Notifier::destroy();
|
||||
Input::destroy();
|
||||
Resource::destroy();
|
||||
Audio::destroy();
|
||||
Screen::destroy();
|
||||
Asset::destroy();
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
@@ -257,34 +256,6 @@ void Director::bindInputs()
|
||||
}
|
||||
}
|
||||
|
||||
// Inicializa JailAudio
|
||||
void Director::initJailAudio()
|
||||
{
|
||||
// Inicializa SDL
|
||||
if (!SDL_Init(SDL_INIT_AUDIO))
|
||||
{
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_AUDIO could not initialize! SDL Error: %s", SDL_GetError());
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "\n** SDL_AUDIO: INITIALIZING\n");
|
||||
|
||||
JA_Init(48000, SDL_AUDIO_S16LE, 2);
|
||||
if (options.audio.enabled)
|
||||
{
|
||||
JA_SetMusicVolume(to_JA_volume(options.audio.music.volume));
|
||||
JA_SetSoundVolume(to_JA_volume(options.audio.sound.volume));
|
||||
}
|
||||
else
|
||||
{
|
||||
JA_SetMusicVolume(0);
|
||||
JA_SetSoundVolume(0);
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "** SDL_AUDIO: INITIALIZATION COMPLETE\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Crea el indice de ficheros
|
||||
void Director::setFileList()
|
||||
{
|
||||
@@ -632,8 +603,8 @@ void Director::runDemoGame()
|
||||
// Ejecuta la sección init
|
||||
void Director::runInit()
|
||||
{
|
||||
JA_StopMusic();
|
||||
JA_StopChannel(-1);
|
||||
Audio::get()->stopMusic();
|
||||
Audio::get()->stopAllSounds();
|
||||
if (section::options == section::Options::RELOAD || true)
|
||||
{
|
||||
Resource::get()->reload();
|
||||
|
||||
Reference in New Issue
Block a user