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;

View File

@@ -41,7 +41,7 @@ Plugin::Descriptor PLUGIN_EXPORT amplifier_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "A native amplifier plugin" ),
"Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,

View File

@@ -43,27 +43,27 @@ AmplifierControlDialog::AmplifierControlDialog( AmplifierControls* controls ) :
setPalette( pal );
setFixedSize( 100, 110 );
auto volumeKnob = new Knob(knobBright_26, this);
auto volumeKnob = new Knob(KnobType::Bright26, this);
volumeKnob -> move( 16, 10 );
volumeKnob -> setVolumeKnob( true );
volumeKnob->setModel( &controls->m_volumeModel );
volumeKnob->setLabel( tr( "VOL" ) );
volumeKnob->setHintText( tr( "Volume:" ) , "%" );
auto panKnob = new Knob(knobBright_26, this);
auto panKnob = new Knob(KnobType::Bright26, this);
panKnob -> move( 57, 10 );
panKnob->setModel( &controls->m_panModel );
panKnob->setLabel( tr( "PAN" ) );
panKnob->setHintText( tr( "Panning:" ) , "" );
auto leftKnob = new Knob(knobBright_26, this);
auto leftKnob = new Knob(KnobType::Bright26, this);
leftKnob -> move( 16, 65 );
leftKnob -> setVolumeKnob( true );
leftKnob->setModel( &controls->m_leftModel );
leftKnob->setLabel( tr( "LEFT" ) );
leftKnob->setHintText( tr( "Left gain:" ) , "%" );
auto rightKnob = new Knob(knobBright_26, this);
auto rightKnob = new Knob(KnobType::Bright26, this);
rightKnob -> move( 57, 65 );
rightKnob -> setVolumeKnob( true );
rightKnob->setModel( &controls->m_rightModel );

View File

