RapportMicrophone
Description
The RapportMicrophone class is a public implementation of the IRapportAudioInput interface. It provides a robust, reference-counted system for managing a microphone device, allowing multiple parts of an application to safely access the same microphone input without conflicts.
Namespace: SpeechGraphics.Rapport.Audio
Fields
Name | Type | Description |
|---|---|---|
UserMute | bool | A flag that, when |
Properties
Name | Type | Description |
|---|---|---|
SystemMute | bool | A property that gets or sets the system-level mute state, as required by the |
IsMuted | bool | A read-only property that returns |
Frequency | int | The sample rate of the active microphone, in Hertz (Hz). This value is retrieved from the internal microphone instance. |
MicrophoneReadLatency | double | The latency, in seconds, between when audio data is read from the physical microphone and when it is available to be sent to the server. |
Methods
Name | Type | Description |
|---|---|---|
SetDevice(string name) | void | Changes the active microphone device. This method first releases the reference to the currently active microphone and then acquires a new one for the specified Parameters:
|
Update() | void | This method is called internally by the system. It forwards the call to the internal microphone instance, allowing it to perform per-frame buffer updates. |
OnAudioRead(int sampleOffset, float[] buffer) | void | Called internally from the audio thread to get samples from the microphone and populate the provided buffer. This method first checks the Parameters:
|
Lifecycle and Reference Counting
The RapportMicrophone class uses a static dictionary and reference counting to ensure that only a single instance of a microphone device is ever active at one time, even if multiple RapportMicrophone objects are created for the same device. The private static methods GetOrCreateInternal and ReleaseInternal handle this logic. The destructor (~RapportMicrophone()) automatically calls ReleaseInternal to decrement the reference count when an object is destroyed.