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.newSourceCreates a new Source from a file, SoundData, or Decoder.

Functions

Object:typeGets the type of the object as a string.
Object:typeOfChecks whether an object is of a certain type.
Source:cloneCreates an identical copy of the Source in the stopped state.Added since 0.9.1
Source:getAttenuationDistancesGets the reference and maximum attenuation distances of the Source.Added since 0.9.0
Source:getChannelsGets the number of channels in the Source.Added since 0.9.0
Source:getConeGets the Source's directional volume cones.Added since 0.9.0
Source:getDirectionGets the direction of the Source.Added since 0.7.0
Source:getDistanceReturns the reference and maximum distance of the source.Added since 0.8.0 Removed in 0.9.0
Source:getPitchGets the current pitch of the Source.
Source:getPositionGets the position of the Source.Added since 0.7.0
Source:getRolloffReturns the rolloff factor of the source.Added since 0.8.0
Source:getVelocityGets the velocity of the Source.Added since 0.7.0
Source:getVolumeGets the current volume of the Source.
Source:getVolumeLimitsReturns the volume limits of the source.Added since 0.8.0
Source:isLoopingReturns whether the Source will loop.
Source:isPausedReturns whether the Source is paused.
Source:isPlayingReturns whether the Source is playing.Added since 0.9.0
Source:isRelativeGets whether the Source's position and direction are relative to the listener.Added since 0.9.0
Source:isStaticReturns whether the Source is static.Added since 0.7.0
Source:isStoppedReturns whether the Source is stopped.
Source:pausePauses a source.Added since 0.7.0
Source:playPlays a source.Added since 0.7.0
Source:resumeResumes a paused source.Added since 0.7.0
Source:rewindRewinds a source.Added since 0.7.0
Source:seekSets the currently playing position of the Source.Added since 0.8.0
Source:setAttenuationDistancesSets the reference and maximum attenuation distances of the Source.Added since 0.9.0
Source:setConeSets the Source's directional volume cones.Added since 0.9.0
Source:setDirectionSets the direction of the Source.Added since 0.7.0
Source:setDistanceSets the reference and maximum distance of the source.Added since 0.8.0 Removed in 0.9.0
Source:setLoopingSets whether the Source should loop.
Source:setPitchSets the pitch of the Source.
Source:setPositionSets the position of the Source.Added since 0.7.0
Source:setRelativeSets whether the Source's position and direction are relative to the listener.Added since 0.9.0
Source:setRolloffSets the rolloff factor.Added since 0.8.0
Source:setVelocitySets the velocity of the Source.Added since 0.7.0
Source:setVolumeSets the current volume of the Source.
Source:setVolumeLimitsSets the volume limits of the source.Added since 0.8.0
Source:stopStops a source.Added since 0.7.0
Source:tellGets the currently playing position of the Source.Added since 0.8.0

Supertypes

See Also


Other Languages

Personal tools