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

#include "../Sound.h"
#include <memory>

using namespace crepe::api;

AudioSource::AudioSource(std::unique_ptr<Resource> 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();
}