Exemple #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());
            }
        }
        private void btnAudio_Click(object sender, System.EventArgs e)
        {
            try
            {
                // Show the form
                frmAudioFormat af = new frmAudioFormat(acg.AudioSource);
                if(af.ShowDialog(this) == DialogResult.OK)
                {
                    // 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(acg, false);
                    acg.RemoveFiltersDownstreamFrom(acg.Source);

                    try
                    {
                        acg.AudioSource.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(acg);

                    UpdateCurrentSettings();
                }
            }
            catch(COMException ex)
            {
                Log(DShowError._AMGetErrorText(ex.ErrorCode));
                Log(ex.ToString());
            }
            catch(Exception ex)
            {
                Log(ex.ToString());
            }
        }