Unravel Engine C++ Reference
|
Class that contains core data for audio sources. More...
#include <audio_source_component.h>
Public Member Functions | |
void | update (const math::transform &t, delta_t dt) |
Updates the audio source with the given transform and delta time. | |
void | on_play_begin () |
Called when audio playback begins. | |
void | on_play_end () |
Called when audio playback ends. | |
void | set_loop (bool on) |
Sets whether the audio source should loop. | |
void | set_volume (float volume) |
Sets the volume of the audio source. | |
void | set_pitch (float pitch) |
Sets the pitch of the audio source. | |
void | set_volume_rolloff (float rolloff) |
Sets the volume rolloff factor of the audio source. | |
void | set_range (const frange_t &range) |
Sets the range of the audio source. | |
void | set_autoplay (bool on) |
Sets whether the audio source should autoplay. | |
auto | get_autoplay () const -> bool |
Gets whether the audio source is set to autoplay. | |
auto | get_volume () const -> float |
Gets the volume of the audio source. | |
auto | get_pitch () const -> float |
Gets the pitch of the audio source. | |
auto | get_volume_rolloff () const -> float |
Gets the volume rolloff factor of the audio source. | |
auto | get_range () const -> const frange_t & |
Gets the range of the audio source. | |
void | set_playback_position (audio::duration_t offset) |
Sets the playback position of the audio source. | |
auto | get_playback_position () const -> audio::duration_t |
Gets the playback position of the audio source. | |
auto | get_playback_duration () const -> audio::duration_t |
Gets the total playback duration of the audio source. | |
auto | play () -> bool |
Starts playing the audio source. | |
void | stop () |
Stops playing the audio source. | |
void | pause () |
Pauses the audio source. | |
void | resume () |
Resumes playing the audio source. | |
void | set_mute (bool mute) |
Sets whether the audio source is muted. | |
auto | is_muted () const -> bool |
Checks if the audio source is muted. | |
auto | is_playing () const -> bool |
Checks if the audio source is currently playing. | |
auto | is_paused () const -> bool |
Checks if the audio source is currently paused. | |
auto | is_looping () const -> bool |
Checks if the audio source is set to loop. | |
void | set_clip (const asset_handle< audio_clip > &clip) |
Sets the audio clip for the audio source. | |
auto | get_clip () const -> const asset_handle< audio_clip > & |
Gets the audio clip of the audio source. | |
auto | has_bound_sound () const -> bool |
Checks if the audio source has a valid sound bound. | |
![]() | |
void | touch () |
Marks the component as 'touched'. | |
Additional Inherited Members | |
![]() | |
using | base |
![]() | |
bool | eto {} |
Disable empty type optimizations. | |
![]() | |
static constexpr bool | in_place_delete |
Indicates if the component can be deleted in place. | |
Class that contains core data for audio sources.
Definition at line 16 of file audio_source_component.h.
auto unravel::audio_source_component::get_autoplay | ( | ) | const -> bool |
Gets whether the audio source is set to autoplay.
Definition at line 114 of file audio_source_component.cpp.
auto unravel::audio_source_component::get_clip | ( | ) | const -> const asset_handle<audio_clip>& |
Gets the audio clip of the audio source.
Definition at line 275 of file audio_source_component.cpp.
auto unravel::audio_source_component::get_pitch | ( | ) | const -> float |
Gets the pitch of the audio source.
Definition at line 124 of file audio_source_component.cpp.
auto unravel::audio_source_component::get_playback_duration | ( | ) | const -> audio::duration_t |
Gets the total playback duration of the audio source.
Definition at line 157 of file audio_source_component.cpp.
auto unravel::audio_source_component::get_playback_position | ( | ) | const -> audio::duration_t |
Gets the playback position of the audio source.
Definition at line 148 of file audio_source_component.cpp.
auto unravel::audio_source_component::get_range | ( | ) | const -> const frange_t& |
Gets the range of the audio source.
Definition at line 134 of file audio_source_component.cpp.
auto unravel::audio_source_component::get_volume | ( | ) | const -> float |
Gets the volume of the audio source.
Definition at line 119 of file audio_source_component.cpp.
auto unravel::audio_source_component::get_volume_rolloff | ( | ) | const -> float |
Gets the volume rolloff factor of the audio source.
Definition at line 129 of file audio_source_component.cpp.
auto unravel::audio_source_component::has_bound_sound | ( | ) | const -> bool |
Checks if the audio source has a valid sound bound.
Definition at line 280 of file audio_source_component.cpp.
auto unravel::audio_source_component::is_looping | ( | ) | const -> bool |
Checks if the audio source is set to loop.
Definition at line 261 of file audio_source_component.cpp.
auto unravel::audio_source_component::is_muted | ( | ) | const -> bool |
Checks if the audio source is muted.
Definition at line 234 of file audio_source_component.cpp.
auto unravel::audio_source_component::is_paused | ( | ) | const -> bool |
Checks if the audio source is currently paused.
Definition at line 252 of file audio_source_component.cpp.
auto unravel::audio_source_component::is_playing | ( | ) | const -> bool |
Checks if the audio source is currently playing.
Definition at line 243 of file audio_source_component.cpp.
void unravel::audio_source_component::on_play_begin | ( | ) |
Called when audio playback begins.
Definition at line 8 of file audio_source_component.cpp.
void unravel::audio_source_component::on_play_end | ( | ) |
Called when audio playback ends.
Definition at line 13 of file audio_source_component.cpp.
void unravel::audio_source_component::pause | ( | ) |
Pauses the audio source.
Definition at line 197 of file audio_source_component.cpp.
auto unravel::audio_source_component::play | ( | ) | -> bool |
Starts playing the audio source.
Definition at line 167 of file audio_source_component.cpp.
void unravel::audio_source_component::resume | ( | ) |
Resumes playing the audio source.
Definition at line 206 of file audio_source_component.cpp.
void unravel::audio_source_component::set_autoplay | ( | bool | on | ) |
Sets whether the audio source should autoplay.
on | True to autoplay, false otherwise. |
Definition at line 109 of file audio_source_component.cpp.
void unravel::audio_source_component::set_clip | ( | const asset_handle< audio_clip > & | clip | ) |
Sets the audio clip for the audio source.
sound | The audio clip to set. |
Definition at line 266 of file audio_source_component.cpp.
void unravel::audio_source_component::set_loop | ( | bool | on | ) |
Sets whether the audio source should loop.
on | True to loop, false otherwise. |
Definition at line 51 of file audio_source_component.cpp.
void unravel::audio_source_component::set_mute | ( | bool | mute | ) |
Sets whether the audio source is muted.
mute | True to mute, false otherwise. |
Definition at line 215 of file audio_source_component.cpp.
void unravel::audio_source_component::set_pitch | ( | float | pitch | ) |
Sets the pitch of the audio source.
pitch | The pitch level. Valid range: [0.0, 5.0]. |
Definition at line 73 of file audio_source_component.cpp.
void unravel::audio_source_component::set_playback_position | ( | audio::duration_t | offset | ) |
Sets the playback position of the audio source.
offset | The playback position offset. |
Definition at line 139 of file audio_source_component.cpp.
void unravel::audio_source_component::set_range | ( | const frange_t & | range | ) |
Sets the range of the audio source.
range | The range of the audio source. min should be <= max and both >= 0.0. |
Definition at line 95 of file audio_source_component.cpp.
void unravel::audio_source_component::set_volume | ( | float | volume | ) |
Sets the volume of the audio source.
volume | The volume level. Valid range: [0.0, 1.0]. |
Definition at line 62 of file audio_source_component.cpp.
void unravel::audio_source_component::set_volume_rolloff | ( | float | rolloff | ) |
Sets the volume rolloff factor of the audio source.
rolloff | The volume rolloff factor. Valid range: [0.0, 10.0]. |
Definition at line 84 of file audio_source_component.cpp.
void unravel::audio_source_component::stop | ( | ) |
Stops playing the audio source.
Definition at line 187 of file audio_source_component.cpp.
void unravel::audio_source_component::update | ( | const math::transform & | t, |
delta_t | dt ) |
Updates the audio source with the given transform and delta time.
t | The transform to update with. |
dt | The delta time. |
Definition at line 23 of file audio_source_component.cpp.