Class SpeakerFrames
Plays 20 ms voice frames through a speaker, keeping a short buffer against uneven arrival; silence fills the gaps.
Implements
Inherited Members
Namespace: Uniform.Matrix.Audio
Assembly: Uniform.Matrix.Audio.dll
Syntax
public sealed class SpeakerFrames : IDisposable
Constructors
| Edit this page View SourceSpeakerFrames(IWavePlayer, TimeSpan?)
Play through speaker.
Declaration
public SpeakerFrames(IWavePlayer speaker, TimeSpan? maxBuffered = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IWavePlayer | speaker | Output device, not yet initialized. |
| TimeSpan? | maxBuffered | Most audio queued; frames beyond it are dropped, so delay cannot grow without bound. |
Properties
| Edit this page View SourceBuffered
Audio queued and not yet played.
Declaration
public TimeSpan Buffered { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Methods
| Edit this page View SourceDispose()
Close the speaker.
Declaration
public void Dispose()
Play(ReadOnlySpan<short>)
Queue a frame of samples.
Declaration
public void Play(ReadOnlySpan<short> frame)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<short> | frame |
Start()
Start playing.
Declaration
public void Start()
Stop()
Stop playing and forget what is queued.
Declaration
public void Stop()
Events
| Edit this page View SourceFailed
Raised when the speaker stops on an error while playing, e.g. a device that went away.
Declaration
public event Action<Exception>? Failed
Event Type
| Type | Description |
|---|---|
| Action<Exception> |