コード例 #1
0
        private void Window_Closed(object sender, EventArgs e)
        {
            Term();

            // 設定ファイルを書き出す。
            PreferenceStore.Save(mPref);
        }
コード例 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mPref = PreferenceStore.Load();
            LocalizeUI();

            mWasapiPlay = new WasapiCS();
            mWasapiPlay.Init();

            mWasapiRec = new WasapiCS();
            mWasapiRec.Init();
            mCaptureDataArrivedDelegate = new Wasapi.WasapiCS.CaptureCallback(CaptureDataArrived);
            mWasapiRec.RegisterCaptureCallback(mCaptureDataArrivedDelegate);

            mBwStartTesting                     = new BackgroundWorker();
            mBwStartTesting.DoWork             += new DoWorkEventHandler(BwStartTesting_DoWork);
            mBwStartTesting.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BwStartTesting_RunWorkerCompleted);

            mPlayWorker                            = new BackgroundWorker();
            mPlayWorker.DoWork                    += new DoWorkEventHandler(PlayDoWork);
            mPlayWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(PlayRunWorkerCompleted);
            mPlayWorker.WorkerSupportsCancellation = true;

            mRecWorker                            = new BackgroundWorker();
            mRecWorker.DoWork                    += new DoWorkEventHandler(RecDoWork);
            mRecWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(RecRunWorkerCompleted);
            mRecWorker.WorkerSupportsCancellation = true;
            mRecWorker.WorkerReportsProgress      = true;
            mRecWorker.ProgressChanged           += new ProgressChangedEventHandler(RecWorkerProgressChanged);

            UpdateDeviceList();

            textBoxLog.Text = string.Format("WWImpulseResponse version {0}\r\n", AssemblyVersion);

            mStateChanged = new Wasapi.WasapiCS.StateChangedCallback(StateChangedCallback);
            mWasapiPlay.RegisterStateChangedCallback(mStateChanged);

            mTimeDomainPlot.SetFunctionType(WWUserControls.TimeDomainPlot.FunctionType.DiscreteTimeSequence);
            mTimeDomainPlot.SetDiscreteTimeSequence(new double[1], 44100);

            mFreqResponse.Mode = WWUserControls.FrequencyResponse.ModeType.ZPlane;
            mFreqResponse.SamplingFrequency = 48000;
            mFreqResponse.PhaseUnwarp       = true;
            //mFreqResponse.ShowPhase = false;
            mFreqResponse.ShowGroupDelay = false;
            mFreqResponse.UpdateMagnitudeRange(WWUserControls.FrequencyResponse.MagnitudeRangeType.M48dB);
            mFreqResponse.Update();

            mLevelMeterUC.PreferenceToUI(1, -6, -100);
            mLevelMeterUC.YellowLevelChangeEnable(false);
            mLevelMeterUC.SetParamChangedCallback(LevelMeterUCParamChanged);

            PreferenceToUI();

            mInitialized = true;
        }