@@ -64,7 +64,7 @@ Plugin::Descriptor PLUGIN_EXPORT audiofileprocessor_plugin_descriptor =
"instrument-track" ),
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
Plugin::Instrument,
Plugin::Type::Instrument,
new PluginPixmapLoader( "logo" ),
"wav,ogg,ds,spx,au,voc,aif,aiff,flac,raw",
nullptr,
@@ -516,7 +516,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument,
m_stutterButton->setToolTip(
tr( "Continue sample playback across notes" ) );
m_ampKnob = new Knob( knobBright_26, this );
m_ampKnob = new Knob( KnobType::Bright26, this );
m_ampKnob->setVolumeKnob( true );
m_ampKnob->move( 5, 108 );
m_ampKnob->setHintText( tr( "Amplify:" ), "%" );
@@ -567,7 +567,7 @@ void AudioFileProcessorView::dragEnterEvent( QDragEnterEvent * _dee )
QString txt = _dee->mimeData()->data(
mimeType( MimeType::StringPair ) );
if( txt.section( ':', 0, 0 ) == QString( "clip_%1" ).arg(
Track::SampleTrack ) )
static_cast<int>(Track::Type::Sample) ) )
{
_dee->acceptProposedAction();
}
@@ -619,7 +619,7 @@ void AudioFileProcessorView::dropEvent( QDropEvent * _de )
newWaveView();
return;
}
else if( type == QString( "clip_%1" ).arg( Track::SampleTrack ) )
else if( type == QString( "clip_%1" ).arg( static_cast<int>(Track::Type::Sample) ) )
{
DataFile dataFile( value.toUtf8() );
castModel<AudioFileProcessor>()->setAudioFile( dataFile.content().firstChild().toElement().attribute( "src" ) );
@@ -787,9 +787,9 @@ void AudioFileProcessorWaveView::mousePressEvent( QMouseEvent * _me )
const int end_dist = qAbs( m_endFrameX - x );
const int loop_dist = qAbs( m_loopFrameX - x );
draggingType dt = sample_loop; int md = loop_dist;
if( start_dist < loop_dist ) { dt = sample_start; md = start_dist; }
else if( end_dist < loop_dist ) { dt = sample_end; md = end_dist; }
DraggingType dt = DraggingType::SampleLoop; int md = loop_dist;
if( start_dist < loop_dist ) { dt = DraggingType::SampleStart; md = start_dist; }
else if( end_dist < loop_dist ) { dt = DraggingType::SampleEnd; md = end_dist; }
if( md < 4 )
{
@@ -797,7 +797,7 @@ void AudioFileProcessorWaveView::mousePressEvent( QMouseEvent * _me )
}
else
{
m_draggingType = wave;
m_draggingType = DraggingType::Wave;
updateCursor(_me);
}
}
@@ -808,7 +808,7 @@ void AudioFileProcessorWaveView::mousePressEvent( QMouseEvent * _me )
void AudioFileProcessorWaveView::mouseReleaseEvent( QMouseEvent * _me )
{
m_isDragging = false;
if( m_draggingType == wave )
if( m_draggingType == DraggingType::Wave )
{
updateCursor(_me);
}
@@ -828,16 +828,16 @@ void AudioFileProcessorWaveView::mouseMoveEvent( QMouseEvent * _me )
const int step = _me->x() - m_draggingLastPoint.x();
switch( m_draggingType )
{
case sample_start:
slideSamplePointByPx( start, step );
case DraggingType::SampleStart:
slideSamplePointByPx( Point::Start, step );
break;
case sample_end:
slideSamplePointByPx( end, step );
case DraggingType::SampleEnd:
slideSamplePointByPx( Point::End, step );
break;
case sample_loop:
slideSamplePointByPx( loop, step );
case DraggingType::SampleLoop:
slideSamplePointByPx( Point::Loop, step );
break;
case wave:
case DraggingType::Wave:
default:
if( qAbs( _me->y() - m_draggingLastPoint.y() )
< 2 * qAbs( _me->x() - m_draggingLastPoint.x() ) )
@@ -983,7 +983,7 @@ void AudioFileProcessorWaveView::updateGraph()
if( m_to == 1 )
{
m_to = m_sampleBuffer.frames() * 0.7;
slideSamplePointToFrames( end, m_to * 0.7 );
slideSamplePointToFrames( Point::End, m_to * 0.7 );
}
if( m_from > m_sampleBuffer.startFrame() )
@@ -1110,7 +1110,7 @@ void AudioFileProcessorWaveView::setKnobs( knob * _start, knob * _end, knob * _l
void AudioFileProcessorWaveView::slideSamplePointByPx( knobType _point, int _px )
void AudioFileProcessorWaveView::slideSamplePointByPx( Point _point, int _px )
{
slideSamplePointByFrames(
_point,
@@ -1121,18 +1121,18 @@ void AudioFileProcessorWaveView::slideSamplePointByPx( knobType _point, int _px
void AudioFileProcessorWaveView::slideSamplePointByFrames( knobType _point, f_cnt_t _frames, bool _slide_to )
void AudioFileProcessorWaveView::slideSamplePointByFrames( Point _point, f_cnt_t _frames, bool _slide_to )
{
knob * a_knob = m_startKnob;
switch( _point )
{
case end:
case Point::End:
a_knob = m_endKnob;
break;
case loop:
case Point::Loop:
a_knob = m_loopKnob;
break;
case start:
case Point::Start:
break;
}
if( a_knob == nullptr )
@@ -1196,7 +1196,7 @@ void AudioFileProcessorWaveView::reverse()
void AudioFileProcessorWaveView::updateCursor( QMouseEvent * _me )
{
bool const waveIsDragged = m_isDragging && (m_draggingType == wave);
bool const waveIsDragged = m_isDragging && (m_draggingType == DraggingType::Wave);
bool const pointerCloseToStartEndOrLoop = (_me != nullptr ) &&
( isCloseTo( _me->x(), m_startFrameX ) ||
isCloseTo( _me->x(), m_endFrameX ) ||

View File

@@ -177,11 +177,11 @@ protected:
public:
enum knobType
enum class Point
{
start,
end,
loop
Start,
End,
Loop
} ;
class knob : public Knob
@@ -192,7 +192,7 @@ public:
public:
knob( QWidget * _parent ) :
Knob( knobBright_26, _parent ),
Knob( KnobType::Bright26, _parent ),
m_waveView( 0 ),
m_relatedKnob( 0 )
{
@@ -239,12 +239,12 @@ public slots:
private:
static const int s_padding = 2;
enum draggingType
enum class DraggingType
{
wave,
sample_start,
sample_end,
sample_loop
Wave,
SampleStart,
SampleEnd,
SampleLoop
} ;
SampleBuffer& m_sampleBuffer;
@@ -262,7 +262,7 @@ private:
f_cnt_t m_loopFrameX;
bool m_isDragging;
QPoint m_draggingLastPoint;
draggingType m_draggingType;
DraggingType m_draggingType;
bool m_reversed;
f_cnt_t m_framesPlayed;
bool m_animation;
@@ -276,11 +276,11 @@ public:
private:
void zoom( const bool _out = false );
void slide( int _px );
void slideSamplePointByPx( knobType _point, int _px );
void slideSamplePointByFrames( knobType _point, f_cnt_t _frames, bool _slide_to = false );
void slideSamplePointByPx( Point _point, int _px );
void slideSamplePointByFrames( Point _point, f_cnt_t _frames, bool _slide_to = false );
void slideSampleByFrames( f_cnt_t _frames );
void slideSamplePointToFrames( knobType _point, f_cnt_t _frames )
void slideSamplePointToFrames( Point _point, f_cnt_t _frames )
{
slideSamplePointByFrames( _point, _frames, true );
}

View File

@@ -41,7 +41,7 @@ Plugin::Descriptor PLUGIN_EXPORT bassbooster_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "Boost your bass the fast and simple way" ),
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,

View File

@@ -50,17 +50,17 @@ BassBoosterControlDialog::BassBoosterControlDialog( BassBoosterControls* control
auto l = new QHBoxLayout;
auto freqKnob = new Knob(knobBright_26, this);
auto freqKnob = new Knob(KnobType::Bright26, this);
freqKnob->setModel( &controls->m_freqModel );
freqKnob->setLabel( tr( "FREQ" ) );
freqKnob->setHintText( tr( "Frequency:" ) , "Hz" );
auto gainKnob = new Knob(knobBright_26, this);
auto gainKnob = new Knob(KnobType::Bright26, this);
gainKnob->setModel( &controls->m_gainModel );
gainKnob->setLabel( tr( "GAIN" ) );
gainKnob->setHintText( tr( "Gain:" ) , "" );
auto ratioKnob = new Knob(knobBright_26, this);
auto ratioKnob = new Knob(KnobType::Bright26, this);
ratioKnob->setModel( &controls->m_ratioModel );
ratioKnob->setLabel( tr( "RATIO" ) );
ratioKnob->setHintText( tr( "Ratio:" ) , "" );

View File

@@ -60,7 +60,7 @@ Plugin::Descriptor PLUGIN_EXPORT bitinvader_plugin_descriptor =
"Customizable wavetable synthesizer" ),
"Andreas Brandmaier <andreas/at/brandmaier/dot/de>",
0x0100,
Plugin::Instrument,
Plugin::Type::Instrument,
new PluginPixmapLoader( "logo" ),
nullptr,
nullptr,
@@ -345,11 +345,11 @@ BitInvaderView::BitInvaderView( Instrument * _instrument,
"artwork" ) );
setPalette( pal );
m_sampleLengthKnob = new Knob( knobDark_28, this );
m_sampleLengthKnob = new Knob( KnobType::Dark28, this );
m_sampleLengthKnob->move( 6, 201 );
m_sampleLengthKnob->setHintText( tr( "Sample length" ), "" );
m_graph = new Graph( this, Graph::NearestStyle, 204, 134 );
m_graph = new Graph( this, Graph::Style::Nearest, 204, 134 );
m_graph->move(23,59); // 55,120 - 2px border
m_graph->setAutoFillBackground( true );
m_graph->setGraphColor( QColor( 255, 255, 255 ) );
@@ -431,12 +431,12 @@ BitInvaderView::BitInvaderView( Instrument * _instrument,
m_interpolationToggle = new LedCheckBox( "Interpolation", this,
tr( "Interpolation" ), LedCheckBox::Yellow );
tr( "Interpolation" ), LedCheckBox::LedColor::Yellow );
m_interpolationToggle->move( 131, 221 );
m_normalizeToggle = new LedCheckBox( "Normalize", this,
tr( "Normalize" ), LedCheckBox::Green );
tr( "Normalize" ), LedCheckBox::LedColor::Green );
m_normalizeToggle->move( 131, 236 );
@@ -556,7 +556,7 @@ void BitInvaderView::smoothClicked()
void BitInvaderView::interpolationToggled( bool value )
{
m_graph->setGraphStyle( value ? Graph::LinearStyle : Graph::NearestStyle);
m_graph->setGraphStyle( value ? Graph::Style::Linear : Graph::Style::Nearest);
Engine::getSong()->setModified();
}

View File

@@ -48,7 +48,7 @@ Plugin::Descriptor PLUGIN_EXPORT bitcrush_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "An oversampling bitcrusher" ),
"Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader( "logo" ),
nullptr,
nullptr,

View File

@@ -53,13 +53,13 @@ BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
outLabel->move( 139, 15 );
// input knobs
auto inGain = new Knob(knobBright_26, this);
auto inGain = new Knob(KnobType::Bright26, this);
inGain->move( 16, 32 );
inGain->setModel( & controls->m_inGain );
inGain->setLabel( tr( "GAIN" ) );
inGain->setHintText( tr( "Input gain:" ) , " dBFS" );
auto inNoise = new Knob(knobBright_26, this);
auto inNoise = new Knob(KnobType::Bright26, this);
inNoise->move( 14, 76 );
inNoise->setModel( & controls->m_inNoise );
inNoise->setLabel( tr( "NOISE" ) );
@@ -67,13 +67,13 @@ BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
// output knobs
auto outGain = new Knob(knobBright_26, this);
auto outGain = new Knob(KnobType::Bright26, this);
outGain->move( 138, 32 );
outGain->setModel( & controls->m_outGain );
outGain->setLabel( tr( "GAIN" ) );
outGain->setHintText( tr( "Output gain:" ) , " dBFS" );
auto outClip = new Knob(knobBright_26, this);
auto outClip = new Knob(KnobType::Bright26, this);
outClip->move( 138, 76 );
outClip->setModel( & controls->m_outClip );
outClip->setLabel( tr( "CLIP" ) );
@@ -82,25 +82,25 @@ BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
// leds
auto rateEnabled = new LedCheckBox("", this, tr("Rate enabled"), LedCheckBox::Green);
auto rateEnabled = new LedCheckBox("", this, tr("Rate enabled"), LedCheckBox::LedColor::Green);
rateEnabled->move( 64, 14 );
rateEnabled->setModel( & controls->m_rateEnabled );
rateEnabled->setToolTip(tr("Enable sample-rate crushing"));
auto depthEnabled = new LedCheckBox("", this, tr("Depth enabled"), LedCheckBox::Green);
auto depthEnabled = new LedCheckBox("", this, tr("Depth enabled"), LedCheckBox::LedColor::Green);
depthEnabled->move( 101, 14 );
depthEnabled->setModel( & controls->m_depthEnabled );
depthEnabled->setToolTip(tr("Enable bit-depth crushing"));
// rate crushing knobs
auto rate = new Knob(knobBright_26, this);
auto rate = new Knob(KnobType::Bright26, this);
rate->move( 59, 32 );
rate->setModel( & controls->m_rate );
rate->setLabel( tr( "FREQ" ) );
rate->setHintText( tr( "Sample rate:" ) , " Hz" );
auto stereoDiff = new Knob(knobBright_26, this);
auto stereoDiff = new Knob(KnobType::Bright26, this);
stereoDiff->move( 72, 76 );
stereoDiff->setModel( & controls->m_stereoDiff );
stereoDiff->setLabel( tr( "STEREO" ) );
@@ -108,7 +108,7 @@ BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
// depth crushing knob
auto levels = new Knob(knobBright_26, this);
auto levels = new Knob(KnobType::Bright26, this);
levels->move( 92, 32 );
levels->setModel( & controls->m_levels );
levels->setLabel( tr( "QUANT" ) );

View File

@@ -220,7 +220,7 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D
CarlaInstrument::~CarlaInstrument()
{
Engine::audioEngine()->removePlayHandlesOfTypes(instrumentTrack(), PlayHandle::TypeNotePlayHandle | PlayHandle::TypeInstrumentPlayHandle);
Engine::audioEngine()->removePlayHandlesOfTypes(instrumentTrack(), PlayHandle::Type::NotePlayHandle | PlayHandle::Type::InstrumentPlayHandle);
if (fHost.resourceDir != nullptr)
{
@@ -345,7 +345,7 @@ intptr_t CarlaInstrument::handleDispatcher(const NativeHostDispatcherOpcode opco
Instrument::Flags CarlaInstrument::flags() const
{
return IsSingleStreamed|IsMidiBased|IsNotBendable;
return Flag::IsSingleStreamed | Flag::IsMidiBased | Flag::IsNotBendable;
}
QString CarlaInstrument::nodeName() const
@@ -1015,7 +1015,7 @@ void CarlaParamsView::refreshKnobs()
for (uint32_t i=0; i < m_carlaInstrument->m_paramModels.count(); ++i)
{
bool enabled = m_carlaInstrument->m_paramModels[i]->enabled();
m_knobs.push_back(new Knob(knobDark_28, m_inputScrollAreaWidgetContent));
m_knobs.push_back(new Knob(KnobType::Dark28, m_inputScrollAreaWidgetContent));
QString name = (*m_carlaInstrument->m_paramModels[i]).displayName();
m_knobs[i]->setHintText(name, "");
m_knobs[i]->setLabel(name);

View File

@@ -43,7 +43,7 @@ Plugin::Descriptor PLUGIN_EXPORT carlapatchbay_plugin_descriptor =
"Carla Patchbay Instrument" ),
"falkTX <falktx/at/falktx.com>",
CARLA_VERSION_HEX,
Plugin::Instrument,
Plugin::Type::Instrument,
new PluginPixmapLoader( "logo" ),
nullptr,
nullptr,

View File

@@ -43,7 +43,7 @@ Plugin::Descriptor PLUGIN_EXPORT carlarack_plugin_descriptor =
"Carla Rack Instrument" ),
"falkTX <falktx/at/falktx.com>",
CARLA_VERSION_HEX,
Plugin::Instrument,
Plugin::Type::Instrument,
new PluginPixmapLoader( "logo" ),
nullptr,
nullptr,

View File

@@ -43,7 +43,7 @@ Plugin::Descriptor PLUGIN_EXPORT compressor_plugin_descriptor =
QT_TRANSLATE_NOOP("PluginBrowser", "A dynamic range compressor."),
"Lost Robot <r94231@gmail.com>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,
@@ -442,28 +442,28 @@ bool CompressorEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
m_gainResult[i] = qMax(m_rangeVal, m_gainResult[i]);
}
switch (stereoLink)
switch (static_cast<StereoLinkMode>(stereoLink))
{
case Unlinked:
case StereoLinkMode::Unlinked:
{
break;
}
case Maximum:
case StereoLinkMode::Maximum:
{
m_gainResult[0] = m_gainResult[1] = qMin(m_gainResult[0], m_gainResult[1]);
break;
}
case Average:
case StereoLinkMode::Average:
{
m_gainResult[0] = m_gainResult[1] = (m_gainResult[0] + m_gainResult[1]) * 0.5f;
break;
}
case Minimum:
case StereoLinkMode::Minimum:
{
m_gainResult[0] = m_gainResult[1] = qMax(m_gainResult[0], m_gainResult[1]);
break;
}
case Blend:
case StereoLinkMode::Blend:
{
if (blend > 0)// 0 is unlinked
{

View File

@@ -79,7 +79,7 @@ private:
inline int realmod(int k, int n);
inline float realfmod(float k, float n);
enum StereoLinkModes { Unlinked, Maximum, Average, Minimum, Blend };
enum class StereoLinkMode { Unlinked, Maximum, Average, Minimum, Blend };
std::vector<float> m_preLookaheadBuf[2];
int m_preLookaheadBufLoc[2] = {0};

View File

@@ -95,92 +95,92 @@ CompressorControlDialog::CompressorControlDialog(CompressorControls* controls) :
m_ratioEnabledLabel->setPixmap(PLUGIN_NAME::getIconPixmap("knob_enabled_large"));
m_ratioEnabledLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
m_thresholdKnob = new Knob(knobStyled, this);
m_thresholdKnob = new Knob(KnobType::Styled, this);
makeLargeKnob(m_thresholdKnob, tr("Threshold:") , " dBFS");
m_thresholdKnob->setModel(&controls->m_thresholdModel);
m_thresholdKnob->setToolTip(tr("Volume at which the compression begins to take place"));
m_ratioKnob = new Knob(knobStyled, this);
m_ratioKnob = new Knob(KnobType::Styled, this);
makeLargeKnob(m_ratioKnob, tr("Ratio:") , ":1");
m_ratioKnob->setModel(&controls->m_ratioModel);
m_ratioKnob->setToolTip(tr("How far the compressor must turn the volume down after crossing the threshold"));
m_attackKnob = new Knob(knobStyled, this);
m_attackKnob = new Knob(KnobType::Styled, this);
makeLargeKnob(m_attackKnob, tr("Attack:") , " ms");
m_attackKnob->setModel(&controls->m_attackModel);
m_attackKnob->setToolTip(tr("Speed at which the compressor starts to compress the audio"));
m_releaseKnob = new Knob(knobStyled, this);
m_releaseKnob = new Knob(KnobType::Styled, this);
makeLargeKnob(m_releaseKnob, tr("Release:") , " ms");
m_releaseKnob->setModel(&controls->m_releaseModel);
m_releaseKnob->setToolTip(tr("Speed at which the compressor ceases to compress the audio"));
m_kneeKnob = new Knob(knobStyled, this);
m_kneeKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_kneeKnob, tr("Knee:") , " dB");
m_kneeKnob->setModel(&controls->m_kneeModel);
m_kneeKnob->setToolTip(tr("Smooth out the gain reduction curve around the threshold"));
m_rangeKnob = new Knob(knobStyled, this);
m_rangeKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_rangeKnob, tr("Range:") , " dBFS");
m_rangeKnob->setModel(&controls->m_rangeModel);
m_rangeKnob->setToolTip(tr("Maximum gain reduction"));
m_lookaheadLengthKnob = new Knob(knobStyled, this);
m_lookaheadLengthKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_lookaheadLengthKnob, tr("Lookahead Length:") , " ms");
m_lookaheadLengthKnob->setModel(&controls->m_lookaheadLengthModel);
m_lookaheadLengthKnob->setToolTip(tr("How long the compressor has to react to the sidechain signal ahead of time"));
m_holdKnob = new Knob(knobStyled, this);
m_holdKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_holdKnob, tr("Hold:") , " ms");
m_holdKnob->setModel(&controls->m_holdModel);
m_holdKnob->setToolTip(tr("Delay between attack and release stages"));
m_rmsKnob = new Knob(knobStyled, this);
m_rmsKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_rmsKnob, tr("RMS Size:") , "");
m_rmsKnob->setModel(&controls->m_rmsModel);
m_rmsKnob->setToolTip(tr("Size of the RMS buffer"));
m_inBalanceKnob = new Knob(knobStyled, this);
m_inBalanceKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_inBalanceKnob, tr("Input Balance:") , "");
m_inBalanceKnob->setModel(&controls->m_inBalanceModel);
m_inBalanceKnob->setToolTip(tr("Bias the input audio to the left/right or mid/side"));
m_outBalanceKnob = new Knob(knobStyled, this);
m_outBalanceKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_outBalanceKnob, tr("Output Balance:") , "");
m_outBalanceKnob->setModel(&controls->m_outBalanceModel);
m_outBalanceKnob->setToolTip(tr("Bias the output audio to the left/right or mid/side"));
m_stereoBalanceKnob = new Knob(knobStyled, this);
m_stereoBalanceKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_stereoBalanceKnob, tr("Stereo Balance:") , "");
m_stereoBalanceKnob->setModel(&controls->m_stereoBalanceModel);
m_stereoBalanceKnob->setToolTip(tr("Bias the sidechain signal to the left/right or mid/side"));
m_blendKnob = new Knob(knobStyled, this);
m_blendKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_blendKnob, tr("Stereo Link Blend:") , "");
m_blendKnob->setModel(&controls->m_blendModel);
m_blendKnob->setToolTip(tr("Blend between unlinked/maximum/average/minimum stereo linking modes"));
m_tiltKnob = new Knob(knobStyled, this);
m_tiltKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_tiltKnob, tr("Tilt Gain:") , " dB");
m_tiltKnob->setModel(&controls->m_tiltModel);
m_tiltKnob->setToolTip(tr("Bias the sidechain signal to the low or high frequencies. -6 db is lowpass, 6 db is highpass."));
m_tiltFreqKnob = new Knob(knobStyled, this);
m_tiltFreqKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_tiltFreqKnob, tr("Tilt Frequency:") , " Hz");
m_tiltFreqKnob->setModel(&controls->m_tiltFreqModel);
m_tiltFreqKnob->setToolTip(tr("Center frequency of sidechain tilt filter"));
m_mixKnob = new Knob(knobStyled, this);
m_mixKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_mixKnob, tr("Mix:") , "%");
m_mixKnob->setModel(&controls->m_mixModel);
m_mixKnob->setToolTip(tr("Balance between wet and dry signals"));
m_autoAttackKnob = new Knob(knobStyled, this);
m_autoAttackKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_autoAttackKnob, tr("Auto Attack:") , "%");
m_autoAttackKnob->setModel(&controls->m_autoAttackModel);
m_autoAttackKnob->setToolTip(tr("Automatically control attack value depending on crest factor"));
m_autoReleaseKnob = new Knob(knobStyled, this);
m_autoReleaseKnob = new Knob(KnobType::Styled, this);
makeSmallKnob(m_autoReleaseKnob, tr("Auto Release:") , "%");
m_autoReleaseKnob->setModel(&controls->m_autoReleaseModel);
m_autoReleaseKnob->setToolTip(tr("Automatically control release value depending on crest factor"));

