-
Notifications
You must be signed in to change notification settings - Fork 5
/
Sound.hpp
78 lines (63 loc) · 1.46 KB
/
Sound.hpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Sound.hpp
*
* Created on: 2014-12-14
* Author: Dimitri Kourkoulis
* http://dimitros.be
* License: BSD 3-Clause License (see LICENSE file)
*/
#pragma once
#include "Logger.hpp"
#include <string>
#include <miguel/vorbis/include/vorbis/vorbisfile.h>
#include <memory>
#include <unordered_map>
#include <dimitrikourk/portaudio/include/portaudio.h>
#include "SoundData.hpp"
using namespace std;
namespace small3d {
/**
* @class Sound
*
* @brief Sound management class
*/
class Sound {
private:
unordered_map<string, SoundData*> *sounds;
PaDeviceIndex defaultOutput;
public:
/**
* Constructor
*/
Sound();
/**
* Destructor
*/
~Sound();
/**
* Loads a sound from a file. For the moment, the file can
* only be an .ogg file.
*
* @param soundFilePath The path to the file, relative to the
* directory of execution.
*
* @param soundName The name by which the loaded sound will
* be identified.
*/
void load(const string &soundFilePath, const string &soundName);
/**
* Plays a sound.
*
* @param soundName The name of the sound to be played.
*
*/
void play(const string &soundName);
/**
* Delete a sound from memory.
*
* @param soundName The name of the sound to be deleted.
*
*/
void deleteSound(const string &soundName);
};
}