Source

Edit

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:getPitchGet the pitch of the Source.
Source:getVolumeGet the volume of the Source.
Source:isLoopingCheck if the Source is looping.
Source:isPlayingCheck if the Source is playing.
Source:pausePause the Source.
Source:playPlay the Source.
Source:seekSet the playback position of the Source.
Source:setLoopingSet whether or not the Source loops.
Source:setPitchSet the pitch of the Source.
Source:setVolumeSet the volume of the Source.
Source:stopStop the Source.
Source:tellGet the playback position of the Source.

Effects

Source:getDirectivityGet the directivity of the Source.
Source:getOrientationGet the orientation of the Source.
Source:getPoseGet the pose of the Source.
Source:getPositionGet the position of the Source.
Source:getRadiusGet the radius of the Source.
Source:isEffectEnabledCheck if an effect is enabled.
Source:isSpatialCheck if the Source is spatial.
Source:setDirectivitySet the directivity of the Source.
Source:setEffectEnabledEnable or disable an effect.
Source:setOrientationSet the orientation of the Source.
Source:setPoseSet the pose of the Source.
Source:setPositionSet the position 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