#include <th_sound.h>
|
| | sound_player () |
| |
| | sound_player (const sound_player &)=delete |
| |
| sound_player & | operator= (const sound_player &)=delete |
| |
| | ~sound_player () |
| |
| void | populate_from (sound_archive *pArchive) |
| |
| uint32_t | play (size_t iIndex, double dVolume, int loops) |
| |
| uint32_t | play_at (size_t iIndex, int iX, int iY, int loops) |
| |
| uint32_t | play_at (size_t iIndex, double dVolume, int iX, int iY, int loops) |
| |
| toggle_pause_result | toggle_pause (uint32_t handle) |
| |
| void | stop (uint32_t handle) |
| |
| bool | is_playing (uint32_t handle) |
| | Returns whether the sound matching the given handle is playing.
|
| |
| void | set_sound_effect_volume (double dVolume) |
| | Sets the default volume for sound effects.
|
| |
| void | set_sound_effects_enabled (bool bOn) |
| |
| void | set_camera (int iX, int iY, int iRadius) |
| | Sets the position of the camera for play_at calculations.
|
| |
| int | reserve_channel () |
| |
| void | release_channel (int iChannel) |
| | Releases a previously reserved SDL_mixer channel.
|
| |
◆ toggle_pause_result
| Enumerator |
|---|
| error | |
| paused | |
| resumed | |
◆ sound_player() [1/2]
| sound_player::sound_player |
( |
| ) |
|
◆ sound_player() [2/2]
◆ ~sound_player()
| sound_player::~sound_player |
( |
| ) |
|
◆ get_singleton()
◆ is_playing()
| bool sound_player::is_playing |
( |
uint32_t |
handle | ) |
|
Returns whether the sound matching the given handle is playing.
◆ operator=()
◆ play()
| uint32_t sound_player::play |
( |
size_t |
iIndex, |
|
|
double |
dVolume, |
|
|
int |
loops |
|
) |
| |
Plays the sound effect in the sound_archive with the given index.
- Parameters
-
| iIndex | Index of the sound effect to play. |
| dVolume | Volume to play the sound effect at, in the range 0.0 to 1.0. |
| loops | The number of times to play the sound, -1 for 'practically' infinite. |
- Returns
- The sound handle
- See also
- Mix_PlayChannel
◆ play_at() [1/2]
| uint32_t sound_player::play_at |
( |
size_t |
iIndex, |
|
|
double |
dVolume, |
|
|
int |
iX, |
|
|
int |
iY, |
|
|
int |
loops |
|
) |
| |
Plays the sound effect in the sound_archive with the given index with volume attenuation based on the distance from the given position to the camera.
- Parameters
-
| iIndex | Index of the sound effect to play. |
| dVolume | Volume to play the sound effect at before attenuation, in the range 0.0 to 1.0. |
| iX | X coordinate of the sound effect. |
| iY | Y coordinate of the sound effect. |
| loops | The number of times to play the sound, -1 for 'practically' infinite. |
- Returns
- The sound handle or 0 on error
◆ play_at() [2/2]
| uint32_t sound_player::play_at |
( |
size_t |
iIndex, |
|
|
int |
iX, |
|
|
int |
iY, |
|
|
int |
loops |
|
) |
| |
Plays the sound effect in the sound_archive with the given index with volume attenuation based on the distance from the given position to the camera.
- Parameters
-
| iIndex | Index of the sound effect to play. |
| iX | X coordinate of the sound effect. |
| iY | Y coordinate of the sound effect. |
| loops | The number of times to play the sound, -1 for 'practically' infinite. |
- Returns
- The sound handle or 0 on error
◆ populate_from()
◆ release_channel()
| void sound_player::release_channel |
( |
int |
iChannel | ) |
|
Releases a previously reserved SDL_mixer channel.
◆ reserve_channel()
| int sound_player::reserve_channel |
( |
| ) |
|
Reserves an SDL_mixer channel for exclusive use.
Not necessary to use in conjunction with play() or play_at(), as these methods will automatically reserve and release channels.
- Returns
- The reserved channel index, or -1 if no channels are available.
◆ set_camera()
Sets the position of the camera for play_at calculations.
◆ set_sound_effect_volume()
| void sound_player::set_sound_effect_volume |
( |
double |
dVolume | ) |
|
Sets the default volume for sound effects.
◆ set_sound_effects_enabled()
| void sound_player::set_sound_effects_enabled |
( |
bool |
bOn | ) |
|
Enables or disables sound effects. Note: Only affects sounds played via play_at(int, int, int).
◆ stop()
| void sound_player::stop |
( |
uint32_t |
handle | ) |
|
Stops playback on a given channel.
- Parameters
-
◆ toggle_pause()
Pause playback on a given channel if playing, or resume if paused.
- Parameters
-
| handle | The sound to toggle pause on. |
- Returns
- The result of the toggle: paused, resumed, or error.
◆ null_handle
| constexpr uint32_t sound_player::null_handle = 0u |
|
staticconstexpr |
◆ number_of_channels
The documentation for this class was generated from the following files:
- /home/runner/work/CorsixTH/CorsixTH/CorsixTH/Src/th_sound.h
- /home/runner/work/CorsixTH/CorsixTH/CorsixTH/Src/th_sound.cpp