示例#1
0
        /// <summary>
        /// Show the uncompressed audio format form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAudio_Click(object sender, System.EventArgs e)
        {
            try
            {
                // Show the form
                frmAudioFormat af = new frmAudioFormat(ac.CaptureGraph);
                if (af.ShowDialog(this) == DialogResult.OK)
                {
                    if (ckTestAudio.Checked)
                    {
                        ckTestAudio.Checked = false;
                    }

                    // Get the media type they selected and set it
                    _AMMediaType mt;
                    object       fb;
                    af.GetMediaType(out mt, out fb);

                    #region Log

                    Log("Setting media type to...");
                    Log(MediaType.Dump(mt) + MediaType.FormatType.Dump(fb));

                    #endregion Log

                    frmAV.RenderAndRunAudio(ac.CaptureGraph, false);
                    ac.CaptureGraph.RemoveFiltersDownstreamFromSource(MSR.LST.Net.Rtp.PayloadType.dynamicAudio);

                    try
                    {
                        ac.CaptureGraph.Source.SetMediaType(mt, fb);
                    }
                    catch (COMException ex)
                    {
                        Log(DShowError._AMGetErrorText(ex.ErrorCode));
                        Log(ex.ToString());
                    }
                    catch (Exception ex)
                    {
                        Log(ex.ToString());
                    }

                    ac.SaveAudioSettings();
                    ac.AddAudioCompressor();
                    frmAV.RenderAndRunAudio(ac.CaptureGraph);

                    UpdateCurrentSettings();
                }
            }
            catch (COMException ex)
            {
                Log(DShowError._AMGetErrorText(ex.ErrorCode));
                Log(ex.ToString());
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
            }
        }
示例#2
0
        private void ckTestAudio_CheckedChanged(object sender, EventArgs e)
        {
            SaveSettings();

            try {
                ckTestAudio.Text = ckTestAudio.Checked ? Strings.StopAudio : Strings.TestAudio;
                if (ckTestAudio.Checked)
                {
                    RefreshAudioCapability();
                }
                frmAV.RenderAndRunAudio(ac.CaptureGraph, ckTestAudio.Checked);
            }
            catch (COMException ex) {
                frmAV.Log(DShowError._AMGetErrorText(ex.ErrorCode));
                frmAV.Log(ex.ToString());
            }
            catch (Exception ex) {
                frmAV.Log(ex.ToString());
            }
        }