diff options
Diffstat (limited to 'src/crepe/api/AudioSource.cpp')
-rw-r--r-- | src/crepe/api/AudioSource.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp index 63fd0d7..7b05cb1 100644 --- a/src/crepe/api/AudioSource.cpp +++ b/src/crepe/api/AudioSource.cpp @@ -1,23 +1,15 @@ -#include <memory> - -#include "../facade/Sound.h" - #include "AudioSource.h" using namespace crepe; +using namespace std; -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); } +AudioSource::AudioSource(game_object_id_t id, const Asset & src) + : Component(id), + source(src) {} void AudioSource::play(bool looping) { - this->sound->set_looping(looping); - this->sound->play(); + this->loop = looping; + this->oneshot_play = true; } -void AudioSource::stop() { - this->sound->pause(); - this->sound->rewind(); -} +void AudioSource::stop() { this->oneshot_stop = true; } |