private void cmdListSettings_Click(object sender, RoutedEventArgs e)
        {
            Button cmd = (Button)sender;

            if (cmd.DataContext is PreferenceAudioFilter)
            {
                var before = cmd.DataContext as PreferenceAudioFilter;

                switch (before.FilterType)
                {
                case PreferenceAudioFilterType.ChannelRouting:
                    var dlg = new ChannelRoutingSettings();
                    dlg.UpdateChannelRouting(before.ChannelRouting());
                    var dlgResult = dlg.ShowDialog();
                    if (dlgResult != true)
                    {
                        return;
                    }
                    before.ArgArray = BuildChannelRoutingArgArray(dlg.ChannelRouting);
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }
        }
        private void buttonLeftArrow_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxAvailableEffects.SelectedIndex < 0)
            {
                return;
            }

            PreferenceAudioFilter filter = null;

            switch ((PreferenceAudioFilterType)listBoxAvailableEffects.SelectedIndex)
            {
            case PreferenceAudioFilterType.PolarityInvert:
                filter = new PreferenceAudioFilter(PreferenceAudioFilterType.PolarityInvert, null);
                break;

            case PreferenceAudioFilterType.MonauralMix:
                filter = new PreferenceAudioFilter(PreferenceAudioFilterType.MonauralMix, null);
                break;

            case PreferenceAudioFilterType.ChannelRouting: {
                var dlg = new ChannelRoutingSettings();
                dlg.UpdateChannelRouting(null);
                var dlgResult = dlg.ShowDialog();
                if (dlgResult != true)
                {
                    return;
                }

                filter = new PreferenceAudioFilter(PreferenceAudioFilterType.ChannelRouting, BuildChannelRoutingArgArray(dlg.ChannelRouting));
            }
            break;

            default:
                System.Diagnostics.Debug.Assert(false);
                return;
            }

            if (listBoxActivatedEffects.SelectedIndex < 0)
            {
                mAudioFilterList.Add(filter);
            }
            else
            {
                mAudioFilterList.Insert(listBoxActivatedEffects.SelectedIndex + 1, filter);
            }

            AudioFilterListUpdated();
        }
        private void cmdListSettings_Click(object sender, RoutedEventArgs e)
        {
            Button cmd = (Button)sender;
            if (cmd.DataContext is PreferenceAudioFilter) {
                var before = cmd.DataContext as PreferenceAudioFilter;

                switch (before.FilterType) {
                case PreferenceAudioFilterType.ChannelRouting:
                    var dlg = new ChannelRoutingSettings();
                    dlg.UpdateChannelRouting(before.ChannelRouting());
                    var dlgResult = dlg.ShowDialog();
                    if (dlgResult != true) {
                        return;
                    }
                    before.ArgArray = BuildChannelRoutingArgArray(dlg.ChannelRouting);
                    break;
                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }
        }
        private void buttonLeftArrow_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxAvailableEffects.SelectedIndex < 0) {
                return;
            }

            PreferenceAudioFilter filter = null;
            switch ((PreferenceAudioFilterType)listBoxAvailableEffects.SelectedIndex) {
            case PreferenceAudioFilterType.PolarityInvert:
                filter = new PreferenceAudioFilter(PreferenceAudioFilterType.PolarityInvert, null);
                break;
            case PreferenceAudioFilterType.MonauralMix:
                filter = new PreferenceAudioFilter(PreferenceAudioFilterType.MonauralMix, null);
                break;
            case PreferenceAudioFilterType.ChannelRouting: {
                    var dlg = new ChannelRoutingSettings();
                    dlg.UpdateChannelRouting(null);
                    var dlgResult = dlg.ShowDialog();
                    if (dlgResult != true) {
                        return;
                    }

                    filter = new PreferenceAudioFilter(PreferenceAudioFilterType.ChannelRouting, BuildChannelRoutingArgArray(dlg.ChannelRouting));
                }
                break;
            default:
                System.Diagnostics.Debug.Assert(false);
                return;
            }

            if (listBoxActivatedEffects.SelectedIndex < 0) {
                mAudioFilterList.Add(filter);
            } else {
                mAudioFilterList.Insert(listBoxActivatedEffects.SelectedIndex+1, filter);
            }

            AudioFilterListUpdated();
        }