BaseAudioClipStream
(
newChannels
, newSampleRate
, newStreamReadyLength
)
|
The constructor that takes in a total channel & sample rate
Signature
Meta.Voice.Audio.BaseAudioClipStream.BaseAudioClipStream(int newChannels, int newSampleRate, float newStreamReadyLength=WitConstants.ENDPOINT_TTS_DEFAULT_READY_LENGTH) Parameters newChannels: intÂ
The channels to be used for streaming
newSampleRate: intÂ
The new sample rate
newStreamReadyLength: floatÂ
The minimum length in seconds required before the OnStreamReady method is called
|
Length
: float |
The length of the stream in seconds.
Signature
float Meta.Voice.Audio.BaseAudioClipStream.Length |
TotalSamples
: int |
The maximum known total of samples currently in this stream.
Signature
int Meta.Voice.Audio.BaseAudioClipStream.TotalSamples |
AddedSamples
: int
[Get] |
The total number of samples currently added to this stream.
Signature
int Meta.Voice.Audio.BaseAudioClipStream.AddedSamples |
Channels
: int
[Get] |
The current number of channels in this audio data stream
Signature
int Meta.Voice.Audio.BaseAudioClipStream.Channels |
ExpectedSamples
: int
[Get] |
The total number of samples expected from the stream. When streaming, this is not set until the stream is complete.
Signature
int Meta.Voice.Audio.BaseAudioClipStream.ExpectedSamples |
IsComplete
: bool
[Get] |
Whether or not the stream has been completed
Signature
bool Meta.Voice.Audio.BaseAudioClipStream.IsComplete |
IsReady
: bool
[Get] |
Whether or not the stream is ready for playback
Signature
bool Meta.Voice.Audio.BaseAudioClipStream.IsReady |
OnAddSamples
: AudioClipStreamSampleDelegate
[Get][Set] |
The callback delegate for stream samples added.
Signature
AudioClipStreamSampleDelegate Meta.Voice.Audio.BaseAudioClipStream.OnAddSamples |
OnStreamComplete
: AudioClipStreamDelegate
[Get][Set] |
The callback delegate for stream completion once SetContentLength is called & all samples have been added via the AddSamples(float[] samples) method.
Signature
AudioClipStreamDelegate Meta.Voice.Audio.BaseAudioClipStream.OnStreamComplete |
OnStreamReady
: AudioClipStreamDelegate
[Get][Set] |
The callback delegate for stream completion once SetContentLength is called & all samples have been added via the AddSamples(float[] samples) method.
Signature
AudioClipStreamDelegate Meta.Voice.Audio.BaseAudioClipStream.OnStreamReady |
OnStreamUnloaded
: AudioClipStreamDelegate
[Get][Set] |
The callback when the stream has unloaded all data
Signature
AudioClipStreamDelegate Meta.Voice.Audio.BaseAudioClipStream.OnStreamUnloaded |
OnStreamUpdated
: AudioClipStreamDelegate
[Get][Set] |
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.
Signature
AudioClipStreamDelegate Meta.Voice.Audio.BaseAudioClipStream.OnStreamUpdated |
SampleRate
: int
[Get] |
A getter for the current sample rate of how many samples per second should be played
Signature
int Meta.Voice.Audio.BaseAudioClipStream.SampleRate |
StreamReadyLength
: float
[Get] |
A getter for the minimum length in seconds required before the OnStreamReady method is called
Signature
float Meta.Voice.Audio.BaseAudioClipStream.StreamReadyLength |
HandleStreamUpdated
()
|
Perform on stream update following ready
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.HandleStreamUpdated() Returns void |
IsEnoughBuffered
()
|
A check if the clip stream has buffered enough to be considered ready
Signature
virtual bool Meta.Voice.Audio.BaseAudioClipStream.IsEnoughBuffered() Returns bool |
RaiseStreamComplete
()
|
Method that calls OnStreamComplete on the main thread
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.RaiseStreamComplete() Returns void |
RaiseStreamReady
()
|
Method that calls OnStreamReady on the main thread
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.RaiseStreamReady() Returns void |
RaiseStreamUpdated
()
|
Method that calls OnStreamUpdated on the main thread
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.RaiseStreamUpdated() Returns void |
Reset
()
|
Method for clearing all data
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.Reset() Returns void |
AddSamples
(
samples
, offset
, length
)
|
Adds a sample buffer to the current stream in its entirety.
Signature
abstract void Meta.Voice.Audio.BaseAudioClipStream.AddSamples(float[] samples, int offset, int length) Parameters samples: float []Â
A buffer of decoded floats that were decoded
offset: intÂ
The offset of the buffer to be used
length: intÂ
The total samples to be used
Returns abstract void |
SetExpectedSamples
(
expectedSamples
)
|
Calls on occassions where the total samples are known. Either prior to a disk load or following a stream completion.
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.SetExpectedSamples(int expectedSamples) Parameters expectedSamples: intÂ
The final number of samples expected to be received
Returns void |
Unload
()
|
Called when clip stream should clear ram and ready for re-use
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.Unload() Returns void |
UpdateState
()
|
Calls to determine if completion method should be called
Signature
virtual void Meta.Voice.Audio.BaseAudioClipStream.UpdateState() Returns void |
GetLength
(
totalSamples
, channels
, samplesPerSecond
)
|
Calculates length in seconds based on total samples, channels & samples per second
Signature
static float Meta.Voice.Audio.BaseAudioClipStream.GetLength(int totalSamples, int channels, int samplesPerSecond) Parameters totalSamples: intchannels: intsamplesPerSecond: intReturns float |