17 #ifndef SOUNDMANAGER_H
18 #define SOUNDMANAGER_H
20 #include <QMediaPlayer>
22 #include <QSoundEffect>
25 #include "SoundEffectInstance.h"
154 void onBGMMediaStatusChanged(QMediaPlayer::MediaStatus status);
157 void updateCurrentBGMTrack();
163 QMediaPlayer mBGMPlayer;
165 QUrl mCurrentBGMTrack;
168 bool mBGMMuted =
false;
171 constexpr
static const float BASE_MUSIC_GAIN = 0.30f;
172 constexpr
static const int QMEDIA_PLAYER_GAIN_FACTOR = 100;
176 #endif // SOUNDMANAGER_H
Q_INVOKABLE void clearBGMTrack(BGMPriority priority)
Clears the audio track of the specified background music priority level.
An instance of a sound effect.
Definition: SoundEffectInstance.h:36
Represents the highest priority level an audio track can have.
Definition: SoundManager.h:76
bool isPaused() const
Returns paused.
Definition: SoundManager.h:98
void pausedChanged()
Emitted when paused changes.
SoundManager(QObject *parent=nullptr)
Constructs a SoundManager.
Represents an invalid priority level and serves as a lower bound on priority.
Definition: SoundManager.h:64
bool isBGMMuted() const
Returns bgmMuted.
Represents a priority level for audio playing in game Environments.
Definition: SoundManager.h:72
Controls the sound effects and background music (BGM) audio tracks needed to be played during the gam...
Definition: SoundManager.h:39
Represents a priority level for audio playing on menus.
Definition: SoundManager.h:68
BGMPriority
Ordered priority levels for background music tracks.
Definition: SoundManager.h:60
void bgmMutedChanged()
Emitted when bgmMuted changes.
void setBGMMuted(bool value)
Sets bgmMuted.
void setPaused(bool value)
Sets paused.
Q_INVOKABLE void playSoundEffect(const QString &path)
Plays a one-shot sound effect.
bool paused
Whether or not the SoundManager is currently paused (i.e. not playing audio).
Definition: SoundManager.h:51
SoundEffectInstance getSoundEffect(const QString &path)
Loads a sound effect with sample data obtained from file.
bool bgmMuted
Whether or not the background music is currently muted.
Definition: SoundManager.h:45
Q_INVOKABLE void setBGMTrack(BGMPriority priority, const QString &path)
Sets the audio track of the specified background priority level.