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 for this stream
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

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
Perform on stream updated invocation
void
Perform on stream update following ready
void
Perform on stream complete invocation

Public Member Functions

void
AddSamples
( float [] samples )
Adds an array of samples to the current stream
void
SetTotalSamples
( int totalSamples )
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.TotalSamples
The total number of samples expected for this stream
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

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.HandleStreamReady ( )
Perform on stream updated invocation
virtual void Meta.Voice.Audio.AudioClipStream.HandleStreamUpdated ( )
Perform on stream update following ready
virtual void Meta.Voice.Audio.AudioClipStream.HandleStreamComplete ( )
Perform on stream complete invocation

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.SetTotalSamples
( int totalSamples )
Calls on occassions where the total samples are known. Either prior to a disk load or following a stream completion.
Parameters
totalSamples
The total samples is the final number of samples 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