An audio source implementation that provides a diverse range of audio source options.
The available options encompass signal generation, playback from file and more.
Inheritance
System.Object
AudioExtrasSource
Implements
SIPSorceryMedia.Abstractions.IAudioSource
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: SIPSorcery.dll
public class AudioExtrasSource : IAudioSource
Constructors
|
Improve this Doc
View Source
Declaration
public AudioExtrasSource()
|
Improve this Doc
View Source
Instantiates an audio source that can generate output samples from a variety of different
non-live sources.
Declaration
public AudioExtrasSource(IAudioEncoder audioEncoder, AudioSourceOptions audioOptions = null)
Parameters
Type |
Name |
Description |
SIPSorceryMedia.Abstractions.IAudioEncoder |
audioEncoder |
|
AudioSourceOptions |
audioOptions |
Optional. The options that determine the type of audio to stream to the remote party.
Example type of audio sources are music, silence, white noise etc.
|
Fields
|
Improve this Doc
View Source
Declaration
public int _audioSamplePeriodMilliseconds
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
public const int AUDIO_SAMPLE_PERIOD_MILLISECONDS_DEFAULT = 20
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
public const int AUDIO_SAMPLE_PERIOD_MILLISECONDS_MAX = 500
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
public const int AUDIO_SAMPLE_PERIOD_MILLISECONDS_MIN = 20
Field Value
Type |
Description |
System.Int32 |
|
Properties
|
Improve this Doc
View Source
Declaration
public int AudioSamplePeriodMilliseconds { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
|
Improve this Doc
View Source
Cancels an in-progress send audio from stream operation.
Declaration
public void CancelSendAudioFromStream()
|
Improve this Doc
View Source
Declaration
|
Improve this Doc
View Source
Declaration
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
Declaration
public void ExternalAudioSourceRawSample(AudioSamplingRatesEnum samplingRate, uint durationMilliseconds, short[] sample)
Parameters
Type |
Name |
Description |
SIPSorceryMedia.Abstractions.AudioSamplingRatesEnum |
samplingRate |
|
System.UInt32 |
durationMilliseconds |
|
System.Int16[] |
sample |
|
|
Improve this Doc
View Source
Declaration
public List<AudioFormat> GetAudioSourceFormats()
Returns
Type |
Description |
System.Collections.Generic.List<SIPSorceryMedia.Abstractions.AudioFormat> |
|
|
Improve this Doc
View Source
Declaration
public bool HasEncodedAudioSubscribers()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Declaration
public bool IsAudioSourcePaused()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Declaration
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
Declaration
public void RestrictFormats(Func<AudioFormat, bool> filter)
Parameters
Type |
Name |
Description |
System.Func<SIPSorceryMedia.Abstractions.AudioFormat, System.Boolean> |
filter |
|
|
Improve this Doc
View Source
Declaration
public Task ResumeAudio()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
Attempts to send audio samples from a stream, typically a file, input.
Declaration
public Task SendAudioFromStream(Stream audioStream, AudioSamplingRatesEnum streamSampleRate)
Parameters
Type |
Name |
Description |
System.IO.Stream |
audioStream |
The stream containing the 16 bit PCM sampled at either 8 or 16Khz
to send to the remote party.
|
SIPSorceryMedia.Abstractions.AudioSamplingRatesEnum |
streamSampleRate |
The sample rate of the supplied PCM samples. Supported rates are
8 or 16 KHz.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
A task that completes once the stream has been fully sent.
|
|
Improve this Doc
View Source
Declaration
public void SetAudioSourceFormat(AudioFormat audioFormat)
Parameters
Type |
Name |
Description |
SIPSorceryMedia.Abstractions.AudioFormat |
audioFormat |
|
|
Improve this Doc
View Source
Sets the source for the session. Overrides any existing source.
Declaration
public void SetSource(AudioSourceOptions sourceOptions)
Parameters
|
Improve this Doc
View Source
Convenience method for audio sources when only default options are required,
e.g. the default music file rather than a custom one.
Declaration
public void SetSource(AudioSourcesEnum audioSource)
Parameters
Type |
Name |
Description |
AudioSourcesEnum |
audioSource |
The audio source to set. The call will fail
if the source requires additional options, e.g. stream from file.
|
|
Improve this Doc
View Source
Initialises the audio source as required.
Declaration
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Events
|
Improve this Doc
View Source
Declaration
public event SourceErrorDelegate OnAudioSinkError
Event Type
Type |
Description |
SIPSorceryMedia.Abstractions.SourceErrorDelegate |
|
|
Improve this Doc
View Source
Declaration
public event EncodedSampleDelegate OnAudioSourceEncodedSample
Event Type
Type |
Description |
SIPSorceryMedia.Abstractions.EncodedSampleDelegate |
|
|
Improve this Doc
View Source
Declaration
public event SourceErrorDelegate OnAudioSourceError
Event Type
Type |
Description |
SIPSorceryMedia.Abstractions.SourceErrorDelegate |
|
|
Improve this Doc
View Source
This audio source DOES NOT generate raw samples. Subscribe to the encoded samples event
to get samples ready for passing to the RTP transport layer.
Declaration
[Obsolete("This audio source only produces encoded samples. Do not subscribe to this event.")]
public event RawAudioSampleDelegate OnAudioSourceRawSample
Event Type
Type |
Description |
SIPSorceryMedia.Abstractions.RawAudioSampleDelegate |
|
|
Improve this Doc
View Source
Fires when the current send audio from stream operation completes. Send from
stream operations are intended to be short snippets of audio that get sent
as interruptions to the primary audio stream.
Declaration
public event Action OnSendFromAudioStreamComplete
Event Type
Type |
Description |
System.Action |
|
Implements
SIPSorceryMedia.Abstractions.IAudioSource
Extension Methods