refactor jail_audio: namespace Ja, enum class, tipus sense prefix JA_

This commit is contained in:
2026-05-16 17:56:46 +02:00
parent 9f6d38cf48
commit be95b8afab
14 changed files with 741 additions and 832 deletions
+7 -7
View File
@@ -64,12 +64,12 @@ Resource::~Resource() {
textures_.clear();
for (auto &[name, s] : sounds_) {
JA_DeleteSound(s);
Ja::deleteSound(s);
}
sounds_.clear();
for (auto &[name, m] : musics_) {
JA_DeleteMusic(m);
Ja::deleteMusic(m);
}
musics_.clear();
}
@@ -103,14 +103,14 @@ void Resource::preloadResources() {
break;
}
case Asset::Type::SOUND: {
JA_Sound_t *s = JA_LoadSound(bytes.data(), (uint32_t)bytes.size());
Ja::Sound *s = Ja::loadSound(bytes.data(), (uint32_t)bytes.size());
if (s != nullptr) {
sounds_[BASE_NAME] = s;
}
break;
}
case Asset::Type::MUSIC: {
JA_Music_t *m = JA_LoadMusic(bytes.data(), (Uint32)bytes.size());
Ja::Music *m = Ja::loadMusic(bytes.data(), (Uint32)bytes.size());
if (m != nullptr) {
musics_[BASE_NAME] = m;
}
@@ -185,7 +185,7 @@ void Resource::preloadFonts() {
// Pass 2b: construye los Menu (dependen de Text+sonidos cargados antes)
//
// NOTA: Menu::loadFromBytes aún llama internamente a asset->get() y Text/
// JA_LoadSound por path. Funciona en modo fallback; en pack estricto requiere
// Ja::loadSound por path. Funciona en modo fallback; en pack estricto requiere
// que Menu se adapte a cargar desde ResourceHelper. Migración pendiente.
void Resource::preloadMenus() {
const auto &items = Asset::get()->getAll();
@@ -218,7 +218,7 @@ auto Resource::getTexture(const std::string &name) -> Texture * {
return it->second;
}
auto Resource::getSound(const std::string &name) -> JA_Sound_t * {
auto Resource::getSound(const std::string &name) -> Ja::Sound * {
auto it = sounds_.find(name);
if (it == sounds_.end()) {
std::cerr << "Resource::getSound: missing " << name << '\n';
@@ -227,7 +227,7 @@ auto Resource::getSound(const std::string &name) -> JA_Sound_t * {
return it->second;
}
auto Resource::getMusic(const std::string &name) -> JA_Music_t * {
auto Resource::getMusic(const std::string &name) -> Ja::Music * {
auto it = musics_.find(name);
if (it == musics_.end()) {
std::cerr << "Resource::getMusic: missing " << name << '\n';