API reference
API reference
Select your platform
No SDKs available
No versions available

AudioClipStream Class

A simple abstract class that can be used to simplify the code required for a custom IAudioClipStream
Meta::Voice::Audio::AudioClipStream extends Meta.Voice.Audio.IAudioClipStream.

Overview

Properties

bool
IsReady[Get]
Whether or not the stream is ready for playback
bool
Whether or not the stream has been completed
int
The current number of channels in this audio data stream
int
A getter for the current sample rate of how many samples per second should be played
int
The total number of samples currently added to this stream.
int
The total number of samples expected from the stream. When streaming, this is not set until the stream is complete.
float
A getter for the minimum length in seconds required before the OnStreamReady method is called
The callback delegate for stream completion once SetContentLength is called & all samples have been added via the AddSamples(float[] samples) method.
The callback delegate for stream update if any additional data such as the AudioClip is expected to update mid stream. This can be set externally but should only be called within the clip stream itself.
The callback delegate for stream completion once SetContentLength is called & all samples have been added via the AddSamples(float[] samples) method.

Data Fields

int
The maximum known total of samples currently in this stream.
float
Length[Get]
The length of the stream in seconds.

Object Data

AudioClipStream
( int newChannels,
int newSampleRate,
float newStreamReadyLength )
The constructor that takes in a total channel & sample rate
void
Method that calls OnStreamReady on the main thread
void
Perform on stream update following ready
void
Method that calls OnStreamUpdated on the main thread
void
Method that calls OnStreamComplete on the main thread

Public Member Functions

void
AddSamples
( float [] samples )
Adds an array of samples to the current stream
void
SetExpectedSamples
( int expectedSamples )
Calls on occassions where the total samples are known. Either prior to a disk load or following a stream completion.
void
Calls to determine if completion method should be called
void
Unload ( )
Called when clip stream should be completely removed from ram

Static Public Member Functions

static float
GetLength
( int totalSamples,
int channels,
int samplesPerSecond )
Calculates length in seconds based on total samples, channels & samples per second

Details

Properties

bool Meta.Voice.Audio.AudioClipStream.IsReady
Whether or not the stream is ready for playback
bool Meta.Voice.Audio.AudioClipStream.IsComplete
Whether or not the stream has been completed
int Meta.Voice.Audio.AudioClipStream.Channels
The current number of channels in this audio data stream
int Meta.Voice.Audio.AudioClipStream.SampleRate
A getter for the current sample rate of how many samples per second should be played
int Meta.Voice.Audio.AudioClipStream.AddedSamples
The total number of samples currently added to this stream.
int Meta.Voice.Audio.AudioClipStream.ExpectedSamples
The total number of samples expected from the stream. When streaming, this is not set until the stream is complete.
float Meta.Voice.Audio.AudioClipStream.StreamReadyLength
A getter for the minimum length in seconds required before the OnStreamReady method is called
AudioClipStreamDelegate Meta.Voice.Audio.AudioClipStream.OnStreamReady
The callback delegate for stream completion once SetContentLength is called & all samples have been added via the AddSamples(float[] samples) method.
AudioClipStreamDelegate Meta.Voice.Audio.AudioClipStream.OnStreamUpdated
The callback delegate for stream update if any additional data such as the AudioClip is expected to update mid stream. This can be set externally but should only be called within the clip stream itself.
AudioClipStreamDelegate Meta.Voice.Audio.AudioClipStream.OnStreamComplete
The callback delegate for stream completion once SetContentLength is called & all samples have been added via the AddSamples(float[] samples) method.

Fields

int Meta.Voice.Audio.AudioClipStream.TotalSamples
The maximum known total of samples currently in this stream.
float Meta.Voice.Audio.AudioClipStream.Length
The length of the stream in seconds.

Object Data

Meta.Voice.Audio.AudioClipStream.AudioClipStream
( int newChannels,
int newSampleRate,
float newStreamReadyLength )
The constructor that takes in a total channel & sample rate
Parameters
newChannels
The channels to be used for streaming
newSampleRate
The new sample rate
newStreamReadyLength
The minimum length in seconds required before the OnStreamReady method is called
virtual void Meta.Voice.Audio.AudioClipStream.RaiseStreamReady ( )
Method that calls OnStreamReady on the main thread
virtual void Meta.Voice.Audio.AudioClipStream.HandleStreamUpdated ( )
Perform on stream update following ready
virtual void Meta.Voice.Audio.AudioClipStream.RaiseStreamUpdated ( )
Method that calls OnStreamUpdated on the main thread
virtual void Meta.Voice.Audio.AudioClipStream.RaiseStreamComplete ( )
Method that calls OnStreamComplete on the main thread

Member Functions

virtual void Meta.Voice.Audio.AudioClipStream.AddSamples
( float [] samples )
Adds an array of samples to the current stream
Parameters
samples
A list of decoded floats from 0f to 1f
virtual void Meta.Voice.Audio.AudioClipStream.SetExpectedSamples
( int expectedSamples )
Calls on occassions where the total samples are known. Either prior to a disk load or following a stream completion.
Parameters
expectedSamples
The final number of samples expected to be received
virtual void Meta.Voice.Audio.AudioClipStream.UpdateState ( )
Calls to determine if completion method should be called
virtual void Meta.Voice.Audio.AudioClipStream.Unload ( )
Called when clip stream should be completely removed from ram

Static Member Functions

static float Meta.Voice.Audio.AudioClipStream.GetLength
( int totalSamples,
int channels,
int samplesPerSecond )
Calculates length in seconds based on total samples, channels & samples per second
Did you find this page helpful?
Thumbs up icon
Thumbs down icon