diff options
Diffstat (limited to 'meta/3rd/love2d/library/love/sound.lua')
-rw-r--r-- | meta/3rd/love2d/library/love/sound.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/3rd/love2d/library/love/sound.lua b/meta/3rd/love2d/library/love/sound.lua index c41d3380..bbe47d10 100644 --- a/meta/3rd/love2d/library/love/sound.lua +++ b/meta/3rd/love2d/library/love/sound.lua @@ -3,12 +3,18 @@ --- ---This module is responsible for decoding sound files. It can't play the sounds, see love.audio for that. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.sound) +--- ---@class love.sound love.sound = {} --- ---Attempts to find a decoder for the encoded sound data in the specified file. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.sound.newDecoder) +--- ---@overload fun(filename: string, buffer?: number):love.Decoder ---@param file love.File # The file with encoded sound data. ---@param buffer? number # The size of each decoded chunk, in bytes. @@ -20,6 +26,9 @@ 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. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.sound.newSoundData) +--- ---@overload fun(file: love.File):love.SoundData ---@overload fun(decoder: love.Decoder):love.SoundData ---@overload fun(samples: number, rate?: number, bits?: number, channels?: number):love.SoundData @@ -30,6 +39,9 @@ function love.sound.newSoundData(filename) end --- ---An object which can gradually decode a sound file. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.sound) +--- ---@class love.Decoder: love.Object local Decoder = {} @@ -38,42 +50,63 @@ local Decoder = {} --- ---The new decoder will start decoding from the beginning of the audio stream. --- +--- +---[Open in Browser](https://love2d.org/wiki/Decoder:clone) +--- ---@return love.Decoder decoder # New copy of the decoder. function Decoder:clone() end --- ---Decodes the audio and returns a SoundData object containing the decoded audio data. --- +--- +---[Open in Browser](https://love2d.org/wiki/Decoder:decode) +--- ---@return love.SoundData soundData # Decoded audio data. function Decoder:decode() end --- ---Returns the number of bits per sample. --- +--- +---[Open in Browser](https://love2d.org/wiki/Decoder:getBitDepth) +--- ---@return number bitDepth # Either 8, or 16. function Decoder:getBitDepth() end --- ---Returns the number of channels in the stream. --- +--- +---[Open in Browser](https://love2d.org/wiki/Decoder:getChannelCount) +--- ---@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. --- +--- +---[Open in Browser](https://love2d.org/wiki/Decoder:getDuration) +--- ---@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. --- +--- +---[Open in Browser](https://love2d.org/wiki/Decoder:getSampleRate) +--- ---@return number rate # Number of samples per second. function Decoder:getSampleRate() end --- ---Sets the currently playing position of the Decoder. --- +--- +---[Open in Browser](https://love2d.org/wiki/Decoder:seek) +--- ---@param offset number # The position to seek to, in seconds. function Decoder:seek(offset) end @@ -82,30 +115,45 @@ function Decoder:seek(offset) end --- ---You can not play SoundData back directly. You must wrap a Source object around it. --- +--- +---[Open in Browser](https://love2d.org/wiki/love.sound) +--- ---@class love.SoundData: love.Data, love.Object local SoundData = {} --- ---Returns the number of bits per sample. --- +--- +---[Open in Browser](https://love2d.org/wiki/SoundData:getBitDepth) +--- ---@return number bitdepth # Either 8, or 16. function SoundData:getBitDepth() end --- ---Returns the number of channels in the SoundData. --- +--- +---[Open in Browser](https://love2d.org/wiki/SoundData:getChannelCount) +--- ---@return number channels # 1 for mono, 2 for stereo. function SoundData:getChannelCount() end --- ---Gets the duration of the sound data. --- +--- +---[Open in Browser](https://love2d.org/wiki/SoundData:getDuration) +--- ---@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. --- +--- +---[Open in Browser](https://love2d.org/wiki/SoundData:getSample) +--- ---@overload fun(self: love.SoundData, i: number, channel: number):number ---@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). @@ -114,18 +162,27 @@ function SoundData:getSample(i) end --- ---Returns the number of samples per channel of the SoundData. --- +--- +---[Open in Browser](https://love2d.org/wiki/SoundData:getSampleCount) +--- ---@return number count # Total number of samples. function SoundData:getSampleCount() end --- ---Returns the sample rate of the SoundData. --- +--- +---[Open in Browser](https://love2d.org/wiki/SoundData:getSampleRate) +--- ---@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. --- +--- +---[Open in Browser](https://love2d.org/wiki/SoundData:setSample) +--- ---@overload fun(self: love.SoundData, i: number, channel: number, sample: number) ---@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). |