Module sfx
A one-shot OGG Vorbis audio sample.
Sfx extends BoundObject
Properties
Properties.
Significant fields on an instance.
-
volume
-
Minimum
0, maximum 1
Class Methods
Class Methods.
Must be called on
Class, with a capital leading character.
e.g.
Class:method("foo")
-
Sfx:new (filename)
-
Create a new
Sfx by loading an OGG file
Parameters:
- filename
string
The filename of the OGG file
Returns:
Sfx
-
Sfx:oneshot (filename, volume, ended)
-
Helper function to immediately load and play a sound.
Parameters:
- filename
string
The filename of the OGG file
- volume
number
The volume to play the sound. Default
1.0
- ended
function
A callback that is fired when the Sfx ends
Returns:
Sfx
Instance Methods
Instance Methods.
Must be called on an instance of
Class.
e.g.
instance:method("foo")
-
sfx:play ()
-
Play the
Sfx
Returns:
nil
Hooks
Hooks.
Callbacks implemented in subclasses to customize behavior. Hooks are called
on individual instances.
-
ended (self)
-
Called when the
Music ends.
Parameters: