sound.inc
sound.inc
CPP1/****n* PawnLibs/sound/SND_getAssetId2 * Summary3 * Get a sound ID by the filename.4 * Synopsis5 */6native SND_getAssetId(const name[]);7/*8 * Description9 * Usually an application uses sound IDs to start playback. TBD: SDK should10 * have way to specify ID for sound/image. But sometimes IDs are unknown, e.g.11 * in common libraries, or they change rapidly during development. This12 * interface can be used to get an ID of the sound by its filename in the13 * runtime. Recommended way is to use this function in initialization code.14 * Maximum asset name length is 15 characters remaining symbols are truncated15 * during lookup.16 * Inputs17 * * name - sound filename for which ID is requested18 * Return value19 * The ID of sound with a given filename or -1 in case of error.20 * See also21 * * SND_play()22 * * ON_Init()23 * History24 * * v5.0 - renamed from SND_getId() to SND_getAssetId()25 * * v6.0 - truncate asset name in WASM API26 ******/2728/****n* PawnLibs/sound/SND_play29 * Summary30 * Play sound by ID.31 * Synopsis32 */33native SND_play(const id, const volume);34/*35 * Description36 * Play any sound by its ID. Platform does not support audio mixing, so37 * previously playing sound will be stopped if it has not yet finished.38 * Supported audio formats:39 * * WAV40 * * MP341 * * MIDI42 * Inputs43 * * id - an ID of sound to play44 * * volume - volume of sound in percents to play, range 0..10045 * See also46 * * SND_getAssetId()47 ******/4849/****n* PawnLibs/sound/SND_cacheSounds50 * Summary51 * Force platform to cache application sounds.52 * Synopsis53 */54native SND_cacheSounds(soundList[], size = sizeof(soundList));55/*56 * Description57 * Platform automatically reads and caches sounds from flash when the58 * application plays a sound. Flash operations are synchronous and may cause59 * delays especially when reading large portions of data. To prevent the60 * application from lags it is possible to cache sound data in advance.61 * However if application requests to play a non-cached sound and there is not62 * enough memory then oldest accessed sounds will be removed from cache. Also63 * there is a limit of 256 for a total number of cached sounds.64 * Inputs65 * * soundList - array with IDs of sounds to cache66 * * size - size of soundList array67 * Return value68 * Number of cached sounds or negative value if an error happened. Error69 * codes:70 * * -1 invalid function arguments count71 * * -2 invalid soundList array72 * History73 * * v5.0 - moved from appCtrl module to sound74 ******/7576/****n* PawnLibs/sound/SND_isPlaying77 * Summary78 * Check if audio is playing.79 * Synopsis80 */81native bool:SND_isPlaying();82/*83 * Return value84 * True if audio is playing, false otherwise.85 * History86 * * v6.0 - added87 ******/8889/****n* PawnLibs/sound/SND_stop90 * Summary91 * Stop playing sound if any.92 * Synopsis93 */94native SND_stop();95/*96 * See also97 * * SND_play()98 * History99 * * v6.0 - added100 ******/101102/****n* PawnLibs/sound/SND_getAssetsCount103 * Summary104 * Get the total count of sound assets.105 * Synopsis106 */107native SND_getAssetsCount();108/*109 * Return value110 * Number of sound assets.111 * History112 * * v6.0 - added113 ******/114115
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.