View File

@@ -43,7 +43,7 @@ Plugin::Descriptor PLUGIN_EXPORT crossovereq_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "A 4-band Crossover Equalizer" ),
"Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader( "logo" ),
nullptr,
nullptr,

View File

@@ -46,19 +46,19 @@ CrossoverEQControlDialog::CrossoverEQControlDialog( CrossoverEQControls * contro
setFixedSize( 167, 178 );
// knobs
auto xover12 = new Knob(knobBright_26, this);
auto xover12 = new Knob(KnobType::Bright26, this);
xover12->move( 29, 11 );
xover12->setModel( & controls->m_xover12 );
xover12->setLabel( "1/2" );
xover12->setHintText( tr( "Band 1/2 crossover:" ), " Hz" );
auto xover23 = new Knob(knobBright_26, this);
auto xover23 = new Knob(KnobType::Bright26, this);
xover23->move( 69, 11 );
xover23->setModel( & controls->m_xover23 );
xover23->setLabel( "2/3" );
xover23->setHintText( tr( "Band 2/3 crossover:" ), " Hz" );
auto xover34 = new Knob(knobBright_26, this);
auto xover34 = new Knob(KnobType::Bright26, this);
xover34->move( 109, 11 );
xover34->setModel( & controls->m_xover34 );
xover34->setLabel( "3/4" );
@@ -90,22 +90,22 @@ CrossoverEQControlDialog::CrossoverEQControlDialog( CrossoverEQControls * contro
gain4->setHintText( tr( "Band 4 gain:" ), " dBFS" );
// leds
auto mute1 = new LedCheckBox("", this, tr("Band 1 mute"), LedCheckBox::Green);
auto mute1 = new LedCheckBox("", this, tr("Band 1 mute"), LedCheckBox::LedColor::Green);
mute1->move( 15, 154 );
mute1->setModel( & controls->m_mute1 );
mute1->setToolTip(tr("Mute band 1"));
auto mute2 = new LedCheckBox("", this, tr("Band 2 mute"), LedCheckBox::Green);
auto mute2 = new LedCheckBox("", this, tr("Band 2 mute"), LedCheckBox::LedColor::Green);
mute2->move( 55, 154 );
mute2->setModel( & controls->m_mute2 );
mute2->setToolTip(tr("Mute band 2"));
auto mute3 = new LedCheckBox("", this, tr("Band 3 mute"), LedCheckBox::Green);
auto mute3 = new LedCheckBox("", this, tr("Band 3 mute"), LedCheckBox::LedColor::Green);
mute3->move( 95, 154 );
mute3->setModel( & controls->m_mute3 );
mute3->setToolTip(tr("Mute band 3"));
auto mute4 = new LedCheckBox("", this, tr("Band 4 mute"), LedCheckBox::Green);
auto mute4 = new LedCheckBox("", this, tr("Band 4 mute"), LedCheckBox::LedColor::Green);
mute4->move( 135, 154 );
mute4->setModel( & controls->m_mute4 );
mute4->setToolTip(tr("Mute band 4"));

View File

@@ -44,28 +44,28 @@ DelayControlsDialog::DelayControlsDialog( DelayControls *controls ) :
setPalette( pal );
setFixedSize( 300, 208 );
auto sampleDelayKnob = new TempoSyncKnob(knobBright_26, this);
auto sampleDelayKnob = new TempoSyncKnob(KnobType::Bright26, this);
sampleDelayKnob->move( 10,14 );
sampleDelayKnob->setVolumeKnob( false );
sampleDelayKnob->setModel( &controls->m_delayTimeModel );
sampleDelayKnob->setLabel( tr( "DELAY" ) );
sampleDelayKnob->setHintText( tr( "Delay time" ) + " ", " s" );
auto feedbackKnob = new Knob(knobBright_26, this);
auto feedbackKnob = new Knob(KnobType::Bright26, this);
feedbackKnob->move( 11, 58 );
feedbackKnob->setVolumeKnob( true) ;
feedbackKnob->setModel( &controls->m_feedbackModel);
feedbackKnob->setLabel( tr( "FDBK" ) );
feedbackKnob->setHintText( tr ( "Feedback amount" ) + " " , "" );
auto lfoFreqKnob = new TempoSyncKnob(knobBright_26, this);
auto lfoFreqKnob = new TempoSyncKnob(KnobType::Bright26, this);
lfoFreqKnob->move( 11, 119 );
lfoFreqKnob->setVolumeKnob( false );
lfoFreqKnob->setModel( &controls->m_lfoTimeModel );
lfoFreqKnob->setLabel( tr( "RATE" ) );
lfoFreqKnob->setHintText( tr ( "LFO frequency") + " ", " s" );
auto lfoAmtKnob = new TempoSyncKnob(knobBright_26, this);
auto lfoAmtKnob = new TempoSyncKnob(KnobType::Bright26, this);
lfoAmtKnob->move( 11, 159 );
lfoAmtKnob->setVolumeKnob( false );
lfoAmtKnob->setModel( &controls->m_lfoAmountModel );

View File

@@ -44,7 +44,7 @@ Plugin::Descriptor PLUGIN_EXPORT delay_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "A native delay plugin" ),
"Dave French <contact/dot/dave/dot/french3/at/googlemail/dot/com>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,

View File

@@ -40,7 +40,7 @@ Plugin::Descriptor PLUGIN_EXPORT dispersion_plugin_descriptor =
QT_TRANSLATE_NOOP("PluginBrowser", "An all-pass filter allowing for extremely high orders."),
"Lost Robot <r94231/at/gmail/dot/com>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr

View File

@@ -51,19 +51,19 @@ DispersionControlDialog::DispersionControlDialog(DispersionControls* controls) :
m_amountBox->setLabel(tr("AMOUNT"));
m_amountBox->setToolTip(tr("Number of all-pass filters"));
Knob * freqKnob = new Knob(knobBright_26, this);
Knob * freqKnob = new Knob(KnobType::Bright26, this);
freqKnob->move(59, 8);
freqKnob->setModel(&controls->m_freqModel);
freqKnob->setLabel(tr("FREQ"));
freqKnob->setHintText(tr("Frequency:") , " Hz");
Knob * resoKnob = new Knob(knobBright_26, this);
Knob * resoKnob = new Knob(KnobType::Bright26, this);
resoKnob->move(99, 8);
resoKnob->setModel(&controls->m_resoModel);
resoKnob->setLabel(tr("RESO"));
resoKnob->setHintText(tr("Resonance:") , " octaves");
Knob * feedbackKnob = new Knob(knobBright_26, this);
Knob * feedbackKnob = new Knob(KnobType::Bright26, this);
feedbackKnob->move(139, 8);
feedbackKnob->setModel(&controls->m_feedbackModel);
feedbackKnob->setLabel(tr("FEED"));

View File

@@ -43,7 +43,7 @@ Plugin::Descriptor PLUGIN_EXPORT dualfilter_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "A Dual filter plugin" ),
"Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader( "logo" ),
nullptr,
nullptr,
@@ -90,12 +90,12 @@ bool DualFilterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
if( m_dfControls.m_filter1Model.isValueChanged() || m_filter1changed )
{
m_filter1->setFilterType( m_dfControls.m_filter1Model.value() );
m_filter1->setFilterType( static_cast<BasicFilters<2>::FilterType>(m_dfControls.m_filter1Model.value()) );
m_filter1changed = true;
}
if( m_dfControls.m_filter2Model.isValueChanged() || m_filter2changed )
{
m_filter2->setFilterType( m_dfControls.m_filter2Model.value() );
m_filter2->setFilterType( static_cast<BasicFilters<2>::FilterType>(m_dfControls.m_filter2Model.value()) );
m_filter2changed = true;
}

