Class StreamedAudioSource
Inheritance
System.Object
StreamedAudioSource
Assembly: cs.temp.dll.dll
Syntax
public class StreamedAudioSource : MonoBehaviour
Constructors
StreamedAudioSource()
Declaration
[Obsolete("new not allowed. Use StreamedAudioSource.New", true)]
public StreamedAudioSource()
Properties
BufferDurationMS
The length of the internal buffer in milliseconds
Declaration
public int BufferDurationMS { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
BufferFactor
How large the internal ring buffer is, relative to (targetLatency + frameLifetime).
Declaration
public int BufferFactor { get; set; }
Property Value
| Type |
Description |
| System.Int32 |
|
Buffering
Declaration
[Obsolete("This property has been deprecated. Use IsBuffering instead.")]
public bool Buffering { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
ChannelCount
Current clip's channel count
Declaration
public int ChannelCount { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
DownwardPitchCorrectionScale
Declaration
public float DownwardPitchCorrectionScale { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
FrameCountForPlay
Declaration
[Obsolete("FrameCountForPlay is no longer supported. Use targetLatency instead to configure buffer size.")]
public int FrameCountForPlay { get; set; }
Property Value
| Type |
Description |
| System.Int32 |
|
FrameLifetime
If no new frame arrives for longer than this, stop playback (seconds).
Declaration
public float FrameLifetime { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
IsBuffering
Whether audio is currently being fed and buffered for playback eventually.
Declaration
public bool IsBuffering { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsPlaying
Whether playback is currently running
Declaration
public bool IsPlaying { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
PitchDeadZoneSec
Declaration
public float PitchDeadZoneSec { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
PitchMaxCorrection
Maximum absolute pitch deviation.
Declaration
public float PitchMaxCorrection { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
PitchProportionalGain
P gain: pitch response per second of latency error.
Declaration
public float PitchProportionalGain { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
PitchProportionalGame
Declaration
[Obsolete("Use PitchProportionalGain instead. This property was a typo!")]
public float PitchProportionalGame { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
PitchReturnSpeed
How fast pitch drifts back to 1.0 when within the deadzone.
Declaration
public float PitchReturnSpeed { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
SamplingFrequency
Current clip's sample rate
Declaration
public int SamplingFrequency { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
StartSafetyMarginSec
Extra safety buffer on first start (seconds). Prevents razor-edge starts.
Declaration
public float StartSafetyMarginSec { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
TargetLatency
Desired steady-state playback latency (seconds).
Declaration
public float TargetLatency { get; set; }
Property Value
| Type |
Description |
| System.Single |
|
UnityAudioSource
The that plays the streaming audio
Declaration
public AudioSource UnityAudioSource { get; }
Property Value
| Type |
Description |
| AudioSource |
|
Methods
Feed(Int32, Int32, Single[])
Feed one frame of interleaved audio (float PCM).
- frequency: Hz of this frame
- channels: channel count of this frame
- samples: interleaved samples (length = perChSamplesInFrame * channels)
Declaration
public void Feed(int frequency, int channels, float[] samples)
Parameters
| Type |
Name |
Description |
| System.Int32 |
frequency |
|
| System.Int32 |
channels |
|
| System.Single[] |
samples |
|
Feed(Int32, Int32, Single[], Boolean)
Declaration
[Obsolete("Feed no longer needs autoPlayWhenReady. Auto play is always on.")]
public void Feed(int frequency, int channels, float[] samples, bool autoPlayWhenReady = true)
Parameters
| Type |
Name |
Description |
| System.Int32 |
frequency |
|
| System.Int32 |
channels |
|
| System.Single[] |
samples |
|
| System.Boolean |
autoPlayWhenReady |
|
New(String)
Declaration
public static StreamedAudioSource New(string name = null)
Parameters
| Type |
Name |
Description |
| System.String |
name |
|
Returns
Play()
Declaration
[Obsolete("Play() is no longer supported. Calling this method will do nothing. When enough audio has been buffered the audio will always play automatically.")]
public void Play()
Stop()
Declaration
[Obsolete("Stop() is no longer supported. Calling this method will do nothing. If you want to stop playback, stop calling the Feed method and playback will end automatically when the buffer is cleared. For immediately stopping playback consider setting UnityAudioSource.volume to 0")]
public void Stop()