Пример #1
0
 public static bool Save(Preference p)
 {
     var xmlRW = new WWXmlRW.XmlRW<Preference>(m_fileName);
     return xmlRW.Save(p);
 }
Пример #2
0
        public static bool Save(Preference p)
        {
            var xmlRW = new WWXmlRW.XmlRW <Preference>(m_fileName);

            return(xmlRW.Save(p));
        }
Пример #3
0
        private void buttonReset_Click(object sender, RoutedEventArgs e)
        {
            var preference = new Preference();

            UpdateUIFromPreference(preference);
        }
Пример #4
0
        private void UpdateUIFromPreference(Preference preference)
        {
            switch (preference.BitsPerSampleFixType)
            {
            case BitsPerSampleFixType.Sint16:
                comboBoxOutputFormat.SelectedIndex = (int)SettingsBitFormatType.Sint16;
                break;

            case BitsPerSampleFixType.Sint24:
                comboBoxOutputFormat.SelectedIndex = (int)SettingsBitFormatType.Sint24;
                break;

            case BitsPerSampleFixType.Sint32:
                comboBoxOutputFormat.SelectedIndex = (int)SettingsBitFormatType.Sint32;
                break;

            case BitsPerSampleFixType.Sfloat32:
                comboBoxOutputFormat.SelectedIndex = (int)SettingsBitFormatType.Sfloat32;
                break;

            case BitsPerSampleFixType.Sint32V24:
                comboBoxOutputFormat.SelectedIndex = (int)SettingsBitFormatType.Sint32V24;
                break;

            case BitsPerSampleFixType.AutoSelect:
            default:
                comboBoxOutputFormat.SelectedIndex = (int)SettingsBitFormatType.AutoSelect;
                break;
            }

            comboBoxNoiseShaping.SelectedIndex = (int)preference.BpsConvNoiseShaping;

            checkBoxPlaceKokomadeAfterIndex00.IsChecked =
                preference.ReplaceGapWithKokomade;

            checkBoxManuallySetMainWindowDimension.IsChecked =
                preference.ManuallySetMainWindowDimension;

            checkBoxStorePlaylistContent.IsChecked =
                preference.StorePlaylistContent;

            checkBoxCoverart.IsChecked =
                preference.DispCoverart;

            checkBoxReduceVolume.IsChecked =
                preference.ReduceVolume;

            switch (preference.ReduceVolumeByDb)
            {
            case 2: // -2dB
                comboBoxReduceVolumeByDb.SelectedIndex = 0;
                break;

            case 4: // -4dB
                comboBoxReduceVolumeByDb.SelectedIndex = 1;
                break;

            case 6: // -6dB
            default:
                comboBoxReduceVolumeByDb.SelectedIndex = 2;
                break;
            }

            checkBoxIsFormatSupported.IsChecked = preference.IsFormatSupportedCall;
            checkBoxParallelRead.IsChecked      = preference.ParallelRead;

            if (10000 == preference.TimePeriodHundredNanosec)
            {
                comboBoxTimePeriod.SelectedItem = cbItemTimerResolution1Millisec;
            }
            else
            {
                comboBoxTimePeriod.SelectedItem = cbItemTimerResolutionDefault;
            }

            textBoxPlayingTimeSize.Text =
                preference.PlayingTimeSize.ToString(CultureInfo.CurrentCulture);

            textBoxZeroFlushSeconds.Text =
                string.Format(CultureInfo.CurrentCulture, "{0}", preference.ZeroFlushMillisec * 0.001);

            textBoxConversionQuality.Text =
                string.Format(CultureInfo.CurrentCulture, "{0}", preference.ResamplerConversionQuality);

            checkBoxSootheLimiterApo.IsChecked = preference.SootheLimiterApo;

            sliderWindowScaling.Value =
                preference.WindowScale;

            checkBoxPlayingTimeBold.IsChecked =
                preference.PlayingTimeFontBold;

            var fontFamilies = new Dictionary <string, FontFamily>();

            foreach (FontFamily fontFamily in Fonts.SystemFontFamilies)
            {
                if (!fontFamilies.ContainsKey(fontFamily.ToString()))
                {
                    fontFamilies.Add(fontFamily.ToString(), fontFamily);
                }
            }

            foreach (var kvp in fontFamilies)
            {
                var item = new ComboBoxItem();
                item.Content = kvp.Value;
                //item.FontFamily = fontFamily;
                comboBoxPlayingTimeFontNames.Items.Add(item);
                if (kvp.Key.Equals(preference.PlayingTimeFontName))
                {
                    comboBoxPlayingTimeFontNames.SelectedItem = item;
                }
            }

            {
                mPlaylistAlternateBackgroundArgb = preference.AlternatingRowBackgroundArgb;
                rectangleColor.Fill = new SolidColorBrush(Util.ColorFromArgb(
                                                              preference.AlternatingRowBackgroundArgb));
                checkBoxAlternateBackground.IsChecked =
                    preference.AlternatingRowBackground;
                if (preference.AlternatingRowBackground)
                {
                    rectangleColor.IsEnabled    = true;
                    buttonChangeColor.IsEnabled = true;
                }
                else
                {
                    rectangleColor.IsEnabled    = false;
                    buttonChangeColor.IsEnabled = false;
                }
            }

            switch (preference.RenderThreadTaskType)
            {
            case RenderThreadTaskType.Audio:
                comboBoxRenderThreadTaskType.SelectedItem = cbItemTaskAudio;
                break;

            case RenderThreadTaskType.None:
                comboBoxRenderThreadTaskType.SelectedItem = cbItemTaskNone;
                break;

            case RenderThreadTaskType.Playback:
                comboBoxRenderThreadTaskType.SelectedItem = cbItemTaskPlayback;
                break;

            case RenderThreadTaskType.ProAudio:
            default:
                comboBoxRenderThreadTaskType.SelectedItem = cbItemTaskProAudio;
                break;
            }

            comboBoxRenderThreadPriority.SelectedIndex = (int)preference.MMThreadPriority;
            if (preference.RenderThreadTaskType == RenderThreadTaskType.None)
            {
                comboBoxRenderThreadPriority.IsEnabled = false;
            }
            else
            {
                comboBoxRenderThreadPriority.IsEnabled = true;
            }

            comboBoxCueEncoding.Items.Clear();
            foreach (var encoding in Encoding.GetEncodings())
            {
                int pos = comboBoxCueEncoding.Items.Add(encoding.DisplayName);
                if (preference.CueEncodingCodePage == encoding.CodePage)
                {
                    comboBoxCueEncoding.SelectedIndex = pos;
                }
            }

            checkBoxSortDropFolder.IsChecked =
                preference.SortDropFolder;

            checkBoxSortDroppedFiles.IsChecked =
                preference.SortDroppedFiles;

            checkBoxBatchReadEndpointToEveryTrack.IsChecked =
                preference.BatchReadEndpointToEveryTrack;

            checkBoxVerifyFlacMD5Sum.IsChecked = preference.VerifyFlacMD5Sum;
            checkBoxVerifyFlacMD5Sum.IsEnabled = preference.ParallelRead == false;

            checkBoxGpuRendering.IsChecked     = preference.GpuRendering;
            checkBoxChannelCountEven.IsChecked = preference.AddSilentForEvenChannel;

            switch (preference.ChannelCount2)
            {
            case ChannelCount2Type.MixFormatChannelCount:
                comboBoxChannelCount.SelectedItem = cbItemChannelCountMixFormat;
                break;

            case ChannelCount2Type.SourceChannelCount:
                comboBoxChannelCount.SelectedItem = cbItemChannelCountNotChange;
                break;

            case ChannelCount2Type.Ch2:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount2;
                break;

            case ChannelCount2Type.Ch4:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount4;
                break;

            case ChannelCount2Type.Ch6:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount6;
                break;

            case ChannelCount2Type.Ch8:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount8;
                break;

            case ChannelCount2Type.Ch10:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount10;
                break;

            case ChannelCount2Type.Ch16:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount16;
                break;

            case ChannelCount2Type.Ch18:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount18;
                break;

            case ChannelCount2Type.Ch24:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount24;
                break;

            case ChannelCount2Type.Ch26:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount26;
                break;

            case ChannelCount2Type.Ch32:
                comboBoxChannelCount.SelectedItem = cbItemChannelCount32;
                break;

            default:
                comboBoxChannelCount.SelectedItem = cbItemChannelCountMixFormat;
                break;
            }
        }
