22class SoundSystemBase {
32 SoundSystemBase& operator=(SoundSystemBase
const&);
33 SoundSystemBase(SoundSystemBase
const&);
40 virtual ~SoundSystemBase() =
default;
42 virtual ~SoundSystemBase();
45 virtual bool preinit();
49 virtual void destroy();
53 virtual void setAsyncLoadFunction(::std::function<
void(
::SoundItem const&, ::std::function<
void()>)> asyncLoad);
55 virtual void enable(
bool status);
57 virtual void mute(
bool muted);
59 virtual bool addListener(
int const handle);
61 virtual void removeListener(
int const handle);
63 virtual void setListenerDirection(
int const listenerHandle, ::glm::vec3
const& forward, ::glm::vec3
const& up);
65 virtual void setListenerPos(
int const listenerHandle,
float x,
float y,
float z);
67 virtual void setListenerVelocity(
int const listenerHandle,
float x,
float y,
float z);
69 virtual void setMainVolume(
float vol);
71 virtual void setMusicVolume(
float vol);
73 virtual void setSoundVolume(
float vol);
75 virtual void setSoundCategoryVolume(::std::string
const& category,
float vol);
77 virtual void setTTSVolume(
float vol);
79 virtual bool load(
::Core::Path const& soundName,
bool isStream);
81 virtual bool loadRawFromMemory(
90 virtual bool loadFromMemory(
::Core::Path const& soundName,
char const* data, uint64 dataSize);
92 virtual bool loadExternalEvent(::std::string
const& soundName);
96 virtual void unloadAll();
100 virtual bool usesSoundBanks();
102 virtual void loadSoundBank(::std::string
const& name,
bool isNonBlocking);
104 virtual void unloadSoundBank(::std::string
const& name);
106 virtual void play(::std::string
const& name);
108 virtual void pause(::std::string
const& name);
110 virtual void stop(::std::string
const& name);
112 virtual void stop(uint64 handle);
114 virtual uint64 playEvent(
::SoundEvent const& soundEvent, ::std::string
const& eventName,
float volume,
float pitch);
116 virtual uint64 playEventAt(
118 ::std::string
const& eventName,
126 virtual uint64 playAt(
129 ::std::string
const& eventName,
139 bool useLegacyMaxDistance,
143 virtual uint64 playEventAttached(
145 ::std::string
const& eventName,
149 virtual bool isPlayingSound(uint64 handle)
const;
151 virtual void fadeOut(uint64 handle,
float duration)
const;
153 virtual void playMusic(::std::string
const& eventName,
::SoundItem const& soundItem);
155 virtual bool isPlayingMusicEvent(::std::string
const& eventName)
const;
159 virtual bool isLoadingMusic()
const;
161 virtual void cancelLoadMusic();
163 virtual ::Core::PathBuffer<::std::string>
const& getCurrentlyPlayingMusicName()
const;
165 virtual ::std::string getCurrentlyPlayingEventName()
const;
167 virtual void stopMusic();
169 virtual void stopRecords();
171 virtual void stopAllSounds();
173 virtual void pauseAllPlayingSounds();
175 virtual void resumeAllPreviouslyPlayingSounds();
177 virtual void fadeMusicOut(
float time);
179 virtual bool isMusicChannelPlaying()
const;
181 virtual void pauseMusic(
bool state);
183 virtual void update(
float elapsedTime);
185 virtual uint64 registerLoop(
187 ::std::weak_ptr<::SoundEvent>
const soundEvent,
188 ::std::string
const& eventName,
190 float fadeInDuration,
191 float fadeOutDuration
194 virtual void unregisterLoop(uint64 handle,
bool hard);
196 virtual void displayDebugStats(::std::string& debugOutputFormat)
const;
198 virtual void startSnapshot(::std::string
const& name);
200 virtual void stopSnapshot(::std::string
const& name);
202 virtual void stopAllSnapshots();
204 virtual uint64 getNewSoundHandle();
206 virtual ::std::optional<::PlayingSoundAttributes> tryGetPlayingSoundAttributes(uint64 handle)
const;
208 virtual ::std::optional<::LoopingSoundAttributes> tryGetLoopingSoundAttributes(uint64 handle)
const;
221 MCNAPI
bool $preinit();
225 MCNAPI
void $destroy();
229 MCNAPI
void $setAsyncLoadFunction(::std::function<
void(
::SoundItem const&, ::std::function<
void()>)> asyncLoad);
231 MCNAPI
void $enable(
bool status);
233 MCNAPI
void $mute(
bool muted);
235 MCNAPI
bool $addListener(
int const handle);
237 MCNAPI
void $removeListener(
int const handle);
239 MCNAPI
void $setListenerDirection(
int const listenerHandle, ::glm::vec3
const& forward, ::glm::vec3
const& up);
241 MCNAPI
void $setListenerPos(
int const listenerHandle,
float x,
float y,
float z);
243 MCNAPI
void $setListenerVelocity(
int const listenerHandle,
float x,
float y,
float z);
245 MCNAPI
void $setMainVolume(
float vol);
247 MCNAPI
void $setMusicVolume(
float vol);
249 MCNAPI
void $setSoundVolume(
float vol);
251 MCNAPI
void $setSoundCategoryVolume(::std::string
const& category,
float vol);
253 MCNAPI
void $setTTSVolume(
float vol);
255 MCNAPI
bool $load(
::Core::Path const& soundName,
bool isStream);
257 MCNAPI
bool $loadRawFromMemory(
262 int defaultfrequency,
266 MCNAPI
bool $loadFromMemory(
::Core::Path const& soundName,
char const* data, uint64 dataSize);
268 MCNAPI
bool $loadExternalEvent(::std::string
const& soundName);
272 MCNAPI
void $unloadAll();
276 MCNAPI
bool $usesSoundBanks();
278 MCNAPI
void $loadSoundBank(::std::string
const& name,
bool isNonBlocking);
280 MCNAPI
void $unloadSoundBank(::std::string
const& name);
282 MCNAPI
void $play(::std::string
const& name);
284 MCNAPI
void $pause(::std::string
const& name);
286 MCNAPI
void $stop(::std::string
const& name);
288 MCNAPI
void $stop(uint64 handle);
290 MCNAPI uint64 $playEvent(
::SoundEvent const& soundEvent, ::std::string
const& eventName,
float volume,
float pitch);
292 MCNAPI uint64 $playEventAt(
294 ::std::string
const& eventName,
302 MCNAPI uint64 $playAt(
305 ::std::string
const& eventName,
315 bool useLegacyMaxDistance,
319 MCNAPI uint64 $playEventAttached(
321 ::std::string
const& eventName,
325 MCNAPI
bool $isPlayingSound(uint64 handle)
const;
327 MCNAPI
void $fadeOut(uint64 handle,
float duration)
const;
329 MCNAPI
void $playMusic(::std::string
const& eventName,
::SoundItem const& soundItem);
331 MCNAPI
bool $isPlayingMusicEvent(::std::string
const& eventName)
const;
335 MCNAPI
bool $isLoadingMusic()
const;
337 MCNAPI
void $cancelLoadMusic();
339 MCNAPI ::Core::PathBuffer<::std::string>
const& $getCurrentlyPlayingMusicName()
const;
341 MCNAPI ::std::string $getCurrentlyPlayingEventName()
const;
343 MCNAPI
void $stopMusic();
345 MCNAPI
void $stopRecords();
347 MCNAPI
void $stopAllSounds();
349 MCNAPI
void $pauseAllPlayingSounds();
351 MCNAPI
void $resumeAllPreviouslyPlayingSounds();
353 MCNAPI
void $fadeMusicOut(
float time);
355 MCNAPI
bool $isMusicChannelPlaying()
const;
357 MCNAPI
void $pauseMusic(
bool state);
359 MCNAPI
void $update(
float elapsedTime);
361 MCNAPI uint64 $registerLoop(
363 ::std::weak_ptr<::SoundEvent>
const soundEvent,
364 ::std::string
const& eventName,
366 float fadeInDuration,
367 float fadeOutDuration
370 MCNAPI
void $unregisterLoop(uint64 handle,
bool hard);
372 MCNAPI
void $displayDebugStats(::std::string& debugOutputFormat)
const;
374 MCNAPI
void $startSnapshot(::std::string
const& name);
376 MCNAPI
void $stopSnapshot(::std::string
const& name);
378 MCNAPI
void $stopAllSnapshots();
380 MCNAPI uint64 $getNewSoundHandle();
382 MCNAPI ::std::optional<::PlayingSoundAttributes> $tryGetPlayingSoundAttributes(uint64 handle)
const;
384 MCNAPI ::std::optional<::LoopingSoundAttributes> $tryGetLoopingSoundAttributes(uint64 handle)
const;