2#include <engine/engine_export.h>
4#include <audiopp/source.h>
199 auto is_sound_valid()
const -> bool;
205 auto create_source() -> bool;
207 bool auto_play_ =
false;
210 float volume_ = 1.0f;
212 float volume_rolloff_ = 1.0f;
214 std::shared_ptr<audio::source> source_;
217 bool auto_play_consumed_ =
true;
Class that contains core data for audio sources.
auto get_range() const -> const frange_t &
Gets the range of the audio source.
void set_volume(float volume)
Sets the volume of the audio source.
void set_autoplay(bool on)
Sets whether the audio source should autoplay.
void set_clip(const asset_handle< audio_clip > &clip)
Sets the audio clip for the audio source.
void set_range(const frange_t &range)
Sets the range of the audio source.
void update(const math::transform &t, delta_t dt)
Updates the audio source with the given transform and delta time.
void set_loop(bool on)
Sets whether the audio source should loop.
auto is_playing() const -> bool
Checks if the audio source is currently playing.
auto get_clip() const -> const asset_handle< audio_clip > &
Gets the audio clip of the audio source.
void resume()
Resumes playing the audio source.
void set_mute(bool mute)
Sets whether the audio source is muted.
void on_play_begin()
Called when audio playback begins.
void stop()
Stops playing the audio source.
auto is_muted() const -> bool
Checks if the audio source is muted.
auto get_volume_rolloff() const -> float
Gets the volume rolloff factor of the audio source.
void on_play_end()
Called when audio playback ends.
auto is_paused() const -> bool
Checks if the audio source is currently paused.
auto has_bound_sound() const -> bool
Checks if the audio source has a valid sound bound.
auto get_pitch() const -> float
Gets the pitch of the audio source.
void set_volume_rolloff(float rolloff)
Sets the volume rolloff factor of the audio source.
void set_playback_position(audio::duration_t offset)
Sets the playback position of the audio source.
void set_pitch(float pitch)
Sets the pitch of the audio source.
auto get_autoplay() const -> bool
Gets whether the audio source is set to autoplay.
auto is_looping() const -> bool
Checks if the audio source is set to loop.
auto get_volume() const -> float
Gets the volume of the audio source.
auto get_playback_position() const -> audio::duration_t
Gets the playback position of the audio source.
void pause()
Pauses 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.
std::chrono::duration< float > delta_t
Represents a handle to an asset, providing access and management functions.
CRTP (Curiously Recurring Template Pattern) base structure for components.