treballant en la classe Audio

This commit is contained in:
2025-03-28 23:27:33 +01:00
parent 31a0ad6fd5
commit d2417f48d9
29 changed files with 321 additions and 253 deletions

View File

@@ -10,7 +10,7 @@
#include "game_logo.h" // Para GameLogo
#include "global_inputs.h" // Para check, update
#include "input.h" // Para Input, InputAction, INPUT_DO_NOT_ALLOW_R...
#include "jail_audio.h" // Para JA_GetMusicState, JA_FadeOutMusic, JA_...
#include "audio.h" // Para JA_GetMusicState, JA_FadeOutMusic, JA_...
#include "lang.h" // Para getText
#include "global_events.h" // Para handleEvent
#include "notifier.h" // Para Notifier
@@ -55,7 +55,7 @@ Title::Title()
Title::~Title()
{
Resource::get()->getTexture("smb2.gif")->setPalette(0);
JA_StopChannel(-1);
Audio::get()->stopAllSounds();
}
// Actualiza las variables del objeto
@@ -203,8 +203,8 @@ void Title::checkInput()
{
if ((state_ == TitleState::LOGO_FINISHED || ALLOW_TITLE_ANIMATION_SKIP) && !fade_->isEnabled())
{
JA_PlaySound(Resource::get()->getSound("game_start.wav"));
JA_FadeOutMusic(1500);
Audio::get()->playSound("game_start.wav");
Audio::get()->fadeOutMusic(1500);
switch (CONTROLLER.player_id)
{
case 1:
@@ -325,7 +325,7 @@ void Title::updateFade()
// Se ha pulsado para jugar
section::name = section::Name::GAME;
section::options = selection_;
JA_StopMusic();
Audio::get()->stopMusic();
}
}
}
@@ -342,6 +342,7 @@ void Title::updateState()
if (game_logo_->hasFinished())
{
state_ = TitleState::LOGO_FINISHED;
Audio::get()->playMusic("title.ogg");
}
break;
}
@@ -350,12 +351,6 @@ void Title::updateState()
// El contador solo sube si no estamos definiendo botones
counter_ = define_buttons_->isEnabled() ? 0 : counter_ + 1;
// Reproduce la música
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
{
JA_PlayMusic(Resource::get()->getMusic("title.ogg"));
}
// Actualiza el logo con el título del juego
game_logo_->update();