Audio Module

From SolarStrike wiki
Jump to: navigation, search

load

resource audio.load(string filename)

Load a sound file and returns the resource. Returns nil on failure.


unload

audio.unload(userdata resource)

Unloads an audio resource and sets its buffer & sources to empty (AL_NONE).


play

audio.play(userdata resource)

Plays a loaded audio resource.


stop

audio.stop(userdata resource)

Stops an audioresource (if it is playing).


pause

audio.pause(userdata resource)

Pause an audio resource (if it is playing).


getState

string audio.getState(userdata resource)

Returns the state of an audioresource as a string. The string will be one of these values: initial, playing, paused, stopped, unknown


setLooping

audio.setLooping(userdata resource, boolean looping)

Sets the "looping" state for an audio resource; true = loop it, false = no looping.


setVolume

audio.setVolume(userdata resource, number volume)

Sets the volume for an audio resource. 0 = no volume, 1 = full volume.