Skip to content
LeviMC
English
AutoLightDark
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/audio/SoundPauseSource.h"
7#include "mc/deps/core/file/PathBuffer.h"
8#include "mc/deps/core/sound/SoundFormat.h"
9#include "mc/deps/game_refs/WeakRef.h"
10
11// auto generated forward declare list
12// clang-format off
14class SoundEvent;
17struct PlayMusicOptions;
18struct PlaySoundOptions;
21namespace Audio { class IStreamableAudioAsset; }
22namespace Audio { class OnlineAudioStream; }
23namespace Audio { class SoundStartOptions; }
24namespace Core { class Path; }
25namespace Core { class PathView; }
26class SoundItem;
27struct SoundLoadTask;
28struct SoundSystemGUID;
29// clang-format on
30
31class SoundSystemBase {
32public:
33 // member variables
34 // NOLINTBEGIN
37 // NOLINTEND
38
39public:
40 // prevent constructor by default
41 SoundSystemBase& operator=(SoundSystemBase const&);
42 SoundSystemBase(SoundSystemBase const&);
43 SoundSystemBase();
44
45public:
46 // virtual functions
47 // NOLINTBEGIN
48#ifdef LL_PLAT_S
49 virtual ~SoundSystemBase() = default;
50#else // LL_PLAT_C
51 virtual ~SoundSystemBase();
52#endif
53
54 virtual bool preinit();
55
56 virtual void init();
57
58 virtual void destroy();
59
60 virtual void setOutputDevice(::SoundSystemGUID& outputDevice);
61
62 virtual void setAsyncLoadFunction(::std::function<void(::SoundLoadTask)> asyncLoad);
63
64 virtual void enable(bool status);
65
66 virtual void mute(bool muted);
67
68 virtual bool addListener(int const handle);
69
70 virtual void removeListener(int const handle);
71
72 virtual void setListenerDirection(int const listenerHandle, ::glm::vec3 const& forward, ::glm::vec3 const& up);
73
74 virtual void setListenerPos(int const listenerHandle, float x, float y, float z);
75
76 virtual void setListenerVelocity(int const listenerHandle, float x, float y, float z);
77
78 virtual void setMainVolume(float vol);
79
80 virtual void setMusicVolume(float vol);
81
82 virtual void setSoundVolume(float vol);
83
84 virtual void setSoundCategoryVolume(::std::string const& category, float vol);
85
86 virtual void setTTSVolume(float vol);
87
88 virtual bool loadRawFromMemory(
89 ::Core::Path const& soundPath,
90 char const* data,
91 uint64 dataSize,
92 int numchannels,
93 int defaultfrequency,
94 ::SoundFormat format
95 );
96
97 virtual bool loadFromMemory(::Core::Path const& soundPath, char const* data, uint64 dataSize);
98
99 virtual void unload(::Core::Path const& soundPath);
100
101 virtual void unloadAllExcept(::std::vector<::Core::PathBuffer<::std::string>> const& exceptions);
102
103 virtual void stop(::std::string const& eventName);
104
105 virtual void stop(uint64 handle);
106
107 virtual void stop(::ServerSoundHandle serverSoundHandle);
108
109 virtual uint64 playEvent(::SoundEvent const& soundEvent, ::std::string const& eventName, float volume, float pitch);
110
111 virtual uint64 playEventAt(
112 ::SoundEvent const& soundEvent,
113 ::std::string const& eventName,
114 float x,
115 float y,
116 float z,
117 float volume,
118 float pitch,
119 ::std::optional<::ServerSoundHandle> serverSoundHandle
120 );
121
122 virtual uint64 playEventAt(::SoundEvent const& soundEvent, ::PlaySoundOptions const& options);
123
124 virtual uint64 playStreamableEventAt(
125 ::SoundEvent const& soundEvent,
126 ::SoundItem const& soundItem,
127 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset,
128 ::PlaySoundOptions const& options
129 );
130
131 virtual uint64 playAt(
132 ::Core::Path const& soundPath,
133 ::SoundEvent const* soundEvent,
134 ::std::string const& eventName,
135 uint64 soundHandle,
136 float x,
137 float y,
138 float z,
139 float volume,
140 float pitch,
141 bool is3D,
142 float minDistance,
143 float maxDistance,
144 bool useLegacyMaxDistance,
145 bool isTTS,
146 ::std::optional<::ServerSoundHandle> serverSoundHandle,
147 int loopCount,
148 float volumeBase
149 );
150
151 virtual uint64 playEventAttached(
152 ::SoundEvent const& soundEvent,
153 ::std::string const& eventName,
154 ::std::function<void(::SoundInstanceProperties&)>&& getSoundProperties
155 );
156
157 virtual bool isPlayingSound(uint64 handle) const;
158
159 virtual bool isPlayingSound(::Core::Path const& soundPath) const;
160
161 virtual bool isPlayingSound(::ServerSoundHandle serverSoundHandle) const;
162
163 virtual bool isSoundActive(uint64 handle) const;
164
165 virtual bool wasSoundStoppedExplicitly(::ServerSoundHandle serverSoundHandle) const;
166
167 virtual void setVolume(::ServerSoundHandle serverSoundHandle, float volume);
168
169 virtual void setPitch(::ServerSoundHandle serverSoundHandle, float pitch);
170
171 virtual void fade(::ServerSoundHandle serverSoundHandle, float duration, float targetVolume);
172
173 virtual void setPlaybackPosition(::ServerSoundHandle serverSoundHandle, float seconds);
174
175 virtual void setPlaybackPosition(uint64 soundHandle, float seconds);
176
177 virtual void pause(::ServerSoundHandle serverSoundHandle, ::SoundPauseSource source);
178
179 virtual void pause(uint64 soundHandle, ::SoundPauseSource source);
180
181 virtual void resume(::ServerSoundHandle serverSoundHandle, ::SoundPauseSource source);
182
183 virtual void resume(uint64 soundHandle, ::SoundPauseSource source);
184
185 virtual void signalStart(uint64 soundHandle);
186
187 virtual void fadeOut(uint64 handle, float duration) const;
188
189 virtual void playMusic(::PlayMusicOptions options, ::SoundItem const& soundItem);
190
191 virtual uint64 playStreamableMusic(
192 ::std::string const& eventName,
193 ::SoundItem const& soundItem,
194 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset
195 );
196
197 virtual bool isPlayingMusicEvent(::std::string const& eventName) const;
198
199 virtual bool isPlayingMusic(::Core::PathView soundPath) const;
200
201 virtual bool isLoadingMusic() const;
202
203 virtual void cancelLoadMusic();
204
205 virtual ::Core::PathView getCurrentlyPlayingMusicPath() const;
206
207 virtual ::std::string getCurrentlyPlayingEventName() const;
208
209 virtual void stopMusic();
210
211 virtual void stopRecords();
212
213 virtual void stopAllSounds();
214
215 virtual void pauseAllPlayingSounds(::SoundPauseSource source);
216
217 virtual void resumeAllPreviouslyPlayingSounds(::SoundPauseSource source);
218
219 virtual void fadeMusicOut(float time);
220
221 virtual bool isMusicChannelPlaying() const;
222
223 virtual void pauseMusic(bool paused);
224
225 virtual void update(float elapsedTime);
226
227 virtual uint64 registerLoop(
228 ::SoundItem const& soundItem,
229 ::std::weak_ptr<::SoundEvent> const soundEvent,
230 ::std::string const& eventName,
231 ::std::function<void(::LoopingSoundState&)> getSoundState,
232 float fadeInDuration,
233 float fadeOutDuration
234 );
235
236 virtual void unregisterLoop(uint64 handle, bool hard);
237
238 virtual void displayDebugStats(::std::string& debugOutputFormat) const;
239
240 virtual uint64 getNewSoundHandle();
241
242 virtual ::std::optional<::PlayingSoundAttributes> tryGetPlayingSoundAttributes(uint64 handle) const;
243
244 virtual ::std::optional<::PlayingSoundAttributes>
245 tryGetPlayingSoundAttributes(::ServerSoundHandle serverSoundHandle) const;
246
247 virtual ::std::optional<::LoopingSoundAttributes> tryGetLoopingSoundAttributes(uint64 handle) const;
248
249 virtual uint64 createRawUISoundStream(int bitDepth, int channels, float samplingRate);
250
251 virtual void closeRawUISoundStream(uint64 handle);
252
253 virtual void playRawUISoundStream(uint64 handle);
254
255 virtual void pauseRawUISoundStream(uint64 handle);
256
257 virtual void feedRawUISoundStream(uint64 handle, int samples, float** pcm, int channels);
258
259 virtual void endRawUISoundStream(uint64 handle);
260
261 virtual void setRawUISoundStreamVolume(uint64 handle, float volume);
262
263 virtual void flushRawUISoundStreamData(uint64 handle);
264
265 virtual uint64 playOnlineMusic(
266 ::std::string const& eventName,
268 float volume,
269 ::Audio::SoundStartOptions startOptions
270 );
271
272 virtual uint64 playOnlineMusic(
273 ::std::string const& eventName,
274 ::SoundItem const& soundItem,
276 ::Audio::SoundStartOptions startOptions
277 );
278
279 virtual uint64 playOnlineSound(
281 float volume,
282 float pitch,
283 ::Audio::SoundStartOptions startOptions
284 );
285
286 virtual uint64 playOnlineSound(
287 ::SoundEvent const& soundEvent,
288 ::SoundItem const& soundItem,
290 ::PlaySoundOptions const& options,
291 ::Audio::SoundStartOptions startOptions
292 );
293 // NOLINTEND
294
295public:
296 // destructor thunk
297 // NOLINTBEGIN
298#ifdef LL_PLAT_C
299 MCNAPI void $dtor();
300#endif
301 // NOLINTEND
302
303public:
304 // virtual function thunks
305 // NOLINTBEGIN
306#ifdef LL_PLAT_C
307 MCNAPI bool $preinit();
308
309 MCNAPI void $init();
310
311 MCNAPI void $destroy();
312
313 MCNAPI void $setOutputDevice(::SoundSystemGUID& outputDevice);
314
315 MCNAPI void $setAsyncLoadFunction(::std::function<void(::SoundLoadTask)> asyncLoad);
316
317 MCNAPI void $enable(bool status);
318
319 MCNAPI void $mute(bool muted);
320
321 MCNAPI bool $addListener(int const handle);
322
323 MCNAPI void $removeListener(int const handle);
324
325 MCNAPI void $setListenerDirection(int const listenerHandle, ::glm::vec3 const& forward, ::glm::vec3 const& up);
326
327 MCNAPI void $setListenerPos(int const listenerHandle, float x, float y, float z);
328
329 MCNAPI void $setListenerVelocity(int const listenerHandle, float x, float y, float z);
330
331 MCNAPI void $setMainVolume(float vol);
332
333 MCNAPI void $setMusicVolume(float vol);
334
335 MCNAPI void $setSoundVolume(float vol);
336
337 MCNAPI void $setSoundCategoryVolume(::std::string const& category, float vol);
338
339 MCNAPI void $setTTSVolume(float vol);
340
341 MCNAPI bool $loadRawFromMemory(
342 ::Core::Path const& soundPath,
343 char const* data,
344 uint64 dataSize,
345 int numchannels,
346 int defaultfrequency,
347 ::SoundFormat format
348 );
349
350 MCNAPI bool $loadFromMemory(::Core::Path const& soundPath, char const* data, uint64 dataSize);
351
352 MCNAPI void $unload(::Core::Path const& soundPath);
353
354 MCNAPI void $unloadAllExcept(::std::vector<::Core::PathBuffer<::std::string>> const& exceptions);
355
356 MCNAPI void $stop(::std::string const& eventName);
357
358 MCNAPI void $stop(uint64 handle);
359
360 MCNAPI void $stop(::ServerSoundHandle serverSoundHandle);
361
362 MCNAPI uint64 $playEvent(::SoundEvent const& soundEvent, ::std::string const& eventName, float volume, float pitch);
363
364 MCNAPI uint64 $playEventAt(
365 ::SoundEvent const& soundEvent,
366 ::std::string const& eventName,
367 float x,
368 float y,
369 float z,
370 float volume,
371 float pitch,
372 ::std::optional<::ServerSoundHandle> serverSoundHandle
373 );
374
375 MCNAPI uint64 $playEventAt(::SoundEvent const& soundEvent, ::PlaySoundOptions const& options);
376
377 MCNAPI uint64 $playStreamableEventAt(
378 ::SoundEvent const& soundEvent,
379 ::SoundItem const& soundItem,
380 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset,
381 ::PlaySoundOptions const& options
382 );
383
384 MCNAPI uint64 $playAt(
385 ::Core::Path const& soundPath,
386 ::SoundEvent const* soundEvent,
387 ::std::string const& eventName,
388 uint64 soundHandle,
389 float x,
390 float y,
391 float z,
392 float volume,
393 float pitch,
394 bool is3D,
395 float minDistance,
396 float maxDistance,
397 bool useLegacyMaxDistance,
398 bool isTTS,
399 ::std::optional<::ServerSoundHandle> serverSoundHandle,
400 int loopCount,
401 float volumeBase
402 );
403
404 MCNAPI uint64 $playEventAttached(
405 ::SoundEvent const& soundEvent,
406 ::std::string const& eventName,
407 ::std::function<void(::SoundInstanceProperties&)>&& getSoundProperties
408 );
409
410 MCNAPI bool $isPlayingSound(uint64 handle) const;
411
412 MCNAPI bool $isPlayingSound(::Core::Path const& soundPath) const;
413
414 MCNAPI bool $isPlayingSound(::ServerSoundHandle serverSoundHandle) const;
415
416 MCNAPI bool $isSoundActive(uint64 handle) const;
417
418 MCNAPI bool $wasSoundStoppedExplicitly(::ServerSoundHandle serverSoundHandle) const;
419
420 MCNAPI void $setVolume(::ServerSoundHandle serverSoundHandle, float volume);
421
422 MCNAPI void $setPitch(::ServerSoundHandle serverSoundHandle, float pitch);
423
424 MCNAPI void $fade(::ServerSoundHandle serverSoundHandle, float duration, float targetVolume);
425
426 MCNAPI void $setPlaybackPosition(::ServerSoundHandle serverSoundHandle, float seconds);
427
428 MCNAPI void $setPlaybackPosition(uint64 soundHandle, float seconds);
429
430 MCNAPI void $pause(::ServerSoundHandle serverSoundHandle, ::SoundPauseSource source);
431
432 MCNAPI void $pause(uint64 soundHandle, ::SoundPauseSource source);
433
434 MCNAPI void $resume(::ServerSoundHandle serverSoundHandle, ::SoundPauseSource source);
435
436 MCNAPI void $resume(uint64 soundHandle, ::SoundPauseSource source);
437
438 MCNAPI void $signalStart(uint64 soundHandle);
439
440 MCNAPI void $fadeOut(uint64 handle, float duration) const;
441
442 MCNAPI void $playMusic(::PlayMusicOptions options, ::SoundItem const& soundItem);
443
444 MCNAPI uint64 $playStreamableMusic(
445 ::std::string const& eventName,
446 ::SoundItem const& soundItem,
447 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset
448 );
449
450 MCNAPI bool $isPlayingMusicEvent(::std::string const& eventName) const;
451
452 MCNAPI bool $isPlayingMusic(::Core::PathView soundPath) const;
453
454 MCNAPI bool $isLoadingMusic() const;
455
456 MCNAPI void $cancelLoadMusic();
457
458 MCNAPI ::Core::PathView $getCurrentlyPlayingMusicPath() const;
459
460 MCNAPI ::std::string $getCurrentlyPlayingEventName() const;
461
462 MCNAPI void $stopMusic();
463
464 MCNAPI void $stopRecords();
465
466 MCNAPI void $stopAllSounds();
467
468 MCNAPI void $pauseAllPlayingSounds(::SoundPauseSource source);
469
470 MCNAPI void $resumeAllPreviouslyPlayingSounds(::SoundPauseSource source);
471
472 MCNAPI void $fadeMusicOut(float time);
473
474 MCNAPI bool $isMusicChannelPlaying() const;
475
476 MCNAPI void $pauseMusic(bool paused);
477
478 MCNAPI void $update(float elapsedTime);
479
480 MCNAPI uint64 $registerLoop(
481 ::SoundItem const& soundItem,
482 ::std::weak_ptr<::SoundEvent> const soundEvent,
483 ::std::string const& eventName,
484 ::std::function<void(::LoopingSoundState&)> getSoundState,
485 float fadeInDuration,
486 float fadeOutDuration
487 );
488
489 MCNAPI void $unregisterLoop(uint64 handle, bool hard);
490
491 MCNAPI void $displayDebugStats(::std::string& debugOutputFormat) const;
492
493 MCNAPI uint64 $getNewSoundHandle();
494
495 MCNAPI ::std::optional<::PlayingSoundAttributes> $tryGetPlayingSoundAttributes(uint64 handle) const;
496
497 MCNAPI ::std::optional<::PlayingSoundAttributes>
498 $tryGetPlayingSoundAttributes(::ServerSoundHandle serverSoundHandle) const;
499
500 MCNAPI ::std::optional<::LoopingSoundAttributes> $tryGetLoopingSoundAttributes(uint64 handle) const;
501
502 MCNAPI uint64 $createRawUISoundStream(int bitDepth, int channels, float samplingRate);
503
504 MCNAPI void $closeRawUISoundStream(uint64 handle);
505
506 MCNAPI void $playRawUISoundStream(uint64 handle);
507
508 MCNAPI void $pauseRawUISoundStream(uint64 handle);
509
510 MCNAPI void $feedRawUISoundStream(uint64 handle, int samples, float** pcm, int channels);
511
512 MCNAPI void $endRawUISoundStream(uint64 handle);
513
514 MCNAPI void $setRawUISoundStreamVolume(uint64 handle, float volume);
515
516 MCNAPI void $flushRawUISoundStreamData(uint64 handle);
517
518 MCNAPI uint64 $playOnlineMusic(
519 ::std::string const& eventName,
521 float volume,
522 ::Audio::SoundStartOptions startOptions
523 );
524
525 MCNAPI uint64 $playOnlineMusic(
526 ::std::string const& eventName,
527 ::SoundItem const& soundItem,
529 ::Audio::SoundStartOptions startOptions
530 );
531
532 MCNAPI uint64 $playOnlineSound(
534 float volume,
535 float pitch,
536 ::Audio::SoundStartOptions startOptions
537 );
538
539 MCNAPI uint64 $playOnlineSound(
540 ::SoundEvent const& soundEvent,
541 ::SoundItem const& soundItem,
543 ::PlaySoundOptions const& options,
544 ::Audio::SoundStartOptions startOptions
545 );
546#endif
547
548
549 // NOLINTEND
550
551public:
552 // vftables
553 // NOLINTBEGIN
554 MCNAPI static void** $vftable();
555 // NOLINTEND
556};
Definition IStreamableAudioAsset.h:10
Definition OnlineAudioStream.h:7
Definition SoundStartOptions.h:7
Definition PathBuffer.h:8
Definition PathView.h:19
Definition Path.h:10
Definition ServerSoundHandle.h:5
Definition SoundEvent.h:10
Definition SoundItem.h:5
static MCAPI void ** $vftable()
Definition WeakRef.h:8
Definition LoopingSoundAttributes.h:8
Definition LoopingSoundState.h:5
Definition PlayMusicOptions.h:5
Definition PlaySoundOptions.h:10
Definition PlayingSoundAttributes.h:5
Definition SoundInstanceProperties.h:5
Definition SoundLoadTask.h:5
Definition SoundSystemGUID.h:5
Definition Alias.h:14