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
The multiplier for the buffer length.
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 |
|
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
Maximum time to keep audio in buffer before discarding it
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 |
|
PitchMaxCorrection
Caps pitch adjustment so audio doesn't sound unnatural
Declaration
public float PitchMaxCorrection { get; set; }
Property Value
Type |
Description |
System.Single |
|
PitchProportionalGame
Controls how aggressively pitch is adjusted to reach target latency
Declaration
public float PitchProportionalGame { 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 |
|
TargetLatency
Target delay between receiving and playing audio
Declaration
public float TargetLatency { get; set; }
Property Value
Type |
Description |
System.Single |
|
UnityAudioSource
Accessor for AudioSource with lazy initialization and setup
Declaration
public AudioSource UnityAudioSource { get; }
Property Value
Type |
Description |
AudioSource |
|
Methods
Feed(Int32, Int32, Single[])
Feeds audio into the buffer. Reinitializes format if it changes.
Starts playback when target latency is reached.
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()