Class AudioSource
An audio source.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class AudioSource : MediaSource<IAudioOutput, IAudioInput, IAudioInputCollection, AudioSource, AudioFrame, AudioBuffer, AudioBufferCollection, AudioFormat>, IEquatable<NSObject>, INSObjectProtocol, INativeObject, IDisposable, IAudioOutput, IMediaOutput<IAudioOutput, IAudioInput, AudioFrame, AudioBuffer, AudioBufferCollection, AudioFormat>, IOutput<IAudioOutput, IAudioInput, AudioFrame, AudioBuffer, AudioBufferCollection, AudioFormat>, IAudioElement, IMediaElement, IElement
Constructors
AudioSource(AudioFormat)
Initializes a new instance of the AudioSource class.
Declaration
public AudioSource(AudioFormat outputFormat)
Parameters
Type | Name | Description |
---|---|---|
AudioFormat | outputFormat | The output format. |
AudioSource(AudioFormat, Int32)
Initializes a new instance of the AudioSource class.
Declaration
public AudioSource(AudioFormat outputFormat, int frameDuration)
Parameters
Type | Name | Description |
---|---|---|
AudioFormat | outputFormat | The output format. |
System.Int32 | frameDuration | The frame duration in milliseconds. |
Properties
Config
Gets the output configuration.
Declaration
public AudioConfig Config { get; }
Property Value
Type | Description |
---|---|
AudioConfig |
DisableTimestampReset
Gets or sets whether the timestamp should be reset using the wall clock after TimestampResetInterval milliseconds elapse between frames.
Declaration
public bool DisableTimestampReset { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ForceTimestampReset
Gets or sets whether the timestamp should be reset before the next frame is processed.
Declaration
public bool ForceTimestampReset { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
FrameDuration
Gets the frame duration in milliseconds. Defaults to 20.
Declaration
public int FrameDuration { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TimestampResetInterval
Gets or sets the amount of time in milliseconds between audio frames that will trigger a reset of the timestamp to the wall clock.
Declaration
public int TimestampResetInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Volume
Gets or sets a value indicating the volume (output resistance) of this source. Valid value range is 0.0 to 1.0, inclusive.
Declaration
public double Volume { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
CalculateDuration(Int32)
Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format.
Declaration
public int CalculateDuration(int dataLength)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataLength | The length of the audio chunk. |
Returns
Type | Description |
---|---|
System.Int32 |
CalculateDuration(Int32, AudioConfig)
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.
Declaration
[Obsolete("Use SoundUtility.CalculateDuration instead.")]
public static int CalculateDuration(int dataLength, AudioConfig config)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataLength | The length of the audio chunk. |
AudioConfig | config | The configuration. |
Returns
Type | Description |
---|---|
System.Int32 |
CalculateDuration(Int32, Int32, Int32)
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.
Declaration
[Obsolete("Use SoundUtility.CalculateDuration instead.")]
public static int CalculateDuration(int dataLength, int clockRate, int channelCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataLength | The length of the audio chunk. |
System.Int32 | clockRate | The clock rate. |
System.Int32 | channelCount | The channel count. |
Returns
Type | Description |
---|---|
System.Int32 |
CalculateDurationFloat(Int32)
Calculates the duration of an audio chunk given its data length (the number of bytes) and assuming that the clock rate and channel count match the output format.
Declaration
public int CalculateDurationFloat(int dataLength)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataLength | The length of the audio chunk. |
Returns
Type | Description |
---|---|
System.Int32 |
CalculateDurationFloat(Int32, Int32, Int32)
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.
Declaration
[Obsolete("Use SoundUtility.CalculateDurationFloat instead.")]
public static int CalculateDurationFloat(int dataLength, int clockRate, int channelCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataLength | The length of the audio chunk. |
System.Int32 | clockRate | The clock rate. |
System.Int32 | channelCount | The channel count. |
Returns
Type | Description |
---|---|
System.Int32 |
CreateInputCollection(IAudioOutput)
Creates an input collection.
Declaration
protected override IAudioInputCollection CreateInputCollection(IAudioOutput output)
Parameters
Type | Name | Description |
---|---|---|
IAudioOutput | output | The output. |
Returns
Type | Description |
---|---|
IAudioInputCollection |
Overrides
DoDestroy()
Declaration
protected override void DoDestroy()
Overrides
RaiseFrame(AudioFrame)
Raises a frame.
Declaration
protected override void RaiseFrame(AudioFrame frame)
Parameters
Type | Name | Description |
---|---|---|
AudioFrame | frame | The frame. |
Overrides
TrySetSystemTimestamp(AudioFrame)
Tries to set the system timestamp on an audio frame. This will succeed if the system timestamp is already set or if the system timestamp can be calculated off the timestamp.
Declaration
protected bool TrySetSystemTimestamp(AudioFrame frame)
Parameters
Type | Name | Description |
---|---|---|
AudioFrame | frame | The frame. |
Returns
Type | Description |
---|---|
System.Boolean |
TrySetTimestamp(AudioFrame)
Tries to set the timestamp on an audio frame. This will succeed if the timestamp is already set or if the timestamp can be calculated off the system timestamp.
Declaration
protected bool TrySetTimestamp(AudioFrame frame)
Parameters
Type | Name | Description |
---|---|---|
AudioFrame | frame | The frame. |
Returns
Type | Description |
---|---|
System.Boolean |