Пример #1
0
        public Form1()
        {
            InitializeComponent();

            // Instantiate the client control
            voipclient = new ConaitoLib.EvoVoIPClass();
            if ( voipclient.InitVoIP( true ) )
            {
                textBoxLog.Text += "Initialized VoIP Evo voice client\n";
            }
            else
            {
                textBoxLog.Text += "Failed to initialize VoIP Evo voice client\n";
            }

            //connected successfully to server. Result of voipclient.Connect(..)
            voipclient.OnConnectSuccess += new ConaitoLib.IEvoVoIPEvents_OnConnectSuccessEventHandler( this.voipclient_OnConnectSuccess );
            //failed to connect to server. Result of voipclient.Connect(..)
            voipclient.OnConnectFailed += new ConaitoLib.IEvoVoIPEvents_OnConnectFailedEventHandler( this.voipclient_OnConnectFailed );
            //server dropped connection
            voipclient.OnConnectionLost += new ConaitoLib.IEvoVoIPEvents_OnConnectionLostEventHandler( this.voipclient_OnConnectionLost );
            //server accepted login. Result of voipclient.DoLogin(..)
            voipclient.OnAccepted += new ConaitoLib.IEvoVoIPEvents_OnAcceptedEventHandler( this.voipclient_OnAccepted );
            //logged out of server. Result of voipclient.DoLogout()
            //            voipclient.OnLoggedOut += new ConaitoLib.IEvoVoIPEvents_OnLoggedOutEventHandler( this.voipclient_OnLoggedOut );
            //a new user entered your channel
            voipclient.OnAddUser += new ConaitoLib.IEvoVoIPEvents_OnAddUserEventHandler( this.voipclient_OnAddUser );
            //a user in your channel updated his information, e.g. nickname, status, etc.
            voipclient.OnUpdateUser += new ConaitoLib.IEvoVoIPEvents_OnUpdateUserEventHandler( this.voipclient_OnUpdateUser );
            //a user left your channel
            voipclient.OnRemoveUser += new ConaitoLib.IEvoVoIPEvents_OnRemoveUserEventHandler( this.voipclient_OnRemoveUser );
            //a user in your channel is talking
            voipclient.OnUserTalking += new ConaitoLib.IEvoVoIPEvents_OnUserTalkingEventHandler( this.voipclient_OnUserTalking );
            //a user in your channel stopped talking
            voipclient.OnUserStoppedTalking += new ConaitoLib.IEvoVoIPEvents_OnUserStoppedTalkingEventHandler( this.voipclient_OnUserStoppedTalking );
            //a new channel was created on the server
            voipclient.OnAddChannel += new ConaitoLib.IEvoVoIPEvents_OnAddChannelEventHandler( this.voipclient_OnAddChannel );
            //a channel updated its information, e.g. its number of users
            voipclient.OnUpdateChannel += new ConaitoLib.IEvoVoIPEvents_OnUpdateChannelEventHandler( this.voipclient_OnUpdateChannel );
            //a channel was deleted from the server
            voipclient.OnRemoveChannel += new ConaitoLib.IEvoVoIPEvents_OnRemoveChannelEventHandler( this.voipclient_OnRemoveChannel );
            //you have joined a new channel. Result of voipclient.DoJoinChannel
            voipclient.OnJoinedChannel += new ConaitoLib.IEvoVoIPEvents_OnJoinedChannelEventHandler( this.voipclient_OnJoinedChannel );
            //you have left the channel. Result of voipclient.DoLeaveChannel
            voipclient.OnLeftChannel += new ConaitoLib.IEvoVoIPEvents_OnLeftChannelEventHandler( this.voipclient_OnLeftChannel );
            //a hotkey has become active
            voipclient.OnHotKeyToggle += new ConaitoLib.IEvoVoIPEvents_OnHotKeyToggleEventHandler( this.voipclient_OnHotKeyToggle );
            //notification containing the raw audio (PCM data) which was played when a user was talking.
            voipclient.OnUserAudioData += new ConaitoLib.IEvoVoIPEvents_OnUserAudioDataEventHandler( this.voipclient_OnUserAudioData );

            this.timer1 = new System.Windows.Forms.Timer( this.components );

            //Current mike input level
            vumeterProgressBar.Maximum = 20;
            vumeterProgressBar.Minimum = 0;

            this.timer1.Tick += new System.EventHandler( this.timer1_Tick );
        }
