public HotKeyDlg(TeamTalk tt) { ttclient = tt; InitializeComponent(); ttclient.OnHotKeyTest += new TeamTalk.HotKeyTest(ttclient_OnHotKeyTest); }
public UserInfoDlg(TeamTalk tt, int userid) { ttclient = tt; InitializeComponent(); this.userid = userid; UpdateUser(); }
public MessageDlg(TeamTalk tt, int userid) { ttclient = tt; this.userid = userid; InitializeComponent(); this.CenterToScreen(); }
public FileTransferDlg(TeamTalk tt, int transferid) { this.ttclient = tt; this.transferid = transferid; InitializeComponent(); ttclient.OnFileTransfer += new TeamTalk.FileTransferUpdate(ttclient_OnFileTransfer); UpdateFileTransfer(); }
public DesktopDlg(TeamTalk tt, int userid) { ttclient = tt; this.userid = userid; InitializeComponent(); this.CenterToScreen(); ttclient.OnUserDesktopWindow += new TeamTalk.NewDesktopWindow(ttclient_OnUserDesktopWindow); }
public ServerStatsDlg(TeamTalk tt) { InitializeComponent(); ttclient = tt; ttclient.OnCmdServerStatistics += new TeamTalk.ServerStats(ttclient_OnCmdServerStatistics); cmd_id = ttclient.DoQueryServerStats(); this.CenterToScreen(); }
public ConnectDlg(TeamTalk tt, Settings settings) { ttclient = tt; this.settings = settings; InitializeComponent(); ipaddrComboBox.Text = settings.server.ipaddr; tcpportNumericUpDown.Value = settings.server.tcpport; udpportNumericUpDown.Value = settings.server.udpport; cryptCheckBox.Checked = settings.server.encrypted; }
public LoginDlg(TeamTalk tt, Settings settings) { ttclient = tt; this.settings = settings; InitializeComponent(); nickTextBox.Text = settings.nickname; usernameTextBox.Text = settings.server.username; passwdTextBox.Text = settings.server.password; ttclient.OnCmdProcessing += new TeamTalk.CommandProcessing(ttclient_OnCmdProcessing); ttclient.OnCmdError += new TeamTalk.CommandError(ttclient_OnCmdError); }
public FilesView(TeamTalk tt, ListView list) { this.ttclient = tt; this.listview = list; listview.Columns.Add("File ID"); listview.Columns.Add("Filename"); listview.Columns.Add("Size"); listview.Columns.Add("Owner"); ttclient.OnCmdFileNew += new TeamTalk.FileUpdate(ttclient_OnCmdFileNew); ttclient.OnCmdFileRemove += new TeamTalk.FileUpdate(ttclient_OnCmdFileRemove); ttclient.OnCmdUserJoinedChannel += new TeamTalk.UserUpdate(ttclient_OnCmdUserJoinedChannel); }
public VideoDlg(TeamTalk tt, int userid) { ttclient = tt; this.userid = userid; InitializeComponent(); this.CenterToScreen(); User user = new User(); if (userid > 0 && ttclient.GetUser(userid, ref user)) this.Text = "Video - " + user.szNickname; else this.Text = "Local Video"; ttclient.OnUserVideoCapture += new TeamTalk.UserVideoFrame(ttclient_OnUserVideoFrame); }
public ChannelsView(TeamTalk tt, TreeView tree) { ttclient = tt; treeview = tree; ttclient.OnCmdChannelNew += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelNew); ttclient.OnCmdChannelUpdate += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelUpdate); ttclient.OnCmdChannelRemove += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelRemove); ttclient.OnCmdUserJoinedChannel += new TeamTalk.UserUpdate(ttclient_OnCmdUserJoinedChannel); ttclient.OnCmdUserUpdate += new TeamTalk.UserUpdate(ttclient_OnCmdUserUpdate); ttclient.OnCmdUserLeftChannel += new TeamTalk.UserUpdate(ttclient_OnCmdUserLeftChannel); ttclient.OnUserStateChange += new TeamTalk.UserUpdate(ttclient_OnUserStateChange); ttclient.OnVoiceActivation += new TeamTalk.VoiceActivation(ttclient_OnVoiceActivation); }
public UsersView(TeamTalk tt, ListView list) { ttclient = tt; listview = list; listview.Columns.Add("ID"); listview.Columns.Add("Nickname"); listview.Columns.Add("Username"); listview.Columns.Add("Channel"); listview.Columns.Add("IP-Address"); listview.Columns.Add("StatusMsg"); listview.Columns.Add("User Type"); listview.Columns.Add("UserData"); ttclient.OnCmdUserLoggedIn += new TeamTalk.UserUpdate(ttclient_OnCmdUserLoggedIn); ttclient.OnCmdUserLoggedOut += new TeamTalk.UserUpdate(ttclient_OnCmdUserLoggedOut); ttclient.OnCmdUserUpdate += new TeamTalk.UserUpdate(ttclient_OnCmdUserUpdate); }
public PreferencesDlg(TeamTalk tt, Settings settings) { ttclient = tt; this.settings = settings; InitializeComponent(); this.CenterToScreen(); dsoundRadioButton.Checked = settings.soundsystem == SoundSystem.SOUNDSYSTEM_DSOUND; winmmRadioButton.Checked = settings.soundsystem == SoundSystem.SOUNDSYSTEM_WINMM; UpdateSoundSystem(null, null); vidcodecComboBox.SelectedIndex = 0; this.vidbitrateNumericUpDown.Value = settings.codec.webm_vp8.nRcTargetBitrate; UpdateVideoCaptureDevices(); fwCheckBox.Checked = WindowsFirewall.AppExceptionExists(Application.ExecutablePath); }
public ServerPropertiesDlg(TeamTalk tt) { ttclient = tt; InitializeComponent(); ttclient.GetServerProperties(ref prop); srvnameTextBox.Text = prop.szServerName; maxusersNumericUpDown.Value = prop.nMaxUsers; motdTextBox.Text = prop.szMOTD; motdrawTextBox.Text = prop.szMOTDRaw; tcpportNumericUpDown.Value = prop.nTcpPort; udpportNumericUpDown.Value = prop.nUdpPort; usertimeoutNumericUpDown.Value = prop.nUserTimeout; autosaveCheckBox.Checked = prop.bAutoSave; voiceNumericUpDown1.Value = prop.nMaxVoiceTxPerSecond / 1024; vidcapNumericUpDown5.Value = prop.nMaxVideoCaptureTxPerSecond /1024; mediafileNumericUpDown2.Value = prop.nMaxMediaFileTxPerSecond / 1024; desktopNumericUpDown3.Value = prop.nMaxDesktopTxPerSecond / 1024; totalNumericUpDown4.Value = prop.nMaxTotalTxPerSecond / 1024; versionTextBox.Text = prop.szServerVersion; }
public UserAccountsDlg(TeamTalk tt) { ttclient = tt; create_cmdid = 0; del_cmdid = 0; InitializeComponent(); this.CenterToScreen(); listView1.Columns.Add("Username"); listView1.Columns.Add("Password"); listView1.Columns.Add("User Type"); listView1.Columns.Add("UserData"); listView1.Columns.Add("Note"); Channel[] channels; if (ttclient.GetServerChannels(out channels)) { foreach (Channel chan in channels) { string channel = ""; //auto-op only works for static channels if (chan.uChannelType.HasFlag(ChannelType.CHANNEL_PERMANENT) && ttclient.GetChannelPath(chan.nChannelID, ref channel)) availchanListBox.Items.Add(channel); } } ttclient.OnCmdProcessing += new TeamTalk.CommandProcessing(ttclient_OnCmdProcessing); ttclient.OnCmdError += new TeamTalk.CommandError(ttclient_OnCmdError); ttclient.OnCmdSuccess += new TeamTalk.CommandSuccess(ttclient_OnCmdSuccess); ttclient.OnCmdUserAccount += new TeamTalk.ListUserAccount(ttclient_OnCmdUserAccount); //hopefully you have less than 100000 accounts list_cmdid = ttclient.DoListUserAccounts(0, 100000); }
public ChannelDlg(TeamTalk tt, ChannelDlgType dlgtype, int channelid, int parentid) { ttclient = tt; this.dlgtype = dlgtype; InitializeComponent(); if (channelid > 0 && ttclient.GetChannel(channelid, ref chan)) { string path = ""; ttclient.GetChannelPath(channelid, ref path); chanpathTextBox.Text = path; channameTextBox.Text = chan.szName; topicTextBox.Text = chan.szTopic; passwdTextBox.Text = chan.szPassword; maxusersNumericUpDown.Value = chan.nMaxUsers; diskquotaNumericUpDown.Value = chan.nDiskQuota / 1024; permchannelCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_PERMANENT); singletxCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_SOLO_TRANSMIT); classroomCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_CLASSROOM); oprecvonlyCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_OPERATOR_RECVONLY); novoiceactCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_VOICEACTIVATION); norecordCheckBox.Checked = chan.uChannelType.HasFlag(ChannelType.CHANNEL_NO_RECORDING); switch (chan.audiocodec.nCodec) { case Codec.SPEEX_CODEC: tabControl1.SelectedIndex = (int)CodecTabs.SPEEX_CBR_TAB; speexnbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 0; speexwbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 1; speexuwbRadioButton.Checked = chan.audiocodec.speex.nBandmode == 2; speexqualityTrackBar.Value = chan.audiocodec.speex.nQuality; speexTxInterval.Value = chan.audiocodec.speex.nTxIntervalMSec; speexstereoCheckBox.Checked = chan.audiocodec.speex.bStereoPlayback; break; case Codec.SPEEX_VBR_CODEC : tabControl1.SelectedIndex = (int)CodecTabs.SPEEX_VBR_TAB; speexvbrnbRadioButton.Checked = chan.audiocodec.speex_vbr.nBandmode == 0; speexvbrwbRadioButton.Checked = chan.audiocodec.speex_vbr.nBandmode == 1; speexvbruwbRadioButton.Checked = chan.audiocodec.speex_vbr.nBandmode == 2; speexvbrqualityTrackBar.Value = chan.audiocodec.speex_vbr.nQuality; speexvbrbitrateNumericUpDown.Value = chan.audiocodec.speex_vbr.nBitRate; speexvbrmaxbrNumericUpDown.Value = chan.audiocodec.speex_vbr.nMaxBitRate; speexvbrTxInterval.Value = chan.audiocodec.speex_vbr.nTxIntervalMSec; speexvbrdtxCheckBox.Checked = chan.audiocodec.speex_vbr.bDTX; speexvbrstereoCheckBox.Checked = chan.audiocodec.speex_vbr.bStereoPlayback; break; case Codec.OPUS_CODEC: tabControl1.SelectedIndex = (int)CodecTabs.OPUS_TAB; int i = opussamplerateComboBox.FindString(chan.audiocodec.opus.nSampleRate.ToString()); if (i < 0) i = 0; opussamplerateComboBox.SelectedIndex = i; opuschannelsComboBox.SelectedIndex = chan.audiocodec.opus.nChannels - 1; switch (chan.audiocodec.opus.nApplication) { case OpusConstants.OPUS_APPLICATION_AUDIO : opusaudioRadioButton.Checked = true; break; case OpusConstants.OPUS_APPLICATION_VOIP : opusvoipRadioButton.Checked = true; break; default: opusvoipRadioButton.Checked = true; break; } opuscomplexityNumericUpDown.Value = chan.audiocodec.opus.nComplexity; opusfecCheckBox.Checked = chan.audiocodec.opus.bFEC; opusdtxCheckBox.Checked = chan.audiocodec.opus.bDTX; opusvbrCheckBox.Checked = chan.audiocodec.opus.bVBR; opusvbrconstraintCheckBox.Checked = chan.audiocodec.opus.bVBRConstraint; opusbitrateNumericUpDown.Value = chan.audiocodec.opus.nBitRate / 1000; opusTxIntervalNumericUpDown.Value = chan.audiocodec.opus.nTxIntervalMSec; break; } agcCheckBox.Checked = chan.audiocfg.bEnableAGC; gainlevelTrackBar.Value = chan.audiocfg.nGainLevel; } else { string path = ""; ttclient.GetChannelPath(parentid, ref path); chanpathTextBox.Text = path; chan.nParentID = parentid; } UserType usertype = ttclient.GetMyUserType(); switch (dlgtype) { case ChannelDlgType.JOIN_CHANNEL : //when joining a channel 'disk quota' and 'max users' are set to server's default values diskquotaNumericUpDown.ReadOnly = true; maxusersNumericUpDown.ReadOnly = true; goto case ChannelDlgType.CREATE_CHANNEL; case ChannelDlgType.CREATE_CHANNEL : opussamplerateComboBox.SelectedIndex = 0; opuschannelsComboBox.SelectedIndex = 0; opuschannelsComboBox.SelectedIndex = 0; //only admins can change static channel property permchannelCheckBox.Enabled = ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS); diskquotaNumericUpDown.ReadOnly = !ttclient.UserRights.HasFlag(UserRight.USERRIGHT_MODIFY_CHANNELS); agcCheckBox.Checked = true; gainlevelTrackBar.Value = 8000; break; case ChannelDlgType.UPDATE_CHANNEL : break; case ChannelDlgType.VIEW_CHANNEL : channameTextBox.ReadOnly = true; topicTextBox.ReadOnly = true; passwdTextBox.ReadOnly = true; oppasswdTextBox.ReadOnly = true; maxusersNumericUpDown.ReadOnly = true; diskquotaNumericUpDown.ReadOnly = true; permchannelCheckBox.Enabled = false; singletxCheckBox.Enabled = false; classroomCheckBox.Enabled = false; oprecvonlyCheckBox.Enabled = false; novoiceactCheckBox.Enabled = false; norecordCheckBox.Enabled = false; agcCheckBox.Enabled = false; gainlevelTrackBar.Enabled = false; tabControl1.Enabled = false; break; } }
public MainForm() { InitializeComponent(); /* Set license information before creating the client instance */ //TeamTalk.SetLicenseInformation("", ""); msgdialogs = new Dictionary<int, MessageDlg>(); viddialogs = new Dictionary<int, VideoDlg>(); desktopdialogs = new Dictionary<int, DesktopDlg>(); inputProgressBar.Minimum = SoundLevel.SOUND_VU_MIN; inputProgressBar.Maximum = SoundLevel.SOUND_VU_MAX; voiceactTrackBar.Minimum = SoundLevel.SOUND_VU_MIN; voiceactTrackBar.Maximum = SoundLevel.SOUND_VU_MAX; inputgainTrackBar.Minimum = SoundLevel.SOUND_GAIN_MIN; inputgainTrackBar.Maximum = SoundLevel.SOUND_GAIN_MAX; volumeTrackBar.Minimum = SoundLevel.SOUND_VOLUME_MIN; volumeTrackBar.Maximum = 16000; /* we pass 'false' to poll_events since we don't want to * manually process events using ttclient.GetMessage */ ttclient = new TeamTalk(false); channels = new ChannelsView(ttclient, treeView1); users = new UsersView(ttclient, listView1); files = new FilesView(ttclient, filesListView); settings = new Settings(); voiceactTrackBar.Value = ttclient.GetVoiceActivationLevel(); inputgainTrackBar.Value = ttclient.GetSoundInputGainLevel(); volumeTrackBar.Value = ttclient.GetSoundOutputVolume(); //get default devices TeamTalk.GetDefaultSoundDevices(ref settings.sndinputid, ref settings.sndoutputid); ttclient.OnConnectionSuccess += new TeamTalk.Connection(ttclient_OnConnectionSuccess); ttclient.OnConnectionFailed += new TeamTalk.Connection(ttclient_OnConnectionFailed); ttclient.OnConnectionLost += new TeamTalk.Connection(ttclient_OnConnectionLost); ttclient.OnCmdProcessing += new TeamTalk.CommandProcessing(ttclient_OnCmdProcessing); ttclient.OnCmdError += new TeamTalk.CommandError(ttclient_OnCmdError); ttclient.OnCmdMyselfLoggedIn += new TeamTalk.MyselfLoggedIn(ttclient_OnCmdMyselfLoggedIn); ttclient.OnCmdMyselfLoggedOut += new TeamTalk.MyselfLoggedOut(ttclient_OnCmdMyselfLoggedOut); ttclient.OnCmdUserLoggedIn += new TeamTalk.UserUpdate(ttclient_OnCmdUserLoggedIn); ttclient.OnCmdUserJoinedChannel += new TeamTalk.UserUpdate(ttclient_OnCmdUserJoinedChannel); ttclient.OnCmdUserLeftChannel += new TeamTalk.UserUpdate(ttclient_OnCmdUserLeftChannel); ttclient.OnCmdUserTextMessage += new TeamTalk.UserTextMessage(ttclient_OnCmdUserTextMessage); ttclient.OnCmdChannelNew += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelNew); ttclient.OnCmdChannelUpdate += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelUpdate); ttclient.OnCmdChannelRemove += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelRemove); ttclient.OnInternalError += new TeamTalk.ErrorOccured(ttclient_OnInternalError); ttclient.OnHotKeyToggle += new TeamTalk.HotKeyToggle(ttclient_OnHotKeyToggle); ttclient.OnUserVideoCapture += new TeamTalk.UserVideoFrame(ttclient_OnUserVideoCapture); ttclient.OnStreamMediaFile += new TeamTalk.StreamMediaFile(ttclient_OnStreamMediaFile); ttclient.OnUserRecordMediaFile += new TeamTalk.UserRecordMediaFile(ttclient_OnUserRecordMediaFile); ttclient.OnUserAudioBlock += new TeamTalk.NewAudioBlock(ttclient_OnUserAudioBlock); ttclient.OnUserDesktopInput += new TeamTalk.UserDesktopInput(ttclient_OnUserDesktopInput); ttclient.OnFileTransfer += new TeamTalk.FileTransferUpdate(ttclient_OnFileTransfer); ttclient.OnUserDesktopWindow += new TeamTalk.NewDesktopWindow(ttclient_OnUserDesktopWindow); vumeterTimer.Enabled = true; timer1.Enabled = true; }
public void TestIpLogins() { const string USERNAME = "******", PASSWORD = "******"; string NICKNAME = "TeamTalk.NET - " + GetCurrentMethod(); const UserRight USERRIGHTS = UserRight.USERRIGHT_UPDATE_SERVERPROPERTIES | UserRight.USERRIGHT_MULTI_LOGIN; MakeUserAccount(GetCurrentMethod(), USERNAME, PASSWORD, USERRIGHTS); TeamTalk ttclient = NewClientInstance(); Connect(ttclient); Login(ttclient, NICKNAME, USERNAME, PASSWORD); ServerProperties srvprop = new ServerProperties(); Assert.IsTrue(ttclient.GetServerProperties(ref srvprop)); ServerProperties srvprop2 = srvprop; srvprop2.nMaxLoginsPerIPAddress = 2; Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoUpdateServer(srvprop2), DEF_WAIT), "Update server"); ttclient.Disconnect(); TeamTalk ttclient2 = new TeamTalk(true); Connect(ttclient); Login(ttclient, NICKNAME, USERNAME, PASSWORD); Connect(ttclient2); Login(ttclient2, NICKNAME, USERNAME, PASSWORD); TeamTalk ttclient3 = new TeamTalk(true); Connect(ttclient3); Assert.IsTrue(!WaitCmdSuccess(ttclient3, ttclient3.DoLogin(NICKNAME, USERNAME, PASSWORD), 500), "Login failure"); Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoUpdateServer(srvprop), DEF_WAIT), "Update server"); }
[STAThread] //this macro must be set in console applications for TeamTalk to work properly static void Main(string[] args) { ttclient = new TeamTalk(true); string ipaddr = "192.168.1.110"; string username = "******", password = "******"; int tcpport = TeamTalk.DEFAULT_TCPPORT, udpport = TeamTalk.DEFAULT_UDPPORT; bool encrypted = false; Console.WriteLine("TeamTalk 5 server logger."); Console.WriteLine(); Console.WriteLine("TeamTalk 5 server login information."); Console.Write("Specify IP-address of server to connect to: "); ipaddr = get_str(ipaddr); Console.Write("Specify TCP port: "); tcpport = get_int(tcpport); Console.Write("Specify UDP port: "); udpport = get_int(udpport); Console.Write("Is server encrypted? "); encrypted = get_str("N").ToLower() == "y"; Console.WriteLine("Administrator account information."); Console.Write("Specify username: "******"Specify password: "******"Specify directory where to store audio: "); audio_dir = get_str(audio_dir); if (!File.Exists("lame_enc.dll")) { Console.WriteLine("lame_enc.dll not found, so audio will be stored to .wav instead of .mp3"); } //hook events for checking connection ttclient.OnConnectionFailed += new TeamTalk.Connection(ttclient_OnConnectFailed); ttclient.OnConnectionSuccess += new TeamTalk.Connection(ttclient_OnConnectSuccess); ttclient.OnConnectionLost += new TeamTalk.Connection(ttclient_OnConnectionLost); //now that we got all the information we needed we can connect and logon if (!ttclient.Connect(ipaddr, tcpport, udpport, 0, 0, encrypted)) { Console.WriteLine("Failed to connect to server"); return; } TTMessage msg = new TTMessage(); //wait for 10 seconds for connect event if (!ttclient.GetMessage(ref msg, 10000)) { Console.WriteLine("Did not connect in time. Aborting..."); return; } Debug.Assert((ttclient.Flags & ClientFlag.CLIENT_CONNECTED) == ClientFlag.CLIENT_CONNECTED); //hook the remaining events we want to process ttclient.OnCmdMyselfLoggedIn += new TeamTalk.MyselfLoggedIn(ttclient_OnCmdMyselfLoggedIn); ttclient.OnCmdServerUpdate += new TeamTalk.ServerUpdate(ttclient_OnCmdServerUpdate); ttclient.OnCmdChannelNew += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelNew); ttclient.OnCmdChannelUpdate += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelUpdate); ttclient.OnCmdChannelRemove += new TeamTalk.ChannelUpdate(ttclient_OnCmdChannelRemove); ttclient.OnCmdUserLoggedIn += new TeamTalk.UserUpdate(ttclient_OnCmdUserLoggedIn); ttclient.OnCmdUserLoggedOut += new TeamTalk.UserUpdate(ttclient_OnCmdUserLoggedOut); ttclient.OnCmdUserUpdate += new TeamTalk.UserUpdate(ttclient_OnCmdUserUpdate); ttclient.OnCmdUserJoinedChannel += new TeamTalk.UserUpdate(ttclient_OnCmdUserJoinedChannel); ttclient.OnCmdUserLeftChannel += new TeamTalk.UserUpdate(ttclient_OnCmdUserLeftChannel); ttclient.OnCmdFileNew += new TeamTalk.FileUpdate(ttclient_OnCmdFileNew); ttclient.OnCmdFileRemove += new TeamTalk.FileUpdate(ttclient_OnCmdFileRemove); ttclient.OnCmdUserTextMessage += new TeamTalk.UserTextMessage(ttclient_OnCmdUserTextMessage); ttclient.OnCmdProcessing += new TeamTalk.CommandProcessing(ttclient_OnCmdProcessing); ttclient.OnCmdError += new TeamTalk.CommandError(ttclient_OnCmdError); ttclient.OnCmdSuccess += new TeamTalk.CommandSuccess(ttclient_OnCmdSuccess); ttclient.OnUserRecordMediaFile += new TeamTalk.UserRecordMediaFile(ttclient_OnUserAudioFile); //now that we're connected log on cur_cmd_id = ttclient.DoLogin("ttserverlog", username, password); Console.WriteLine("Login command got cmd ID #" + cur_cmd_id); if (cur_cmd_id < 0) { Console.WriteLine("Failed to issue command. Aborting..."); return; } //wait for login command to complete while (ttclient.GetMessage(ref msg, 10000)) { ttclient.ProcessMsg(msg); if (msg.nClientEvent == ClientEvent.CLIENTEVENT_CMD_PROCESSING && msg.nSource == cur_cmd_id && (bool)msg.DataToObject() /* bActive */ == false) { break; } } //if this assertion failed it's because the login information was incorrect Debug.Assert((ttclient.Flags & ClientFlag.CLIENT_AUTHORIZED) == ClientFlag.CLIENT_AUTHORIZED); //we have to be admin user to do logging on the server. Debug.Assert((ttclient.UserType & UserType.USERTYPE_ADMIN) == UserType.USERTYPE_ADMIN); //now process events forever. while (ttclient.GetMessage(ref msg, -1)) { ttclient.ProcessMsg(msg); } }
void VoiceTxRx(TeamTalk ttclient, int TEST_DURATION, int VOICE_TX_DURATION, int SILENCE_DURATION) { Debug.WriteLine("Total Duration {0} {1} {2}", TEST_DURATION, VOICE_TX_DURATION, SILENCE_DURATION); Channel chan = new Channel(); Assert.IsTrue(ttclient.GetChannel(ttclient.ChannelID, ref chan)); TTMessage msg = new TTMessage(); int tx_interval = chan.audiocodec.opus.nTxIntervalMSec; int test_duration = 0, voice_tx_duration; while (test_duration < TEST_DURATION) { Debug.WriteLine("Duration {0}", test_duration); voice_tx_duration = 0; AudioBlock block; Assert.IsTrue(ttclient.EnableVoiceTransmission(true)); Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_USER_STATECHANGE, 1000, ref msg)); Assert.IsTrue(((User)msg.DataToObject()).uUserState.HasFlag(UserState.USERSTATE_VOICE)); do { Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_USER_AUDIOBLOCK, 1000)); block = ttclient.AcquireUserAudioBlock(StreamType.STREAMTYPE_VOICE, ttclient.UserID); Assert.IsTrue(block.nStreamID > 0); Assert.IsTrue(ttclient.ReleaseUserAudioBlock(block)); } while ((voice_tx_duration += tx_interval) < VOICE_TX_DURATION); Assert.IsTrue(ttclient.EnableVoiceTransmission(false)); Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_USER_STATECHANGE, 5000, ref msg)); Assert.IsFalse(((User)msg.DataToObject()).uUserState.HasFlag(UserState.USERSTATE_VOICE)); WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_NONE, SILENCE_DURATION); //drain queue do { block = ttclient.AcquireUserAudioBlock(StreamType.STREAMTYPE_VOICE, ttclient.UserID); if(block.nStreamID>0) ttclient.ReleaseUserAudioBlock(block); } while(block.nStreamID>0); while(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_USER_AUDIOBLOCK, 0)) test_duration += voice_tx_duration; test_duration += SILENCE_DURATION; } }
private static bool WaitCmdComplete(TeamTalk ttclient, int cmdid, int waittimeout) { TTMessage msg = new TTMessage(); while (WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CMD_PROCESSING, waittimeout, ref msg)) { if (msg.nSource == cmdid && (bool)msg.DataToObject() == false) return true; } return false; }
private static void Connect(TeamTalk ttclient) { Assert.IsTrue(ttclient.Connect(IPADDR, TCPPORT, UDPPORT, 0, 0, ENCRYPTED), "connect call"); Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CON_SUCCESS, 1000), "wait connect"); }
private static void Login(TeamTalk ttclient, string nick, string username, string passwd) { int cmdid = ttclient.DoLogin(nick, username, passwd); Assert.IsTrue(cmdid > 0, "do login"); TTMessage msg = new TTMessage(); Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CMD_MYSELF_LOGGEDIN, DEF_WAIT, ref msg), "wait login"); UserAccount account = (UserAccount)msg.DataToObject(); Assert.AreEqual(username, account.szUsername, "username set"); //Assert.AreEqual(passwd, account.szPassword, "password set"); Assert.IsTrue(WaitCmdComplete(ttclient, cmdid, 1000), "Wait login complete"); Assert.IsTrue(ttclient.Flags.HasFlag(ClientFlag.CLIENT_AUTHORIZED)); }
public MediaFileDlg(TeamTalk ttclient) { this.ttclient = ttclient; InitializeComponent(); }
private static void JoinRoot(TeamTalk ttclient) { Assert.IsTrue(ttclient.Flags.HasFlag(ClientFlag.CLIENT_AUTHORIZED), "Auth ok"); Assert.IsTrue(ttclient.GetRootChannelID() > 0, "root exists"); int cmdid = ttclient.DoJoinChannelByID(ttclient.GetRootChannelID(), ""); Assert.IsTrue(cmdid > 0, "do join root"); Assert.IsTrue(WaitCmdComplete(ttclient, cmdid, 1000), "Wait join complete"); }
TeamTalk NewClientInstance() { TeamTalk ttclient = new TeamTalk(true); ttclients.Add(ttclient); return ttclient; }
private static Channel BuildDefaultChannel(TeamTalk ttclient, string name) { Channel chan = new Channel(true); chan.nParentID = ttclient.GetRootChannelID(); chan.szName = name; chan.szTopic = "a topic"; chan.nMaxUsers = 128; chan.audiocodec.nCodec = Codec.OPUS_CODEC; chan.audiocodec.opus.nApplication = OpusConstants.OPUS_APPLICATION_AUDIO; chan.audiocodec.opus.nChannels = 1; chan.audiocodec.opus.nBitRate = 64000; chan.audiocodec.opus.nComplexity = 5; chan.audiocodec.opus.nTxIntervalMSec = 20; chan.audiocodec.opus.nSampleRate = 48000; chan.audiocodec.opus.bDTX = true; chan.audiocodec.opus.bFEC = true; chan.audiocodec.opus.bVBR = true; chan.audiocodec.opus.bVBRConstraint = false; return chan; }
private static bool WaitForEvent(TeamTalk ttclient, ClientEvent e, int waittimeout, ref TTMessage msg) { long start = DateTime.Now.Ticks / 10000; TTMessage tmp = new TTMessage(); while (ttclient.GetMessage(ref tmp, waittimeout) && tmp.nClientEvent != e) { ttclient.ProcessMsg(tmp); if(DEBUG_OUTPUT) Debug.WriteLine(DateTime.Now + " #" + ttclient.GetMyUserID() + ": " + tmp.nClientEvent); if(DateTime.Now.Ticks / 10000 - start >= waittimeout) break; } if (tmp.nClientEvent == e) { ttclient.ProcessMsg(tmp); if (DEBUG_OUTPUT) Debug.WriteLine(DateTime.Now + " #" + ttclient.GetMyUserID() + ": " + tmp.nClientEvent); msg = tmp; } return tmp.nClientEvent == e; }
private void InitSound(TeamTalk ttclient) { int devin = 0, devout = 0; Assert.IsTrue(TeamTalk.GetDefaultSoundDevicesEx(SoundSystem.SOUNDSYSTEM_WASAPI, ref devin, ref devout), "Get default DSound devices"); SpeexDSP spxdsp = new SpeexDSP(); spxdsp.bEnableAGC = true; spxdsp.nGainLevel = SpeexDSPConstants.DEFAULT_AGC_GAINLEVEL; spxdsp.nMaxIncDBSec = SpeexDSPConstants.DEFAULT_AGC_INC_MAXDB; spxdsp.nMaxDecDBSec = SpeexDSPConstants.DEFAULT_AGC_DEC_MAXDB; spxdsp.nMaxGainDB = SpeexDSPConstants.DEFAULT_AGC_GAINMAXDB; spxdsp.bEnableDenoise = true; spxdsp.nMaxNoiseSuppressDB = SpeexDSPConstants.DEFAULT_DENOISE_SUPPRESS; spxdsp.bEnableEchoCancellation = true; spxdsp.nEchoSuppress = SpeexDSPConstants.DEFAULT_ECHO_SUPPRESS; spxdsp.nEchoSuppressActive = SpeexDSPConstants.DEFAULT_ECHO_SUPPRESS_ACTIVE; Assert.IsTrue(ttclient.InitSoundInputDevice(devin), "Init sound input"); Assert.IsTrue(ttclient.Flags.HasFlag(ClientFlag.CLIENT_SNDINPUT_READY), "Input ready"); Assert.IsTrue(ttclient.InitSoundOutputDevice(devout), "Init sound output"); Assert.IsTrue(ttclient.Flags.HasFlag(ClientFlag.CLIENT_SNDOUTPUT_READY), "Output ready"); }
private static bool WaitCmdError(TeamTalk ttclient, int cmdid, int waittimeout) { TTMessage msg = new TTMessage(); while (WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CMD_ERROR, waittimeout, ref msg)) { if (msg.nSource == cmdid) return true; } return false; }
private static bool WaitForEvent(TeamTalk ttclient, ClientEvent e, int waittimeout) { TTMessage msg = new TTMessage(); return WaitForEvent(ttclient, e, waittimeout, ref msg); }