This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudioManager_8hpp_source.html
137 lines (135 loc) · 17.2 KB
/
AudioManager_8hpp_source.html
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SPICPRJ Engine: src/Managers/AudioManager.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">SPICPRJ Engine
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_d71c2fe00ed3b147a8f961a1bf80b6a4.html">Managers</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">AudioManager.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="AudioManager_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef SPIC_ENGINE_AUDIOMANAGER_HPP</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define SPIC_ENGINE_AUDIOMANAGER_HPP</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>  </div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include <string></span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include <map></span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include <memory></span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include "../Models/AudioClip.hpp"</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>  </div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="keyword">namespace </span><a class="code" href="namespaceengine.html">engine</a></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> {</div>
<div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="classengine_1_1AudioManager.html"> 14</a></span>  <span class="keyword">class </span><a class="code" href="classengine_1_1AudioManager.html">AudioManager</a></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  {</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  <span class="keyword">private</span>:</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="keyword">static</span> <a class="code" href="classengine_1_1AudioManager.html">AudioManager</a> _instance;</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  std::map<std::string, std::shared_ptr<AudioClip>> _audioClips = {};</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  std::map<std::string, int> _channels = {};</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keyword">public</span>:</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classengine_1_1AudioManager.html#a184b4d586ab1eac523ea6a9ff9719f89">ChannelCallback</a>(<span class="keywordtype">int</span> channelNumber);</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  </div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordtype">void</span> <a class="code" href="classengine_1_1AudioManager.html#addf8048a76b00328274e9d5a72af0add">LoadAudioClip</a>(<span class="keyword">const</span> std::string& path);</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  </div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordtype">bool</span> <a class="code" href="classengine_1_1AudioManager.html#aa85dbebd512153572560ca70d0b11e6a">Contains</a>(<span class="keyword">const</span> std::string& path) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  </div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordtype">void</span> <a class="code" href="classengine_1_1AudioManager.html#ada8f604d9a7ec07cd761467de54afbe6">Play</a>(<span class="keyword">const</span> std::string& gameObjectName, <span class="keyword">const</span> std::string& path, <span class="keywordtype">bool</span> loop = <span class="keyword">false</span>, <span class="keywordtype">double</span> volume = 0.5);</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  </div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordtype">void</span> <a class="code" href="classengine_1_1AudioManager.html#a8a7059eab9311963f2270d01396eca9c">Stop</a>(<span class="keyword">const</span> std::string& gameObjectName, <span class="keyword">const</span> std::string& path);</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  </div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keywordtype">void</span> <a class="code" href="classengine_1_1AudioManager.html#ae67e5633d99ca0fb7ed7018805da1b20">Pause</a>(<span class="keyword">const</span> std::string& gameObjectName, <span class="keyword">const</span> std::string& path);</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  </div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keyword">static</span> <a class="code" href="classengine_1_1AudioManager.html">AudioManager</a>& <a class="code" href="classengine_1_1AudioManager.html#ac3ac4333dbf24a65cba51fd584b3a45d">GetInstance</a>();</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  </div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classengine_1_1AudioManager.html#a3f4c6c55939026220f7ecca9988ee363"> 72</a></span>  <a class="code" href="classengine_1_1AudioManager.html#a3f4c6c55939026220f7ecca9988ee363">AudioManager</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classengine_1_1AudioManager.html#a64eaf93ac582e1ebb89c1c26b6d65dcf"> 77</a></span>  <a class="code" href="classengine_1_1AudioManager.html">AudioManager</a>& <a class="code" href="classengine_1_1AudioManager.html#a64eaf93ac582e1ebb89c1c26b6d65dcf">operator=</a>(<span class="keyword">const</span> <a class="code" href="classengine_1_1AudioManager.html">AudioManager</a>& manager) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  </div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="classengine_1_1AudioManager.html#ac43862e7a8bb57e2c823665772c12445"> 82</a></span>  <a class="code" href="classengine_1_1AudioManager.html">AudioManager</a>& <a class="code" href="classengine_1_1AudioManager.html#ac43862e7a8bb57e2c823665772c12445">operator=</a>(<a class="code" href="classengine_1_1AudioManager.html">AudioManager</a>&& manager) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classengine_1_1AudioManager.html#a8bdc41450ca3132df1b84822020c29b0"> 87</a></span>  <a class="code" href="classengine_1_1AudioManager.html#a8bdc41450ca3132df1b84822020c29b0">AudioManager</a>(<span class="keyword">const</span> <a class="code" href="classengine_1_1AudioManager.html">AudioManager</a>& manager) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  </div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="classengine_1_1AudioManager.html#a0ed69a62fdf03209e8a0d905b52d5c81"> 92</a></span>  <a class="code" href="classengine_1_1AudioManager.html#a0ed69a62fdf03209e8a0d905b52d5c81">AudioManager</a>(<a class="code" href="classengine_1_1AudioManager.html">AudioManager</a>&& manager) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  };</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span> }</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  </div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  </div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="preprocessor">#endif </span><span class="comment">//SPIC_ENGINE_AUDIOMANAGER_HPP</span></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html"><div class="ttname"><a href="classengine_1_1AudioManager.html">engine::AudioManager</a></div><div class="ttdoc">Caches multiple audio clips to prevent the Engine from accessing files multiple times.</div><div class="ttdef"><b>Definition:</b> AudioManager.hpp:15</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_a0ed69a62fdf03209e8a0d905b52d5c81"><div class="ttname"><a href="classengine_1_1AudioManager.html#a0ed69a62fdf03209e8a0d905b52d5c81">engine::AudioManager::AudioManager</a></div><div class="ttdeci">AudioManager(AudioManager &&manager)=delete</div><div class="ttdoc">Deleted move constructor.</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_a184b4d586ab1eac523ea6a9ff9719f89"><div class="ttname"><a href="classengine_1_1AudioManager.html#a184b4d586ab1eac523ea6a9ff9719f89">engine::AudioManager::ChannelCallback</a></div><div class="ttdeci">static void ChannelCallback(int channelNumber)</div><div class="ttdoc">Triggers when a Channel has been finished and needs to be cleared.</div><div class="ttdef"><b>Definition:</b> AudioManager.cpp:103</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_a3f4c6c55939026220f7ecca9988ee363"><div class="ttname"><a href="classengine_1_1AudioManager.html#a3f4c6c55939026220f7ecca9988ee363">engine::AudioManager::AudioManager</a></div><div class="ttdeci">AudioManager()=default</div><div class="ttdoc">Constructs a new AudioManager.</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_a64eaf93ac582e1ebb89c1c26b6d65dcf"><div class="ttname"><a href="classengine_1_1AudioManager.html#a64eaf93ac582e1ebb89c1c26b6d65dcf">engine::AudioManager::operator=</a></div><div class="ttdeci">AudioManager & operator=(const AudioManager &manager)=delete</div><div class="ttdoc">Deleted copy assignment operator.</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_a8a7059eab9311963f2270d01396eca9c"><div class="ttname"><a href="classengine_1_1AudioManager.html#a8a7059eab9311963f2270d01396eca9c">engine::AudioManager::Stop</a></div><div class="ttdeci">void Stop(const std::string &gameObjectName, const std::string &path)</div><div class="ttdoc">Stops a AudioClip from playing at a given GameObject.</div><div class="ttdef"><b>Definition:</b> AudioManager.cpp:73</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_a8bdc41450ca3132df1b84822020c29b0"><div class="ttname"><a href="classengine_1_1AudioManager.html#a8bdc41450ca3132df1b84822020c29b0">engine::AudioManager::AudioManager</a></div><div class="ttdeci">AudioManager(const AudioManager &manager)=delete</div><div class="ttdoc">Deleted copy constructor.</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_aa85dbebd512153572560ca70d0b11e6a"><div class="ttname"><a href="classengine_1_1AudioManager.html#aa85dbebd512153572560ca70d0b11e6a">engine::AudioManager::Contains</a></div><div class="ttdeci">bool Contains(const std::string &path) const</div><div class="ttdoc">Checks whether a AudioClip has been chached for a given file.</div><div class="ttdef"><b>Definition:</b> AudioManager.cpp:98</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_ac3ac4333dbf24a65cba51fd584b3a45d"><div class="ttname"><a href="classengine_1_1AudioManager.html#ac3ac4333dbf24a65cba51fd584b3a45d">engine::AudioManager::GetInstance</a></div><div class="ttdeci">static AudioManager & GetInstance()</div><div class="ttdoc">Get the instance of the AudioManager.</div><div class="ttdef"><b>Definition:</b> AudioManager.cpp:93</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_ac43862e7a8bb57e2c823665772c12445"><div class="ttname"><a href="classengine_1_1AudioManager.html#ac43862e7a8bb57e2c823665772c12445">engine::AudioManager::operator=</a></div><div class="ttdeci">AudioManager & operator=(AudioManager &&manager)=delete</div><div class="ttdoc">Deleted move assignment operator.</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_ada8f604d9a7ec07cd761467de54afbe6"><div class="ttname"><a href="classengine_1_1AudioManager.html#ada8f604d9a7ec07cd761467de54afbe6">engine::AudioManager::Play</a></div><div class="ttdeci">void Play(const std::string &gameObjectName, const std::string &path, bool loop=false, double volume=0.5)</div><div class="ttdoc">Plays a AudioClip on a given GameObject.</div><div class="ttdef"><b>Definition:</b> AudioManager.cpp:33</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_addf8048a76b00328274e9d5a72af0add"><div class="ttname"><a href="classengine_1_1AudioManager.html#addf8048a76b00328274e9d5a72af0add">engine::AudioManager::LoadAudioClip</a></div><div class="ttdeci">void LoadAudioClip(const std::string &path)</div><div class="ttdoc">Load a AudioClip from the filesystem.</div><div class="ttdef"><b>Definition:</b> AudioManager.cpp:21</div></div>
<div class="ttc" id="aclassengine_1_1AudioManager_html_ae67e5633d99ca0fb7ed7018805da1b20"><div class="ttname"><a href="classengine_1_1AudioManager.html#ae67e5633d99ca0fb7ed7018805da1b20">engine::AudioManager::Pause</a></div><div class="ttdeci">void Pause(const std::string &gameObjectName, const std::string &path)</div><div class="ttdoc">Stops a AudioClip from playing at a given GameObject.</div><div class="ttdef"><b>Definition:</b> AudioManager.cpp:83</div></div>
<div class="ttc" id="anamespaceengine_html"><div class="ttname"><a href="namespaceengine.html">engine</a></div><div class="ttdef"><b>Definition:</b> EngineException.hpp:8</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>