aboutsummaryrefslogtreecommitdiff
path: root/src/dummy_audio.cpp
blob: 1249076305544a20dde9bc8b6e0063c3a6bb621c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "crepe/util/log.h"
#include "crepe/Sound.h"

#include <chrono>
#include <thread>

using namespace crepe;
using namespace std;
using namespace std::chrono_literals;
using std::make_unique;

int main() {
	dbg_trace();

	auto bgm = Sound("../mwe/audio/bgm.ogg");
	auto sfx1 = Sound("../mwe/audio/sfx1.wav");
	auto sfx2 = Sound("../mwe/audio/sfx2.wav");
	auto sfx3 = Sound("../mwe/audio/sfx3.wav");

	bgm.play();

	// play each sample sequentially
	this_thread::sleep_for(500ms);
	sfx1.play();
	this_thread::sleep_for(500ms);
	sfx2.play();
	bgm.pause();
	this_thread::sleep_for(500ms);
	sfx3.play();
	bgm.play();
	this_thread::sleep_for(500ms);

	// play all samples simultaniously
	sfx1.play();
	sfx2.play();
	sfx3.play();
	this_thread::sleep_for(1000ms);

	return 0;
}