23class SoundSystemBase {
33 SoundSystemBase& operator=(SoundSystemBase
const&);
34 SoundSystemBase(SoundSystemBase
const&);
41 virtual ~SoundSystemBase() =
default;
43 virtual ~SoundSystemBase();
46 virtual bool preinit();
50 virtual void destroy();
59 virtual void setAsyncLoadFunction(::std::function<
void(
::SoundItem const&, ::std::function<
void()>)>);
61 virtual void setAsyncLoadFunction(::std::function<
void(
::SoundItem const&, ::std::function<
void()>)> asyncLoad);
65 virtual void enable(
bool);
67 virtual void enable(
bool status);
71 virtual void mute(
bool);
73 virtual void mute(
bool muted);
77 virtual bool addListener(
int const);
79 virtual bool addListener(
int const handle);
83 virtual void removeListener(
int const);
85 virtual void removeListener(
int const handle);
89 virtual void setListenerDirection(
int const, ::glm::vec3
const&, ::glm::vec3
const&);
91 virtual void setListenerDirection(
int const listenerHandle, ::glm::vec3
const& forward, ::glm::vec3
const& up);
95 virtual void setListenerPos(
int const,
float,
float,
float);
97 virtual void setListenerPos(
int const listenerHandle,
float x,
float y,
float z);
101 virtual void setListenerVelocity(
int const,
float,
float,
float);
103 virtual void setListenerVelocity(
int const listenerHandle,
float x,
float y,
float z);
107 virtual void setMainVolume(
float);
109 virtual void setMainVolume(
float vol);
113 virtual void setMusicVolume(
float);
115 virtual void setMusicVolume(
float vol);
119 virtual void setSoundVolume(
float);
121 virtual void setSoundVolume(
float vol);
125 virtual void setSoundCategoryVolume(::std::string
const&,
float);
127 virtual void setSoundCategoryVolume(::std::string
const& category,
float vol);
131 virtual void setTTSVolume(
float);
133 virtual void setTTSVolume(
float vol);
139 virtual bool load(
::Core::Path const& soundName,
bool isStream);
143 virtual bool loadRawFromMemory(
::Core::Path const&,
char const*, uint64,
int,
int, ::SoundFormat);
145 virtual bool loadRawFromMemory(
150 int defaultfrequency,
156 virtual bool loadFromMemory(
::Core::Path const&,
char const*, uint64);
158 virtual bool loadFromMemory(
::Core::Path const& soundName,
char const* data, uint64 dataSize);
161 virtual bool loadExternalEvent(::std::string
const&);
169 virtual void unloadAll();
177 virtual bool usesSoundBanks();
179 virtual void loadSoundBank(::std::string
const&,
bool);
181 virtual void unloadSoundBank(::std::string
const&);
183 virtual void play(::std::string
const&);
185 virtual void pause(::std::string
const&);
188 virtual void stop(::std::string
const&);
190 virtual void stop(::std::string
const& soundName);
194 virtual void stop(uint64);
196 virtual void stop(uint64 handle);
200 virtual uint64 playEvent(
::SoundEvent const&, ::std::string
const&,
float,
float);
202 virtual uint64 playEvent(
::SoundEvent const& soundEvent, ::std::string
const& eventName,
float volume,
float pitch);
206 virtual uint64 playEventAt(
208 ::std::string
const&,
214 ::std::optional<::ServerSoundHandle>
217 virtual uint64 playEventAt(
219 ::std::string
const& eventName,
225 ::std::optional<::ServerSoundHandle> serverSoundHandle
230 virtual uint64 playAt(
233 ::std::string
const&,
245 ::std::optional<::ServerSoundHandle>
248 virtual uint64 playAt(
251 ::std::string
const& eventName,
261 bool useLegacyMaxDistance,
263 ::std::optional<::ServerSoundHandle> serverSoundHandle
271 virtual uint64 playEventAttached(
273 ::std::string
const& eventName,
279 virtual bool isPlayingSound(uint64)
const;
281 virtual bool isPlayingSound(uint64 handle)
const;
285 virtual void fadeOut(uint64,
float)
const;
287 virtual void fadeOut(uint64 handle,
float duration)
const;
291 virtual void playMusic(::std::string
const&,
::SoundItem const&);
293 virtual void playMusic(::std::string
const& eventName,
::SoundItem const& soundItem);
297 virtual bool isPlayingMusicEvent(::std::string
const&)
const;
299 virtual bool isPlayingMusicEvent(::std::string
const& eventName)
const;
308 virtual bool isLoadingMusic()
const;
310 virtual void cancelLoadMusic();
312 virtual ::Core::PathBuffer<::std::string>
const& getCurrentlyPlayingMusicName()
const;
314 virtual ::std::string getCurrentlyPlayingEventName()
const;
316 virtual void stopMusic();
318 virtual void stopRecords();
320 virtual void stopAllSounds();
322 virtual void pauseAllPlayingSounds();
324 virtual void resumeAllPreviouslyPlayingSounds();
327 virtual void fadeMusicOut(
float);
329 virtual void fadeMusicOut(
float time);
332 virtual bool isMusicChannelPlaying()
const;
335 virtual void pauseMusic(
bool);
337 virtual void pauseMusic(
bool state);
341 virtual void update(
float);
343 virtual void update(
float elapsedTime);
347 virtual uint64 registerLoop(
349 ::std::weak_ptr<::SoundEvent>
const,
350 ::std::string
const&,
356 virtual uint64 registerLoop(
358 ::std::weak_ptr<::SoundEvent>
const soundEvent,
359 ::std::string
const& eventName,
361 float fadeInDuration,
362 float fadeOutDuration
367 virtual void unregisterLoop(uint64,
bool);
369 virtual void unregisterLoop(uint64 handle,
bool hard);
373 virtual void displayDebugStats(::std::string&)
const;
375 virtual void displayDebugStats(::std::string& debugOutputFormat)
const;
378 virtual void startSnapshot(::std::string
const&);
380 virtual void stopSnapshot(::std::string
const&);
382 virtual void stopAllSnapshots();
384 virtual uint64 getNewSoundHandle();
387 virtual ::std::optional<::PlayingSoundAttributes> tryGetPlayingSoundAttributes(uint64)
const;
389 virtual ::std::optional<::PlayingSoundAttributes> tryGetPlayingSoundAttributes(uint64 handle)
const;
393 virtual ::std::optional<::LoopingSoundAttributes> tryGetLoopingSoundAttributes(uint64)
const;
395 virtual ::std::optional<::LoopingSoundAttributes> tryGetLoopingSoundAttributes(uint64 handle)
const;
404 MCNAPI
int getNumListeners();
418 MCNAPI
bool $preinit();
422 MCNAPI
void $destroy();
426 MCNAPI
void $setAsyncLoadFunction(::std::function<
void(
::SoundItem const&, ::std::function<
void()>)> asyncLoad);
428 MCNAPI
void $enable(
bool status);
430 MCNAPI
void $mute(
bool muted);
432 MCNAPI
bool $addListener(
int const handle);
434 MCNAPI
void $removeListener(
int const handle);
436 MCNAPI
void $setListenerDirection(
int const listenerHandle, ::glm::vec3
const& forward, ::glm::vec3
const& up);
438 MCNAPI
void $setListenerPos(
int const listenerHandle,
float x,
float y,
float z);
440 MCNAPI
void $setListenerVelocity(
int const listenerHandle,
float x,
float y,
float z);
442 MCNAPI
void $setMainVolume(
float vol);
444 MCNAPI
void $setMusicVolume(
float vol);
446 MCNAPI
void $setSoundVolume(
float vol);
448 MCNAPI
void $setSoundCategoryVolume(::std::string
const& category,
float vol);
450 MCNAPI
void $setTTSVolume(
float vol);
452 MCNAPI
bool $load(
::Core::Path const& soundName,
bool isStream);
454 MCNAPI
bool $loadRawFromMemory(
459 int defaultfrequency,
463 MCNAPI
bool $loadFromMemory(
::Core::Path const& soundName,
char const* data, uint64 dataSize);
465 MCNAPI
bool $loadExternalEvent(::std::string
const&);
469 MCNAPI
void $unloadAll();
473 MCNAPI
bool $usesSoundBanks();
475 MCNAPI
void $loadSoundBank(::std::string
const&,
bool);
477 MCNAPI
void $unloadSoundBank(::std::string
const&);
479 MCNAPI
void $play(::std::string
const&);
481 MCNAPI
void $pause(::std::string
const&);
483 MCNAPI
void $stop(::std::string
const& soundName);
485 MCNAPI
void $stop(uint64 handle);
487 MCNAPI uint64 $playEvent(
::SoundEvent const& soundEvent, ::std::string
const& eventName,
float volume,
float pitch);
489 MCNAPI uint64 $playEventAt(
491 ::std::string
const& eventName,
497 ::std::optional<::ServerSoundHandle> serverSoundHandle
500 MCNAPI uint64 $playAt(
503 ::std::string
const& eventName,
513 bool useLegacyMaxDistance,
515 ::std::optional<::ServerSoundHandle> serverSoundHandle
518 MCNAPI uint64 $playEventAttached(
520 ::std::string
const& eventName,
524 MCNAPI
bool $isPlayingSound(uint64 handle)
const;
526 MCNAPI
void $fadeOut(uint64 handle,
float duration)
const;
528 MCNAPI
void $playMusic(::std::string
const& eventName,
::SoundItem const& soundItem);
530 MCNAPI
bool $isPlayingMusicEvent(::std::string
const& eventName)
const;
534 MCNAPI
bool $isLoadingMusic()
const;
536 MCNAPI
void $cancelLoadMusic();
538 MCNAPI ::Core::PathBuffer<::std::string>
const& $getCurrentlyPlayingMusicName()
const;
540 MCNAPI ::std::string $getCurrentlyPlayingEventName()
const;
542 MCNAPI
void $stopMusic();
544 MCNAPI
void $stopRecords();
546 MCNAPI
void $stopAllSounds();
548 MCNAPI
void $pauseAllPlayingSounds();
550 MCNAPI
void $resumeAllPreviouslyPlayingSounds();
552 MCNAPI
void $fadeMusicOut(
float time);
554 MCNAPI
bool $isMusicChannelPlaying()
const;
556 MCNAPI
void $pauseMusic(
bool state);
558 MCNAPI
void $update(
float elapsedTime);
560 MCNAPI uint64 $registerLoop(
562 ::std::weak_ptr<::SoundEvent>
const soundEvent,
563 ::std::string
const& eventName,
565 float fadeInDuration,
566 float fadeOutDuration
569 MCNAPI
void $unregisterLoop(uint64 handle,
bool hard);
571 MCNAPI
void $displayDebugStats(::std::string& debugOutputFormat)
const;
573 MCNAPI
void $startSnapshot(::std::string
const&);
575 MCNAPI
void $stopSnapshot(::std::string
const&);
577 MCNAPI
void $stopAllSnapshots();
579 MCNAPI uint64 $getNewSoundHandle();
581 MCNAPI ::std::optional<::PlayingSoundAttributes> $tryGetPlayingSoundAttributes(uint64 handle)
const;
583 MCNAPI ::std::optional<::LoopingSoundAttributes> $tryGetLoopingSoundAttributes(uint64 handle)
const;