126 lines
2.8 KiB
C#
126 lines
2.8 KiB
C#
using System;
|
|
using Oculus.Platform.Models;
|
|
|
|
namespace Oculus.Platform
|
|
{
|
|
public static class Voip
|
|
{
|
|
public static void Start(ulong userID)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
CAPI.ovr_Voip_Start(userID);
|
|
}
|
|
}
|
|
|
|
public static void Accept(ulong userID)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
CAPI.ovr_Voip_Accept(userID);
|
|
}
|
|
}
|
|
|
|
public static void Stop(ulong userID)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
CAPI.ovr_Voip_Stop(userID);
|
|
}
|
|
}
|
|
|
|
public static void SetMicrophoneFilterCallback(CAPI.FilterCallback callback)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
CAPI.ovr_Voip_SetMicrophoneFilterCallbackWithFixedSizeBuffer(callback, (UIntPtr)480uL);
|
|
}
|
|
}
|
|
|
|
public static void SetMicrophoneMuted(VoipMuteState state)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
CAPI.ovr_Voip_SetMicrophoneMuted(state);
|
|
}
|
|
}
|
|
|
|
public static VoipMuteState GetSystemVoipMicrophoneMuted()
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
return CAPI.ovr_Voip_GetSystemVoipMicrophoneMuted();
|
|
}
|
|
return VoipMuteState.Unknown;
|
|
}
|
|
|
|
public static SystemVoipStatus GetSystemVoipStatus()
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
return CAPI.ovr_Voip_GetSystemVoipStatus();
|
|
}
|
|
return SystemVoipStatus.Unknown;
|
|
}
|
|
|
|
public static VoipDtxState GetIsConnectionUsingDtx(ulong peerID)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
return CAPI.ovr_Voip_GetIsConnectionUsingDtx(peerID);
|
|
}
|
|
return VoipDtxState.Unknown;
|
|
}
|
|
|
|
public static VoipBitrate GetLocalBitrate(ulong peerID)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
return CAPI.ovr_Voip_GetLocalBitrate(peerID);
|
|
}
|
|
return VoipBitrate.Unknown;
|
|
}
|
|
|
|
public static VoipBitrate GetRemoteBitrate(ulong peerID)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
return CAPI.ovr_Voip_GetRemoteBitrate(peerID);
|
|
}
|
|
return VoipBitrate.Unknown;
|
|
}
|
|
|
|
public static void SetNewConnectionOptions(VoipOptions voipOptions)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
CAPI.ovr_Voip_SetNewConnectionOptions((IntPtr)voipOptions);
|
|
}
|
|
}
|
|
|
|
public static Request<SystemVoipState> SetSystemVoipSuppressed(bool suppressed)
|
|
{
|
|
if (Core.IsInitialized())
|
|
{
|
|
return new Request<SystemVoipState>(CAPI.ovr_Voip_SetSystemVoipSuppressed(suppressed));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static void SetVoipConnectRequestCallback(Message<Oculus.Platform.Models.NetworkingPeer>.Callback callback)
|
|
{
|
|
Callback.SetNotificationCallback(Message.MessageType.Notification_Voip_ConnectRequest, callback);
|
|
}
|
|
|
|
public static void SetVoipStateChangeCallback(Message<Oculus.Platform.Models.NetworkingPeer>.Callback callback)
|
|
{
|
|
Callback.SetNotificationCallback(Message.MessageType.Notification_Voip_StateChange, callback);
|
|
}
|
|
|
|
public static void SetSystemVoipStateNotificationCallback(Message<SystemVoipState>.Callback callback)
|
|
{
|
|
Callback.SetNotificationCallback(Message.MessageType.Notification_Voip_SystemVoipState, callback);
|
|
}
|
|
}
|
|
}
|