Source

A Source represents audio you can play back. You can do interesting things with Sources, like set the volume, pitch, and its position relative to the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources.

The Source controls (play/pause/etc) act according to the following state table.

Stopped Playing Paused
play() Play No change Play
stop() No change Stop + Rewind Stop + Rewind
pause() No change Pause No change
resume() No change No change Play
rewind() No change Rewind + Play Rewind + Pause

And for fans of flowcharts (note: omitted calls have no effect, rewind does).

SourceControls.png

Constructors

love.audio.newSource Creates a new Source from a file, SoundData, or Decoder.

Functions

Object:type Gets the type of the object as a string.
Object:typeOf Checks whether an object is of a certain type.
Source:clone Creates an identical copy of the Source in the stopped state. 0.9.1
Source:getAttenuationDistances Gets the reference and maximum attenuation distances of the Source. 0.9.0
Source:getChannels Gets the number of channels in the Source. 0.9.0
Source:getCone Gets the Source's directional volume cones. 0.9.0
Source:getDirection Gets the direction of the Source. 0.7.0
Source:getDistance Returns the reference and maximum distance of the source. 0.8.0 0.9.0
Source:getDuration Gets the duration of the Source. 0.10.0
Source:getPitch Gets the current pitch of the Source.
Source:getPosition Gets the position of the Source. 0.7.0
Source:getRolloff Returns the rolloff factor of the source. 0.8.0
Source:getType Gets the type (static or stream) of the Source. 0.10.0
Source:getVelocity Gets the velocity of the Source. 0.7.0
Source:getVolume Gets the current volume of the Source.
Source:getVolumeLimits Returns the volume limits of the source. 0.8.0
Source:isLooping Returns whether the Source will loop.
Source:isPaused Returns whether the Source is paused.
Source:isPlaying Returns whether the Source is playing. 0.9.0
Source:isRelative Gets whether the Source's position and direction are relative to the listener. 0.9.0
Source:isStatic Returns whether the Source is static. 0.7.0 0.10.0
Source:isStopped Returns whether the Source is stopped.
Source:pause Pauses a source. 0.7.0
Source:play Plays a source. 0.7.0
Source:resume Resumes a paused source. 0.7.0
Source:rewind Rewinds a source. 0.7.0
Source:seek Sets the currently playing position of the Source. 0.8.0
Source:setAttenuationDistances Sets the reference and maximum attenuation distances of the Source. 0.9.0
Source:setCone Sets the Source's directional volume cones. 0.9.0
Source:setDirection Sets the direction of the Source. 0.7.0
Source:setDistance Sets the reference and maximum distance of the source. 0.8.0 0.9.0
Source:setLooping Sets whether the Source should loop.
Source:setPitch Sets the pitch of the Source.
Source:setPosition Sets the position of the Source. 0.7.0
Source:setRelative Sets whether the Source's position and direction are relative to the listener. 0.9.0
Source:setRolloff Sets the rolloff factor. 0.8.0
Source:setVelocity Sets the velocity of the Source. 0.7.0
Source:setVolume Sets the current volume of the Source.
Source:setVolumeLimits Sets the volume limits of the source. 0.8.0
Source:stop Stops a source. 0.7.0
Source:tell Gets the currently playing position of the Source. 0.8.0

Supertypes

See Also


Source:setVolumeLimits

Source:setVolumeLimits Available since LÖVE 0.8.0 This function is not supported in earlier versions. Sets the volume limits of the source.

2017-03-21 15:53:30
Source:setRelative

Source:setRelative Available since LÖVE 0.9.0 This function is not supported in earlier versions. Sets whether the

2017-03-21 15:53:28
Source:isPlaying

Source:isPlaying Available since LÖVE 0.9.0 This function is not supported in earlier versions. Returns whether the Source is playing.

2017-03-21 15:53:21
Source:setVelocity

Source:setVelocity Available since LÖVE 0.7.0 This function is not supported in earlier versions. Sets the velocity of the Source. This

2017-03-21 15:53:29
Source:setDirection

Source:setDirection Available since LÖVE 0.7.0 This function is not supported in earlier versions. Sets the direction vector of the Source.

2017-03-21 15:53:26
Source:getType

Source:getType Available since LÖVE 0.10.0 This function is not supported in earlier versions. Gets the type (static or stream) of the Source

2017-03-21 15:53:18
Source:rewind

Source:rewind Available since LÖVE 0.7.0 This function is not supported in earlier versions. Rewinds a Source. Function

2017-03-21 15:53:24
Source:getPosition

Source:getPosition Available since LÖVE 0.7.0 This function is not supported in earlier versions. Gets the position of the Source.

2017-03-21 15:53:17
Source:setPosition

Source:setPosition Available since LÖVE 0.7.0 This function is not supported in earlier versions. Sets the position of the Source. Please note

2017-03-21 15:53:28
Source:getVolumeLimits

Source:getVolumeLimits Available since LÖVE 0.8.0 This function is not supported in earlier versions. Returns the volume limits of the source

2017-03-21 15:53:20