PawnLibs/sound/SND_cacheSounds
Summary
Force platform to cache application sounds.
Synopsis
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
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
Return value
Number of sound assets.
PawnLibs/sound/SND_isPlaying
Summary
Check if audio is playing.
Synopsis
Return value
True if audio is playing, false otherwise.
PawnLibs/sound/SND_play
Summary
Play sound by ID.
Synopsis
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
See also
- SND_play()