mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 16:40:07 +02:00
Conditional compilation (disabled) to make Spectral selection choice global...
... not per track, and the preferences or View Settings page has a separate static box for global settings as opposed to track settings. This is the only global setting for now.
This commit is contained in:
parent
f74713f020
commit
7d379cde13
@ -2344,7 +2344,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
|||||||
(zoomInfo.PositionToTime(0, -leftOffset) - tOffset)
|
(zoomInfo.PositionToTime(0, -leftOffset) - tOffset)
|
||||||
);
|
);
|
||||||
|
|
||||||
const bool isSpectral = settings.spectralSelection;
|
const bool isSpectral = settings.SpectralSelectionEnabled();
|
||||||
const bool hidden = (ZoomInfo::HIDDEN == zoomInfo.GetFisheyeState());
|
const bool hidden = (ZoomInfo::HIDDEN == zoomInfo.GetFisheyeState());
|
||||||
const int begin = hidden
|
const int begin = hidden
|
||||||
? 0
|
? 0
|
||||||
|
@ -1813,7 +1813,7 @@ inline bool isSpectralSelectionTrack(const Track *pTrack, bool *pLogf = NULL) {
|
|||||||
settings.scaleType == SpectrogramSettings::stLogarithmic;
|
settings.scaleType == SpectrogramSettings::stLogarithmic;
|
||||||
*pLogf = logF;
|
*pLogf = logF;
|
||||||
}
|
}
|
||||||
return (display == WaveTrack::Spectrum) && settings.spectralSelection;
|
return (display == WaveTrack::Spectrum) && settings.SpectralSelectionEnabled();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (pLogf)
|
if (pLogf)
|
||||||
|
@ -605,7 +605,7 @@ bool NyquistEffect::Process()
|
|||||||
const WaveTrack::WaveTrackDisplay display = mCurTrack[0]->GetDisplay();
|
const WaveTrack::WaveTrackDisplay display = mCurTrack[0]->GetDisplay();
|
||||||
const bool bAllowSpectralEditing =
|
const bool bAllowSpectralEditing =
|
||||||
(display == WaveTrack::Spectrum) &&
|
(display == WaveTrack::Spectrum) &&
|
||||||
mCurTrack[0]->GetSpectrogramSettings().spectralSelection;
|
mCurTrack[0]->GetSpectrogramSettings().SpectralSelectionEnabled();
|
||||||
|
|
||||||
if (bAllowSpectralEditing) {
|
if (bAllowSpectralEditing) {
|
||||||
#if defined(EXPERIMENTAL_SPECTRAL_EDITING)
|
#if defined(EXPERIMENTAL_SPECTRAL_EDITING)
|
||||||
|
@ -26,6 +26,33 @@ Paul Licameli
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
SpectrogramSettings::Globals::Globals()
|
||||||
|
{
|
||||||
|
LoadPrefs();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpectrogramSettings::Globals::SavePrefs()
|
||||||
|
{
|
||||||
|
#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
gPrefs->Write(wxT("/Spectrum/EnableSpectralSelection"), spectralSelection);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpectrogramSettings::Globals::LoadPrefs()
|
||||||
|
{
|
||||||
|
#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
spectralSelection
|
||||||
|
= (gPrefs->Read(wxT("/Spectrum/EnableSpectralSelection"), 0L) != 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
SpectrogramSettings::Globals
|
||||||
|
&SpectrogramSettings::Globals::Get()
|
||||||
|
{
|
||||||
|
static Globals instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
SpectrogramSettings::SpectrogramSettings()
|
SpectrogramSettings::SpectrogramSettings()
|
||||||
: hFFT(0)
|
: hFFT(0)
|
||||||
, window(0)
|
, window(0)
|
||||||
@ -48,7 +75,9 @@ SpectrogramSettings::SpectrogramSettings(const SpectrogramSettings &other)
|
|||||||
#endif
|
#endif
|
||||||
, isGrayscale(other.isGrayscale)
|
, isGrayscale(other.isGrayscale)
|
||||||
, scaleType(other.scaleType)
|
, scaleType(other.scaleType)
|
||||||
|
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
, spectralSelection(other.spectralSelection)
|
, spectralSelection(other.spectralSelection)
|
||||||
|
#endif
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
, fftYGrid(other.fftYGrid)
|
, fftYGrid(other.fftYGrid)
|
||||||
#endif
|
#endif
|
||||||
@ -82,7 +111,9 @@ SpectrogramSettings &SpectrogramSettings::operator= (const SpectrogramSettings &
|
|||||||
#endif
|
#endif
|
||||||
isGrayscale = other.isGrayscale;
|
isGrayscale = other.isGrayscale;
|
||||||
scaleType = other.scaleType;
|
scaleType = other.scaleType;
|
||||||
|
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
spectralSelection = other.spectralSelection;
|
spectralSelection = other.spectralSelection;
|
||||||
|
#endif
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
fftYGrid = other.fftYGrid;
|
fftYGrid = other.fftYGrid;
|
||||||
#endif
|
#endif
|
||||||
@ -219,7 +250,10 @@ void SpectrogramSettings::LoadPrefs()
|
|||||||
isGrayscale = (gPrefs->Read(wxT("/Spectrum/Grayscale"), 0L) != 0);
|
isGrayscale = (gPrefs->Read(wxT("/Spectrum/Grayscale"), 0L) != 0);
|
||||||
|
|
||||||
scaleType = ScaleType(gPrefs->Read(wxT("/Spectrum/ScaleType"), 0L));
|
scaleType = ScaleType(gPrefs->Read(wxT("/Spectrum/ScaleType"), 0L));
|
||||||
|
|
||||||
|
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
spectralSelection = (gPrefs->Read(wxT("/Spectrum/EnableSpectralSelection"), 0L) != 0);
|
spectralSelection = (gPrefs->Read(wxT("/Spectrum/EnableSpectralSelection"), 0L) != 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
fftYGrid = (gPrefs->Read(wxT("/Spectrum/FFTYGrid"), 0L) != 0);
|
fftYGrid = (gPrefs->Read(wxT("/Spectrum/FFTYGrid"), 0L) != 0);
|
||||||
@ -276,7 +310,10 @@ void SpectrogramSettings::SavePrefs()
|
|||||||
gPrefs->Write(wxT("/Spectrum/Grayscale"), isGrayscale);
|
gPrefs->Write(wxT("/Spectrum/Grayscale"), isGrayscale);
|
||||||
|
|
||||||
gPrefs->Write(wxT("/Spectrum/ScaleType"), scaleType);
|
gPrefs->Write(wxT("/Spectrum/ScaleType"), scaleType);
|
||||||
|
|
||||||
|
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
gPrefs->Write(wxT("/Spectrum/EnableSpectralSelection"), spectralSelection);
|
gPrefs->Write(wxT("/Spectrum/EnableSpectralSelection"), spectralSelection);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
gPrefs->Write(wxT("/Spectrum/FFTYGrid"), fftYGrid);
|
gPrefs->Write(wxT("/Spectrum/FFTYGrid"), fftYGrid);
|
||||||
@ -486,3 +523,12 @@ int SpectrogramSettings::GetFFTLength(bool autocorrelation) const
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpectrogramSettings::SpectralSelectionEnabled() const
|
||||||
|
{
|
||||||
|
#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
return Globals::Get().spectralSelection;
|
||||||
|
#else
|
||||||
|
return spectralSelection;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -13,6 +13,8 @@ Paul Licameli
|
|||||||
|
|
||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
|
|
||||||
|
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
|
||||||
struct FFTParam;
|
struct FFTParam;
|
||||||
class SpectrumPrefs;
|
class SpectrumPrefs;
|
||||||
class wxArrayString;
|
class wxArrayString;
|
||||||
@ -22,6 +24,22 @@ class SpectrogramSettings
|
|||||||
friend class SpectrumPrefs;
|
friend class SpectrumPrefs;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Singleton for settings that are not per-track
|
||||||
|
class Globals
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static Globals &Get();
|
||||||
|
void SavePrefs();
|
||||||
|
|
||||||
|
#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
bool spectralSelection;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
Globals();
|
||||||
|
void LoadPrefs();
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
LogMinWindowSize = 3,
|
LogMinWindowSize = 3,
|
||||||
LogMaxWindowSize = 15,
|
LogMaxWindowSize = 15,
|
||||||
@ -72,6 +90,7 @@ public:
|
|||||||
int GetMaxFreq(double rate) const;
|
int GetMaxFreq(double rate) const;
|
||||||
int GetLogMinFreq(double rate) const;
|
int GetLogMinFreq(double rate) const;
|
||||||
int GetLogMaxFreq(double rate) const;
|
int GetLogMaxFreq(double rate) const;
|
||||||
|
bool SpectralSelectionEnabled() const;
|
||||||
|
|
||||||
void SetMinFreq(int freq);
|
void SetMinFreq(int freq);
|
||||||
void SetMaxFreq(int freq);
|
void SetMaxFreq(int freq);
|
||||||
@ -95,7 +114,9 @@ public:
|
|||||||
|
|
||||||
ScaleType scaleType;
|
ScaleType scaleType;
|
||||||
|
|
||||||
|
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
bool spectralSelection; // But should this vary per track? -- PRL
|
bool spectralSelection; // But should this vary per track? -- PRL
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
bool fftYGrid;
|
bool fftYGrid;
|
||||||
@ -116,5 +137,4 @@ public:
|
|||||||
mutable float *window;
|
mutable float *window;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -218,8 +218,11 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
|
|
||||||
S.Id(ID_GRAYSCALE).TieCheckBox(_("S&how the spectrum using grayscale colors"),
|
S.Id(ID_GRAYSCALE).TieCheckBox(_("S&how the spectrum using grayscale colors"),
|
||||||
mTempSettings.isGrayscale);
|
mTempSettings.isGrayscale);
|
||||||
|
|
||||||
|
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
S.Id(ID_SPECTRAL_SELECTION).TieCheckBox(_("Ena&ble spectral selection"),
|
S.Id(ID_SPECTRAL_SELECTION).TieCheckBox(_("Ena&ble spectral selection"),
|
||||||
mTempSettings.spectralSelection);
|
mTempSettings.spectralSelection);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
S.TieCheckBox(_("Show a grid along the &Y-axis"),
|
S.TieCheckBox(_("Show a grid along the &Y-axis"),
|
||||||
@ -257,6 +260,15 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
}
|
}
|
||||||
// S.EndStatic();
|
// S.EndStatic();
|
||||||
|
|
||||||
|
#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
S.StartStatic(_("Global settings"));
|
||||||
|
{
|
||||||
|
S.TieCheckBox(_("Ena&ble spectral selection"),
|
||||||
|
SpectrogramSettings::Globals::Get().spectralSelection);
|
||||||
|
}
|
||||||
|
S.EndStatic();
|
||||||
|
#endif
|
||||||
|
|
||||||
S.StartMultiColumn(2, wxALIGN_RIGHT);
|
S.StartMultiColumn(2, wxALIGN_RIGHT);
|
||||||
{
|
{
|
||||||
S.Id(ID_APPLY).AddButton(_("Appl&y"));
|
S.Id(ID_APPLY).AddButton(_("Appl&y"));
|
||||||
@ -340,7 +352,10 @@ bool SpectrumPrefs::Apply()
|
|||||||
ShuttleGui S(this, eIsGettingFromDialog);
|
ShuttleGui S(this, eIsGettingFromDialog);
|
||||||
PopulateOrExchange(S);
|
PopulateOrExchange(S);
|
||||||
|
|
||||||
|
|
||||||
mTempSettings.ConvertToActualWindowSizes();
|
mTempSettings.ConvertToActualWindowSizes();
|
||||||
|
SpectrogramSettings::Globals::Get().SavePrefs(); // always
|
||||||
|
|
||||||
if (mWt) {
|
if (mWt) {
|
||||||
if (mDefaulted) {
|
if (mDefaulted) {
|
||||||
mWt->SetSpectrogramSettings(NULL);
|
mWt->SetSpectrogramSettings(NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user