Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
volume.hpp
Go to the documentation of this file.
1
3#pragma once
4
6#include <aegis2d/audio/export.hpp>
8
9#include <string_view>
10
11namespace aegis2d::audio {
12
18struct AEGIS2D_AUDIO_EXPORT Volumes {
20 float master = 1.0F;
22 float music = 1.0F;
24 float effects = 1.0F;
25
29 [[nodiscard]] float slider(Channel channel) const noexcept;
30
37 [[nodiscard]] float gain(Channel channel) const noexcept;
38
41 [[nodiscard]] Volumes clamped() const noexcept;
42
48 void save(core::Config& settings, std::string_view section) const;
49
56 void load(const core::Config& settings, std::string_view section);
57};
58
59} // namespace aegis2d::audio
Audio output: sounds loaded once, then played on a channel, on top of SDL3.
JSON configuration with dotted-path lookups, which can be changed and saved.
Sound effects and music on top of SDL3 (client only).
Definition audio.hpp:17
Channel
Group of sounds whose volume is set together.
Definition audio.hpp:28
Definition endpoint.hpp:85
Positions of the three volume sliders of a settings menu, from 0 (silent) to 1.
Definition volume.hpp:18
float slider(Channel channel) const noexcept
Slider of a channel.
Volumes clamped() const noexcept
The same volumes, each one brought into [0, 1]; not-a-number becomes 1.
float gain(Channel channel) const noexcept
Gain applied to the samples of a channel.