Classier enums (#6760)

This commit is contained in:
Dominic Clark
2023-08-24 19:16:02 +01:00
committed by GitHub
parent 3aed361b82
commit f10277715f
276 changed files with 2607 additions and 2521 deletions

View File

@@ -109,27 +109,27 @@ public:
struct qualitySettings
{
enum Mode
enum class Mode
{
Mode_Draft,
Mode_HighQuality,
Mode_FinalMix
Draft,
HighQuality,
FinalMix
} ;
enum Interpolation
enum class Interpolation
{
Interpolation_Linear,
Interpolation_SincFastest,
Interpolation_SincMedium,
Interpolation_SincBest
Linear,
SincFastest,
SincMedium,
SincBest
} ;
enum Oversampling
enum class Oversampling
{
Oversampling_None,
Oversampling_2x,
Oversampling_4x,
Oversampling_8x
None,
X2,
X4,
X8
} ;
Interpolation interpolation;
@@ -139,18 +139,18 @@ public:
{
switch (m)
{
case Mode_Draft:
interpolation = Interpolation_Linear;
oversampling = Oversampling_None;
case Mode::Draft:
interpolation = Interpolation::Linear;
oversampling = Oversampling::None;
break;
case Mode_HighQuality:
case Mode::HighQuality:
interpolation =
Interpolation_SincFastest;
oversampling = Oversampling_2x;
Interpolation::SincFastest;
oversampling = Oversampling::X2;
break;
case Mode_FinalMix:
interpolation = Interpolation_SincBest;
oversampling = Oversampling_8x;
case Mode::FinalMix:
interpolation = Interpolation::SincBest;
oversampling = Oversampling::X8;
break;
}
}
@@ -165,10 +165,10 @@ public:
{
switch( oversampling )
{
case Oversampling_None: return 1;
case Oversampling_2x: return 2;
case Oversampling_4x: return 4;
case Oversampling_8x: return 8;
case Oversampling::None: return 1;
case Oversampling::X2: return 2;
case Oversampling::X4: return 4;
case Oversampling::X8: return 8;
}
return 1;
}
@@ -177,13 +177,13 @@ public:
{
switch( interpolation )
{
case Interpolation_Linear:
case Interpolation::Linear:
return SRC_ZERO_ORDER_HOLD;
case Interpolation_SincFastest:
case Interpolation::SincFastest:
return SRC_SINC_FASTEST;
case Interpolation_SincMedium:
case Interpolation::SincMedium:
return SRC_SINC_MEDIUM_QUALITY;
case Interpolation_SincBest:
case Interpolation::SincBest:
return SRC_SINC_BEST_QUALITY;
}
return SRC_LINEAR;
@@ -255,7 +255,7 @@ public:
return m_playHandles;
}
void removePlayHandlesOfTypes(Track * track, const quint8 types);
void removePlayHandlesOfTypes(Track * track, PlayHandle::Types types);
// methods providing information for other classes

View File

@@ -45,7 +45,7 @@ public:
class JobQueue
{
public:
enum OperationMode
enum class OperationMode
{
Static, // no jobs added while processing queue
Dynamic // jobs can be added while processing queue
@@ -57,7 +57,7 @@ public:
m_items(),
m_writeIndex( 0 ),
m_itemsDone( 0 ),
m_opMode( Static )
m_opMode( OperationMode::Static )
{
std::fill(m_items, m_items + JOB_QUEUE_SIZE, nullptr);
}
@@ -83,7 +83,7 @@ public:
virtual void quit();
static void resetJobQueue( JobQueue::OperationMode _opMode =
JobQueue::Static )
JobQueue::OperationMode::Static )
{
globalJobQueue.reset( _opMode );
}
@@ -97,7 +97,7 @@ public:
// to ThreadableJob objects
template<typename T>
static void fillJobQueue( const T & _vec,
JobQueue::OperationMode _opMode = JobQueue::Static )
JobQueue::OperationMode _opMode = JobQueue::OperationMode::Static )
{
resetJobQueue( _opMode );
for (const auto& job : _vec)

View File

@@ -81,7 +81,7 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject
public:
using AutoModelVector = std::vector<AutomatableModel*>;
enum ScaleType
enum class ScaleType
{
Linear,
Logarithmic,
@@ -232,11 +232,11 @@ public:
}
void setScaleLogarithmic( bool setToTrue = true )
{
setScaleType( setToTrue ? Logarithmic : Linear );
setScaleType( setToTrue ? ScaleType::Logarithmic : ScaleType::Linear );
}
bool isScaleLogarithmic() const
{
return m_scaleType == Logarithmic;
return m_scaleType == ScaleType::Logarithmic;
}
void setStep( const float step );

View File

@@ -54,11 +54,11 @@ class LMMS_EXPORT AutomationClip : public Clip
{
Q_OBJECT
public:
enum ProgressionTypes
enum class ProgressionType
{
DiscreteProgression,
LinearProgression,
CubicHermiteProgression
Discrete,
Linear,
CubicHermite
} ;
using timeMap = QMap<int, AutomationNode>;
@@ -76,11 +76,11 @@ public:
const objectVector& objects() const;
// progression-type stuff
inline ProgressionTypes progressionType() const
inline ProgressionType progressionType() const
{
return m_progressionType;
}
void setProgressionType( ProgressionTypes _new_progression_type );
void setProgressionType( ProgressionType _new_progression_type );
inline float getTension() const
{
@@ -214,7 +214,7 @@ private:
timeMap m_oldTimeMap; // old values for storing the values before setDragValue() is called.
float m_tension;
bool m_hasAutomation;
ProgressionTypes m_progressionType;
ProgressionType m_progressionType;
bool m_dragging;
bool m_dragKeepOutValue; // Should we keep the current dragged node's outValue?

View File

@@ -87,11 +87,11 @@ public:
return "automationeditor";
}
enum EditModes
enum class EditMode
{
DRAW,
ERASE,
DRAW_OUTVALUES
Draw,
Erase,
DrawOutValues
};
public slots:
@@ -129,10 +129,10 @@ protected slots:
void horScrolled( int new_pos );
void verScrolled( int new_pos );
void setEditMode(AutomationEditor::EditModes mode);
void setEditMode(AutomationEditor::EditMode mode);
void setEditMode(int mode);
void setProgressionType(AutomationClip::ProgressionTypes type);
void setProgressionType(AutomationClip::ProgressionType type);
void setProgressionType(int type);
void setTension();
@@ -146,14 +146,14 @@ protected slots:
private:
enum Actions
enum class Action
{
NONE,
MOVE_VALUE,
ERASE_VALUES,
MOVE_OUTVALUE,
RESET_OUTVALUES,
DRAW_LINE
None,
MoveValue,
EraseValues,
MoveOutValue,
ResetOutValues,
DrawLine
} ;
// some constants...
@@ -201,7 +201,7 @@ private:
TimePos m_currentPosition;
Actions m_action;
Action m_action;
int m_moveXOffset;
@@ -215,7 +215,7 @@ private:
// Time position (key) of automation node whose outValue is being dragged
int m_draggedOutValueKey;
EditModes m_editMode;
EditMode m_editMode;
bool m_mouseDownLeft;
bool m_mouseDownRight; //true if right click is being held down

View File

@@ -89,14 +89,15 @@ QDataStream& operator>> ( QDataStream &in, WaveMipMap &waveMipMap );
class LMMS_EXPORT BandLimitedWave
{
public:
enum Waveforms
enum class Waveform
{
BLSaw,
BLSquare,
BLTriangle,
BLMoog,
NumBLWaveforms
Count
};
constexpr static auto NumWaveforms = static_cast<std::size_t>(Waveform::Count);
BandLimitedWave() = default;
virtual ~BandLimitedWave() = default;
@@ -127,7 +128,7 @@ public:
* \param _wavelen The wavelength (length of one cycle, ie. the inverse of frequency) of the wanted oscillation, measured in sample frames
* \param _wave The wanted waveform. Options currently are saw, triangle, square and moog saw.
*/
static inline sample_t oscillate( float _ph, float _wavelen, Waveforms _wave )
static inline sample_t oscillate( float _ph, float _wavelen, Waveform _wave )
{
// get the next higher tlen
int t = 0;
@@ -139,12 +140,12 @@ public:
int lookup = static_cast<int>( lookupf );
const float ip = fraction( lookupf );
const sample_t s1 = s_waveforms[ _wave ].sampleAt( t, lookup );
const sample_t s2 = s_waveforms[ _wave ].sampleAt( t, ( lookup + 1 ) % tlen );
const sample_t s1 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, lookup );
const sample_t s2 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, ( lookup + 1 ) % tlen );
const int lm = lookup == 0 ? tlen - 1 : lookup - 1;
const sample_t s0 = s_waveforms[ _wave ].sampleAt( t, lm );
const sample_t s3 = s_waveforms[ _wave ].sampleAt( t, ( lookup + 2 ) % tlen );
const sample_t s0 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, lm );
const sample_t s3 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, ( lookup + 2 ) % tlen );
const sample_t sr = optimal4pInterpolate( s0, s1, s2, s3, ip );
return sr;
@@ -153,8 +154,8 @@ public:
lookup = lookup << 1;
tlen = tlen << 1;
t += 1;
const sample_t s3 = s_waveforms[ _wave ].sampleAt( t, lookup );
const sample_t s4 = s_waveforms[ _wave ].sampleAt( t, ( lookup + 1 ) % tlen );
const sample_t s3 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, lookup );
const sample_t s4 = s_waveforms[ static_cast<std::size_t>(_wave) ].sampleAt( t, ( lookup + 1 ) % tlen );
const sample_t s34 = linearInterpolate( s3, s4, ip );
const float ip2 = ( ( tlen - _wavelen ) / tlen - 0.5 ) * 2.0;
@@ -168,7 +169,7 @@ public:
static bool s_wavesGenerated;
static std::array<WaveMipMap, NumBLWaveforms> s_waveforms;
static std::array<WaveMipMap, NumWaveforms> s_waveforms;
static QString s_wavetableDir;
};

