private void buttonLeftArrow_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxAvailableEffects.SelectedIndex < 0) {
                return;
            }

            PreferenceAudioFilter filter = null;
            var filterType = (PreferenceAudioFilterType)listBoxAvailableEffects.SelectedIndex;
            switch (filterType) {
            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 ChannelMappingSettings();
                    dlg.UpdateChannelMapping(null);
                    var dlgResult = dlg.ShowDialog();
                    if (dlgResult != true) {
                        return;
                    }

                    filter = new PreferenceAudioFilter(PreferenceAudioFilterType.ChannelRouting, BuildChannelMappingArgArray(dlg.ChannelMapping));
                }
                break;
            case PreferenceAudioFilterType.MuteChannel:
            case PreferenceAudioFilterType.SoloChannel: {
                    var dlg = new ChannelSelect();
                    var dlgResult = dlg.ShowDialog();
                    if (dlgResult != true) {
                        return;
                    }
                    filter = new PreferenceAudioFilter(filterType, new string[1] { dlg.SelectedChannel.ToString() });
                }
                break;
            default:
                System.Diagnostics.Debug.Assert(false);
                return;
            }

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

            AudioFilterListUpdated();
        }
Ejemplo n.º 2
0
        private void buttonLeftArrow_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxAvailableEffects.SelectedIndex < 0)
            {
                return;
            }

            PreferenceAudioFilter filter = null;
            var filterType = (PreferenceAudioFilterType)listBoxAvailableEffects.SelectedIndex;

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

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

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

            case PreferenceAudioFilterType.PolarityInvert:
            case PreferenceAudioFilterType.MuteChannel:
            case PreferenceAudioFilterType.SoloChannel: {
                var dlg = new ChannelSelect();

                if (filterType == PreferenceAudioFilterType.PolarityInvert)
                {
                    // デフォルトで両チャンネル極性反転。
                    dlg.SetChannel(0, true);
                    dlg.SetChannel(1, true);
                }

                var dlgResult = dlg.ShowDialog();
                if (dlgResult != true)
                {
                    return;
                }

                var selectedChannelsStr = SelectedChannelFlagsToString(dlg.SelectedChannels);
                if (selectedChannelsStr.Length == 0)
                {
                    MessageBox.Show("Please select one or more channels.");
                    return;
                }
                else
                {
                    filter = new PreferenceAudioFilter(filterType, new string[1] {
                            selectedChannelsStr
                        });
                }
            }
            break;

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

            case PreferenceAudioFilterType.Delay: {
                var dlg       = new DelaySettingsWindow();
                var dlgResult = dlg.ShowDialog();
                if (dlgResult != true)
                {
                    return;
                }

                filter = new PreferenceAudioFilter(PreferenceAudioFilterType.Delay, new string[1] {
                        dlg.DelayString
                    });
            }
            break;

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

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

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

            AudioFilterListUpdated();
        }
Ejemplo n.º 3
0
        private void buttonLeftArrow_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxAvailableEffects.SelectedIndex < 0)
            {
                return;
            }

            PreferenceAudioFilter filter = null;
            var filterType = (PreferenceAudioFilterType)listBoxAvailableEffects.SelectedIndex;

            switch (filterType)
            {
            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 ChannelMappingSettings();
                dlg.UpdateChannelMapping(null);
                var dlgResult = dlg.ShowDialog();
                if (dlgResult != true)
                {
                    return;
                }

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

            case PreferenceAudioFilterType.MuteChannel:
            case PreferenceAudioFilterType.SoloChannel: {
                var dlg       = new ChannelSelect();
                var dlgResult = dlg.ShowDialog();
                if (dlgResult != true)
                {
                    return;
                }
                filter = new PreferenceAudioFilter(filterType, new string[1] {
                        dlg.SelectedChannel.ToString()
                    });
            }
            break;

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

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

            AudioFilterListUpdated();
        }