|
Aegis2D
Modular C++26 2D game engine for networked games
|
Sound effects and music on top of SDL3 (client only). More...
Classes | |
| class | AudioDevice |
| The default audio output and the sounds it plays. More... | |
| class | AudioError |
| Thrown when the audio device cannot be opened or a sound cannot be loaded. More... | |
| class | EventSounds |
| Plays sounds when events are published on an event bus, so gameplay code never calls audio. More... | |
| struct | SoundOptions |
| How EventSounds plays the sound of an event. More... | |
| struct | Volumes |
| Positions of the three volume sliders of a settings menu, from 0 (silent) to 1. More... | |
Typedefs | |
| using | SoundId = std::size_t |
| Identifier of a sound loaded by an AudioDevice, given by AudioDevice::load(). | |
Enumerations | |
| enum class | Channel : std::uint8_t { Effects , Music } |
| Group of sounds whose volume is set together. More... | |
Functions | |
| std::pair< float, float > | positional (Vec2 position, Vec2 camera_center, float view_half_width) noexcept |
| Stereo pan and distance gain for a world-space sound relative to a camera view. | |
| std::string_view | name () noexcept |
| Name of the module, used to check that it is linked. | |
Sound effects and music on top of SDL3 (client only).
| using aegis2d::audio::SoundId = typedef std::size_t |
Identifier of a sound loaded by an AudioDevice, given by AudioDevice::load().
|
strong |
|
noexcept |
Name of the module, used to check that it is linked.
"audio", a view of a static string.
|
inlinenoexcept |
Stereo pan and distance gain for a world-space sound relative to a camera view.
The camera center and half-width define the reference: a source at the center returns {0, 1} (no pan, full volume); one at the edge returns {±1, 0} (fully panned, silent). Sources beyond the edge are clamped.
| position | World position of the sound. |
| camera_center | World position the camera centers on (Camera::center()). |
| view_half_width | Half-width of the visible area in world units (Camera::visible() width / 2), used as the maximum range: sounds this far or more from the center are silent. Pass a larger value to hear sounds beyond the view. |
{pan, gain}: pan in [-1, 1], gain in [0, 1].