aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/AudioSource.cpp
blob: 63fd0d724e26ed273433ec234f3b749de36c2ba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <memory>

#include "../facade/Sound.h"

#include "AudioSource.h"

using namespace crepe;

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();
}