// Connect / Disconnect public void Connect(string roomName, string appKey, UInt64 clientIdentifier) { if (_nativeMatcher == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Matcher"); } Plugin.MatcherConnect(_nativeMatcher, roomName, appKey, clientIdentifier); }
public int Channels() { if (_nativeAudioOutputStream == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("AudioOutputStream"); } return(Plugin.AudioOutputStreamGetChannels(_nativeAudioOutputStream)); }
// Disconnect public void Disconnect() { if (_nativeMatcher == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Matcher"); } Plugin.MatcherDisconnect(_nativeMatcher); }
public bool ProcessPlaybackFrame(float[] audioData) { if (_nativeAudioPreprocessor == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("AudioPreprocessor"); } return(Plugin.AudioPreprocessorProcessPlaybackFrame(_nativeAudioPreprocessor, audioData, audioData.Length)); }
public int Channels() { if (_nativeMicrophone == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Microphone"); } return(Plugin.MicrophoneGetChannels(_nativeMicrophone)); }
public bool Start() { if (_nativeMicrophone == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Microphone"); } return(Plugin.MicrophoneStart(_nativeMicrophone)); }
public void Disconnect() { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } Plugin.ClientDisconnect(_nativeClient); }
// Metadata public int ClientIndex() { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } return(Plugin.ClientGetClientIndex(_nativeClient)); }
// Send audio data public bool SendRawAudioData(float[] audioData) { if (_nativeAudioInputStream == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("AudioInputStream"); } return(Plugin.AudioInputStreamSendRawAudioData(_nativeAudioInputStream, audioData, audioData.Length)); }
public bool GetAudioData(float[] audioData) { if (_nativeMicrophone == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Microphone"); } return(Plugin.MicrophoneGetAudioData(_nativeMicrophone, audioData, audioData.Length)); }
public void ContinueConnectionWithPingTimes(PingResult[] pingResults) { if (_nativeMatcher == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Matcher"); } Plugin.MatcherContinueConnectionWithPingTimes(_nativeMatcher, pingResults, pingResults.Length); }
public string GetServerError() { if (_nativeMatcher == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Matcher"); } return(Plugin.MatcherGetServerError(_nativeMatcher)); }
// Set desired sample rate. Native plugin will resample to it automatically. // Set to 0.0f to reset it back to the sample rate that's sent from the server. public void SetSampleRate(int sampleRate) { if (_nativeAudioOutputStream == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("AudioOutputStream"); } Plugin.AudioOutputStreamSetSampleRate(_nativeAudioOutputStream, sampleRate); }
// RPC public bool SendRPCMessage(byte[] data, int dataLength, bool reliable) { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } return(Plugin.ClientSendRPCMessage(_nativeClient, data, dataLength, reliable)); }
public double RoomTime() { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } return(Plugin.ClientGetRoomTime(_nativeClient)); }
public void Stop() { if (_nativeMicrophone == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Microphone"); } Plugin.MicrophoneStop(_nativeMicrophone); }
// Tick public int Tick() { if (_nativeMatcher == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Matcher"); } return(Plugin.MatcherTick(_nativeMatcher)); }
// Connect / Disconnect public void Connect(UInt64 clientIdentifier, byte[] connectToken) { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } // TODO: Connect/Disconnect need to fail gracefully if called multiple times. Plugin.ClientConnect(_nativeClient, clientIdentifier, connectToken, connectToken.Length); }
public int StreamID() { if (_nativeAudioOutputStream == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("AudioOutputStream"); } // TODO: It might be worth caching this if the calls are expensive return(Plugin.AudioOutputStreamGetStreamID(_nativeAudioOutputStream)); }
// Tick public int Tick() { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } // TODO: ClientTick should do its own deltaTime calculation. It will be more precise and will prevent the client and server from getting out of sync. return(Plugin.ClientTick(_nativeClient)); }
public bool GetAudioData(float[] audioData) { if (_nativeAudioOutputStream == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("AudioOutputStream"); } // TODO: Fix this return(Plugin.AudioOutputStreamGetAudioData(_nativeAudioOutputStream, audioData, audioData.Length) > 0); }
// Network Statistics public NetworkInfo GetNetworkStatistics() { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } NetworkInfo networkInfo; Plugin.ClientGetNetworkStatistics(_nativeClient, out networkInfo); return(networkInfo); }
public byte[] GetConnectToken() { if (_nativeMatcher == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Matcher"); } int connectTokenLength = Plugin.MatcherGetConnectTokenLength(_nativeMatcher); IntPtr connectTokenPointer = Plugin.MatcherGetConnectToken(_nativeMatcher); byte[] connectToken = new byte[connectTokenLength]; Marshal.Copy(connectTokenPointer, connectToken, 0, connectTokenLength); return(connectToken); }
// Audio public AudioInputStream CreateAudioInputStream(bool voice, int sampleRate, int channels) { if (_nativeClient == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Client"); } if (sampleRate <= 0) { throw new ArgumentException("Attempting to create audio stream with invalid sample rate (" + sampleRate + ")."); } if (channels <= 0) { throw new ArgumentException("Attempting to create audio stream with an invalid number of channels (" + channels + ")."); } IntPtr nativeAudioInputStream = Plugin.ClientCreateAudioInputStream(_nativeClient, voice, sampleRate, channels); AudioInputStream audioInputStream = new AudioInputStream(nativeAudioInputStream); _audioInputStreams.Add(audioInputStream); return(audioInputStream); }
public string[] GetIPsToPing() { if (_nativeMatcher == IntPtr.Zero) { throw RealtimeNativeException.NativePointerIsNull("Matcher"); } int numberOfAddressesToPing = Plugin.MatcherGetNumberOfIPsToPing(_nativeMatcher); if (numberOfAddressesToPing <= 0) { return new string[] {} } ; List <string> addressesToPing = new List <string>(numberOfAddressesToPing); for (int i = 0; i < numberOfAddressesToPing; i++) { addressesToPing.Add(Plugin.MatcherGetAddressToPingAtIndex(_nativeMatcher, i)); } return(addressesToPing.ToArray()); }