Manages all sound operations for the application. More...
#include <pulseaudio_player.h>
Public Member Functions | |
PulseAudioPlayer (const Settings &settings) | |
Constructs a PulseAudioPlayer instance. | |
~PulseAudioPlayer () override | |
Destroys the PulseAudioPlayer instance and cleans up all SDL_mixer resources. | |
void | loadSounds () override |
Loads all necessary sound resources based on current settings. | |
void | playUISound (const std::string &key) override |
Plays a specific UI sound effect. | |
void | playAmbienceMusic (const std::string &path) override |
Plays the background ambience music. | |
void | playTableMusic (const std::string &path) override |
Plays the table-specific music. | |
void | playCustomLaunch (const std::string &path) override |
Plays the custom launch audio. | |
void | stopMusic () override |
Stops any currently playing background music (ambience or table music). | |
void | applyAudioSettings () override |
Applies the current audio settings (volumes, mute states) to all active sound types. | |
void | updateSettings (const Settings &newSettings) override |
Updates the internal settings and reloads sounds if necessary. | |
![]() | |
virtual | ~ISoundManager ()=default |
Virtual destructor to ensure proper cleanup for derived classes. | |
Manages all sound operations for the application.
This class implements the ISoundManager interface, providing concrete functionality for loading, playing, and controlling UI sounds (Mix_Chunk), ambience music (Mix_Music), and table-specific music (Mix_Music). It handles SDL_mixer initialization and resource management, including random positioning for ambience music.
PulseAudioPlayer::PulseAudioPlayer | ( | const Settings & | settings | ) |
Constructs a PulseAudioPlayer instance.
Initializes the sound manager with the executable directory and initial settings.
settings | Initial application settings, including sound paths and volumes. |
|
override |
Destroys the PulseAudioPlayer instance and cleans up all SDL_mixer resources.
Ensures proper cleanup of audio resources and SDL_mixer subsystems.
|
overridevirtual |
Applies the current audio settings (volumes, mute states) to all active sound types.
Implements ISoundManager.
|
overridevirtual |
Loads all necessary sound resources based on current settings.
This includes UI sound effects and the ambience music file.
Implements ISoundManager.
|
overridevirtual |
Plays the background ambience music.
path | The full path to the ambience music file. |
Implements ISoundManager.
|
overridevirtual |
Plays the custom launch audio.
path | The full path to the custom launch audio file. |
Implements ISoundManager.
|
overridevirtual |
Plays the table-specific music.
path | The full path to the table music file. |
Implements ISoundManager.
|
overridevirtual |
Plays a specific UI sound effect.
key | The unique identifier for the UI sound. |
Implements ISoundManager.
|
overridevirtual |
Stops any currently playing background music (ambience or table music).
Implements ISoundManager.
|
overridevirtual |
Updates the internal settings and reloads sounds if necessary.
newSettings | The new settings to apply. |
Implements ISoundManager.