|
R-Type
Distributed multiplayer game engine in C++
|
Sound effect manager implementation using the graphics audio system. More...
#include <SoundEffectManager.hpp>


Public Member Functions | |
| SoundEffectManager (Graphics::IGraphics &graphics) | |
| Construct the sound effect manager. | |
| ~SoundEffectManager () override | |
| Destructor - unloads all sounds. | |
| SoundEffectManager (const SoundEffectManager &)=delete | |
| SoundEffectManager & | operator= (const SoundEffectManager &)=delete |
| SoundEffectManager (SoundEffectManager &&)=default | |
| SoundEffectManager & | operator= (SoundEffectManager &&)=default |
| bool | Initialize () |
| Initialize the audio system and load all sounds. | |
| void | PlayClickSound () override |
| Play the button click sound effect. | |
| void | PlayMainMenuOpenSound () override |
| Play the main menu open sound effect. | |
| void | PlayRoomMenuOpenSound () override |
| Play the room menu open sound effect. | |
| void | SetVolume (float volume) override |
| Set the master volume for all sound effects. | |
| float | GetVolume () const override |
| Get the current master volume. | |
Public Member Functions inherited from Audio::ISoundEffectService | |
| virtual | ~ISoundEffectService ()=default |
Private Member Functions | |
| void | LoadSounds () |
| void | ApplyVolumeToAllSounds () |
Private Attributes | |
| Graphics::IGraphics & | _graphics |
| float | _volume {DEFAULT_SOUND_EFFECT_VOLUME} |
| bool | _initialized {false} |
Static Private Attributes | |
| static constexpr const char * | SOUND_CLICK = "menu_click" |
| static constexpr const char * | SOUND_MAIN_MENU_OPEN = "main_menu_open" |
| static constexpr const char * | SOUND_ROOM_MENU_OPEN = "room_menu_open" |
| static constexpr const char * | PATH_CLICK = "assets/sounds/menu-click.mp3" |
| static constexpr const char * | PATH_MAIN_MENU_OPEN = "assets/sounds/main-menu-open.mp3" |
| static constexpr const char * | PATH_ROOM_MENU_OPEN = "assets/sounds/rooms-menu-open.mp3" |
Sound effect manager implementation using the graphics audio system.
This class manages loading and playing menu sound effects. It uses the IGraphics interface for audio operations, maintaining consistency with the rest of the codebase.
Sound file paths (relative to project root):
Definition at line 33 of file SoundEffectManager.hpp.
|
explicit |
Construct the sound effect manager.
| graphics | Graphics interface with audio capabilities. |
Definition at line 12 of file SoundEffectManager.cpp.
|
override |
Destructor - unloads all sounds.
Definition at line 14 of file SoundEffectManager.cpp.
References _graphics, _initialized, SOUND_CLICK, SOUND_MAIN_MENU_OPEN, SOUND_ROOM_MENU_OPEN, and Graphics::IGraphics::UnloadSound().

|
delete |
|
default |
|
private |
Definition at line 56 of file SoundEffectManager.cpp.
References _graphics, _volume, Graphics::IGraphics::SetSoundVolume(), SOUND_CLICK, SOUND_MAIN_MENU_OPEN, and SOUND_ROOM_MENU_OPEN.
Referenced by Initialize(), and SetVolume().

|
overridevirtual |
Get the current master volume.
Implements Audio::ISoundEffectService.
Definition at line 87 of file SoundEffectManager.cpp.
References _volume.
| bool Audio::SoundEffectManager::Initialize | ( | ) |
Initialize the audio system and load all sounds.
Definition at line 22 of file SoundEffectManager.cpp.
References _graphics, _initialized, _volume, ApplyVolumeToAllSounds(), Graphics::IGraphics::InitAudioDevice(), Graphics::IGraphics::IsAudioDeviceReady(), LoadSounds(), LOG_ERROR, and LOG_INFO.

|
private |
Definition at line 42 of file SoundEffectManager.cpp.
References _graphics, Graphics::IGraphics::LoadSound(), LOG_WARNING, PATH_CLICK, PATH_MAIN_MENU_OPEN, PATH_ROOM_MENU_OPEN, SOUND_CLICK, SOUND_MAIN_MENU_OPEN, and SOUND_ROOM_MENU_OPEN.
Referenced by Initialize().

|
delete |
|
default |
|
overridevirtual |
Play the button click sound effect.
Implements Audio::ISoundEffectService.
Definition at line 62 of file SoundEffectManager.cpp.
References _graphics, _initialized, Graphics::IGraphics::PlaySound(), and SOUND_CLICK.

|
overridevirtual |
Play the main menu open sound effect.
Implements Audio::ISoundEffectService.
Definition at line 68 of file SoundEffectManager.cpp.
References _graphics, _initialized, Graphics::IGraphics::PlaySound(), and SOUND_MAIN_MENU_OPEN.

|
overridevirtual |
Play the room menu open sound effect.
Implements Audio::ISoundEffectService.
Definition at line 74 of file SoundEffectManager.cpp.
References _graphics, _initialized, Graphics::IGraphics::PlaySound(), and SOUND_ROOM_MENU_OPEN.

|
overridevirtual |
Set the master volume for all sound effects.
| volume | Volume level (0.0 to 1.0) |
Implements Audio::ISoundEffectService.
Definition at line 80 of file SoundEffectManager.cpp.
References _initialized, _volume, and ApplyVolumeToAllSounds().

|
private |
Definition at line 79 of file SoundEffectManager.hpp.
Referenced by ApplyVolumeToAllSounds(), Initialize(), LoadSounds(), PlayClickSound(), PlayMainMenuOpenSound(), PlayRoomMenuOpenSound(), and ~SoundEffectManager().
|
private |
Definition at line 81 of file SoundEffectManager.hpp.
Referenced by Initialize(), PlayClickSound(), PlayMainMenuOpenSound(), PlayRoomMenuOpenSound(), SetVolume(), and ~SoundEffectManager().
|
private |
Definition at line 80 of file SoundEffectManager.hpp.
Referenced by ApplyVolumeToAllSounds(), GetVolume(), Initialize(), and SetVolume().
|
staticconstexprprivate |
Definition at line 89 of file SoundEffectManager.hpp.
Referenced by LoadSounds().
|
staticconstexprprivate |
Definition at line 90 of file SoundEffectManager.hpp.
Referenced by LoadSounds().
|
staticconstexprprivate |
Definition at line 91 of file SoundEffectManager.hpp.
Referenced by LoadSounds().
|
staticconstexprprivate |
Definition at line 84 of file SoundEffectManager.hpp.
Referenced by ApplyVolumeToAllSounds(), LoadSounds(), PlayClickSound(), and ~SoundEffectManager().
|
staticconstexprprivate |
Definition at line 85 of file SoundEffectManager.hpp.
Referenced by ApplyVolumeToAllSounds(), LoadSounds(), PlayMainMenuOpenSound(), and ~SoundEffectManager().
|
staticconstexprprivate |
Definition at line 86 of file SoundEffectManager.hpp.
Referenced by ApplyVolumeToAllSounds(), LoadSounds(), PlayRoomMenuOpenSound(), and ~SoundEffectManager().