Example #1
0
        private int startVoiceEngine()
        {
            // Create channel
            voiceChannel = viEAndroidJavaAPI.VoE_CreateChannel();
            if (0 > voiceChannel)
            {
                Log.Debug(TAG, "VoE create channel failed");
                return(-1);
            }

            // Set local receiver
            if (0 != viEAndroidJavaAPI.VoE_SetLocalReceiver(voiceChannel, receivePortVoice))
            {
                Log.Debug(TAG, "VoE set local receiver failed");
            }

            if (0 != viEAndroidJavaAPI.VoE_StartListen(voiceChannel))
            {
                Log.Debug(TAG, "VoE start listen failed");
            }

            // Route audio
            RouteAudio(cbEnableSpeaker.Checked);

            // set volume to default value
            if (0 != viEAndroidJavaAPI.VoE_SetSpeakerVolume(volumeLevel))
            {
                Log.Debug(TAG, "VoE set speaker volume failed");
            }

            // Start playout
            if (0 != viEAndroidJavaAPI.VoE_StartPlayout(voiceChannel))
            {
                Log.Debug(TAG, "VoE start playout failed");
            }

            if (0 != viEAndroidJavaAPI.VoE_SetSendDestination(voiceChannel, destinationPortVoice, RemoteIPString))
            {
                Log.Debug(TAG, "VoE set send  destination failed");
            }

            if (0 != viEAndroidJavaAPI.VoE_SetSendCodec(voiceChannel, voiceCodecType))
            {
                Log.Debug(TAG, "VoE set send codec failed");
            }

            if (0 != viEAndroidJavaAPI.VoE_SetECStatus(enableAECM))
            {
                Log.Debug(TAG, "VoE set EC Status failed");
            }

            if (0 != viEAndroidJavaAPI.VoE_SetAGCStatus(enableAGC))
            {
                Log.Debug(TAG, "VoE set AGC Status failed");
            }

            if (0 != viEAndroidJavaAPI.VoE_SetNSStatus(enableNS))
            {
                Log.Debug(TAG, "VoE set NS Status failed");
            }

            if (0 != viEAndroidJavaAPI.VoE_StartSend(voiceChannel))
            {
                Log.Debug(TAG, "VoE start send failed");
            }

            voERunning = true;
            return(0);
        }