Class Room
Main Room
Assembly: cs.temp.dll.dll
Implements:
OdinNative.Wrapper.IRoom, Odin.IDisposable
Properties
EndPoint
Room server gateway endpoint
Id
RoomId
OwnPeerId
PeerId of self
Name
Room name
RoomStatus
RoomStatus
IsJoined
IsJoined
IsClosed
IsClosed
PositionX
Inital position of self on join
PositionY
Inital position of self on join
PositionZ
Inital position of self on join
CryptoCipher
Crypto cipher
RpcWriter
Msgpack writer for RPC
RpcId
RpcAckActive
Toggle message type for Room.SendRpc
true is request and false is notification.
RpcTableThunk
Msgpack results to RPC requests
RoomUserData
Odin UserData helper for marshal byte arrays on Room level
RemotePeers
Conatiner of room peers
Encoders
Container of room input medias
Decoders
Elements of room output medias
Token
Room joining token
Parent
Default value
null
indicates root or not set
Fields
Samplerate
Room default samplerate
Stereo
Room default stereo flag
AvailableEncoderIds
Available media ids that are reserved for the room
Methods
OnDatagramReceived(DatagramEventArgs)
Parameters
Type | Name |
---|---|
OdinNative.Wrapper.Room.DatagramEventArgs | e |
OnRPCReceived(RpcEventArgs)
Parameters
Type | Name |
---|---|
OdinNative.Wrapper.Room.RpcEventArgs | e |
Create(string, uint, bool)
Initialise independent room
Returns
OdinNative.Wrapper.Room.Room: Room object
Parameters
Type | Name | Description |
---|---|---|
System.String | endPoint | Gateway server |
System.UInt32 | samplerate | sets default samplerate |
System.Boolean | stereo | sets default stereo flag |
GetBaseRoom<T>()
This will always return itself
Returns
<T>
Type Parameters
T
Room_OnPeerLeft(object, ulong)
Remove and dispose peer of OdinNative.Wrapper.Room.Room.RemotePeers
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
Room_OnMediaStarted(object, ulong, MediaRpc)
Add new created decoder to OdinNative.Wrapper.Room.Room.RemotePeers by id
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
Odin.MediaRpc | media |
Room_OnMediaStopped(object, ulong, ushort)
Remove and dispose decoder of OdinNative.Wrapper.Room.Room.RemotePeers by media id
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
System.UInt16 | mediaId |
Room_OnUserDataChanged(object, ulong, byte[])
Set userdata of OdinNative.Wrapper.Room.Room.RemotePeers by id
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
System.Byte[] | userData |
Room_OnMessageReceived(object, ulong, byte[])
Log message in Debug
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
System.Byte[] | message |
Room_OnRoomJoined(object, ulong, string, string, byte[], ushort[], ReadOnlyCollection<PeerRpc>)
Set OdinNative.Wrapper.Room.Room.RemotePeers for bookkeeping and AvailableEncoderIds for encoders
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | ownPeerId |
System.String | name |
System.String | customer |
System.Byte[] | roomUserData |
System.UInt16[] | mediaIds |
Odin.ReadOnlyCollection<PeerRpc> | peers |
Room_OnRoomLeft(object, string)
This close the current room
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | room |
System.String | reason | event reason |
Room_OnRoomStatusChanged(object, string)
Set the RoomStatus and flag for transition
Parameters
Type | Name |
---|---|
System.Object | sender |
System.String | connectionStatus |
Room_OnDatagram(object, DatagramEventArgs)
Default impl will push a datagram to all OdinNative.Wrapper.Room.Room.Decoders of the same mediaId in the current room.
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Room object |
OdinNative.Wrapper.Room.DatagramEventArgs | e | Datagram payload |
Room_OnRPC(object, RpcEventArgs)
Default impl will process all rpc packets.
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Room object |
OdinNative.Wrapper.Room.RpcEventArgs | e | RPC payload |
ProcessRPC(byte[])
Will process all rpc packets.
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | raw Msgpack |
Join(string, string, uint, bool, out Room)
Create and join a Room
Returns
System.Boolean
: true on successfully request join or false
Parameters
Type | Name | Description |
---|---|---|
System.String | endPoint | Gateway server |
System.String | token | Join token |
System.UInt32 | samplerate | sets default samplerate |
System.Boolean | stereo | sets default stereo flag |
OdinNative.Wrapper.Room.Room | room | Initialized room |
Join(OdinConnectionPoolHandle, string, string, uint, bool, out Room)
Create and join a Room
Returns
System.Boolean
: true on successfully request join or false
Parameters
Type | Name | Description |
---|---|---|
Odin.OdinConnectionPoolHandle | connectionPoolHandle | Connection pool for the room |
System.String | endPoint | Gateway server |
System.String | token | Join token |
System.UInt32 | samplerate | sets default samplerate |
System.Boolean | stereo | sets default stereo flag |
OdinNative.Wrapper.Room.Room | room | Initialized room |
Join(OdinConnectionPoolHandle, string, string, string, byte[], float, float, float, uint, bool, out Room)
Create and join a Room
Returns
System.Boolean
: true on successfully request join or false
Parameters
Type | Name | Description |
---|---|---|
Odin.OdinConnectionPoolHandle | connectionPoolHandle | Connection pool for the room |
System.String | endPoint | Gateway server |
System.String | token | Join token |
System.String | roomName | initial room name |
System.Byte[] | userData | initial userdata |
System.Single | positionX | initial position |
System.Single | positionY | initial position |
System.Single | positionZ | initial position |
System.UInt32 | samplerate | sets default samplerate |
System.Boolean | stereo | sets default stereo flag |
OdinNative.Wrapper.Room.Room | room | Initialized room |
Join(string)
Join a room with token
Returns
System.Boolean
: true on successfully request join or false
Parameters
Type | Name | Description |
---|---|---|
System.String | token | Join token |
Join(OdinConnectionPoolHandle, string, string, string, byte[], float, float, float, uint, bool, OdinCipherHandle)
Create and join a Room
Returns
OdinNative.Wrapper.Room.Room: true on successfully request join or false
Parameters
Type | Name | Description |
---|---|---|
Odin.OdinConnectionPoolHandle | connectionPoolHandle | Connection pool for the room |
System.String | endPoint | Gateway server |
System.String | token | Join token |
System.String | roomName | initial room name |
System.Byte[] | userData | initial userdata |
System.Single | positionX | initial position |
System.Single | positionY | initial position |
System.Single | positionZ | initial position |
System.UInt32 | samplerate | sets default samplerate |
System.Boolean | stereo | sets default stereo flag |
Odin.OdinCipherHandle | cipher |
Join(string, string, byte[], float, float, float, OdinCipherHandle)
Join a room
Returns
System.Boolean
: true on successfully request join or false
Parameters
Type | Name | Description |
---|---|---|
System.String | token | room token |
System.String | roomName | initial room name |
System.Byte[] | userData | initial userdata |
System.Single | positionX | initial position |
System.Single | positionY | initial position |
System.Single | positionZ | initial position |
Odin.OdinCipherHandle | cipher | cypto interface |
Join(string, OdinCipherHandle)
Join a room with encryption
Returns
System.Boolean
: true on successfully request join or false
Parameters
Type | Name | Description |
---|---|---|
System.String | token | Join token |
Odin.OdinCipherHandle | cipher | cypto cipher |
GetRoomId()
Retrieves the room id
Returns
System.UInt64
: room id### GetRoomName(bool)
Retrieves the room name
Returns
System.String
: room name
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | update | update this room name on true |
ResendUserData()
Resend native UserData
Returns
Odin.OdinError
: error code### GetEncoder(ushort, out MediaEncoder)
Get a encoder from OdinNative.Wrapper.Room.Room.Encoders by id
Returns
System.Boolean
: true on encoder found or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | id of a input media |
OdinNative.Wrapper.MediaEncoder | encoder | input object |
GetOrCreateEncoder(ushort, out MediaEncoder)
Get a encoder from OdinNative.Wrapper.Room.Room.Encoders by id. If the encoder is not found create a new one that will be added to OdinNative.Wrapper.Room.Room.Encoders.
Returns
System.Boolean
: true or false on error
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | id of a input media |
OdinNative.Wrapper.MediaEncoder | encoder | input object |
GetOrCreateEncoder(ushort, uint, bool, out MediaEncoder)
Get a encoder from OdinNative.Wrapper.Room.Room.Encoders by id. If the encoder is not found create a new one that will be added to OdinNative.Wrapper.Room.Room.Encoders.
Returns
System.Boolean
: true or false on error
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | id of a input media |
System.UInt32 | samplerate | custom samplerate |
System.Boolean | stereo | custom stereo flag |
OdinNative.Wrapper.MediaEncoder | encoder | input object |
CreateEncoder(ushort)
Create a new input media that will be added toOdinNative.Wrapper.Room.Room.Encoders
Returns
OdinNative.Wrapper.MediaEncoder: input media
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | id of a input media |
CreateEncoder(ushort, uint, bool)
Create a new input media that will be added toOdinNative.Wrapper.Room.Room.Encoders
Returns
OdinNative.Wrapper.MediaEncoder: input media
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | id of a input media |
System.UInt32 | samplerate | custom samplerate |
System.Boolean | stereo | custom stereo flag |
RemoveEncoder(ushort, out MediaEncoder)
Removes the input media from OdinNative.Wrapper.Room.Room.Encoders
Returns
System.Boolean
: true on encoder found or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | id of a input media |
OdinNative.Wrapper.MediaEncoder | encoder | input media that was removed |
GetDecoder(ulong, ushort, out MediaDecoder)
Get a decoder from OdinNative.Wrapper.PeerEntity.Medias of OdinNative.Wrapper.Room.Room.RemotePeers by id
Returns
System.Boolean
: true on decoder found or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | peerId | id of peer |
System.UInt16 | mediaId | id of output media |
OdinNative.Wrapper.MediaDecoder | decoder | output object or null |
GetOrCreateDecoder(ulong, ushort, out MediaDecoder)
Get a decoder from OdinNative.Wrapper.PeerEntity.Medias of OdinNative.Wrapper.Room.Room.RemotePeers by id. If the decoder is not found create a new one that will be added to the Peer
Returns
System.Boolean
: true on decoder found or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | peerId | id of peer |
System.UInt16 | mediaId | id of output media |
OdinNative.Wrapper.MediaDecoder | decoder | output object or null |
GetOrCreateDecoder(ulong, ushort, uint, bool, out MediaDecoder)
Get a decoder from OdinNative.Wrapper.PeerEntity.Medias of OdinNative.Wrapper.Room.Room.RemotePeers by id. If the decoder is not found create a new one that will be added to the Peer
Returns
System.Boolean
: true on decoder found or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | peerId | id of peer |
System.UInt16 | mediaId | id of output media |
System.UInt32 | samplerate | custom samplerate |
System.Boolean | stereo | custom stereo flag |
OdinNative.Wrapper.MediaDecoder | decoder | output object or null |
CreateDecoder(ulong, ushort)
Create a new output media that will be added to OdinNative.Wrapper.PeerEntity.Medias
Returns
OdinNative.Wrapper.MediaDecoder: output media
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | peerId | id of peer |
System.UInt16 | mediaId | id of output media |
CreateDecoder(ulong, ushort, uint, bool)
Create a new output media that will be added to OdinNative.Wrapper.PeerEntity.Medias
Returns
OdinNative.Wrapper.MediaDecoder: output media
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | peerId | id of peer |
System.UInt16 | mediaId | id of output media |
System.UInt32 | samplerate | custom samplerate |
System.Boolean | stereo | custom stereo flag |
RemoveDecoder(ulong, ushort, out MediaDecoder)
Removes a output media from a remote peer.
Returns
System.Boolean
: true on decoder found or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | peerId | id of peer |
System.UInt16 | mediaId | id of a output media |
OdinNative.Wrapper.MediaDecoder | decoder | output media that was removed |
StartMedia(MediaEncoder)
Send a "StartMedia"
RPC to the server to start the encoder for input.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Wrapper.MediaEncoder | encoder | input media |
StartMedia(ushort, MediaRpcProperties)
Send a "StartMedia"
RPC with custom media-data to the server to start the encoder for input.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | id of input media |
Odin.MediaRpcProperties | properties | arbitrary media data usually to identify the media on lost connections |
StopMedia(MediaEncoder)
Send a "StopMedia"
to the server to stop the encoder.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Wrapper.MediaEncoder | encoder | input media to stop |
StopMedia(ushort)
Send a "StopMedia"
to the server to stop the encoder.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | raw id to stop |
PauseMedia(MediaDecoder)
Send a "PauseMedia"
to the server to stop the decoder for output.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Wrapper.MediaDecoder | decoder | output media to stop |
PauseMedia(ushort)
Send a "PauseMedia"
to the server to stop the decoder for output.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | raw id to stop |
ResumeMedia(MediaDecoder)
Send a "ResumeMedia"
to the server to start a stopped decoder for output.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Wrapper.MediaDecoder | decoder | output media to start |
ResumeMedia(ushort)
Send a "ResumeMedia"
to the server to start a stopped decoder for output.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | raw id to start |
UpdateUserData(IUserData)
Update arbitrary userdata of self (note: OdinNative.Wrapper.UserData)
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Wrapper.IUserData | userData | arbitrary data |
UpdateUserData(byte[])
Update binary userdata of self (note: OdinNative.Wrapper.Room.Room.UpdateUserData(OdinNative.Wrapper.IUserData))
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | raw binary data |
SetPosition(float, float, float)
Set the spatial position for server side culling. Other remote peers outside the boundary will appear as not in the room or leaving the room.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | X of vector |
System.Single | y | Y of vector |
System.Single | z | Z of vector |
SendMessage(string)
Send "SendMessage"
to the server to broadcast the message with default UTF8 encoding.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | UTF8 string |
SendMessage(string, Encoding)
Send "SendMessage"
to the server to broadcast the message.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | string |
Odin.Encoding | encoding | custom encoding |
SendMessage(byte[])
Send "SendMessage"
to the server to broadcast an arbitrary message.
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | message | arbitrary data |
SendRpc(string, Action<IMsgPackWriter>)
Send registered RPCs to the server. (set by OdinNative.Wrapper.Room.Room.RpcWriter)
Returns
Odin.Task<OdinNative.Wrapper.Room.RpcResult>
: Thunk task that will not run (see OdinNative.Wrapper.Room.Room.RpcTableThunk)
Parameters
Type | Name | Description |
---|---|---|
System.String | method | RPC method |
Odin.Action<IMsgPackWriter> | builder | Msgpack builder |
SendAudio(float[], bool)
Push the samples to all OdinNative.Wrapper.Room.Room.Encoders for pipeline processing and pop the result as datagrams to the server
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | samples | Audio data |
System.Boolean | isSilent | flag these samples as silence |
SendAudio(float[], ushort, bool)
Push the samples to the input media for pipeline processing and pop the result as datagram to the server
Returns
System.Boolean
: true on success or false
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | samples | Audio data |
System.UInt16 | mediaId | input media id |
System.Boolean | isSilent | flag these samples as silence |
SendAudio(float[], MediaEncoder)
Push the samples to the input media for pipeline processing and pop the result as datagram to the server
Returns
System.Boolean
: true on success or false
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | samples | Audio data |
OdinNative.Wrapper.MediaEncoder | encoder | input media |
SendEncoderAudio(ushort)
Pop all samples from the input media by id and send them to the server
Returns
System.Boolean
: true on success or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | input media id |
SendEncoderAudio(MediaEncoder)
Pop all samples from the input media and send them to the server
Returns
System.Boolean
: true on success or false
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Wrapper.MediaEncoder | encoder | input media |
SendDatagram(ushort, byte[])
Send audio to the server
Returns
Odin.OdinError
: OdinNative.Core.Imports.NativeBindings.OdinError.ODIN_ERROR_SUCCESS or error
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | mediaId | input media id |
System.Byte[] | datagram | encoder datagram |
SendLoopbackRpc(byte[])
Send client side rpc message
Returns
Odin.OdinError
: OdinNative.Core.Imports.NativeBindings.OdinError.ODIN_ERROR_SUCCESS or error
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | rpc | bytes |
Close()
Close the native room. (native dispose)
Dispose(bool)
On dispose will free the room and all associated data
Parameters
Type | Name |
---|---|
System.Boolean | disposing |
~Room()
Default deconstructor
Dispose()
On dispose will free the room and all associated data
Events
OnDatagram
Call on audio data
Event Type
Odin.EventHandler<OdinNative.Wrapper.Room.DatagramEventArgs>
OnRpc
Call on rpc data
Event Type
Odin.EventHandler<OdinNative.Wrapper.Room.RpcEventArgs>
OnSendRpcResponse
Call on response to a rpc request
Event Type
Odin.EventHandler<OdinNative.Wrapper.Room.RpcResult>
OnRoomStatusChanged
Odin connection status
Event Type
OdinNative.Wrapper.OnRoomStatusChangedDelegate
OnRoomJoined
Odin room joined
Event Type
OdinNative.Wrapper.OnRoomJoinedDelegate
OnRoomLeft
Odin room left
Event Type
OdinNative.Wrapper.OnRoomLeftDelegate
OnPeerJoined
Odin peer joined
Event Type
OdinNative.Wrapper.OnPeerJoinedDelegate
OnPeerLeft
Odin peer left
Event Type
OdinNative.Wrapper.OnPeerLeftDelegate
OnMediaStarted
Odin media started
Event Type
OdinNative.Wrapper.OnMediaStartedDelegate
OnMediaStopped
Odin media stopped
Event Type
OdinNative.Wrapper.OnMediaStoppedDelegate
OnUserDataChanged
Odin peer changed userdata
Event Type
OdinNative.Wrapper.OnUserDataChangedDelegate
OnMessageReceived
Odin room received message
Event Type
OdinNative.Wrapper.OnMessageReceivedDelegate
Implements
- OdinNative.Wrapper.IRoom
Odin.IDisposable