Difference between revisions of "Source"
(Query updated to Concept:Current.) |
|||
(10 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
A Source represents audio you can play back. | 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. | + | 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 is internally referenced as long as it is playing. | ||
+ | |||
+ | The Source controls (play/pause/stop) act according to the following state table. | ||
+ | {| class="wikitable" | ||
+ | ! !! Playing !! Paused | ||
+ | |- | ||
+ | | play() || No change || Play | ||
+ | |- | ||
+ | | stop() || Pause + Rewind || Rewind | ||
+ | |- | ||
+ | | pause() || Pause || No change | ||
+ | |} | ||
+ | And for fans of flowcharts (note: omitted calls have no effect, stopping always rewinds). | ||
+ | |||
+ | [[File:NewSourceControls.png]] | ||
+ | |||
== Constructors == | == Constructors == | ||
{{#ask: [[Category:Functions]] [[Constructs::Source]] [[Concept:Current]] | {{#ask: [[Category:Functions]] [[Constructs::Source]] [[Concept:Current]] | ||
| headers=hide | | headers=hide | ||
| default=None. | | default=None. | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
| ?Description | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
}} | }} | ||
== Functions == | == Functions == | ||
{{#ask: [[Category:Functions]] [[parent::Source||Object]] [[Concept:Current]] | {{#ask: [[Category:Functions]] [[parent::Source||Object]] [[Concept:Current]] | ||
| headers=hide | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | limit=100 | ||
| ?Description | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | }} | ||
+ | |||
+ | == Enums == | ||
+ | {{#ask: [[Category:Enums]] [[parent::Source]] [[Concept:Current]] | ||
+ | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
}} | }} | ||
== Supertypes == | == Supertypes == | ||
− | [[Object]] | + | * [[parent::Object]] |
== See Also == | == See Also == | ||
* [[parent::love.audio]] | * [[parent::love.audio]] |
Latest revision as of 16:11, 5 December 2020
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 is internally referenced as long as it is playing.
The Source controls (play/pause/stop) act according to the following state table.
Playing | Paused | |
---|---|---|
play() | No change | Play |
stop() | Pause + Rewind | Rewind |
pause() | Pause | No change |
And for fans of flowcharts (note: omitted calls have no effect, stopping always rewinds).
Constructors
love.audio.newQueueableSource | Creates a new Source usable for real-time generated sound playback with Source:queue. | 11.0 | |
love.audio.newSource | Creates a new Source from a file, SoundData, or Decoder. |
Functions
Object:release | Immediately destroys the object's Lua reference. | 11.0 | |
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:getActiveEffects | Gets a list of the Source's active effect names. | 11.0 | |
Source:getAirAbsorption | Gets the amount of air absorption applied to the Source. | 11.2 | |
Source:getAttenuationDistances | Gets the reference and maximum attenuation distances of the Source. | 0.9.0 | |
Source:getChannelCount | Gets the number of channels in the Source. | 11.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:getEffect | Retrieve filter settings associated to a specific effect. | 11.0 | |
Source:getFilter | Gets the filter settings currently applied to the Source. | 11.0 | |
Source:getFreeBufferCount | Gets the number of free buffer slots of a queueable Source. | 11.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 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. | 0.7.1 | 11.0 |
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. | 11.0 | |
Source:pause | Pauses a source. | 0.7.0 | |
Source:play | Plays a source. | 0.7.0 | |
Source:queue | Queues SoundData for playback in a queueable Source. | 11.0 | |
Source:resume | Resumes a paused source. | 0.7.0 | 11.0 |
Source:rewind | Rewinds a source. | 0.7.0 | 11.0 |
Source:seek | Sets the currently playing position of the Source. | 0.8.0 | |
Source:setAirAbsorption | Sets the amount of air absorption applied to the Source. | 11.2 | |
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:setEffect | Applies an audio effect to the Source. | 11.0 | |
Source:setFilter | Sets a low-pass, high-pass, or band-pass filter to apply when playing the Source. | 11.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 |
Enums
FilterType | Types of filters for Sources. | 11.0 | |
SourceType | Types of audio sources. |
Supertypes
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info