45 [[nodiscard]]
float volume() const noexcept;
48 [[nodiscard]]
bool loop() const noexcept;
49 void loop(
bool value) noexcept;
63 std::optional<std::reference_wrapper<
SoundInstance>> instance_opt_;
65 std::
string audio_file_path_;
66 std::
string audio_name_;
Component that plays audio using the AudioService.
Definition audio_source.h:29
std::optional< std::reference_wrapper< SoundInstance > > instance() const noexcept
~AudioSource() override=default
bool play_on_awake() const noexcept
float volume() const noexcept
void on_detach() override
Called when the component is detached from a GameObject.
void on_attach() override
Called when the component is attached to a GameObject.
bool loop() const noexcept
AudioSource(std::string audio_file_path, bool play_on_awake=true, bool loop=false, float volume=1.0f)
const std::string & audio_file_path() const noexcept
std::string audio_name() const noexcept
void update(float dt) override
void play(bool loop=false)
std::string type_name() const override
Provides a consistent type name for the component.
Base class for all components that can be attached to GameObjects.
Definition component.h:24
Represents an instance of a generic sound within the audio system. The reason for separating SoundIns...
Definition sound_instance.h:14
Represents a generic sound resource in the audio engine. This class serves as a base for specific sou...
Definition sound_resource.h:12