mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
fixing strict-aliasing rule violations by passing enum types as int references
This commit is contained in:
parent
7a30222f49
commit
87eaaa6f45
@ -263,7 +263,7 @@ WaveTrack::WaveTrackDisplay WaveTrack::FindDefaultViewMode()
|
|||||||
// Prefer the NEW preference key if it is present
|
// Prefer the NEW preference key if it is present
|
||||||
|
|
||||||
WaveTrack::WaveTrackDisplay viewMode;
|
WaveTrack::WaveTrackDisplay viewMode;
|
||||||
gPrefs->Read(wxT("/GUI/DefaultViewModeNew"), (int*)&viewMode, -1);
|
gPrefs->Read(wxT("/GUI/DefaultViewModeNew"), &viewMode, -1);
|
||||||
|
|
||||||
// Default to the old key only if not, default the value if it's not there either
|
// Default to the old key only if not, default the value if it's not there either
|
||||||
wxASSERT(WaveTrack::MinDisplay >= 0);
|
wxASSERT(WaveTrack::MinDisplay >= 0);
|
||||||
|
@ -527,7 +527,9 @@ private:
|
|||||||
// and will be taken out of the WaveTrack class:
|
// and will be taken out of the WaveTrack class:
|
||||||
//
|
//
|
||||||
|
|
||||||
enum WaveTrackDisplay {
|
|
||||||
|
typedef int WaveTrackDisplay;
|
||||||
|
enum WaveTrackDisplayValues : int {
|
||||||
|
|
||||||
// DO NOT REORDER OLD VALUES! Replace obsoletes with placeholders.
|
// DO NOT REORDER OLD VALUES! Replace obsoletes with placeholders.
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ bool SetTrackCommand::Apply(const CommandContext & context)
|
|||||||
bool bIsSecondChannel = false;
|
bool bIsSecondChannel = false;
|
||||||
while (t )
|
while (t )
|
||||||
{
|
{
|
||||||
bool bThisTrack =
|
bool bThisTrack =
|
||||||
(bHasTrackIndex && (i==mTrackIndex)) ||
|
(bHasTrackIndex && (i==mTrackIndex)) ||
|
||||||
(bHasChannelIndex && (j==mChannelIndex ) ) ||
|
(bHasChannelIndex && (j==mChannelIndex ) ) ||
|
||||||
(!bHasTrackIndex && !bHasChannelIndex) ;
|
(!bHasTrackIndex && !bHasChannelIndex) ;
|
||||||
@ -191,9 +191,9 @@ bool SetTrackCommand::Apply(const CommandContext & context)
|
|||||||
|
|
||||||
if( wt && bHasDisplayType )
|
if( wt && bHasDisplayType )
|
||||||
wt->SetDisplay(
|
wt->SetDisplay(
|
||||||
(mDisplayType == kWaveform) ?
|
(mDisplayType == kWaveform) ?
|
||||||
WaveTrack::WaveTrackDisplay::Waveform
|
WaveTrack::WaveTrackDisplayValues::Waveform
|
||||||
: WaveTrack::WaveTrackDisplay::Spectrum
|
: WaveTrack::WaveTrackDisplayValues::Spectrum
|
||||||
);
|
);
|
||||||
if( wt && bHasScaleType )
|
if( wt && bHasScaleType )
|
||||||
wt->GetIndependentWaveformSettings().scaleType =
|
wt->GetIndependentWaveformSettings().scaleType =
|
||||||
|
@ -53,7 +53,8 @@ public:
|
|||||||
// Do not assume that this enumeration will remain the
|
// Do not assume that this enumeration will remain the
|
||||||
// same as NumberScaleType in future. That enum may become
|
// same as NumberScaleType in future. That enum may become
|
||||||
// more general purpose.
|
// more general purpose.
|
||||||
enum ScaleType {
|
typedef int ScaleType;
|
||||||
|
enum ScaleTypeValues : int {
|
||||||
stLinear,
|
stLinear,
|
||||||
stLogarithmic,
|
stLogarithmic,
|
||||||
stMel,
|
stMel,
|
||||||
@ -131,7 +132,8 @@ public:
|
|||||||
bool spectralSelection; // But should this vary per track? -- PRL
|
bool spectralSelection; // But should this vary per track? -- PRL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum Algorithm {
|
typedef int Algorithm;
|
||||||
|
enum AlgorithmValues : int {
|
||||||
algSTFT = 0,
|
algSTFT = 0,
|
||||||
algReassignment,
|
algReassignment,
|
||||||
algPitchEAC,
|
algPitchEAC,
|
||||||
|
@ -176,7 +176,7 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.StartTwoColumn();
|
S.StartTwoColumn();
|
||||||
{
|
{
|
||||||
S.Id(ID_SCALE).TieChoice(_("S&cale") + wxString(wxT(":")),
|
S.Id(ID_SCALE).TieChoice(_("S&cale") + wxString(wxT(":")),
|
||||||
*(int*)&mTempSettings.scaleType,
|
mTempSettings.scaleType,
|
||||||
&mScaleChoices);
|
&mScaleChoices);
|
||||||
|
|
||||||
mMinFreq =
|
mMinFreq =
|
||||||
@ -226,7 +226,7 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
{
|
{
|
||||||
mAlgorithmChoice =
|
mAlgorithmChoice =
|
||||||
S.Id(ID_ALGORITHM).TieChoice(_("A&lgorithm") + wxString(wxT(":")),
|
S.Id(ID_ALGORITHM).TieChoice(_("A&lgorithm") + wxString(wxT(":")),
|
||||||
*(int*)&mTempSettings.algorithm,
|
mTempSettings.algorithm,
|
||||||
&mAlgorithmChoices);
|
&mAlgorithmChoices);
|
||||||
|
|
||||||
S.Id(ID_WINDOW_SIZE).TieChoice(_("Window &size:"),
|
S.Id(ID_WINDOW_SIZE).TieChoice(_("Window &size:"),
|
||||||
|
@ -92,12 +92,12 @@ void WaveformPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
{
|
{
|
||||||
mScaleChoice =
|
mScaleChoice =
|
||||||
S.Id(ID_SCALE).TieChoice(_("S&cale") + wxString(wxT(":")),
|
S.Id(ID_SCALE).TieChoice(_("S&cale") + wxString(wxT(":")),
|
||||||
*(int*)&mTempSettings.scaleType,
|
mTempSettings.scaleType,
|
||||||
&mScaleChoices);
|
&mScaleChoices);
|
||||||
|
|
||||||
mRangeChoice =
|
mRangeChoice =
|
||||||
S.Id(ID_RANGE).TieChoice(_("Waveform dB &range") + wxString(wxT(":")),
|
S.Id(ID_RANGE).TieChoice(_("Waveform dB &range") + wxString(wxT(":")),
|
||||||
*(int*)&mTempSettings.dBRange,
|
mTempSettings.dBRange,
|
||||||
&mRangeChoices);
|
&mRangeChoices);
|
||||||
S.SetSizeHints(mRangeChoices);
|
S.SetSizeHints(mRangeChoices);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@ public:
|
|||||||
void NextLowerDBRange();
|
void NextLowerDBRange();
|
||||||
void NextHigherDBRange();
|
void NextHigherDBRange();
|
||||||
|
|
||||||
enum ScaleType {
|
typedef int ScaleType;
|
||||||
|
enum ScaleTypeValues : int {
|
||||||
stLinear,
|
stLinear,
|
||||||
stLogarithmic,
|
stLogarithmic,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user