SDK 6.3/C++/Sound
Jump to navigation
Jump to search
Official WOWCube SDK documentation. SDK 6.3, C++ (WebAssembly) API. Signatures are extracted from the canonical SDK headers shipped with the WOWCube Development Kit; the headers remain authoritative.
SDK 6.3 · PAWN API: Core ·
Graphics ·
Topology ·
Sound ·
Motion Sensor ·
Leaderboard ·
Splash Screen ·
Physics ·
Network ·
Save ·
Scramble ·
Logging
C++: Native API · Application · GFX Engine · Rust: Rust API (experimental) · Changelog
← SDK 6.3 · C++ Native API / Sound
Sound asset playback and caching.
Shared types, enums and constants are listed on the Native API overview.
Contents
Minimal example
Play a packed sound asset:
soundID_t sfx = SND_getAssetId("hit.wav");
SND_play(sfx, 100);
Functions
SND_getAssetId
Syntax:
i32_t SND_getAssetId(const char* soundName)
Description:
- Get a sound ID by the filename.
Return values:
- The ID of sound with a given filename or -1 in case of error.
History:
- v5.0 - renamed from SND_getId() to SND_getAssetId()
- v6.0 - truncate asset name in WASM API
SND_play
Syntax:
i32_t SND_play(soundID_t soundID, u32_t volume)
Description:
- Play sound by ID.
- Play any sound by its ID. Platform does not support audio mixing, so
- previously playing sound will be stopped if it has not yet finished.
- Supported audio formats:
- WAV
- MP3
- MIDI
SND_cacheSounds
Syntax:
i32_t SND_cacheSounds(soundID_t* soundIDs, u32_t count)
Description:
- Force platform to cache application sounds.
- Platform automatically reads and caches sounds from flash when the
- application plays a sound. Flash operations are synchronous and may cause
- delays especially when reading large portions of data. To prevent the
- application from lags it is possible to cache sound data in advance.
- However if application requests to play a non-cached sound and there is not
- enough memory then oldest accessed sounds will be removed from cache. Also
- there is a limit of 256 for a total number of cached sounds.
Return values:
- Number of cached sounds or negative value if an error happened. Error
- codes:
- * -1 invalid function arguments count
- * -2 invalid soundList array
History:
- v5.0 - moved from appCtrl module to sound
SND_isPlaying
Syntax:
i32_t SND_isPlaying()
Description:
- Check if audio is playing.
Return values:
- True if audio is playing, false otherwise.
History:
- v6.0 - added
SND_stop
Syntax:
i32_t SND_stop()
Description:
- Stop playing sound if any.
History:
- v6.0 - added
SND_getAssetsCount
Syntax:
i32_t SND_getAssetsCount()
Description:
- Get the total count of sound assets.
Return values:
- Number of sound assets.
History:
- v6.0 - added