Пример #2
0
        public Form1()
        {
            InitializeComponent();

            // Instantiate the client control
            voipclient = new ConaitoLib.EvoVoIPClass();
            if (voipclient.InitVoIP(true))
            {
                textBoxLog.Text += "Initialized VoIP Evo voice client\n";
            }
            else
            {
                textBoxLog.Text += "Failed to initialize VoIP Evo voice client\n";
            }

            //connected successfully to server. Result of voipclient.Connect(..)
            voipclient.OnConnectSuccess += new ConaitoLib.IEvoVoIPEvents_OnConnectSuccessEventHandler(this.voipclient_OnConnectSuccess);
            //failed to connect to server. Result of voipclient.Connect(..)
            voipclient.OnConnectFailed += new ConaitoLib.IEvoVoIPEvents_OnConnectFailedEventHandler(this.voipclient_OnConnectFailed);
            //server dropped connection
            voipclient.OnConnectionLost += new ConaitoLib.IEvoVoIPEvents_OnConnectionLostEventHandler(this.voipclient_OnConnectionLost);
            //server accepted login. Result of voipclient.DoLogin(..)
            voipclient.OnAccepted += new ConaitoLib.IEvoVoIPEvents_OnAcceptedEventHandler(this.voipclient_OnAccepted);
            //logged out of server. Result of voipclient.DoLogout()
            //            voipclient.OnLoggedOut += new ConaitoLib.IEvoVoIPEvents_OnLoggedOutEventHandler( this.voipclient_OnLoggedOut );
            //a new user entered your channel
            voipclient.OnAddUser += new ConaitoLib.IEvoVoIPEvents_OnAddUserEventHandler(this.voipclient_OnAddUser);
            //a user in your channel updated his information, e.g. nickname, status, etc.
            voipclient.OnUpdateUser += new ConaitoLib.IEvoVoIPEvents_OnUpdateUserEventHandler(this.voipclient_OnUpdateUser);
            //a user left your channel
            voipclient.OnRemoveUser += new ConaitoLib.IEvoVoIPEvents_OnRemoveUserEventHandler(this.voipclient_OnRemoveUser);
            //a user in your channel is talking
            voipclient.OnUserTalking += new ConaitoLib.IEvoVoIPEvents_OnUserTalkingEventHandler(this.voipclient_OnUserTalking);
            //a user in your channel stopped talking
            voipclient.OnUserStoppedTalking += new ConaitoLib.IEvoVoIPEvents_OnUserStoppedTalkingEventHandler(this.voipclient_OnUserStoppedTalking);
            //a new channel was created on the server
            voipclient.OnAddChannel += new ConaitoLib.IEvoVoIPEvents_OnAddChannelEventHandler(this.voipclient_OnAddChannel);
            //a channel updated its information, e.g. its number of users
            voipclient.OnUpdateChannel += new ConaitoLib.IEvoVoIPEvents_OnUpdateChannelEventHandler(this.voipclient_OnUpdateChannel);
            //a channel was deleted from the server
            voipclient.OnRemoveChannel += new ConaitoLib.IEvoVoIPEvents_OnRemoveChannelEventHandler(this.voipclient_OnRemoveChannel);
            //you have joined a new channel. Result of voipclient.DoJoinChannel
            voipclient.OnJoinedChannel += new ConaitoLib.IEvoVoIPEvents_OnJoinedChannelEventHandler(this.voipclient_OnJoinedChannel);
            //you have left the channel. Result of voipclient.DoLeaveChannel
            voipclient.OnLeftChannel += new ConaitoLib.IEvoVoIPEvents_OnLeftChannelEventHandler(this.voipclient_OnLeftChannel);
            //a hotkey has become active
            voipclient.OnHotKeyToggle += new ConaitoLib.IEvoVoIPEvents_OnHotKeyToggleEventHandler(this.voipclient_OnHotKeyToggle);
            //notification containing the raw audio (PCM data) which was played when a user was talking.
            voipclient.OnUserAudioData += new ConaitoLib.IEvoVoIPEvents_OnUserAudioDataEventHandler(this.voipclient_OnUserAudioData);

            this.timer1 = new System.Windows.Forms.Timer(this.components);

            //Current mike input level
            vumeterProgressBar.Maximum = 20;
            vumeterProgressBar.Minimum = 0;

            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
        }
