Class ClientSession<T>
Handles a client session. Requires implementations of IAudioClient<T>, IAudioInput and IAudioOutput. Handles input, output along with filters over the entire client lifecycle. Adjusts to changes in configuration at runtime.
Inheritance
Namespace: Adrenak.UniVoice
Assembly: cs.temp.dll.dll
Syntax
public class ClientSession<T> : IDisposable
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
ClientSession(IAudioClient<T>, IAudioInput, IAudioOutputFactory)
Declaration
public ClientSession(IAudioClient<T> client, IAudioInput input, IAudioOutputFactory outputFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| IAudioClient<T> | client | |
| IAudioInput | input | |
| IAudioOutputFactory | outputFactory |
ClientSession(IAudioClient<T>, IAudioInput, Func<IAudioOutput>)
Declaration
public ClientSession(IAudioClient<T> client, IAudioInput input, Func<IAudioOutput> outputProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IAudioClient<T> | client | |
| IAudioInput | input | |
| System.Func<IAudioOutput> | outputProvider |
Properties
Client
Declaration
public IAudioClient<T> Client { get; set; }
Property Value
| Type | Description |
|---|---|
| IAudioClient<T> |
Input
The IAudioInput that's used for sourcing outgoing audio
Declaration
public IAudioInput Input { get; set; }
Property Value
| Type | Description |
|---|---|
| IAudioInput |
InputEnabled
Whether input audio will be processed. If set to false, any input audio captured by Input would be ignored and would neither be processed by the InputFilters nor send via the Client This can be used to create "Push to talk" style features without having to use YourVoiceSettings
Declaration
public bool InputEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
InputFilters
The IAudioFilter that will be applied to the outgoing audio for all the peers. Note that filters are executed in the order they are present in this list
Declaration
public List<IAudioFilter> InputFilters { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<IAudioFilter> |
OutputFactory
The IAudioOutputFactory that creates the IAudioOutput of peers
Declaration
public IAudioOutputFactory OutputFactory { get; set; }
Property Value
| Type | Description |
|---|---|
| IAudioOutputFactory |
OutputFilters
The output IAudioFilter that will be applied to the incoming audio for all the peers. Note that filters are executed in the order they are present in this list.
Declaration
[Obsolete("OutputFilters has been removed. Use AddOutputFilter and RemoveOutputFilter instead.", true)]
public List<IAudioFilter> OutputFilters { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<IAudioFilter> |
OutputProvider
The provider of IAudioOutput objects for peers. If this value is being set while peers already exist, the old outputs would be cleared and new onces will be created.
Declaration
public Func<IAudioOutput> OutputProvider { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Func<IAudioOutput> |
OutputsEnabled
Whether any incoming audio from peers would be processed. If set to false, all incoming peer audio is ignored, and would neither be processed by the OutputFilters nor output to the IAudioOutput of any peer. This can be used to easily mute all the peers on the network. Note that this doesn't stop the audio data from arriving and would consume bandwidth. To stop reception completely by telling the server to not send audio, use YourVoiceSettings
Declaration
public bool OutputsEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
PeerOutputs
The IAudioOutput instances of each peer in the session
Declaration
public Dictionary<T, IAudioOutput> PeerOutputs { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<T, IAudioOutput> |
Methods
AddOutputFilter<TFilter>(Func<IAudioFilter>)
Adds an filter to the output audio. Note: it is possible to register the same filter type more than once, this can be used to create some effects but can also cause errors.
Declaration
public void AddOutputFilter<TFilter>(Func<IAudioFilter> filterFactory)
where TFilter : IAudioFilter
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<IAudioFilter> | filterFactory | A lambda method that returns an instance of the filter type |
Type Parameters
| Name | Description |
|---|---|
| TFilter | The type of the filter to be added |
Dispose()
Declaration
public void Dispose()
HasInputFilter<TFilter>()
Checks if an input audio filter of a specific type has been registered.
Declaration
public bool HasInputFilter<TFilter>()
where TFilter : IAudioFilter
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the filter is registered, false otherwise |
Type Parameters
| Name | Description |
|---|---|
| TFilter | The type of the filter to check |
HasOutputFilter<TFilter>()
Checks if an output audio filter of a specific type has been registered.
Declaration
public bool HasOutputFilter<TFilter>()
where TFilter : IAudioFilter
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the filter is registered, false otherwise |
Type Parameters
| Name | Description |
|---|---|
| TFilter | The type of the filter to check |
RemoveOutputFilter<TFilter>()
Removes a previously registered output audio filter
Declaration
public void RemoveOutputFilter<TFilter>()
where TFilter : IAudioFilter
Type Parameters
| Name | Description |
|---|---|
| TFilter | The type of the filter to be removed |