Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
audio_emitter.hpp
1
8
9
#pragma once
10
#include "
../assets.hpp
"
11
12
#include <
toast/export.hpp
>
13
#include <
toast/world/node.hpp
>
14
15
namespace
toast {
16
17
class
TOAST_API [[ToastNode, Color(
"Beige"
), Icon(
"AudioStreamPlayer"
)]]
AudioEmitter
:
public
Node {
18
public
:
19
[[Button]]
20
void
play
();
21
22
[[Button]]
23
void
stop
();
24
25
void
pause
(
bool
value);
26
void
setParameter
(std::string_view
name
,
float
value);
27
void
setParameter
(std::string_view,
bool
value);
28
auto
isPlaying
() -> bool;
29
30
void
event
(std::string_view path);
31
void
event
(
toast::UID
uid
);
32
void
playOnEnable
(
bool
value);
33
void
volume
(
float
value);
34
void
pitch
(
float
value);
35
void
allowFadeout
(
bool
value);
37
signals::Signal<std::string_view> audio_started;
38
signals::Signal<std::string_view> audio_stopped;
39
signals::Signal<bool> audio_paused;
40
41
private
:
42
void
updateInspectorMessages()
override
;
43
void
onEnable();
44
void
onDisable();
45
46
[[
Reflect
, Name(
"Audio Event"
)]]
47
assets::Handle<assets::AudioEvent>
m_event;
48
49
[[
Reflect
]]
50
bool
m_play_on_enable =
false
;
51
52
[[
Reflect
, Range(0.0, 1.0)]]
53
float
m_volume = 1.0f;
54
55
[[
Reflect
, Range(0.5, 2.0)]]
56
float
m_pitch = 1.0f;
57
58
[[
Reflect
]]
59
bool
m_allow_fadeout =
true
;
60
};
61
62
}
assets.hpp
assets::Handle
Type-safe smart pointer for assets.
Definition
core_types.hpp:149
toast::AudioEmitter
Definition
audio_emitter.hpp:17
toast::AudioEmitter::isPlaying
auto isPlaying() -> bool
Definition
audio_emitter.cpp:69
toast::AudioEmitter::setParameter
void setParameter(std::string_view name, float value)
Changes a parameter by name.
Definition
audio_emitter.cpp:55
toast::AudioEmitter::pitch
void pitch(float value)
Definition
audio_emitter.cpp:95
toast::AudioEmitter::pause
void pause(bool value)
Pauses and resumes in a location.
Definition
audio_emitter.cpp:47
toast::AudioEmitter::stop
void stop()
Stops the event using the allowFadeout().
Definition
audio_emitter.cpp:39
toast::AudioEmitter::playOnEnable
void playOnEnable(bool value)
If true, will play every time the node is enabled.
Definition
audio_emitter.cpp:84
toast::AudioEmitter::event
void event(std::string_view path)
Sets the event by URI.
Definition
audio_emitter.cpp:76
toast::AudioEmitter::allowFadeout
void allowFadeout(bool value)
Definition
audio_emitter.cpp:102
toast::AudioEmitter::volume
void volume(float value)
Definition
audio_emitter.cpp:88
toast::AudioEmitter::play
void play()
Fires the event.
Definition
audio_emitter.cpp:24
toast::Node::name
auto name() const noexcept -> std::string_view
Display name. Siblings may share one - this is not an identifier.
Definition
node.cpp:45
toast::Node::uid
auto uid() const noexcept -> const UID &
Stable unique identifier, assigned at construction or deserialization. Never changes.
Definition
node.cpp:37
toast::Reflect
Definition
reflect.hpp:244
export.hpp
node.hpp
Base object type for the scene graph.
toast::UID
Definition
uid.hpp:20
engine
src
toast
audio
nodes
audio_emitter.hpp
Generated by
1.17.0