WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. API
  4. PawnLibs/sound/SND\ cacheSounds
Mission NodeSDK 6.2PawnAPI Reference

PawnLibs/sound/SND\ cacheSounds

PawnLibs/sound/SND\ cacheSounds Summary Force platform to cache application sounds. Synopsis native SND cacheSounds(soundList[], size = sizeof(soundList)); D...

API / SDK 6.2 / Pawn / API Reference

PawnLibs/sound/SND_cacheSounds

Summary

Force platform to cache application sounds.

Synopsis

PawnLibs/sound/SND\ cacheSounds
PAWN
1native SND_cacheSounds(soundList[], size = sizeof(soundList));
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Description

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.

Inputs

  • soundList - array with IDs of sounds to cache
  • size - size of soundList array

Return value

Number of cached sounds or negative value if an error happened. Error codes:

  • -1 invalid function arguments count
  • -2 invalid soundList array

PawnLibs/sound/SND_getAssetId

Summary

Get a sound ID by the filename.

Synopsis

PawnLibs/sound/SND\ cacheSounds
PAWN
1native SND_getAssetId(const name[]);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Description

Usually an application uses sound IDs to start playback. TBD: SDK should have way to specify ID for sound/image. But sometimes IDs are unknown, e.g. in common libraries, or they change rapidly during development. This interface can be used to get an ID of the sound by its filename in the runtime. Recommended way is to use this function in initialization code. Maximum asset name length is 15 characters remaining symbols are truncated during lookup.

Inputs

  • name - sound filename for which ID is requested

Return value

The ID of sound with a given filename or -1 in case of error.

See also

  • SND_play()
  • ON_Init()

PawnLibs/sound/SND_getAssetsCount

Summary

Get the total count of sound assets.

Synopsis

PawnLibs/sound/SND\ cacheSounds
PAWN
1native SND_getAssetsCount();
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Return value

Number of sound assets.

PawnLibs/sound/SND_isPlaying

Summary

Check if audio is playing.

Synopsis

PawnLibs/sound/SND\ cacheSounds
PAWN
1native bool:SND_isPlaying();
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Return value

True if audio is playing, false otherwise.

PawnLibs/sound/SND_play

Summary

Play sound by ID.

Synopsis

PawnLibs/sound/SND\ cacheSounds
PAWN
1native SND_play(const id, const volume);
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Description

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

Inputs

  • id - an ID of sound to play
  • volume - volume of sound in percents to play, range 0..100

See also

  • SND_getAssetId()

PawnLibs/sound/SND_stop

Summary

Stop playing sound if any.

Synopsis

PawnLibs/sound/SND\ cacheSounds
PAWN
1native SND_stop();
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

See also

  • SND_play()

Jump Grid

On This Page

PawnLibs/sound/SND\ getAssetIdPawnLibs/sound/SND\ getAssetsCountPawnLibs/sound/SND\ isPlayingPawnLibs/sound/SND\ playPawnLibs/sound/SND\ stop
Context Rail

Related nodes

PawnLibs/wowcore/SELF\ ID
API / SDK 6.2 / Pawn / API Reference
PawnLibs/graphics
API / SDK 6.2 / Pawn / API Reference
PawnLibs/topology
API / SDK 6.2 / Pawn / API Reference
PawnLibs/motion\ sensor
API / SDK 6.2 / Pawn / API Reference
Previous Node
PawnLibs/graphics
API / SDK 6.2 / Pawn / API Reference
Next Node
PawnLibs/topology
API / SDK 6.2 / Pawn / API Reference