LeviLamina
Loading...
Searching...
No Matches
SoundSystemBase.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/sound/SoundFormat.h"
8
9// auto generated forward declare list
10// clang-format off
15struct SoundSystemGUID;
16namespace Core { class Path; }
17namespace Core { class PathView; }
18class SoundEvent;
19class SoundItem;
20// clang-format on
21
22class SoundSystemBase {
23public:
24 // member variables
25 // NOLINTBEGIN
28 // NOLINTEND
29
30public:
31 // prevent constructor by default
32 SoundSystemBase& operator=(SoundSystemBase const&);
33 SoundSystemBase(SoundSystemBase const&);
34 SoundSystemBase();
35
36public:
37 // virtual functions
38 // NOLINTBEGIN
39#ifdef LL_PLAT_S
40 virtual ~SoundSystemBase() = default;
41#else // LL_PLAT_C
42 virtual ~SoundSystemBase();
43#endif
44
45 virtual bool preinit();
46
47 virtual void init();
48
49 virtual void destroy();
50
51 virtual void setOutputDevice(::SoundSystemGUID& outputDevice);
52
53 virtual void setAsyncLoadFunction(::std::function<void(::SoundItem const&, ::std::function<void()>)> asyncLoad);
54
55 virtual void enable(bool status);
56
57 virtual void mute(bool muted);
58
59 virtual bool addListener(int const handle);
60
61 virtual void removeListener(int const handle);
62
63 virtual void setListenerDirection(int const listenerHandle, ::glm::vec3 const& forward, ::glm::vec3 const& up);
64
65 virtual void setListenerPos(int const listenerHandle, float x, float y, float z);
66
67 virtual void setListenerVelocity(int const listenerHandle, float x, float y, float z);
68
69 virtual void setMainVolume(float vol);
70
71 virtual void setMusicVolume(float vol);
72
73 virtual void setSoundVolume(float vol);
74
75 virtual void setSoundCategoryVolume(::std::string const& category, float vol);
76
77 virtual void setTTSVolume(float vol);
78
79 virtual bool load(::Core::Path const& soundName, bool isStream);
80
81 virtual bool loadRawFromMemory(
82 ::Core::Path const& soundName,
83 char const* data,
84 uint64 dataSize,
85 int numchannels,
86 int defaultfrequency,
87 ::SoundFormat format
88 );
89
90 virtual bool loadFromMemory(::Core::Path const& soundName, char const* data, uint64 dataSize);
91
92 virtual bool loadExternalEvent(::std::string const& soundName);
93
94 virtual void unload(::Core::Path const& soundName);
95
96 virtual void unloadAll();
97
98 virtual bool isSoundLoaded(::Core::Path const& name);
99
100 virtual bool usesSoundBanks();
101
102 virtual void loadSoundBank(::std::string const& name, bool isNonBlocking);
103
104 virtual void unloadSoundBank(::std::string const& name);
105
106 virtual void play(::std::string const& name);
107
108 virtual void pause(::std::string const& name);
109
110 virtual void stop(::std::string const& name);
111
112 virtual void stop(uint64 handle);
113
114 virtual uint64 playEvent(::SoundEvent const& soundEvent, ::std::string const& eventName, float volume, float pitch);
115
116 virtual uint64 playEventAt(
117 ::SoundEvent const& soundEvent,
118 ::std::string const& eventName,
119 float x,
120 float y,
121 float z,
122 float volume,
123 float pitch
124 );
125
126 virtual uint64 playAt(
127 ::Core::Path const& soundName,
128 ::SoundEvent const* soundEvent,
129 ::std::string const& eventName,
130 uint64 soundHandle,
131 float x,
132 float y,
133 float z,
134 float volume,
135 float pitch,
136 bool is3D,
137 float minDistance,
138 float maxDistance,
139 bool useLegacyMaxDistance,
140 bool isTTS
141 );
142
143 virtual uint64 playEventAttached(
144 ::SoundEvent const& soundEvent,
145 ::std::string const& eventName,
146 ::std::function<void(::SoundInstanceProperties&)>&& getSoundProperties
147 );
148
149 virtual bool isPlayingSound(uint64 handle) const;
150
151 virtual void fadeOut(uint64 handle, float duration) const;
152
153 virtual void playMusic(::std::string const& eventName, ::SoundItem const& soundItem);
154
155 virtual bool isPlayingMusicEvent(::std::string const& eventName) const;
156
157 virtual bool isPlayingMusic(::Core::PathView soundName) const;
158
159 virtual bool isLoadingMusic() const;
160
161 virtual void cancelLoadMusic();
162
163 virtual ::Core::PathBuffer<::std::string> const& getCurrentlyPlayingMusicName() const;
164
165 virtual ::std::string getCurrentlyPlayingEventName() const;
166
167 virtual void stopMusic();
168
169 virtual void stopRecords();
170
171 virtual void stopAllSounds();
172
173 virtual void pauseAllPlayingSounds();
174
175 virtual void resumeAllPreviouslyPlayingSounds();
176
177 virtual void fadeMusicOut(float time);
178
179 virtual bool isMusicChannelPlaying() const;
180
181 virtual void pauseMusic(bool state);
182
183 virtual void update(float elapsedTime);
184
185 virtual uint64 registerLoop(
186 ::SoundItem const& soundItem,
187 ::std::weak_ptr<::SoundEvent> const soundEvent,
188 ::std::string const& eventName,
189 ::std::function<void(::LoopingSoundState&)> getSoundState,
190 float fadeInDuration,
191 float fadeOutDuration
192 );
193
194 virtual void unregisterLoop(uint64 handle, bool hard);
195
196 virtual void displayDebugStats(::std::string& debugOutputFormat) const;
197
198 virtual void startSnapshot(::std::string const& name);
199
200 virtual void stopSnapshot(::std::string const& name);
201
202 virtual void stopAllSnapshots();
203
204 virtual uint64 getNewSoundHandle();
205
206 virtual ::std::optional<::PlayingSoundAttributes> tryGetPlayingSoundAttributes(uint64 handle) const;
207
208 virtual ::std::optional<::LoopingSoundAttributes> tryGetLoopingSoundAttributes(uint64 handle) const;
209 // NOLINTEND
210
211public:
212 // destructor thunk
213 // NOLINTBEGIN
214 MCNAPI void $dtor();
215 // NOLINTEND
216
217public:
218 // virtual function thunks
219 // NOLINTBEGIN
220#ifdef LL_PLAT_C
221 MCNAPI bool $preinit();
222
223 MCNAPI void $init();
224
225 MCNAPI void $destroy();
226
227 MCNAPI void $setOutputDevice(::SoundSystemGUID& outputDevice);
228
229 MCNAPI void $setAsyncLoadFunction(::std::function<void(::SoundItem const&, ::std::function<void()>)> asyncLoad);
230
231 MCNAPI void $enable(bool status);
232
233 MCNAPI void $mute(bool muted);
234
235 MCNAPI bool $addListener(int const handle);
236
237 MCNAPI void $removeListener(int const handle);
238
239 MCNAPI void $setListenerDirection(int const listenerHandle, ::glm::vec3 const& forward, ::glm::vec3 const& up);
240
241 MCNAPI void $setListenerPos(int const listenerHandle, float x, float y, float z);
242
243 MCNAPI void $setListenerVelocity(int const listenerHandle, float x, float y, float z);
244
245 MCNAPI void $setMainVolume(float vol);
246
247 MCNAPI void $setMusicVolume(float vol);
248
249 MCNAPI void $setSoundVolume(float vol);
250
251 MCNAPI void $setSoundCategoryVolume(::std::string const& category, float vol);
252
253 MCNAPI void $setTTSVolume(float vol);
254
255 MCNAPI bool $load(::Core::Path const& soundName, bool isStream);
256
257 MCNAPI bool $loadRawFromMemory(
258 ::Core::Path const& soundName,
259 char const* data,
260 uint64 dataSize,
261 int numchannels,
262 int defaultfrequency,
263 ::SoundFormat format
264 );
265
266 MCNAPI bool $loadFromMemory(::Core::Path const& soundName, char const* data, uint64 dataSize);
267
268 MCNAPI bool $loadExternalEvent(::std::string const& soundName);
269
270 MCNAPI void $unload(::Core::Path const& soundName);
271
272 MCNAPI void $unloadAll();
273
274 MCNAPI bool $isSoundLoaded(::Core::Path const& name);
275
276 MCNAPI bool $usesSoundBanks();
277
278 MCNAPI void $loadSoundBank(::std::string const& name, bool isNonBlocking);
279
280 MCNAPI void $unloadSoundBank(::std::string const& name);
281
282 MCNAPI void $play(::std::string const& name);
283
284 MCNAPI void $pause(::std::string const& name);
285
286 MCNAPI void $stop(::std::string const& name);
287
288 MCNAPI void $stop(uint64 handle);
289
290 MCNAPI uint64 $playEvent(::SoundEvent const& soundEvent, ::std::string const& eventName, float volume, float pitch);
291
292 MCNAPI uint64 $playEventAt(
293 ::SoundEvent const& soundEvent,
294 ::std::string const& eventName,
295 float x,
296 float y,
297 float z,
298 float volume,
299 float pitch
300 );
301
302 MCNAPI uint64 $playAt(
303 ::Core::Path const& soundName,
304 ::SoundEvent const* soundEvent,
305 ::std::string const& eventName,
306 uint64 soundHandle,
307 float x,
308 float y,
309 float z,
310 float volume,
311 float pitch,
312 bool is3D,
313 float minDistance,
314 float maxDistance,
315 bool useLegacyMaxDistance,
316 bool isTTS
317 );
318
319 MCNAPI uint64 $playEventAttached(
320 ::SoundEvent const& soundEvent,
321 ::std::string const& eventName,
322 ::std::function<void(::SoundInstanceProperties&)>&& getSoundProperties
323 );
324
325 MCNAPI bool $isPlayingSound(uint64 handle) const;
326
327 MCNAPI void $fadeOut(uint64 handle, float duration) const;
328
329 MCNAPI void $playMusic(::std::string const& eventName, ::SoundItem const& soundItem);
330
331 MCNAPI bool $isPlayingMusicEvent(::std::string const& eventName) const;
332
333 MCNAPI bool $isPlayingMusic(::Core::PathView soundName) const;
334
335 MCNAPI bool $isLoadingMusic() const;
336
337 MCNAPI void $cancelLoadMusic();
338
339 MCNAPI ::Core::PathBuffer<::std::string> const& $getCurrentlyPlayingMusicName() const;
340
341 MCNAPI ::std::string $getCurrentlyPlayingEventName() const;
342
343 MCNAPI void $stopMusic();
344
345 MCNAPI void $stopRecords();
346
347 MCNAPI void $stopAllSounds();
348
349 MCNAPI void $pauseAllPlayingSounds();
350
351 MCNAPI void $resumeAllPreviouslyPlayingSounds();
352
353 MCNAPI void $fadeMusicOut(float time);
354
355 MCNAPI bool $isMusicChannelPlaying() const;
356
357 MCNAPI void $pauseMusic(bool state);
358
359 MCNAPI void $update(float elapsedTime);
360
361 MCNAPI uint64 $registerLoop(
362 ::SoundItem const& soundItem,
363 ::std::weak_ptr<::SoundEvent> const soundEvent,
364 ::std::string const& eventName,
365 ::std::function<void(::LoopingSoundState&)> getSoundState,
366 float fadeInDuration,
367 float fadeOutDuration
368 );
369
370 MCNAPI void $unregisterLoop(uint64 handle, bool hard);
371
372 MCNAPI void $displayDebugStats(::std::string& debugOutputFormat) const;
373
374 MCNAPI void $startSnapshot(::std::string const& name);
375
376 MCNAPI void $stopSnapshot(::std::string const& name);
377
378 MCNAPI void $stopAllSnapshots();
379
380 MCNAPI uint64 $getNewSoundHandle();
381
382 MCNAPI ::std::optional<::PlayingSoundAttributes> $tryGetPlayingSoundAttributes(uint64 handle) const;
383
384 MCNAPI ::std::optional<::LoopingSoundAttributes> $tryGetLoopingSoundAttributes(uint64 handle) const;
385#endif
386
387
388 // NOLINTEND
389
390public:
391 // vftables
392 // NOLINTBEGIN
393 MCNAPI static void** $vftable();
394 // NOLINTEND
395};
Definition PathView.h:17
Definition Path.h:10
Definition SoundEvent.h:5
Definition SoundItem.h:5
MCAPI void $dtor()
static MCAPI void ** $vftable()
Definition LoopingSoundAttributes.h:8
Definition LoopingSoundState.h:5
Definition PlayingSoundAttributes.h:5
Definition SoundInstanceProperties.h:5
Definition SoundSystemGUID.h:5
Definition Alias.h:14