Пример #5
0
 public void SetPreference(Preference preference)
 {
     m_preference = preference;
 }
Пример #6
0
        public static Preference Load()
        {
            var xmlRW = new WWXmlRW.XmlRW <Preference>(m_fileName);

            int nColumnCount = 13;

            Preference p = xmlRW.Load();

            // postprocess playlist columns order info...
            // at this point, column count must be nColumnCount * 2
            if (p.PlayListColumnsOrder.Count == nColumnCount)
            {
                // very old format. no playlist column info in preference file.
            }
            else if (p.PlayListColumnsOrder.Count == nColumnCount + 10)
            {
                // old format. delete latter 10 items inserted by file load.
                p.PlayListColumnsOrderRemoveRange(nColumnCount, 10);
            }
            else if (p.PlayListColumnsOrder.Count == nColumnCount + 11)
            {
                // PlayPcmWin 4.0.98 format. delete latter 11 items inserted by file load.
                p.PlayListColumnsOrderRemoveRange(nColumnCount, 11);
            }
            else if (p.PlayListColumnsOrder.Count == nColumnCount + 12)
            {
                // PlayPcmWin 5.0.16 format. delete latter 12 items inserted by file load.
                p.PlayListColumnsOrderRemoveRange(nColumnCount, 12);
            }
            else if (p.PlayListColumnsOrder.Count == nColumnCount * 2)
            {
                // Latest PlayPcmWin 5.0.32 format. saved data is okay. delete former nColumnCount items inserted by Reset()
                p.PlayListColumnsOrderRemoveRange(0, nColumnCount);
            }
            else
            {
                System.Console.WriteLine("E: Preference PlayListColumnOrder item count {0}", p.PlayListColumnsOrder.Count);
                System.Diagnostics.Debug.Assert(false);
                p.Reset();
            }

            // (読み込んだ値が都合によりサポートされていない場合、このタイミングでロード後に強制的に上書き出来る)

            // サンプルレートの選択アルゴリズム。廃止された選択肢が選ばれていたらAutoSelectに設定する。
            switch (p.BitsPerSampleFixType)
            {
            case BitsPerSampleFixType.Variable:
            case BitsPerSampleFixType.VariableSint16Sint24:
            case BitsPerSampleFixType.VariableSint16Sint32V24:
                p.BitsPerSampleFixType = BitsPerSampleFixType.AutoSelect;
                break;

            default:
                break;
            }

            // 再描画抑止は再生時間表示がなくなるのが紛らわしいので廃止。
            p.RefrainRedraw = false;

            // 並列読み込みが有効のときはFLACのMD5計算を行わない。
            if (p.ParallelRead)
            {
                p.VerifyFlacMD5Sum = false;
            }

            // EnableNoiseShaping(古いフラグ)が無効のときはBpsConvNoiseShaping(新しい設定パラメータ)をNoneに設定。
            if (!p.EnableNoiseShaping)
            {
                p.BpsConvNoiseShaping = NoiseShapingType.None;
            }

            // DwmEnableMMCSSは、いつの頃からかエラーが出るようになったので呼び出さないようにする。
            p.DwmEnableMmcssCall = false;

            if (p.TimePeriodHundredNanosec < Preference.TIME_PERIOD_ONE_MILLISEC)
            {
                // 0.5msモードは動作不安定なので廃止。
                p.TimePeriodHundredNanosec = Preference.TIME_PERIOD_ONE_MILLISEC;
            }

            return(p);
        }