Difference between revisions of "SDK 6.3/PAWN/Sound"

From WowWiki
Jump to navigation Jump to search
(Official WOWCube SDK 6.3 documentation (automated publish from SDK headers))
 
(Official WOWCube SDK 6.3 documentation (automated publish from SDK headers))
Line 1: Line 1:
 
{{notice|'''Official WOWCube SDK documentation.''' SDK 6.3, PAWN API. Generated from the canonical SDK headers — do not edit by hand; regenerate from source.}}
 
{{notice|'''Official WOWCube SDK documentation.''' SDK 6.3, PAWN API. Generated from the canonical SDK headers — do not edit by hand; regenerate from source.}}
 +
 +
{{SDK 6.3 nav}}
 +
 +
''← [[SDK 6.3]] · PAWN / Sound''
  
 
==Functions==
 
==Functions==
Line 17: Line 21:
 
: The ID of sound with a given filename or -1 in case of error.
 
: The ID of sound with a given filename or -1 in case of error.
  
See also: SND_play(), ON_Init()
+
See also: [[#SND_play|SND_play()]], [[SDK 6.3/PAWN/Core#ON_Init|ON_Init()]]
  
 
History:
 
History:
Line 42: Line 46:
 
:: volume of sound in percents to play, range 0..100
 
:: volume of sound in percents to play, range 0..100
  
See also: SND_getAssetId()
+
See also: [[#SND_getAssetId|SND_getAssetId()]]
  
 
===SND_cacheSounds===
 
===SND_cacheSounds===
Line 93: Line 97:
 
: Stop playing sound if any.
 
: Stop playing sound if any.
  
See also: SND_play()
+
See also: [[#SND_play|SND_play()]]
  
 
History:
 
History:
Line 129: Line 133:
 
:: size of the array snd
 
:: size of the array snd
  
See also: PlayLoopRandomSound()
+
See also: [[#PlayLoopRandomSound|PlayLoopRandomSound()]]
  
 
===PlayLoopRandomSound===
 
===PlayLoopRandomSound===
Line 153: Line 157:
 
:: size of the array snd
 
:: size of the array snd
  
See also: PlayRandomSound()
+
See also: [[#PlayRandomSound|PlayRandomSound()]]
  
 
[[Category:SDK 6.3]]
 
[[Category:SDK 6.3]]
 
[[Category:PAWN API]]
 
[[Category:PAWN API]]

Revision as of 19:36, 25 July 2026

Official WOWCube SDK documentation. SDK 6.3, PAWN API. Generated from the canonical SDK headers — do not edit by hand; regenerate from source.

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 · PAWN / Sound

Functions

SND_getAssetId

Syntax:

native SND_getAssetId(const name[]);

Description:

Get a sound ID by the filename.

Arguments:

name
sound filename for which ID is requested

Return values:

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

See also: SND_play(), ON_Init()

History:

v5.0 - renamed from SND_getId() to SND_getAssetId()
v6.0 - truncate asset name in WASM API

SND_play

Syntax:

native SND_play(const id, const 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

Arguments:

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

See also: SND_getAssetId()

SND_cacheSounds

Syntax:

native SND_cacheSounds(soundList[], size = sizeof(soundList));

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.

Arguments:

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

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:

native bool:SND_isPlaying();

Description:

Check if audio is playing.

Return values:

True if audio is playing, false otherwise.

History:

v6.0 - added

SND_stop

Syntax:

native SND_stop();

Description:

Stop playing sound if any.

See also: SND_play()

History:

v6.0 - added

SND_getAssetsCount

Syntax:

native SND_getAssetsCount();

Description:

Get the total count of sound assets.

Return values:

Number of sound assets.

History:

v6.0 - added

PlayRandomSound

Syntax:

stock bool:PlayRandomSound(const snd[], const volume, const bool: stopPlaying = true, size = sizeof(snd))

Description:

Play random sound from an array.
Play random sound from an array.

Arguments:

snd
the array of sounds from which the sound will be selected
volume
sound volume
stopPlaying
stop sound playback if it is being played
size
size of the array snd

See also: PlayLoopRandomSound()

PlayLoopRandomSound

Syntax:

stock PlayLoopRandomSound(const snd[], const volume, const delayMin, const delayMax, dt, size = sizeof(snd))

Description:

Play random sound from an array in a loop with a specified delay range.
Play random sound from an array in a loop with a specified delay range.

Arguments:

snd
the array of sounds from which the sound will be selected
volume
sound volume
delayMin
minimum delay
delayMax
maximum delay
dt
delta time
size
size of the array snd

See also: PlayRandomSound()