Multichannel Audio mixer class. The AudioMixer allows AudioEmitter components to group their outputs into one of 16 channels, each of which may have their volume adjusted, affecting all of the AudioEmitters currently routed through that channel. The AudioMixer also has a master volume channel which is applied to all subsequent channels. By default AudioEmitter components are assigned to channel 0. For these AudioMixer settings to be applied a scene must have an active AudioSystem.
More...
#include <Mixer.hpp>
|
static void | setMasterVolume (float) |
| Sets the master volume. Volume ranges from 0 - 1 for normal values but are clamped up to a value of 10 which, depending onthe active subsystem, attemps to amplify the volume.
|
|
static float | getMasterVolume () |
| Returns the current master volume.
|
|
static void | setVolume (float vol, sf::Uint8 channel) |
| Sets the volume of the given channel. Volume ranges from 0 - 1 for normal values but are clamped up to a value of 10 which, depending onthe active subsystem, attemps to amplify the volume. More...
|
|
static float | getVolume (sf::Uint8) |
| Returns the current volume of the requested channel.
|
|
static void | setPrefadeVolume (float vol, sf::Uint8 channel) |
| Sets the pre-fade volume. This allows programatically altering the volume at run-time without modifying the overall level of the mixer channel. Unlike main mixer channels these values are not stored in the application configuration between sessions, and are reset to default volume of 1 each time the application is started. More...
|
|
static float | getPrefadeVolume (sf::Uint8 channel) |
| Returns the pre-fade volume of the requested channel.
|
|
static void | setLabel (const std::string &label, sf::Uint8 channel) |
| Sets a label for a channel. For example you might want to set channel 0 to 'Effects' and channel 1 to 'Music' for easy reference. Channel names will appear in the console mixer window. More...
|
|
static const std::string & | getLabel (sf::Uint8 channel) |
| Returns the current label assigned to the requested channel. More...
|
|
|
static constexpr std::size_t | MaxChannels = 16 |
| Maximum number of available channels. Channel IDs start at 0 and run to MaxChannels - 1.
|
|
Multichannel Audio mixer class. The AudioMixer allows AudioEmitter components to group their outputs into one of 16 channels, each of which may have their volume adjusted, affecting all of the AudioEmitters currently routed through that channel. The AudioMixer also has a master volume channel which is applied to all subsequent channels. By default AudioEmitter components are assigned to channel 0. For these AudioMixer settings to be applied a scene must have an active AudioSystem.
These functions are not threadsafe - so appropriate care should be taken when accessing the AudioMixer from multiple threads.
- See also
- AudioEmitter::setChannel()
◆ getLabel()
static const std::string& xy::AudioMixer::getLabel |
( |
sf::Uint8 |
channel | ) |
|
|
static |
Returns the current label assigned to the requested channel.
- Parameters
-
channel | Number of the channel from which to retrieve the label |
◆ setLabel()
static void xy::AudioMixer::setLabel |
( |
const std::string & |
label, |
|
|
sf::Uint8 |
channel |
|
) |
| |
|
static |
Sets a label for a channel. For example you might want to set channel 0 to 'Effects' and channel 1 to 'Music' for easy reference. Channel names will appear in the console mixer window.
- Parameters
-
label | String to use as channel label |
channel | To to which to apply the label |
◆ setPrefadeVolume()
static void xy::AudioMixer::setPrefadeVolume |
( |
float |
vol, |
|
|
sf::Uint8 |
channel |
|
) |
| |
|
static |
Sets the pre-fade volume. This allows programatically altering the volume at run-time without modifying the overall level of the mixer channel. Unlike main mixer channels these values are not stored in the application configuration between sessions, and are reset to default volume of 1 each time the application is started.
- Parameters
-
vol | The pre-fade volume to which to set the channel |
channel | ID of the channel whose volume should be set. Valid values are 0 - 15. |
◆ setVolume()
static void xy::AudioMixer::setVolume |
( |
float |
vol, |
|
|
sf::Uint8 |
channel |
|
) |
| |
|
static |
Sets the volume of the given channel. Volume ranges from 0 - 1 for normal values but are clamped up to a value of 10 which, depending onthe active subsystem, attemps to amplify the volume.
- Parameters
-
vol | The volume to which to set the channel |
channel | ID (0 - 15) of the channel whose volume should be set. |