LuaSTG-x Core API
audio::Decoder Class Reference
Inheritance diagram for audio::Decoder:

Public Member Functions

function clone ()
 
function createFromFile (local path, local bufferSize, local type)
 
function createFromLocalFile (local path, local bufferSize, local type)
 
function createFromSoundData (local soundData, local bufferSize, local type)
 
function createFromStream (local s, local bufferSize, local type)
 
function createFromStringData (local str, local bufferSize, local type)
 
function getBitDepth ()
 
function getBufferSize ()
 
function getBytesPerFrame ()
 
function getChannelCount ()
 
function getDecoderTypeFromPath (local path)
 
function getDuration ()
 
function getLoopingEnd ()
 
function getLoopingStart ()
 
function getSampleRate ()
 
function getTotalFrames ()
 
function isFinished ()
 
function isSeekable ()
 
function rewind ()
 
function seek (local frameOffset)
 
function seekTime (local seconds)
 
function tell ()
 

Member Function Documentation

◆ clone()

function clone ( )

Creates a deep of itself. The sound stream can (and should) be

rewound, and does not have to be at the same place.

return A new Decoder object.

Returns
audio.Decoder

◆ createFromFile()

function createFromFile ( local  path,
local  bufferSize,
local  type 
)
Parameters
pathstring
bufferSizenumber
typenumber
Returns
audio.Decoder

◆ createFromLocalFile()

function createFromLocalFile ( local  path,
local  bufferSize,
local  type 
)
Parameters
pathstring
bufferSizenumber
typenumber
Returns
audio.Decoder

◆ createFromSoundData()

function createFromSoundData ( local  soundData,
local  bufferSize,
local  type 
)
Parameters
soundDataaudio.SoundData
bufferSizenumber
typenumber
Returns
audio.Decoder

◆ createFromStream()

function createFromStream ( local  s,
local  bufferSize,
local  type 
)
Parameters
saudio.Stream
bufferSizenumber
typenumber
Returns
audio.Decoder

◆ createFromStringData()

function createFromStringData ( local  str,
local  bufferSize,
local  type 
)
Parameters
strstring
bufferSizenumber
typenumber
Returns
audio.Decoder

◆ getBitDepth()

function getBitDepth ( )

Gets the number of bits per sample. Supported values are 8 or 16.

return Either 8, 16, or 0 if unsupported.

Returns
number

◆ getBufferSize()

function getBufferSize ( )

Gets the size of the buffer (NOT the size of the entire stream).

return The size of the buffer.

Returns
number

◆ getBytesPerFrame()

function getBytesPerFrame ( )
Returns
number

◆ getChannelCount()

function getChannelCount ( )

Gets the number of channels in a stream. Supported values are 1 (mono) or 2 (stereo).

return Either 1 for mono, 2 for stereo, or 0 on errors.

Returns
number

◆ getDecoderTypeFromPath()

function getDecoderTypeFromPath ( local  path)
Parameters
pathstring
Returns
number

◆ getDuration()

function getDuration ( )

Gets the estimated total duration of the stream. in seconds. May return

-1 if the duration cannot be determined.

Returns
number

◆ getLoopingEnd()

function getLoopingEnd ( )
Returns
number

◆ getLoopingStart()

function getLoopingStart ( )
Returns
number

◆ getSampleRate()

function getSampleRate ( )

Gets the sample rate for the Decoder, that is, samples per second.

return The sample rate, eg. 44100.

Returns
number

◆ getTotalFrames()

function getTotalFrames ( )
Returns
number

◆ isFinished()

function isFinished ( )

Checks whether a stream has more data to decode or not. Use

rewind to start the stream again.

return False if there is more data, true on EOF.

Returns
boolean

◆ isSeekable()

function isSeekable ( )

Checks whether a stream is seekable.

return True if seekable, false otherwise.

Returns
boolean

◆ rewind()

function rewind ( )

Rewinds the stream to the start.

return True if success, false on fail/unsupported.

Returns
boolean

◆ seek()

function seek ( local  frameOffset)

Seeks to the specified position, if possible.

param frameOffset The position in the stream in frames.

return True if success, false on fail/unsupported.

Parameters
frameOffsetnumber
Returns
boolean

◆ seekTime()

function seekTime ( local  seconds)

Seeks to the specified position, if possible.

param seconds The position in the stream in seconds.

return True if success, false on fail/unsupported.

Parameters
secondsnumber
Returns
boolean

◆ tell()

function tell ( )

brief Tells the current frame offset.

return The current frame offset.

Returns
number

The documentation for this class was generated from the following file: