Difference between revisions of "Source:queue"

(Created page)
 
m (Notes: reordered sample code to make more sense)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{newin|[[0.11.0]]|110|type=function}}
+
{{newin|[[11.0]]|110|type=function}}
 
Queues SoundData for playback in a [[love.audio.newQueueableSource|queueable Source]].
 
Queues SoundData for playback in a [[love.audio.newQueueableSource|queueable Source]].
  
 
This method requires the Source to be created via [[love.audio.newQueueableSource]].
 
This method requires the Source to be created via [[love.audio.newQueueableSource]].
 +
 +
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
success = Source:queue( soundData, length )
 +
</source>
 +
=== Arguments ===
 +
{{param|SoundData|soundData|The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's.}}
 +
{{param|number|length ([[Data:getSize|sounddata:getSize()]])|Length in bytes to queue.}}
 +
=== Returns ===
 +
{{param|boolean|success|True if the data was successfully queued for playback, false if there were no [[Source:getFreeBufferCount|available buffers]] to use for queueing.}}
 +
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
success = Source:queue( sounddata )
+
success = Source:queue( soundData, offset, length )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|SoundData|sounddata|The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's.}}
+
{{param|SoundData|soundData|The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's.}}
 +
{{param|number|offset|Starting position in bytes to queue.}}
 +
{{param|number|length|Length in bytes to queue starting from specified offset.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|boolean|success|True if the data was successfully queued for playback, false if there were no [[Source:getFreeBufferCount|available buffers]] to use for queueing.}}
 
{{param|boolean|success|True if the data was successfully queued for playback, false if there were no [[Source:getFreeBufferCount|available buffers]] to use for queueing.}}
 +
 +
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
success = Source:queue( rawData, offset, length, sampleRate, bitDepth, channels )
 +
</source>
 +
=== Arguments ===
 +
{{param|light userdata|rawData|A pointer returns from Data:getPointer}}
 +
{{param|number|offset|Starting position in bytes to queue.}}
 +
{{param|number|length|Length in bytes to queue starting from specified offset.}}
 +
{{param|number|sampleRate|Sample rate.}}
 +
{{param|number|bitDepth|Bit depth.}}
 +
{{param|number|channels|Channel count.}}
 +
=== Returns ===
 +
{{param|boolean|success|True if the data was successfully queued for playback, false if there were no [[Source:getFreeBufferCount|available buffers]] to use for queueing.}}
 +
 +
== Notes ==
 +
To convert sample unit to bytes, multiply the sample unit by <code>SoundData:getChannelCount() * SoundData:getBitDepth() / 8</code>.
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::Source]]
 
* [[parent::Source]]

Latest revision as of 12:38, 13 February 2022

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

Queues SoundData for playback in a queueable Source.

This method requires the Source to be created via love.audio.newQueueableSource.

Function

Synopsis

success = Source:queue( soundData, length )

Arguments

SoundData soundData
The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's.
number length (sounddata:getSize())
Length in bytes to queue.

Returns

boolean success
True if the data was successfully queued for playback, false if there were no available buffers to use for queueing.

Function

Synopsis

success = Source:queue( soundData, offset, length )

Arguments

SoundData soundData
The data to queue. The SoundData's sample rate, bit depth, and channel count must match the Source's.
number offset
Starting position in bytes to queue.
number length
Length in bytes to queue starting from specified offset.

Returns

boolean success
True if the data was successfully queued for playback, false if there were no available buffers to use for queueing.

Function

Synopsis

success = Source:queue( rawData, offset, length, sampleRate, bitDepth, channels )

Arguments

light userdata rawData
A pointer returns from Data:getPointer
number offset
Starting position in bytes to queue.
number length
Length in bytes to queue starting from specified offset.
number sampleRate
Sample rate.
number bitDepth
Bit depth.
number channels
Channel count.

Returns

boolean success
True if the data was successfully queued for playback, false if there were no available buffers to use for queueing.

Notes

To convert sample unit to bytes, multiply the sample unit by SoundData:getChannelCount() * SoundData:getBitDepth() / 8.

See Also

Other Languages