Love2D APISoundDataOn this pageSoundData Description: Contains raw audio samples. type Type: Function. Description: Gets the type of the object as a string. Signature: type: function(self: SoundData): string Returns: Return TypeDescriptionstringThe type as a string. Of Type: Function. Description: Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. Signature: typeOf: function(self: SoundData, type_name: string): boolean Parameters: ParameterTypeDescriptiontype_namestringThe name of the type to check for. Returns: Return TypeDescriptionbooleanTrue if the object is of the specified type, false otherwise. release Type: Function. Description: Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. This method can be used to immediately clean up resources without waiting for Lua's garbage collector. Signature: release: function(self: SoundData): boolean Returns: Return TypeDescriptionbooleanTrue if the object was released by this call, false if it had been previously released. getString Type: Function. Description: Gets the full Data as a string. Signature: getString: function(self: SoundData): string Returns: Return TypeDescriptionstringThe raw data. getSize Type: Function. Description: Gets the Data's size in bytes. Signature: getSize: function(self: SoundData): integer Returns: Return TypeDescriptionintegerThe size of the Data in bytes. getPointer Type: Function. Description: Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI. Signature: getPointer: function(self: SoundData): any Returns: Return TypeDescriptionanyA raw pointer to the Data. getFFIPointer Type: Function. Description: Gets an FFI pointer to the Data. This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used. Signature: getFFIPointer: function(self: SoundData): nil Returns: Return TypeDescriptionnilA raw void* pointer to the Data, or nil if FFI is unavailable. clone Type: Function. Description: Creates a new copy of the Data object. Signature: clone: function(self: SoundData): SoundData Returns: Return TypeDescriptionSoundDataThe new copy. getChannelCount Type: Function. Description: Returns the number of channels in the SoundData. Signature: getChannelCount: function(self: SoundData): integer getChannels: function(self: SoundData): integer Returns: Return TypeDescriptioninteger1 for mono, 2 for stereo. getBitDepth Type: Function. Description: Returns the number of bits per sample. Signature: getBitDepth: function(self: SoundData): integer Returns: Return TypeDescriptionintegerEither 8, or 16. getSampleRate Type: Function. Description: Returns the sample rate of the SoundData. Signature: getSampleRate: function(self: SoundData): integer Returns: Return TypeDescriptionintegerNumber of samples per second. getSampleCount Type: Function. Description: Returns the number of samples per channel of the SoundData. Signature: getSampleCount: function(self: SoundData): integer Returns: Return TypeDescriptionintegerTotal number of samples. getDuration Type: Function. Description: Gets the duration of the sound data. Signature: getDuration: function(self: SoundData): number getSample: function(self: SoundData, index: integer, channel?: integer): number Parameters: ParameterTypeDescriptionindexintegerThe index parameter.channelintegerThe channel parameter. Returns: Return TypeDescriptionnumberThe duration of the sound data in seconds. setSample Type: Function. Description: 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. Signature: setSample: function(self: SoundData, index: integer, sample: number) Parameters: ParameterTypeDescriptionindexintegerAn integer value specifying the position of the sample (starting at 0).samplenumberThe normalized samplepoint (range -1.0 to 1.0). setSample Type: Function. Description: 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. Signature: setSample: function(self: SoundData, index: integer, channel: number, sample: number) Parameters: ParameterTypeDescriptionindexintegerAn integer value specifying the position of the sample (starting at 0).channelnumberThe index of the channel to set within the given sample.samplenumberThe normalized samplepoint (range -1.0 to 1.0).