This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
forked from rpbpolis/spic-prj-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
AudioSource.hpp
91 lines (76 loc) · 2.44 KB
/
AudioSource.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
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef AUDIOSOURCE_H_
#define AUDIOSOURCE_H_
#include "Component.hpp"
#include <string>
#if __has_include("AudioSource_includes.hpp")
#include "AudioSource_includes.hpp"
#endif
namespace spic {
/**
* @brief Component which can play audio.
* @spicapi
*/
class AudioSource : public Component {
public:
/**
* @brief Constructor.
* @param audioClip The source tho the audio clip.
* @param playOnAwake Whether the audio should start playing automatically.
* @param looping Automatically start over when done.
* @param volume The volume level of the AudioSource.
* @sharedapi
*/
AudioSource(const std::string& audioClip, bool playOnAwake, bool looping, double volume);
/**
* @brief Call this method to start playing audio.
* @param looping Automatically start over when done.
* @spicapi
*/
void Play(bool looping);
/**
* @brief Call this method to stop playing audio.
* @spicapi
*/
void Stop();
/**
* @brief Get the volume of the AudioSource
* @return The volume of the AudioSource, which is a double between 0.0 and 1.0 inclusively
* @sharedapi
*/
double Volume() const;
/**
* @brief Set volume of the AudioSource
* @param newVolume The new volume level of the AudioSource
* @sharedapi
*/
void Volume(double newVolume);
#if __has_include("AudioSource_public.hpp")
#include "AudioSource_public.hpp"
#endif
private:
/**
* @brief Path to a locally stored audio file.
* @spicapi
*/
std::string audioClip;
/**
* @brief When true, the component will start playing automatically.
* @spicapi
*/
bool playOnAwake;
/**
* @brief When true, the audio will play indefinitely.
* @spicapi
*/
bool loop;
/**
* @brief Audio volume, between 0.0 and 1.0.
* @spicapi
*/
double volume;
#if __has_include("AudioSource_private.hpp")
#include "AudioSource_private.hpp"
#endif
};
}
#endif // AUDIOSOURCE_H_