Ejemplo n.º 1
0
        public HotKeyDlg(TeamTalkBase tt)
        {
            ttclient = tt;
            InitializeComponent();

            ttclient.OnHotKeyTest += new TeamTalkBase.HotKeyTest(ttclient_OnHotKeyTest);
        }
Ejemplo n.º 2
0
 public UserInfoDlg(TeamTalkBase tt, int userid)
 {
     ttclient = tt;
     InitializeComponent();
     this.userid = userid;
     UpdateUser();
 }
Ejemplo n.º 3
0
        public MessageDlg(TeamTalkBase tt, int userid)
        {
            ttclient    = tt;
            this.userid = userid;

            InitializeComponent();
            this.CenterToScreen();
        }
Ejemplo n.º 4
0
        public FileTransferDlg(TeamTalkBase tt, int transferid)
        {
            this.ttclient   = tt;
            this.transferid = transferid;
            InitializeComponent();

            ttclient.OnFileTransfer += new TeamTalkBase.FileTransferUpdate(ttclient_OnFileTransfer);
            UpdateFileTransfer();
        }
Ejemplo n.º 5
0
        public ServerStatsDlg(TeamTalkBase tt)
        {
            InitializeComponent();
            ttclient = tt;

            ttclient.OnCmdServerStatistics += new TeamTalkBase.ServerStats(ttclient_OnCmdServerStatistics);

            cmd_id = ttclient.DoQueryServerStats();
            this.CenterToScreen();
        }
Ejemplo n.º 6
0
        public DesktopDlg(TeamTalkBase tt, int userid)
        {
            ttclient    = tt;
            this.userid = userid;

            InitializeComponent();
            this.CenterToScreen();

            ttclient.OnUserDesktopWindow += new TeamTalkBase.NewDesktopWindow(ttclient_OnUserDesktopWindow);
        }
Ejemplo n.º 7
0
        public ConnectDlg(TeamTalkBase 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;
        }
Ejemplo n.º 8
0
        public LoginDlg(TeamTalkBase 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 TeamTalkBase.CommandProcessing(ttclient_OnCmdProcessing);
            ttclient.OnCmdError      += new TeamTalkBase.CommandError(ttclient_OnCmdError);
        }
Ejemplo n.º 9
0
        public FilesView(TeamTalkBase 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 TeamTalkBase.FileUpdate(ttclient_OnCmdFileNew);
            ttclient.OnCmdFileRemove        += new TeamTalkBase.FileUpdate(ttclient_OnCmdFileRemove);
            ttclient.OnCmdUserJoinedChannel += new TeamTalkBase.UserUpdate(ttclient_OnCmdUserJoinedChannel);
        }
Ejemplo n.º 10
0
        public ChannelsView(TeamTalkBase tt, TreeView tree)
        {
            ttclient = tt;
            treeview = tree;

            ttclient.OnCmdChannelNew    += new TeamTalkBase.ChannelUpdate(ttclient_OnCmdChannelNew);
            ttclient.OnCmdChannelUpdate += new TeamTalkBase.ChannelUpdate(ttclient_OnCmdChannelUpdate);
            ttclient.OnCmdChannelRemove += new TeamTalkBase.ChannelUpdate(ttclient_OnCmdChannelRemove);

            ttclient.OnCmdUserJoinedChannel += new TeamTalkBase.UserUpdate(ttclient_OnCmdUserJoinedChannel);
            ttclient.OnCmdUserUpdate        += new TeamTalkBase.UserUpdate(ttclient_OnCmdUserUpdate);
            ttclient.OnCmdUserLeftChannel   += new TeamTalkBase.UserUpdate(ttclient_OnCmdUserLeftChannel);

            ttclient.OnUserStateChange += new TeamTalkBase.UserUpdate(ttclient_OnUserStateChange);
            ttclient.OnVoiceActivation += new TeamTalkBase.VoiceActivation(ttclient_OnVoiceActivation);
        }
