|
Game Audio Module
A C++ audio system using miniaudio with Python bindings
|
Controls multiple sounds as a single unit. More...
#include <audio_group.h>
Public Member Functions | |
| ~AudioGroup () | |
| Destructor. | |
Static Public Member Functions | |
| static std::unique_ptr< AudioGroup > | Create (ma_engine *engine) |
| Factory method for creating AudioGroup instances. | |
Private Member Functions | |
| AudioGroup (ma_engine *engine) | |
| Private constructor - use Create() instead. | |
| void | FadeVolume (float targetVolume, std::chrono::milliseconds duration) |
| Fades the group volume to a target over duration. | |
| std::chrono::milliseconds | GetFadeDuration () const |
| Gets the duration of the current fade. | |
| std::chrono::steady_clock::time_point | GetFadeEndTime () const |
| Gets the end time of the current fade. | |
| ma_sound_group * | GetHandle () |
| Gets the underlying miniaudio sound group handle. | |
| float | GetStartVolume () const |
| Gets the starting volume for the current fade. | |
| float | GetTargetVolume () const |
| Gets the target volume for the current fade. | |
| float | GetVolume () const |
| Gets the current volume for this group. | |
| bool | IsFading () const |
| Checks if the group is currently fading. | |
| void | SetFadingState (bool fading) |
| Allows AudioManager to set fading state directly. | |
| void | SetVolume (float volume) |
| Sets the volume for this group. | |
Private Attributes | |
| float | volume_ |
| Current volume level. | |
Fade State | |
| float | target_volume_ {0.0f} |
| Target volume for fade. | |
| float | start_volume_ {0.0f} |
| Starting volume for fade. | |
| bool | is_fading_ {false} |
| Whether currently fading. | |
| std::chrono::steady_clock::time_point | fade_end_time_ |
| When the fade will end. | |
| std::chrono::milliseconds | fade_duration_ {0} |
| Duration of the fade. | |
miniaudio Resources | |
| ma_sound_group * | sound_group_ |
| miniaudio sound group handle | |
| ma_engine * | engine_ |
| Reference to miniaudio engine. | |
Friends | |
| class | AudioManager |
| Allow AudioManager to access private members for control. | |
| class | AudioSystem |
| Allow AudioSystem to create groups. | |
| class | Sound |
| Allow Sound to access the group handle. | |
Controls multiple sounds as a single unit.
AudioGroup allows collective control over multiple sounds (e.g., all music or all sound effects). This enables group volume adjustment, fading, and other operations to be applied to multiple sounds simultaneously.
Groups are mapped to miniaudio sound groups internally.
|
explicitprivate |
Private constructor - use Create() instead.
| engine | Pointer to the miniaudio engine |
| audio::AudioGroup::~AudioGroup | ( | ) |
Destructor.
Cleans up miniaudio resources
|
inlinestatic |
Factory method for creating AudioGroup instances.
This static factory method ensures proper initialization and encapsulation of AudioGroup objects.
| engine | Pointer to the miniaudio engine |
|
private |
Fades the group volume to a target over duration.
| targetVolume | Target volume level (0.0 to 1.0) |
| duration | Duration of the fade in milliseconds |
|
inlineprivate |
Gets the duration of the current fade.
|
inlineprivate |
Gets the end time of the current fade.
|
inlineprivate |
Gets the underlying miniaudio sound group handle.
|
inlineprivate |
Gets the starting volume for the current fade.
|
inlineprivate |
Gets the target volume for the current fade.
|
inlineprivate |
Gets the current volume for this group.
|
inlineprivate |
Checks if the group is currently fading.
|
inlineprivate |
Allows AudioManager to set fading state directly.
| fading | Whether the group is fading |
|
private |
Sets the volume for this group.
| volume | Volume level (0.0 to 1.0) |
|
friend |
Allow AudioManager to access private members for control.
|
friend |
Allow AudioSystem to create groups.
|
private |
Reference to miniaudio engine.
|
private |
Duration of the fade.
|
private |
When the fade will end.
|
private |
Whether currently fading.
|
private |
miniaudio sound group handle
|
private |
Starting volume for fade.
|
private |
Target volume for fade.
|
private |
Current volume level.