[NEW] music::whichMusic()

This commit is contained in:
2023-10-19 15:27:53 +02:00
parent 490dc1e5d6
commit 70720e7e62
2 changed files with 12 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ namespace audio
static char *buffer = nullptr; static char *buffer = nullptr;
static Mix_Music *music = nullptr; static Mix_Music *music = nullptr;
static std::string music_filename = "";
// Inicialitza el sistema de só // Inicialitza el sistema de só
void init() void init()
@@ -47,6 +48,7 @@ namespace audio
if (music==nullptr) return false; if (music==nullptr) return false;
music_filename = filename;
return true; return true;
} }
@@ -99,6 +101,12 @@ namespace audio
} }
} }
// Obté el nom de l'arxiu de música actual
std::string whichMusic()
{
return music_filename;
}
// Carrega un só des d'un arxiu WAV // Carrega un só des d'un arxiu WAV
const sound *loadSound(const std::string filename) const sound *loadSound(const std::string filename)
{ {

View File

@@ -55,6 +55,10 @@ namespace audio
/// @return estat actual de la música (MUSIC_INVALID, MUSIC_PLAYING, MUSIC_PAUSED o MUSIC_STOPPED) /// @return estat actual de la música (MUSIC_INVALID, MUSIC_PLAYING, MUSIC_PAUSED o MUSIC_STOPPED)
const music_state getMusicState(); const music_state getMusicState();
/// @brief Obté el nom de l'arxiu de música actual
/// @return el nom de l'arxiu
std::string whichMusic();
/// @brief Carrega un só des d'un arxiu WAV /// @brief Carrega un só des d'un arxiu WAV
/// @param filename nom de l'arxiu /// @param filename nom de l'arxiu
/// @return un punter al só /// @return un punter al só