Ejemplo n.º 11
0
        public UsersView(TeamTalkBase 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 TeamTalkBase.UserUpdate(ttclient_OnCmdUserLoggedIn);
            ttclient.OnCmdUserLoggedOut += new TeamTalkBase.UserUpdate(ttclient_OnCmdUserLoggedOut);
            ttclient.OnCmdUserUpdate    += new TeamTalkBase.UserUpdate(ttclient_OnCmdUserUpdate);
        }
Ejemplo n.º 12
0
        public PreferencesDlg(TeamTalkBase 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);
        }
Ejemplo n.º 13
0
        private void UpdateVideoCaptureDevices()
        {
            if (!TeamTalkBase.GetVideoCaptureDevices(out videodevs) || videodevs.Length == 0)
            {
                return;
            }

            foreach (VideoCaptureDevice dev in videodevs)
            {
                int index = viddevComboBox.Items.Add(dev.szDeviceName);
                if (dev.szDeviceID == settings.videoid)
                {
                    viddevComboBox.SelectedIndex = index;
                }
            }
            if (viddevComboBox.SelectedIndex < 0)
            {
                viddevComboBox.SelectedIndex = 0;
            }
        }
Ejemplo n.º 14
0
        public VideoDlg(TeamTalkBase 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 TeamTalkBase.UserVideoFrame(ttclient_OnUserVideoFrame);
        }
Ejemplo n.º 15
0
        private void openButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.Filter           = "All files (*.*)|*.*";
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            textBox1.Text = openFileDialog1.FileName;

            if (TeamTalkBase.GetMediaFileInfo(openFileDialog1.FileName, ref info))
            {
                if (info.audioFmt.nAudioFmt != AudioFileFormat.AFF_NONE)
                {
                    audioLabel.Text = String.Format("{0} Hz, {1}", info.audioFmt.nSampleRate,
                                                    (info.audioFmt.nChannels == 1 ? "Mono" : "Stereo"));
                }
                else
                {
                    audioLabel.Text = "Unknown";
                }

                if (info.videoFmt.picFourCC != FourCC.FOURCC_NONE)
                {
                    videoLabel.Text = String.Format("{0}x{1} FPS: {2}",
                                                    info.videoFmt.nWidth, info.videoFmt.nHeight, info.videoFmt.nFPS_Numerator);
                }
                else
                {
                    videoLabel.Text = "Unknown";
                }
            }
            else
            {
                info = new MediaFileInfo();
            }
        }
Ejemplo n.º 16
0
        public UserAccountsDlg(TeamTalkBase 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 TeamTalkBase.CommandProcessing(ttclient_OnCmdProcessing);
            ttclient.OnCmdError       += new TeamTalkBase.CommandError(ttclient_OnCmdError);
            ttclient.OnCmdSuccess     += new TeamTalkBase.CommandSuccess(ttclient_OnCmdSuccess);
            ttclient.OnCmdUserAccount += new TeamTalkBase.ListUserAccount(ttclient_OnCmdUserAccount);

            //hopefully you have less than 100000 accounts
            list_cmdid = ttclient.DoListUserAccounts(0, 100000);
        }
Ejemplo n.º 17
0
        public ServerPropertiesDlg(TeamTalkBase 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;
        }
Ejemplo n.º 18
0
        private void UpdateSelectedSoundDevices(object sender, EventArgs e)
        {
            if (sndinputComboBox.SelectedItem == null ||
                sndoutputComboBox.SelectedItem == null)
            {
                return;
            }

            int inputid  = ((ItemData)sndinputComboBox.SelectedItem).id;
            int outputid = ((ItemData)sndoutputComboBox.SelectedItem).id;

            SoundDevice[] devs;
            TeamTalkBase.GetSoundDevices(out devs);

            int in_samplerate = 0, out_samplerate = 0;

            foreach (SoundDevice dev in devs)
            {
                if (dev.nDeviceID == inputid)
                {
                    in_samplerate = dev.nDefaultSampleRate;
                }
                if (dev.nDeviceID == outputid)
                {
                    out_samplerate = dev.nDefaultSampleRate;
                }
            }

            //for duplex mode both input and output sound device must support the same sample rate
            duplexCheckBox.Enabled = in_samplerate == out_samplerate;
            if (in_samplerate != out_samplerate)
            {
                duplexCheckBox.Checked     = false;
                echocancelCheckBox.Checked = false;
            }
            echocancelCheckBox.Enabled = duplexCheckBox.Checked;
        }
