31class SoundSystemBase {
41 SoundSystemBase& operator=(SoundSystemBase
const&);
42 SoundSystemBase(SoundSystemBase
const&);
49 virtual ~SoundSystemBase() =
default;
51 virtual ~SoundSystemBase();
54 virtual bool preinit();
58 virtual void destroy();
62 virtual void setAsyncLoadFunction(::std::function<
void(
::SoundLoadTask)> asyncLoad);
64 virtual void enable(
bool status);
66 virtual void mute(
bool muted);
68 virtual bool addListener(
int const handle);
70 virtual void removeListener(
int const handle);
72 virtual void setListenerDirection(
int const listenerHandle, ::glm::vec3
const& forward, ::glm::vec3
const& up);
74 virtual void setListenerPos(
int const listenerHandle,
float x,
float y,
float z);
76 virtual void setListenerVelocity(
int const listenerHandle,
float x,
float y,
float z);
78 virtual void setMainVolume(
float vol);
80 virtual void setMusicVolume(
float vol);
82 virtual void setSoundVolume(
float vol);
84 virtual void setSoundCategoryVolume(::std::string
const& category,
float vol);
86 virtual void setTTSVolume(
float vol);
88 virtual bool loadRawFromMemory(
97 virtual bool loadFromMemory(
::Core::Path const& soundPath,
char const* data, uint64 dataSize);
103 virtual void stop(::std::string
const& eventName);
105 virtual void stop(uint64 handle);
109 virtual uint64 playEvent(
::SoundEvent const& soundEvent, ::std::string
const& eventName,
float volume,
float pitch);
111 virtual uint64 playEventAt(
113 ::std::string
const& eventName,
119 ::std::optional<::ServerSoundHandle> serverSoundHandle
124 virtual uint64 playStreamableEventAt(
127 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset,
131 virtual uint64 playAt(
134 ::std::string
const& eventName,
144 bool useLegacyMaxDistance,
146 ::std::optional<::ServerSoundHandle> serverSoundHandle,
151 virtual uint64 playEventAttached(
153 ::std::string
const& eventName,
157 virtual bool isPlayingSound(uint64 handle)
const;
159 virtual bool isPlayingSound(
::Core::Path const& soundPath)
const;
163 virtual bool isSoundActive(uint64 handle)
const;
171 virtual void fade(
::ServerSoundHandle serverSoundHandle,
float duration,
float targetVolume);
175 virtual void setPlaybackPosition(uint64 soundHandle,
float seconds);
179 virtual void pause(uint64 soundHandle, ::SoundPauseSource source);
183 virtual void resume(uint64 soundHandle, ::SoundPauseSource source);
185 virtual void signalStart(uint64 soundHandle);
187 virtual void fadeOut(uint64 handle,
float duration)
const;
191 virtual uint64 playStreamableMusic(
192 ::std::string
const& eventName,
194 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset
197 virtual bool isPlayingMusicEvent(::std::string
const& eventName)
const;
201 virtual bool isLoadingMusic()
const;
203 virtual void cancelLoadMusic();
205 virtual ::Core::PathView getCurrentlyPlayingMusicPath()
const;
207 virtual ::std::string getCurrentlyPlayingEventName()
const;
209 virtual void stopMusic();
211 virtual void stopRecords();
213 virtual void stopAllSounds();
215 virtual void pauseAllPlayingSounds(::SoundPauseSource source);
217 virtual void resumeAllPreviouslyPlayingSounds(::SoundPauseSource source);
219 virtual void fadeMusicOut(
float time);
221 virtual bool isMusicChannelPlaying()
const;
223 virtual void pauseMusic(
bool paused);
225 virtual void update(
float elapsedTime);
227 virtual uint64 registerLoop(
229 ::std::weak_ptr<::SoundEvent>
const soundEvent,
230 ::std::string
const& eventName,
232 float fadeInDuration,
233 float fadeOutDuration
236 virtual void unregisterLoop(uint64 handle,
bool hard);
238 virtual void displayDebugStats(::std::string& debugOutputFormat)
const;
240 virtual uint64 getNewSoundHandle();
242 virtual ::std::optional<::PlayingSoundAttributes> tryGetPlayingSoundAttributes(uint64 handle)
const;
244 virtual ::std::optional<::PlayingSoundAttributes>
247 virtual ::std::optional<::LoopingSoundAttributes> tryGetLoopingSoundAttributes(uint64 handle)
const;
249 virtual uint64 createRawUISoundStream(
int bitDepth,
int channels,
float samplingRate);
251 virtual void closeRawUISoundStream(uint64 handle);
253 virtual void playRawUISoundStream(uint64 handle);
255 virtual void pauseRawUISoundStream(uint64 handle);
257 virtual void feedRawUISoundStream(uint64 handle,
int samples,
float** pcm,
int channels);
259 virtual void endRawUISoundStream(uint64 handle);
261 virtual void setRawUISoundStreamVolume(uint64 handle,
float volume);
263 virtual void flushRawUISoundStreamData(uint64 handle);
265 virtual uint64 playOnlineMusic(
266 ::std::string
const& eventName,
272 virtual uint64 playOnlineMusic(
273 ::std::string
const& eventName,
279 virtual uint64 playOnlineSound(
286 virtual uint64 playOnlineSound(
307 MCNAPI
bool $preinit();
311 MCNAPI
void $destroy();
315 MCNAPI
void $setAsyncLoadFunction(::std::function<
void(
::SoundLoadTask)> asyncLoad);
317 MCNAPI
void $enable(
bool status);
319 MCNAPI
void $mute(
bool muted);
321 MCNAPI
bool $addListener(
int const handle);
323 MCNAPI
void $removeListener(
int const handle);
325 MCNAPI
void $setListenerDirection(
int const listenerHandle, ::glm::vec3
const& forward, ::glm::vec3
const& up);
327 MCNAPI
void $setListenerPos(
int const listenerHandle,
float x,
float y,
float z);
329 MCNAPI
void $setListenerVelocity(
int const listenerHandle,
float x,
float y,
float z);
331 MCNAPI
void $setMainVolume(
float vol);
333 MCNAPI
void $setMusicVolume(
float vol);
335 MCNAPI
void $setSoundVolume(
float vol);
337 MCNAPI
void $setSoundCategoryVolume(::std::string
const& category,
float vol);
339 MCNAPI
void $setTTSVolume(
float vol);
341 MCNAPI
bool $loadRawFromMemory(
346 int defaultfrequency,
350 MCNAPI
bool $loadFromMemory(
::Core::Path const& soundPath,
char const* data, uint64 dataSize);
356 MCNAPI
void $stop(::std::string
const& eventName);
358 MCNAPI
void $stop(uint64 handle);
362 MCNAPI uint64 $playEvent(
::SoundEvent const& soundEvent, ::std::string
const& eventName,
float volume,
float pitch);
364 MCNAPI uint64 $playEventAt(
366 ::std::string
const& eventName,
372 ::std::optional<::ServerSoundHandle> serverSoundHandle
377 MCNAPI uint64 $playStreamableEventAt(
380 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset,
384 MCNAPI uint64 $playAt(
387 ::std::string
const& eventName,
397 bool useLegacyMaxDistance,
399 ::std::optional<::ServerSoundHandle> serverSoundHandle,
404 MCNAPI uint64 $playEventAttached(
406 ::std::string
const& eventName,
410 MCNAPI
bool $isPlayingSound(uint64 handle)
const;
412 MCNAPI
bool $isPlayingSound(
::Core::Path const& soundPath)
const;
416 MCNAPI
bool $isSoundActive(uint64 handle)
const;
424 MCNAPI
void $fade(
::ServerSoundHandle serverSoundHandle,
float duration,
float targetVolume);
428 MCNAPI
void $setPlaybackPosition(uint64 soundHandle,
float seconds);
432 MCNAPI
void $pause(uint64 soundHandle, ::SoundPauseSource source);
436 MCNAPI
void $resume(uint64 soundHandle, ::SoundPauseSource source);
438 MCNAPI
void $signalStart(uint64 soundHandle);
440 MCNAPI
void $fadeOut(uint64 handle,
float duration)
const;
444 MCNAPI uint64 $playStreamableMusic(
445 ::std::string
const& eventName,
447 ::std::unique_ptr<::Audio::IStreamableAudioAsset> streamableAudioAsset
450 MCNAPI
bool $isPlayingMusicEvent(::std::string
const& eventName)
const;
454 MCNAPI
bool $isLoadingMusic()
const;
456 MCNAPI
void $cancelLoadMusic();
458 MCNAPI ::Core::PathView $getCurrentlyPlayingMusicPath()
const;
460 MCNAPI ::std::string $getCurrentlyPlayingEventName()
const;
462 MCNAPI
void $stopMusic();
464 MCNAPI
void $stopRecords();
466 MCNAPI
void $stopAllSounds();
468 MCNAPI
void $pauseAllPlayingSounds(::SoundPauseSource source);
470 MCNAPI
void $resumeAllPreviouslyPlayingSounds(::SoundPauseSource source);
472 MCNAPI
void $fadeMusicOut(
float time);
474 MCNAPI
bool $isMusicChannelPlaying()
const;
476 MCNAPI
void $pauseMusic(
bool paused);
478 MCNAPI
void $update(
float elapsedTime);
480 MCNAPI uint64 $registerLoop(
482 ::std::weak_ptr<::SoundEvent>
const soundEvent,
483 ::std::string
const& eventName,
485 float fadeInDuration,
486 float fadeOutDuration
489 MCNAPI
void $unregisterLoop(uint64 handle,
bool hard);
491 MCNAPI
void $displayDebugStats(::std::string& debugOutputFormat)
const;
493 MCNAPI uint64 $getNewSoundHandle();
495 MCNAPI ::std::optional<::PlayingSoundAttributes> $tryGetPlayingSoundAttributes(uint64 handle)
const;
497 MCNAPI ::std::optional<::PlayingSoundAttributes>
500 MCNAPI ::std::optional<::LoopingSoundAttributes> $tryGetLoopingSoundAttributes(uint64 handle)
const;
502 MCNAPI uint64 $createRawUISoundStream(
int bitDepth,
int channels,
float samplingRate);
504 MCNAPI
void $closeRawUISoundStream(uint64 handle);
506 MCNAPI
void $playRawUISoundStream(uint64 handle);
508 MCNAPI
void $pauseRawUISoundStream(uint64 handle);
510 MCNAPI
void $feedRawUISoundStream(uint64 handle,
int samples,
float** pcm,
int channels);
512 MCNAPI
void $endRawUISoundStream(uint64 handle);
514 MCNAPI
void $setRawUISoundStreamVolume(uint64 handle,
float volume);
516 MCNAPI
void $flushRawUISoundStreamData(uint64 handle);
518 MCNAPI uint64 $playOnlineMusic(
519 ::std::string
const& eventName,
525 MCNAPI uint64 $playOnlineMusic(
526 ::std::string
const& eventName,
532 MCNAPI uint64 $playOnlineSound(
539 MCNAPI uint64 $playOnlineSound(