Component for playing sound effects from game objects.
More...
#include <audio/Emitter.hpp>
|
| | Emitter (std::string audioPath, bool loop=false, double volume=1) |
| | Create a new audio emitter.
|
| |
| | Emitter (Utilities::Stream &stream) |
| | Create emitter from text serialized data.
|
| |
| std::string | GetType () const |
| | Get component type.
|
| |
| Utilities::Stream | Export (Utilities::StreamType type) const |
| | Serialize component to a stream.
|
| |
| void | Play () |
| | Play the sound.
|
| |
| void | ChangeSource (std::string path) |
| | Change the audio source file.
|
| |
| Mix_Chunk * | GetData () const |
| | Get the raw audio data.
|
| |
| bool | isPlaying () const |
| | Check if sound is currently playing.
|
| |
|
| Component () |
| | Create new component.
|
| |
|
virtual | ~Component () |
| | Clean up component resources.
|
| |
| GameObject & | GetParent () const |
| | Get parent GameObject.
|
| |
| Scene & | GetScene () const |
| | Get containing Scene.
|
| |
| virtual void | Start () |
| | Initialize component after creation.
|
| |
| virtual void | Update (double deltaTime) |
| | Update component logic.
|
| |
| virtual void | Draw (const Utilities::Matrix4 &transform) |
| | Draw component visuals.
|
| |
|
|
bool | loop |
| | Whether the sound should loop when playing.
|
| |
|
double | volume |
| | Volume level from 0.0 to 1.0.
|
| |
|
int | channel |
| | Current audio channel ID, or -1 if not playing.
|
| |
|
|
class | StevEngine::GameObject |
| |
|
|
std::vector< std::pair< Utilities::ID, std::string > > | handlers |
| | Event handler registrations.
|
| |
Component for playing sound effects from game objects.
The Emitter component allows game objects to play audio files. It supports one-shot and looping sounds with configurable volume levels.
◆ Emitter() [1/2]
| StevEngine::Audio::Emitter::Emitter |
( |
std::string | audioPath, |
|
|
bool | loop = false, |
|
|
double | volume = 1 ) |
Create a new audio emitter.
- Parameters
-
| audioPath | Path to the audio file to play |
| loop | Whether the sound should loop |
| volume | Initial volume level from 0.0 to 1.0 |
◆ Emitter() [2/2]
Create emitter from text serialized data.
- Parameters
-
| stream | Stream containing serialized component data |
◆ ChangeSource()
| void StevEngine::Audio::Emitter::ChangeSource |
( |
std::string | path | ) |
|
Change the audio source file.
- Parameters
-
| path | Path to new audio file |
Loads a new audio file, freeing the previous one if loaded.
◆ Export()
| Utilities::Stream StevEngine::Audio::Emitter::Export |
( |
Utilities::StreamType | type | ) |
const |
|
virtual |
Serialize component to a stream.
- Parameters
-
| type | Type of stream to export to |
- Returns
- Serialized stream
Reimplemented from StevEngine::Component.
◆ GetData()
| Mix_Chunk * StevEngine::Audio::Emitter::GetData |
( |
| ) |
const |
|
inline |
Get the raw audio data.
- Returns
- Pointer to loaded audio chunk
◆ GetType()
| std::string StevEngine::Audio::Emitter::GetType |
( |
| ) |
const |
|
inlinevirtual |
◆ isPlaying()
| bool StevEngine::Audio::Emitter::isPlaying |
( |
| ) |
const |
|
inline |
Check if sound is currently playing.
- Returns
- true if sound is playing, false otherwise
◆ Play()
| void StevEngine::Audio::Emitter::Play |
( |
| ) |
|
Play the sound.
Starts playing the loaded audio file. If the sound is already playing, it will be stopped and restarted.
The documentation for this class was generated from the following files: