3#include "utilities/Stream.hpp"
4#include "main/Component.hpp"
7#define EMITTER_TYPE "Emitter"
9namespace StevEngine::Audio {
31 std::string audioPath;
55 std::string
GetType()
const {
return EMITTER_TYPE; }
84 Mix_Chunk*
GetData()
const {
return audioData; };
Component for playing sound effects from game objects.
Definition Emitter.hpp:17
Mix_Chunk * GetData() const
Get the raw audio data.
Definition Emitter.hpp:84
Emitter(std::string audioPath, bool loop=false, double volume=1)
Create a new audio emitter.
Definition Emitter.cpp:11
void ChangeSource(std::string path)
Change the audio source file.
Definition Emitter.cpp:26
double volume
Volume level from 0.0 to 1.0.
Definition Emitter.hpp:24
bool loop
Whether the sound should loop when playing.
Definition Emitter.hpp:21
void Play()
Play the sound.
Definition Emitter.cpp:22
int channel
Current audio channel ID, or -1 if not playing.
Definition Emitter.hpp:27
std::string GetType() const
Get component type.
Definition Emitter.hpp:55
Utilities::Stream Export(Utilities::StreamType type) const
Serialize component to a stream.
Definition Emitter.cpp:52
bool isPlaying() const
Check if sound is currently playing.
Definition Emitter.hpp:90
Component()
Create new component.
Definition Component.cpp:10
static bool RegisterComponentType(std::string type)
Register a component type for creation.
Definition Component.hpp:133
Core game object class.
Definition GameObject.hpp:35
Stream for serialization of data.
Definition Stream.hpp:20