Sound add

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

sound_id = sound_add(filename, volume)

sound_add is used to load a sound file. Only .wav files are accepted. The sound is also stored in memory for further references.

Return value

Argument Type Description
sound_id ID This value can be used for further reference. Functions such as sound_play and sound_stop can use this sound_id. Its good practice to store this sound_id in your logic code.

Arguments

# Argument Type Description
1 filename String This is the filename of the sound you wich to load. Only .wav files are supported.
2 volume Number (Optional) Volume of the sound. Ranges from 0.0 (off) to 1.0 (loudest)

Example

-- Load sounds
mysound1 = sound_add("mysound1.wav")

-- Play the sound
sound_play(mysound1)