Difference between revisions of "love.audio.newQueueableSource"

m
(Specify what queueable sources do and link to Source at the beginning.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{newin|[[0.11.0]]|110|type=function}}
+
{{newin|[[11.0]]|110|type=function}}
Creates a new Source usable for real-time generated sound playback with [[Source:queue]].
+
Creates a new [[Source]] usable for real-time generated sound playback with [[Source:queue]].
 +
 
 +
Queueable sources allow [[SoundData]] objects to be played seamlessly one after another, without the need to wait for an update cycle.
 
  {{newobjectnotice}}
 
  {{newobjectnotice}}
 
== Function ==
 
== Function ==
Line 11: Line 13:
 
{{param|number|bitdepth|Bits per sample (8 or 16).}}
 
{{param|number|bitdepth|Bits per sample (8 or 16).}}
 
{{param|number|channels|1 for mono or 2 for stereo.}}
 
{{param|number|channels|1 for mono or 2 for stereo.}}
{{param|number|buffercount (0)|The number of buffers that can be queued up at any given time with [[Source:queue]]. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified.}}
+
{{param|number|buffercount (8)|The number of buffers that can be queued up at any given time with [[Source:queue]]. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified.}}
 +
 
 
=== Returns ===
 
=== Returns ===
 
{{param|Source|source|The new Source usable with [[Source:queue]].}}
 
{{param|Source|source|The new Source usable with [[Source:queue]].}}

Latest revision as of 14:22, 2 October 2022

Available since LÖVE 11.0
This function is not supported in earlier versions.

Creates a new Source usable for real-time generated sound playback with Source:queue.

Queueable sources allow SoundData objects to be played seamlessly one after another, without the need to wait for an update cycle.

O.png This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!  



Function

Synopsis

source = love.audio.newQueueableSource( samplerate, bitdepth, channels, buffercount )

Arguments

number samplerate
Number of samples per second when playing.
number bitdepth
Bits per sample (8 or 16).
number channels
1 for mono or 2 for stereo.
number buffercount (8)
The number of buffers that can be queued up at any given time with Source:queue. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified.

Returns

Source source
The new Source usable with Source:queue.

Notes

The sample rate, bit depth, and channel count of any SoundData used with Source:queue must match the parameters given to this constructor.

See Also

Other Languages