CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
AudioSource.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
11
13
15
20
21namespace CeresEngine {
22
32 struct CE_SCRIPT_EXPORT() AudioSourceComponent final : public Component<AudioSourceComponent> {
33 struct Accessor;
34
36
39
42 double volume = 1.0;
43
46 double minimumVolume = 0.0;
47
50 double maximumVolume = 1.0;
51
54 double pitch = 1.0;
55 };
56
58 using Component<AudioSourceComponent>::Accessor::Accessor;
59
61 [[nodiscard]] CE_SCRIPT_EXPORT()
62 double getVolume() const;
63
66 void setVolume(double volume);
67
69 [[nodiscard]] CE_SCRIPT_EXPORT()
70 double getMinimumVolume() const;
71
74 void setMinimumVolume(double minimumVolume);
75
77 [[nodiscard]] CE_SCRIPT_EXPORT()
78 double getMaximumVolume() const;
79
82 void setMaximumVolume(double maximumVolume);
83
85 [[nodiscard]] CE_SCRIPT_EXPORT()
86 double getPitch() const;
87
90 void setPitch(double pitch);
91
92 public:
94 void play(AudioAPIBufferPtr buffer);
95 };
96
107
110 struct Play final : public EntityAction<Play> {
113
116 explicit Play(AudioAPIBufferPtr buffer) : buffer(std::move(buffer)) {}
117 };
118
119} // namespace CeresEngine
120
#define CE_EXTERN_COMPONENT(T)
Definition Component.hpp:600
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
A type-safe entity type.
Definition Entity.hpp:538
Definition Application.hpp:19
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
Definition Span.hpp:668
Definition AudioSource.hpp:57
A component that represents a source for emitting audio.
Definition AudioSource.hpp:32
AudioAPISourcePtr source
Definition AudioSource.hpp:35
Vector< AudioAPIBufferPtr > buffers
A vector of audio buffers being played by the source.
Definition AudioSource.hpp:38
Components serve as the base for data storage for an entity.
Definition Component.hpp:68
A class that must be inherited by concrete action types.
Definition Action.hpp:33
An entity action that can be dispatched to a AudioSource to start playing a new audio buffer.
Definition AudioSource.hpp:110
Play(AudioAPIBufferPtr buffer)
Creates a new Play action.
Definition AudioSource.hpp:116
AudioAPIBufferPtr buffer
The buffer to be played by the audio source.
Definition AudioSource.hpp:112
Definition SceneObject.hpp:23