Source

A Source is an object representing a single sound. Currently ogg, wav, and mp3 formats are supported.

When a Source is playing, it will send audio to the speakers. Sources do not play automatically when they are created. Instead, the play, pause, and stop functions can be used to control when they should play.

Source:seek and Source:tell can be used to control the playback position of the Source. A Source can be set to loop when it reaches the end using Source:setLooping.

Constructors

lovr.audio.newSourceCreate a new Source.
Source:cloneCreate an identical copy of the Source.

Playback

Source:getDurationGet the duration of the Source.
Source:isLoopingCheck if the Source is looping.
Source:setLoopingSet whether or not the Source loops.
Source:pausePause the Source.
Source:playPlay the Source.
Source:isPlayingCheck if the Source is playing.
Source:seekSet the playback position of the Source.
Source:stopStop the Source.
Source:tellGet the playback position of the Source.
Source:getVolumeGet the volume of the Source.
Source:setVolumeSet the volume of the Source.

Spatial Effects

Source:getDirectivityGet the directivity of the Source.
Source:setDirectivitySet the directivity of the Source.
Source:isEffectEnabledCheck if an effect is enabled.
Source:setEffectEnabledEnable or disable an effect.
Source:getOrientationGet the orientation of the Source.
Source:setOrientationSet the orientation of the Source.
Source:getPoseGet the pose of the Source.
Source:setPoseSet the pose of the Source.
Source:getPositionGet the position of the Source.
Source:setPositionSet the position of the Source.
Source:getRadiusGet the radius of the Source.
Source:setRadiusSet the radius of the Source.

Utility

Source:cloneCreate an identical copy of the Source.
Source:getSoundGet the Sound object backing the Source.

See also