MCPcopy Create free account
hub / github.com/audacity/audacity / Recalc

Method Recalc

src/FreqWindow.cpp:943–997  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941}
942
943void FrequencyPlotDialog::Recalc()
944{
945 if (!mData || mDataLen < mWindowSize) {
946 DrawPlot();
947 return;
948 }
949
950 SpectrumAnalyst::Algorithm alg =
951 SpectrumAnalyst::Algorithm(mAlgChoice->GetSelection());
952 int windowFunc = mFuncChoice->GetSelection();
953
954 wxWindow *hadFocus = FindFocus();
955 // In wxMac, the skipped window MUST be a top level window. I'd originally made it
956 // just the mProgress window with the idea of preventing user interaction with the
957 // controls while the plot was being recalculated. This doesn't appear to be necessary
958 // so just use the top level window instead.
959 {
960 std::optional<wxWindowDisabler> blocker;
961 if (IsShown())
962 blocker.emplace(this);
963 wxYieldIfNeeded();
964
965 auto first = true;
966 auto progress = [&](long long num, long long den) {
967 if (first) {
968 mProgress->SetRange(den);
969 first = false;
970 }
971 mProgress->SetValue(num);
972 };
973
974 mAnalyst->Calculate(alg, windowFunc, mWindowSize, mRate,
975 mData.get(), mDataLen,
976 &mYMin, &mYMax, std::move(progress));
977
978 mProgress->Reset();
979 }
980 if (hadFocus) {
981 hadFocus->SetFocus();
982 }
983
984 if (alg == SpectrumAnalyst::Spectrum) {
985 if(mYMin < -dBRange)
986 mYMin = -dBRange;
987 if(mYMax <= -dBRange)
988 mYMax = -dBRange + 10.; // it's all out of range, but show a scale.
989 else
990 mYMax += .5;
991 }
992
993 // Prime the scrollbar
994 mPanScroller->SetScrollbar(0, (mYMax - mYMin) * 100, (mYMax - mYMin) * 100, 1);
995
996 DrawPlot();
997}
998
999void FrequencyPlotDialog::OnExport(wxCommandEvent & WXUNUSED(event))
1000{

Callers

nothing calls this directly

Calls 12

AlgorithmEnum · 0.85
FindFocusFunction · 0.85
moveFunction · 0.85
emplaceMethod · 0.80
SetScrollbarMethod · 0.80
GetSelectionMethod · 0.45
SetRangeMethod · 0.45
SetValueMethod · 0.45
CalculateMethod · 0.45
getMethod · 0.45
ResetMethod · 0.45
SetFocusMethod · 0.45

Tested by

no test coverage detected