Class ChatroomAgent
Provides the means to host or connect to a chatroom.
Namespace: Adrenak.UniVoice
Assembly: cs.temp.dll.dll
Syntax
public class ChatroomAgent : IDisposable
Constructors
ChatroomAgent(IChatroomNetwork, IAudioInput, IAudioOutputFactory)
Creates and returns a new agent using the provided dependencies. The instance then makes the dependencies work together.
Declaration
public ChatroomAgent(IChatroomNetwork chatroomNetwork, IAudioInput audioInput, IAudioOutputFactory audioOutputFactory)
Parameters
Type | Name | Description |
---|---|---|
IChatroomNetwork | chatroomNetwork | The chatroom network implementation |
IAudioInput | audioInput | The source of the outgoing audio |
IAudioOutputFactory | audioOutputFactory | The factory used for creating IAudioOutput instances for peers so that incoming audio from peers can be played. |
Fields
OnModeChanged
Fired when the CurrentMode changes.
Declaration
public Action<ChatroomAgentMode> OnModeChanged
Field Value
Type | Description |
---|---|
Action<ChatroomAgentMode> |
PeerOutputs
There is a IAudioOutput for each peer that gets created using the provided AudioOutputFactory The IAudioOutput instance corresponding to a peer is responsible for playing the audio that we receive from that peer.
Declaration
public Dictionary<short, IAudioOutput> PeerOutputs
Field Value
Type | Description |
---|---|
Dictionary<Int16, IAudioOutput> |
PeerSettings
ChatroomPeerSettings for each peer which allows you to read or change the settings for a specific peer. Use [id] to get settings for a peer with ID id;
Declaration
public Dictionary<short, ChatroomPeerSettings> PeerSettings
Field Value
Type | Description |
---|---|
Dictionary<Int16, ChatroomPeerSettings> |
Properties
AudioInput
Source of outgoing audio that can be transmitted over the network to peers
Declaration
public IAudioInput AudioInput { get; }
Property Value
Type | Description |
---|---|
IAudioInput |
AudioOutputFactory
A factory that returns an IAudioOutput instance. Used every time a Peer connects for that peer to get an output for that peer.
Declaration
public IAudioOutputFactory AudioOutputFactory { get; }
Property Value
Type | Description |
---|---|
IAudioOutputFactory |
CurrentMode
The current ChatroomAgentMode of this agent
Declaration
public ChatroomAgentMode CurrentMode { get; }
Property Value
Type | Description |
---|---|
ChatroomAgentMode |
MuteOthers
Mutes all the peers. If set to true, no incoming audio from other peers will be played. If you want to selectively mute a peer, use the muteThem flag in the PeerSettings instance for that peer. Note that setting this will not change PeerSettings
Declaration
public bool MuteOthers { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
MuteSelf
Whether this agent is muted or not. If set to true, voice data will not be sent to ANY peer. If you want to selectively mute yourself to a peer, use the muteSelf flag in the PeerSettings instance for that peer. Note that setting this will not change PeerSettings
Declaration
public bool MuteSelf { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Network
The underlying network which the agent uses to host or connect to chatrooms, and send and receive data to and from peers
Declaration
public IChatroomNetwork Network { get; }
Property Value
Type | Description |
---|---|
IChatroomNetwork |
Methods
Dispose()
Disposes the instance. WARNING: Calling this method will also dispose the dependencies passed to it in the constructor. Be mindful of this if you're sharing dependencies between multiple instances and/or using them outside this instance.
Declaration
public void Dispose()