Пример #3
0
        public void initialize(
            IVoiceClientEventCommunicator controller,
            String strDM,
            String strVoiceServerHostname,
            int iVoiceServerPort,
            String strConaitoServerPasswd)
        {
            if (null == controller)
            {
                throw new Exception("Voice client controller is null");
            }
            m_eventCommunicator = controller;
            _strDM = strDM;
            _strVoiceServerHostname = strVoiceServerHostname;
            _iVoiceServerPort       = iVoiceServerPort;
            _strConaitoServerPasswd = strConaitoServerPasswd;

            // It can take a while for a remote server to exchange the messages,
            // so give it a few tries to initialize.
            bool bAuthorized = false;

            for (int i = 0; i < 5; i++)
            {
                if (m_voipclient.InitVoIP(true))
                {
                    bAuthorized = true;
                    logDebugOnly(
                        String.Format("Conaito initialization succeeded for user {0}\n", strDM));
                    logDebugOnly(
                        String.Format("  VoiceServerHostname = {0}, VoiceServerPort = {1}\n",
                                      strVoiceServerHostname, Convert.ToInt32(iVoiceServerPort).ToString()));
                    break;
                }
                else
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (!bAuthorized)
            {
                throw new Exception("Voice client failed to initialize");
            }
        }
Пример #4
0
        public VoiceRecorder(int channelNo)
        {
            //simModelName = simModelPath;
            //simModelInfo = smr.readModel(simModelName);
            //isRunning = false;
            //isLoggedIn = false;
            //roomMembership = new Dictionary<string, List<string>>();
            //channelIDMap = new Dictionary<string, int>();
            //userChannelMap = new Dictionary<int, List<int>>();
            //server = new SimulationEventDistributorClient();
            //distributor.RegisterClient(ref server);

            channelID = channelNo;

            fileName.Append("DDDVoiceRecord_" + channelID.ToString());

            voipclient = new ConaitoLib.EvoVoIPClass();

            if (!voipclient.InitVoIP(true))
            {
                ErrorLog.Write("Failed to initialize VoIP Evo voice client");
            }

            //Register the user is talking event.  Use this to log user talking events to the DDD.
            voipclient.OnUserTalking += new ConaitoLib.IEvoVoIPEvents_OnUserTalkingEventHandler(this.voipclient_OnUserTalking);

            //notification containing the raw audio (PCM data) which was played when a user was talking.
            voipclient.OnUserAudioData += new ConaitoLib.IEvoVoIPEvents_OnUserAudioDataEventHandler(this.voipclient_OnUserAudioData);

            if (!System.IO.File.Exists("lame_enc.dll"))
            {
                ErrorLog.Write("Unable to find lame_enc.dll. Please download it at http://lame.sourceforge.net");
                return;
            }

                //set up the file directory and file name to record to.
                //StringBuilder tempdir = new StringBuilder(tempdirTextBox.Text);
                //StringBuilder mp3file = new StringBuilder(mp3fileTextBox.Text);
                if (VL_CreateVoiceLog(fileDirectory, fileName, 5) == 0)
                    ErrorLog.Write("Failed to start voice-log");
        }
Пример #5
0
        public void initialize(
            //IVoiceClientEventCommunicator controller,
            String strDM,
            int channelID,
            String strVoiceServerHostname,
            int iVoiceServerPort,
            String strConaitoServerPasswd)
        {
            //if (null == controller)
            //{
            //    throw new Exception("Voice client controller is null");
            //}
            //m_eventCommunicator = controller;
            _strDM = strDM;
            _strVoiceServerHostname = strVoiceServerHostname;
            _iVoiceServerPort       = iVoiceServerPort;
            _strConaitoServerPasswd = strConaitoServerPasswd;
            _iChannelID             = channelID;

            // It can take a while for a remote server to exchange the messages,
            // so give it a few tries to initialize.
            bool bAuthorized = false;

            for (int i = 0; i < 5; i++)
            {
                if (m_voipclient.InitVoIP(true))
                {
                    bAuthorized = true;
                    //logDebugOnly(
                    //    String.Format("Conaito initialization succeeded for user {0}\n", strDM));
                    //logDebugOnly(
                    //    String.Format("  VoiceServerHostname = {0}, VoiceServerPort = {1}\n",
                    //   strVoiceServerHostname, Convert.ToInt32(iVoiceServerPort).ToString()));
                    break;
                }
                else
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (!bAuthorized)
            {
                throw new Exception("Voice client failed to initialize");
            }

            //String strChannelPassword = "";
            //String strTopic = "";
            //String strOpPassword = "";
            bool soundInited = initSoundSystem();

            if (soundInited && Connect())
            {
                // Register push-to-talk key
                bHotKeyRegistered = m_voipclient.RegisterHotKey(
                    kiPUSH_TO_TALK_ID,
                    false,  // control
                    false,  // alt
                    false,  // shift
                    false,  // windows key
                    kcPushToTalkKey);

                //this.m_timer1.Tick += new System.EventHandler( this.timer1_Tick );

                // Give it a little time or you won't get the nodes when you log in
                // I found it works at 1/2 second but not less  -- shorvitz 3/10/08
                System.Threading.Thread.Sleep(500);
                login();
                System.Threading.Thread.Sleep(500);
                //bool joinsuccess = m_voipclient.DoJoinChannel(m_voipclient.GetChannelPath(_iChannelID), strChannelPassword, strTopic, strOpPassword);
            }
        }