コード例 #1
0
 public static void Save(List <PreferenceAudioFilter> audioFilterList)
 {
     using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(
                m_fileName, System.IO.FileMode.Create,
                IsolatedStorageFile.GetUserStoreForDomain())) {
         PreferenceAudioFilter.SaveFilteresToStream(audioFilterList, isfs);
     }
 }
コード例 #2
0
        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();
        }
コード例 #3
0
        public static List <PreferenceAudioFilter> Load()
        {
            var result = new List <PreferenceAudioFilter>();

            try {
                using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(
                           m_fileName, System.IO.FileMode.Open,
                           IsolatedStorageFile.GetUserStoreForDomain())) {
                    result = PreferenceAudioFilter.LoadFiltersFromStream(isfs);
                }
            } catch (System.Exception ex) {
                Console.WriteLine(ex);
            }

            return(result);
        }
コード例 #4
0
        private static List <PreferenceAudioFilter> TryLoad(string path)
        {
            var result = new List <PreferenceAudioFilter>();

            try {
                using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(
                           path, System.IO.FileMode.Open,
                           IsolatedStorageFile.GetUserStoreForDomain())) {
                    result = PreferenceAudioFilter.LoadFiltersFromStream(isfs);
                }
            } catch (System.Exception ex) {
                // file not found
                Console.WriteLine(ex);
                result = null;
            }
            return(result);
        }
コード例 #5
0
        public PreferenceAudioFilter Copy()
        {
            var p = new PreferenceAudioFilter(FilterType, mArgArray);

            return(p);
        }
コード例 #6
0
        public PreferenceAudioFilter Copy()
        {
            var p = new PreferenceAudioFilter(FilterType, mArgArray);

            return p;
        }
コード例 #7
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();
        }
コード例 #8
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();
        }