View File

@@ -36,7 +36,7 @@ namespace lmms::gui
#define makeknob( name, x, y, model, label, hint, unit ) \
Knob * name = new Knob( knobBright_26, this); \
Knob * name = new Knob( KnobType::Bright26, this); \
(name) -> move( x, y ); \
(name) ->setModel( &controls-> model ); \
(name) ->setLabel( label ); \
@@ -64,8 +64,8 @@ DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls )
gain1Knob-> setVolumeKnob( true );
gain2Knob-> setVolumeKnob( true );
auto enabled1Toggle = new LedCheckBox("", this, tr("Filter 1 enabled"), LedCheckBox::Green);
auto enabled2Toggle = new LedCheckBox("", this, tr("Filter 2 enabled"), LedCheckBox::Green);
auto enabled1Toggle = new LedCheckBox("", this, tr("Filter 1 enabled"), LedCheckBox::LedColor::Green);
auto enabled2Toggle = new LedCheckBox("", this, tr("Filter 2 enabled"), LedCheckBox::LedColor::Green);
enabled1Toggle -> move( 12, 11 );
enabled1Toggle -> setModel( &controls -> m_enabled1Model );

View File

@@ -47,7 +47,7 @@ Plugin::Descriptor PLUGIN_EXPORT dynamicsprocessor_plugin_descriptor =
"plugin for processing dynamics in a flexible way" ),
"Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,
@@ -167,19 +167,19 @@ bool DynProcEffect::processAudioBuffer( sampleFrame * _buf,
}
// account for stereo mode
switch( stereoMode )
switch( static_cast<DynProcControls::StereoMode>(stereoMode) )
{
case DynProcControls::SM_Maximum:
case DynProcControls::StereoMode::Maximum:
{
sm_peak[0] = sm_peak[1] = qMax( m_currentPeak[0], m_currentPeak[1] );
break;
}
case DynProcControls::SM_Average:
case DynProcControls::StereoMode::Average:
{
sm_peak[0] = sm_peak[1] = ( m_currentPeak[0] + m_currentPeak[1] ) * 0.5;
break;
}
case DynProcControls::SM_Unlinked:
case DynProcControls::StereoMode::Unlinked:
{
sm_peak[0] = m_currentPeak[0];
sm_peak[1] = m_currentPeak[1];

View File

@@ -47,7 +47,7 @@ DynProcControlDialog::DynProcControlDialog(
setPalette( pal );
setFixedSize( 224, 319 );
auto waveGraph = new Graph(this, Graph::LinearNonCyclicStyle, 204, 205);
auto waveGraph = new Graph(this, Graph::Style::LinearNonCyclic, 204, 205);
waveGraph -> move( 10, 6 );
waveGraph -> setModel( &_controls -> m_wavegraphModel );
waveGraph -> setAutoFillBackground( true );
@@ -58,7 +58,7 @@ DynProcControlDialog::DynProcControlDialog(
waveGraph->setGraphColor( QColor( 85, 204, 145 ) );
waveGraph -> setMaximumSize( 204, 205 );
auto inputKnob = new Knob(knobBright_26, this);
auto inputKnob = new Knob(KnobType::Bright26, this);
inputKnob -> setVolumeKnob( true );
inputKnob -> setVolumeRatio( 1.0 );
inputKnob -> move( 26, 223 );
@@ -66,7 +66,7 @@ DynProcControlDialog::DynProcControlDialog(
inputKnob->setLabel( tr( "INPUT" ) );
inputKnob->setHintText( tr( "Input gain:" ) , "" );
auto outputKnob = new Knob(knobBright_26, this);
auto outputKnob = new Knob(KnobType::Bright26, this);
outputKnob -> setVolumeKnob( true );
outputKnob -> setVolumeRatio( 1.0 );
outputKnob -> move( 76, 223 );
@@ -74,13 +74,13 @@ DynProcControlDialog::DynProcControlDialog(
outputKnob->setLabel( tr( "OUTPUT" ) );
outputKnob->setHintText( tr( "Output gain:" ) , "" );
auto attackKnob = new Knob(knobBright_26, this);
auto attackKnob = new Knob(KnobType::Bright26, this);
attackKnob -> move( 24, 268 );
attackKnob->setModel( &_controls->m_attackModel );
attackKnob->setLabel( tr( "ATTACK" ) );
attackKnob->setHintText( tr( "Peak attack time:" ) , "ms" );
auto releaseKnob = new Knob(knobBright_26, this);
auto releaseKnob = new Knob(KnobType::Bright26, this);
releaseKnob -> move( 74, 268 );
releaseKnob->setModel( &_controls->m_releaseModel );
releaseKnob->setLabel( tr( "RELEASE" ) );

View File

@@ -41,12 +41,11 @@ class DynProcControls : public EffectControls
{
Q_OBJECT
public:
enum StereoModes
enum class StereoMode
{
SM_Maximum,
SM_Average,
SM_Unlinked,
NumStereoModes
Maximum,
Average,
Unlinked
};
DynProcControls( DynProcEffect * _eff );
~DynProcControls() override = default;

View File

@@ -106,14 +106,14 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
distance = 81;
for( int i = 0; i < m_parameterWidget->bandCount() ; i++ )
{
auto resKnob = new Knob(knobBright_26, this);
auto resKnob = new Knob(KnobType::Bright26, this);
resKnob->move( distance, 440 );
resKnob->setVolumeKnob(false);
resKnob->setModel( m_parameterWidget->getBandModels( i )->res );
if(i > 1 && i < 6) { resKnob->setHintText( tr( "Bandwidth: " ) , tr( " Octave" ) ); }
else { resKnob->setHintText( tr( "Resonance : " ) , "" ); }
auto freqKnob = new Knob(knobBright_26, this);
auto freqKnob = new Knob(KnobType::Bright26, this);
freqKnob->move( distance, 396 );
freqKnob->setVolumeKnob( false );
freqKnob->setModel( m_parameterWidget->getBandModels( i )->freq );

View File

@@ -137,7 +137,7 @@ void EqHandle::paint( QPainter *painter, const QStyleOptionGraphicsItem *option,
QRectF textRect2 = QRectF ( rectX+1, rectY+1, 80, 30 );
QString freq = QString::number( xPixelToFreq( EqHandle::x(), m_width ) );
QString res;
if ( getType() != para )
if ( getType() != EqHandleType::Para )
{
res = tr( "Reso: ") + QString::number( getResonance() );
}
@@ -171,11 +171,11 @@ QPainterPath EqHandle::getCurvePath()
float y = m_heigth * 0.5;
for ( float x = 0 ; x < m_width; x++ )
{
if ( m_type == highpass ) y = getLowCutCurve( x );
if ( m_type == lowshelf ) y = getLowShelfCurve( x );
if ( m_type == para ) y = getPeakCurve( x );
if ( m_type == highshelf ) y = getHighShelfCurve( x );
if ( m_type == lowpass ) y = getHighCutCurve( x );
if ( m_type == EqHandleType::HighPass ) y = getLowCutCurve( x );
if ( m_type == EqHandleType::LowShelf ) y = getLowShelfCurve( x );
if ( m_type == EqHandleType::Para ) y = getPeakCurve( x );
if ( m_type == EqHandleType::HighShelf ) y = getHighShelfCurve( x );
if ( m_type == EqHandleType::LowPass ) y = getHighCutCurve( x );
if ( x == 0 ) path.moveTo( x, y ); // sets the begin of Path
path.lineTo( x, y );
}
@@ -410,7 +410,7 @@ int EqHandle::getNum()
void EqHandle::setType( int t )
void EqHandle::setType( EqHandleType t )
{
EqHandle::m_type = t;
}
@@ -442,7 +442,7 @@ void EqHandle::setMouseHover( bool d )
int EqHandle::getType()
EqHandleType EqHandle::getType()
{
return m_type;
}
@@ -569,7 +569,7 @@ void EqHandle::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
void EqHandle::wheelEvent( QGraphicsSceneWheelEvent *wevent )
{
float highestBandwich;
if( m_type != para )
if( m_type != EqHandleType::Para )
{
highestBandwich = 10;
}
@@ -631,7 +631,7 @@ QVariant EqHandle::itemChange( QGraphicsItem::GraphicsItemChange change, const Q
if( change == ItemPositionChange )
{
// pass filter don't move in y direction
if ( m_type == highpass || m_type == lowpass )
if ( m_type == EqHandleType::HighPass || m_type == EqHandleType::LowPass )
{
float newX = value.toPointF().x();
if( newX < 0 )
@@ -714,23 +714,23 @@ void EqCurve::paint( QPainter *painter, const QStyleOptionGraphicsItem *option,
{
for ( int x = 0; x < m_width ; x=x+1 )
{
if ( m_handle->at( thatHandle )->getType() == highpass )
if ( m_handle->at( thatHandle )->getType() == EqHandleType::HighPass )
{
mainCurve[x]= ( mainCurve[x] + ( m_handle->at( thatHandle )->getLowCutCurve( x ) * ( activeHandles ) ) - ( ( activeHandles * ( m_heigth/2 ) ) - m_heigth ) );
}
if ( m_handle->at(thatHandle)->getType() == lowshelf )
if ( m_handle->at(thatHandle)->getType() == EqHandleType::LowShelf )
{
mainCurve[x]= ( mainCurve[x] + ( m_handle->at( thatHandle )->getLowShelfCurve( x ) * ( activeHandles ) ) - ( ( activeHandles * ( m_heigth/2 ) ) - m_heigth ) );
}
if ( m_handle->at( thatHandle )->getType() == para )
if ( m_handle->at( thatHandle )->getType() == EqHandleType::Para )
{
mainCurve[x]= ( mainCurve[x] + ( m_handle->at( thatHandle )->getPeakCurve( x ) * ( activeHandles ) ) - ( ( activeHandles * ( m_heigth/2 ) ) - m_heigth ) );
}
if ( m_handle->at( thatHandle )->getType() == highshelf )
if ( m_handle->at( thatHandle )->getType() == EqHandleType::HighShelf )
{
mainCurve[x]= ( mainCurve[x] + ( m_handle->at( thatHandle )->getHighShelfCurve( x ) * ( activeHandles ) ) - ( ( activeHandles * ( m_heigth/2 ) ) - m_heigth ) );
}
if ( m_handle->at(thatHandle)->getType() == lowpass )
if ( m_handle->at(thatHandle)->getType() == EqHandleType::LowPass )
{
mainCurve[x]= ( mainCurve[x] + ( m_handle->at( thatHandle )->getHighCutCurve( x ) * ( activeHandles ) ) - ( ( activeHandles * ( m_heigth/2 ) ) - m_heigth ) );
}

View File

@@ -32,12 +32,12 @@ namespace lmms::gui
{
enum{
highpass=1,
lowshelf,
para,
highshelf,
lowpass
enum class EqHandleType {
HighPass=1,
LowShelf,
Para,
HighShelf,
LowPass
};
@@ -64,8 +64,8 @@ public:
float getHighCutCurve( float x );
float getResonance();
int getNum();
int getType();
void setType( int t );
EqHandleType getType();
void setType( EqHandleType t );
void setResonance( float r );
bool isMouseHover();
void setMouseHover( bool d );
@@ -104,7 +104,8 @@ private:
bool m_lp24;
bool m_lp48;
bool m_mouseHover;
int m_type, m_numb;
EqHandleType m_type;
int m_numb;
float m_width, m_heigth;
float m_resonance;
bool m_mousePressed;

View File

@@ -44,7 +44,7 @@ Plugin::Descriptor PLUGIN_EXPORT eq_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "A native eq plugin" ),
"Dave French <contact/dot/dave/dot/french3/at/googlemail/dot/com>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,

View File

@@ -164,35 +164,35 @@ void EqParameterWidget::changeHandle( int i )
switch ( i )
{
case 0 :
m_handleList->at( i )->setType( highpass );
m_handleList->at( i )->setType( EqHandleType::HighPass );
m_handleList->at( i )->setPos( x, m_displayHeigth / 2 );
break;
case 1:
m_handleList->at( i )->setType( lowshelf );
m_handleList->at( i )->setType( EqHandleType::LowShelf );
m_handleList->at( i )->setPos( x, y );
break;
case 2:
m_handleList->at( i )->setType( para );
m_handleList->at( i )->setType( EqHandleType::Para );
m_handleList->at( i )->setPos( x, y );
break;
case 3:
m_handleList->at( i )->setType( para );
m_handleList->at( i )->setType( EqHandleType::Para );
m_handleList->at( i )->setPos( x, y );
break;
case 4:
m_handleList->at( i )->setType( para );
m_handleList->at( i )->setType( EqHandleType::Para );
m_handleList->at( i )->setPos( x, y );
break;
case 5:
m_handleList->at( i )->setType( para );
m_handleList->at( i )->setType( EqHandleType::Para );
m_handleList->at( i )->setPos( x, y );
break;
case 6:
m_handleList->at( i )->setType( highshelf );
m_handleList->at( i )->setType( EqHandleType::HighShelf );
m_handleList->at( i )->setPos( x, y );
break;
case 7:
m_handleList->at( i )->setType( lowpass );
m_handleList->at( i )->setType( EqHandleType::LowPass );
m_handleList->at( i )->setPos( QPointF( x, m_displayHeigth / 2 ) );
break;
}

View File

@@ -42,42 +42,42 @@ FlangerControlsDialog::FlangerControlsDialog( FlangerControls *controls ) :
setPalette( pal );
setFixedSize( 233, 75 );
auto delayKnob = new Knob(knobBright_26, this);
auto delayKnob = new Knob(KnobType::Bright26, this);
delayKnob->move( 10,10 );
delayKnob->setVolumeKnob( false );
delayKnob->setModel( &controls->m_delayTimeModel );
delayKnob->setLabel( tr( "DELAY" ) );
delayKnob->setHintText( tr( "Delay time:" ) + " ", "s" );
auto lfoFreqKnob = new TempoSyncKnob(knobBright_26, this);
auto lfoFreqKnob = new TempoSyncKnob(KnobType::Bright26, this);
lfoFreqKnob->move( 48,10 );
lfoFreqKnob->setVolumeKnob( false );
lfoFreqKnob->setModel( &controls->m_lfoFrequencyModel );
lfoFreqKnob->setLabel( tr( "RATE" ) );
lfoFreqKnob->setHintText( tr( "Period:" ) , " Sec" );
auto lfoAmtKnob = new Knob(knobBright_26, this);
auto lfoAmtKnob = new Knob(KnobType::Bright26, this);
lfoAmtKnob->move( 85,10 );
lfoAmtKnob->setVolumeKnob( false );
lfoAmtKnob->setModel( &controls->m_lfoAmountModel );
lfoAmtKnob->setLabel( tr( "AMNT" ) );
lfoAmtKnob->setHintText( tr( "Amount:" ) , "" );
auto lfoPhaseKnob = new Knob(knobBright_26, this);
auto lfoPhaseKnob = new Knob(KnobType::Bright26, this);
lfoPhaseKnob->move( 123,10 );
lfoPhaseKnob->setVolumeKnob( false );
lfoPhaseKnob->setModel( &controls->m_lfoPhaseModel );
lfoPhaseKnob->setLabel( tr( "PHASE" ) );
lfoPhaseKnob->setHintText( tr( "Phase:" ) , " degrees" );
auto feedbackKnob = new Knob(knobBright_26, this);
auto feedbackKnob = new Knob(KnobType::Bright26, this);
feedbackKnob->move( 160,10 );
feedbackKnob->setVolumeKnob( true) ;
feedbackKnob->setModel( &controls->m_feedbackModel );
feedbackKnob->setLabel( tr( "FDBK" ) );
feedbackKnob->setHintText( tr( "Feedback amount:" ) , "" );
auto whiteNoiseKnob = new Knob(knobBright_26, this);
auto whiteNoiseKnob = new Knob(KnobType::Bright26, this);
whiteNoiseKnob->move( 196,10 );
whiteNoiseKnob->setVolumeKnob( true) ;
whiteNoiseKnob->setModel( &controls->m_whiteNoiseAmountModel );

View File

@@ -45,7 +45,7 @@ Plugin::Descriptor PLUGIN_EXPORT flanger_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "A native flanger plugin" ),
"Dave French <contact/dot/dave/dot/french3/at/googlemail/dot/com>",
0x0100,
Plugin::Effect,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,

View File

@@ -63,7 +63,7 @@ Plugin::Descriptor PLUGIN_EXPORT freeboy_plugin_descriptor =
"Attila Herman <attila589/at/gmail.com>"
"Csaba Hruska <csaba.hruska/at/gmail.com>",
0x0100,
Plugin::Instrument,
Plugin::Type::Instrument,
new PluginPixmapLoader( "logo" ),
nullptr,
} ;
@@ -446,7 +446,7 @@ class FreeBoyKnob : public Knob
{
public:
FreeBoyKnob( QWidget * _parent ) :
Knob( knobStyled, _parent )
Knob( KnobType::Styled, _parent )
{
setFixedSize( 30, 30 );
setCenterPointX( 15.0 );
@@ -677,7 +677,7 @@ FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument,
m_graph = new Graph( this );
m_graph->setGraphStyle( Graph::NearestStyle );
m_graph->setGraphStyle( Graph::Style::Nearest );
m_graph->setGraphColor( QColor(0x4E, 0x83, 0x2B) );
m_graph->move( 37, 199 );
m_graph->resize(208, 47);

View File

@@ -69,7 +69,7 @@ Plugin::Descriptor PLUGIN_EXPORT gigplayer_plugin_descriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "Player for GIG files" ),
"Garrett Wilson <g/at/floft/dot/net>",
0x0100,
Plugin::Instrument,
Plugin::Type::Instrument,
new PluginPixmapLoader( "logo" ),
"gig",
nullptr,
@@ -108,8 +108,8 @@ GigInstrument::GigInstrument( InstrumentTrack * _instrument_track ) :
GigInstrument::~GigInstrument()
{
Engine::audioEngine()->removePlayHandlesOfTypes( instrumentTrack(),
PlayHandle::TypeNotePlayHandle
| PlayHandle::TypeInstrumentPlayHandle );
PlayHandle::Type::NotePlayHandle
| PlayHandle::Type::InstrumentPlayHandle );
freeInstance();
}
@@ -341,16 +341,16 @@ void GigInstrument::play( sampleFrame * _working_buffer )
for( QList<GigNote>::iterator it = m_notes.begin(); it != m_notes.end(); ++it )
{
// Process notes in the KeyUp state, adding release samples if desired
if( it->state == KeyUp )
if( it->state == GigState::KeyUp )
{
// If there are no samples, we're done
if( it->samples.empty() )
{
it->state = Completed;
it->state = GigState::Completed;
}
else
{
it->state = PlayingKeyUp;
it->state = GigState::PlayingKeyUp;
// Notify each sample that the key has been released
for (auto& sample : it->samples)
@@ -366,9 +366,9 @@ void GigInstrument::play( sampleFrame * _working_buffer )
}
}
// Process notes in the KeyDown state, adding samples for the notes
else if( it->state == KeyDown )
else if( it->state == GigState::KeyDown )
{
it->state = PlayingKeyDown;
it->state = GigState::PlayingKeyDown;
addSamples( *it, false );
}
@@ -393,7 +393,7 @@ void GigInstrument::play( sampleFrame * _working_buffer )
}
// Delete ended notes (either in the completed state or all the samples ended)
if( it->state == Completed || it->samples.empty() )
if( it->state == GigState::Completed || it->samples.empty() )
{
it = m_notes.erase( it );
@@ -408,7 +408,7 @@ void GigInstrument::play( sampleFrame * _working_buffer )
for (auto& note : m_notes)
{
// Only process the notes if we're in a playing state
if (!(note.state == PlayingKeyDown || note.state == PlayingKeyUp ))
if (!(note.state == GigState::PlayingKeyDown || note.state == GigState::PlayingKeyUp ))
{
continue;
}
@@ -680,9 +680,9 @@ void GigInstrument::deleteNotePluginData( NotePlayHandle * _n )
for (auto& note : m_notes)
{
// Find the note by matching pointers to the plugin data
if (note.handle == pluginData && (note.state == KeyDown || note.state == PlayingKeyDown))
if (note.handle == pluginData && (note.state == GigState::KeyDown || note.state == GigState::PlayingKeyDown))
{
note.state = KeyUp;
note.state = GigState::KeyUp;
}
}
@@ -906,7 +906,7 @@ class gigKnob : public Knob
{
public:
gigKnob( QWidget * _parent ) :
Knob( knobBright_26, _parent )
Knob( KnobType::Bright26, _parent )
{
setFixedSize( 31, 38 );
}

View File

@@ -187,7 +187,7 @@ public:
// What portion of a note are we in?
enum GigState
enum class GigState
{
// We just pressed the key
KeyDown,
@@ -224,7 +224,7 @@ public:
GigNote( int midiNote, int velocity, float frequency, GIGPluginData * handle )
: midiNote( midiNote ), velocity( velocity ),
release( false ), isRelease( false ), state( KeyDown ),
release( false ), isRelease( false ), state( GigState::KeyDown ),
frequency( frequency ), handle( handle )
{
}
@@ -268,7 +268,7 @@ public:
Flags flags() const override
{
return IsSingleStreamed|IsNotBendable;
return Flag::IsSingleStreamed | Flag::IsNotBendable;
}
gui::PluginView* instantiateView( QWidget * _parent ) override;

View File

@@ -30,7 +30,7 @@ Plugin::Descriptor PLUGIN_EXPORT hydrogenimport_plugin_descriptor =
"Filter for importing Hydrogen files into LMMS" ),
"frank mather",
0x0100,
Plugin::ImportFilter,
Plugin::Type::ImportFilter,
nullptr,
nullptr,
nullptr,
@@ -42,7 +42,7 @@ QString filename;
class NoteKey
{
public:
enum Key {
enum class Key {
C = 0,
Cs,
D,
@@ -59,7 +59,7 @@ public:
static int stringToNoteKey( const QString& str )
{
int m_key = NoteKey::C;
auto m_key = Key::C;
QString sKey = str.left( str.length() - 1 );
@@ -74,54 +74,54 @@ public:
if ( sKey == "C" )
{
m_key = NoteKey::C;
m_key = Key::C;
}
else if ( sKey == "Cs" )
{
m_key = NoteKey::Cs;
m_key = Key::Cs;
}
else if ( sKey == "D" )
{
m_key = NoteKey::D;
m_key = Key::D;
}
else if ( sKey == "Ef" )
{
m_key = NoteKey::Ef;
m_key = Key::Ef;
}
else if ( sKey == "E" )
{
m_key = NoteKey::E;
m_key = Key::E;
}
else if ( sKey == "F" )
{
m_key = NoteKey::F;
m_key = Key::F;
}
else if ( sKey == "Fs" )
{
m_key = NoteKey::Fs;
m_key = Key::Fs;
}
else if ( sKey == "G" )
{
m_key = NoteKey::G;
m_key = Key::G;
}
else if ( sKey == "Af" )
{
m_key = NoteKey::Af;
m_key = Key::Af;
}
else if ( sKey == "A" )
{
m_key = NoteKey::A;
m_key = Key::A;
}
else if ( sKey == "Bf" )
{
m_key = NoteKey::Bf;
m_key = Key::Bf;
}
else if ( sKey == "B" ) {
m_key = NoteKey::B;
m_key = Key::B;
}
// Hydrogen records MIDI notes from C-1 to B5, and exports them as a number ranging from -3 to 3
return m_key + ((nOctave + 3) * 12);
return static_cast<int>(m_key) + ((nOctave + 3) * 12);
}
};
@@ -218,7 +218,7 @@ bool HydrogenImport::readSong()
if ( nLayer == 0 )
{
drum_track[sId] = static_cast<InstrumentTrack*>(
Track::create(Track::InstrumentTrack, Engine::patternStore())
Track::create(Track::Type::Instrument, Engine::patternStore())
);
drum_track[sId]->volumeModel()->setValue( fVolume * 100 );
drum_track[sId]->panningModel()->setValue( ( fPan_R - fPan_L ) * 100 );

Some files were not shown because too many files have changed in this diff Show More