View File

@@ -224,7 +224,7 @@ class BasicFilters
{
MM_OPERATORS
public:
enum FilterTypes
enum class FilterType
{
LowPass,
HiPass,
@@ -247,8 +247,7 @@ public:
Highpass_SV,
Notch_SV,
FastFormant,
Tripole,
NumFilters
Tripole
};
static inline float minFreq()
@@ -261,20 +260,20 @@ public:
return( 0.01f );
}
inline void setFilterType( const int _idx )
inline void setFilterType( const FilterType _idx )
{
m_doubleFilter = _idx == DoubleLowPass || _idx == DoubleMoog;
m_doubleFilter = _idx == FilterType::DoubleLowPass || _idx == FilterType::DoubleMoog;
if( !m_doubleFilter )
{
m_type = static_cast<FilterTypes>( _idx );
m_type = _idx;
return;
}
// Double lowpass mode, backwards-compat for the goofy
// Add-NumFilters to signify doubleFilter stuff
m_type = _idx == DoubleLowPass
? LowPass
: Moog;
m_type = _idx == FilterType::DoubleLowPass
? FilterType::LowPass
: FilterType::Moog;
if( m_subFilter == nullptr )
{
m_subFilter = new BasicFilters<CHANNELS>(
@@ -334,7 +333,7 @@ public:
sample_t out;
switch( m_type )
{
case Moog:
case FilterType::Moog:
{
sample_t x = _in0 - m_r*m_y4[_chnl];
@@ -364,7 +363,7 @@ public:
// 3x onepole filters with 4x oversampling and interpolation of oversampled signal:
// input signal is linear-interpolated after oversampling, output signal is averaged from oversampled outputs
case Tripole:
case FilterType::Tripole:
{
out = 0.0f;
float ip = 0.0f;
@@ -397,8 +396,8 @@ public:
// and extended to other SV filter types
// /* Hal Chamberlin's state variable filter */
case Lowpass_SV:
case Bandpass_SV:
case FilterType::Lowpass_SV:
case FilterType::Bandpass_SV:
{
float highpass;
@@ -414,12 +413,12 @@ public:
}
/* mix filter output into output buffer */
return m_type == Lowpass_SV
return m_type == FilterType::Lowpass_SV
? m_delay4[_chnl]
: m_delay3[_chnl];
}
case Highpass_SV:
case FilterType::Highpass_SV:
{
float hp;
@@ -433,7 +432,7 @@ public:
return hp;
}
case Notch_SV:
case FilterType::Notch_SV:
{
float hp1, hp2;
@@ -458,7 +457,7 @@ public:
// can be driven up to self-oscillation (BTW: do not remove the limits!!!).
// (C) 1998 ... 2009 S.Fendt. Released under the GPL v2.0 or any later version.
case Lowpass_RC12:
case FilterType::Lowpass_RC12:
{
sample_t lp, bp, hp, in;
for( int n = 4; n != 0; --n )
@@ -482,8 +481,8 @@ public:
}
return lp;
}
case Highpass_RC12:
case Bandpass_RC12:
case FilterType::Highpass_RC12:
case FilterType::Bandpass_RC12:
{
sample_t hp, bp, in;
for( int n = 4; n != 0; --n )
@@ -501,10 +500,10 @@ public:
m_rchp0[_chnl] = hp;
m_rcbp0[_chnl] = bp;
}
return m_type == Highpass_RC12 ? hp : bp;
return m_type == FilterType::Highpass_RC12 ? hp : bp;
}
case Lowpass_RC24:
case FilterType::Lowpass_RC24:
{
sample_t lp, bp, hp, in;
for( int n = 4; n != 0; --n )
@@ -547,8 +546,8 @@ public:
}
return lp;
}
case Highpass_RC24:
case Bandpass_RC24:
case FilterType::Highpass_RC24:
case FilterType::Bandpass_RC24:
{
sample_t hp, bp, in;
for( int n = 4; n != 0; --n )
@@ -568,7 +567,7 @@ public:
m_rcbp0[_chnl] = bp;
// second stage gets the output of the first stage as input...
in = m_type == Highpass_RC24
in = m_type == FilterType::Highpass_RC24
? hp + m_rcbp1[_chnl] * m_rcq
: bp + m_rcbp1[_chnl] * m_rcq;
@@ -584,17 +583,17 @@ public:
m_rchp1[_chnl] = hp;
m_rcbp1[_chnl] = bp;
}
return m_type == Highpass_RC24 ? hp : bp;
return m_type == FilterType::Highpass_RC24 ? hp : bp;
}
case Formantfilter:
case FastFormant:
case FilterType::Formantfilter:
case FilterType::FastFormant:
{
if (std::abs(_in0) < 1.0e-10f && std::abs(m_vflast[0][_chnl]) < 1.0e-10f) { return 0.0f; } // performance hack - skip processing when the numbers get too small
sample_t hp, bp, in;
out = 0;
const int os = m_type == FastFormant ? 1 : 4; // no oversampling for fast formant
const int os = m_type == FilterType::FastFormant ? 1 : 4; // no oversampling for fast formant
for( int o = 0; o < os; ++o )
{
// first formant
@@ -681,7 +680,7 @@ public:
out += bp;
}
return m_type == FastFormant ? out * 2.0f : out * 0.5f;
return m_type == FilterType::FastFormant ? out * 2.0f : out * 0.5f;
}
default:
@@ -704,12 +703,12 @@ public:
// temp coef vars
_q = std::max(_q, minQ());
if( m_type == Lowpass_RC12 ||
m_type == Bandpass_RC12 ||
m_type == Highpass_RC12 ||
m_type == Lowpass_RC24 ||
m_type == Bandpass_RC24 ||
m_type == Highpass_RC24 )
if( m_type == FilterType::Lowpass_RC12 ||
m_type == FilterType::Bandpass_RC12 ||
m_type == FilterType::Highpass_RC12 ||
m_type == FilterType::Lowpass_RC24 ||
m_type == FilterType::Bandpass_RC24 ||
m_type == FilterType::Highpass_RC24 )
{
_freq = std::clamp(_freq, 50.0f, 20000.0f);
const float sr = m_sampleRatio * 0.25f;
@@ -724,8 +723,8 @@ public:
return;
}
if( m_type == Formantfilter ||
m_type == FastFormant )
if( m_type == FilterType::Formantfilter ||
m_type == FilterType::FastFormant )
{
_freq = std::clamp(_freq, minFreq(), 20000.0f); // limit freq and q for not getting bad noise out of the filter...
@@ -750,7 +749,7 @@ public:
const float f1 = 1.0f / ( linearInterpolate( _f[vowel+0][1], _f[vowel+1][1], fract ) * F_2PI );
// samplerate coeff: depends on oversampling
const float sr = m_type == FastFormant ? m_sampleRatio : m_sampleRatio * 0.25f;
const float sr = m_type == FilterType::FastFormant ? m_sampleRatio : m_sampleRatio * 0.25f;
m_vfa[0] = 1.0f - sr / ( f0 + sr );
m_vfb[0] = 1.0f - m_vfa[0];
@@ -761,8 +760,8 @@ public:
return;
}
if( m_type == Moog ||
m_type == DoubleMoog )
if( m_type == FilterType::Moog ||
m_type == FilterType::DoubleMoog )
{
// [ 0 - 0.5 ]
const float f = std::clamp(_freq, minFreq(), 20000.0f) * m_sampleRatio;
@@ -780,7 +779,7 @@ public:
return;
}
if( m_type == Tripole )
if( m_type == FilterType::Tripole )
{
const float f = std::clamp(_freq, 20.0f, 20000.0f) * m_sampleRatio * 0.25f;
@@ -791,10 +790,10 @@ public:
return;
}
if( m_type == Lowpass_SV ||
m_type == Bandpass_SV ||
m_type == Highpass_SV ||
m_type == Notch_SV )
if( m_type == FilterType::Lowpass_SV ||
m_type == FilterType::Bandpass_SV ||
m_type == FilterType::Highpass_SV ||
m_type == FilterType::Notch_SV )
{
const float f = sinf(std::max(minFreq(), _freq) * m_sampleRatio * F_PI);
m_svf1 = std::min(f, 0.825f);
@@ -818,38 +817,38 @@ public:
switch( m_type )
{
case LowPass:
case FilterType::LowPass:
{
const float b1 = ( 1.0f - tcos ) * a0;
const float b0 = b1 * 0.5f;
m_biQuad.setCoeffs( a1, a2, b0, b1, b0 );
break;
}
case HiPass:
case FilterType::HiPass:
{
const float b1 = ( -1.0f - tcos ) * a0;
const float b0 = b1 * -0.5f;
m_biQuad.setCoeffs( a1, a2, b0, b1, b0 );
break;
}
case BandPass_CSG:
case FilterType::BandPass_CSG:
{
const float b0 = tsin * a0;
m_biQuad.setCoeffs( a1, a2, b0, 0.0f, -b0 );
break;
}
case BandPass_CZPG:
case FilterType::BandPass_CZPG:
{
const float b0 = alpha * a0;
m_biQuad.setCoeffs( a1, a2, b0, 0.0f, -b0 );
break;
}
case Notch:
case FilterType::Notch:
{
m_biQuad.setCoeffs( a1, a2, a0, a1, a0 );
break;
}
case AllPass:
case FilterType::AllPass:
{
m_biQuad.setCoeffs( a1, a2, a2, a1, 1.0f );
break;
@@ -898,7 +897,7 @@ private:
// in/out history for Lowpass_SV (state-variant lowpass)
frame m_delay1, m_delay2, m_delay3, m_delay4;
FilterTypes m_type;
FilterType m_type;
bool m_doubleFilter;
float m_sampleRate;

View File

@@ -164,13 +164,6 @@ signals:
private:
enum Actions
{
NoAction,
Move,
Resize
} ;
Track * m_track;
QString m_name;

View File

@@ -140,7 +140,7 @@ public slots:
void resetColor();
protected:
enum ContextMenuAction
enum class ContextMenuAction
{
Remove,
Cut,
@@ -191,9 +191,9 @@ protected slots:
private:
enum Actions
enum class Action
{
NoAction,
None,
Move,
MoveSelection,
Resize,
@@ -206,7 +206,7 @@ private:
static TextFloat * s_textFloat;
Clip * m_clip;
Actions m_action;
Action m_action;
QPoint m_initialMousePos;
QPoint m_initialMouseGlobalPos;
QVector<TimePos> m_initialOffsets;

View File

@@ -51,20 +51,19 @@ class LMMS_EXPORT Controller : public Model, public JournallingObject
{
Q_OBJECT
public:
enum ControllerTypes
enum class ControllerType
{
DummyController,
LfoController,
MidiController,
PeakController,
Dummy,
Lfo,
Midi,
Peak,
/*
XYController,
EquationController
XY,
Equation
*/
NumControllerTypes
} ;
Controller( ControllerTypes _type, Model * _parent,
Controller( ControllerType _type, Model * _parent,
const QString & _display_name );
~Controller() override;
@@ -83,7 +82,7 @@ public:
m_sampleExact = _exact;
}
inline ControllerTypes type() const
inline ControllerType type() const
{
return( m_type );
}
@@ -94,8 +93,8 @@ public:
{
switch( m_type )
{
case LfoController: return( true );
case PeakController: return( true );
case ControllerType::Lfo: return( true );
case ControllerType::Peak: return( true );
default:
break;
}
@@ -112,7 +111,7 @@ public:
void loadSettings( const QDomElement & _this ) override;
QString nodeName() const override;
static Controller * create( ControllerTypes _tt, Model * _parent );
static Controller * create( ControllerType _tt, Model * _parent );
static Controller * create( const QDomElement & _this,
Model * _parent );
@@ -165,7 +164,7 @@ protected:
int m_connectionCount;
QString m_name;
ControllerTypes m_type;
ControllerType m_type;
static ControllerVector s_controllers;

View File

@@ -36,7 +36,7 @@ class LMMS_EXPORT CustomTextKnob : public Knob
protected:
inline void setHintText( const QString & _txt_before, const QString & _txt_after ) {} // inaccessible
public:
CustomTextKnob( knobTypes _knob_num, QWidget * _parent = nullptr, const QString & _name = QString(), const QString & _value_text = QString() );
CustomTextKnob( KnobType _knob_num, QWidget * _parent = nullptr, const QString & _name = QString(), const QString & _value_text = QString() );
CustomTextKnob( QWidget * _parent = nullptr, const QString & _name = QString(), const QString & _value_text = QString() ); //!< default ctor

View File

@@ -47,9 +47,9 @@ class LMMS_EXPORT DataFile : public QDomDocument
using UpgradeMethod = void(DataFile::*)();
public:
enum Types
enum class Type
{
UnknownType,
Unknown,
SongProject,
SongProjectTemplate,
InstrumentTrackSettings,
@@ -57,10 +57,8 @@ public:
ClipboardData,
JournalData,
EffectSettings,
MidiClip,
TypeCount
MidiClip
} ;
using Type = Types;
DataFile( const QString& fileName );
DataFile( const QByteArray& data );

View File

@@ -169,7 +169,7 @@ private:
bool m_bad_lfoShapeData;
SampleBuffer m_userWave;
enum LfoShapes
enum class LfoShape
{
SineWave,
TriangleWave,
@@ -177,8 +177,9 @@ private:
SquareWave,
UserDefinedWave,
RandomWave,
NumLfoShapes
Count
} ;
constexpr static auto NumLfoShapes = static_cast<std::size_t>(LfoShape::Count);
sample_t lfoShapeSample( fpp_t _frame_offset );
void updateLfoShapeData();

View File

@@ -62,7 +62,7 @@ private:
QString m_fileExtension;
bool m_multiExport;
ProjectRenderer::ExportFileFormats m_ft;
ProjectRenderer::ExportFileFormat m_ft;
std::unique_ptr<RenderManager> m_renderManager;
} ;

View File

@@ -223,20 +223,19 @@ private:
class FileItem : public QTreeWidgetItem
{
public:
enum FileTypes
enum class FileType
{
ProjectFile,
PresetFile,
SampleFile,
SoundFontFile,
PatchFile,
MidiFile,
VstPluginFile,
UnknownFile,
NumFileTypes
Project,
Preset,
Sample,
SoundFont,
Patch,
Midi,
VstPlugin,
Unknown
} ;
enum FileHandling
enum class FileHandling
{
NotSupported,
LoadAsProject,
@@ -255,7 +254,7 @@ public:
return QFileInfo(m_path, text(0)).absoluteFilePath();
}
inline FileTypes type() const
inline FileType type() const
{
return( m_type );
}
@@ -267,7 +266,7 @@ public:
inline bool isTrack() const
{
return m_handling == LoadAsPreset || m_handling == LoadByPlugin;
return m_handling == FileHandling::LoadAsPreset || m_handling == FileHandling::LoadByPlugin;
}
QString extension();
@@ -287,7 +286,7 @@ private:
static QPixmap * s_unknownFilePixmap;
QString m_path;
FileTypes m_type;
FileType m_type;
FileHandling m_handling;
} ;

83
include/Flags.h Normal file
View File

@@ -0,0 +1,83 @@
/*
* Flags.h - class to make flags from enums
*
* Copyright (c) 2023 Dominic Clark
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LMMS_FLAGS_H
#define LMMS_FLAGS_H
#include <type_traits>
namespace lmms {
template<typename T>
class Flags
{
static_assert(std::is_enum_v<T>, "lmms::Flags can only be used with enum types");
public:
using EnumType = T;
using UnderlyingType = std::underlying_type_t<T>;
constexpr Flags() = default;
constexpr Flags(T value) : // Intentionally not explicit
m_value{static_cast<UnderlyingType>(value)}
{}
constexpr explicit Flags(UnderlyingType value) :
m_value{value}
{}
constexpr auto testAll(Flags flags) const -> bool { return *this & flags == flags; }
constexpr auto testAny(Flags flags) const -> bool { return *this & flags != Flags{}; }
constexpr auto testFlag(EnumType flag) const -> bool { return static_cast<bool>(*this & flag); }
constexpr auto operator~() const -> Flags { return Flags{~m_value}; }
friend constexpr auto operator&(Flags l, Flags r) -> Flags { return Flags{l.m_value & r.m_value}; }
friend constexpr auto operator|(Flags l, Flags r) -> Flags { return Flags{l.m_value | r.m_value}; }
friend constexpr auto operator^(Flags l, Flags r) -> Flags { return Flags{l.m_value ^ r.m_value}; }
friend constexpr auto operator+(Flags l, Flags r) -> Flags { return Flags{l.m_value | r.m_value}; }
friend constexpr auto operator-(Flags l, Flags r) -> Flags { return Flags{l.m_value & ~r.m_value}; }
constexpr auto operator&=(Flags f) -> Flags& { m_value &= f.m_value; return *this; }
constexpr auto operator|=(Flags f) -> Flags& { m_value |= f.m_value; return *this; }
constexpr auto operator^=(Flags f) -> Flags& { m_value ^= f.m_value; return *this; }
constexpr auto operator+=(Flags f) -> Flags& { m_value |= f.m_value; return *this; }
constexpr auto operator-=(Flags f) -> Flags& { m_value &= ~f.m_value; return *this; }
constexpr explicit operator UnderlyingType() const { return m_value; } // TODO C++23: explicit(std::is_scoped_enum<T>)
constexpr explicit operator bool() const { return m_value != 0; }
friend constexpr auto operator==(Flags l, Flags r) -> bool { return l.m_value == r.m_value; } // TODO C++20: = default
friend constexpr auto operator!=(Flags l, Flags r) -> bool { return l.m_value != r.m_value; } // TODO C++20: Remove
private:
UnderlyingType m_value = 0;
};
#define LMMS_DECLARE_OPERATORS_FOR_FLAGS(type) \
constexpr inline auto operator|(type l, type r) -> ::lmms::Flags<type> { return ::lmms::Flags{l} | ::lmms::Flags{r}; }
} // namespace lmms
#endif // LMMS_FLAGS_H

View File

@@ -48,13 +48,12 @@ class LMMS_EXPORT Graph : public QWidget, public ModelView
{
Q_OBJECT
public:
enum graphStyle
enum class Style
{
NearestStyle, //!< draw as stairs
LinearStyle, //!< connect each 2 samples with a line, with wrapping
LinearNonCyclicStyle, //!< LinearStyle without wrapping
BarStyle, //!< draw thick bars
NumGraphStyles
Nearest, //!< draw as stairs
Linear, //!< connect each 2 samples with a line, with wrapping
LinearNonCyclic, //!< Linear without wrapping
Bar, //!< draw thick bars
};
/**
@@ -62,7 +61,7 @@ public:
* @param _width Pixel width of widget
* @param _height Pixel height of widget
*/
Graph( QWidget * _parent, graphStyle _style = Graph::LinearStyle,
Graph( QWidget * _parent, Style _style = Style::Linear,
int _width = 132,
int _height = 104
);
@@ -78,13 +77,13 @@ public:
return castModel<graphModel>();
}
inline graphStyle getGraphStyle()
inline Style getGraphStyle()
{
return m_graphStyle;
}
inline void setGraphStyle( graphStyle _s )
inline void setGraphStyle( Style _s )
{
m_graphStyle = _s;
update();
@@ -114,7 +113,7 @@ private:
QPixmap m_foreground;
QColor m_graphColor;
graphStyle m_graphStyle;
Style m_graphStyle;
bool m_mouseDown;
int m_lastCursorX;

View File

@@ -27,6 +27,8 @@
#define LMMS_INSTRUMENT_H
#include <QString>
#include "Flags.h"
#include "lmms_export.h"
#include "lmms_basics.h"
#include "MemoryManager.h"
@@ -47,7 +49,7 @@ class LMMS_EXPORT Instrument : public Plugin
{
MM_OPERATORS
public:
enum Flag
enum class Flag
{
NoFlags = 0x00,
IsSingleStreamed = 0x01, /*! Instrument provides a single audio stream for all notes */
@@ -55,7 +57,7 @@ public:
IsNotBendable = 0x04, /*! Instrument can't react to pitch bend changes */
};
Q_DECLARE_FLAGS(Flags, Flag);
using Flags = lmms::Flags<Flag>;
Instrument(InstrumentTrack * _instrument_track,
const Descriptor * _descriptor,
@@ -102,7 +104,7 @@ public:
virtual Flags flags() const
{
return NoFlags;
return Flag::NoFlags;
}
// sub-classes can re-implement this for receiving all incoming
@@ -149,7 +151,7 @@ private:
} ;
Q_DECLARE_OPERATORS_FOR_FLAGS(Instrument::Flags)
LMMS_DECLARE_OPERATORS_FOR_FLAGS(Instrument::Flag)
} // namespace lmms

View File

@@ -176,14 +176,13 @@ class InstrumentFunctionArpeggio : public Model, public JournallingObject
{
Q_OBJECT
public:
enum ArpDirections
enum class ArpDirection
{
ArpDirUp,
ArpDirDown,
ArpDirUpAndDown,
ArpDirDownAndUp,
ArpDirRandom,
NumArpDirections
Up,
Down,
UpAndDown,
DownAndUp,
Random
} ;
InstrumentFunctionArpeggio( Model * _parent );
@@ -202,11 +201,11 @@ public:
private:
enum ArpModes
enum class ArpMode
{
FreeMode,
SortMode,
SyncMode
Free,
Sort,
Sync
} ;
BoolModel m_arpEnabledModel;

View File

@@ -51,13 +51,14 @@ public:
void processAudioBuffer( sampleFrame * _ab, const fpp_t _frames,
NotePlayHandle * _n );
enum Targets
enum class Target
{
Volume,
Cut,
Resonance,
NumTargets
Count
} ;
constexpr static auto NumTargets = static_cast<std::size_t>(Target::Count);
f_cnt_t envFrames( const bool _only_vol = false ) const;
f_cnt_t releaseFrames() const;
@@ -82,7 +83,7 @@ private:
FloatModel m_filterCutModel;
FloatModel m_filterResModel;
static const char *const targetNames[InstrumentSoundShaping::NumTargets][3];
static const char *const targetNames[NumTargets][3];
friend class gui::InstrumentSoundShapingView;

View File

@@ -42,9 +42,9 @@ namespace lmms::gui
class SimpleTextFloat;
enum knobTypes
enum class KnobType
{
knobDark_28, knobBright_26, knobSmall_17, knobVintage_32, knobStyled
Dark28, Bright26, Small17, Vintage32, Styled
} ;
@@ -53,7 +53,7 @@ void convertPixmapToGrayScale(QPixmap &pixMap);
class LMMS_EXPORT Knob : public QWidget, public FloatModelView
{
Q_OBJECT
Q_ENUMS( knobTypes )
Q_ENUMS( KnobType )
Q_PROPERTY(float innerRadius READ innerRadius WRITE setInnerRadius)
Q_PROPERTY(float outerRadius READ outerRadius WRITE setOuterRadius)
@@ -75,7 +75,7 @@ class LMMS_EXPORT Knob : public QWidget, public FloatModelView
mapPropertyFromModel(bool,isVolumeKnob,setVolumeKnob,m_volumeKnob);
mapPropertyFromModel(float,volumeRatio,setVolumeRatio,m_volumeRatio);
Q_PROPERTY(knobTypes knobNum READ knobNum WRITE setknobNum)
Q_PROPERTY(KnobType knobNum READ knobNum WRITE setknobNum)
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
@@ -83,7 +83,7 @@ class LMMS_EXPORT Knob : public QWidget, public FloatModelView
void onKnobNumUpdated(); //!< to be called when you updated @a m_knobNum
public:
Knob( knobTypes _knob_num, QWidget * _parent = nullptr, const QString & _name = QString() );
Knob( KnobType _knob_num, QWidget * _parent = nullptr, const QString & _name = QString() );
Knob( QWidget * _parent = nullptr, const QString & _name = QString() ); //!< default ctor
Knob( const Knob& other ) = delete;
@@ -106,8 +106,8 @@ public:
float outerRadius() const;
void setOuterRadius( float r );
knobTypes knobNum() const;
void setknobNum( knobTypes k );
KnobType knobNum() const;
void setknobNum( KnobType k );
QPointF centerPoint() const;
float centerPointX() const;
@@ -206,7 +206,7 @@ private:
QColor m_textColor;
knobTypes m_knobNum;
KnobType m_knobNum;
} ;

View File

@@ -35,16 +35,16 @@ namespace lmms
class LadspaControl;
enum buffer_rate_t {
CHANNEL_IN,
CHANNEL_OUT,
AUDIO_RATE_INPUT,
AUDIO_RATE_OUTPUT,
CONTROL_RATE_INPUT,
CONTROL_RATE_OUTPUT
enum class BufferRate {
ChannelIn,
ChannelOut,
AudioRateInput,
AudioRateOutput,
ControlRateInput,
ControlRateOutput
};
enum buffer_data_t { TOGGLED, ENUM, INTEGER, FLOATING, TIME, NONE };
enum class BufferDataType { Toggled, Enum, Integer, Floating, Time, None };
//! This struct is used to hold port descriptions internally
//! which where received from the ladspa plugin
@@ -54,8 +54,8 @@ struct port_desc_t
ch_cnt_t proc;
uint16_t port_id;
uint16_t control_id;
buffer_rate_t rate;
buffer_data_t data_type;
BufferRate rate;
BufferDataType data_type;
float scale;
LADSPA_Data max;
LADSPA_Data min;

View File

@@ -62,14 +62,14 @@ calls using:
as the plug-in key. */
enum LadspaPluginType
enum class LadspaPluginType
{
SOURCE,
TRANSFER,
VALID,
INVALID,
SINK,
OTHER
Source,
Transfer,
Valid,
Invalid,
Sink,
Other
};
struct LadspaManagerDescription

View File

@@ -38,20 +38,19 @@ class LMMS_EXPORT LedCheckBox : public AutomatableButton
{
Q_OBJECT
public:
enum LedColors
enum class LedColor
{
Yellow,
Green,
Red,
NumColors
Red
} ;
LedCheckBox( const QString & _txt, QWidget * _parent,
const QString & _name = QString(),
LedColors _color = Yellow );
LedColor _color = LedColor::Yellow );
LedCheckBox( QWidget * _parent,
const QString & _name = QString(),
LedColors _color = Yellow );
LedColor _color = LedColor::Yellow );
~LedCheckBox() override;
@@ -75,7 +74,7 @@ private:
QString m_text;
void initUi( LedColors _color ); //!< to be called by ctors
void initUi( LedColor _color ); //!< to be called by ctors
void onTextUpdated(); //!< to be called when you updated @a m_text
} ;

View File

@@ -36,34 +36,6 @@ namespace lmms::gui
class LmmsStyle : public QProxyStyle
{
public:
enum ColorRole
{
AutomationBarFill,
AutomationBarValue,
AutomationSelectedBarFill,
AutomationCrosshair,
PianoRollStepNote,
PianoRollSelectedNote,
PianoRollDefaultNote,
PianoRollFrozenNote,
PianoRollMutedNote,
PianoRollEditHandle,
PianoRollVolumeLevel,
PianoRollPanningLevel,
PianoRollSelectedLevel,
TimelineForecolor,
StandardGraphLine,
StandardGraphHandle,
StandardGraphHandleBorder,
StandardGraphCrosshair,
TextFloatForecolor,
TextFloatFill,
VisualizationLevelLow,
VisualizationLevelMid,
VisualizationLevelPeak,
NumColorRoles
};
LmmsStyle();
~LmmsStyle() override = default;
@@ -88,8 +60,6 @@ public:
private:
QImage colorizeXpm( const char * const * xpm, const QBrush& fill ) const;
void hoverColors( bool sunken, bool hover, bool active, QColor& color, QColor& blend ) const;
QColor m_colors[ LmmsStyle::NumColorRoles ];
};

View File

@@ -74,7 +74,7 @@ class PluginIssue;
class LMMS_EXPORT Lv2ControlBase : public LinkedModelGroups
{
public:
static Plugin::PluginTypes check(const LilvPlugin* m_plugin,
static Plugin::Type check(const LilvPlugin* m_plugin,
std::vector<PluginIssue> &issues);
void shutdown();

View File

@@ -95,18 +95,18 @@ public:
//! use only for std::map internals
Lv2Info() : m_plugin(nullptr) {}
//! ctor used inside Lv2Manager
Lv2Info(const LilvPlugin* plug, Plugin::PluginTypes type, bool valid) :
Lv2Info(const LilvPlugin* plug, Plugin::Type type, bool valid) :
m_plugin(plug), m_type(type), m_valid(valid) {}
Lv2Info(Lv2Info&& other) = default;
Lv2Info& operator=(Lv2Info&& other) = default;
const LilvPlugin* plugin() const { return m_plugin; }
Plugin::PluginTypes type() const { return m_type; }
Plugin::Type type() const { return m_type; }
bool isValid() const { return m_valid; }
private:
const LilvPlugin* m_plugin;
Plugin::PluginTypes m_type;
Plugin::Type m_type;
bool m_valid = false;
};

View File

@@ -33,6 +33,7 @@
#include <memory>
#include <vector>
#include "Flags.h"
#include "lmms_basics.h"
#include "PluginIssue.h"
@@ -210,12 +211,12 @@ private:
struct AtomSeq : public VisitablePort<AtomSeq, PortBase>
{
enum FlagType
enum class FlagType
{
None = 0,
Midi = 1
};
unsigned flags = FlagType::None;
Flags<FlagType> flags = FlagType::None;
struct Lv2EvbufDeleter
{

View File

@@ -64,7 +64,7 @@ namespace Lv2Ports
class Lv2Proc : public LinkedModelGroup
{
public:
static Plugin::PluginTypes check(const LilvPlugin* plugin,
static Plugin::Type check(const LilvPlugin* plugin,
std::vector<PluginIssue> &issues);
/*

View File

@@ -47,7 +47,7 @@ private:
static QString pluginName(const LilvPlugin *plug);
public:
Lv2SubPluginFeatures(Plugin::PluginTypes type);
Lv2SubPluginFeatures(Plugin::Type type);
void fillDescriptionWidget(
QWidget *parent, const Key *k) const override;

View File

@@ -113,7 +113,7 @@ public:
return m_autoSaveTimer.interval();
}
enum SessionState
enum class SessionState
{
Normal,
Recover

View File

@@ -46,7 +46,7 @@ class LMMS_EXPORT MidiClip : public Clip
{
Q_OBJECT
public:
enum MidiClipTypes
enum class Type
{
BeatClip,
MelodyClip
@@ -82,7 +82,7 @@ public:
void splitNotes(NoteVector notes, TimePos pos);
// clip-type stuff
inline MidiClipTypes type() const
inline Type type() const
{
return m_clipType;
}
@@ -129,14 +129,14 @@ protected slots:
private:
TimePos beatClipLength() const;
void setType( MidiClipTypes _new_clip_type );
void setType( Type _new_clip_type );
void checkType();
void resizeToFirstTrack();
InstrumentTrack * m_instrumentTrack;
MidiClipTypes m_clipType;
Type m_clipType;
// data-stuff
NoteVector m_notes;

View File

@@ -69,20 +69,19 @@ class MidiPort : public Model, public SerializingObject
public:
using Map = QMap<QString, bool>;
enum Modes
enum class Mode
{
Disabled, // don't route any MIDI-events (default)
Input, // from MIDI-client to MIDI-event-processor
Output, // from MIDI-event-processor to MIDI-client
Duplex // both directions
} ;
using Mode = Modes;
MidiPort( const QString& name,
MidiClient* client,
MidiEventProcessor* eventProcessor,
Model* parent = nullptr,
Mode mode = Disabled );
Mode mode = Mode::Disabled );
~MidiPort() override;
void setName( const QString& name );
@@ -96,12 +95,12 @@ public:
bool isInputEnabled() const
{
return mode() == Input || mode() == Duplex;
return mode() == Mode::Input || mode() == Mode::Duplex;
}
bool isOutputEnabled() const
{
return mode() == Output || mode() == Duplex;
return mode() == Mode::Output || mode() == Mode::Duplex;
}
int realOutputChannel() const

View File

@@ -40,7 +40,7 @@ class MidiPortMenu : public QMenu, public ModelView
{
Q_OBJECT
public:
MidiPortMenu( MidiPort::Modes _mode );
MidiPortMenu( MidiPort::Mode _mode );
~MidiPortMenu() override = default;
@@ -55,7 +55,7 @@ protected slots:
private:
void modelChanged() override;
MidiPort::Modes m_mode;
MidiPort::Mode m_mode;
} ;

View File

@@ -42,47 +42,53 @@ namespace lmms
class DetuningHelper;
enum Keys
enum class Key : int
{
Key_C = 0,
Key_CIS = 1, Key_DES = 1,
Key_D = 2,
Key_DIS = 3, Key_ES = 3,
Key_E = 4, Key_FES = 4,
Key_F = 5,
Key_FIS = 6, Key_GES = 6,
Key_G = 7,
Key_GIS = 8, Key_AS = 8,
Key_A = 9,
Key_AIS = 10, Key_B = 10,
Key_H = 11
C = 0,
Cis = 1, Des = 1,
D = 2,
Dis = 3, Es = 3,
E = 4, Fes = 4,
F = 5,
Fis = 6, Ges = 6,
G = 7,
Gis = 8, As = 8,
A = 9,
Ais = 10, B = 10,
H = 11
} ;
enum Octaves
enum class Octave : int
{
Octave_m1, // MIDI standard starts at C-1
Octave_0,
Octave_1,
Octave_2,
Octave_3,
Octave_4, DefaultOctave = Octave_4,
Octave_4,
Octave_5,
Octave_6,
Octave_7,
Octave_8,
Octave_9, // incomplete octave, MIDI only goes up to G9
NumOctaves
};
const int FirstOctave = -1;
const int KeysPerOctave = 12;
const int DefaultKey = DefaultOctave * KeysPerOctave + Key_A;
constexpr inline auto operator+(Octave octave, Key key) -> int
{
return static_cast<int>(octave) * KeysPerOctave + static_cast<int>(key);
}
constexpr auto DefaultOctave = Octave::Octave_4;
const int DefaultKey = DefaultOctave + Key::A;
//! Number of physical keys, limited to MIDI range (valid for both MIDI 1.0 and 2.0)
const int NumKeys = 128;
const int DefaultMiddleKey = Octave_4 * KeysPerOctave + Key_C;
const int DefaultBaseKey = Octave_4 * KeysPerOctave + Key_A;
const int DefaultMiddleKey = Octave::Octave_4 + Key::C;
const int DefaultBaseKey = Octave::Octave_4 + Key::A;
const float DefaultBaseFreq = 440.f;
const float MaxDetuning = 4 * 12.0f;

View File

@@ -56,15 +56,13 @@ public:
fpp_t m_fadeInLength;
// specifies origin of NotePlayHandle
enum Origins
enum class Origin
{
OriginMidiClip, /*! playback of a note from a MIDI clip */
OriginMidiInput, /*! playback of a MIDI note input event */
OriginNoteStacking, /*! created by note stacking instrument function */
OriginArpeggio, /*! created by arpeggio instrument function */
OriginCount
MidiClip, /*! playback of a note from a MIDI clip */
MidiInput, /*! playback of a MIDI note input event */
NoteStacking, /*! created by note stacking instrument function */
Arpeggio, /*! created by arpeggio instrument function */
};
using Origin = Origins;
NotePlayHandle( InstrumentTrack* instrumentTrack,
const f_cnt_t offset,
@@ -72,7 +70,7 @@ public:
const Note& noteToPlay,
NotePlayHandle* parent = nullptr,
int midiEventChannel = -1,
Origin origin = OriginMidiClip );
Origin origin = Origin::MidiClip );
~NotePlayHandle() override;
void * operator new ( size_t size, void * p )
@@ -349,7 +347,7 @@ public:
const Note& noteToPlay,
NotePlayHandle* parent = nullptr,
int midiEventChannel = -1,
NotePlayHandle::Origin origin = NotePlayHandle::OriginMidiClip );
NotePlayHandle::Origin origin = NotePlayHandle::Origin::MidiClip );
static void release( NotePlayHandle * nph );
static void extend( int i );
static void free();

View File

@@ -48,31 +48,34 @@ class LMMS_EXPORT Oscillator
{
MM_OPERATORS
public:
enum WaveShapes
enum class WaveShape
{
SineWave,
TriangleWave,
SawWave,
SquareWave,
MoogSawWave,
ExponentialWave,
Sine,
Triangle,
Saw,
Square,
MoogSaw,
Exponential,
WhiteNoise,
UserDefinedWave,
NumWaveShapes, //!< Number of all available wave shapes
FirstWaveShapeTable = TriangleWave, //!< First wave shape that has a pre-generated table
NumWaveShapeTables = WhiteNoise - FirstWaveShapeTable, //!< Number of band-limited wave shapes to be generated
UserDefined,
Count //!< Number of all available wave shapes
};
constexpr static auto NumWaveShapes = static_cast<std::size_t>(WaveShape::Count);
//! First wave shape that has a pre-generated table
constexpr static auto FirstWaveShapeTable = static_cast<std::size_t>(WaveShape::Triangle);
//! Number of band-limited wave shapes to be generated
constexpr static auto NumWaveShapeTables = static_cast<std::size_t>(WaveShape::WhiteNoise) - FirstWaveShapeTable;
enum ModulationAlgos
enum class ModulationAlgo
{
PhaseModulation,
AmplitudeModulation,
SignalMix,
SynchronizedBySubOsc,
FrequencyModulation,
NumModulationAlgos
Count
} ;
constexpr static auto NumModulationAlgos = static_cast<std::size_t>(ModulationAlgo::Count);
Oscillator( const IntModel *wave_shape_model,
const IntModel *mod_algo_model,
@@ -251,7 +254,7 @@ private:
bool m_isModulator;
/* Multiband WaveTable */
static sample_t s_waveTables[WaveShapes::NumWaveShapeTables][OscillatorConstants::WAVE_TABLES_PER_WAVEFORM_COUNT][OscillatorConstants::WAVETABLE_LENGTH];
static sample_t s_waveTables[NumWaveShapeTables][OscillatorConstants::WAVE_TABLES_PER_WAVEFORM_COUNT][OscillatorConstants::WAVETABLE_LENGTH];
static fftwf_plan s_fftPlan;
static fftwf_plan s_ifftPlan;
static fftwf_complex * s_specBuf;
@@ -284,26 +287,26 @@ private:
const ch_cnt_t _chnl );
inline bool syncOk( float _osc_coeff );
template<WaveShapes W>
template<WaveShape W>
void updateNoSub( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<WaveShapes W>
template<WaveShape W>
void updatePM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<WaveShapes W>
template<WaveShape W>
void updateAM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<WaveShapes W>
template<WaveShape W>
void updateMix( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<WaveShapes W>
template<WaveShape W>
void updateSync( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<WaveShapes W>
template<WaveShape W>
void updateFM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl );
template<WaveShapes W>
template<WaveShape W>
inline sample_t getSample( const float _sample );
inline void recalcPhase();

View File

@@ -35,19 +35,18 @@ namespace lmms
class OutputSettings
{
public:
enum BitDepth
enum class BitDepth
{
Depth_16Bit,
Depth_24Bit,
Depth_32Bit,
NumDepths
Depth16Bit,
Depth24Bit,
Depth32Bit
};
enum StereoMode
enum class StereoMode
{
StereoMode_Stereo,
StereoMode_JointStereo,
StereoMode_Mono
Stereo,
JointStereo,
Mono
};
class BitRateSettings
@@ -85,7 +84,7 @@ public:
OutputSettings( sample_rate_t sampleRate,
BitRateSettings const & bitRateSettings,
BitDepth bitDepth ) :
OutputSettings(sampleRate, bitRateSettings, bitDepth, StereoMode_Stereo )
OutputSettings(sampleRate, bitRateSettings, bitDepth, StereoMode::Stereo )
{
}

View File

@@ -38,10 +38,10 @@ class MidiEventProcessor;
class Piano final : public Model
{
public:
enum KeyTypes
enum class KeyType
{
WhiteKey,
BlackKey
White,
Black
} ;
Piano(InstrumentTrack* track);

View File

@@ -104,13 +104,13 @@ class PianoRoll : public QWidget
Q_PROPERTY(QBrush blackKeyActiveBackground MEMBER m_blackKeyActiveBackground)
Q_PROPERTY(QBrush blackKeyDisabledBackground MEMBER m_blackKeyDisabledBackground)
public:
enum EditModes
enum class EditMode
{
ModeDraw,
ModeErase,
ModeSelect,
ModeEditDetuning,
ModeEditKnife
Draw,
Erase,
Select,
Detuning,
Knife
};
/*! \brief Resets settings to default when e.g. creating a new project */
@@ -153,16 +153,26 @@ public:
int trackOctaveSize() const;
Song::PlayModes desiredPlayModeForAccompany() const;
Song::PlayMode desiredPlayModeForAccompany() const;
int quantization() const;
protected:
enum QuantizeActions
enum class QuantizeAction
{
QuantizeBoth,
QuantizePos,
QuantizeLength
Both,
Pos,
Length
};
enum class SemiToneMarkerAction
{
UnmarkAll,
MarkCurrentSemiTone,
MarkAllOctaveSemiTones,
MarkCurrentScale,
MarkCurrentChord,
CopyAllNotesOnKey
};
void keyPressEvent( QKeyEvent * ke ) override;
@@ -221,12 +231,12 @@ protected slots:
void quantizeChanged();
void noteLengthChanged();
void keyChanged();
void quantizeNotes(lmms::gui::PianoRoll::QuantizeActions mode = QuantizeBoth);
void quantizeNotes(QuantizeAction mode = QuantizeAction::Both);
void updateSemiToneMarkerMenu();
void changeNoteEditMode( int i );
void markSemiTone(int i, bool fromMenu = true);
void markSemiTone(SemiToneMarkerAction i, bool fromMenu = true);
void hideMidiClip( lmms::MidiClip* clip );
@@ -248,46 +258,36 @@ signals:
private:
enum Actions
enum class Action
{
ActionNone,
ActionMoveNote,
ActionResizeNote,
ActionSelectNotes,
ActionChangeNoteProperty,
ActionResizeNoteEditArea,
ActionKnife
None,
MoveNote,
ResizeNote,
SelectNotes,
ChangeNoteProperty,
ResizeNoteEditArea,
Knife
};
enum NoteEditMode
enum class NoteEditMode
{
NoteEditVolume,
NoteEditPanning,
NoteEditCount // make sure this one is always last
Volume,
Panning,
Count // make sure this one is always last
};
enum SemiToneMarkerAction
enum class KeyType
{
stmaUnmarkAll,
stmaMarkCurrentSemiTone,
stmaMarkAllOctaveSemiTones,
stmaMarkCurrentScale,
stmaMarkCurrentChord,
stmaCopyAllNotesOnKey
WhiteSmall,
WhiteBig,
Black
};
enum PianoRollKeyTypes
enum class GridMode
{
PR_WHITE_KEY_SMALL,
PR_WHITE_KEY_BIG,
PR_BLACK_KEY
};
enum GridMode
{
gridNudge,
gridSnap
// gridFree
Nudge,
Snap
// Free
};
PositionLine * m_positionLine;
@@ -346,7 +346,7 @@ private:
static QPixmap * s_toolOpen;
static QPixmap* s_toolKnife;
static std::array<PianoRollKeyTypes, 12> prKeyOrder;
static std::array<KeyType, 12> prKeyOrder;
static SimpleTextFloat * s_textFloat;
@@ -378,7 +378,7 @@ private:
QList<Note> m_recordingNotes;
Note * m_currentNote;
Actions m_action;
Action m_action;
NoteEditMode m_noteEditMode;
GridMode m_gridMode;
@@ -429,9 +429,9 @@ private:
int m_startKey; // first key when drawing
int m_lastKey;
EditModes m_editMode;
EditModes m_ctrlMode; // mode they were in before they hit ctrl
EditModes m_knifeMode; // mode they where in before entering knife mode
EditMode m_editMode;
EditMode m_ctrlMode; // mode they were in before they hit ctrl
EditMode m_knifeMode; // mode they where in before entering knife mode
bool m_mouseDownRight; //true if right click is being held down

View File

@@ -30,7 +30,7 @@
#include "lmms_export.h"
#include "Flags.h"
#include "ThreadableJob.h"
#include "lmms_basics.h"
@@ -45,19 +45,16 @@ class AudioPort;
class LMMS_EXPORT PlayHandle : public ThreadableJob
{
public:
enum Types
enum class Type
{
TypeNotePlayHandle = 0x01,
TypeInstrumentPlayHandle = 0x02,
TypeSamplePlayHandle = 0x04,
TypePresetPreviewHandle = 0x08
NotePlayHandle = 0x01,
InstrumentPlayHandle = 0x02,
SamplePlayHandle = 0x04,
PresetPreviewHandle = 0x08
} ;
using Type = Types;
using Types = Flags<Type>;
enum
{
MaxNumber = 1024
} ;
constexpr static std::size_t MaxNumber = 1024;
PlayHandle( const Type type, f_cnt_t offset = 0 );
@@ -164,6 +161,8 @@ private:
using PlayHandleList = QList<PlayHandle*>;
using ConstPlayHandleList = QList<const PlayHandle*>;
LMMS_DECLARE_OPERATORS_FOR_FLAGS(PlayHandle::Type)
} // namespace lmms
#endif // LMMS_PLAY_HANDLE_H

View File

@@ -74,7 +74,7 @@ class LMMS_EXPORT Plugin : public Model, public JournallingObject
MM_OPERATORS
Q_OBJECT
public:
enum PluginTypes
enum class Type
{
Instrument, // instrument being used in channel-track
Effect, // effect-plugin for effect-board
@@ -97,7 +97,7 @@ public:
const char * description;
const char * author;
int version;
PluginTypes type;
Type type;
const PixmapLoader * logo;
const char * supportedFileTypes; //!< csv list of extensions
@@ -181,7 +181,7 @@ public:
using KeyList = QList<Key>;
SubPluginFeatures( Plugin::PluginTypes type ) :
SubPluginFeatures( Plugin::Type type ) :
m_type( type )
{
}
@@ -227,7 +227,7 @@ public:
}
protected:
const Plugin::PluginTypes m_type;
const Plugin::Type m_type;
} ;
SubPluginFeatures * subPluginFeatures;
@@ -250,7 +250,7 @@ public:
const PixmapLoader *logo() const;
//! Return plugin type
inline PluginTypes type() const
inline Type type() const
{
return m_descriptor->type;
}

View File

@@ -55,7 +55,7 @@ public:
bool isNull() const {return ! library;}
};
using PluginInfoList = QList<PluginInfo>;
using DescriptorMap = QMultiMap<Plugin::PluginTypes, Plugin::Descriptor*>;
using DescriptorMap = QMultiMap<Plugin::Type, Plugin::Descriptor*>;
PluginFactory();
~PluginFactory() = default;
@@ -68,7 +68,7 @@ public:
/// Returns a list of all found plugins' descriptors.
Plugin::DescriptorList descriptors() const;
Plugin::DescriptorList descriptors(Plugin::PluginTypes type) const;
Plugin::DescriptorList descriptors(Plugin::Type type) const;
struct PluginInfoAndKey
{

View File

@@ -33,32 +33,32 @@ namespace lmms
//! Types of issues that can cause LMMS to not load a plugin
//! LMMS Plugins should use this to indicate errors
enum PluginIssueType
enum class PluginIssueType
{
// port flow & type
unknownPortFlow,
unknownPortType,
UnknownPortFlow,
UnknownPortType,
// channel count
tooManyInputChannels,
tooManyOutputChannels,
tooManyMidiInputChannels,
tooManyMidiOutputChannels,
noOutputChannel,
TooManyInputChannels,
TooManyOutputChannels,
TooManyMidiInputChannels,
TooManyMidiOutputChannels,
NoOutputChannel,
// port metadata
portHasNoDef,
portHasNoMin,
portHasNoMax,
minGreaterMax,
defaultValueNotInRange,
logScaleMinMissing,
logScaleMaxMissing,
logScaleMinMaxDifferentSigns,
PortHasNoDef,
PortHasNoMin,
PortHasNoMax,
MinGreaterMax,
DefaultValueNotInRange,
LogScaleMinMissing,
LogScaleMaxMissing,
LogScaleMinMaxDifferentSigns,
// features
featureNotSupported, //!< plugin requires functionality LMMS can't offer
FeatureNotSupported, //!< plugin requires functionality LMMS can't offer
// misc
badPortType, //!< port type not supported
blacklisted,
noIssue
BadPortType, //!< port type not supported
Blacklisted,
NoIssue
};
//! Issue type bundled with informational string

View File

@@ -104,7 +104,7 @@ private:
struct CheckPoint
{
CheckPoint( jo_id_t initID = 0, const DataFile& initData = DataFile( DataFile::JournalData ) ) :
CheckPoint( jo_id_t initID = 0, const DataFile& initData = DataFile( DataFile::Type::JournalData ) ) :
joID( initID ),
data( initData )
{

View File

@@ -40,20 +40,21 @@ class LMMS_EXPORT ProjectRenderer : public QThread
{
Q_OBJECT
public:
enum ExportFileFormats: int
enum class ExportFileFormat : int
{
WaveFile,
FlacFile,
OggFile,
MP3File,
NumFileFormats
Wave,
Flac,
Ogg,
MP3,
Count
} ;
constexpr static auto NumFileFormats = static_cast<std::size_t>(ExportFileFormat::Count);
struct FileEncodeDevice
{
bool isAvailable() const { return m_getDevInst != nullptr; }
ExportFileFormats m_fileFormat;
ExportFileFormat m_fileFormat;
const char * m_description;
const char * m_extension;
AudioFileDeviceInstantiaton m_getDevInst;
@@ -62,7 +63,7 @@ public:
ProjectRenderer( const AudioEngine::qualitySettings & _qs,
const OutputSettings & _os,
ExportFileFormats _file_format,
ExportFileFormat _file_format,
const QString & _out_file );
~ProjectRenderer() override = default;
@@ -71,10 +72,10 @@ public:
return m_fileDev != nullptr;
}
static ExportFileFormats getFileFormatFromExtension(
static ExportFileFormat getFileFormatFromExtension(
const QString & _ext );
static QString getFileExtensionFromFormat( ExportFileFormats fmt );
static QString getFileExtensionFromFormat( ExportFileFormat fmt );
static const std::array<FileEncodeDevice, 5> fileEncodeDevices;

View File

@@ -42,11 +42,11 @@ namespace lmms
class ProjectVersion
{
public:
enum CompareType : int { None = 0, Major=1, Minor=2, Release=3, Stage=4, Build=5, All = std::numeric_limits<int>::max() };
enum class CompareType : int { None = 0, Major=1, Minor=2, Release=3, Stage=4, Build=5, All = std::numeric_limits<int>::max() };
ProjectVersion(QString version, CompareType c = All);
ProjectVersion(const char * version, CompareType c = All);
ProjectVersion(QString version, CompareType c = CompareType::All);
ProjectVersion(const char * version, CompareType c = CompareType::All);
const QString& getVersion() const { return m_version; }
int getMajor() const { return m_major; }

View File

@@ -43,7 +43,7 @@ public:
RenderManager(
const AudioEngine::qualitySettings & qualitySettings,
const OutputSettings & outputSettings,
ProjectRenderer::ExportFileFormats fmt,
ProjectRenderer::ExportFileFormat fmt,
QString outputPath);
~RenderManager() override;
@@ -73,7 +73,7 @@ private:
const AudioEngine::qualitySettings m_qualitySettings;
const AudioEngine::qualitySettings m_oldQualitySettings;
const OutputSettings m_outputSettings;
ProjectRenderer::ExportFileFormats m_format;
ProjectRenderer::ExportFileFormat m_format;
QString m_outputPath;
std::unique_ptr<ProjectRenderer> m_activeRenderer;

View File

@@ -57,10 +57,10 @@ class LMMS_EXPORT SampleBuffer : public QObject, public sharedObject
Q_OBJECT
MM_OPERATORS
public:
enum LoopMode {
LoopOff = 0,
LoopOn,
LoopPingPong
enum class LoopMode {
Off = 0,
On,
PingPong
};
class LMMS_EXPORT handleState
{
@@ -125,7 +125,7 @@ public:
handleState * state,
const fpp_t frames,
const float freq,
const LoopMode loopMode = LoopOff
const LoopMode loopMode = LoopMode::Off
);
void visualize(

View File

@@ -53,7 +53,7 @@ class SetupDialog : public QDialog
Q_OBJECT
public:
enum ConfigTabs
enum class ConfigTab
{
GeneralSettings,
PerformanceSettings,
@@ -62,7 +62,7 @@ public:
PathsSettings
};
SetupDialog(ConfigTabs tab_to_open = GeneralSettings);
SetupDialog(ConfigTab tab_to_open = ConfigTab::GeneralSettings);
~SetupDialog() override;

View File

@@ -68,15 +68,16 @@ class LMMS_EXPORT Song : public TrackContainer
mapPropertyFromModel( int,masterPitch,setMasterPitch,m_masterPitchModel );
mapPropertyFromModel( int,masterVolume,setMasterVolume, m_masterVolumeModel );
public:
enum PlayModes
enum class PlayMode
{
Mode_None,
Mode_PlaySong,
Mode_PlayPattern,
Mode_PlayMidiClip,
Mode_PlayAutomationClip,
Mode_Count
None,
Song,
Pattern,
MidiClip,
AutomationClip,
Count
} ;
constexpr static auto PlayModeCount = static_cast<std::size_t>(PlayMode::Count);
struct SaveOptions {
/**
@@ -141,36 +142,34 @@ public:
inline int getMilliseconds() const
{
return m_elapsedMilliSeconds[m_playMode];
return getMilliseconds(m_playMode);
}
inline int getMilliseconds(PlayModes playMode) const
inline int getMilliseconds(PlayMode playMode) const
{
return m_elapsedMilliSeconds[playMode];
return m_elapsedMilliSeconds[static_cast<std::size_t>(playMode)];
}
inline void setToTime(TimePos const & pos)
{
m_elapsedMilliSeconds[m_playMode] = pos.getTimeInMilliseconds(getTempo());
m_playPos[m_playMode].setTicks(pos.getTicks());
setToTime(pos, m_playMode);
}
inline void setToTime(TimePos const & pos, PlayModes playMode)
inline void setToTime(TimePos const & pos, PlayMode playMode)
{
m_elapsedMilliSeconds[playMode] = pos.getTimeInMilliseconds(getTempo());
m_playPos[playMode].setTicks(pos.getTicks());
m_elapsedMilliSeconds[static_cast<std::size_t>(playMode)] = pos.getTimeInMilliseconds(getTempo());
getPlayPos(playMode).setTicks(pos.getTicks());
}
inline void setToTimeByTicks(tick_t ticks)
{
m_elapsedMilliSeconds[m_playMode] = TimePos::ticksToMilliseconds(ticks, getTempo());
m_playPos[m_playMode].setTicks(ticks);
setToTimeByTicks(ticks, m_playMode);
}
inline void setToTimeByTicks(tick_t ticks, PlayModes playMode)
inline void setToTimeByTicks(tick_t ticks, PlayMode playMode)
{
m_elapsedMilliSeconds[playMode] = TimePos::ticksToMilliseconds(ticks, getTempo());
m_playPos[playMode].setTicks(ticks);
m_elapsedMilliSeconds[static_cast<std::size_t>(playMode)] = TimePos::ticksToMilliseconds(ticks, getTempo());
getPlayPos(playMode).setTicks(ticks);
}
inline int getBars() const
@@ -253,18 +252,18 @@ public:
m_renderBetweenMarkers = renderBetweenMarkers;
}
inline PlayModes playMode() const
inline PlayMode playMode() const
{
return m_playMode;
}
inline PlayPos & getPlayPos( PlayModes pm )
inline PlayPos & getPlayPos( PlayMode pm )
{
return m_playPos[pm];
return m_playPos[static_cast<std::size_t>(pm)];
}
inline const PlayPos & getPlayPos( PlayModes pm ) const
inline const PlayPos & getPlayPos( PlayMode pm ) const
{
return m_playPos[pm];
return m_playPos[static_cast<std::size_t>(pm)];
}
inline PlayPos & getPlayPos()
{
@@ -417,21 +416,21 @@ private:
inline bar_t currentBar() const
{
return m_playPos[m_playMode].getBar();
return getPlayPos(m_playMode).getBar();
}
inline tick_t currentTick() const
{
return m_playPos[m_playMode].getTicks();
return getPlayPos(m_playMode).getTicks();
}
inline f_cnt_t currentFrame() const
{
return m_playPos[m_playMode].getTicks() * Engine::framesPerTick() +
m_playPos[m_playMode].currentFrame();
return getPlayPos(m_playMode).getTicks() * Engine::framesPerTick() +
getPlayPos(m_playMode).currentFrame();
}
void setPlayPos( tick_t ticks, PlayModes playMode );
void setPlayPos( tick_t ticks, PlayMode playMode );
void saveControllerStates( QDomDocument & doc, QDomElement & element );
void restoreControllerStates( const QDomElement & element );
@@ -482,14 +481,14 @@ private:
QHash<QString, int> m_errors;
PlayModes m_playMode;
PlayPos m_playPos[Mode_Count];
PlayMode m_playMode;
PlayPos m_playPos[PlayModeCount];
bar_t m_length;
const MidiClip* m_midiClipToPlay;
bool m_loopMidiClip;
double m_elapsedMilliSeconds[Mode_Count];
double m_elapsedMilliSeconds[PlayModeCount];
tick_t m_elapsedTicks;
bar_t m_elapsedBars;

View File

@@ -57,11 +57,11 @@ class SongEditor : public TrackContainerView
{
Q_OBJECT
public:
enum EditMode
enum class EditMode
{
DrawMode,
KnifeMode,
SelectMode
Draw,
Knife,
Select
};
SongEditor( Song * song );

View File

@@ -41,7 +41,7 @@ class LMMS_EXPORT TempoSyncKnob : public Knob
{
Q_OBJECT
public:
TempoSyncKnob( knobTypes knobNum, QWidget* parent = nullptr, const QString& name = QString() );
TempoSyncKnob( KnobType knobNum, QWidget* parent = nullptr, const QString& name = QString() );
~TempoSyncKnob() override;
const QString & syncDescription();

View File

@@ -46,17 +46,17 @@ class LMMS_EXPORT TempoSyncKnobModel : public FloatModel
Q_OBJECT
MODEL_IS_VISITABLE
public:
enum TempoSyncMode
enum class SyncMode
{
SyncNone,
SyncDoubleWholeNote,
SyncWholeNote,
SyncHalfNote,
SyncQuarterNote,
SyncEighthNote,
SyncSixteenthNote,
SyncThirtysecondNote,
SyncCustom
None,
DoubleWholeNote,
WholeNote,
HalfNote,
QuarterNote,
EighthNote,
SixteenthNote,
ThirtysecondNote,
Custom
} ;
TempoSyncKnobModel( const float _val, const float _min,
@@ -68,12 +68,12 @@ public:
void saveSettings( QDomDocument & _doc, QDomElement & _this, const QString& name ) override;
void loadSettings( const QDomElement & _this, const QString& name ) override;
TempoSyncMode syncMode() const
SyncMode syncMode() const
{
return m_tempoSyncMode;
}
void setSyncMode( TempoSyncMode _new_mode );
void setSyncMode( SyncMode _new_mode );
float scale() const
{
@@ -83,16 +83,16 @@ public:
void setScale( float _new_scale );
signals:
void syncModeChanged( lmms::TempoSyncKnobModel::TempoSyncMode _new_mode );
void syncModeChanged( lmms::TempoSyncKnobModel::SyncMode _new_mode );
void scaleChanged( float _new_scale );
public slots:
inline void disableSync()
{
setTempoSync( SyncNone );
setTempoSync( SyncMode::None );
}
void setTempoSync( int _note_type );
void setTempoSync( SyncMode _note_type );
void setTempoSync( QAction * _item );
@@ -102,8 +102,8 @@ protected slots:
private:
TempoSyncMode m_tempoSyncMode;
TempoSyncMode m_tempoLastSyncMode;
SyncMode m_tempoSyncMode;
SyncMode m_tempoLastSyncMode;
float m_scale;
MeterModel m_custom;

View File

@@ -51,13 +51,11 @@ private slots:
private:
enum DisplayModes
enum class DisplayMode
{
MinutesSeconds,
BarsTicks,
DisplayModeCount
BarsTicks
};
using DisplayMode = DisplayModes;
void setDisplayMode( DisplayMode displayMode );

View File

@@ -55,19 +55,19 @@ public:
Q_PROPERTY( QColor activeLoopInnerColor READ getActiveLoopInnerColor WRITE setActiveLoopInnerColor )
Q_PROPERTY( int loopRectangleVerticalPadding READ getLoopRectangleVerticalPadding WRITE setLoopRectangleVerticalPadding )
enum AutoScrollStates
enum class AutoScrollState
{
AutoScrollEnabled,
AutoScrollDisabled
Enabled,
Disabled
} ;
enum LoopPointStates
enum class LoopPointState
{
LoopPointsDisabled,
LoopPointsEnabled
Disabled,
Enabled
} ;
enum BehaviourAtStopStates
enum class BehaviourAtStopState
{
BackToZero,
BackToStart,
@@ -76,7 +76,7 @@ public:
TimeLineWidget(int xoff, int yoff, float ppb, Song::PlayPos & pos,
const TimePos & begin, Song::PlayModes mode, QWidget * parent);
const TimePos & begin, Song::PlayMode mode, QWidget * parent);
~TimeLineWidget() override;
inline QColor const & getBarLineColor() const { return m_barLineColor; }
@@ -111,12 +111,12 @@ public:
return( m_pos );
}
AutoScrollStates autoScroll() const
AutoScrollState autoScroll() const
{
return m_autoScroll;
}
BehaviourAtStopStates behaviourAtStop() const
BehaviourAtStopState behaviourAtStop() const
{
return m_behaviourAtStop;
}
@@ -128,7 +128,7 @@ public:
bool loopPointsEnabled() const
{
return m_loopPoints == LoopPointsEnabled;
return m_loopPoints == LoopPointState::Enabled;
}
inline const TimePos & loopBegin() const
@@ -220,9 +220,9 @@ private:
QColor m_barLineColor;
QColor m_barNumberColor;
AutoScrollStates m_autoScroll;
LoopPointStates m_loopPoints;
BehaviourAtStopStates m_behaviourAtStop;
AutoScrollState m_autoScroll;
LoopPointState m_loopPoints;
BehaviourAtStopState m_behaviourAtStop;
bool m_changedPosition;
@@ -232,7 +232,7 @@ private:
float m_snapSize;
Song::PlayPos & m_pos;
const TimePos & m_begin;
const Song::PlayModes m_mode;
const Song::PlayMode m_mode;
TimePos m_loopPos[2];
TimePos m_savedPos;
@@ -242,7 +242,7 @@ private:
int m_initalXSelect;
enum actions
enum class Action
{
NoAction,
MovePositionMarker,

View File

@@ -72,29 +72,29 @@ class LMMS_EXPORT Track : public Model, public JournallingObject
public:
using clipVector = std::vector<Clip*>;
enum TrackTypes
enum class Type
{
InstrumentTrack,
PatternTrack,
SampleTrack,
EventTrack,
VideoTrack,
AutomationTrack,
HiddenAutomationTrack,
NumTrackTypes
Instrument,
Pattern,
Sample,
Event,
Video,
Automation,
HiddenAutomation,
Count
} ;
Track( TrackTypes type, TrackContainer * tc );
Track( Type type, TrackContainer * tc );
~Track() override;
static Track * create( TrackTypes tt, TrackContainer * tc );
static Track * create( Type tt, TrackContainer * tc );
static Track * create( const QDomElement & element,
TrackContainer * tc );
Track * clone();
// pure virtual functions
TrackTypes type() const
Type type() const
{
return m_type;
}
@@ -224,7 +224,7 @@ public slots:
private:
TrackContainer* m_trackContainer;
TrackTypes m_type;
Type m_type;
QString m_name;
int m_height;

View File

@@ -50,10 +50,10 @@ class LMMS_EXPORT TrackContainer : public Model, public JournallingObject
Q_OBJECT
public:
using TrackList = std::vector<Track*>;
enum TrackContainerTypes
enum class Type
{
PatternContainer,
SongContainer
Pattern,
Song
} ;
TrackContainer();
@@ -63,7 +63,7 @@ public:
void loadSettings( const QDomElement & _this ) override;
int countTracks( Track::TrackTypes _tt = Track::NumTrackTypes ) const;
int countTracks( Track::Type _tt = Track::Type::Count ) const;
void addTrack( Track * _track );
@@ -85,12 +85,12 @@ public:
return "trackcontainer";
}
inline void setType( TrackContainerTypes newType )
inline void setType( Type newType )
{
m_TrackContainerType = newType;
}
inline TrackContainerTypes type() const
inline Type type() const
{
return m_TrackContainerType;
}
@@ -108,7 +108,7 @@ protected:
private:
TrackList m_tracks;
TrackContainerTypes m_TrackContainerType;
Type m_TrackContainerType;
friend class gui::TrackContainerView;

View File

@@ -174,12 +174,6 @@ protected:
private:
enum Actions
{
AddTrack,
RemoveTrack
} ;
class scrollArea : public QScrollArea
{
public:

View File

@@ -95,7 +95,7 @@ public slots:
void changePosition( const lmms::TimePos & newPos = TimePos( -1 ) );
protected:
enum ContextMenuAction
enum class ContextMenuAction
{
Paste
};

View File

@@ -95,7 +95,7 @@ public:
bool isMovingTrack() const
{
return m_action == MoveTrack;
return m_action == Action::Move;
}
virtual void update();
@@ -139,11 +139,11 @@ protected:
private:
enum Actions
enum class Action
{
NoAction,
MoveTrack,
ResizeTrack
None,
Move,
Resize
} ;
Track * m_track;
@@ -153,7 +153,7 @@ private:
QWidget m_trackSettingsWidget;
TrackContentWidget m_trackContentWidget;
Actions m_action;
Action m_action;
virtual FadeButton * getActivityIndicator()
{

View File

@@ -44,12 +44,12 @@ const unsigned int FFT_BUFFER_SIZE = 2048;
const std::vector<unsigned int> FFT_BLOCK_SIZES = {256, 512, 1024, 2048, 4096, 8192, 16384};
// List of FFT window functions supported by precomputeWindow()
enum FFT_WINDOWS
enum class FFTWindow
{
RECTANGULAR = 0,
BLACKMAN_HARRIS,
HAMMING,
HANNING
Rectangular = 0,
BlackmanHarris,
Hamming,
Hanning
};
@@ -83,7 +83,7 @@ int LMMS_EXPORT notEmpty(const std::vector<float> &spectrum);
*
* @return -1 on error
*/
int LMMS_EXPORT precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool normalized = true);
int LMMS_EXPORT precomputeWindow(float *window, unsigned int length, FFTWindow type, bool normalized = true);
/** Compute absolute values of complex_buffer, save to absspec_buffer.

View File

@@ -62,13 +62,13 @@ constexpr unsigned int MaxKeymapCount = 10; //!< number of keyboard mappings per
constexpr int LOWEST_LOG_FREQ = 5;
// Full range is defined by LOWEST_LOG_FREQ and current sample rate.
enum FREQUENCY_RANGES
enum class FrequencyRange
{
FRANGE_FULL = 0,
FRANGE_AUDIBLE,
FRANGE_BASS,
FRANGE_MIDS,
FRANGE_HIGH
Full = 0,
Audible,
Bass,
Mids,
High
};
constexpr int FRANGE_AUDIBLE_START = 20;
@@ -83,12 +83,12 @@ constexpr int FRANGE_HIGH_END = 20000;
// Amplitude ranges (in dBFS).
// Reference: full scale sine wave (-1.0 to 1.0) is 0 dB.
// Doubling or halving the amplitude produces 3 dB difference.
enum AMPLITUDE_RANGES
enum class AmplitudeRange
{
ARANGE_EXTENDED = 0,
ARANGE_AUDIBLE,
ARANGE_LOUD,
ARANGE_SILENT
Extended = 0,
Audible,
Loud,
Silent
};
constexpr int ARANGE_EXTENDED_START = -80;