summaryrefslogtreecommitdiff
path: root/meta/3rd/love2d/library/love.sound.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-20 17:06:06 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-20 17:06:06 +0800
commit002e0c1673fdc5bd76331aaa1359cbb0925dad2e (patch)
tree6cbd6e62f3119798f300c2b67927677ae0dceaaa /meta/3rd/love2d/library/love.sound.lua
parent4bad35e608179e74c9ce186fa2038573055e574b (diff)
downloadlua-language-server-002e0c1673fdc5bd76331aaa1359cbb0925dad2e.zip
update
Diffstat (limited to 'meta/3rd/love2d/library/love.sound.lua')
-rw-r--r--meta/3rd/love2d/library/love.sound.lua88
1 files changed, 85 insertions, 3 deletions
diff --git a/meta/3rd/love2d/library/love.sound.lua b/meta/3rd/love2d/library/love.sound.lua
index e44eabfa..75c2923a 100644
--- a/meta/3rd/love2d/library/love.sound.lua
+++ b/meta/3rd/love2d/library/love.sound.lua
@@ -4,9 +4,9 @@ love.sound = {}
---
---Attempts to find a decoder for the encoded sound data in the specified file.
---
----@param file File # The file with encoded sound data.
+---@param file love.sound.File # The file with encoded sound data.
---@param buffer number # The size of each decoded chunk, in bytes.
----@return Decoder decoder # A new Decoder object.
+---@return love.sound.Decoder decoder # A new Decoder object.
function love.sound.newDecoder(file, buffer) end
---
@@ -15,5 +15,87 @@ function love.sound.newDecoder(file, buffer) end
---The sound data will be decoded to the memory in a raw format. It is recommended to create only short sounds like effects, as a 3 minute song uses 30 MB of memory this way.
---
---@param filename string # The file name of the file to load.
----@return SoundData soundData # A new SoundData object.
+---@return love.sound.SoundData soundData # A new SoundData object.
function love.sound.newSoundData(filename) end
+
+---@class love.sound.Decoder: love.sound.Object
+local Decoder = {}
+
+---
+---Creates a new copy of current decoder.
+---
+---The new decoder will start decoding from the beginning of the audio stream.
+---
+---@return love.sound.Decoder decoder # New copy of the decoder.
+function Decoder:clone() end
+
+---
+---Returns the number of bits per sample.
+---
+---@return number bitDepth # Either 8, or 16.
+function Decoder:getBitDepth() end
+
+---
+---Returns the number of channels in the stream.
+---
+---@return number channels # 1 for mono, 2 for stereo.
+function Decoder:getChannelCount() end
+
+---
+---Gets the duration of the sound file. It may not always be sample-accurate, and it may return -1 if the duration cannot be determined at all.
+---
+---@return number duration # The duration of the sound file in seconds, or -1 if it cannot be determined.
+function Decoder:getDuration() end
+
+---
+---Returns the sample rate of the Decoder.
+---
+---@return number rate # Number of samples per second.
+function Decoder:getSampleRate() end
+
+---@class love.sound.SoundData: love.sound.Data, love.sound.Object
+local SoundData = {}
+
+---
+---Returns the number of bits per sample.
+---
+---@return number bitdepth # Either 8, or 16.
+function SoundData:getBitDepth() end
+
+---
+---Returns the number of channels in the SoundData.
+---
+---@return number channels # 1 for mono, 2 for stereo.
+function SoundData:getChannelCount() end
+
+---
+---Gets the duration of the sound data.
+---
+---@return number duration # The duration of the sound data in seconds.
+function SoundData:getDuration() end
+
+---
+---Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
+---
+---@param i number # An integer value specifying the position of the sample (starting at 0).
+---@return number sample # The normalized samplepoint (range -1.0 to 1.0).
+function SoundData:getSample(i) end
+
+---
+---Returns the number of samples per channel of the SoundData.
+---
+---@return number count # Total number of samples.
+function SoundData:getSampleCount() end
+
+---
+---Returns the sample rate of the SoundData.
+---
+---@return number rate # Number of samples per second.
+function SoundData:getSampleRate() end
+
+---
+---Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
+---
+---@param i number # An integer value specifying the position of the sample (starting at 0).
+---@param sample number # The normalized samplepoint (range -1.0 to 1.0).
+function SoundData:setSample(i, sample) end