diff options
author | max-001 <maxsmits21@knpmail.nl> | 2024-10-09 10:54:50 +0200 |
---|---|---|
committer | max-001 <maxsmits21@knpmail.nl> | 2024-10-09 10:54:50 +0200 |
commit | f5b4e2c84326bd96c78ad1f6e4481c1970e54444 (patch) | |
tree | aa75ef01ace01d86ffda93632e0b40dc11e0dcbc /src/crepe/api/AudioSource.cpp | |
parent | 765550bce8a81c6f0c79c0083b14ef68e0c900b2 (diff) | |
parent | 6b7a670d60fec808e4fd1fcf3a8df2c503dcbdf4 (diff) |
Merge remote-tracking branch 'origin/master' into max/POC-ECS-homemade
Diffstat (limited to 'src/crepe/api/AudioSource.cpp')
-rw-r--r-- | src/crepe/api/AudioSource.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp new file mode 100644 index 0000000..b512d27 --- /dev/null +++ b/src/crepe/api/AudioSource.cpp @@ -0,0 +1,22 @@ +#include "AudioSource.h" + +#include "../Sound.h" +#include <memory> + +using namespace crepe::api; + +AudioSource::AudioSource(std::unique_ptr<Asset> audio_clip) { + this->sound = std::make_unique<crepe::Sound>(std::move(audio_clip)); +} + +void AudioSource::play() { return this->play(false); } + +void AudioSource::play(bool looping) { + this->sound->set_looping(looping); + this->sound->play(); +} + +void AudioSource::stop() { + this->sound->pause(); + this->sound->rewind(); +} |