ASAPCabinetFE
 
Loading...
Searching...
No Matches
PulseAudioPlayer Class Reference

Manages all sound operations for the application. More...

#include <pulseaudio_player.h>

+ Inheritance diagram for PulseAudioPlayer:
+ Collaboration diagram for PulseAudioPlayer:

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.
 
- Public Member Functions inherited from ISoundManager
virtual ~ISoundManager ()=default
 Virtual destructor to ensure proper cleanup for derived classes.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PulseAudioPlayer()

PulseAudioPlayer::PulseAudioPlayer ( const Settings settings)

Constructs a PulseAudioPlayer instance.

Initializes the sound manager with the executable directory and initial settings.

Parameters
settingsInitial application settings, including sound paths and volumes.

◆ ~PulseAudioPlayer()

PulseAudioPlayer::~PulseAudioPlayer ( )
override

Destroys the PulseAudioPlayer instance and cleans up all SDL_mixer resources.

Ensures proper cleanup of audio resources and SDL_mixer subsystems.

+ Here is the call graph for this function:

Member Function Documentation

◆ applyAudioSettings()

void PulseAudioPlayer::applyAudioSettings ( )
overridevirtual

Applies the current audio settings (volumes, mute states) to all active sound types.

Implements ISoundManager.

+ Here is the caller graph for this function:

◆ loadSounds()

void PulseAudioPlayer::loadSounds ( )
overridevirtual

Loads all necessary sound resources based on current settings.

This includes UI sound effects and the ambience music file.

Implements ISoundManager.

+ Here is the caller graph for this function:

◆ playAmbienceMusic()

void PulseAudioPlayer::playAmbienceMusic ( const std::string &  path)
overridevirtual

Plays the background ambience music.

Parameters
pathThe full path to the ambience music file.

Implements ISoundManager.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ playCustomLaunch()

void PulseAudioPlayer::playCustomLaunch ( const std::string &  path)
overridevirtual

Plays the custom launch audio.

Parameters
pathThe full path to the custom launch audio file.

Implements ISoundManager.

+ Here is the call graph for this function:

◆ playTableMusic()

void PulseAudioPlayer::playTableMusic ( const std::string &  path)
overridevirtual

Plays the table-specific music.

Parameters
pathThe full path to the table music file.

Implements ISoundManager.

+ Here is the call graph for this function:

◆ playUISound()

void PulseAudioPlayer::playUISound ( const std::string &  key)
overridevirtual

Plays a specific UI sound effect.

Parameters
keyThe unique identifier for the UI sound.

Implements ISoundManager.

◆ stopMusic()

void PulseAudioPlayer::stopMusic ( )
overridevirtual

Stops any currently playing background music (ambience or table music).

Implements ISoundManager.

+ Here is the caller graph for this function:

◆ updateSettings()

void PulseAudioPlayer::updateSettings ( const Settings newSettings)
overridevirtual

Updates the internal settings and reloads sounds if necessary.

Parameters
newSettingsThe new settings to apply.

Implements ISoundManager.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: