Murl Engine Lua Addon API  Version 1.0 beta
Murl.IAudioStream

The audio stream interface.


Table members

Methods


Clone()

Create a clone of the audio stream object.

Murl.IAudioStream Clone()

Returns
Murl.IAudioStream The new audio stream object.

Clone(sampleFormat)

Create a clone of the audio with a specified sample format.

Murl.IAudioStream Clone(Murl.IEnums.SampleFormat sampleFormat)

Parameters
sampleFormatThe sample format of the new audio object.
Returns
Murl.IAudioStream The new audio stream object or null if conversion is not available.

GetNumberOfSamples()

Get the total number of decoded samples in the stream.

Integer GetNumberOfSamples()

Returns
Integer The number of samples.

GetSampleIndex(startTime)

Get the index of the sample at a given start time.

Integer GetSampleIndex(Number startTime)

Parameters
startTimeThe sample start time in seconds.
Returns
Integer The sample index.

GetStartTime(sampleIndex)

Get the start time of a sample at a given index.

Number GetStartTime(Integer sampleIndex)

Parameters
sampleIndexThe index of the sample to query.
Returns
Number The sample's start time.

GetSampleRate()

Get the sample rate, i.e. the number of samples per second

Number GetSampleRate()

Returns
Number The number of samples per second.

GetSampleDuration()

Get the duration of a single sample, i.e. the inverse sample rate.

Number GetSampleDuration()

Returns
Number The sample duration in seconds.

GetTotalDuration()

Get the total duration of the stream, in seconds.

Number GetTotalDuration()

Returns
Number The total duration.

GetSampleFormat()

Get the sample format.

Murl.IEnums.SampleFormat GetSampleFormat()

Returns
Murl.IEnums.SampleFormat The sample format.

GetBytesPerSample()

Get the number of bytes per sample.

Integer GetBytesPerSample()

Returns
Integer The number of bytes per sample.

GetNumberOfBytes()

Get the total number of bytes for the fully decoded stream.

Integer GetNumberOfBytes()

Returns
Integer The number of bytes.

IsReadyForDecoding()

Check if the stream is ready to be decoded.

Boolean IsReadyForDecoding()

Returns
Boolean true if ready.

StartDecoding()

Start decoding the stream. Has to be called before Decode().

Boolean StartDecoding()

Returns
Boolean true if successful.

EndDecoding()

End decoding the stream. Has to be called after Decode().

Boolean EndDecoding()

Returns
Boolean true if successful.

Decode(dstBuffer, dstFormat, firstSample, numSamples)

Decode the stream. StartDecoding() has to be called before, see also EndDecoding().

Integer, Murl.Data Decode(Murl.Data dstBuffer, Murl.IEnums.SampleFormat dstFormat, Integer firstSample, Integer numSamples)

Parameters
dstBufferThe destination data.
dstFormatThe destination sample format.
firstSampleThe sample number to start from.
numSamplesThe number of samples to decode.
Returns
Integer The number of decoded samples.
Murl.Data dstBuffer The destination data.

SetCurrentMode(mode)

Set the stream's current access mode. This serves as a hint to a possible underlying stream decoder, to be able to do optimal decoding whether single sample access or a continuous sequence of audio data is desired.

Boolean SetCurrentMode(Murl.IEnums.StreamMode mode)

Parameters
modeThe access mode to apply.
Returns
Boolean true if successful.

GetCurrentMode()

Get the stream's current access mode.

Murl.IEnums.StreamMode GetCurrentMode()

Returns
Murl.IEnums.StreamMode The current access mode.

SetCurrentTimeOffset(timeOffset)

Set the current time offset for subsequent PrepareDecodedData() calls.

Boolean SetCurrentTimeOffset(Number timeOffset)

Parameters
timeOffsetThe time offset in seconds.
Returns
Boolean true if successful.

GetCurrentTimeOffset()

Get the current time offset.

Number GetCurrentTimeOffset()

Returns
Number The time offset in seconds.

PrepareDecodedData()

Prepare decoded data, creating the underlying sample storage if needed. Decode the entire stream, see GetDecodedData().

Boolean PrepareDecodedData()

Returns
Boolean true if successful.

FinishDecodedData()

Finish decoded data after a call to PrepareDecodedData(). If the stream supports re-creating its contents on its own, it may also free its underlying sample storage to save memory.

Boolean FinishDecodedData()

Returns
Boolean true if successful.

ReleaseDecodedData()

Release decoded data. If the stream supports re-creating its contents on its own, it may free any underlying sample storage to save memory on this call, otherwise this may be a no-op.

Boolean ReleaseDecodedData()

Returns
Boolean true if successful.

GetDecodedTimeOffset()

Get the time offset of the recently decoded data buffer.

Number GetDecodedTimeOffset()

Returns
Number The time offset in seconds.

GetDecodedSampleIndex()

Get the index of the first decoded sample in the recently decoded buffer.

Integer GetDecodedSampleIndex()

Returns
Integer The sample index.

GetDecodedData()

Get the decoded data. PrepareDecodedData() has to be called before, see also FinishDecodedData().

Murl.ConstData GetDecodedData()

Returns
Murl.ConstData The decoded data or empty data if not supported.

LockDecodedData()

Lock the decoded data.

Murl.MutableData LockDecodedData()

Returns
Murl.MutableData The mutable data or empty data if not supported.

UnlockDecodedData()

Unlock the decoded data.

Boolean UnlockDecodedData()

Returns
Boolean true if successful.