Audacity 3.2.0
Enumerations | Functions | Variables
anonymous_namespace{SpectrogramSettings.cpp} Namespace Reference

Enumerations

enum  { WINDOW , TWINDOW , DWINDOW }
 

Functions

void RecreateWindow (Floats &window, int which, size_t fftLen, size_t padding, int windowType, size_t windowSize, double &scale)
 

Variables

IntSetting SpectrumAlgorithm
 
IntSetting SpectrumScale
 
IntSetting SpectrumWindowFunction
 
BoolSetting SpectrumEnableSelection
 
IntSetting SpectrumFFTSize
 
IntSetting SpectrumFrequencyGain
 
IntSetting SpectrumGain
 
BoolSetting SpectrumGrayscale
 
IntSetting SpectrumMinFreq
 
IntSetting SpectrumRange
 
IntSetting SpectrumZeroPaddingFactor
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Function Documentation

◆ RecreateWindow()

void anonymous_namespace{SpectrogramSettings.cpp}::RecreateWindow ( Floats window,
int  which,
size_t  fftLen,
size_t  padding,
int  windowType,
size_t  windowSize,
double &  scale 
)

Definition at line 538 of file SpectrogramSettings.cpp.

541 {
542 // Create the requested window function
543 window = Floats{ fftLen };
544 size_t ii;
545
546 const bool extra = padding > 0;
547 wxASSERT(windowSize % 2 == 0);
548 if (extra)
549 // For windows that do not go to 0 at the edges, this improves symmetry
550 ++windowSize;
551 const size_t endOfWindow = padding + windowSize;
552 // Left and right padding
553 for (ii = 0; ii < padding; ++ii) {
554 window[ii] = 0.0;
555 window[fftLen - ii - 1] = 0.0;
556 }
557 // Default rectangular window in the middle
558 for (; ii < endOfWindow; ++ii)
559 window[ii] = 1.0;
560 // Overwrite middle as needed
561 switch (which) {
562 case WINDOW:
563 NewWindowFunc(windowType, windowSize, extra, window.get() + padding);
564 break;
565 case TWINDOW:
566 NewWindowFunc(windowType, windowSize, extra, window.get() + padding);
567 {
568 for (int jj = padding, multiplier = -(int)windowSize / 2; jj < (int)endOfWindow; ++jj, ++multiplier)
569 window[jj] *= multiplier;
570 }
571 break;
572 case DWINDOW:
573 DerivativeOfWindowFunc(windowType, windowSize, extra, window.get() + padding);
574 break;
575 default:
576 wxASSERT(false);
577 }
578 // Scale the window function to give 0dB spectrum for 0dB sine tone
579 if (which == WINDOW) {
580 scale = 0.0;
581 for (ii = padding; ii < endOfWindow; ++ii)
582 scale += window[ii];
583 if (scale > 0)
584 scale = 2.0 / scale;
585 }
586 for (ii = padding; ii < endOfWindow; ++ii)
587 window[ii] *= scale;
588 }
void NewWindowFunc(int whichFunction, size_t NumSamplesIn, bool extraSample, float *in)
Definition: FFT.cpp:368
void DerivativeOfWindowFunc(int whichFunction, size_t NumSamples, bool extraSample, float *in)
Definition: FFT.cpp:536

References DerivativeOfWindowFunc(), DWINDOW, NewWindowFunc(), TWINDOW, WINDOW, SpectrogramSettings::window, SpectrogramSettings::windowSize, and SpectrogramSettings::windowType.

Referenced by SpectrogramSettings::CacheWindows().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ SpectrumAlgorithm

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumAlgorithm
Initial value:
{
L"/Spectrum/Algorithm", 0 }

Definition at line 40 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumEnableSelection

BoolSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumEnableSelection

◆ SpectrumFFTSize

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumFFTSize
Initial value:
{
L"/Spectrum/FFTSize", 2048 }

Definition at line 49 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumFrequencyGain

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumFrequencyGain
Initial value:
{
L"/Spectrum/FrequencyGain", 0 }

Definition at line 51 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumGain

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumGain
Initial value:
{
L"/Spectrum/Gain", 20 }

Definition at line 53 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumGrayscale

BoolSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumGrayscale
Initial value:
{
L"/Spectrum/Grayscale", false }

Definition at line 55 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::ColorSchemeEnumSetting::Migrate().

◆ SpectrumMinFreq

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumMinFreq
Initial value:
{
L"/Spectrum/MinFreq", 0 }

Definition at line 57 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumRange

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumRange
Initial value:
{
L"/Spectrum/Range", 80 }

Definition at line 59 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumScale

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumScale
Initial value:
{
L"/Spectrum/ScaleType", 2 }

Definition at line 42 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumWindowFunction

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumWindowFunction
Initial value:
{
L"/Spectrum/WindowType", eWinFuncHann }
@ eWinFuncHann
Definition: FFT.h:114

Definition at line 44 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().

◆ SpectrumZeroPaddingFactor

IntSetting anonymous_namespace{SpectrogramSettings.cpp}::SpectrumZeroPaddingFactor
Initial value:
{
L"/Spectrum/ZeroPaddingFactor", 2 }

Definition at line 61 of file SpectrogramSettings.cpp.

Referenced by SpectrogramSettings::LoadPrefs(), SpectrogramSettings::SavePrefs(), and SpectrogramSettings::UpdatePrefs().