diff options
Diffstat (limited to 'src/crepe/api/AudioSource.cpp')
-rw-r--r-- | src/crepe/api/AudioSource.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp index b512d27..7b05cb1 100644 --- a/src/crepe/api/AudioSource.cpp +++ b/src/crepe/api/AudioSource.cpp @@ -1,22 +1,15 @@ #include "AudioSource.h" -#include "../Sound.h" -#include <memory> +using namespace crepe; +using namespace std; -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); } +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; } |