Example #1
0
        private void RefreshList(Object sender, Windows.UI.Xaml.RoutedEventArgs evt)
        {
            AudioCaptureEffectsManager  CaptureEffectsManagerLocal;
            IReadOnlyList <AudioEffect> Effectslist;
            int           deviceIndex = DevicesList.SelectedIndex;
            MediaCategory Category;

            if (CategoriesList.SelectedIndex < 0)
            {
                Category = MediaCategory.Communications;
            }
            else
            {
                Category = (MediaCategory)CategoriesList.SelectedIndex;
            }

            if (deviceIndex < 0)
            {
                CaptureEffectsManagerLocal = AudioEffectsManager.CreateAudioCaptureEffectsManager(
                    MediaDevice.GetDefaultAudioCaptureId(AudioDeviceRole.Communications),
                    Category,
                    Windows.Media.AudioProcessing.Default);
                lblEffects.DataContext = new EffectLabelView {
                    EffectLabelName = "Effects Active on {Default Device}"
                };
            }
            else
            {
                CaptureEffectsManagerLocal = AudioEffectsManager.CreateAudioCaptureEffectsManager(
                    m_DeviceInfo[deviceIndex].Id,
                    Category,
                    Windows.Media.AudioProcessing.Default);
                lblEffects.DataContext = new EffectLabelView {
                    EffectLabelName = "Effects Active on  {" + m_DeviceInfo[deviceIndex].Name + "}"
                };
            }

            Effectslist = CaptureEffectsManagerLocal.GetAudioCaptureEffects();
            DisplayEffectsList(Effectslist);
        }
Example #2
0
        private void StartStopMonitor(Object sender, Windows.UI.Xaml.RoutedEventArgs evt)
        {
            if (m_MonitorStarted == true)
            {
                if (m_CaptureEffectsManager != null)
                {
                    m_CaptureEffectsManager.AudioCaptureEffectsChanged -= OnCaptureEffectsChanged;
                    m_CaptureEffectsManager = null;
                }
                // No longer monitoring effects changes; re-enable button for "Refresh Effects List"
                btnRefreshEffects.IsEnabled = true;
                // Reset effects list to empty
                lblEffects.DataContext = new EffectLabelView {
                    EffectLabelName = "Effects"
                };
                DisplayEmptyEffectsList();
                m_MonitorStarted            = false;
                btnStartStopMonitor.Content = "Start Monitoring";
            }
            else
            {
                int           deviceIndex = DevicesList.SelectedIndex;
                MediaCategory Category;

                if (CategoriesList.SelectedIndex < 0)
                {
                    Category = MediaCategory.Communications;
                }
                else
                {
                    Category = (MediaCategory)CategoriesList.SelectedIndex;
                }

                if (deviceIndex < 0)
                {
                    m_CaptureEffectsManager = AudioEffectsManager.CreateAudioCaptureEffectsManager(
                        MediaDevice.GetDefaultAudioCaptureId(AudioDeviceRole.Communications),
                        Category,
                        Windows.Media.AudioProcessing.Default);
                    m_CaptureEffectsManager.AudioCaptureEffectsChanged += OnCaptureEffectsChanged;
                    lblEffects.DataContext = new EffectLabelView {
                        EffectLabelName = "Effects Active on {Default Device}"
                    };
                }
                else
                {
                    m_CaptureEffectsManager = AudioEffectsManager.CreateAudioCaptureEffectsManager(
                        m_DeviceInfo[deviceIndex].Id,
                        Category,
                        Windows.Media.AudioProcessing.Default);
                    m_CaptureEffectsManager.AudioCaptureEffectsChanged += OnCaptureEffectsChanged;
                    lblEffects.DataContext = new EffectLabelView {
                        EffectLabelName = "Effects Active on  {" + m_DeviceInfo[deviceIndex].Name + "}"
                    };
                }

                // Display current effects once
                IReadOnlyList <AudioEffect> Effectslist = m_CaptureEffectsManager.GetAudioCaptureEffects();
                DisplayEffectsList(Effectslist);

                // Start monitoring effects changes; for now disable button for "Refresh Effects List"
                btnRefreshEffects.IsEnabled = false;
                m_MonitorStarted            = true;
                btnStartStopMonitor.Content = "Stop Monitoring";
            }
        }