void Start()
 {
     if (AutoStart)
     {
         StartRecorder((UInt16)OpenRelayClient.Player.ID, OpenRelayClient.AllocateObjectId(), PreferMicrophoneIndex);
     }
 }
 void Start()
 {
     if (AutoStart)
     {
         StartRecorder((UInt16)OpenRelayClient.Player.ID, OpenRelayClient.AllocateObjectId());
     }
 }
 void Start()
 {
     OpenRelayClient.OnSyncStreamCall += delegate { };
     if (AutoStart)
     {
         StartPlayer((UInt16)OpenRelayClient.Player.ID, OpenRelayClient.AllocateObjectId());
     }
 }
        void SyncVoice(float[] inData)
        {
            if (OpusEncode)
            {
                var data = new float[inData.Length + amountFrameBufferSize];
                if (amountFrameBufferSize > 0)
                {
                    Array.Copy(amountFrameBuffer, 0, data, 0, amountFrameBufferSize);
                }
                Array.Copy(inData, 0, data, amountFrameBufferSize, inData.Length);
                int position   = 0;
                int counter    = 0;
                var encodeSets = new List <EncodeSet>();
                while (data.Length - position > frameSize)
                {
                    Array.Copy(data, position, frameBuffer, 0, frameSize);
                    var encodeSet = new EncodeSet();
                    encodeSet.Length  = (UInt16)encoder.Encode(frameBuffer, outputBuffer);
                    encodeSet.Encoded = new byte[encodeSet.Length];
                    Array.Copy(outputBuffer, encodeSet.Encoded, encodeSet.Length);
                    encodeSets.Add(encodeSet);
                    position += frameSize;
                    counter++;
                }

                var option = OpenRelayClient.BroadcastFilter.Default;
                if (DebugEcho)
                {
                    option = echoSyncOption;
                }

                if (!SyncBuffering)
                {
                    OpenRelayClient.SyncStream((byte)0, EncodeSetsToByteArray(encodeSets.ToArray()), CurrentObjectId, option);
                }
                else if (encodeSetBufferCounter > 4)
                {
                    encodeSetsBuffer.AddRange(encodeSets);
                    OpenRelayClient.SyncStream((byte)0, EncodeSetsToByteArray(encodeSetsBuffer.ToArray()), CurrentObjectId, option);
                    encodeSetsBuffer.Clear();
                    encodeSetBufferCounter = 0;
                }
                else
                {
                    encodeSetsBuffer.AddRange(encodeSets);
                    encodeSetBufferCounter++;
                }

                //amount logics.
                amountFrameBufferSize = data.Length - position;
                if (amountFrameBufferSize >= 0)
                {
                    Array.Copy(data, position, amountFrameBuffer, 0, amountFrameBufferSize);
                }
            }
            else
            {
                var dataraw = new byte[inData.Length * 4];
                Buffer.BlockCopy(inData, 0, dataraw, 0, dataraw.Length);
                var option = OpenRelayClient.BroadcastFilter.Default;
                if (DebugEcho)
                {
                    option = echoSyncOption;
                }
                OpenRelayClient.SyncStream((byte)0, dataraw, CurrentObjectId, option);
            }
        }