-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
SpectrogramSettings.cpp
649 lines (546 loc) · 18.1 KB
/
SpectrogramSettings.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
/**********************************************************************
Audacity: A Digital Audio Editor
SpectrogramSettings.cpp
Paul Licameli
*******************************************************************//**
\class SpectrogramSettings
\brief Spectrogram settings, either for one track or as defaults.
*//*******************************************************************/
#include "SpectrogramSettings.h"
#include "../AColor.h"
#include "../NumberScale.h"
#include <algorithm>
#include "../FFT.h"
#include "../Prefs.h"
#include <cmath>
#include "../widgets/AudacityMessageBox.h"
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"), 1L) != 0);
#endif
}
SpectrogramSettings::Globals
&SpectrogramSettings::Globals::Get()
{
static Globals instance;
return instance;
}
SpectrogramSettings::SpectrogramSettings()
{
LoadPrefs();
}
SpectrogramSettings::SpectrogramSettings(const SpectrogramSettings &other)
: minFreq(other.minFreq)
, maxFreq(other.maxFreq)
, range(other.range)
, gain(other.gain)
, frequencyGain(other.frequencyGain)
, windowType(other.windowType)
, windowSize(other.windowSize)
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
, zeroPaddingFactor(other.zeroPaddingFactor)
#endif
, colorScheme(other.colorScheme)
, scaleType(other.scaleType)
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
, spectralSelection(other.spectralSelection)
#endif
, algorithm(other.algorithm)
#ifdef EXPERIMENTAL_FFT_Y_GRID
, fftYGrid(other.fftYGrid)
#endif
#ifdef EXPERIMENTAL_FIND_NOTES
, fftFindNotes(other.fftFindNotes)
, findNotesMinA(other.findNotesMinA)
, numberOfMaxima(other.numberOfMaxima)
, findNotesQuantize(other.findNotesQuantize)
#endif
// Do not copy these!
, hFFT{}
, window{}
, tWindow{}
, dWindow{}
{
}
SpectrogramSettings &SpectrogramSettings::operator= (const SpectrogramSettings &other)
{
if (this != &other) {
minFreq = other.minFreq;
maxFreq = other.maxFreq;
range = other.range;
gain = other.gain;
frequencyGain = other.frequencyGain;
windowType = other.windowType;
windowSize = other.windowSize;
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
zeroPaddingFactor = other.zeroPaddingFactor;
#endif
colorScheme = other.colorScheme;
scaleType = other.scaleType;
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
spectralSelection = other.spectralSelection;
#endif
algorithm = other.algorithm;
#ifdef EXPERIMENTAL_FFT_Y_GRID
fftYGrid = other.fftYGrid;
#endif
#ifdef EXPERIMENTAL_FIND_NOTES
fftFindNotes = other.fftFindNotes;
findNotesMinA = other.findNotesMinA;
numberOfMaxima = other.numberOfMaxima;
findNotesQuantize = other.findNotesQuantize;
#endif
// Invalidate the caches
DestroyWindows();
}
return *this;
}
SpectrogramSettings& SpectrogramSettings::defaults()
{
static SpectrogramSettings instance;
return instance;
}
//static
const EnumValueSymbols &SpectrogramSettings::GetScaleNames()
{
static const EnumValueSymbols result{
// Keep in correspondence with enum SpectrogramSettings::ScaleType:
XO("Linear") ,
XO("Logarithmic") ,
/* i18n-hint: The name of a frequency scale in psychoacoustics */
XO("Mel") ,
/* i18n-hint: The name of a frequency scale in psychoacoustics, named for Heinrich Barkhausen */
XO("Bark") ,
/* i18n-hint: The name of a frequency scale in psychoacoustics, abbreviates Equivalent Rectangular Bandwidth */
XO("ERB") ,
/* i18n-hint: Time units, that is Period = 1 / Frequency */
XO("Period") ,
};
return result;
}
//static
const EnumValueSymbols &SpectrogramSettings::GetColorSchemeNames()
{
static const EnumValueSymbols result{
// Keep in correspondence with enum SpectrogramSettings::ColorScheme:
/* i18n-hint: New color scheme for spectrograms */
{ wxT("SpecColorNew"), XO("Color (New)") },
/* i18n-hint: color scheme from theme for spectrograms */
{ wxT("SpecColorTheme"), XO("Color (from Theme)") },
/* i18n-hint: grayscale color scheme for spectrograms */
{ wxT("SpecGrayscale"), XO("Grayscale") },
/* i18n-hint: inverse grayscale color scheme for spectrograms */
{ wxT("SpecInvGrayscale"), XO("Inv. Grayscale") },
};
wxASSERT(csNumColorScheme == result.size());
static_assert(csNumColorScheme == AColor::colorSchemes, "Broken correspondence");
return result;
}
void SpectrogramSettings::ColorSchemeEnumSetting::Migrate(wxString &value)
{
// Migrate old grayscale option to Color scheme choice
bool isGrayscale = (gPrefs->Read(wxT("/Spectrum/Grayscale"), 0L) != 0);
if (isGrayscale && !gPrefs->Read(wxT("/Spectrum/ColorScheme"), &value)) {
value = GetColorSchemeNames().at(csInvGrayscale).Internal();
Write(value);
gPrefs->Flush();
}
}
SpectrogramSettings::ColorSchemeEnumSetting SpectrogramSettings::colorSchemeSetting{
wxT("/Spectrum/ColorScheme"),
GetColorSchemeNames(),
csColorNew, // default to Color(New)
{ csColorNew, csColorTheme, csGrayscale, csInvGrayscale },
};
//static
const TranslatableStrings &SpectrogramSettings::GetAlgorithmNames()
{
static const TranslatableStrings results{
// Keep in correspondence with enum SpectrogramSettings::Algorithm:
XO("Frequencies") ,
/* i18n-hint: the Reassignment algorithm for spectrograms */
XO("Reassignment") ,
/* i18n-hint: EAC abbreviates "Enhanced Autocorrelation" */
XO("Pitch (EAC)") ,
};
return results;
}
bool SpectrogramSettings::Validate(bool quiet)
{
if (!quiet &&
maxFreq < 100) {
AudacityMessageBox( XO("Maximum frequency must be 100 Hz or above") );
return false;
}
else
maxFreq = std::max(100, maxFreq);
if (!quiet &&
minFreq < 0) {
AudacityMessageBox( XO("Minimum frequency must be at least 0 Hz") );
return false;
}
else
minFreq = std::max(0, minFreq);
if (!quiet &&
maxFreq <= minFreq) {
AudacityMessageBox( XO(
"Minimum frequency must be less than maximum frequency") );
return false;
}
else
maxFreq = std::max(1 + minFreq, maxFreq);
if (!quiet &&
range <= 0) {
AudacityMessageBox( XO("The range must be at least 1 dB") );
return false;
}
else
range = std::max(1, range);
if (!quiet &&
frequencyGain < 0) {
AudacityMessageBox( XO("The frequency gain cannot be negative") );
return false;
}
else if (!quiet &&
frequencyGain > 60) {
AudacityMessageBox( XO(
"The frequency gain must be no more than 60 dB/dec") );
return false;
}
else
frequencyGain =
std::max(0, std::min(60, frequencyGain));
// The rest are controlled by drop-down menus so they can't go wrong
// in the Preferences dialog, but we also come here after reading fom saved
// preference files, which could be or from future versions. Validate quietly.
windowType =
std::max(0, std::min(NumWindowFuncs() - 1, windowType));
scaleType =
ScaleType(std::max(0,
std::min((int)(SpectrogramSettings::stNumScaleTypes) - 1,
(int)(scaleType))));
colorScheme = ColorScheme(
std::max(0, std::min<int>(csNumColorScheme-1, colorScheme))
);
algorithm = Algorithm(
std::max(0, std::min((int)(algNumAlgorithms) - 1, (int)(algorithm)))
);
ConvertToEnumeratedWindowSizes();
ConvertToActualWindowSizes();
return true;
}
void SpectrogramSettings::LoadPrefs()
{
minFreq = gPrefs->Read(wxT("/Spectrum/MinFreq"), 0L);
maxFreq = gPrefs->Read(wxT("/Spectrum/MaxFreq"), 8000L);
range = gPrefs->Read(wxT("/Spectrum/Range"), 80L);
gain = gPrefs->Read(wxT("/Spectrum/Gain"), 20L);
frequencyGain = gPrefs->Read(wxT("/Spectrum/FrequencyGain"), 0L);
windowSize = gPrefs->Read(wxT("/Spectrum/FFTSize"), 1024);
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
zeroPaddingFactor = gPrefs->Read(wxT("/Spectrum/ZeroPaddingFactor"), 1);
#endif
gPrefs->Read(wxT("/Spectrum/WindowType"), &windowType, eWinFuncHann);
colorScheme = colorSchemeSetting.ReadEnum();
scaleType = ScaleType(gPrefs->Read(wxT("/Spectrum/ScaleType"), 0L));
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
spectralSelection = (gPrefs->Read(wxT("/Spectrum/EnableSpectralSelection"), 1L) != 0);
#endif
algorithm = Algorithm(gPrefs->Read(wxT("/Spectrum/Algorithm"), 0L));
#ifdef EXPERIMENTAL_FFT_Y_GRID
fftYGrid = (gPrefs->Read(wxT("/Spectrum/FFTYGrid"), 0L) != 0);
#endif //EXPERIMENTAL_FFT_Y_GRID
#ifdef EXPERIMENTAL_FIND_NOTES
fftFindNotes = (gPrefs->Read(wxT("/Spectrum/FFTFindNotes"), 0L) != 0);
findNotesMinA = gPrefs->Read(wxT("/Spectrum/FindNotesMinA"), -30.0);
numberOfMaxima = gPrefs->Read(wxT("/Spectrum/FindNotesN"), 5L);
findNotesQuantize = (gPrefs->Read(wxT("/Spectrum/FindNotesQuantize"), 0L) != 0);
#endif //EXPERIMENTAL_FIND_NOTES
// Enforce legal values
Validate(true);
InvalidateCaches();
}
void SpectrogramSettings::SavePrefs()
{
gPrefs->Write(wxT("/Spectrum/MinFreq"), minFreq);
gPrefs->Write(wxT("/Spectrum/MaxFreq"), maxFreq);
// Nothing wrote these. They only varied from the linear scale bounds in-session. -- PRL
// gPrefs->Write(wxT("/SpectrumLog/MaxFreq"), logMinFreq);
// gPrefs->Write(wxT("/SpectrumLog/MinFreq"), logMaxFreq);
gPrefs->Write(wxT("/Spectrum/Range"), range);
gPrefs->Write(wxT("/Spectrum/Gain"), gain);
gPrefs->Write(wxT("/Spectrum/FrequencyGain"), frequencyGain);
gPrefs->Write(wxT("/Spectrum/FFTSize"), windowSize);
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
gPrefs->Write(wxT("/Spectrum/ZeroPaddingFactor"), zeroPaddingFactor);
#endif
gPrefs->Write(wxT("/Spectrum/WindowType"), windowType);
colorSchemeSetting.WriteEnum(colorScheme);
gPrefs->Write(wxT("/Spectrum/ScaleType"), (int) scaleType);
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
gPrefs->Write(wxT("/Spectrum/EnableSpectralSelection"), spectralSelection);
#endif
gPrefs->Write(wxT("/Spectrum/Algorithm"), (int) algorithm);
#ifdef EXPERIMENTAL_FFT_Y_GRID
gPrefs->Write(wxT("/Spectrum/FFTYGrid"), fftYGrid);
#endif //EXPERIMENTAL_FFT_Y_GRID
#ifdef EXPERIMENTAL_FIND_NOTES
gPrefs->Write(wxT("/Spectrum/FFTFindNotes"), fftFindNotes);
gPrefs->Write(wxT("/Spectrum/FindNotesMinA"), findNotesMinA);
gPrefs->Write(wxT("/Spectrum/FindNotesN"), numberOfMaxima);
gPrefs->Write(wxT("/Spectrum/FindNotesQuantize"), findNotesQuantize);
#endif //EXPERIMENTAL_FIND_NOTES
}
// This is a temporary hack until SpectrogramSettings gets fully integrated
void SpectrogramSettings::UpdatePrefs()
{
if (minFreq == defaults().minFreq) {
gPrefs->Read(wxT("/Spectrum/MinFreq"), &minFreq, 0L);
}
if (maxFreq == defaults().maxFreq) {
gPrefs->Read(wxT("/Spectrum/MaxFreq"), &maxFreq, 8000L);
}
if (range == defaults().range) {
gPrefs->Read(wxT("/Spectrum/Range"), &range, 80L);
}
if (gain == defaults().gain) {
gPrefs->Read(wxT("/Spectrum/Gain"), &gain, 20L);
}
if (frequencyGain == defaults().frequencyGain) {
gPrefs->Read(wxT("/Spectrum/FrequencyGain"), &frequencyGain, 0L);
}
if (windowSize == defaults().windowSize) {
gPrefs->Read(wxT("/Spectrum/FFTSize"), &windowSize, 1024);
}
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
if (zeroPaddingFactor == defaults().zeroPaddingFactor) {
gPrefs->Read(wxT("/Spectrum/ZeroPaddingFactor"), &zeroPaddingFactor, 1);
}
#endif
if (windowType == defaults().windowType) {
gPrefs->Read(wxT("/Spectrum/WindowType"), &windowType, eWinFuncHann);
}
if (colorScheme == defaults().colorScheme) {
colorScheme = colorSchemeSetting.ReadEnum();
}
if (scaleType == defaults().scaleType) {
int temp;
gPrefs->Read(wxT("/Spectrum/ScaleType"), &temp, 0L);
scaleType = ScaleType(temp);
}
#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
if (spectralSelection == defaults().spectralSelection) {
int temp;
gPrefs->Read(wxT("/Spectrum/EnableSpectralSelection"), &temp, 1L);
spectralSelection = (temp != 0);
}
#endif
if (algorithm == defaults().algorithm) {
int temp;
gPrefs->Read(wxT("/Spectrum/Algorithm"), &temp, 0L);
algorithm = Algorithm(temp);
}
#ifdef EXPERIMENTAL_FFT_Y_GRID
if (fftYGrid == defaults().fftYGrid) {
int temp;
gPrefs->Read(wxT("/Spectrum/FFTYGrid"), &temp, 0L);
fftYGrid = (temp != 0);
}
#endif //EXPERIMENTAL_FFT_Y_GRID
#ifdef EXPERIMENTAL_FIND_NOTES
if (fftFindNotes == defaults().fftFindNotes) {
int temp;
gPrefs->Read(wxT("/Spectrum/FFTFindNotes"), &temp, 0L);
fftFindNotes = (temp != 0);
}
if (findNotesMinA == defaults().findNotesMinA) {
gPrefs->Read(wxT("/Spectrum/FindNotesMinA"), &findNotesMinA, -30.0);
}
if (numberOfMaxima == defaults().numberOfMaxima) {
numberOfMaxima = gPrefs->Read(wxT("/Spectrum/FindNotesN"), &numberOfMaxima, 5L);
}
if (findNotesQuantize == defaults().findNotesQuantize) {
int temp;
gPrefs->Read(wxT("/Spectrum/FindNotesQuantize"), &temp, 0L);
findNotesQuantize = (temp != 0);
}
#endif //EXPERIMENTAL_FIND_NOTES
// Enforce legal values
Validate(true);
}
void SpectrogramSettings::InvalidateCaches()
{
DestroyWindows();
}
SpectrogramSettings::~SpectrogramSettings()
{
DestroyWindows();
}
void SpectrogramSettings::DestroyWindows()
{
hFFT.reset();
window.reset();
dWindow.reset();
tWindow.reset();
}
namespace
{
enum { WINDOW, TWINDOW, DWINDOW };
void RecreateWindow(
Floats &window, int which, size_t fftLen,
size_t padding, int windowType, size_t windowSize, double &scale)
{
// Create the requested window function
window = Floats{ fftLen };
size_t ii;
const bool extra = padding > 0;
wxASSERT(windowSize % 2 == 0);
if (extra)
// For windows that do not go to 0 at the edges, this improves symmetry
++windowSize;
const size_t endOfWindow = padding + windowSize;
// Left and right padding
for (ii = 0; ii < padding; ++ii) {
window[ii] = 0.0;
window[fftLen - ii - 1] = 0.0;
}
// Default rectangular window in the middle
for (; ii < endOfWindow; ++ii)
window[ii] = 1.0;
// Overwrite middle as needed
switch (which) {
case WINDOW:
NewWindowFunc(windowType, windowSize, extra, window.get() + padding);
break;
case TWINDOW:
NewWindowFunc(windowType, windowSize, extra, window.get() + padding);
{
for (int jj = padding, multiplier = -(int)windowSize / 2; jj < (int)endOfWindow; ++jj, ++multiplier)
window[jj] *= multiplier;
}
break;
case DWINDOW:
DerivativeOfWindowFunc(windowType, windowSize, extra, window.get() + padding);
break;
default:
wxASSERT(false);
}
// Scale the window function to give 0dB spectrum for 0dB sine tone
if (which == WINDOW) {
scale = 0.0;
for (ii = padding; ii < endOfWindow; ++ii)
scale += window[ii];
if (scale > 0)
scale = 2.0 / scale;
}
for (ii = padding; ii < endOfWindow; ++ii)
window[ii] *= scale;
}
}
void SpectrogramSettings::CacheWindows() const
{
if (hFFT == NULL || window == NULL) {
double scale;
auto factor = ZeroPaddingFactor();
const auto fftLen = WindowSize() * factor;
const auto padding = (WindowSize() * (factor - 1)) / 2;
hFFT = GetFFT(fftLen);
RecreateWindow(window, WINDOW, fftLen, padding, windowType, windowSize, scale);
if (algorithm == algReassignment) {
RecreateWindow(tWindow, TWINDOW, fftLen, padding, windowType, windowSize, scale);
RecreateWindow(dWindow, DWINDOW, fftLen, padding, windowType, windowSize, scale);
}
}
}
void SpectrogramSettings::ConvertToEnumeratedWindowSizes()
{
unsigned size;
int logarithm;
logarithm = -LogMinWindowSize;
size = unsigned(windowSize);
while (size > 1)
size >>= 1, ++logarithm;
windowSize = std::max(0, std::min(NumWindowSizes - 1, logarithm));
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
// Choices for zero padding begin at 1
logarithm = 0;
size = unsigned(zeroPaddingFactor);
while (zeroPaddingFactor > 1)
zeroPaddingFactor >>= 1, ++logarithm;
zeroPaddingFactor = std::max(0,
std::min(LogMaxWindowSize - (windowSize + LogMinWindowSize),
logarithm
));
#endif
}
void SpectrogramSettings::ConvertToActualWindowSizes()
{
windowSize = 1 << (windowSize + LogMinWindowSize);
#ifdef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
zeroPaddingFactor = 1 << zeroPaddingFactor;
#endif
}
float SpectrogramSettings::findBin( float frequency, float binUnit ) const
{
float linearBin = frequency / binUnit;
if (linearBin < 0)
return -1;
else
return linearBin;
}
size_t SpectrogramSettings::GetFFTLength() const
{
#ifndef EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
return windowSize;
#else
return windowSize * ((algorithm != algPitchEAC) ? zeroPaddingFactor : 1);
#endif
}
size_t SpectrogramSettings::NBins() const
{
// Omit the Nyquist frequency bin
return GetFFTLength() / 2;
}
NumberScale SpectrogramSettings::GetScale( float minFreqIn, float maxFreqIn ) const
{
NumberScaleType type = nstLinear;
// Don't assume the correspondence of the enums will remain direct in the future.
// Do this switch.
switch (scaleType) {
default:
wxASSERT(false);
case stLinear:
type = nstLinear; break;
case stLogarithmic:
type = nstLogarithmic; break;
case stMel:
type = nstMel; break;
case stBark:
type = nstBark; break;
case stErb:
type = nstErb; break;
case stPeriod:
type = nstPeriod; break;
}
return NumberScale(type, minFreqIn, maxFreqIn);
}
bool SpectrogramSettings::SpectralSelectionEnabled() const
{
#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
return Globals::Get().spectralSelection;
#else
return spectralSelection;
#endif
}