Ejemplo n.º 19
0
        private void sndTestCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            ItemData input  = (ItemData)sndinputComboBox.SelectedItem;
            ItemData output = (ItemData)sndoutputComboBox.SelectedItem;

            if (sndTestCheckBox.Checked)
            {
                //Extract input device and get its default samplerate.
                //WASAPI devices only support one sample rate so it's important to use the correct one.
                SoundDevice[] devs;
                TeamTalkBase.GetSoundDevices(out devs);

                int in_samplerate = 0;
                foreach (SoundDevice dev in devs)
                {
                    if (dev.nDeviceID == input.id)
                    {
                        in_samplerate = dev.nDefaultSampleRate;
                    }
                }

                SpeexDSP spxdsp = new SpeexDSP(true);
                spxdsp.bEnableAGC              = true;
                spxdsp.bEnableDenoise          = true;
                spxdsp.bEnableEchoCancellation = echocancelCheckBox.Checked;
                soundloop = TeamTalkBase.StartSoundLoopbackTest(input.id, output.id, in_samplerate, 1, duplexCheckBox.Checked, spxdsp);
                if (soundloop == IntPtr.Zero)
                {
                    MessageBox.Show("Failed to test selected device");
                    sndTestCheckBox.Checked = false;
                }
            }
            else
            {
                TeamTalkBase.CloseSoundLoopbackTest(soundloop);
            }
        }
Ejemplo n.º 20
0
        void UpdateSoundSystem(object sender, EventArgs e)
        {
            sndinputComboBox.Items.Clear();
            sndoutputComboBox.Items.Clear();

            SoundDevice[] devs;
            TeamTalkBase.GetSoundDevices(out devs);

            SoundSystem soundsystem = SoundSystem.SOUNDSYSTEM_WASAPI;

            if (dsoundRadioButton.Checked)
            {
                soundsystem = SoundSystem.SOUNDSYSTEM_DSOUND;
                Debug.WriteLine("DirectSound devices");
            }
            else if (winmmRadioButton.Checked)
            {
                soundsystem = SoundSystem.SOUNDSYSTEM_WINMM;
                Debug.WriteLine("WinMM devices");
            }
            else
            {
                Debug.WriteLine("WASAPI devices");
            }

            Debug.WriteLine("INPUT DEVICES");
            foreach (SoundDevice dev in devs)
            {
                if (dev.nSoundSystem != soundsystem)
                {
                    continue;
                }
                Debug.WriteLine("Name " + dev.szDeviceName);
                Debug.WriteLine("\tID #" + dev.nDeviceID);
                Debug.WriteLine("\tUnique ID #" + dev.szDeviceID);
                Debug.WriteLine("\tWaveDeviceID #" + dev.nWaveDeviceID);
                string tmp = "";
                if (WindowsMixer.GetWaveInName(dev.nWaveDeviceID, ref tmp))
                {
                    Debug.WriteLine("\tMixer name: " + tmp);
                }
                for (int i = 0; i < WindowsMixer.GetWaveInControlCount(dev.nWaveDeviceID); i++)
                {
                    if (WindowsMixer.GetWaveInControlName(dev.nWaveDeviceID, i, ref tmp))
                    {
                        Debug.WriteLine("\t\tControl name: " + tmp);
                        Debug.WriteLine("\t\tSelected: " + WindowsMixer.GetWaveInControlSelected(dev.nWaveDeviceID, i));
                    }
                }

                if (dev.nMaxInputChannels > 0)
                {
                    int index = sndinputComboBox.Items.Add(new ItemData(dev.szDeviceName, dev.nDeviceID));
                    if (dev.nDeviceID == settings.sndinputid)
                    {
                        sndinputComboBox.SelectedIndex = index;
                    }
                }
                if (dev.nMaxOutputChannels > 0)
                {
                    int index = sndoutputComboBox.Items.Add(new ItemData(dev.szDeviceName, dev.nDeviceID));
                    if (dev.nDeviceID == settings.sndoutputid)
                    {
                        sndoutputComboBox.SelectedIndex = index;
                    }
                }
            }
            if (sndinputComboBox.SelectedIndex < 0 && sndinputComboBox.Items.Count > 0)
            {
                sndinputComboBox.SelectedIndex = 0;
            }
            if (sndoutputComboBox.SelectedIndex < 0 && sndoutputComboBox.Items.Count > 0)
            {
                sndoutputComboBox.SelectedIndex = 0;
            }
        }
