Ejemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mPref = PreferenceStore.Load();

            if (0 != string.CompareOrdinal(Thread.CurrentThread.CurrentUICulture.Name, mPref.CultureString))
            {
                // カルチャーをセットする。
                CultureInfo newCulture = new CultureInfo(mPref.CultureString);
                Thread.CurrentThread.CurrentCulture   = newCulture;
                Thread.CurrentThread.CurrentUICulture = newCulture;
            }

            comboBoxLang.SelectedIndex = CultureStringToIdx(Thread.CurrentThread.CurrentUICulture.Name);

            int hr = 0;

            hr = mWasapiCtrl.Init();
            AddLog(string.Format("RecPcmWin version {0}\r\n", AssemblyVersion));
            AddLog(string.Format("wasapi.Init() {0:X8}\r\n", hr));

            Closed += new EventHandler(MainWindow_Closed);

            CreateDeviceList();

            UpdateUITexts();

            PreferenceToUI();

            int currentSec = 0;
            int maxSec     = (int)((long)mPref.RecordingBufferSizeMB * 1024 * 1024 / GetBytesPerSec(mPref));

            UpdateDurationLabel(currentSec, maxSec);

            mLevelMeterUC.SetParamChangedCallback(LevelMeterUCParamChanged);

            mWasapiStateChangedDelegate = new Wasapi.WasapiCS.StateChangedCallback(WasapiStatusChanged);
            mWasapiCtrl.RegisterStateChangedCallback(mWasapiStateChangedDelegate);

            mInitialized = true;
        }
Ejemplo n.º 2
0
        public static bool Save(Preference p)
        {
            var xmlRW = new WWXmlRW.XmlRW <Preference>(m_fileName);

            return(xmlRW.Save(p));
        }
Ejemplo n.º 3
0
 private static int GetBytesPerSec(Preference pref)
 {
     return(pref.NumOfChannels * pref.SampleRate *
            WasapiCS.SampleFormatTypeToUseBitsPerSample(pref.SampleFormat) / 8);
 }