bool AudioEngine::LoadSound(const std::string &filename, hoa_mode_manager::GameMode *gm) { if(!DoesFileExist(filename)) return false; SoundDescriptor *new_sound = new SoundDescriptor(); // Add potential ownership of the sound descriptor if(gm) new_sound->AddOwner(gm); if(!_LoadAudio(new_sound, filename)) { delete new_sound; // When the sound is used by multiple modes, simply add the ownership there. std::map<std::string, private_audio::AudioCacheElement>::iterator it = _audio_cache.find(filename); if(it != _audio_cache.end()) { it->second.audio->AddOwner(gm); return true; } return false; } return true; }
bool AudioEngine::LoadMusic(const std::string& filename) { MusicDescriptor* new_music = new MusicDescriptor(); if (_LoadAudio(new_music, filename) == false) { delete new_music; return false; } return true; }
bool AudioEngine::LoadSound(const std::string& filename) { if (DoesFileExist(filename) == false) return false; SoundDescriptor* new_sound = new SoundDescriptor(); if (_LoadAudio(new_sound, filename) == false) { delete new_sound; return false; } return true; }
bool AudioEngine::LoadMusic(const std::string &filename, vt_mode_manager::GameMode *gm) { MusicDescriptor *new_music = new MusicDescriptor(); // Add potential ownership of the sound descriptor if(gm) new_music->AddOwner(gm); if(!_LoadAudio(new_music, filename)) { delete new_music; // When the music is used by multiple modes, simply add the ownership there. std::map<std::string, private_audio::AudioCacheElement>::iterator it = _audio_cache.find(filename); if(it != _audio_cache.end()) { it->second.audio->AddOwner(gm); return true; } return false; } return true; }
bool AudioEngine::LoadMusic(const std::string &filename, vt_mode_manager::GameMode *gm) { return _LoadAudio(filename, true, gm); }
bool AudioEngine::LoadSound(const std::string &filename, vt_mode_manager::GameMode *gm) { return _LoadAudio(filename, false, gm); }