Ejemplo n.º 21
0
 public MediaFileDlg(TeamTalkBase ttclient)
 {
     this.ttclient = ttclient;
     InitializeComponent();
 }
Ejemplo n.º 22
0
 private void PreferencesDlg_FormClosing(object sender, FormClosingEventArgs e)
 {
     TeamTalkBase.CloseSoundLoopbackTest(soundloop);
 }
Ejemplo n.º 23
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            DesktopWindow tmp_wnd = ttclient.AcquireUserDesktopWindow(userid);

            if (tmp_wnd.nSessionID <= 0)
            {
                ttclient.ReleaseUserDesktopWindow(deskwnd);
                this.Close();
                return;
            }

            ttclient.ReleaseUserDesktopWindow(deskwnd);

            deskwnd = tmp_wnd;

            if (ClientSize.Height != deskwnd.nHeight || ClientSize.Width != deskwnd.nWidth)
            {
                ClientSize = new Size(deskwnd.nWidth, deskwnd.nHeight);
                //int width_diff = deskwnd.nWidth - ClientSize.Width;
                //int height_diff = deskwnd.nHeight - ClientSize.Height;
                //this.Size.Width += width_diff;
                //this.Size.Height += height_diff;
            }

            if (bmp != null)
            {
                bmp.Dispose();
            }
            bmp = null;

            switch (deskwnd.bmpFormat)
            {
            case BitmapFormat.BMP_RGB8_PALETTE:
                bmp = new Bitmap(deskwnd.nWidth, deskwnd.nHeight, deskwnd.nBytesPerLine,
                                 PixelFormat.Format8bppIndexed, deskwnd.frameBuffer);
                ColorPalette pal = bmp.Palette;
                for (int i = 0; i < 256; i++)
                {
                    pal.Entries[i] = TeamTalkBase.Palette_GetColorTable(BitmapFormat.BMP_RGB8_PALETTE, i);
                }
                bmp.Palette = pal;
                break;

            case BitmapFormat.BMP_RGB16_555:
                bmp = new Bitmap(deskwnd.nWidth, deskwnd.nHeight,
                                 deskwnd.nBytesPerLine, PixelFormat.Format16bppRgb555,
                                 deskwnd.frameBuffer);
                break;

            case BitmapFormat.BMP_RGB24:
                bmp = new Bitmap(deskwnd.nWidth, deskwnd.nHeight, deskwnd.nBytesPerLine,
                                 PixelFormat.Format24bppRgb, deskwnd.frameBuffer);
                break;

            case BitmapFormat.BMP_RGB32:
                bmp = new Bitmap(deskwnd.nWidth, deskwnd.nHeight, deskwnd.nBytesPerLine,
                                 PixelFormat.Format32bppRgb, deskwnd.frameBuffer);
                break;
            }

            Invalidate();
        }
Ejemplo n.º 24
0
        public ChannelDlg(TeamTalkBase 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;
            }
        }