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

@@ -81,7 +81,7 @@ AudioEngine::AudioEngine( bool renderOnly ) :
m_workers(),
m_numWorkers( QThread::idealThreadCount()-1 ),
m_newPlayHandles( PlayHandle::MaxNumber ),
m_qualitySettings( qualitySettings::Mode_Draft ),
m_qualitySettings( qualitySettings::Mode::Draft ),
m_masterGain( 1.0f ),
m_isProcessing( false ),
m_audioDev( nullptr ),
@@ -357,7 +357,7 @@ const surroundSampleFrame * AudioEngine::renderNextBuffer()
if( it != m_playHandles.end() )
{
( *it )->audioPort()->removePlayHandle( ( *it ) );
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
if( ( *it )->type() == PlayHandle::Type::NotePlayHandle )
{
NotePlayHandleManager::release( (NotePlayHandle*) *it );
}
@@ -405,7 +405,7 @@ const surroundSampleFrame * AudioEngine::renderNextBuffer()
if( ( *it )->isFinished() )
{
( *it )->audioPort()->removePlayHandle( ( *it ) );
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
if( ( *it )->type() == PlayHandle::Type::NotePlayHandle )
{
NotePlayHandleManager::release( (NotePlayHandle*) *it );
}
@@ -464,12 +464,12 @@ void AudioEngine::handleMetronome()
static tick_t lastMetroTicks = -1;
Song * song = Engine::getSong();
Song::PlayModes currentPlayMode = song->playMode();
Song::PlayMode currentPlayMode = song->playMode();
bool metronomeSupported =
currentPlayMode == Song::Mode_PlayMidiClip
|| currentPlayMode == Song::Mode_PlaySong
|| currentPlayMode == Song::Mode_PlayPattern;
currentPlayMode == Song::PlayMode::MidiClip
|| currentPlayMode == Song::PlayMode::Song
|| currentPlayMode == Song::PlayMode::Pattern;
if (!metronomeSupported || !m_metronomeActive || song->isExporting())
{
@@ -534,7 +534,7 @@ void AudioEngine::clearInternal()
// TODO: m_midiClient->noteOffAll();
for (auto ph : m_playHandles)
{
if (ph->type() != PlayHandle::TypeInstrumentPlayHandle)
if (ph->type() != PlayHandle::Type::InstrumentPlayHandle)
{
m_playHandlesToRemove.push_back(ph);
}
@@ -681,7 +681,7 @@ bool AudioEngine::addPlayHandle( PlayHandle* handle )
return true;
}
if( handle->type() == PlayHandle::TypeNotePlayHandle )
if( handle->type() == PlayHandle::Type::NotePlayHandle )
{
NotePlayHandleManager::release( (NotePlayHandle*)handle );
}
@@ -732,7 +732,7 @@ void AudioEngine::removePlayHandle(PlayHandle * ph)
// (See tobydox's 2008 commit 4583e48)
if ( removedFromList )
{
if (ph->type() == PlayHandle::TypeNotePlayHandle)
if (ph->type() == PlayHandle::Type::NotePlayHandle)
{
NotePlayHandleManager::release(dynamic_cast<NotePlayHandle*>(ph));
}
@@ -749,7 +749,7 @@ void AudioEngine::removePlayHandle(PlayHandle * ph)
void AudioEngine::removePlayHandlesOfTypes(Track * track, const quint8 types)
void AudioEngine::removePlayHandlesOfTypes(Track * track, PlayHandle::Types types)
{
requestChangeInModel();
PlayHandleList::Iterator it = m_playHandles.begin();
@@ -758,7 +758,7 @@ void AudioEngine::removePlayHandlesOfTypes(Track * track, const quint8 types)
if ((*it)->isFromTrack(track) && ((*it)->type() & types))
{
( *it )->audioPort()->removePlayHandle( ( *it ) );
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
if( ( *it )->type() == PlayHandle::Type::NotePlayHandle )
{
NotePlayHandleManager::release( (NotePlayHandle*) *it );
}

View File

@@ -91,7 +91,7 @@ void AudioEngineWorkerThread::JobQueue::run()
}
}
// always exit loop if we're not in dynamic mode
processedJob = processedJob && ( m_opMode == Dynamic );
processedJob = processedJob && ( m_opMode == OperationMode::Dynamic );
}
}

View File

@@ -44,7 +44,7 @@ AutomatableModel::AutomatableModel(
const float val, const float min, const float max, const float step,
Model* parent, const QString & displayName, bool defaultConstructed ) :
Model( parent, displayName, defaultConstructed ),
m_scaleType( Linear ),
m_scaleType( ScaleType::Linear ),
m_minValue( min ),
m_maxValue( max ),
m_step( step ),
@@ -105,7 +105,7 @@ void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, co
{
bool mustQuote = mustQuoteName(name);
if( isAutomated() || m_scaleType != Linear )
if( isAutomated() || m_scaleType != ScaleType::Linear )
{
// automation needs tuple of data (name, id, value)
// scale type also needs an extra value
@@ -114,7 +114,7 @@ void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, co
QDomElement me = doc.createElement( mustQuote ? QString("automatablemodel") : name );
me.setAttribute( "id", ProjectJournal::idToSave( id() ) );
me.setAttribute( "value", m_value );
me.setAttribute( "scale_type", m_scaleType == Logarithmic ? "log" : "linear" );
me.setAttribute( "scale_type", m_scaleType == ScaleType::Logarithmic ? "log" : "linear" );
if(mustQuote) {
me.setAttribute( "nodename", name );
}
@@ -140,11 +140,11 @@ void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, co
// the discardMIDIConnections option is true.
auto controllerType = m_controllerConnection
? m_controllerConnection->getController()->type()
: Controller::DummyController;
: Controller::ControllerType::Dummy;
bool skipMidiController = Engine::getSong()->isSavingProject()
&& Engine::getSong()->getSaveOptions().discardMIDIConnections.value();
if (m_controllerConnection && controllerType != Controller::DummyController
&& !(skipMidiController && controllerType == Controller::MidiController))
if (m_controllerConnection && controllerType != Controller::ControllerType::Dummy
&& !(skipMidiController && controllerType == Controller::ControllerType::Midi))
{
QDomElement controllerElement;
@@ -264,18 +264,18 @@ void AutomatableModel::loadSettings( const QDomElement& element, const QString&
{
if( nodeElement.attribute( "scale_type" ) == "linear" )
{
setScaleType( Linear );
setScaleType( ScaleType::Linear );
}
else if( nodeElement.attribute( "scale_type" ) == "log" )
{
setScaleType( Logarithmic );
setScaleType( ScaleType::Logarithmic );
}
}
}
else
{
setScaleType( Linear );
setScaleType( ScaleType::Linear );
if( element.hasAttribute( name ) )
// attribute => read the element's value from the attribute list
@@ -335,7 +335,7 @@ template<class T> T AutomatableModel::logToLinearScale( T value ) const
float AutomatableModel::scaledValue( float value ) const
{
return m_scaleType == Linear
return m_scaleType == ScaleType::Linear
? value
: logToLinearScale<float>( ( value - minValue<float>() ) / m_range );
}
@@ -343,7 +343,7 @@ float AutomatableModel::scaledValue( float value ) const
float AutomatableModel::inverseScaledValue( float value ) const
{
return m_scaleType == Linear
return m_scaleType == ScaleType::Linear
? value
: lmms::linearToLogScale( minValue<float>(), maxValue<float>(), value );
}
@@ -571,10 +571,10 @@ float AutomatableModel::controllerValue( int frameOffset ) const
float v = 0;
switch(m_scaleType)
{
case Linear:
case ScaleType::Linear:
v = minValue<float>() + ( range() * controllerConnection()->currentValue( frameOffset ) );
break;
case Logarithmic:
case ScaleType::Logarithmic:
v = logToLinearScale(
controllerConnection()->currentValue( frameOffset ));
break;
@@ -623,13 +623,13 @@ ValueBuffer * AutomatableModel::valueBuffer()
float * nvalues = m_valueBuffer.values();
switch( m_scaleType )
{
case Linear:
case ScaleType::Linear:
for( int i = 0; i < m_valueBuffer.length(); i++ )
{
nvalues[i] = minValue<float>() + ( range() * values[i] );
}
break;
case Logarithmic:
case ScaleType::Logarithmic:
for( int i = 0; i < m_valueBuffer.length(); i++ )
{
nvalues[i] = logToLinearScale( values[i] );

View File

@@ -53,7 +53,7 @@ AutomationClip::AutomationClip( AutomationTrack * _auto_track ) :
m_autoTrack( _auto_track ),
m_objects(),
m_tension( 1.0 ),
m_progressionType( DiscreteProgression ),
m_progressionType( ProgressionType::Discrete ),
m_dragging( false ),
m_isRecording( false ),
m_lastRecordedValue( 0 )
@@ -63,11 +63,11 @@ AutomationClip::AutomationClip( AutomationTrack * _auto_track ) :
{
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::PatternContainer:
case TrackContainer::Type::Pattern:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
case TrackContainer::Type::Song:
// move down
default:
setAutoResize( false );
@@ -104,11 +104,11 @@ AutomationClip::AutomationClip( const AutomationClip & _clip_to_copy ) :
if (!getTrack()){ return; }
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::PatternContainer:
case TrackContainer::Type::Pattern:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
case TrackContainer::Type::Song:
// move down
default:
setAutoResize( false );
@@ -147,13 +147,13 @@ bool AutomationClip::addObject( AutomatableModel * _obj, bool _search_dup )
void AutomationClip::setProgressionType(
ProgressionTypes _new_progression_type )
ProgressionType _new_progression_type )
{
QMutexLocker m(&m_clipMutex);
if ( _new_progression_type == DiscreteProgression ||
_new_progression_type == LinearProgression ||
_new_progression_type == CubicHermiteProgression )
if ( _new_progression_type == ProgressionType::Discrete ||
_new_progression_type == ProgressionType::Linear ||
_new_progression_type == ProgressionType::CubicHermite )
{
m_progressionType = _new_progression_type;
emit dataChanged();
@@ -560,11 +560,11 @@ float AutomationClip::valueAt( timeMap::const_iterator v, int offset ) const
// value if we do
if (offset == 0) { return INVAL(v); }
if (m_progressionType == DiscreteProgression)
if (m_progressionType == ProgressionType::Discrete)
{
return OUTVAL(v);
}
else if( m_progressionType == LinearProgression )
else if( m_progressionType == ProgressionType::Linear )
{
float slope =
(INVAL(v + 1) - OUTVAL(v))
@@ -572,7 +572,7 @@ float AutomationClip::valueAt( timeMap::const_iterator v, int offset ) const
return OUTVAL(v) + offset * slope;
}
else /* CubicHermiteProgression */
else /* ProgressionType::CubicHermite */
{
// Implements a Cubic Hermite spline as explained at:
// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Unit_interval_.280.2C_1.29
@@ -767,7 +767,7 @@ void AutomationClip::saveSettings( QDomDocument & _doc, QDomElement & _this )
_this.setAttribute( "pos", startPosition() );
_this.setAttribute( "len", length() );
_this.setAttribute( "name", name() );
_this.setAttribute( "prog", QString::number( progressionType() ) );
_this.setAttribute( "prog", QString::number( static_cast<int>(progressionType()) ) );
_this.setAttribute( "tens", QString::number( getTension() ) );
_this.setAttribute( "mute", QString::number( isMuted() ) );
@@ -808,7 +808,7 @@ void AutomationClip::loadSettings( const QDomElement & _this )
movePosition( _this.attribute( "pos" ).toInt() );
setName( _this.attribute( "name" ) );
setProgressionType( static_cast<ProgressionTypes>( _this.attribute(
setProgressionType( static_cast<ProgressionType>( _this.attribute(
"prog" ).toInt() ) );
setTension( _this.attribute( "tens" ) );
setMuted(_this.attribute( "mute", QString::number( false ) ).toInt() );
@@ -891,7 +891,7 @@ bool AutomationClip::isAutomated( const AutomatableModel * _m )
auto l = combineAllTracks();
for (const auto track : l)
{
if (track->type() == Track::AutomationTrack || track->type() == Track::HiddenAutomationTrack)
if (track->type() == Track::Type::Automation || track->type() == Track::Type::HiddenAutomation)
{
for (const auto& clip : track->getClips())
{
@@ -926,7 +926,7 @@ std::vector<AutomationClip *> AutomationClip::clipsForModel(const AutomatableMod
for (const auto track : l)
{
// we want only automation tracks...
if (track->type() == Track::AutomationTrack || track->type() == Track::HiddenAutomationTrack )
if (track->type() == Track::Type::Automation || track->type() == Track::Type::HiddenAutomation )
{
// go through all the clips...
for (const auto& trackClip : track->getClips())
@@ -985,7 +985,7 @@ void AutomationClip::resolveAllIDs()
auto l = combineAllTracks();
for (const auto& track : l)
{
if (track->type() == Track::AutomationTrack || track->type() == Track::HiddenAutomationTrack)
if (track->type() == Track::Type::Automation || track->type() == Track::Type::HiddenAutomation)
{
for (const auto& clip : track->getClips())
{

View File

@@ -30,7 +30,7 @@
namespace lmms
{
std::array<WaveMipMap, BandLimitedWave::Waveforms::NumBLWaveforms> BandLimitedWave::s_waveforms = { };
std::array<WaveMipMap, BandLimitedWave::NumWaveforms> BandLimitedWave::s_waveforms = { };
bool BandLimitedWave::s_wavesGenerated = false;
QString BandLimitedWave::s_wavetableDir = "";
@@ -84,7 +84,7 @@ void BandLimitedWave::generateWaves()
{
saw_file.open( QIODevice::ReadOnly );
QDataStream in( &saw_file );
in >> s_waveforms[ BandLimitedWave::BLSaw ];
in >> s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSaw)];
saw_file.close();
}
else
@@ -108,14 +108,14 @@ void BandLimitedWave::generateWaves()
s += amp * /*a2 **/sin( static_cast<double>( ph * harm ) / static_cast<double>( len ) * F_2PI );
harm++;
} while( hlen > 2.0 );
s_waveforms[ BandLimitedWave::BLSaw ].setSampleAt( i, ph, s );
s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSaw)].setSampleAt( i, ph, s );
max = std::max(max, std::abs(s));
}
// normalize
for( int ph = 0; ph < len; ph++ )
{
sample_t s = s_waveforms[ BandLimitedWave::BLSaw ].sampleAt( i, ph ) / max;
s_waveforms[ BandLimitedWave::BLSaw ].setSampleAt( i, ph, s );
sample_t s = s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSaw)].sampleAt( i, ph ) / max;
s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSaw)].setSampleAt( i, ph, s );
}
}
}
@@ -126,7 +126,7 @@ void BandLimitedWave::generateWaves()
{
sqr_file.open( QIODevice::ReadOnly );
QDataStream in( &sqr_file );
in >> s_waveforms[ BandLimitedWave::BLSquare ];
in >> s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSquare)];
sqr_file.close();
}
else
@@ -150,14 +150,14 @@ void BandLimitedWave::generateWaves()
s += amp * /*a2 **/ sin( static_cast<double>( ph * harm ) / static_cast<double>( len ) * F_2PI );
harm += 2;
} while( hlen > 2.0 );
s_waveforms[ BandLimitedWave::BLSquare ].setSampleAt( i, ph, s );
s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSquare)].setSampleAt( i, ph, s );
max = std::max(max, std::abs(s));
}
// normalize
for( int ph = 0; ph < len; ph++ )
{
sample_t s = s_waveforms[ BandLimitedWave::BLSquare ].sampleAt( i, ph ) / max;
s_waveforms[ BandLimitedWave::BLSquare ].setSampleAt( i, ph, s );
sample_t s = s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSquare)].sampleAt( i, ph ) / max;
s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSquare)].setSampleAt( i, ph, s );
}
}
}
@@ -167,7 +167,7 @@ void BandLimitedWave::generateWaves()
{
tri_file.open( QIODevice::ReadOnly );
QDataStream in( &tri_file );
in >> s_waveforms[ BandLimitedWave::BLTriangle ];
in >> s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLTriangle)];
tri_file.close();
}
else
@@ -192,14 +192,14 @@ void BandLimitedWave::generateWaves()
( ( harm + 1 ) % 4 == 0 ? 0.5 : 0.0 ) ) * F_2PI );
harm += 2;
} while( hlen > 2.0 );
s_waveforms[ BandLimitedWave::BLTriangle ].setSampleAt( i, ph, s );
s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLTriangle)].setSampleAt( i, ph, s );
max = std::max(max, std::abs(s));
}
// normalize
for( int ph = 0; ph < len; ph++ )
{
sample_t s = s_waveforms[ BandLimitedWave::BLTriangle ].sampleAt( i, ph ) / max;
s_waveforms[ BandLimitedWave::BLTriangle ].setSampleAt( i, ph, s );
sample_t s = s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLTriangle)].sampleAt( i, ph ) / max;
s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLTriangle)].setSampleAt( i, ph, s );
}
}
}
@@ -210,7 +210,7 @@ void BandLimitedWave::generateWaves()
{
moog_file.open( QIODevice::ReadOnly );
QDataStream in( &moog_file );
in >> s_waveforms[ BandLimitedWave::BLMoog ];
in >> s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLMoog)];
moog_file.close();
}
else
@@ -222,9 +222,9 @@ void BandLimitedWave::generateWaves()
for( int ph = 0; ph < len; ph++ )
{
const int sawph = ( ph + static_cast<int>( len * 0.75 ) ) % len;
const sample_t saw = s_waveforms[ BandLimitedWave::BLSaw ].sampleAt( i, sawph );
const sample_t tri = s_waveforms[ BandLimitedWave::BLTriangle ].sampleAt( i, ph );
s_waveforms[ BandLimitedWave::BLMoog ].setSampleAt( i, ph, ( saw + tri ) * 0.5f );
const sample_t saw = s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSaw)].sampleAt( i, sawph );
const sample_t tri = s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLTriangle)].sampleAt( i, ph );
s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLMoog)].setSampleAt( i, ph, ( saw + tri ) * 0.5f );
}
}
}
@@ -252,22 +252,22 @@ QFile moogfile( "path-to-wavetables/moog.bin" );
sawfile.open( QIODevice::WriteOnly );
QDataStream sawout( &sawfile );
sawout << s_waveforms[ BandLimitedWave::BLSaw ];
sawout << s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSaw)];
sawfile.close();
sqrfile.open( QIODevice::WriteOnly );
QDataStream sqrout( &sqrfile );
sqrout << s_waveforms[ BandLimitedWave::BLSquare ];
sqrout << s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLSquare)];
sqrfile.close();
trifile.open( QIODevice::WriteOnly );
QDataStream triout( &trifile );
triout << s_waveforms[ BandLimitedWave::BLTriangle ];
triout << s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLTriangle)];
trifile.close();
moogfile.open( QIODevice::WriteOnly );
QDataStream moogout( &moogfile );
moogout << s_waveforms[ BandLimitedWave::BLMoog ];
moogout << s_waveforms[static_cast<std::size_t>(BandLimitedWave::Waveform::BLMoog)];
moogfile.close();
*/

View File

@@ -173,7 +173,7 @@ void ConfigManager::upgrade()
ProjectVersion createdWith = m_version;
// Don't use old themes as they break the UI (i.e. 0.4 != 1.0, etc)
if (createdWith.setCompareType(ProjectVersion::Minor) != LMMS_VERSION)
if (createdWith.setCompareType(ProjectVersion::CompareType::Minor) != LMMS_VERSION)
{
m_themeDir = defaultThemeDir();
}
@@ -707,7 +707,7 @@ unsigned int ConfigManager::legacyConfigVersion()
{
ProjectVersion createdWith = m_version;
createdWith.setCompareType(ProjectVersion::Build);
createdWith.setCompareType(ProjectVersion::CompareType::Build);
if( createdWith < "1.1.90" )
{

View File

@@ -44,7 +44,7 @@ std::vector<Controller*> Controller::s_controllers;
Controller::Controller( ControllerTypes _type, Model * _parent,
Controller::Controller( ControllerType _type, Model * _parent,
const QString & _display_name ) :
Model( _parent, _display_name ),
JournallingObject(),
@@ -53,7 +53,7 @@ Controller::Controller( ControllerTypes _type, Model * _parent,
m_connectionCount( 0 ),
m_type( _type )
{
if( _type != DummyController && _type != MidiController )
if( _type != ControllerType::Dummy && _type != ControllerType::Midi )
{
s_controllers.push_back(this);
// Determine which name to use
@@ -182,30 +182,30 @@ void Controller::resetFrameCounter()
Controller * Controller::create( ControllerTypes _ct, Model * _parent )
Controller * Controller::create( ControllerType _ct, Model * _parent )
{
static Controller * dummy = nullptr;
Controller * c = nullptr;
switch( _ct )
{
case Controller::DummyController:
case ControllerType::Dummy:
if (!dummy)
dummy = new Controller( DummyController, nullptr,
dummy = new Controller( ControllerType::Dummy, nullptr,
QString() );
c = dummy;
break;
case Controller::LfoController:
case ControllerType::Lfo:
c = new class LfoController( _parent );
break;
case Controller::PeakController:
case ControllerType::Peak:
//Already instantiated in EffectChain::loadSettings()
Q_ASSERT( false );
break;
case Controller::MidiController:
case ControllerType::Midi:
c = new class MidiController( _parent );
break;
@@ -221,14 +221,14 @@ Controller * Controller::create( ControllerTypes _ct, Model * _parent )
Controller * Controller::create( const QDomElement & _this, Model * _parent )
{
Controller * c;
if( _this.attribute( "type" ).toInt() == Controller::PeakController )
if( static_cast<ControllerType>(_this.attribute( "type" ).toInt()) == ControllerType::Peak )
{
c = PeakController::getControllerBySetting( _this );
}
else
{
c = create(
static_cast<ControllerTypes>( _this.attribute( "type" ).toInt() ),
static_cast<ControllerType>( _this.attribute( "type" ).toInt() ),
_parent );
}
@@ -269,7 +269,7 @@ bool Controller::hasModel( const Model * m ) const
void Controller::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
_this.setAttribute( "type", type() );
_this.setAttribute( "type", static_cast<int>(type()) );
_this.setAttribute( "name", name() );
}
@@ -277,7 +277,7 @@ void Controller::saveSettings( QDomDocument & _doc, QDomElement & _this )
void Controller::loadSettings( const QDomElement & _this )
{
if( _this.attribute( "type" ).toInt() != type() )
if( static_cast<ControllerType>(_this.attribute( "type" ).toInt()) != type() )
{
qWarning( "controller-type does not match controller-type of "
"settings-node!\n" );

View File

@@ -50,7 +50,7 @@ ControllerConnection::ControllerConnection(Controller * _controller) :
}
else
{
m_controller = Controller::create( Controller::DummyController,
m_controller = Controller::create( Controller::ControllerType::Dummy,
nullptr );
}
s_connections.push_back(this);
@@ -60,7 +60,7 @@ ControllerConnection::ControllerConnection(Controller * _controller) :
ControllerConnection::ControllerConnection( int _controllerId ) :
m_controller( Controller::create( Controller::DummyController, nullptr ) ),
m_controller( Controller::create( Controller::ControllerType::Dummy, nullptr ) ),
m_controllerId( _controllerId ),
m_ownsController( false )
{
@@ -72,7 +72,7 @@ ControllerConnection::ControllerConnection( int _controllerId ) :
ControllerConnection::~ControllerConnection()
{
if( m_controller && m_controller->type() != Controller::DummyController )
if( m_controller && m_controller->type() != Controller::ControllerType::Dummy )
{
m_controller->removeConnection( this );
}
@@ -104,14 +104,14 @@ void ControllerConnection::setController( Controller * _controller )
m_controller = nullptr;
}
if( m_controller && m_controller->type() != Controller::DummyController )
if( m_controller && m_controller->type() != Controller::ControllerType::Dummy )
{
m_controller->removeConnection( this );
}
if( !_controller )
{
m_controller = Controller::create( Controller::DummyController, nullptr );
m_controller = Controller::create( Controller::ControllerType::Dummy, nullptr );
}
else
{
@@ -119,7 +119,7 @@ void ControllerConnection::setController( Controller * _controller )
}
m_controllerId = -1;
if( _controller->type() != Controller::DummyController )
if( _controller->type() != Controller::ControllerType::Dummy )
{
_controller->addConnection( this );
QObject::connect( _controller, SIGNAL(valueChanged()),
@@ -127,7 +127,7 @@ void ControllerConnection::setController( Controller * _controller )
}
m_ownsController =
(_controller->type() == Controller::MidiController);
(_controller->type() == Controller::ControllerType::Midi);
// If we don't own the controller, allow deletion of controller
// to delete the connection
@@ -168,7 +168,7 @@ void ControllerConnection::finalizeConnections()
c->setController( Engine::getSong()->
controllers().at( c->m_controllerId ) );
}
else if (c->getController()->type() == Controller::DummyController)
else if (c->getController()->type() == Controller::ControllerType::Dummy)
{
delete c;
--i;
@@ -228,7 +228,7 @@ void ControllerConnection::loadSettings( const QDomElement & _this )
}
else
{
m_controller = Controller::create( Controller::DummyController, nullptr );
m_controller = Controller::create( Controller::ControllerType::Dummy, nullptr );
}
}
}

View File

@@ -26,6 +26,7 @@
#include "DataFile.h"
#include <algorithm>
#include <cmath>
#include <map>
@@ -98,17 +99,16 @@ namespace
QString m_name;
};
const auto s_types = std::array<TypeDescStruct, DataFile::TypeCount>
{
TypeDescStruct{ DataFile::UnknownType, "unknown" },
TypeDescStruct{ DataFile::SongProject, "song" },
TypeDescStruct{ DataFile::SongProjectTemplate, "songtemplate" },
TypeDescStruct{ DataFile::InstrumentTrackSettings, "instrumenttracksettings" },
TypeDescStruct{ DataFile::DragNDropData, "dnddata" },
TypeDescStruct{ DataFile::ClipboardData, "clipboard-data" },
TypeDescStruct{ DataFile::JournalData, "journaldata" },
TypeDescStruct{ DataFile::EffectSettings, "effectsettings" },
TypeDescStruct{ DataFile::MidiClip, "midiclip" }
const auto s_types = std::array{
TypeDescStruct{ DataFile::Type::Unknown, "unknown" },
TypeDescStruct{ DataFile::Type::SongProject, "song" },
TypeDescStruct{ DataFile::Type::SongProjectTemplate, "songtemplate" },
TypeDescStruct{ DataFile::Type::InstrumentTrackSettings, "instrumenttracksettings" },
TypeDescStruct{ DataFile::Type::DragNDropData, "dnddata" },
TypeDescStruct{ DataFile::Type::ClipboardData, "clipboard-data" },
TypeDescStruct{ DataFile::Type::JournalData, "journaldata" },
TypeDescStruct{ DataFile::Type::EffectSettings, "effectsettings" },
TypeDescStruct{ DataFile::Type::MidiClip, "midiclip" }
};
}
@@ -214,7 +214,7 @@ bool DataFile::validate( QString extension )
return true;
}
break;
case Type::UnknownType:
case Type::Unknown:
if (! ( extension == "mmp" || extension == "mpt" || extension == "mmpz" ||
extension == "xpf" || extension == "xml" ||
( extension == "xiz" && ! getPluginFactory()->pluginSupportingExtension(extension).isNull()) ||
@@ -251,7 +251,7 @@ QString DataFile::nameWithExtension( const QString & _fn ) const
switch( type() )
{
case SongProject:
case Type::SongProject:
if( extension != "mmp" &&
extension != "mpt" &&
extension != "mmpz" )
@@ -264,13 +264,13 @@ QString DataFile::nameWithExtension( const QString & _fn ) const
return _fn + ".mmp";
}
break;
case SongProjectTemplate:
case Type::SongProjectTemplate:
if( extension != "mpt" )
{
return _fn + ".mpt";
}
break;
case InstrumentTrackSettings:
case Type::InstrumentTrackSettings:
if( extension != "xpf" )
{
return _fn + ".xpf";
@@ -286,8 +286,8 @@ QString DataFile::nameWithExtension( const QString & _fn ) const
void DataFile::write( QTextStream & _strm )
{
if( type() == SongProject || type() == SongProjectTemplate
|| type() == InstrumentTrackSettings )
if( type() == Type::SongProject || type() == Type::SongProjectTemplate
|| type() == Type::InstrumentTrackSettings )
{
cleanMetaNodes( documentElement() );
}
@@ -585,21 +585,17 @@ bool DataFile::hasLocalPlugins(QDomElement parent /* = QDomElement()*/, bool fir
DataFile::Type DataFile::type( const QString& typeName )
{
for( int i = 0; i < TypeCount; ++i )
{
if( s_types[i].m_name == typeName )
{
return static_cast<DataFile::Type>( i );
}
}
const auto it = std::find_if(s_types.begin(), s_types.end(),
[&typeName](const TypeDescStruct& type) { return type.m_name == typeName; });
if (it != s_types.end()) { return it->m_type; }
// compat code
if( typeName == "channelsettings" )
{
return DataFile::InstrumentTrackSettings;
return Type::InstrumentTrackSettings;
}
return UnknownType;
return Type::Unknown;
}
@@ -607,12 +603,7 @@ DataFile::Type DataFile::type( const QString& typeName )
QString DataFile::typeName( Type type )
{
if( type >= UnknownType && type < TypeCount )
{
return s_types[type].m_name;
}
return s_types[UnknownType].m_name;
return s_types[static_cast<std::size_t>(type)].m_name;
}
@@ -1760,8 +1751,8 @@ void DataFile::upgrade_bbTcoRename()
for (int i = 0; !elements.item(i).isNull(); ++i)
{
auto e = elements.item(i).toElement();
static_assert(Track::PatternTrack == 1, "Must be type=1 for backwards compatibility");
if (e.attribute("type").toInt() == Track::PatternTrack)
static_assert(Track::Type::Pattern == static_cast<Track::Type>(1), "Must be type=1 for backwards compatibility");
if (static_cast<Track::Type>(e.attribute("type").toInt()) == Track::Type::Pattern)
{
e.setAttribute("name", e.attribute("name").replace("Beat/Bassline", "Pattern"));
}
@@ -1789,7 +1780,7 @@ void DataFile::upgrade()
documentElement().setAttribute( "creator", "LMMS" );
documentElement().setAttribute( "creatorversion", LMMS_VERSION );
if( type() == SongProject || type() == SongProjectTemplate )
if( type() == Type::SongProject || type() == Type::SongProjectTemplate )
{
// Time-signature
if ( !m_head.hasAttribute( "timesig_numerator" ) )
@@ -1867,8 +1858,8 @@ void DataFile::loadData( const QByteArray & _data, const QString & _sourceFile )
ProjectVersion createdWith = root.attribute("creatorversion");
ProjectVersion openedWith = LMMS_VERSION;
if (createdWith.setCompareType(ProjectVersion::Minor)
!= openedWith.setCompareType(ProjectVersion::Minor)
if (createdWith.setCompareType(ProjectVersion::CompareType::Minor)
!= openedWith.setCompareType(ProjectVersion::CompareType::Minor)
&& gui::getGUI() != nullptr && root.attribute("type") == "song"
){
auto projectType = _sourceFile.endsWith(".mpt") ?

View File

@@ -113,7 +113,7 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters(
SECS_PER_LFO_OSCILLATION * 1000.0, this,
tr( "LFO frequency" ) ),
m_lfoAmountModel( 0.0, -1.0, 1.0, 0.005, this, tr( "LFO mod amount" ) ),
m_lfoWaveModel( SineWave, 0, NumLfoShapes, this, tr( "LFO wave shape" ) ),
m_lfoWaveModel( static_cast<int>(LfoShape::SineWave), 0, NumLfoShapes, this, tr( "LFO wave shape" ) ),
m_x100Model( false, this, tr( "LFO frequency x 100" ) ),
m_controlEnvAmountModel( false, this, tr( "Modulate env amount" ) ),
m_lfoFrame( 0 ),
@@ -209,28 +209,28 @@ inline sample_t EnvelopeAndLfoParameters::lfoShapeSample( fpp_t _frame_offset )
const float phase = frame / static_cast<float>(
m_lfoOscillationFrames );
sample_t shape_sample;
switch( m_lfoWaveModel.value() )
switch( static_cast<LfoShape>(m_lfoWaveModel.value()) )
{
case TriangleWave:
case LfoShape::TriangleWave:
shape_sample = Oscillator::triangleSample( phase );
break;
case SquareWave:
case LfoShape::SquareWave:
shape_sample = Oscillator::squareSample( phase );
break;
case SawWave:
case LfoShape::SawWave:
shape_sample = Oscillator::sawSample( phase );
break;
case UserDefinedWave:
case LfoShape::UserDefinedWave:
shape_sample = m_userWave.userWaveSample( phase );
break;
case RandomWave:
case LfoShape::RandomWave:
if( frame == 0 )
{
m_random = Oscillator::noiseSample( 0.0f );
}
shape_sample = m_random;
break;
case SineWave:
case LfoShape::SineWave:
default:
shape_sample = Oscillator::sinSample( phase );
break;

View File

@@ -61,7 +61,7 @@ void ImportFilter::import( const QString & _file_to_import,
const bool j = Engine::projectJournal()->isJournalling();
Engine::projectJournal()->setJournalling( false );
for (const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::ImportFilter))
for (const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::Type::ImportFilter))
{
unique_ptr<Plugin> p(Plugin::instantiate( desc->name, nullptr, s.data() ));
if( dynamic_cast<ImportFilter *>( p.get() ) != nullptr &&

View File

@@ -234,7 +234,7 @@ void InstrumentFunctionNoteStacking::processNote( NotePlayHandle * _n )
// at the same time we only add sub-notes if nothing of the note was
// played yet, because otherwise we would add chord-subnotes every
// time an audio-buffer is rendered...
if( ( _n->origin() == NotePlayHandle::OriginArpeggio || ( _n->hasParent() == false && _n->instrumentTrack()->isArpeggioEnabled() == false ) ) &&
if( ( _n->origin() == NotePlayHandle::Origin::Arpeggio || ( _n->hasParent() == false && _n->instrumentTrack()->isArpeggioEnabled() == false ) ) &&
_n->totalFramesPlayed() == 0 &&
m_chordsEnabledModel.value() == true && ! _n->isReleased() )
{
@@ -263,7 +263,7 @@ void InstrumentFunctionNoteStacking::processNote( NotePlayHandle * _n )
// different
Engine::audioEngine()->addPlayHandle(
NotePlayHandleManager::acquire( _n->instrumentTrack(), _n->offset(), _n->frames(), note_copy,
_n, -1, NotePlayHandle::OriginNoteStacking )
_n, -1, NotePlayHandle::Origin::NoteStacking )
);
}
}
@@ -321,7 +321,7 @@ InstrumentFunctionArpeggio::InstrumentFunctionArpeggio( Model * _parent ) :
m_arpDirectionModel.addItem( tr( "Up and down" ), std::make_unique<PixmapLoader>( "arp_up_and_down" ) );
m_arpDirectionModel.addItem( tr( "Down and up" ), std::make_unique<PixmapLoader>( "arp_up_and_down" ) );
m_arpDirectionModel.addItem( tr( "Random" ), std::make_unique<PixmapLoader>( "arp_random" ) );
m_arpDirectionModel.setInitValue( ArpDirUp );
m_arpDirectionModel.setInitValue( static_cast<float>(ArpDirection::Up) );
m_arpModeModel.addItem( tr( "Free" ), std::make_unique<PixmapLoader>( "arp_free" ) );
m_arpModeModel.addItem( tr( "Sort" ), std::make_unique<PixmapLoader>( "arp_sort" ) );
@@ -336,8 +336,8 @@ InstrumentFunctionArpeggio::InstrumentFunctionArpeggio( Model * _parent ) :
void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
{
const int base_note_key = _n->key();
if( _n->origin() == NotePlayHandle::OriginArpeggio ||
_n->origin() == NotePlayHandle::OriginNoteStacking ||
if( _n->origin() == NotePlayHandle::Origin::Arpeggio ||
_n->origin() == NotePlayHandle::Origin::NoteStacking ||
!m_arpEnabledModel.value() ||
_n->isReleased() )
{
@@ -351,7 +351,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
ConstNotePlayHandleList cnphv = NotePlayHandle::nphsOfInstrumentTrack( _n->instrumentTrack() );
if( m_arpModeModel.value() != FreeMode && cnphv.size() == 0 )
if( static_cast<ArpMode>(m_arpModeModel.value()) != ArpMode::Free && cnphv.size() == 0 )
{
// maybe we're playing only a preset-preview-note?
cnphv = PresetPreviewPlayHandle::nphsOfInstrumentTrack( _n->instrumentTrack() );
@@ -375,11 +375,11 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
// used for calculating remaining frames for arp-note, we have to add
// arp_frames-1, otherwise the first arp-note will not be setup
// correctly... -> arp_frames frames silence at the start of every note!
int cur_frame = ( ( m_arpModeModel.value() != FreeMode ) ?
int cur_frame = ( ( static_cast<ArpMode>(m_arpModeModel.value()) != ArpMode::Free ) ?
cnphv.first()->totalFramesPlayed() :
_n->totalFramesPlayed() ) + arp_frames - 1;
// used for loop
f_cnt_t frames_processed = ( m_arpModeModel.value() != FreeMode ) ? cnphv.first()->noteOffset() : _n->noteOffset();
f_cnt_t frames_processed = ( static_cast<ArpMode>(m_arpModeModel.value()) != ArpMode::Free ) ? cnphv.first()->noteOffset() : _n->noteOffset();
while( frames_processed < Engine::audioEngine()->framesPerPeriod() )
{
@@ -397,7 +397,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
// in sorted mode: is it our turn or do we have to be quiet for
// now?
if( m_arpModeModel.value() == SortMode &&
if( static_cast<ArpMode>(m_arpModeModel.value()) == ArpMode::Sort &&
( ( cur_frame / arp_frames ) % total_range ) / range != (f_cnt_t) _n->index() )
{
// update counters
@@ -418,7 +418,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
}
}
int dir = m_arpDirectionModel.value();
auto dir = static_cast<ArpDirection>(m_arpDirectionModel.value());
// Miss notes randomly. We intercept int dir and abuse it
// after need. :)
@@ -427,22 +427,22 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
{
if( 100 * ( (float) rand() / (float)( RAND_MAX + 1.0f ) ) < m_arpMissModel.value() )
{
dir = ArpDirRandom;
dir = ArpDirection::Random;
}
}
int cur_arp_idx = 0;
// process according to arpeggio-direction...
if( dir == ArpDirUp )
if( dir == ArpDirection::Up )
{
cur_arp_idx = ( cur_frame / arp_frames ) % range;
}
else if( dir == ArpDirDown )
else if( dir == ArpDirection::Down )
{
cur_arp_idx = range - ( cur_frame / arp_frames ) %
range - 1;
}
else if( dir == ArpDirUpAndDown && range > 1 )
else if( dir == ArpDirection::UpAndDown && range > 1 )
{
// imagine, we had to play the arp once up and then
// once down -> makes 2 * range possible notes...
@@ -456,9 +456,9 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
cur_arp_idx = range - cur_arp_idx % ( range - 1 ) - 1;
}
}
else if( dir == ArpDirDownAndUp && range > 1 )
else if( dir == ArpDirection::DownAndUp && range > 1 )
{
// copied from ArpDirUpAndDown above
// copied from ArpDirection::UpAndDown above
cur_arp_idx = ( cur_frame / arp_frames ) % ( range * 2 - 2 );
// if greater than range, we have to play down...
// looks like the code for arp_dir==DOWN... :)
@@ -469,7 +469,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
// inverts direction
cur_arp_idx = range - cur_arp_idx - 1;
}
else if( dir == ArpDirRandom )
else if( dir == ArpDirection::Random )
{
// just pick a random chord-index
cur_arp_idx = (int)( range * ( (float) rand() / (float) RAND_MAX ) );
@@ -479,7 +479,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
cur_arp_idx = static_cast<int>(cur_arp_idx / m_arpRepeatsModel.value());
// Cycle notes
if( m_arpCycleModel.value() && dir != ArpDirRandom )
if( m_arpCycleModel.value() && dir != ArpDirection::Random )
{
cur_arp_idx *= m_arpCycleModel.value() + 1;
cur_arp_idx %= static_cast<int>( range / m_arpRepeatsModel.value() );
@@ -507,7 +507,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
gated_frames,
Note( TimePos( 0 ), TimePos( 0 ), sub_note_key, _n->getVolume(),
_n->getPanning(), _n->detuning() ),
_n, -1, NotePlayHandle::OriginArpeggio )
_n, -1, NotePlayHandle::Origin::Arpeggio )
);
// update counters

View File

@@ -31,7 +31,7 @@ namespace lmms
InstrumentPlayHandle::InstrumentPlayHandle( Instrument * instrument, InstrumentTrack* instrumentTrack ) :
PlayHandle( TypeInstrumentPlayHandle ),
PlayHandle( Type::InstrumentPlayHandle ),
m_instrument( instrument )
{
setAudioPort( instrumentTrack->audioPort() );

View File

@@ -69,7 +69,7 @@ InstrumentSoundShaping::InstrumentSoundShaping(
for( int i = 0; i < NumTargets; ++i )
{
float value_for_zero_amount = 0.0;
if( i == Volume )
if( static_cast<Target>(i) == Target::Volume )
{
value_for_zero_amount = 1.0;
}
@@ -119,7 +119,7 @@ float InstrumentSoundShaping::volumeLevel( NotePlayHandle* n, const f_cnt_t fram
}
float level;
m_envLfoParameters[Volume]->fillLevel( &level, frame, envReleaseBegin, 1 );
m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->fillLevel( &level, frame, envReleaseBegin, 1 );
return level;
}
@@ -160,22 +160,22 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
{
n->m_filter = std::make_unique<BasicFilters<>>( Engine::audioEngine()->processingSampleRate() );
}
n->m_filter->setFilterType( m_filterModel.value() );
n->m_filter->setFilterType( static_cast<BasicFilters<>::FilterType>(m_filterModel.value()) );
if( m_envLfoParameters[Cut]->isUsed() )
if( m_envLfoParameters[static_cast<std::size_t>(Target::Cut)]->isUsed() )
{
m_envLfoParameters[Cut]->fillLevel( cutBuffer.data(), envTotalFrames, envReleaseBegin, frames );
m_envLfoParameters[static_cast<std::size_t>(Target::Cut)]->fillLevel( cutBuffer.data(), envTotalFrames, envReleaseBegin, frames );
}
if( m_envLfoParameters[Resonance]->isUsed() )
if( m_envLfoParameters[static_cast<std::size_t>(Target::Resonance)]->isUsed() )
{
m_envLfoParameters[Resonance]->fillLevel( resBuffer.data(), envTotalFrames, envReleaseBegin, frames );
m_envLfoParameters[static_cast<std::size_t>(Target::Resonance)]->fillLevel( resBuffer.data(), envTotalFrames, envReleaseBegin, frames );
}
const float fcv = m_filterCutModel.value();
const float frv = m_filterResModel.value();
if( m_envLfoParameters[Cut]->isUsed() &&
m_envLfoParameters[Resonance]->isUsed() )
if( m_envLfoParameters[static_cast<std::size_t>(Target::Cut)]->isUsed() &&
m_envLfoParameters[static_cast<std::size_t>(Target::Resonance)]->isUsed() )
{
for( fpp_t frame = 0; frame < frames; ++frame )
{
@@ -196,7 +196,7 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
buffer[frame][1] = n->m_filter->update( buffer[frame][1], 1 );
}
}
else if( m_envLfoParameters[Cut]->isUsed() )
else if( m_envLfoParameters[static_cast<std::size_t>(Target::Cut)]->isUsed() )
{
for( fpp_t frame = 0; frame < frames; ++frame )
{
@@ -213,7 +213,7 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
buffer[frame][1] = n->m_filter->update( buffer[frame][1], 1 );
}
}
else if( m_envLfoParameters[Resonance]->isUsed() )
else if( m_envLfoParameters[static_cast<std::size_t>(Target::Resonance)]->isUsed() )
{
for( fpp_t frame = 0; frame < frames; ++frame )
{
@@ -241,10 +241,10 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
}
}
if( m_envLfoParameters[Volume]->isUsed() )
if( m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->isUsed() )
{
QVarLengthArray<float> volBuffer(frames);
m_envLfoParameters[Volume]->fillLevel( volBuffer.data(), envTotalFrames, envReleaseBegin, frames );
m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->fillLevel( volBuffer.data(), envTotalFrames, envReleaseBegin, frames );
for( fpp_t frame = 0; frame < frames; ++frame )
{
@@ -255,7 +255,7 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
}
}
/* else if( m_envLfoParameters[Volume]->isUsed() == false && m_envLfoParameters[PANNING]->isUsed() )
/* else if( m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->isUsed() == false && m_envLfoParameters[PANNING]->isUsed() )
{
// only use panning-envelope...
for( fpp_t frame = 0; frame < frames; ++frame )
@@ -275,11 +275,11 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
f_cnt_t InstrumentSoundShaping::envFrames( const bool _only_vol ) const
{
f_cnt_t ret_val = m_envLfoParameters[Volume]->PAHD_Frames();
f_cnt_t ret_val = m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->PAHD_Frames();
if( _only_vol == false )
{
for( int i = Volume+1; i < NumTargets; ++i )
for( int i = static_cast<std::size_t>(Target::Volume)+1; i < NumTargets; ++i )
{
if( m_envLfoParameters[i]->isUsed() &&
m_envLfoParameters[i]->PAHD_Frames() > ret_val )
@@ -303,17 +303,17 @@ f_cnt_t InstrumentSoundShaping::releaseFrames() const
f_cnt_t ret_val = m_instrumentTrack->instrument()->desiredReleaseFrames();
if( m_instrumentTrack->instrument()->flags().testFlag( Instrument::IsSingleStreamed ) )
if( m_instrumentTrack->instrument()->flags().testFlag( Instrument::Flag::IsSingleStreamed ) )
{
return ret_val;
}
if( m_envLfoParameters[Volume]->isUsed() )
if( m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->isUsed() )
{
return m_envLfoParameters[Volume]->releaseFrames();
return m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->releaseFrames();
}
for( int i = Volume+1; i < NumTargets; ++i )
for( int i = static_cast<std::size_t>(Target::Volume)+1; i < NumTargets; ++i )
{
if( m_envLfoParameters[i]->isUsed() )
{

View File

@@ -40,12 +40,12 @@ Ladspa2LMMS::Ladspa2LMMS()
ladspa_key_t key = plugin.second;
LadspaManagerDescription * desc = getDescription( key );
if( desc->type == SOURCE )
if( desc->type == LadspaPluginType::Source )
{
m_instruments.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == TRANSFER &&
else if( desc->type == LadspaPluginType::Transfer &&
( desc->inputChannels == desc->outputChannels &&
( desc->inputChannels == 1 ||
desc->inputChannels == 2 ||
@@ -55,7 +55,7 @@ Ladspa2LMMS::Ladspa2LMMS()
m_validEffects.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == TRANSFER &&
else if( desc->type == LadspaPluginType::Transfer &&
( desc->inputChannels != desc->outputChannels ||
( desc->inputChannels != 1 &&
desc->inputChannels != 2 &&
@@ -65,12 +65,12 @@ Ladspa2LMMS::Ladspa2LMMS()
m_invalidEffects.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == SINK )
else if( desc->type == LadspaPluginType::Sink )
{
m_analysisTools.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == OTHER )
else if( desc->type == LadspaPluginType::Other )
{
m_otherPlugins.append( qMakePair( getName( key ),
key ) );

View File

@@ -53,7 +53,7 @@ LadspaControl::LadspaControl( Model * _parent, port_desc_t * _port,
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
m_toggledModel.setInitValue(
static_cast<bool>( m_port->def ) );
connect( &m_toggledModel, SIGNAL(dataChanged()),
@@ -66,8 +66,8 @@ LadspaControl::LadspaControl( Model * _parent, port_desc_t * _port,
m_toggledModel.setScaleLogarithmic( m_port->suggests_logscale );
break;
case INTEGER:
case ENUM:
case BufferDataType::Integer:
case BufferDataType::Enum:
m_knobModel.setRange( static_cast<int>( m_port->max ),
static_cast<int>( m_port->min ),
1 + static_cast<int>( m_port->max -
@@ -80,7 +80,7 @@ LadspaControl::LadspaControl( Model * _parent, port_desc_t * _port,
m_knobModel.setScaleLogarithmic( m_port->suggests_logscale );
break;
case FLOATING:
case BufferDataType::Floating:
m_knobModel.setRange( m_port->min, m_port->max,
( m_port->max - m_port->min )
/ ( m_port->name.toUpper() == "GAIN"
@@ -93,7 +93,7 @@ LadspaControl::LadspaControl( Model * _parent, port_desc_t * _port,
m_knobModel.setScaleLogarithmic( m_port->suggests_logscale );
break;
case TIME:
case BufferDataType::Time:
m_tempoSyncKnobModel.setRange( m_port->min, m_port->max,
( m_port->max -
m_port->min ) / 800.0f );
@@ -116,13 +116,13 @@ LADSPA_Data LadspaControl::value()
{
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
return static_cast<LADSPA_Data>( m_toggledModel.value() );
case INTEGER:
case ENUM:
case FLOATING:
case BufferDataType::Integer:
case BufferDataType::Enum:
case BufferDataType::Floating:
return static_cast<LADSPA_Data>( m_knobModel.value() );
case TIME:
case BufferDataType::Time:
return static_cast<LADSPA_Data>( m_tempoSyncKnobModel.value() );
default:
qWarning( "LadspaControl::value(): BAD BAD BAD\n" );
@@ -137,13 +137,13 @@ ValueBuffer * LadspaControl::valueBuffer()
{
switch( m_port->data_type )
{
case TOGGLED:
case INTEGER:
case ENUM:
case BufferDataType::Toggled:
case BufferDataType::Integer:
case BufferDataType::Enum:
return nullptr;
case FLOATING:
case BufferDataType::Floating:
return m_knobModel.valueBuffer();
case TIME:
case BufferDataType::Time:
return m_tempoSyncKnobModel.valueBuffer();
default:
qWarning( "LadspaControl::valueBuffer(): BAD BAD BAD\n" );
@@ -159,17 +159,17 @@ void LadspaControl::setValue( LADSPA_Data _value )
{
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
m_toggledModel.setValue( static_cast<bool>( _value ) );
break;
case INTEGER:
case ENUM:
case BufferDataType::Integer:
case BufferDataType::Enum:
m_knobModel.setValue( static_cast<int>( _value ) );
break;
case FLOATING:
case BufferDataType::Floating:
m_knobModel.setValue( static_cast<float>( _value ) );
break;
case TIME:
case BufferDataType::Time:
m_tempoSyncKnobModel.setValue( static_cast<float>(
_value ) );
break;
@@ -194,15 +194,15 @@ void LadspaControl::saveSettings( QDomDocument& doc,
}
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
m_toggledModel.saveSettings( doc, e, "data" );
break;
case INTEGER:
case ENUM:
case FLOATING:
case BufferDataType::Integer:
case BufferDataType::Enum:
case BufferDataType::Floating:
m_knobModel.saveSettings( doc, e, "data" );
break;
case TIME:
case BufferDataType::Time:
m_tempoSyncKnobModel.saveSettings( doc, e, "data" );
break;
default:
@@ -230,15 +230,15 @@ void LadspaControl::loadSettings( const QDomElement& parent, const QString& name
m_linkEnabledModel.setValue(m_linkEnabledModel.initValue());
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
m_toggledModel.setValue(m_toggledModel.initValue());
break;
case INTEGER:
case ENUM:
case FLOATING:
case BufferDataType::Integer:
case BufferDataType::Enum:
case BufferDataType::Floating:
m_knobModel.setValue(m_knobModel.initValue());
break;
case TIME:
case BufferDataType::Time:
m_tempoSyncKnobModel.setValue(m_tempoSyncKnobModel.initValue());
break;
default:
@@ -265,15 +265,15 @@ void LadspaControl::loadSettings( const QDomElement& parent, const QString& name
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
m_toggledModel.loadSettings( e, dataModelName );
break;
case INTEGER:
case ENUM:
case FLOATING:
case BufferDataType::Integer:
case BufferDataType::Enum:
case BufferDataType::Floating:
m_knobModel.loadSettings( e, dataModelName );
break;
case TIME:
case BufferDataType::Time:
m_tempoSyncKnobModel.loadSettings( e, dataModelName );
break;
default:
@@ -290,15 +290,15 @@ void LadspaControl::linkControls( LadspaControl * _control )
{
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
BoolModel::linkModels( &m_toggledModel, _control->toggledModel() );
break;
case INTEGER:
case ENUM:
case FLOATING:
case BufferDataType::Integer:
case BufferDataType::Enum:
case BufferDataType::Floating:
FloatModel::linkModels( &m_knobModel, _control->knobModel() );
break;
case TIME:
case BufferDataType::Time:
TempoSyncKnobModel::linkModels( &m_tempoSyncKnobModel,
_control->tempoSyncKnobModel() );
break;
@@ -341,15 +341,15 @@ void LadspaControl::unlinkControls( LadspaControl * _control )
{
switch( m_port->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
BoolModel::unlinkModels( &m_toggledModel, _control->toggledModel() );
break;
case INTEGER:
case ENUM:
case FLOATING:
case BufferDataType::Integer:
case BufferDataType::Enum:
case BufferDataType::Floating:
FloatModel::unlinkModels( &m_knobModel, _control->knobModel() );
break;
case TIME:
case BufferDataType::Time:
TempoSyncKnobModel::unlinkModels( &m_tempoSyncKnobModel,
_control->tempoSyncKnobModel() );
break;

View File

@@ -159,21 +159,21 @@ void LadspaManager::addPlugins(
if( plugIn->inputChannels == 0 && plugIn->outputChannels > 0 )
{
plugIn->type = SOURCE;
plugIn->type = LadspaPluginType::Source;
}
else if( plugIn->inputChannels > 0 &&
plugIn->outputChannels > 0 )
{
plugIn->type = TRANSFER;
plugIn->type = LadspaPluginType::Transfer;
}
else if( plugIn->inputChannels > 0 &&
plugIn->outputChannels == 0 )
{
plugIn->type = SINK;
plugIn->type = LadspaPluginType::Sink;
}
else
{
plugIn->type = OTHER;
plugIn->type = LadspaPluginType::Other;
}
m_ladspaManagerMap[key] = plugIn;

View File

@@ -36,12 +36,12 @@ namespace lmms
LfoController::LfoController( Model * _parent ) :
Controller( Controller::LfoController, _parent, tr( "LFO Controller" ) ),
Controller( ControllerType::Lfo, _parent, tr( "LFO Controller" ) ),
m_baseModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Base value" ) ),
m_speedModel( 2.0, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Oscillator speed" ) ),
m_amountModel( 1.0, -1.0, 1.0, 0.005, this, tr( "Oscillator amount" ) ),
m_phaseModel( 0.0, 0.0, 360.0, 4.0, this, tr( "Oscillator phase" ) ),
m_waveModel( Oscillator::SineWave, 0, Oscillator::NumWaveShapes,
m_waveModel( static_cast<int>(Oscillator::WaveShape::Sine), 0, Oscillator::NumWaveShapes,
this, tr( "Oscillator waveform" ) ),
m_multiplierModel( 0, 0, 2, this, tr( "Frequency Multiplier" ) ),
m_duration( 1000 ),
@@ -149,30 +149,31 @@ void LfoController::updateDuration()
void LfoController::updateSampleFunction()
{
switch( m_waveModel.value() )
switch( static_cast<Oscillator::WaveShape>(m_waveModel.value()) )
{
case Oscillator::SineWave:
case Oscillator::WaveShape::Sine:
default:
m_sampleFunction = &Oscillator::sinSample;
break;
case Oscillator::TriangleWave:
case Oscillator::WaveShape::Triangle:
m_sampleFunction = &Oscillator::triangleSample;
break;
case Oscillator::SawWave:
case Oscillator::WaveShape::Saw:
m_sampleFunction = &Oscillator::sawSample;
break;
case Oscillator::SquareWave:
case Oscillator::WaveShape::Square:
m_sampleFunction = &Oscillator::squareSample;
break;
case Oscillator::MoogSawWave:
case Oscillator::WaveShape::MoogSaw:
m_sampleFunction = &Oscillator::moogSawSample;
break;
case Oscillator::ExponentialWave:
case Oscillator::WaveShape::Exponential:
m_sampleFunction = &Oscillator::expSample;
break;
case Oscillator::WhiteNoise:
case Oscillator::WaveShape::WhiteNoise:
m_sampleFunction = &Oscillator::noiseSample;
break;
case Oscillator::UserDefinedWave:
case Oscillator::WaveShape::UserDefined:
m_sampleFunction = nullptr;
/*TODO: If C++11 is allowed, should change the type of
m_sampleFunction be std::function<sample_t(const float)>

View File

@@ -301,7 +301,7 @@ void Mixer::deleteChannel( int index )
for( Track* t : tracks )
{
if( t->type() == Track::InstrumentTrack )
if( t->type() == Track::Type::Instrument )
{
auto inst = dynamic_cast<InstrumentTrack*>(t);
int val = inst->mixerChannelModel()->value(0);
@@ -317,7 +317,7 @@ void Mixer::deleteChannel( int index )
inst->mixerChannelModel()->setValue(val-1);
}
}
else if( t->type() == Track::SampleTrack )
else if( t->type() == Track::Type::Sample )
{
auto strk = dynamic_cast<SampleTrack*>(t);
int val = strk->mixerChannelModel()->value(0);
@@ -401,7 +401,7 @@ void Mixer::moveChannelLeft( int index )
{
for (const auto& track : trackList)
{
if (track->type() == Track::InstrumentTrack)
if (track->type() == Track::Type::Instrument)
{
auto inst = (InstrumentTrack*)track;
int val = inst->mixerChannelModel()->value(0);
@@ -414,7 +414,7 @@ void Mixer::moveChannelLeft( int index )
inst->mixerChannelModel()->setValue(a);
}
}
else if (track->type() == Track::SampleTrack)
else if (track->type() == Track::Type::Sample)
{
auto strk = (SampleTrack*)track;
int val = strk->mixerChannelModel()->value(0);
@@ -630,7 +630,7 @@ void Mixer::masterMix( sampleFrame * _buf )
// also instantly add all muted channels as they don't need to care
// about their senders, and can just increment the deps of their
// recipients right away.
AudioEngineWorkerThread::resetJobQueue( AudioEngineWorkerThread::JobQueue::Dynamic );
AudioEngineWorkerThread::resetJobQueue( AudioEngineWorkerThread::JobQueue::OperationMode::Dynamic );
for( MixerChannel * ch : m_mixerChannels )
{
ch->m_muted = ch->m_muteModel.value();
@@ -863,7 +863,7 @@ bool Mixer::isChannelInUse(int index)
for (const auto t : tracks)
{
if (t->type() == Track::InstrumentTrack)
if (t->type() == Track::Type::Instrument)
{
auto inst = dynamic_cast<InstrumentTrack*>(t);
if (inst->mixerChannelModel()->value() == index)
@@ -871,7 +871,7 @@ bool Mixer::isChannelInUse(int index)
return true;
}
}
else if (t->type() == Track::SampleTrack)
else if (t->type() == Track::Type::Sample)
{
auto strack = dynamic_cast<SampleTrack*>(t);
if (strack->mixerChannelModel()->value() == index)

View File

@@ -216,7 +216,7 @@ void Note::createDetuning()
m_detuning = new DetuningHelper;
(void) m_detuning->automationClip();
m_detuning->setRange( -MaxDetuning, MaxDetuning, 0.5f );
m_detuning->automationClip()->setProgressionType( AutomationClip::LinearProgression );
m_detuning->automationClip()->setProgressionType( AutomationClip::ProgressionType::Linear );
}
}

View File

@@ -53,7 +53,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
NotePlayHandle *parent,
int midiEventChannel,
Origin origin ) :
PlayHandle( TypeNotePlayHandle, _offset ),
PlayHandle( Type::NotePlayHandle, _offset ),
Note( n.length(), n.pos(), n.key(), n.getVolume(), n.getPanning(), n.detuning() ),
m_pluginData( nullptr ),
m_instrumentTrack( instrumentTrack ),
@@ -104,12 +104,12 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
setFrames( _frames );
// inform attached components about new MIDI note (used for recording in Piano Roll)
if( m_origin == OriginMidiInput )
if( m_origin == Origin::MidiInput )
{
m_instrumentTrack->midiNoteOn( *this );
}
if(m_instrumentTrack->instrument() && m_instrumentTrack->instrument()->flags() & Instrument::IsSingleStreamed )
if(m_instrumentTrack->instrument() && m_instrumentTrack->instrument()->flags() & Instrument::Flag::IsSingleStreamed )
{
setUsesBuffer( false );
}
@@ -400,7 +400,7 @@ void NotePlayHandle::noteOff( const f_cnt_t _s )
// inform attached components about MIDI finished (used for recording in Piano Roll)
if (!instrumentTrack()->isSustainPedalPressed())
{
if( m_origin == OriginMidiInput )
if( m_origin == Origin::MidiInput )
{
setLength( TimePos( static_cast<f_cnt_t>( totalFramesPlayed() / Engine::framesPerTick() ) ) );
m_instrumentTrack->midiNoteOff( *this );
@@ -575,8 +575,8 @@ void NotePlayHandle::processTimePos( const TimePos& time )
void NotePlayHandle::resize( const bpm_t _new_tempo )
{
if (origin() == OriginMidiInput ||
(origin() == OriginNoteStacking && m_parent->origin() == OriginMidiInput))
if (origin() == Origin::MidiInput ||
(origin() == Origin::NoteStacking && m_parent->origin() == Origin::MidiInput))
{
// Don't resize notes from MIDI input - they should continue to play
// until the key is released, and their large duration can cause

View File

@@ -90,21 +90,22 @@ void Oscillator::update(sampleFrame* ab, const fpp_t frames, const ch_cnt_t chnl
m_isModulator = modulator;
if (m_subOsc != nullptr)
{
switch (m_modulationAlgoModel->value())
switch (static_cast<ModulationAlgo>(m_modulationAlgoModel->value()))
{
case PhaseModulation:
case ModulationAlgo::PhaseModulation:
updatePM(ab, frames, chnl);
break;
case AmplitudeModulation:
case ModulationAlgo::AmplitudeModulation:
updateAM(ab, frames, chnl);
break;
case SignalMix:
case ModulationAlgo::SignalMix:
default:
updateMix(ab, frames, chnl);
break;
case SynchronizedBySubOsc:
case ModulationAlgo::SynchronizedBySubOsc:
updateSync(ab, frames, chnl);
break;
case FrequencyModulation:
case ModulationAlgo::FrequencyModulation:
updateFM(ab, frames, chnl);
}
}
@@ -199,7 +200,7 @@ void Oscillator::generateAntiAliasUserWaveTable(SampleBuffer *sampleBuffer)
sample_t Oscillator::s_waveTables
[Oscillator::WaveShapes::NumWaveShapeTables]
[Oscillator::NumWaveShapeTables]
[OscillatorConstants::WAVE_TABLES_PER_WAVEFORM_COUNT]
[OscillatorConstants::WAVETABLE_LENGTH];
fftwf_plan Oscillator::s_fftPlan;
@@ -235,9 +236,9 @@ void Oscillator::generateWaveTables()
// Start from the table that contains the least number of bands, and re-use each table in the following
// iteration, adding more bands in each step and avoiding repeated computation of earlier bands.
using generator_t = void (*)(int, sample_t*, int);
auto simpleGen = [](WaveShapes shape, generator_t generator)
auto simpleGen = [](WaveShape shape, generator_t generator)
{
const int shapeID = shape - FirstWaveShapeTable;
const int shapeID = static_cast<std::size_t>(shape) - FirstWaveShapeTable;
int lastBands = 0;
// Clear the first wave table
@@ -273,7 +274,7 @@ void Oscillator::generateWaveTables()
Oscillator::s_sampleBuffer[i] = moogSawSample((float)i / (float)OscillatorConstants::WAVETABLE_LENGTH);
}
fftwf_execute(s_fftPlan);
generateFromFFT(OscillatorConstants::MAX_FREQ / freqFromWaveTableBand(i), s_waveTables[WaveShapes::MoogSawWave - FirstWaveShapeTable][i]);
generateFromFFT(OscillatorConstants::MAX_FREQ / freqFromWaveTableBand(i), s_waveTables[static_cast<std::size_t>(WaveShape::MoogSaw) - FirstWaveShapeTable][i]);
}
// Generate exponential tables
@@ -284,7 +285,7 @@ void Oscillator::generateWaveTables()
s_sampleBuffer[i] = expSample((float)i / (float)OscillatorConstants::WAVETABLE_LENGTH);
}
fftwf_execute(s_fftPlan);
generateFromFFT(OscillatorConstants::MAX_FREQ / freqFromWaveTableBand(i), s_waveTables[WaveShapes::ExponentialWave - FirstWaveShapeTable][i]);
generateFromFFT(OscillatorConstants::MAX_FREQ / freqFromWaveTableBand(i), s_waveTables[static_cast<std::size_t>(WaveShape::Exponential) - FirstWaveShapeTable][i]);
}
};
@@ -292,18 +293,18 @@ void Oscillator::generateWaveTables()
// but since threading is not essential in this case, it is easier and more reliable to simply generate
// the wavetables serially. Remove the the check and #else branch once std::thread is well supported.
#if !defined(__MINGW32__) && !defined(__MINGW64__)
std::thread sawThread(simpleGen, WaveShapes::SawWave, generateSawWaveTable);
std::thread squareThread(simpleGen, WaveShapes::SquareWave, generateSquareWaveTable);
std::thread triangleThread(simpleGen, WaveShapes::TriangleWave, generateTriangleWaveTable);
std::thread sawThread(simpleGen, WaveShape::Saw, generateSawWaveTable);
std::thread squareThread(simpleGen, WaveShape::Square, generateSquareWaveTable);
std::thread triangleThread(simpleGen, WaveShape::Triangle, generateTriangleWaveTable);
std::thread fftThread(fftGen);
sawThread.join();
squareThread.join();
triangleThread.join();
fftThread.join();
#else
simpleGen(WaveShapes::SawWave, generateSawWaveTable);
simpleGen(WaveShapes::SquareWave, generateSquareWaveTable);
simpleGen(WaveShapes::TriangleWave, generateTriangleWaveTable);
simpleGen(WaveShape::Saw, generateSawWaveTable);
simpleGen(WaveShape::Square, generateSquareWaveTable);
simpleGen(WaveShape::Triangle, generateTriangleWaveTable);
fftGen();
#endif
}
@@ -314,32 +315,32 @@ void Oscillator::generateWaveTables()
void Oscillator::updateNoSub( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
switch( m_waveShapeModel->value() )
switch( static_cast<WaveShape>(m_waveShapeModel->value()) )
{
case SineWave:
case WaveShape::Sine:
default:
updateNoSub<SineWave>( _ab, _frames, _chnl );
updateNoSub<WaveShape::Sine>( _ab, _frames, _chnl );
break;
case TriangleWave:
updateNoSub<TriangleWave>( _ab, _frames, _chnl );
case WaveShape::Triangle:
updateNoSub<WaveShape::Triangle>( _ab, _frames, _chnl );
break;
case SawWave:
updateNoSub<SawWave>( _ab, _frames, _chnl );
case WaveShape::Saw:
updateNoSub<WaveShape::Saw>( _ab, _frames, _chnl );
break;
case SquareWave:
updateNoSub<SquareWave>( _ab, _frames, _chnl );
case WaveShape::Square:
updateNoSub<WaveShape::Square>( _ab, _frames, _chnl );
break;
case MoogSawWave:
updateNoSub<MoogSawWave>( _ab, _frames, _chnl );
case WaveShape::MoogSaw:
updateNoSub<WaveShape::MoogSaw>( _ab, _frames, _chnl );
break;
case ExponentialWave:
updateNoSub<ExponentialWave>( _ab, _frames, _chnl );
case WaveShape::Exponential:
updateNoSub<WaveShape::Exponential>( _ab, _frames, _chnl );
break;
case WhiteNoise:
updateNoSub<WhiteNoise>( _ab, _frames, _chnl );
case WaveShape::WhiteNoise:
updateNoSub<WaveShape::WhiteNoise>( _ab, _frames, _chnl );
break;
case UserDefinedWave:
updateNoSub<UserDefinedWave>( _ab, _frames, _chnl );
case WaveShape::UserDefined:
updateNoSub<WaveShape::UserDefined>( _ab, _frames, _chnl );
break;
}
}
@@ -350,32 +351,32 @@ void Oscillator::updateNoSub( sampleFrame * _ab, const fpp_t _frames,
void Oscillator::updatePM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
switch( m_waveShapeModel->value() )
switch( static_cast<WaveShape>(m_waveShapeModel->value()) )
{
case SineWave:
case WaveShape::Sine:
default:
updatePM<SineWave>( _ab, _frames, _chnl );
updatePM<WaveShape::Sine>( _ab, _frames, _chnl );
break;
case TriangleWave:
updatePM<TriangleWave>( _ab, _frames, _chnl );
case WaveShape::Triangle:
updatePM<WaveShape::Triangle>( _ab, _frames, _chnl );
break;
case SawWave:
updatePM<SawWave>( _ab, _frames, _chnl );
case WaveShape::Saw:
updatePM<WaveShape::Saw>( _ab, _frames, _chnl );
break;
case SquareWave:
updatePM<SquareWave>( _ab, _frames, _chnl );
case WaveShape::Square:
updatePM<WaveShape::Square>( _ab, _frames, _chnl );
break;
case MoogSawWave:
updatePM<MoogSawWave>( _ab, _frames, _chnl );
case WaveShape::MoogSaw:
updatePM<WaveShape::MoogSaw>( _ab, _frames, _chnl );
break;
case ExponentialWave:
updatePM<ExponentialWave>( _ab, _frames, _chnl );
case WaveShape::Exponential:
updatePM<WaveShape::Exponential>( _ab, _frames, _chnl );
break;
case WhiteNoise:
updatePM<WhiteNoise>( _ab, _frames, _chnl );
case WaveShape::WhiteNoise:
updatePM<WaveShape::WhiteNoise>( _ab, _frames, _chnl );
break;
case UserDefinedWave:
updatePM<UserDefinedWave>( _ab, _frames, _chnl );
case WaveShape::UserDefined:
updatePM<WaveShape::UserDefined>( _ab, _frames, _chnl );
break;
}
}
@@ -386,32 +387,32 @@ void Oscillator::updatePM( sampleFrame * _ab, const fpp_t _frames,
void Oscillator::updateAM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
switch( m_waveShapeModel->value() )
switch( static_cast<WaveShape>(m_waveShapeModel->value()) )
{
case SineWave:
case WaveShape::Sine:
default:
updateAM<SineWave>( _ab, _frames, _chnl );
updateAM<WaveShape::Sine>( _ab, _frames, _chnl );
break;
case TriangleWave:
updateAM<TriangleWave>( _ab, _frames, _chnl );
case WaveShape::Triangle:
updateAM<WaveShape::Triangle>( _ab, _frames, _chnl );
break;
case SawWave:
updateAM<SawWave>( _ab, _frames, _chnl );
case WaveShape::Saw:
updateAM<WaveShape::Saw>( _ab, _frames, _chnl );
break;
case SquareWave:
updateAM<SquareWave>( _ab, _frames, _chnl );
case WaveShape::Square:
updateAM<WaveShape::Square>( _ab, _frames, _chnl );
break;
case MoogSawWave:
updateAM<MoogSawWave>( _ab, _frames, _chnl );
case WaveShape::MoogSaw:
updateAM<WaveShape::MoogSaw>( _ab, _frames, _chnl );
break;
case ExponentialWave:
updateAM<ExponentialWave>( _ab, _frames, _chnl );
case WaveShape::Exponential:
updateAM<WaveShape::Exponential>( _ab, _frames, _chnl );
break;
case WhiteNoise:
updateAM<WhiteNoise>( _ab, _frames, _chnl );
case WaveShape::WhiteNoise:
updateAM<WaveShape::WhiteNoise>( _ab, _frames, _chnl );
break;
case UserDefinedWave:
updateAM<UserDefinedWave>( _ab, _frames, _chnl );
case WaveShape::UserDefined:
updateAM<WaveShape::UserDefined>( _ab, _frames, _chnl );
break;
}
}
@@ -422,32 +423,32 @@ void Oscillator::updateAM( sampleFrame * _ab, const fpp_t _frames,
void Oscillator::updateMix( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
switch( m_waveShapeModel->value() )
switch( static_cast<WaveShape>(m_waveShapeModel->value()) )
{
case SineWave:
case WaveShape::Sine:
default:
updateMix<SineWave>( _ab, _frames, _chnl );
updateMix<WaveShape::Sine>( _ab, _frames, _chnl );
break;
case TriangleWave:
updateMix<TriangleWave>( _ab, _frames, _chnl );
case WaveShape::Triangle:
updateMix<WaveShape::Triangle>( _ab, _frames, _chnl );
break;
case SawWave:
updateMix<SawWave>( _ab, _frames, _chnl );
case WaveShape::Saw:
updateMix<WaveShape::Saw>( _ab, _frames, _chnl );
break;
case SquareWave:
updateMix<SquareWave>( _ab, _frames, _chnl );
case WaveShape::Square:
updateMix<WaveShape::Square>( _ab, _frames, _chnl );
break;
case MoogSawWave:
updateMix<MoogSawWave>( _ab, _frames, _chnl );
case WaveShape::MoogSaw:
updateMix<WaveShape::MoogSaw>( _ab, _frames, _chnl );
break;
case ExponentialWave:
updateMix<ExponentialWave>( _ab, _frames, _chnl );
case WaveShape::Exponential:
updateMix<WaveShape::Exponential>( _ab, _frames, _chnl );
break;
case WhiteNoise:
updateMix<WhiteNoise>( _ab, _frames, _chnl );
case WaveShape::WhiteNoise:
updateMix<WaveShape::WhiteNoise>( _ab, _frames, _chnl );
break;
case UserDefinedWave:
updateMix<UserDefinedWave>( _ab, _frames, _chnl );
case WaveShape::UserDefined:
updateMix<WaveShape::UserDefined>( _ab, _frames, _chnl );
break;
}
}
@@ -458,32 +459,32 @@ void Oscillator::updateMix( sampleFrame * _ab, const fpp_t _frames,
void Oscillator::updateSync( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
switch( m_waveShapeModel->value() )
switch( static_cast<WaveShape>(m_waveShapeModel->value()) )
{
case SineWave:
case WaveShape::Sine:
default:
updateSync<SineWave>( _ab, _frames, _chnl );
updateSync<WaveShape::Sine>( _ab, _frames, _chnl );
break;
case TriangleWave:
updateSync<TriangleWave>( _ab, _frames, _chnl );
case WaveShape::Triangle:
updateSync<WaveShape::Triangle>( _ab, _frames, _chnl );
break;
case SawWave:
updateSync<SawWave>( _ab, _frames, _chnl );
case WaveShape::Saw:
updateSync<WaveShape::Saw>( _ab, _frames, _chnl );
break;
case SquareWave:
updateSync<SquareWave>( _ab, _frames, _chnl );
case WaveShape::Square:
updateSync<WaveShape::Square>( _ab, _frames, _chnl );
break;
case MoogSawWave:
updateSync<MoogSawWave>( _ab, _frames, _chnl );
case WaveShape::MoogSaw:
updateSync<WaveShape::MoogSaw>( _ab, _frames, _chnl );
break;
case ExponentialWave:
updateSync<ExponentialWave>( _ab, _frames, _chnl );
case WaveShape::Exponential:
updateSync<WaveShape::Exponential>( _ab, _frames, _chnl );
break;
case WhiteNoise:
updateSync<WhiteNoise>( _ab, _frames, _chnl );
case WaveShape::WhiteNoise:
updateSync<WaveShape::WhiteNoise>( _ab, _frames, _chnl );
break;
case UserDefinedWave:
updateSync<UserDefinedWave>( _ab, _frames, _chnl );
case WaveShape::UserDefined:
updateSync<WaveShape::UserDefined>( _ab, _frames, _chnl );
break;
}
}
@@ -494,32 +495,32 @@ void Oscillator::updateSync( sampleFrame * _ab, const fpp_t _frames,
void Oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
switch( m_waveShapeModel->value() )
switch( static_cast<WaveShape>(m_waveShapeModel->value()) )
{
case SineWave:
case WaveShape::Sine:
default:
updateFM<SineWave>( _ab, _frames, _chnl );
updateFM<WaveShape::Sine>( _ab, _frames, _chnl );
break;
case TriangleWave:
updateFM<TriangleWave>( _ab, _frames, _chnl );
case WaveShape::Triangle:
updateFM<WaveShape::Triangle>( _ab, _frames, _chnl );
break;
case SawWave:
updateFM<SawWave>( _ab, _frames, _chnl );
case WaveShape::Saw:
updateFM<WaveShape::Saw>( _ab, _frames, _chnl );
break;
case SquareWave:
updateFM<SquareWave>( _ab, _frames, _chnl );
case WaveShape::Square:
updateFM<WaveShape::Square>( _ab, _frames, _chnl );
break;
case MoogSawWave:
updateFM<MoogSawWave>( _ab, _frames, _chnl );
case WaveShape::MoogSaw:
updateFM<WaveShape::MoogSaw>( _ab, _frames, _chnl );
break;
case ExponentialWave:
updateFM<ExponentialWave>( _ab, _frames, _chnl );
case WaveShape::Exponential:
updateFM<WaveShape::Exponential>( _ab, _frames, _chnl );
break;
case WhiteNoise:
updateFM<WhiteNoise>( _ab, _frames, _chnl );
case WaveShape::WhiteNoise:
updateFM<WaveShape::WhiteNoise>( _ab, _frames, _chnl );
break;
case UserDefinedWave:
updateFM<UserDefinedWave>( _ab, _frames, _chnl );
case WaveShape::UserDefined:
updateFM<WaveShape::UserDefined>( _ab, _frames, _chnl );
break;
}
}
@@ -568,7 +569,7 @@ float Oscillator::syncInit( sampleFrame * _ab, const fpp_t _frames,
// if we have no sub-osc, we can't do any modulation... just get our samples
template<Oscillator::WaveShapes W>
template<Oscillator::WaveShape W>
void Oscillator::updateNoSub( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
@@ -586,7 +587,7 @@ void Oscillator::updateNoSub( sampleFrame * _ab, const fpp_t _frames,
// do pm by using sub-osc as modulator
template<Oscillator::WaveShapes W>
template<Oscillator::WaveShape W>
void Oscillator::updatePM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
@@ -607,7 +608,7 @@ void Oscillator::updatePM( sampleFrame * _ab, const fpp_t _frames,
// do am by using sub-osc as modulator
template<Oscillator::WaveShapes W>
template<Oscillator::WaveShape W>
void Oscillator::updateAM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
@@ -626,7 +627,7 @@ void Oscillator::updateAM( sampleFrame * _ab, const fpp_t _frames,
// do mix by using sub-osc as mix-sample
template<Oscillator::WaveShapes W>
template<Oscillator::WaveShape W>
void Oscillator::updateMix( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
@@ -646,7 +647,7 @@ void Oscillator::updateMix( sampleFrame * _ab, const fpp_t _frames,
// sync with sub-osc (every time sub-osc starts new period, we also start new
// period)
template<Oscillator::WaveShapes W>
template<Oscillator::WaveShape W>
void Oscillator::updateSync( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
@@ -669,7 +670,7 @@ void Oscillator::updateSync( sampleFrame * _ab, const fpp_t _frames,
// do fm by using sub-osc as modulator
template<Oscillator::WaveShapes W>
template<Oscillator::WaveShape W>
void Oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
@@ -690,7 +691,7 @@ void Oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames,
template<>
inline sample_t Oscillator::getSample<Oscillator::SineWave>(const float sample)
inline sample_t Oscillator::getSample<Oscillator::WaveShape::Sine>(const float sample)
{
const float current_freq = m_freq * m_detuning_div_samplerate * Engine::audioEngine()->processingSampleRate();
@@ -708,12 +709,12 @@ inline sample_t Oscillator::getSample<Oscillator::SineWave>(const float sample)
template<>
inline sample_t Oscillator::getSample<Oscillator::TriangleWave>(
inline sample_t Oscillator::getSample<Oscillator::WaveShape::Triangle>(
const float _sample )
{
if (m_useWaveTable && !m_isModulator)
{
return wtSample(s_waveTables[WaveShapes::TriangleWave - FirstWaveShapeTable],_sample);
return wtSample(s_waveTables[static_cast<std::size_t>(WaveShape::Triangle) - FirstWaveShapeTable],_sample);
}
else
{
@@ -725,12 +726,12 @@ inline sample_t Oscillator::getSample<Oscillator::TriangleWave>(
template<>
inline sample_t Oscillator::getSample<Oscillator::SawWave>(
inline sample_t Oscillator::getSample<Oscillator::WaveShape::Saw>(
const float _sample )
{
if (m_useWaveTable && !m_isModulator)
{
return wtSample(s_waveTables[WaveShapes::SawWave - FirstWaveShapeTable], _sample);
return wtSample(s_waveTables[static_cast<std::size_t>(WaveShape::Saw) - FirstWaveShapeTable], _sample);
}
else
{
@@ -742,12 +743,12 @@ inline sample_t Oscillator::getSample<Oscillator::SawWave>(
template<>
inline sample_t Oscillator::getSample<Oscillator::SquareWave>(
inline sample_t Oscillator::getSample<Oscillator::WaveShape::Square>(
const float _sample )
{
if (m_useWaveTable && !m_isModulator)
{
return wtSample(s_waveTables[WaveShapes::SquareWave - FirstWaveShapeTable], _sample);
return wtSample(s_waveTables[static_cast<std::size_t>(WaveShape::Square) - FirstWaveShapeTable], _sample);
}
else
{
@@ -759,12 +760,12 @@ inline sample_t Oscillator::getSample<Oscillator::SquareWave>(
template<>
inline sample_t Oscillator::getSample<Oscillator::MoogSawWave>(
inline sample_t Oscillator::getSample<Oscillator::WaveShape::MoogSaw>(
const float _sample )
{
if (m_useWaveTable && !m_isModulator)
{
return wtSample(s_waveTables[WaveShapes::MoogSawWave - FirstWaveShapeTable], _sample);
return wtSample(s_waveTables[static_cast<std::size_t>(WaveShape::MoogSaw) - FirstWaveShapeTable], _sample);
}
else
{
@@ -776,12 +777,12 @@ inline sample_t Oscillator::getSample<Oscillator::MoogSawWave>(
template<>
inline sample_t Oscillator::getSample<Oscillator::ExponentialWave>(
inline sample_t Oscillator::getSample<Oscillator::WaveShape::Exponential>(
const float _sample )
{
if (m_useWaveTable && !m_isModulator)
{
return wtSample(s_waveTables[WaveShapes::ExponentialWave - FirstWaveShapeTable], _sample);
return wtSample(s_waveTables[static_cast<std::size_t>(WaveShape::Exponential) - FirstWaveShapeTable], _sample);
}
else
{
@@ -793,7 +794,7 @@ inline sample_t Oscillator::getSample<Oscillator::ExponentialWave>(
template<>
inline sample_t Oscillator::getSample<Oscillator::WhiteNoise>(
inline sample_t Oscillator::getSample<Oscillator::WaveShape::WhiteNoise>(
const float _sample )
{
return( noiseSample( _sample ) );
@@ -803,7 +804,7 @@ inline sample_t Oscillator::getSample<Oscillator::WhiteNoise>(
template<>
inline sample_t Oscillator::getSample<Oscillator::UserDefinedWave>(
inline sample_t Oscillator::getSample<Oscillator::WaveShape::UserDefined>(
const float _sample )
{
if (m_useWaveTable && !m_isModulator)

View File

@@ -44,7 +44,7 @@ PatternStore::PatternStore() :
// not change upon setCurrentPattern()-call
connect(&m_patternComboBoxModel, SIGNAL(dataUnchanged()),
this, SLOT(currentPatternChanged()));
setType(PatternContainer);
setType(Type::Pattern);
}
@@ -109,7 +109,7 @@ bar_t PatternStore::lengthOfPattern(int pattern) const
int PatternStore::numOfPatterns() const
{
return Engine::getSong()->countTracks(Track::PatternTrack);
return Engine::getSong()->countTracks(Track::Type::Pattern);
}
@@ -174,7 +174,7 @@ void PatternStore::fixIncorrectPositions()
void PatternStore::play()
{
if (Engine::getSong()->playMode() != Song::Mode_PlayPattern)
if (Engine::getSong()->playMode() != Song::PlayMode::Pattern)
{
Engine::getSong()->playPattern();
}
@@ -218,7 +218,7 @@ void PatternStore::currentPatternChanged()
TrackList tl = Engine::getSong()->tracks();
for (Track * t : tl)
{
if (t->type() == Track::PatternTrack)
if (t->type() == Track::Type::Pattern)
{
t->dataChanged();
}

View File

@@ -46,7 +46,7 @@ bool PeakController::m_buggedFile;
PeakController::PeakController( Model * _parent,
PeakControllerEffect * _peak_effect ) :
Controller( Controller::PeakController, _parent, tr( "Peak Controller" ) ),
Controller( ControllerType::Peak, _parent, tr( "Peak Controller" ) ),
m_peakEffect( _peak_effect ),
m_currentSample( 0.0f )
{

View File

@@ -49,12 +49,12 @@ namespace lmms
*/
static const auto KEY_ORDER = std::array
{
// C CIS D DIS
Piano::WhiteKey, Piano::BlackKey, Piano::WhiteKey, Piano::BlackKey,
// E F FIS G
Piano::WhiteKey, Piano::WhiteKey, Piano::BlackKey, Piano::WhiteKey,
// GIS A AIS B
Piano::BlackKey, Piano::WhiteKey, Piano::BlackKey, Piano::WhiteKey
// C CIS D DIS
Piano::KeyType::White, Piano::KeyType::Black, Piano::KeyType::White, Piano::KeyType::Black,
// E F FIS G
Piano::KeyType::White, Piano::KeyType::White, Piano::KeyType::Black, Piano::KeyType::White,
// GIS A AIS B
Piano::KeyType::Black, Piano::KeyType::White, Piano::KeyType::Black, Piano::KeyType::White
} ;
@@ -127,7 +127,7 @@ bool Piano::isBlackKey(int key)
{
int keyCode = key % KeysPerOctave;
return KEY_ORDER[keyCode] == Piano::BlackKey;
return KEY_ORDER[keyCode] == Piano::KeyType::Black;
}

View File

@@ -50,7 +50,7 @@ static Plugin::Descriptor dummyPluginDescriptor =
QT_TRANSLATE_NOOP( "PluginBrowser", "no description" ),
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
Plugin::Undefined,
Plugin::Type::Undefined,
&dummyLoader,
nullptr
} ;

View File

@@ -109,7 +109,7 @@ Plugin::DescriptorList PluginFactory::descriptors() const
return m_descriptors.values();
}
Plugin::DescriptorList PluginFactory::descriptors(Plugin::PluginTypes type) const
Plugin::DescriptorList PluginFactory::descriptors(Plugin::Type type) const
{
return m_descriptors.values(type);
}

View File

@@ -34,43 +34,43 @@ const char *PluginIssue::msgFor(const PluginIssueType &it)
{
switch (it)
{
case unknownPortFlow:
case PluginIssueType::UnknownPortFlow:
return "unknown port flow for mandatory port";
case unknownPortType:
case PluginIssueType::UnknownPortType:
return "unknown port type for mandatory port";
case tooManyInputChannels:
case PluginIssueType::TooManyInputChannels:
return "too many audio input channels";
case tooManyOutputChannels:
case PluginIssueType::TooManyOutputChannels:
return "too many audio output channels";
case tooManyMidiInputChannels:
case PluginIssueType::TooManyMidiInputChannels:
return "too many MIDI input channels";
case tooManyMidiOutputChannels:
case PluginIssueType::TooManyMidiOutputChannels:
return "too many MIDI output channels";
case noOutputChannel:
case PluginIssueType::NoOutputChannel:
return "no audio output channel";
case portHasNoDef:
case PluginIssueType::PortHasNoDef:
return "port is missing default value";
case portHasNoMin:
case PluginIssueType::PortHasNoMin:
return "port is missing min value";
case portHasNoMax:
case PluginIssueType::PortHasNoMax:
return "port is missing max value";
case minGreaterMax:
case PluginIssueType::MinGreaterMax:
return "port minimum is greater than maximum";
case defaultValueNotInRange:
case PluginIssueType::DefaultValueNotInRange:
return "default value is not in range [min, max]";
case logScaleMinMissing:
case PluginIssueType::LogScaleMinMissing:
return "logscale requires minimum value";
case logScaleMaxMissing:
case PluginIssueType::LogScaleMaxMissing:
return "logscale requires maximum value";
case logScaleMinMaxDifferentSigns:
case PluginIssueType::LogScaleMinMaxDifferentSigns:
return "logscale with min < 0 < max";
case featureNotSupported:
case PluginIssueType::FeatureNotSupported:
return "required feature not supported";
case badPortType:
case PluginIssueType::BadPortType:
return "unsupported port type";
case blacklisted:
case PluginIssueType::Blacklisted:
return "blacklisted plugin";
case noIssue:
case PluginIssueType::NoIssue:
return nullptr;
}
return nullptr;

View File

@@ -48,7 +48,7 @@ public:
m_dataMutex()
{
setJournalling( false );
m_previewInstrumentTrack = dynamic_cast<InstrumentTrack *>( Track::create( Track::InstrumentTrack, this ) );
m_previewInstrumentTrack = dynamic_cast<InstrumentTrack *>( Track::create( Track::Type::Instrument, this ) );
m_previewInstrumentTrack->setJournalling( false );
m_previewInstrumentTrack->setPreviewMode( true );
}
@@ -116,7 +116,7 @@ PreviewTrackContainer * PresetPreviewPlayHandle::s_previewTC;
PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file, bool _load_by_plugin, DataFile *dataFile ) :
PlayHandle( TypePresetPreviewHandle ),
PlayHandle( Type::PresetPreviewHandle ),
m_previewNote(nullptr)
{
setUsesBuffer( false );
@@ -169,7 +169,7 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
// make sure, our preset-preview-track does not appear in any MIDI-
// devices list, so just disable receiving/sending MIDI-events at all
s_previewTC->previewInstrumentTrack()->
midiPort()->setMode( MidiPort::Disabled );
midiPort()->setMode( MidiPort::Mode::Disabled );
Engine::audioEngine()->requestChangeInModel();
// create note-play-handle for it

View File

@@ -58,7 +58,7 @@ void ProjectJournal::undo()
if( jo )
{
DataFile curState( DataFile::JournalData );
DataFile curState( DataFile::Type::JournalData );
jo->saveState( curState, curState.content() );
m_redoCheckPoints.push( CheckPoint( c.joID, curState ) );
@@ -83,7 +83,7 @@ void ProjectJournal::redo()
if( jo )
{
DataFile curState( DataFile::JournalData );
DataFile curState( DataFile::Type::JournalData );
jo->saveState( curState, curState.content() );
m_undoCheckPoints.push( CheckPoint( c.joID, curState ) );
@@ -115,7 +115,7 @@ void ProjectJournal::addJournalCheckPoint( JournallingObject *jo )
{
m_redoCheckPoints.clear();
DataFile dataFile( DataFile::JournalData );
DataFile dataFile( DataFile::Type::JournalData );
jo->saveState( dataFile, dataFile.content() );
m_undoCheckPoints.push( CheckPoint( jo->id(), dataFile ) );

View File

@@ -42,15 +42,15 @@ namespace lmms
const std::array<ProjectRenderer::FileEncodeDevice, 5> ProjectRenderer::fileEncodeDevices
{
FileEncodeDevice{ ProjectRenderer::WaveFile,
FileEncodeDevice{ ProjectRenderer::ExportFileFormat::Wave,
QT_TRANSLATE_NOOP( "ProjectRenderer", "WAV (*.wav)" ),
".wav", &AudioFileWave::getInst },
FileEncodeDevice{ ProjectRenderer::FlacFile,
FileEncodeDevice{ ProjectRenderer::ExportFileFormat::Flac,
QT_TRANSLATE_NOOP("ProjectRenderer", "FLAC (*.flac)"),
".flac",
&AudioFileFlac::getInst
},
FileEncodeDevice{ ProjectRenderer::OggFile,
FileEncodeDevice{ ProjectRenderer::ExportFileFormat::Ogg,
QT_TRANSLATE_NOOP( "ProjectRenderer", "OGG (*.ogg)" ),
".ogg",
#ifdef LMMS_HAVE_OGGVORBIS
@@ -59,7 +59,7 @@ const std::array<ProjectRenderer::FileEncodeDevice, 5> ProjectRenderer::fileEnco
nullptr
#endif
},
FileEncodeDevice{ ProjectRenderer::MP3File,
FileEncodeDevice{ ProjectRenderer::ExportFileFormat::MP3,
QT_TRANSLATE_NOOP( "ProjectRenderer", "MP3 (*.mp3)" ),
".mp3",
#ifdef LMMS_HAVE_MP3LAME
@@ -71,7 +71,7 @@ const std::array<ProjectRenderer::FileEncodeDevice, 5> ProjectRenderer::fileEnco
// Insert your own file-encoder infos here.
// Maybe one day the user can add own encoders inside the program.
FileEncodeDevice{ ProjectRenderer::NumFileFormats, nullptr, nullptr, nullptr }
FileEncodeDevice{ ProjectRenderer::ExportFileFormat::Count, nullptr, nullptr, nullptr }
} ;
@@ -80,7 +80,7 @@ const std::array<ProjectRenderer::FileEncodeDevice, 5> ProjectRenderer::fileEnco
ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySettings,
const OutputSettings & outputSettings,
ExportFileFormats exportFileFormat,
ExportFileFormat exportFileFormat,
const QString & outputFilename ) :
QThread( Engine::audioEngine() ),
m_fileDev( nullptr ),
@@ -88,7 +88,7 @@ ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySe
m_progress( 0 ),
m_abort( false )
{
AudioFileDeviceInstantiaton audioEncoderFactory = fileEncodeDevices[exportFileFormat].m_getDevInst;
AudioFileDeviceInstantiaton audioEncoderFactory = fileEncodeDevices[static_cast<std::size_t>(exportFileFormat)].m_getDevInst;
if (audioEncoderFactory)
{
@@ -110,11 +110,11 @@ ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySe
// Little help function for getting file format from a file extension
// (only for registered file-encoders).
ProjectRenderer::ExportFileFormats ProjectRenderer::getFileFormatFromExtension(
ProjectRenderer::ExportFileFormat ProjectRenderer::getFileFormatFromExtension(
const QString & _ext )
{
int idx = 0;
while( fileEncodeDevices[idx].m_fileFormat != NumFileFormats )
while( fileEncodeDevices[idx].m_fileFormat != ExportFileFormat::Count )
{
if( QString( fileEncodeDevices[idx].m_extension ) == _ext )
{
@@ -123,16 +123,16 @@ ProjectRenderer::ExportFileFormats ProjectRenderer::getFileFormatFromExtension(
++idx;
}
return( WaveFile ); // Default.
return( ExportFileFormat::Wave ); // Default.
}
QString ProjectRenderer::getFileExtensionFromFormat(
ExportFileFormats fmt )
ExportFileFormat fmt )
{
return fileEncodeDevices[fmt].m_extension;
return fileEncodeDevices[static_cast<std::size_t>(fmt)].m_extension;
}

View File

@@ -37,7 +37,7 @@ namespace lmms
RenderManager::RenderManager(
const AudioEngine::qualitySettings & qualitySettings,
const OutputSettings & outputSettings,
ProjectRenderer::ExportFileFormats fmt,
ProjectRenderer::ExportFileFormat fmt,
QString outputPath) :
m_qualitySettings(qualitySettings),
m_oldQualitySettings( Engine::audioEngine()->currentQualitySettings() ),
@@ -102,11 +102,11 @@ void RenderManager::renderTracks()
// find all currently unnmuted tracks -- we want to render these.
for (const auto& tk : tl)
{
Track::TrackTypes type = tk->type();
Track::Type type = tk->type();
// Don't render automation tracks
if ( tk->isMuted() == false &&
( type == Track::InstrumentTrack || type == Track::SampleTrack ) )
( type == Track::Type::Instrument || type == Track::Type::Sample ) )
{
m_unmuted.push_back(tk);
}
@@ -115,11 +115,11 @@ void RenderManager::renderTracks()
const TrackContainer::TrackList t2 = Engine::patternStore()->tracks();
for (const auto& tk : t2)
{
Track::TrackTypes type = tk->type();
Track::Type type = tk->type();
// Don't render automation tracks
if ( tk->isMuted() == false &&
( type == Track::InstrumentTrack || type == Track::SampleTrack ) )
( type == Track::Type::Instrument || type == Track::Type::Sample ) )
{
m_unmuted.push_back(tk);
}

View File

@@ -738,7 +738,7 @@ bool SampleBuffer::play(
// this holds the index of the first frame to play
f_cnt_t playFrame = std::max(state->m_frameIndex, startFrame);
if (loopMode == LoopOff)
if (loopMode == LoopMode::Off)
{
if (playFrame >= endFrame || (endFrame - playFrame) / freqFactor == 0)
{
@@ -746,7 +746,7 @@ bool SampleBuffer::play(
return false;
}
}
else if (loopMode == LoopOn)
else if (loopMode == LoopMode::On)
{
playFrame = getLoopedIndex(playFrame, loopStartFrame, loopEndFrame);
}
@@ -786,14 +786,14 @@ bool SampleBuffer::play(
// Advance
switch (loopMode)
{
case LoopOff:
case LoopMode::Off:
playFrame += srcData.input_frames_used;
break;
case LoopOn:
case LoopMode::On:
playFrame += srcData.input_frames_used;
playFrame = getLoopedIndex(playFrame, loopStartFrame, loopEndFrame);
break;
case LoopPingPong:
case LoopMode::PingPong:
{
f_cnt_t left = srcData.input_frames_used;
if (state->isBackwards())
@@ -825,14 +825,14 @@ bool SampleBuffer::play(
// Advance
switch (loopMode)
{
case LoopOff:
case LoopMode::Off:
playFrame += frames;
break;
case LoopOn:
case LoopMode::On:
playFrame += frames;
playFrame = getLoopedIndex(playFrame, loopStartFrame, loopEndFrame);
break;
case LoopPingPong:
case LoopMode::PingPong:
{
f_cnt_t left = frames;
if (state->isBackwards())
@@ -883,14 +883,14 @@ sampleFrame * SampleBuffer::getSampleFragment(
f_cnt_t end
) const
{
if (loopMode == LoopOff)
if (loopMode == LoopMode::Off)
{
if (index + frames <= end)
{
return m_data + index;
}
}
else if (loopMode == LoopOn)
else if (loopMode == LoopMode::On)
{
if (index + frames <= loopEnd)
{
@@ -907,13 +907,13 @@ sampleFrame * SampleBuffer::getSampleFragment(
*tmp = MM_ALLOC<sampleFrame>( frames);
if (loopMode == LoopOff)
if (loopMode == LoopMode::Off)
{
f_cnt_t available = end - index;
memcpy(*tmp, m_data + index, available * BYTES_PER_FRAME);
memset(*tmp + available, 0, (frames - available) * BYTES_PER_FRAME);
}
else if (loopMode == LoopOn)
else if (loopMode == LoopMode::On)
{
f_cnt_t copied = std::min(frames, loopEnd - index);
memcpy(*tmp, m_data + index, copied * BYTES_PER_FRAME);

View File

@@ -53,7 +53,7 @@ SampleClip::SampleClip( Track * _track ) :
this, SLOT(updateLength()));
//care about positionmarker
gui::TimeLineWidget* timeLine = Engine::getSong()->getPlayPos( Engine::getSong()->Mode_PlaySong ).m_timeLine;
gui::TimeLineWidget* timeLine = Engine::getSong()->getPlayPos( Song::PlayMode::Song ).m_timeLine;
if( timeLine )
{
connect( timeLine, SIGNAL(positionMarkerMoved()), this, SLOT(playbackPositionChanged()));
@@ -74,11 +74,11 @@ SampleClip::SampleClip( Track * _track ) :
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::PatternContainer:
case TrackContainer::Type::Pattern:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
case TrackContainer::Type::Song:
// move down
default:
setAutoResize( false );
@@ -179,7 +179,7 @@ void SampleClip::toggleRecord()
void SampleClip::playbackPositionChanged()
{
Engine::audioEngine()->removePlayHandlesOfTypes( getTrack(), PlayHandle::TypeSamplePlayHandle );
Engine::audioEngine()->removePlayHandlesOfTypes( getTrack(), PlayHandle::Type::SamplePlayHandle );
auto st = dynamic_cast<SampleTrack*>(getTrack());
st->setPlayingClips( false );
}

View File

@@ -36,7 +36,7 @@ namespace lmms
SamplePlayHandle::SamplePlayHandle( SampleBuffer* sampleBuffer , bool ownAudioPort ) :
PlayHandle( TypeSamplePlayHandle ),
PlayHandle( Type::SamplePlayHandle ),
m_sampleBuffer( sharedObject::ref( sampleBuffer ) ),
m_doneMayReturnTrue( true ),
m_frame( 0 ),

View File

@@ -37,7 +37,7 @@ namespace lmms
SampleRecordHandle::SampleRecordHandle( SampleClip* clip ) :
PlayHandle( TypeSamplePlayHandle ),
PlayHandle( Type::SamplePlayHandle ),
m_framesRecorded( 0 ),
m_minLength( clip->length() ),
m_track( clip->getTrack() ),

View File

@@ -68,7 +68,7 @@ tick_t TimePos::s_ticksPerBar = DefaultTicksPerBar;
Song::Song() :
TrackContainer(),
m_globalAutomationTrack( dynamic_cast<AutomationTrack *>(
Track::create( Track::HiddenAutomationTrack,
Track::create( Track::Type::HiddenAutomation,
this ) ) ),
m_tempoModel( DefaultTempo, MinTempo, MaxTempo, this, tr( "Tempo" ) ),
m_timeSigModel( this ),
@@ -89,7 +89,7 @@ Song::Song() :
m_savingProject( false ),
m_loadingProject( false ),
m_isCancelled( false ),
m_playMode( Mode_None ),
m_playMode( PlayMode::None ),
m_length( 0 ),
m_midiClipToPlay( nullptr ),
m_loopMidiClip( false ),
@@ -117,7 +117,7 @@ Song::Song() :
this, SLOT(masterPitchChanged()));*/
qRegisterMetaType<lmms::Note>( "lmms::Note" );
setType( SongContainer );
setType( Type::Song );
for (auto& scale : m_scales) {scale = std::make_shared<Scale>();}
for (auto& keymap : m_keymaps) {keymap = std::make_shared<Keymap>();}
@@ -186,11 +186,11 @@ void Song::setTimeSignature()
void Song::savePos()
{
gui::TimeLineWidget* tl = m_playPos[m_playMode].m_timeLine;
gui::TimeLineWidget* tl = getPlayPos().m_timeLine;
if( tl != nullptr )
{
tl->savePos( m_playPos[m_playMode] );
tl->savePos( getPlayPos() );
}
}
@@ -205,7 +205,7 @@ void Song::processNextBuffer()
if (!m_playing) { return; }
// At the beginning of the song, we have to reset the LFOs
if (m_playMode == Mode_PlaySong && getPlayPos() == 0)
if (m_playMode == PlayMode::Song && getPlayPos() == 0)
{
EnvelopeAndLfoParameters::instances()->reset();
}
@@ -216,11 +216,11 @@ void Song::processNextBuffer()
// Determine the list of tracks to play and the clip number
switch (m_playMode)
{
case Mode_PlaySong:
case PlayMode::Song:
trackList = tracks();
break;
case Mode_PlayPattern:
case PlayMode::Pattern:
if (Engine::patternStore()->numOfPatterns() > 0)
{
clipNum = Engine::patternStore()->currentPattern();
@@ -228,7 +228,7 @@ void Song::processNextBuffer()
}
break;
case Mode_PlayMidiClip:
case PlayMode::MidiClip:
if (m_midiClipToPlay)
{
clipNum = m_midiClipToPlay->getTrack()->getClipNum(m_midiClipToPlay);
@@ -291,11 +291,11 @@ void Song::processNextBuffer()
// If we are playing a pattern track, or a MIDI clip with no loop enabled,
// loop back to the beginning when we reach the end
if (m_playMode == Mode_PlayPattern)
if (m_playMode == PlayMode::Pattern)
{
enforceLoop(TimePos{0}, TimePos{Engine::patternStore()->lengthOfCurrentPattern(), 0});
}
else if (m_playMode == Mode_PlayMidiClip && m_loopMidiClip && !loopEnabled)
else if (m_playMode == PlayMode::MidiClip && m_loopMidiClip && !loopEnabled)
{
enforceLoop(TimePos{0}, m_midiClipToPlay->length());
}
@@ -349,9 +349,9 @@ void Song::processNextBuffer()
frameOffsetInPeriod += framesToPlay;
frameOffsetInTick += framesToPlay;
getPlayPos().setCurrentFrame(frameOffsetInTick);
m_elapsedMilliSeconds[m_playMode] += TimePos::ticksToMilliseconds(framesToPlay / framesPerTick, getTempo());
m_elapsedBars = m_playPos[Mode_PlaySong].getBar();
m_elapsedTicks = (m_playPos[Mode_PlaySong].getTicks() % ticksPerBar()) / 48;
m_elapsedMilliSeconds[static_cast<std::size_t>(m_playMode)] += TimePos::ticksToMilliseconds(framesToPlay / framesPerTick, getTempo());
m_elapsedBars = getPlayPos(PlayMode::Song).getBar();
m_elapsedTicks = (getPlayPos(PlayMode::Song).getTicks() % ticksPerBar()) / 48;
}
}
@@ -367,12 +367,12 @@ void Song::processAutomations(const TrackList &tracklist, TimePos timeStart, fpp
switch (m_playMode)
{
case Mode_PlaySong:
case PlayMode::Song:
break;
case Mode_PlayPattern:
case PlayMode::Pattern:
{
Q_ASSERT(tracklist.size() == 1);
Q_ASSERT(tracklist.at(0)->type() == Track::PatternTrack);
Q_ASSERT(tracklist.at(0)->type() == Track::Type::Pattern);
auto patternTrack = dynamic_cast<PatternTrack*>(tracklist.at(0));
container = Engine::patternStore();
clipNum = patternTrack->patternIndex();
@@ -388,7 +388,7 @@ void Song::processAutomations(const TrackList &tracklist, TimePos timeStart, fpp
Track::clipVector clips;
for (Track* track : tracks)
{
if (track->type() == Track::AutomationTrack) {
if (track->type() == Track::Type::Automation) {
track->getClipsInRange(clips, 0, timeStart);
}
}
@@ -444,12 +444,12 @@ void Song::setModified(bool value)
bool Song::isExportDone() const
{
return !isExporting() || m_playPos[m_playMode] >= m_exportSongEnd;
return !isExporting() || getPlayPos() >= m_exportSongEnd;
}
int Song::getExportProgress() const
{
TimePos pos = m_playPos[m_playMode];
TimePos pos = getPlayPos();
if (pos >= m_exportSongEnd)
{
@@ -486,7 +486,7 @@ void Song::playSong()
stop();
}
m_playMode = Mode_PlaySong;
m_playMode = PlayMode::Song;
m_playing = true;
m_paused = false;
@@ -525,7 +525,7 @@ void Song::playPattern()
stop();
}
m_playMode = Mode_PlayPattern;
m_playMode = PlayMode::Pattern;
m_playing = true;
m_paused = false;
@@ -551,7 +551,7 @@ void Song::playMidiClip( const MidiClip* midiClipToPlay, bool loop )
if( m_midiClipToPlay != nullptr )
{
m_playMode = Mode_PlayMidiClip;
m_playMode = PlayMode::MidiClip;
m_playing = true;
m_paused = false;
}
@@ -589,14 +589,14 @@ void Song::updateLength()
void Song::setPlayPos( tick_t ticks, PlayModes playMode )
void Song::setPlayPos( tick_t ticks, PlayMode playMode )
{
tick_t ticksFromPlayMode = m_playPos[playMode].getTicks();
tick_t ticksFromPlayMode = getPlayPos(playMode).getTicks();
m_elapsedTicks += ticksFromPlayMode - ticks;
m_elapsedMilliSeconds[playMode] += TimePos::ticksToMilliseconds( ticks - ticksFromPlayMode, getTempo() );
m_playPos[playMode].setTicks( ticks );
m_playPos[playMode].setCurrentFrame( 0.0f );
m_playPos[playMode].setJumped( true );
m_elapsedMilliSeconds[static_cast<std::size_t>(playMode)] += TimePos::ticksToMilliseconds( ticks - ticksFromPlayMode, getTempo() );
getPlayPos(playMode).setTicks( ticks );
getPlayPos(playMode).setCurrentFrame( 0.0f );
getPlayPos(playMode).setJumped( true );
// send a signal if playposition changes during playback
if( isPlaying() )
@@ -634,7 +634,7 @@ void Song::togglePause()
void Song::stop()
{
// do not stop/reset things again if we're stopped already
if( m_playMode == Mode_None )
if( m_playMode == PlayMode::None )
{
return;
}
@@ -644,7 +644,7 @@ void Song::stop()
// To avoid race conditions with the processing threads
Engine::audioEngine()->requestChangeInModel();
TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine;
TimeLineWidget * tl = getPlayPos().m_timeLine;
m_paused = false;
m_recording = true;
@@ -652,41 +652,41 @@ void Song::stop()
{
switch( tl->behaviourAtStop() )
{
case TimeLineWidget::BackToZero:
m_playPos[m_playMode].setTicks(0);
m_elapsedMilliSeconds[m_playMode] = 0;
case TimeLineWidget::BehaviourAtStopState::BackToZero:
getPlayPos().setTicks(0);
m_elapsedMilliSeconds[static_cast<std::size_t>(m_playMode)] = 0;
break;
case TimeLineWidget::BackToStart:
case TimeLineWidget::BehaviourAtStopState::BackToStart:
if( tl->savedPos() >= 0 )
{
m_playPos[m_playMode].setTicks(tl->savedPos().getTicks());
getPlayPos().setTicks(tl->savedPos().getTicks());
setToTime(tl->savedPos());
tl->savePos( -1 );
}
break;
case TimeLineWidget::KeepStopPosition:
case TimeLineWidget::BehaviourAtStopState::KeepStopPosition:
break;
}
}
else
{
m_playPos[m_playMode].setTicks( 0 );
m_elapsedMilliSeconds[m_playMode] = 0;
getPlayPos().setTicks( 0 );
m_elapsedMilliSeconds[static_cast<std::size_t>(m_playMode)] = 0;
}
m_playing = false;
m_elapsedMilliSeconds[Mode_None] = m_elapsedMilliSeconds[m_playMode];
m_playPos[Mode_None].setTicks(m_playPos[m_playMode].getTicks());
m_elapsedMilliSeconds[static_cast<std::size_t>(PlayMode::None)] = m_elapsedMilliSeconds[static_cast<std::size_t>(m_playMode)];
getPlayPos(PlayMode::None).setTicks(getPlayPos().getTicks());
m_playPos[m_playMode].setCurrentFrame( 0 );
getPlayPos().setCurrentFrame( 0 );
m_vstSyncController.setPlaybackState( m_exporting );
m_vstSyncController.setAbsolutePosition(
m_playPos[m_playMode].getTicks()
+ m_playPos[m_playMode].currentFrame()
getPlayPos().getTicks()
+ getPlayPos().currentFrame()
/ (double) Engine::framesPerTick() );
// remove all note-play-handles that are active
@@ -701,7 +701,7 @@ void Song::stop()
}
m_oldAutomatedValues.clear();
m_playMode = Mode_None;
m_playMode = PlayMode::None;
Engine::audioEngine()->doneChangeInModel();
@@ -721,19 +721,19 @@ void Song::startExport()
if (m_renderBetweenMarkers)
{
m_exportSongBegin = m_exportLoopBegin = m_playPos[Mode_PlaySong].m_timeLine->loopBegin();
m_exportSongEnd = m_exportLoopEnd = m_playPos[Mode_PlaySong].m_timeLine->loopEnd();
m_exportSongBegin = m_exportLoopBegin = getPlayPos(PlayMode::Song).m_timeLine->loopBegin();
m_exportSongEnd = m_exportLoopEnd = getPlayPos(PlayMode::Song).m_timeLine->loopEnd();
m_playPos[Mode_PlaySong].setTicks( m_playPos[Mode_PlaySong].m_timeLine->loopBegin().getTicks() );
getPlayPos(PlayMode::Song).setTicks( getPlayPos(PlayMode::Song).m_timeLine->loopBegin().getTicks() );
}
else
{
m_exportSongEnd = TimePos(m_length, 0);
// Handle potentially ridiculous loop points gracefully.
if (m_loopRenderCount > 1 && m_playPos[Mode_PlaySong].m_timeLine->loopEnd() > m_exportSongEnd)
if (m_loopRenderCount > 1 && getPlayPos(PlayMode::Song).m_timeLine->loopEnd() > m_exportSongEnd)
{
m_exportSongEnd = m_playPos[Mode_PlaySong].m_timeLine->loopEnd();
m_exportSongEnd = getPlayPos(PlayMode::Song).m_timeLine->loopEnd();
}
if (!m_exportLoop)
@@ -741,17 +741,17 @@ void Song::startExport()
m_exportSongBegin = TimePos(0,0);
// FIXME: remove this check once we load timeline in headless mode
if (m_playPos[Mode_PlaySong].m_timeLine)
if (getPlayPos(PlayMode::Song).m_timeLine)
{
m_exportLoopBegin = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd &&
m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ?
m_playPos[Mode_PlaySong].m_timeLine->loopBegin() : TimePos(0,0);
m_exportLoopEnd = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd &&
m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ?
m_playPos[Mode_PlaySong].m_timeLine->loopEnd() : TimePos(0,0);
m_exportLoopBegin = getPlayPos(PlayMode::Song).m_timeLine->loopBegin() < m_exportSongEnd &&
getPlayPos(PlayMode::Song).m_timeLine->loopEnd() <= m_exportSongEnd ?
getPlayPos(PlayMode::Song).m_timeLine->loopBegin() : TimePos(0,0);
m_exportLoopEnd = getPlayPos(PlayMode::Song).m_timeLine->loopBegin() < m_exportSongEnd &&
getPlayPos(PlayMode::Song).m_timeLine->loopEnd() <= m_exportSongEnd ?
getPlayPos(PlayMode::Song).m_timeLine->loopEnd() : TimePos(0,0);
}
m_playPos[Mode_PlaySong].setTicks( 0 );
getPlayPos(PlayMode::Song).setTicks( 0 );
}
m_exportEffectiveLength = (m_exportLoopBegin - m_exportSongBegin) + (m_exportLoopEnd - m_exportLoopBegin)
@@ -784,7 +784,7 @@ void Song::insertBar()
{
// FIXME journal batch of tracks instead of each track individually
if (track->numOfClips() > 0) { track->addJournalCheckPoint(); }
track->insertBar(m_playPos[Mode_PlaySong]);
track->insertBar(getPlayPos(PlayMode::Song));
}
m_tracksMutex.unlock();
}
@@ -799,7 +799,7 @@ void Song::removeBar()
{
// FIXME journal batch of tracks instead of each track individually
if (track->numOfClips() > 0) { track->addJournalCheckPoint(); }
track->removeBar(m_playPos[Mode_PlaySong]);
track->removeBar(getPlayPos(PlayMode::Song));
}
m_tracksMutex.unlock();
}
@@ -809,7 +809,7 @@ void Song::removeBar()
void Song::addPatternTrack()
{
Track * t = Track::create(Track::PatternTrack, this);
Track * t = Track::create(Track::Type::Pattern, this);
Engine::patternStore()->setCurrentPattern(dynamic_cast<PatternTrack*>(t)->patternIndex());
}
@@ -818,7 +818,7 @@ void Song::addPatternTrack()
void Song::addSampleTrack()
{
( void )Track::create( Track::SampleTrack, this );
( void )Track::create( Track::Type::Sample, this );
}
@@ -826,7 +826,7 @@ void Song::addSampleTrack()
void Song::addAutomationTrack()
{
( void )Track::create( Track::AutomationTrack, this );
( void )Track::create( Track::Type::Automation, this );
}
@@ -859,9 +859,9 @@ void Song::clearProject()
stop();
}
for( int i = 0; i < Mode_Count; i++ )
for( int i = 0; i < PlayModeCount; i++ )
{
setPlayPos( 0, ( PlayModes )i );
setPlayPos( 0, ( PlayMode )i );
}
@@ -960,15 +960,15 @@ void Song::createNewProject()
setProjectFileName("");
Track * t;
t = Track::create( Track::InstrumentTrack, this );
t = Track::create( Track::Type::Instrument, this );
dynamic_cast<InstrumentTrack * >( t )->loadInstrument(
"tripleoscillator" );
t = Track::create(Track::InstrumentTrack, Engine::patternStore());
t = Track::create(Track::Type::Instrument, Engine::patternStore());
dynamic_cast<InstrumentTrack * >( t )->loadInstrument(
"kicker" );
Track::create( Track::SampleTrack, this );
Track::create( Track::PatternTrack, this );
Track::create( Track::AutomationTrack, this );
Track::create( Track::Type::Sample, this );
Track::create( Track::Type::Pattern, this );
Track::create( Track::Type::Automation, this );
m_tempoModel.setInitValue( DefaultTempo );
m_timeSigModel.reset();
@@ -1080,10 +1080,10 @@ void Song::loadProject( const QString & fileName )
m_masterVolumeModel.loadSettings( dataFile.head(), "mastervol" );
m_masterPitchModel.loadSettings( dataFile.head(), "masterpitch" );
if( m_playPos[Mode_PlaySong].m_timeLine )
if( getPlayPos(PlayMode::Song).m_timeLine )
{
// reset loop-point-state
m_playPos[Mode_PlaySong].m_timeLine->toggleLoopPoints( 0 );
getPlayPos(PlayMode::Song).m_timeLine->toggleLoopPoints( 0 );
}
if( !dataFile.content().firstChildElement( "track" ).isNull() )
@@ -1119,7 +1119,7 @@ void Song::loadProject( const QString & fileName )
if( nd.isElement() && nd.nodeName() == "track" )
{
++m_nLoadingTrack;
if (nd.toElement().attribute("type").toInt() == Track::PatternTrack)
if (static_cast<Track::Type>(nd.toElement().attribute("type").toInt()) == Track::Type::Pattern)
{
n += nd.toElement().elementsByTagName("patterntrack").at(0)
.toElement().firstChildElement().childNodes().count();
@@ -1167,9 +1167,9 @@ void Song::loadProject( const QString & fileName )
{
getGUI()->getProjectNotes()->SerializingObject::restoreState( node.toElement() );
}
else if( node.nodeName() == m_playPos[Mode_PlaySong].m_timeLine->nodeName() )
else if( node.nodeName() == getPlayPos(PlayMode::Song).m_timeLine->nodeName() )
{
m_playPos[Mode_PlaySong].m_timeLine->restoreState( node.toElement() );
getPlayPos(PlayMode::Song).m_timeLine->restoreState( node.toElement() );
}
}
}
@@ -1185,7 +1185,7 @@ void Song::loadProject( const QString & fileName )
// Remove dummy controllers that was added for correct connections
m_controllers.erase(std::remove_if(m_controllers.begin(), m_controllers.end(),
[](Controller* c){return c->type() == Controller::DummyController;}),
[](Controller* c){return c->type() == Controller::ControllerType::Dummy;}),
m_controllers.end());
// resolve all IDs so that autoModels are automated
@@ -1235,7 +1235,7 @@ bool Song::saveProjectFile(const QString & filename, bool withResources)
{
using gui::getGUI;
DataFile dataFile( DataFile::SongProject );
DataFile dataFile( DataFile::Type::SongProject );
m_savingProject = true;
m_tempoModel.saveSettings( dataFile, dataFile.head(), "bpm" );
@@ -1253,7 +1253,7 @@ bool Song::saveProjectFile(const QString & filename, bool withResources)
getGUI()->pianoRoll()->saveState( dataFile, dataFile.content() );
getGUI()->automationEditor()->m_editor->saveState( dataFile, dataFile.content() );
getGUI()->getProjectNotes()->SerializingObject::saveState( dataFile, dataFile.content() );
m_playPos[Mode_PlaySong].m_timeLine->saveState( dataFile, dataFile.content() );
getPlayPos(PlayMode::Song).m_timeLine->saveState( dataFile, dataFile.content() );
}
saveControllerStates( dataFile, dataFile.content() );
@@ -1280,7 +1280,7 @@ bool Song::guiSaveProject()
// Save the current song with the given filename
bool Song::guiSaveProjectAs(const QString & filename)
{
DataFile dataFile(DataFile::SongProject);
DataFile dataFile(DataFile::Type::SongProject);
QString fileNameWithExtension = dataFile.nameWithExtension(filename);
bool withResources = m_saveOptions.saveAsProjectBundle.value();
@@ -1328,7 +1328,7 @@ void Song::restoreControllerStates( const QDomElement & element )
else
{
// Fix indices to ensure correct connections
m_controllers.push_back(Controller::create(Controller::DummyController, this));
m_controllers.push_back(Controller::create(Controller::ControllerType::Dummy, this));
}
node = node.nextSibling();

View File

@@ -40,8 +40,8 @@ TempoSyncKnobModel::TempoSyncKnobModel( const float _val, const float _min,
const float _scale, Model * _parent,
const QString & _display_name ) :
FloatModel( _val, _min, _max, _step, _parent, _display_name ),
m_tempoSyncMode( SyncNone ),
m_tempoLastSyncMode( SyncNone ),
m_tempoSyncMode( SyncMode::None ),
m_tempoLastSyncMode( SyncMode::None ),
m_scale( _scale ),
m_custom( _parent )
{
@@ -55,15 +55,15 @@ TempoSyncKnobModel::TempoSyncKnobModel( const float _val, const float _min,
void TempoSyncKnobModel::setTempoSync( QAction * _item )
{
setTempoSync( _item->data().toInt() );
setTempoSync( static_cast<SyncMode>(_item->data().toInt()) );
}
void TempoSyncKnobModel::setTempoSync( int _note_type )
void TempoSyncKnobModel::setTempoSync( SyncMode _note_type )
{
setSyncMode( ( TempoSyncMode ) _note_type );
setSyncMode( _note_type );
Engine::getSong()->setModified();
}
@@ -74,34 +74,34 @@ void TempoSyncKnobModel::calculateTempoSyncTime( bpm_t _bpm )
{
float conversionFactor = 1.0;
if( m_tempoSyncMode )
if( m_tempoSyncMode != SyncMode::None )
{
switch( m_tempoSyncMode )
{
case SyncCustom:
case SyncMode::Custom:
conversionFactor =
static_cast<float>( m_custom.getDenominator() ) /
static_cast<float>( m_custom.getNumerator() );
break;
case SyncDoubleWholeNote:
case SyncMode::DoubleWholeNote:
conversionFactor = 0.125;
break;
case SyncWholeNote:
case SyncMode::WholeNote:
conversionFactor = 0.25;
break;
case SyncHalfNote:
case SyncMode::HalfNote:
conversionFactor = 0.5;
break;
case SyncQuarterNote:
case SyncMode::QuarterNote:
conversionFactor = 1.0;
break;
case SyncEighthNote:
case SyncMode::EighthNote:
conversionFactor = 2.0;
break;
case SyncSixteenthNote:
case SyncMode::SixteenthNote:
conversionFactor = 4.0;
break;
case SyncThirtysecondNote:
case SyncMode::ThirtysecondNote:
conversionFactor = 8.0;
break;
default: ;
@@ -138,18 +138,18 @@ void TempoSyncKnobModel::loadSettings( const QDomElement & _this,
{
FloatModel::loadSettings( _this, _name );
m_custom.loadSettings( _this, _name );
setSyncMode( ( TempoSyncMode ) _this.attribute( _name + "_syncmode" ).toInt() );
setSyncMode( ( SyncMode ) _this.attribute( _name + "_syncmode" ).toInt() );
}
void TempoSyncKnobModel::setSyncMode( TempoSyncMode _new_mode )
void TempoSyncKnobModel::setSyncMode( SyncMode _new_mode )
{
if( m_tempoSyncMode != _new_mode )
{
m_tempoSyncMode = _new_mode;
if( _new_mode == SyncCustom )
if( _new_mode == SyncMode::Custom )
{
connect( &m_custom, SIGNAL(dataChanged()),
this, SLOT(updateCustom()),
@@ -174,7 +174,7 @@ void TempoSyncKnobModel::setScale( float _new_scale )
void TempoSyncKnobModel::updateCustom()
{
setSyncMode( SyncCustom );
setSyncMode( SyncMode::Custom );
}

View File

@@ -42,7 +42,7 @@ ToolPlugin * ToolPlugin::instantiate( const QString & _plugin_name, Model * _par
{
Plugin * p = Plugin::instantiate( _plugin_name, _parent, nullptr );
// check whether instantiated plugin is a tool
if( p->type() == Plugin::Tool )
if( p->type() == Plugin::Type::Tool )
{
// everything ok, so return pointer
return dynamic_cast<ToolPlugin *>( p );

View File

@@ -56,7 +56,7 @@ namespace lmms
*
* \todo check the definitions of all the properties - are they OK?
*/
Track::Track( TrackTypes type, TrackContainer * tc ) :
Track::Track( Type type, TrackContainer * tc ) :
Model( tc ), /*!< The track Model */
m_trackContainer( tc ), /*!< The track container object */
m_type( type ), /*!< The track type */
@@ -101,7 +101,7 @@ Track::~Track()
* \param tt The type of track to create
* \param tc The track container to attach to
*/
Track * Track::create( TrackTypes tt, TrackContainer * tc )
Track * Track::create( Type tt, TrackContainer * tc )
{
Engine::audioEngine()->requestChangeInModel();
@@ -109,13 +109,13 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc )
switch( tt )
{
case InstrumentTrack: t = new class InstrumentTrack( tc ); break;
case PatternTrack: t = new class PatternTrack( tc ); break;
case SampleTrack: t = new class SampleTrack( tc ); break;
// case EVENT_TRACK:
// case VIDEO_TRACK:
case AutomationTrack: t = new class AutomationTrack( tc ); break;
case HiddenAutomationTrack:
case Type::Instrument: t = new class InstrumentTrack( tc ); break;
case Type::Pattern: t = new class PatternTrack( tc ); break;
case Type::Sample: t = new class SampleTrack( tc ); break;
// case Type::Event:
// case Type::Video:
case Type::Automation: t = new class AutomationTrack( tc ); break;
case Type::HiddenAutomation:
t = new class AutomationTrack( tc, true ); break;
default: break;
}
@@ -145,7 +145,7 @@ Track * Track::create( const QDomElement & element, TrackContainer * tc )
Engine::audioEngine()->requestChangeInModel();
Track * t = create(
static_cast<TrackTypes>( element.attribute( "type" ).toInt() ),
static_cast<Type>( element.attribute( "type" ).toInt() ),
tc );
if( t != nullptr )
{
@@ -197,7 +197,7 @@ void Track::saveSettings( QDomDocument & doc, QDomElement & element )
{
element.setTagName( "track" );
}
element.setAttribute( "type", type() );
element.setAttribute( "type", static_cast<int>(type()) );
element.setAttribute( "name", name() );
m_mutedModel.saveSettings( doc, element, "muted" );
m_soloModel.saveSettings( doc, element, "solo" );
@@ -249,7 +249,7 @@ void Track::saveSettings( QDomDocument & doc, QDomElement & element )
*/
void Track::loadSettings( const QDomElement & element )
{
if( element.attribute( "type" ).toInt() != type() )
if( static_cast<Type>(element.attribute( "type" ).toInt()) != type() )
{
qWarning( "Current track-type does not match track-type of "
"settings-node!\n" );
@@ -613,7 +613,7 @@ void Track::toggleSolo()
{
track->setMuted(false);
}
else if (soloLegacyBehavior || track->type() != AutomationTrack)
else if (soloLegacyBehavior || track->type() != Type::Automation)
{
track->setMuted(true);
}
@@ -626,7 +626,7 @@ void Track::toggleSolo()
{
// Unless we are on the sololegacybehavior mode, only restores the
// mute state if the track isn't an Automation Track
if (soloLegacyBehavior || track->type() != AutomationTrack)
if (soloLegacyBehavior || track->type() != Type::Automation)
{
track->setMuted(track->m_mutedBeforeSolo);
}

View File

@@ -156,13 +156,13 @@ void TrackContainer::loadSettings( const QDomElement & _this )
int TrackContainer::countTracks( Track::TrackTypes _tt ) const
int TrackContainer::countTracks( Track::Type _tt ) const
{
int cnt = 0;
m_tracksMutex.lockForRead();
for (const auto& track : m_tracks)
{
if (track->type() == _tt || _tt == Track::NumTrackTypes)
if (track->type() == _tt || _tt == Track::Type::Count)
{
++cnt;
}
@@ -176,7 +176,7 @@ int TrackContainer::countTracks( Track::TrackTypes _tt ) const
void TrackContainer::addTrack( Track * _track )
{
if( _track->type() != Track::HiddenAutomationTrack )
if( _track->type() != Track::Type::HiddenAutomation )
{
_track->lock();
m_tracksMutex.lockForWrite();
@@ -268,9 +268,9 @@ AutomatedValueMap TrackContainer::automatedValuesFromTracks(const TrackList &tra
switch(track->type())
{
case Track::AutomationTrack:
case Track::HiddenAutomationTrack:
case Track::PatternTrack:
case Track::Type::Automation:
case Track::Type::HiddenAutomation:
case Track::Type::Pattern:
if (clipNum < 0) {
track->getClipsInRange(clips, 0, time);
} else {

View File

@@ -183,10 +183,10 @@ static void fixTrack(QDomElement & track, std::set<unsigned int> & automatedBase
return;
}
Track::TrackTypes const trackType = static_cast<Track::TrackTypes>(track.attribute("type").toInt());
Track::Type const trackType = static_cast<Track::Type>(track.attribute("type").toInt());
// BB tracks need special handling because they contain a track container of their own
if (trackType == Track::PatternTrack)
if (trackType == Track::Type::Pattern)
{
// Assuming that a BB track cannot contain another BB track here...
QDomNodeList subTracks = track.elementsByTagName("track");
@@ -233,7 +233,7 @@ static void fixAutomationTracks(QDomElement & song, std::set<unsigned int> const
for (int i = 0; i < tracks.size(); ++i)
{
QDomElement currentTrack = tracks.item(i).toElement();
if (currentTrack.attribute("type").toInt() != Track::AutomationTrack)
if (static_cast<Track::Type>(currentTrack.attribute("type").toInt()) != Track::Type::Automation)
{
continue;
}

View File

@@ -58,8 +58,8 @@ bool AudioFileFlac::startEncoding()
switch (getOutputSettings().getBitDepth())
{
case OutputSettings::Depth_24Bit:
case OutputSettings::Depth_32Bit:
case OutputSettings::BitDepth::Depth24Bit:
case OutputSettings::BitDepth::Depth32Bit:
// FLAC does not support 32bit sampling, so take it as 24.
m_sfinfo.format |= SF_FORMAT_PCM_24;
break;
@@ -94,7 +94,7 @@ void AudioFileFlac::writeBuffer(surroundSampleFrame const* _ab, fpp_t const fram
OutputSettings::BitDepth depth = getOutputSettings().getBitDepth();
float clipvalue = std::nextafterf( -1.0f, 0.0f );
if (depth == OutputSettings::Depth_24Bit || depth == OutputSettings::Depth_32Bit) // Float encoding
if (depth == OutputSettings::BitDepth::Depth24Bit || depth == OutputSettings::BitDepth::Depth32Bit) // Float encoding
{
auto buf = std::vector<sample_t>(frames * channels());
for(fpp_t frame = 0; frame < frames; ++frame)

View File

@@ -94,11 +94,11 @@ MPEG_mode mapToMPEG_mode(OutputSettings::StereoMode stereoMode)
{
switch (stereoMode)
{
case OutputSettings::StereoMode_Stereo:
case OutputSettings::StereoMode::Stereo:
return STEREO;
case OutputSettings::StereoMode_JointStereo:
case OutputSettings::StereoMode::JointStereo:
return JOINT_STEREO;
case OutputSettings::StereoMode_Mono:
case OutputSettings::StereoMode::Mono:
return MONO;
default:
return NOT_SET;

View File

@@ -64,13 +64,13 @@ bool AudioFileWave::startEncoding()
switch( getOutputSettings().getBitDepth() )
{
case OutputSettings::Depth_32Bit:
case OutputSettings::BitDepth::Depth32Bit:
m_si.format |= SF_FORMAT_FLOAT;
break;
case OutputSettings::Depth_24Bit:
case OutputSettings::BitDepth::Depth24Bit:
m_si.format |= SF_FORMAT_PCM_24;
break;
case OutputSettings::Depth_16Bit:
case OutputSettings::BitDepth::Depth16Bit:
default:
m_si.format |= SF_FORMAT_PCM_16;
break;
@@ -102,7 +102,7 @@ void AudioFileWave::writeBuffer( const surroundSampleFrame * _ab,
{
OutputSettings::BitDepth bitDepth = getOutputSettings().getBitDepth();
if( bitDepth == OutputSettings::Depth_32Bit || bitDepth == OutputSettings::Depth_24Bit )
if( bitDepth == OutputSettings::BitDepth::Depth32Bit || bitDepth == OutputSettings::BitDepth::Depth24Bit )
{
auto buf = new float[_frames * channels()];
for( fpp_t frame = 0; frame < _frames; ++frame )

View File

@@ -121,7 +121,7 @@ void AudioPort::doProcessing()
if( ph->buffer() )
{
if( ph->usesBuffer()
&& ( ph->type() == PlayHandle::TypeNotePlayHandle
&& ( ph->type() == PlayHandle::Type::NotePlayHandle
|| !MixHelpers::isSilent( ph->buffer(), fpp ) ) )
{
m_bufferUsage = true;

View File

@@ -102,7 +102,7 @@ int notEmpty(const std::vector<float> &spectrum)
*
* return -1 on error
*/
int precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool normalized)
int precomputeWindow(float *window, unsigned int length, FFTWindow type, bool normalized)
{
if (window == nullptr) {return -1;}
@@ -117,23 +117,23 @@ int precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool
switch (type)
{
default:
case RECTANGULAR:
case FFTWindow::Rectangular:
for (unsigned int i = 0; i < length; i++) {window[i] = 1.0;}
gain = 1;
return 0;
case BLACKMAN_HARRIS:
case FFTWindow::BlackmanHarris:
a0 = 0.35875;
a1 = 0.48829;
a2 = 0.14128;
a3 = 0.01168;
break;
case HAMMING:
case FFTWindow::Hamming:
a0 = 0.54;
a1 = 1.0 - a0;
a2 = 0;
a3 = 0;
break;
case HANNING:
case FFTWindow::Hanning:
a0 = 0.5;
a1 = 1.0 - a0;
a2 = 0;

View File

@@ -39,7 +39,7 @@ namespace lmms
{
Plugin::PluginTypes Lv2ControlBase::check(const LilvPlugin *plugin,
Plugin::Type Lv2ControlBase::check(const LilvPlugin *plugin,
std::vector<PluginIssue> &issues)
{
// for some reason, all checks can be done by one processor...

View File

@@ -217,7 +217,7 @@ void Lv2Manager::initPlugins()
const LilvPlugin* curPlug = lilv_plugins_get(plugins, itr);
std::vector<PluginIssue> issues;
Plugin::PluginTypes type = Lv2ControlBase::check(curPlug, issues);
Plugin::Type type = Lv2ControlBase::check(curPlug, issues);
std::sort(issues.begin(), issues.end());
auto last = std::unique(issues.begin(), issues.end());
issues.erase(last, issues.end());
@@ -240,7 +240,7 @@ void Lv2Manager::initPlugins()
{
if(std::any_of(issues.begin(), issues.end(),
[](const PluginIssue& iss) {
return iss.type() == PluginIssueType::blacklisted; }))
return iss.type() == PluginIssueType::Blacklisted; }))
{
++blacklisted;
}

View File

@@ -126,7 +126,7 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
else if (isA(LV2_CORE__OutputPort)) { m_flow = Flow::Output; }
else {
m_flow = Flow::Unknown;
issue(unknownPortFlow, portName);
issue(PluginIssueType::UnknownPortFlow, portName);
}
m_def = .0f;
@@ -145,7 +145,7 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
if (isA(LV2_CORE__CVPort))
{
// currently not supported, but we can still check the metadata
issue(badPortType, "cvPort");
issue(PluginIssueType::BadPortType, "cvPort");
}
m_type = isA(LV2_CORE__CVPort) ? Type::Cv : Type::Control;
@@ -172,21 +172,21 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
}
};
takeRangeValue(def.get(), m_def, portHasNoDef);
takeRangeValue(def.get(), m_def, PluginIssueType::PortHasNoDef);
if (isToggle)
{
m_min = .0f;
m_max = 1.f;
if(def.get() && m_def != m_min && m_def != m_max)
{
issue(defaultValueNotInRange, portName);
issue(PluginIssueType::DefaultValueNotInRange, portName);
}
}
else
{
// take min/max
takeRangeValue(min.get(), m_min, portHasNoMin);
takeRangeValue(max.get(), m_max, portHasNoMax);
takeRangeValue(min.get(), m_min, PluginIssueType::PortHasNoMin);
takeRangeValue(max.get(), m_max, PluginIssueType::PortHasNoMax);
if(m_type == Type::Cv)
{
// no range is allowed and bashed to [-1,+1],
@@ -196,10 +196,10 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
m_min = -1.f;
m_max = +1.f;
}
else if(!m_min_set()) { issue(portHasNoMin, portName); }
else if(!m_max_set()) { issue(portHasNoMax, portName); }
else if(!m_min_set()) { issue(PluginIssueType::PortHasNoMin, portName); }
else if(!m_max_set()) { issue(PluginIssueType::PortHasNoMax, portName); }
}
if(m_min > m_max) { issue(minGreaterMax, portName); }
if(m_min > m_max) { issue(PluginIssueType::MinGreaterMax, portName); }
// sampleRate
if (hasProperty(LV2_CORE__sampleRate)) { m_sampleRate = true; }
@@ -207,7 +207,7 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
// default value
if (def.get())
{
if (m_def < m_min) { issue(defaultValueNotInRange, portName); }
if (m_def < m_min) { issue(PluginIssueType::DefaultValueNotInRange, portName); }
else if (m_def > m_max)
{
if(m_sampleRate)
@@ -215,7 +215,7 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
// multiplying with sample rate will hopefully lead us
// to a good default value
}
else { issue(defaultValueNotInRange, portName); }
else { issue(PluginIssueType::DefaultValueNotInRange, portName); }
}
}
@@ -254,7 +254,7 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
{
if (m_optional) { m_used = false; }
else {
issue(PluginIssueType::unknownPortType, portName);
issue(PluginIssueType::UnknownPortType, portName);
}
}
@@ -265,16 +265,16 @@ std::vector<PluginIssue> Meta::get(const LilvPlugin *plugin,
// be non-Lv2-conforming
if(m_min == std::numeric_limits<decltype(m_min)>::lowest())
{
issue(PluginIssueType::logScaleMinMissing, portName);
issue(PluginIssueType::LogScaleMinMissing, portName);
}
if(m_max == std::numeric_limits<decltype(m_max)>::max())
{
issue(PluginIssueType::logScaleMaxMissing, portName);
issue(PluginIssueType::LogScaleMaxMissing, portName);
}
// forbid min < 0 < max
if(m_min < 0.f && m_max > 0.f)
{
issue(PluginIssueType::logScaleMinMaxDifferentSigns, portName);
issue(PluginIssueType::LogScaleMinMaxDifferentSigns, portName);
}
m_logarithmic = true;
}

View File

@@ -61,7 +61,7 @@ struct MidiInputEvent
Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
Plugin::Type Lv2Proc::check(const LilvPlugin *plugin,
std::vector<PluginIssue>& issues)
{
unsigned maxPorts = lilv_plugin_get_num_ports(plugin);
@@ -79,7 +79,7 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
if (!Engine::ignorePluginBlacklist() &&
pluginBlacklist.find(pluginUri) != pluginBlacklist.end())
{
issues.emplace_back(blacklisted);
issues.emplace_back(PluginIssueType::Blacklisted);
}
for (unsigned portNum = 0; portNum < maxPorts; ++portNum)
@@ -106,19 +106,19 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
}
if (audioChannels[inCount] > 2)
issues.emplace_back(tooManyInputChannels,
issues.emplace_back(PluginIssueType::TooManyInputChannels,
std::to_string(audioChannels[inCount]));
if (audioChannels[outCount] == 0)
issues.emplace_back(noOutputChannel);
issues.emplace_back(PluginIssueType::NoOutputChannel);
else if (audioChannels[outCount] > 2)
issues.emplace_back(tooManyOutputChannels,
issues.emplace_back(PluginIssueType::TooManyOutputChannels,
std::to_string(audioChannels[outCount]));
if (midiChannels[inCount] > 1)
issues.emplace_back(tooManyMidiInputChannels,
issues.emplace_back(PluginIssueType::TooManyMidiInputChannels,
std::to_string(midiChannels[inCount]));
if (midiChannels[outCount] > 1)
issues.emplace_back(tooManyMidiOutputChannels,
issues.emplace_back(PluginIssueType::TooManyMidiOutputChannels,
std::to_string(midiChannels[outCount]));
AutoLilvNodes reqFeats(lilv_plugin_get_required_features(plugin));
@@ -128,7 +128,7 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
lilv_nodes_get(reqFeats.get(), itr));
if(!Lv2Features::isFeatureSupported(reqFeatName))
{
issues.emplace_back(featureNotSupported, reqFeatName);
issues.emplace_back(PluginIssueType::FeatureNotSupported, reqFeatName);
}
}
@@ -144,16 +144,16 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
{
// yes, this is not a Lv2 feature,
// but it's a feature in abstract sense
issues.emplace_back(featureNotSupported, ro);
issues.emplace_back(PluginIssueType::FeatureNotSupported, ro);
}
}
}
return (audioChannels[inCount] > 2 || audioChannels[outCount] > 2)
? Plugin::Undefined
? Plugin::Type::Undefined
: (audioChannels[inCount] > 0)
? Plugin::Effect
: Plugin::Instrument;
? Plugin::Type::Effect
: Plugin::Type::Instrument;
}

View File

@@ -59,7 +59,7 @@ QString Lv2SubPluginFeatures::pluginName(const LilvPlugin *plug)
Lv2SubPluginFeatures::Lv2SubPluginFeatures(Plugin::PluginTypes type) :
Lv2SubPluginFeatures::Lv2SubPluginFeatures(Plugin::Type type) :
SubPluginFeatures(type)
{
}

View File

@@ -363,9 +363,9 @@ int main( int argc, char * * argv )
new QCoreApplication( argc, argv ) :
new gui::MainApplication(argc, argv);
AudioEngine::qualitySettings qs( AudioEngine::qualitySettings::Mode_HighQuality );
OutputSettings os( 44100, OutputSettings::BitRateSettings(160, false), OutputSettings::Depth_16Bit, OutputSettings::StereoMode_JointStereo );
ProjectRenderer::ExportFileFormats eff = ProjectRenderer::WaveFile;
AudioEngine::qualitySettings qs( AudioEngine::qualitySettings::Mode::HighQuality );
OutputSettings os( 44100, OutputSettings::BitRateSettings(160, false), OutputSettings::BitDepth::Depth16Bit, OutputSettings::StereoMode::JointStereo );
ProjectRenderer::ExportFileFormat eff = ProjectRenderer::ExportFileFormat::Wave;
// second of two command-line parsing stages
for( int i = 1; i < argc; ++i )
@@ -517,23 +517,23 @@ int main( int argc, char * * argv )
if( ext == "wav" )
{
eff = ProjectRenderer::WaveFile;
eff = ProjectRenderer::ExportFileFormat::Wave;
}
#ifdef LMMS_HAVE_OGGVORBIS
else if( ext == "ogg" )
{
eff = ProjectRenderer::OggFile;
eff = ProjectRenderer::ExportFileFormat::Ogg;
}
#endif
#ifdef LMMS_HAVE_MP3LAME
else if( ext == "mp3" )
{
eff = ProjectRenderer::MP3File;
eff = ProjectRenderer::ExportFileFormat::MP3;
}
#endif
else if (ext == "flac")
{
eff = ProjectRenderer::FlacFile;
eff = ProjectRenderer::ExportFileFormat::Flac;
}
else
{
@@ -596,15 +596,15 @@ int main( int argc, char * * argv )
if( mode == "s" )
{
os.setStereoMode(OutputSettings::StereoMode_Stereo);
os.setStereoMode(OutputSettings::StereoMode::Stereo);
}
else if( mode == "j" )
{
os.setStereoMode(OutputSettings::StereoMode_JointStereo);
os.setStereoMode(OutputSettings::StereoMode::JointStereo);
}
else if( mode == "m" )
{
os.setStereoMode(OutputSettings::StereoMode_Mono);
os.setStereoMode(OutputSettings::StereoMode::Mono);
}
else
{
@@ -613,7 +613,7 @@ int main( int argc, char * * argv )
}
else if( arg =="--float" || arg == "-a" )
{
os.setBitDepth(OutputSettings::Depth_32Bit);
os.setBitDepth(OutputSettings::BitDepth::Depth32Bit);
}
else if( arg == "--interpolation" || arg == "-i" )
{
@@ -629,19 +629,19 @@ int main( int argc, char * * argv )
if( ip == "linear" )
{
qs.interpolation = AudioEngine::qualitySettings::Interpolation_Linear;
qs.interpolation = AudioEngine::qualitySettings::Interpolation::Linear;
}
else if( ip == "sincfastest" )
{
qs.interpolation = AudioEngine::qualitySettings::Interpolation_SincFastest;
qs.interpolation = AudioEngine::qualitySettings::Interpolation::SincFastest;
}
else if( ip == "sincmedium" )
{
qs.interpolation = AudioEngine::qualitySettings::Interpolation_SincMedium;
qs.interpolation = AudioEngine::qualitySettings::Interpolation::SincMedium;
}
else if( ip == "sincbest" )
{
qs.interpolation = AudioEngine::qualitySettings::Interpolation_SincBest;
qs.interpolation = AudioEngine::qualitySettings::Interpolation::SincBest;
}
else
{
@@ -663,16 +663,16 @@ int main( int argc, char * * argv )
switch( o )
{
case 1:
qs.oversampling = AudioEngine::qualitySettings::Oversampling_None;
qs.oversampling = AudioEngine::qualitySettings::Oversampling::None;
break;
case 2:
qs.oversampling = AudioEngine::qualitySettings::Oversampling_2x;
qs.oversampling = AudioEngine::qualitySettings::Oversampling::X2;
break;
case 4:
qs.oversampling = AudioEngine::qualitySettings::Oversampling_4x;
qs.oversampling = AudioEngine::qualitySettings::Oversampling::X4;
break;
case 8:
qs.oversampling = AudioEngine::qualitySettings::Oversampling_8x;
qs.oversampling = AudioEngine::qualitySettings::Oversampling::X8;
break;
default:
return usageError( QString( "Invalid oversampling %1" ).arg( argv[i] ) );

View File

@@ -245,16 +245,16 @@ void MidiAlsaSeq::applyPortMode( MidiPort * _port )
switch( _port->mode() )
{
case MidiPort::Duplex:
case MidiPort::Mode::Duplex:
caps[1] |= SND_SEQ_PORT_CAP_READ |
SND_SEQ_PORT_CAP_SUBS_READ;
case MidiPort::Input:
case MidiPort::Mode::Input:
caps[0] |= SND_SEQ_PORT_CAP_WRITE |
SND_SEQ_PORT_CAP_SUBS_WRITE;
break;
case MidiPort::Output:
case MidiPort::Mode::Output:
caps[1] |= SND_SEQ_PORT_CAP_READ |
SND_SEQ_PORT_CAP_SUBS_READ;
break;

View File

@@ -33,9 +33,9 @@ namespace lmms
MidiController::MidiController( Model * _parent ) :
Controller( Controller::MidiController, _parent, tr( "MIDI Controller" ) ),
Controller( ControllerType::Midi, _parent, tr( "MIDI Controller" ) ),
MidiEventProcessor(),
m_midiPort( tr( "unnamed_midi_controller" ), Engine::audioEngine()->midiClient(), this, this, MidiPort::Input ),
m_midiPort( tr( "unnamed_midi_controller" ), Engine::audioEngine()->midiClient(), this, this, MidiPort::Mode::Input ),
m_lastValue( 0.0f ),
m_previousValue( 0.0f )
{

View File

@@ -66,8 +66,8 @@ MidiPort::MidiPort( const QString& name,
{
m_midiClient->addPort( this );
m_readableModel.setValue( m_mode == Input || m_mode == Duplex );
m_writableModel.setValue( m_mode == Output || m_mode == Duplex );
m_readableModel.setValue( m_mode == Mode::Input || m_mode == Mode::Duplex );
m_writableModel.setValue( m_mode == Mode::Output || m_mode == Mode::Duplex );
connect( &m_readableModel, SIGNAL(dataChanged()),
this, SLOT(updateMidiPortMode()), Qt::DirectConnection );
@@ -325,10 +325,10 @@ void MidiPort::subscribeWritablePort( const QString& port, bool subscribe )
void MidiPort::updateMidiPortMode()
{
// this small lookup-table makes everything easier
static const Modes modeTable[2][2] =
static const Mode modeTable[2][2] =
{
{ Disabled, Output },
{ Input, Duplex }
{ Mode::Disabled, Mode::Output },
{ Mode::Input, Mode::Duplex }
} ;
setMode( modeTable[m_readableModel.value()][m_writableModel.value()] );

View File

@@ -149,7 +149,7 @@ void ControllerView::renameController()
if( ok && !new_name.isEmpty() )
{
c->setName( new_name );
if( getController()->type() == Controller::LfoController )
if( getController()->type() == Controller::ControllerType::Lfo )
{
m_controllerDlg->setWindowTitle( tr( "LFO" ) + " (" + new_name + ")" );
}

View File

@@ -95,7 +95,7 @@ AutomatableModelView* CheckControl::modelView() { return m_checkBox; }
CheckControl::CheckControl(QWidget *parent) :
m_widget(new QWidget(parent)),
m_checkBox(new LedCheckBox(nullptr, QString(), LedCheckBox::Green)),
m_checkBox(new LedCheckBox(nullptr, QString(), LedCheckBox::LedColor::Green)),
m_label(new QLabel(m_widget))
{
auto vbox = new QVBoxLayout(m_widget);

View File

@@ -56,28 +56,28 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
// Disable effects that are of type "DummyEffect"
bool isEnabled = !dynamic_cast<DummyEffect *>( effect() );
m_bypass = new LedCheckBox( this, "", isEnabled ? LedCheckBox::Green : LedCheckBox::Red );
m_bypass = new LedCheckBox( this, "", isEnabled ? LedCheckBox::LedColor::Green : LedCheckBox::LedColor::Red );
m_bypass->move( 3, 3 );
m_bypass->setEnabled( isEnabled );
m_bypass->setToolTip(tr("On/Off"));
m_wetDry = new Knob( knobBright_26, this );
m_wetDry = new Knob( KnobType::Bright26, this );
m_wetDry->setLabel( tr( "W/D" ) );
m_wetDry->move( 40 - m_wetDry->width() / 2, 5 );
m_wetDry->setEnabled( isEnabled );
m_wetDry->setHintText( tr( "Wet Level:" ), "" );
m_autoQuit = new TempoSyncKnob( knobBright_26, this );
m_autoQuit = new TempoSyncKnob( KnobType::Bright26, this );
m_autoQuit->setLabel( tr( "DECAY" ) );
m_autoQuit->move( 78 - m_autoQuit->width() / 2, 5 );
m_autoQuit->setEnabled( isEnabled && !effect()->m_autoQuitDisabled );
m_autoQuit->setHintText( tr( "Time:" ), "ms" );
m_gate = new Knob( knobBright_26, this );
m_gate = new Knob( KnobType::Bright26, this );
m_gate->setLabel( tr( "GATE" ) );
m_gate->move( 116 - m_gate->width() / 2, 5 );
m_gate->setEnabled( isEnabled && !effect()->m_autoQuitDisabled );

View File

@@ -440,7 +440,7 @@ void FileBrowserTreeWidget::keyPressEvent(QKeyEvent * ke )
if (file == nullptr) { return; }
// When moving to a new sound, preview it. Skip presets, they can play forever
if (vertical && file->type() == FileItem::SampleFile)
if (vertical && file->type() == FileItem::FileType::Sample)
{
previewFileItem(file);
}
@@ -535,7 +535,7 @@ void FileBrowserTreeWidget::contextMenuEvent(QContextMenuEvent * e )
QList<QAction*> FileBrowserTreeWidget::getContextActions(FileItem* file, bool songEditor)
{
QList<QAction*> result = QList<QAction*>();
const bool fileIsSample = file->type() == FileItem::SampleFile;
const bool fileIsSample = file->type() == FileItem::FileType::Sample;
QString instrumentAction = fileIsSample ?
tr("Send to new AudioFileProcessor instance") :
@@ -603,7 +603,7 @@ void FileBrowserTreeWidget::previewFileItem(FileItem* file)
// In special case of sample-files we do not care about
// handling() rather than directly creating a SamplePlayHandle
if (file->type() == FileItem::SampleFile)
if (file->type() == FileItem::FileType::Sample)
{
TextFloat * tf = TextFloat::displayMessage(
tr("Loading sample"),
@@ -621,15 +621,15 @@ void FileBrowserTreeWidget::previewFileItem(FileItem* file)
ext == "gig" || ext == "pat")
&& !getPluginFactory()->pluginSupportingExtension(ext).isNull())
{
const bool isPlugin = file->handling() == FileItem::LoadByPlugin;
const bool isPlugin = file->handling() == FileItem::FileHandling::LoadByPlugin;
newPPH = new PresetPreviewPlayHandle(fileName, isPlugin);
}
else if (file->type() != FileItem::VstPluginFile && file->isTrack())
else if (file->type() != FileItem::FileType::VstPlugin && file->isTrack())
{
DataFile dataFile(fileName);
if (dataFile.validate(ext))
{
const bool isPlugin = file->handling() == FileItem::LoadByPlugin;
const bool isPlugin = file->handling() == FileItem::FileHandling::LoadByPlugin;
newPPH = new PresetPreviewPlayHandle(fileName, isPlugin, &dataFile);
}
else
@@ -681,34 +681,34 @@ void FileBrowserTreeWidget::mouseMoveEvent( QMouseEvent * me )
{
switch( f->type() )
{
case FileItem::PresetFile:
new StringPairDrag( f->handling() == FileItem::LoadAsPreset ?
case FileItem::FileType::Preset:
new StringPairDrag( f->handling() == FileItem::FileHandling::LoadAsPreset ?
"presetfile" : "pluginpresetfile",
f->fullName(),
embed::getIconPixmap( "preset_file" ), this );
break;
case FileItem::SampleFile:
case FileItem::FileType::Sample:
new StringPairDrag( "samplefile", f->fullName(),
embed::getIconPixmap( "sample_file" ), this );
break;
case FileItem::SoundFontFile:
case FileItem::FileType::SoundFont:
new StringPairDrag( "soundfontfile", f->fullName(),
embed::getIconPixmap( "soundfont_file" ), this );
break;
case FileItem::PatchFile:
case FileItem::FileType::Patch:
new StringPairDrag( "patchfile", f->fullName(),
embed::getIconPixmap( "sample_file" ), this );
break;
case FileItem::VstPluginFile:
case FileItem::FileType::VstPlugin:
new StringPairDrag( "vstpluginfile", f->fullName(),
embed::getIconPixmap( "vst_plugin_file" ), this );
break;
case FileItem::MidiFile:
case FileItem::FileType::Midi:
new StringPairDrag( "importedproject", f->fullName(),
embed::getIconPixmap( "midi_file" ), this );
break;
case FileItem::ProjectFile:
case FileItem::FileType::Project:
new StringPairDrag( "projectfile", f->fullName(),
embed::getIconPixmap( "project_file" ), this );
break;
@@ -732,7 +732,7 @@ void FileBrowserTreeWidget::mouseReleaseEvent(QMouseEvent * me )
if (m_previewPlayHandle == nullptr) { return; }
// Only sample previews may continue after mouse up. Is this a sample preview?
bool isSample = m_previewPlayHandle->type() == PlayHandle::TypeSamplePlayHandle;
bool isSample = m_previewPlayHandle->type() == PlayHandle::Type::SamplePlayHandle;
// Even sample previews should only continue if the user wants them to. Do they?
bool shouldContinue = ConfigManager::inst()->value("ui", "letpreviewsfinish").toInt();
// If both are true the preview may continue, otherwise we stop it
@@ -747,14 +747,14 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it)
Engine::audioEngine()->requestChangeInModel();
switch( f->handling() )
{
case FileItem::LoadAsProject:
case FileItem::FileHandling::LoadAsProject:
if( getGUI()->mainWindow()->mayChangeProject(true) )
{
Engine::getSong()->loadProject( f->fullName() );
}
break;
case FileItem::LoadByPlugin:
case FileItem::FileHandling::LoadByPlugin:
{
const QString e = f->extension();
Instrument * i = it->instrument();
@@ -769,17 +769,17 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it)
break;
}
case FileItem::LoadAsPreset: {
case FileItem::FileHandling::LoadAsPreset: {
DataFile dataFile(f->fullName());
it->replaceInstrument(dataFile);
break;
}
case FileItem::ImportAsProject:
case FileItem::FileHandling::ImportAsProject:
ImportFilter::import( f->fullName(),
Engine::getSong() );
break;
case FileItem::NotSupported:
case FileItem::FileHandling::NotSupported:
default:
break;
@@ -799,14 +799,14 @@ void FileBrowserTreeWidget::activateListItem(QTreeWidgetItem * item,
return;
}
if( f->handling() == FileItem::LoadAsProject ||
f->handling() == FileItem::ImportAsProject )
if( f->handling() == FileItem::FileHandling::LoadAsProject ||
f->handling() == FileItem::FileHandling::ImportAsProject )
{
handleFile( f, nullptr );
}
else if( f->handling() != FileItem::NotSupported )
else if( f->handling() != FileItem::FileHandling::NotSupported )
{
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, Engine::patternStore()));
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, Engine::patternStore()));
handleFile( f, it );
}
}
@@ -818,7 +818,7 @@ void FileBrowserTreeWidget::openInNewInstrumentTrack(TrackContainer* tc, FileIte
{
if(item->isTrack())
{
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, tc));
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, tc));
handleFile(item, it);
}
}
@@ -840,10 +840,10 @@ void FileBrowserTreeWidget::openInNewInstrumentTrack(FileItem* item, bool songEd
bool FileBrowserTreeWidget::openInNewSampleTrack(FileItem* item)
{
// Can't add non-samples to a sample track
if (item->type() != FileItem::SampleFile) { return false; }
if (item->type() != FileItem::FileType::Sample) { return false; }
// Create a new sample track for this sample
auto sampleTrack = static_cast<SampleTrack*>(Track::create(Track::SampleTrack, Engine::getSong()));
auto sampleTrack = static_cast<SampleTrack*>(Track::create(Track::Type::Sample, Engine::getSong()));
// Add the sample clip to the track
Engine::audioEngine()->requestChangeInModel();
@@ -1113,26 +1113,26 @@ void FileItem::initPixmaps()
switch( m_type )
{
case ProjectFile:
case FileType::Project:
setIcon( 0, *s_projectFilePixmap );
break;
case PresetFile:
case FileType::Preset:
setIcon( 0, *s_presetFilePixmap );
break;
case SoundFontFile:
case FileType::SoundFont:
setIcon( 0, *s_soundfontFilePixmap );
break;
case VstPluginFile:
case FileType::VstPlugin:
setIcon( 0, *s_vstPluginFilePixmap );
break;
case SampleFile:
case PatchFile: // TODO
case FileType::Sample:
case FileType::Patch: // TODO
setIcon( 0, *s_sampleFilePixmap );
break;
case MidiFile:
case FileType::Midi:
setIcon( 0, *s_midiFilePixmap );
break;
case UnknownFile:
case FileType::Unknown:
default:
setIcon( 0, *s_unknownFilePixmap );
break;
@@ -1144,36 +1144,36 @@ void FileItem::initPixmaps()
void FileItem::determineFileType()
{
m_handling = NotSupported;
m_handling = FileHandling::NotSupported;
const QString ext = extension();
if( ext == "mmp" || ext == "mpt" || ext == "mmpz" )
{
m_type = ProjectFile;
m_handling = LoadAsProject;
m_type = FileType::Project;
m_handling = FileHandling::LoadAsProject;
}
else if( ext == "xpf" || ext == "xml" )
{
m_type = PresetFile;
m_handling = LoadAsPreset;
m_type = FileType::Preset;
m_handling = FileHandling::LoadAsPreset;
}
else if( ext == "xiz" && ! getPluginFactory()->pluginSupportingExtension(ext).isNull() )
{
m_type = PresetFile;
m_handling = LoadByPlugin;
m_type = FileType::Preset;
m_handling = FileHandling::LoadByPlugin;
}
else if( ext == "sf2" || ext == "sf3" )
{
m_type = SoundFontFile;
m_type = FileType::SoundFont;
}
else if( ext == "pat" )
{
m_type = PatchFile;
m_type = FileType::Patch;
}
else if( ext == "mid" || ext == "midi" || ext == "rmi" )
{
m_type = MidiFile;
m_handling = ImportAsProject;
m_type = FileType::Midi;
m_handling = FileHandling::ImportAsProject;
}
else if( ext == "dll"
#ifdef LMMS_BUILD_LINUX
@@ -1181,28 +1181,28 @@ void FileItem::determineFileType()
#endif
)
{
m_type = VstPluginFile;
m_handling = LoadByPlugin;
m_type = FileType::VstPlugin;
m_handling = FileHandling::LoadByPlugin;
}
else if ( ext == "lv2" )
{
m_type = PresetFile;
m_handling = LoadByPlugin;
m_type = FileType::Preset;
m_handling = FileHandling::LoadByPlugin;
}
else
{
m_type = UnknownFile;
m_type = FileType::Unknown;
}
if( m_handling == NotSupported &&
if( m_handling == FileHandling::NotSupported &&
!ext.isEmpty() && ! getPluginFactory()->pluginSupportingExtension(ext).isNull() )
{
m_handling = LoadByPlugin;
m_handling = FileHandling::LoadByPlugin;
// classify as sample if not classified by anything yet but can
// be handled by a certain plugin
if( m_type == UnknownFile )
if( m_type == FileType::Unknown )
{
m_type = SampleFile;
m_type = FileType::Sample;
}
}
}

View File

@@ -60,9 +60,9 @@ LadspaControlView::LadspaControlView( QWidget * _parent,
switch( m_ctl->port()->data_type )
{
case TOGGLED:
case BufferDataType::Toggled:
{
auto toggle = new LedCheckBox(m_ctl->port()->name, this, QString(), LedCheckBox::Green);
auto toggle = new LedCheckBox(m_ctl->port()->name, this, QString(), LedCheckBox::LedColor::Green);
toggle->setModel( m_ctl->toggledModel() );
layout->addWidget( toggle );
if( link != nullptr )
@@ -78,14 +78,14 @@ LadspaControlView::LadspaControlView( QWidget * _parent,
break;
}
case INTEGER:
case ENUM:
case FLOATING:
knb = new Knob( knobBright_26, this, m_ctl->port()->name );
case BufferDataType::Integer:
case BufferDataType::Enum:
case BufferDataType::Floating:
knb = new Knob( KnobType::Bright26, this, m_ctl->port()->name );
break;
case TIME:
knb = new TempoSyncKnob( knobBright_26, this, m_ctl->port()->name );
case BufferDataType::Time:
knb = new TempoSyncKnob( KnobType::Bright26, this, m_ctl->port()->name );
break;
default:
@@ -94,7 +94,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent,
if( knb != nullptr )
{
if( m_ctl->port()->data_type != TIME )
if( m_ctl->port()->data_type != BufferDataType::Time )
{
knb->setModel( m_ctl->knobModel() );
}

View File

@@ -61,22 +61,22 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
setWindowIcon( embed::getIconPixmap( "controller" ) );
setFixedSize( 240, 58 );
m_baseKnob = new Knob( knobBright_26, this );
m_baseKnob = new Knob( KnobType::Bright26, this );
m_baseKnob->setLabel( tr( "BASE" ) );
m_baseKnob->move( CD_LFO_BASE_CD_KNOB_X, CD_LFO_CD_KNOB_Y );
m_baseKnob->setHintText( tr( "Base:" ), "" );
m_speedKnob = new TempoSyncKnob( knobBright_26, this );
m_speedKnob = new TempoSyncKnob( KnobType::Bright26, this );
m_speedKnob->setLabel( tr( "FREQ" ) );
m_speedKnob->move( CD_LFO_SPEED_CD_KNOB_X, CD_LFO_CD_KNOB_Y );
m_speedKnob->setHintText( tr( "LFO frequency:" ), "" );
m_amountKnob = new Knob( knobBright_26, this );
m_amountKnob = new Knob( KnobType::Bright26, this );
m_amountKnob->setLabel( tr( "AMNT" ) );
m_amountKnob->move( CD_LFO_AMOUNT_CD_KNOB_X, CD_LFO_CD_KNOB_Y );
m_amountKnob->setHintText( tr( "Modulation amount:" ), "" );
m_phaseKnob = new Knob( knobBright_26, this );
m_phaseKnob = new Knob( KnobType::Bright26, this );
m_phaseKnob->setLabel( tr( "PHS" ) );
m_phaseKnob->move( CD_LFO_PHASE_CD_KNOB_X, CD_LFO_CD_KNOB_Y );
m_phaseKnob->setHintText( tr( "Phase offset:" ) , "" + tr( " degrees" ) );

View File

@@ -84,7 +84,7 @@ MainWindow::MainWindow() :
m_autoSaveTimer( this ),
m_viewMenu( nullptr ),
m_metronomeToggle( 0 ),
m_session( Normal )
m_session( SessionState::Normal )
{
setAttribute( Qt::WA_DeleteOnClose );
@@ -377,7 +377,7 @@ void MainWindow::finalize()
m_toolsMenu = new QMenu( this );
for( const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::Tool) )
for( const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::Type::Tool) )
{
m_toolsMenu->addAction( desc->logo->pixmap(), desc->displayName );
m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/nullptr )
@@ -514,7 +514,7 @@ void MainWindow::finalize()
ConfigManager::inst()->value( "audioengine", "audiodev" ) ) )
{
// if so, offer the audio settings section of the setup dialog
SetupDialog sd( SetupDialog::AudioSettings );
SetupDialog sd( SetupDialog::ConfigTab::AudioSettings );
sd.exec();
}
@@ -600,7 +600,7 @@ void MainWindow::resetWindowTitle()
title += '*';
}
if( getSession() == Recover )
if( getSession() == SessionState::Recover )
{
title += " - " + tr( "Recover session. Please save your work!" );
}
@@ -618,7 +618,7 @@ bool MainWindow::mayChangeProject(bool stopPlayback)
Engine::getSong()->stop();
}
if( !Engine::getSong()->isModified() && getSession() != Recover )
if( !Engine::getSong()->isModified() && getSession() != SessionState::Recover )
{
return( true );
}
@@ -635,9 +635,9 @@ bool MainWindow::mayChangeProject(bool stopPlayback)
"last saving. Do you want to save it "
"now?" );
QMessageBox mb( ( getSession() == Recover ?
QMessageBox mb( ( getSession() == SessionState::Recover ?
messageTitleRecovered : messageTitleUnsaved ),
( getSession() == Recover ?
( getSession() == SessionState::Recover ?
messageRecovered : messageUnsaved ),
QMessageBox::Question,
QMessageBox::Save,
@@ -652,7 +652,7 @@ bool MainWindow::mayChangeProject(bool stopPlayback)
}
else if( answer == QMessageBox::Discard )
{
if( getSession() == Recover )
if( getSession() == SessionState::Recover )
{
sessionCleanup();
}
@@ -795,7 +795,7 @@ bool MainWindow::saveProject()
}
else if( this->guiSaveProject() )
{
if( getSession() == Recover )
if( getSession() == SessionState::Recover )
{
sessionCleanup();
}
@@ -850,7 +850,7 @@ bool MainWindow::saveProjectAs()
}
if( this->guiSaveProjectAs( fname ) )
{
if( getSession() == Recover )
if( getSession() == SessionState::Recover )
{
sessionCleanup();
}
@@ -1214,19 +1214,19 @@ void MainWindow::updatePlayPauseIcons()
{
switch( Engine::getSong()->playMode() )
{
case Song::Mode_PlaySong:
case Song::PlayMode::Song:
getGUI()->songEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayAutomationClip:
case Song::PlayMode::AutomationClip:
getGUI()->automationEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayPattern:
case Song::PlayMode::Pattern:
getGUI()->patternEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayMidiClip:
case Song::PlayMode::MidiClip:
getGUI()->pianoRoll()->setPauseIcon( true );
break;
@@ -1288,7 +1288,7 @@ void MainWindow::sessionCleanup()
{
// delete recover session files
QFile::remove( ConfigManager::inst()->recoveryFile() );
setSession( Normal );
setSession( SessionState::Normal );
}
@@ -1480,7 +1480,7 @@ void MainWindow::exportProject(bool multiExport)
efd.setFileMode( FileDialog::AnyFile );
int idx = 0;
QStringList types;
while( ProjectRenderer::fileEncodeDevices[idx].m_fileFormat != ProjectRenderer::NumFileFormats)
while( ProjectRenderer::fileEncodeDevices[idx].m_fileFormat != ProjectRenderer::ExportFileFormat::Count)
{
if(ProjectRenderer::fileEncodeDevices[idx].isAvailable()) {
types << tr(ProjectRenderer::fileEncodeDevices[idx].m_description);
@@ -1625,17 +1625,17 @@ void MainWindow::onSongStopped()
SongEditorWindow* songEditor = getGUI()->songEditor();
switch( tl->behaviourAtStop() )
{
case TimeLineWidget::BackToZero:
if( songEditor && ( tl->autoScroll() == TimeLineWidget::AutoScrollEnabled ) )
case TimeLineWidget::BehaviourAtStopState::BackToZero:
if( songEditor && ( tl->autoScroll() == TimeLineWidget::AutoScrollState::Enabled ) )
{
songEditor->m_editor->updatePosition(0);
}
break;
case TimeLineWidget::BackToStart:
case TimeLineWidget::BehaviourAtStopState::BackToStart:
if( tl->savedPos() >= 0 )
{
if(songEditor && ( tl->autoScroll() == TimeLineWidget::AutoScrollEnabled ) )
if(songEditor && ( tl->autoScroll() == TimeLineWidget::AutoScrollState::Enabled ) )
{
songEditor->m_editor->updatePosition( TimePos(tl->savedPos().getTicks() ) );
}
@@ -1643,7 +1643,7 @@ void MainWindow::onSongStopped()
}
break;
case TimeLineWidget::KeepStopPosition:
case TimeLineWidget::BehaviourAtStopState::KeepStopPosition:
break;
}
}

View File

@@ -64,6 +64,16 @@ MicrotunerConfig::MicrotunerConfig() :
m_baseKeyModel(DefaultBaseKey, 0, NumKeys - 1, nullptr, tr("Base key")),
m_baseFreqModel(DefaultBaseFreq, 0.1f, 9999.999f, 0.001f, nullptr, tr("Base note frequency"))
{
#if QT_VERSION < 0x50C00
// Workaround for a bug in Qt versions below 5.12,
// where argument-dependent-lookup fails for QFlags operators
// declared inside a namepsace.
// This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h
// See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348
using ::operator|;
#endif
setWindowIcon(embed::getIconPixmap("microtuner"));
setWindowTitle(tr("Microtuner"));

View File

@@ -89,7 +89,7 @@ MidiCCRackView::MidiCCRackView(InstrumentTrack * track) :
// Adds the controller knobs
for (int i = 0; i < MidiControllerCount; ++i)
{
m_controllerKnob[i] = new Knob(knobBright_26);
m_controllerKnob[i] = new Knob(KnobType::Bright26);
m_controllerKnob[i]->setLabel(tr("CC %1").arg(i));
knobsAreaLayout->addWidget(m_controllerKnob[i], i/4, i%4);
}

View File

@@ -96,7 +96,7 @@ MixerLine::MixerLine( QWidget * _parent, MixerView * _mv, int _channelIndex ) :
setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) );
// mixer sends knob
m_sendKnob = new Knob( knobBright_26, this, tr( "Channel send amount" ) );
m_sendKnob = new Knob( KnobType::Bright26, this, tr( "Channel send amount" ) );
m_sendKnob->move( 3, 22 );
m_sendKnob->setVisible( false );

View File

@@ -57,6 +57,16 @@ MixerView::MixerView() :
ModelView( nullptr, this ),
SerializingObjectHook()
{
#if QT_VERSION < 0x50C00
// Workaround for a bug in Qt versions below 5.12,
// where argument-dependent-lookup fails for QFlags operators
// declared inside a namepsace.
// This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h
// See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348
using ::operator|;
#endif
Mixer * m = Engine::mixer();
m->setHook( this );
@@ -245,13 +255,13 @@ void MixerView::updateMaxChannelSelector()
{
for (const auto& track : trackList)
{
if (track->type() == Track::InstrumentTrack)
if (track->type() == Track::Type::Instrument)
{
auto inst = (InstrumentTrack*)track;
inst->mixerChannelModel()->setRange(0,
m_mixerChannelViews.size()-1,1);
}
else if (track->type() == Track::SampleTrack)
else if (track->type() == Track::Type::Sample)
{
auto strk = (SampleTrack*)track;
strk->mixerChannelModel()->setRange(0,

View File

@@ -161,7 +161,7 @@ void PluginBrowser::addPlugins()
m_descTree->clear();
// Fetch and sort all instrument plugin descriptors
auto descs = getPluginFactory()->descriptors(Plugin::Instrument);
auto descs = getPluginFactory()->descriptors(Plugin::Type::Instrument);
std::sort(descs.begin(), descs.end(),
[](auto d1, auto d2)
{
@@ -305,7 +305,7 @@ void PluginDescWidget::contextMenuEvent(QContextMenuEvent* e)
void PluginDescWidget::openInNewInstrumentTrack(QString value)
{
TrackContainer* tc = Engine::getSong();
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, tc));
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, tc));
auto ilt = new InstrumentLoaderThread(this, it, value);
ilt->start();
}

View File

@@ -54,6 +54,16 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
m_track(tv->model()),
m_stv(tv)
{
#if QT_VERSION < 0x50C00
// Workaround for a bug in Qt versions below 5.12,
// where argument-dependent-lookup fails for QFlags operators
// declared inside a namepsace.
// This affects the Q_DECLARE_OPERATORS_FOR_FLAGS macro in Instrument.h
// See also: https://codereview.qt-project.org/c/qt/qtbase/+/225348
using ::operator|;
#endif
// init own layout + widgets
setFocusPolicy(Qt::StrongFocus);
auto vlayout = new QVBoxLayout(this);
@@ -94,7 +104,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter;
// set up volume knob
m_volumeKnob = new Knob(knobBright_26, nullptr, tr("Sample volume"));
m_volumeKnob = new Knob(KnobType::Bright26, nullptr, tr("Sample volume"));
m_volumeKnob->setVolumeKnob(true);
m_volumeKnob->setHintText(tr("Volume:"), "%");
@@ -108,7 +118,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
// set up panning knob
m_panningKnob = new Knob(knobBright_26, nullptr, tr("Panning"));
m_panningKnob = new Knob(KnobType::Bright26, nullptr, tr("Panning"));
m_panningKnob->setHintText(tr("Panning:"), "");
basicControlsLayout->addWidget(m_panningKnob, 0, 1);

View File

@@ -321,7 +321,7 @@ void AutomationClipView::paintEvent( QPaintEvent * )
// the value of the end of the shape between the two nodes will be the inValue of
// the next node.
float nextValue;
if( m_clip->progressionType() == AutomationClip::DiscreteProgression )
if( m_clip->progressionType() == AutomationClip::ProgressionType::Discrete )
{
nextValue = OUTVAL(it);
}

View File

@@ -87,7 +87,7 @@ ClipView::ClipView( Clip * clip,
m_initialClipPos( TimePos(0) ),
m_initialClipEnd( TimePos(0) ),
m_clip( clip ),
m_action( NoAction ),
m_action( Action::None ),
m_initialMousePos( QPoint( 0, 0 ) ),
m_initialMouseGlobalPos( QPoint( 0, 0 ) ),
m_initialOffsets( QVector<TimePos>() ),
@@ -435,7 +435,7 @@ void ClipView::dragEnterEvent( QDragEnterEvent * dee )
else
{
StringPairDrag::processDragEnterEvent( dee, "clip_" +
QString::number( m_clip->getTrack()->type() ) );
QString::number( static_cast<int>(m_clip->getTrack()->type()) ) );
}
}
@@ -457,7 +457,7 @@ void ClipView::dropEvent( QDropEvent * de )
QString value = StringPairDrag::decodeValue( de );
// Track must be the same type to paste into
if( type != ( "clip_" + QString::number( m_clip->getTrack()->type() ) ) )
if( type != ( "clip_" + QString::number( static_cast<int>(m_clip->getTrack()->type()) ) ) )
{
return;
}
@@ -537,7 +537,7 @@ DataFile ClipView::createClipDataFiles(
{
Track * t = m_trackView->getTrack();
TrackContainer * tc = t->trackContainer();
DataFile dataFile( DataFile::DragNDropData );
DataFile dataFile( DataFile::Type::DragNDropData );
QDomElement clipParent = dataFile.createElement("clips");
for (const auto& clipView : clipViews)
@@ -547,7 +547,7 @@ DataFile ClipView::createClipDataFiles(
int trackIndex = std::distance(tc->tracks().begin(), std::find(tc->tracks().begin(), tc->tracks().end(), clipTrack));
QDomElement clipElement = dataFile.createElement("clip");
clipElement.setAttribute( "trackIndex", trackIndex );
clipElement.setAttribute( "trackType", clipTrack->type() );
clipElement.setAttribute( "trackType", static_cast<int>(clipTrack->type()) );
clipElement.setAttribute( "trackName", clipTrack->name() );
clipView->m_clip->saveState(dataFile, clipElement);
clipParent.appendChild( clipElement );
@@ -645,27 +645,27 @@ void ClipView::mousePressEvent( QMouseEvent * me )
{
if( isSelected() )
{
m_action = CopySelection;
m_action = Action::CopySelection;
}
else
{
m_action = ToggleSelected;
m_action = Action::ToggleSelected;
}
}
else
{
if( isSelected() )
{
m_action = MoveSelection;
m_action = Action::MoveSelection;
}
else
{
getGUI()->songEditor()->m_editor->selectAllClips( false );
m_clip->addJournalCheckPoint();
// Move, Resize and ResizeLeft
// Split action doesn't disable Clip journalling
if (m_action == Move || m_action == Resize || m_action == ResizeLeft)
// Action::Move, Action::Resize and Action::ResizeLeft
// Action::Split action doesn't disable Clip journalling
if (m_action == Action::Move || m_action == Action::Resize || m_action == Action::ResizeLeft)
{
m_clip->setJournalling(false);
}
@@ -675,22 +675,22 @@ void ClipView::mousePressEvent( QMouseEvent * me )
if( m_clip->getAutoResize() )
{ // Always move clips that can't be manually resized
m_action = Move;
m_action = Action::Move;
setCursor( Qt::SizeAllCursor );
}
else if( me->x() >= width() - RESIZE_GRIP_WIDTH )
{
m_action = Resize;
m_action = Action::Resize;
setCursor( Qt::SizeHorCursor );
}
else if( me->x() < RESIZE_GRIP_WIDTH && (sClip || pClip) )
{
m_action = ResizeLeft;
m_action = Action::ResizeLeft;
setCursor( Qt::SizeHorCursor );
}
else if( sClip && knifeMode )
{
m_action = Split;
m_action = Action::Split;
setCursor( m_cursorKnife );
setMarkerPos( knifeMarkerPos( me ) );
setMarkerEnabled( true );
@@ -698,11 +698,11 @@ void ClipView::mousePressEvent( QMouseEvent * me )
}
else
{
m_action = Move;
m_action = Action::Move;
setCursor( Qt::SizeAllCursor );
}
if( m_action == Move )
if( m_action == Action::Move )
{
s_textFloat->setTitle( tr( "Current position" ) );
s_textFloat->setText( QString( "%1:%2" ).
@@ -710,7 +710,7 @@ void ClipView::mousePressEvent( QMouseEvent * me )
arg( m_clip->startPosition().getTicks() %
TimePos::ticksPerBar() ) );
}
else if( m_action == Resize || m_action == ResizeLeft )
else if( m_action == Action::Resize || m_action == Action::ResizeLeft )
{
s_textFloat->setTitle( tr( "Current length" ) );
s_textFloat->setText( tr( "%1:%2 (%3:%4 to %5:%6)" ).
@@ -727,11 +727,11 @@ void ClipView::mousePressEvent( QMouseEvent * me )
// s_textFloat->reparent( this );
// setup text-float as if Clip was already moved/resized
s_textFloat->moveGlobal( this, QPoint( width() + 2, height() + 2) );
if ( m_action != Split) { s_textFloat->show(); }
if ( m_action != Action::Split) { s_textFloat->show(); }
}
delete m_hint;
QString hint = m_action == Move || m_action == MoveSelection
QString hint = m_action == Action::Move || m_action == Action::MoveSelection
? tr( "Press <%1> and drag to make a copy." )
: tr( "Press <%1> for free resizing." );
m_hint = TextFloat::displayMessage( tr( "Hint" ), hint.arg(UI_CTRL_KEY),
@@ -748,9 +748,9 @@ void ClipView::mousePressEvent( QMouseEvent * me )
{
remove( active );
}
if (m_action == Split)
if (m_action == Action::Split)
{
m_action = NoAction;
m_action = Action::None;
auto sClip = dynamic_cast<SampleClip*>(m_clip);
if (sClip)
{
@@ -790,12 +790,12 @@ void ClipView::mousePressEvent( QMouseEvent * me )
*/
void ClipView::mouseMoveEvent( QMouseEvent * me )
{
if( m_action == CopySelection || m_action == ToggleSelected )
if( m_action == Action::CopySelection || m_action == Action::ToggleSelected )
{
if( mouseMovedDistance( me, 2 ) == true )
{
QVector<ClipView *> clipViews;
if( m_action == CopySelection )
if( m_action == Action::CopySelection )
{
// Collect all selected Clips
QVector<selectableObject *> so =
@@ -816,7 +816,7 @@ void ClipView::mouseMoveEvent( QMouseEvent * me )
}
// Clear the action here because mouseReleaseEvent will not get
// triggered once we go into drag.
m_action = NoAction;
m_action = Action::None;
// Write the Clips to the DataFile for copying
DataFile dataFile = createClipDataFiles( clipViews );
@@ -827,7 +827,7 @@ void ClipView::mouseMoveEvent( QMouseEvent * me )
Qt::KeepAspectRatio,
Qt::SmoothTransformation );
new StringPairDrag( QString( "clip_%1" ).arg(
m_clip->getTrack()->type() ),
static_cast<int>(m_clip->getTrack()->type()) ),
dataFile.toString(), thumbnail, this );
}
}
@@ -839,7 +839,7 @@ void ClipView::mouseMoveEvent( QMouseEvent * me )
}
const float ppb = m_trackView->trackContainerView()->pixelsPerBar();
if( m_action == Move )
if( m_action == Action::Move )
{
TimePos newPos = draggedClipPos( me );
m_clip->movePosition(newPos);
@@ -851,7 +851,7 @@ void ClipView::mouseMoveEvent( QMouseEvent * me )
TimePos::ticksPerBar() ) );
s_textFloat->moveGlobal( this, QPoint( width() + 2, height() + 2 ) );
}
else if( m_action == MoveSelection )
else if( m_action == Action::MoveSelection )
{
// 1: Find the position we want to move the grabbed Clip to
TimePos newPos = draggedClipPos( me );
@@ -881,13 +881,13 @@ void ClipView::mouseMoveEvent( QMouseEvent * me )
( *it )->movePosition( newPos + m_initialOffsets[index] );
}
}
else if( m_action == Resize || m_action == ResizeLeft )
else if( m_action == Action::Resize || m_action == Action::ResizeLeft )
{
const float snapSize = getGUI()->songEditor()->m_editor->getSnapSize();
// Length in ticks of one snap increment
const TimePos snapLength = TimePos( (int)(snapSize * TimePos::ticksPerBar()) );
if( m_action == Resize )
if( m_action == Action::Resize )
{
// The clip's new length
TimePos l = static_cast<int>( me->x() * TimePos::ticksPerBar() / ppb );
@@ -990,7 +990,7 @@ void ClipView::mouseMoveEvent( QMouseEvent * me )
TimePos::ticksPerBar() ) );
s_textFloat->moveGlobal( this, QPoint( width() + 2, height() + 2) );
}
else if( m_action == Split )
else if( m_action == Action::Split )
{
auto sClip = dynamic_cast<SampleClip*>(m_clip);
if (sClip) {
@@ -1015,21 +1015,21 @@ void ClipView::mouseMoveEvent( QMouseEvent * me )
*/
void ClipView::mouseReleaseEvent( QMouseEvent * me )
{
// If the CopySelection was chosen as the action due to mouse movement,
// If the Action::CopySelection was chosen as the action due to mouse movement,
// it will have been cleared. At this point Toggle is the desired action.
// An active StringPairDrag will prevent this method from being called,
// so a real CopySelection would not have occurred.
if( m_action == CopySelection ||
( m_action == ToggleSelected && mouseMovedDistance( me, 2 ) == false ) )
// so a real Action::CopySelection would not have occurred.
if( m_action == Action::CopySelection ||
( m_action == Action::ToggleSelected && mouseMovedDistance( me, 2 ) == false ) )
{
setSelected( !isSelected() );
}
else if( m_action == Move || m_action == Resize || m_action == ResizeLeft )
else if( m_action == Action::Move || m_action == Action::Resize || m_action == Action::ResizeLeft )
{
// TODO: Fix m_clip->setJournalling() consistency
m_clip->setJournalling( true );
}
else if( m_action == Split )
else if( m_action == Action::Split )
{
const float ppb = m_trackView->trackContainerView()->pixelsPerBar();
const TimePos relPos = me->pos().x() * TimePos::ticksPerBar() / ppb;
@@ -1039,7 +1039,7 @@ void ClipView::mouseReleaseEvent( QMouseEvent * me )
);
}
m_action = NoAction;
m_action = Action::None;
delete m_hint;
m_hint = nullptr;
s_textFloat->hide();
@@ -1079,7 +1079,7 @@ void ClipView::contextMenuEvent( QContextMenuEvent * cme )
individualClip
? tr("Delete (middle mousebutton)")
: tr("Delete selection (middle mousebutton)"),
[this](){ contextMenuAction( Remove ); } );
[this](){ contextMenuAction( ContextMenuAction::Remove ); } );
contextMenu.addSeparator();
@@ -1088,14 +1088,14 @@ void ClipView::contextMenuEvent( QContextMenuEvent * cme )
individualClip
? tr("Cut")
: tr("Cut selection"),
[this](){ contextMenuAction( Cut ); } );
[this](){ contextMenuAction( ContextMenuAction::Cut ); } );
if (canMergeSelection(selectedClips))
{
contextMenu.addAction(
embed::getIconPixmap("edit_merge"),
tr("Merge Selection"),
[this]() { contextMenuAction(Merge); }
[this]() { contextMenuAction(ContextMenuAction::Merge); }
);
}
}
@@ -1105,12 +1105,12 @@ void ClipView::contextMenuEvent( QContextMenuEvent * cme )
individualClip
? tr("Copy")
: tr("Copy selection"),
[this](){ contextMenuAction( Copy ); } );
[this](){ contextMenuAction( ContextMenuAction::Copy ); } );
contextMenu.addAction(
embed::getIconPixmap( "edit_paste" ),
tr( "Paste" ),
[this](){ contextMenuAction( Paste ); } );
[this](){ contextMenuAction( ContextMenuAction::Paste ); } );
contextMenu.addSeparator();
@@ -1119,7 +1119,7 @@ void ClipView::contextMenuEvent( QContextMenuEvent * cme )
(individualClip
? tr("Mute/unmute (<%1> + middle click)")
: tr("Mute/unmute selection (<%1> + middle click)")).arg(UI_CTRL_KEY),
[this](){ contextMenuAction( Mute ); } );
[this](){ contextMenuAction( ContextMenuAction::Mute ); } );
contextMenu.addSeparator();
@@ -1143,22 +1143,22 @@ void ClipView::contextMenuAction( ContextMenuAction action )
switch( action )
{
case Remove:
case ContextMenuAction::Remove:
remove( active );
break;
case Cut:
case ContextMenuAction::Cut:
cut( active );
break;
case Copy:
case ContextMenuAction::Copy:
copy( active );
break;
case Paste:
case ContextMenuAction::Paste:
paste();
break;
case Mute:
case ContextMenuAction::Mute:
toggleMute( active );
break;
case Merge:
case ContextMenuAction::Merge:
mergeClips(active);
break;
}
@@ -1205,7 +1205,7 @@ void ClipView::copy( QVector<ClipView *> clipvs )
DataFile dataFile = createClipDataFiles( clipvs );
// Copy the Clip type as a key and the Clip data file to the clipboard
copyStringPair( QString( "clip_%1" ).arg( m_clip->getTrack()->type() ),
copyStringPair( QString( "clip_%1" ).arg( static_cast<int>(m_clip->getTrack()->type()) ),
dataFile.toString() );
}

View File

@@ -204,7 +204,7 @@ void MidiClipView::transposeSelection()
void MidiClipView::constructContextMenu( QMenu * _cm )
{
bool isBeat = m_clip->type() == MidiClip::BeatClip;
bool isBeat = m_clip->type() == MidiClip::Type::BeatClip;
auto a = new QAction(embed::getIconPixmap("piano"), tr("Open in piano-roll"), _cm);
_cm->insertAction( _cm->actions()[0], a );
@@ -253,7 +253,7 @@ void MidiClipView::mousePressEvent( QMouseEvent * _me )
{
bool displayPattern = fixedClips() || (pixelsPerBar() >= 96 && m_legacySEPattern);
if( _me->button() == Qt::LeftButton &&
m_clip->m_clipType == MidiClip::BeatClip &&
m_clip->m_clipType == MidiClip::Type::BeatClip &&
displayPattern && _me->y() > height() - s_stepBtnOff->height() )
// when mouse button is pressed in pattern mode
@@ -311,7 +311,7 @@ void MidiClipView::mouseDoubleClickEvent(QMouseEvent *_me)
_me->ignore();
return;
}
if( m_clip->m_clipType == MidiClip::MelodyClip || !fixedClips() )
if( m_clip->m_clipType == MidiClip::Type::MelodyClip || !fixedClips() )
{
openInPianoRoll();
}
@@ -322,7 +322,7 @@ void MidiClipView::mouseDoubleClickEvent(QMouseEvent *_me)
void MidiClipView::wheelEvent(QWheelEvent * we)
{
if(m_clip->m_clipType == MidiClip::BeatClip &&
if(m_clip->m_clipType == MidiClip::Type::BeatClip &&
(fixedClips() || pixelsPerBar() >= 96) &&
position(we).y() > height() - s_stepBtnOff->height())
{
@@ -400,7 +400,7 @@ void MidiClipView::paintEvent( QPaintEvent * )
QColor c;
bool const muted = m_clip->getTrack()->isMuted() || m_clip->isMuted();
bool current = getGUI()->pianoRoll()->currentMidiClip() == m_clip;
bool beatClip = m_clip->m_clipType == MidiClip::BeatClip;
bool beatClip = m_clip->m_clipType == MidiClip::Type::BeatClip;
if( beatClip )
{
@@ -460,7 +460,7 @@ void MidiClipView::paintEvent( QPaintEvent * )
bool displayPattern = fixedClips() || (pixelsPerBar >= 96 && m_legacySEPattern);
// melody clip paint event
NoteVector const & noteCollection = m_clip->m_notes;
if( m_clip->m_clipType == MidiClip::MelodyClip && !noteCollection.empty() )
if( m_clip->m_clipType == MidiClip::Type::MelodyClip && !noteCollection.empty() )
{
// Compute the minimum and maximum key in the clip
// so that we know how much there is to draw.

View File

@@ -90,13 +90,13 @@ AutomationEditor::AutomationEditor() :
m_bottomLevel( 0 ),
m_topLevel( 0 ),
m_currentPosition(),
m_action( NONE ),
m_action( Action::None ),
m_drawLastLevel( 0.0f ),
m_drawLastTick( 0 ),
m_ppb( DEFAULT_PPB ),
m_y_delta( DEFAULT_Y_DELTA ),
m_y_auto( true ),
m_editMode( DRAW ),
m_editMode( EditMode::Draw ),
m_mouseDownLeft(false),
m_mouseDownRight( false ),
m_scrollBack( false ),
@@ -147,9 +147,9 @@ AutomationEditor::AutomationEditor() :
// add time-line
m_timeLine = new TimeLineWidget( VALUES_WIDTH, 0, m_ppb,
Engine::getSong()->getPlayPos(
Song::Mode_PlayAutomationClip ),
Song::PlayMode::AutomationClip ),
m_currentPosition,
Song::Mode_PlayAutomationClip, this );
Song::PlayMode::AutomationClip, this );
connect( this, SIGNAL( positionChanged( const lmms::TimePos& ) ),
m_timeLine, SLOT( updatePosition( const lmms::TimePos& ) ) );
connect( m_timeLine, SIGNAL( positionChanged( const lmms::TimePos& ) ),
@@ -492,15 +492,15 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
// a node, while others require that we know if we clicked the outValue
// of a node.
bool editingOutValue = (
m_editMode == DRAW_OUTVALUES
|| (m_editMode == ERASE && m_mouseDownRight)
m_editMode == EditMode::DrawOutValues
|| (m_editMode == EditMode::Erase && m_mouseDownRight)
);
timeMap::iterator clickedNode = getNodeAt(mouseEvent->x(), mouseEvent->y(), editingOutValue);
switch (m_editMode)
{
case DRAW:
case EditMode::Draw:
{
m_clip->addJournalCheckPoint();
@@ -518,7 +518,7 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
m_drawLastLevel = level;
// Changes the action to drawing a line of nodes
m_action = DRAW_LINE;
m_action = Action::DrawLine;
}
else // No shift, we are just creating/moving nodes
{
@@ -540,8 +540,8 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
// is being dragged, so if we don't update it we have a bogus iterator
clickedNode = tm.find(newTime);
// Set the action to MOVE_VALUE so moveMouseEvent() knows we are moving a node
m_action = MOVE_VALUE;
// Set the action to Action::MoveValue so moveMouseEvent() knows we are moving a node
m_action = Action::MoveValue;
// Calculate the offset from the place the mouse click happened in comparison
// to the center of the node
@@ -559,7 +559,7 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
Engine::getSong()->setModified();
}
else if (m_mouseDownRight) // Right click on DRAW mode erases values
else if (m_mouseDownRight) // Right click on EditMode::Draw mode erases values
{
// Update the last clicked position so we remove all nodes from
// that point up to the point we release the mouse button
@@ -568,11 +568,11 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
// If we right-clicked a node, remove it
eraseNode(clickedNode);
m_action = ERASE_VALUES;
m_action = Action::EraseValues;
}
break;
}
case ERASE:
case EditMode::Erase:
{
m_clip->addJournalCheckPoint();
@@ -586,7 +586,7 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
// If we right-clicked a node, remove it
eraseNode(clickedNode);
m_action = ERASE_VALUES;
m_action = Action::EraseValues;
}
else if (m_mouseDownRight) // And right click resets outValues
{
@@ -597,11 +597,11 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
// that point up to the point we release the mouse button
m_drawLastTick = posTicks;
m_action = RESET_OUTVALUES;
m_action = Action::ResetOutValues;
}
break;
}
case DRAW_OUTVALUES:
case EditMode::DrawOutValues:
{
m_clip->addJournalCheckPoint();
@@ -615,7 +615,7 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
clickedNode.value().setOutValue(level);
m_action = MOVE_OUTVALUE;
m_action = Action::MoveOutValue;
Engine::getSong()->setModified();
}
@@ -635,7 +635,7 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
m_draggedOutValueKey = POS(clickedNode);
clickedNode.value().setOutValue(level);
m_action = MOVE_OUTVALUE;
m_action = Action::MoveOutValue;
Engine::getSong()->setModified();
}
@@ -650,7 +650,7 @@ void AutomationEditor::mousePressEvent( QMouseEvent* mouseEvent )
// that point up to the point we release the mouse button
m_drawLastTick = posTicks;
m_action = RESET_OUTVALUES;
m_action = Action::ResetOutValues;
}
break;
}
@@ -671,13 +671,13 @@ void AutomationEditor::mouseDoubleClickEvent(QMouseEvent * mouseEvent)
if (mouseEvent->y() <= TOP_MARGIN || mouseEvent->x() < VALUES_WIDTH) { return; }
// Are we fine tuning the inValue or outValue?
const bool isOutVal = (m_editMode == DRAW_OUTVALUES);
const bool isOutVal = (m_editMode == EditMode::DrawOutValues);
timeMap::iterator clickedNode = getNodeAt(mouseEvent->x(), mouseEvent->y(), isOutVal);
switch (m_editMode)
{
case DRAW:
case DRAW_OUTVALUES:
case EditMode::Draw:
case EditMode::DrawOutValues:
if (fineTuneValue(clickedNode, isOutVal)) { update(); }
break;
default:
@@ -703,9 +703,9 @@ void AutomationEditor::mouseReleaseEvent(QMouseEvent * mouseEvent )
mustRepaint = true;
}
if (m_editMode == DRAW)
if (m_editMode == EditMode::Draw)
{
if (m_action == MOVE_VALUE)
if (m_action == Action::MoveValue)
{
// Actually apply the value of the node being dragged
m_clip->applyDragValue();
@@ -714,7 +714,7 @@ void AutomationEditor::mouseReleaseEvent(QMouseEvent * mouseEvent )
QApplication::restoreOverrideCursor();
}
m_action = NONE;
m_action = Action::None;
if (mustRepaint) { repaint(); }
}
@@ -742,12 +742,12 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
switch (m_editMode)
{
case DRAW:
case EditMode::Draw:
{
// We are dragging a node
if (m_mouseDownLeft)
{
if (m_action == MOVE_VALUE)
if (m_action == Action::MoveValue)
{
// When we clicked the node, we might have clicked slightly off
// so we account for that offset for a smooth drag
@@ -770,7 +770,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
Engine::getSong()->setModified();
}
/* else if (m_action == DRAW_LINE)
/* else if (m_action == Action::DrawLine)
{
// We are drawing a line. For now do nothing (as before), but later logic
// could be added here so the line is updated according to the new mouse position
@@ -779,7 +779,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
}
else if (m_mouseDownRight) // We are removing nodes
{
if (m_action == ERASE_VALUES)
if (m_action == Action::EraseValues)
{
// If we moved the mouse past the beginning correct the position in ticks
posTicks = qMax(posTicks, 0);
@@ -794,7 +794,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
}
break;
}
case ERASE:
case EditMode::Erase:
{
// If we moved the mouse past the beginning correct the position in ticks
posTicks = qMax(posTicks, 0);
@@ -802,7 +802,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
// Left button removes nodes
if (m_mouseDownLeft)
{
if (m_action == ERASE_VALUES)
if (m_action == Action::EraseValues)
{
// Removing automation nodes
@@ -814,7 +814,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
}
else if (m_mouseDownRight) // Right button resets outValues
{
if (m_action == RESET_OUTVALUES)
if (m_action == Action::ResetOutValues)
{
// Reseting outValues
@@ -826,7 +826,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
}
break;
}
case DRAW_OUTVALUES:
case EditMode::DrawOutValues:
{
// If we moved the mouse past the beginning correct the position in ticks
posTicks = qMax(posTicks, 0);
@@ -834,7 +834,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
// Left button moves outValues
if (m_mouseDownLeft)
{
if (m_action == MOVE_OUTVALUE)
if (m_action == Action::MoveOutValue)
{
// We are moving the outValue of the node
timeMap & tm = m_clip->getTimeMap();
@@ -850,7 +850,7 @@ void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent )
}
else if (m_mouseDownRight) // Right button resets them
{
if (m_action == RESET_OUTVALUES)
if (m_action == Action::ResetOutValues)
{
// Reseting outValues
@@ -1172,7 +1172,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
// the value of the end of the shape between the two nodes will be the inValue of
// the next node.
float nextValue;
if( m_clip->progressionType() == AutomationClip::DiscreteProgression )
if( m_clip->progressionType() == AutomationClip::ProgressionType::Discrete )
{
nextValue = OUTVAL(it);
}
@@ -1248,22 +1248,22 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
// draw current edit-mode-icon below the cursor
switch( m_editMode )
{
case DRAW:
case EditMode::Draw:
{
if (m_action == ERASE_VALUES) { cursor = s_toolErase; }
else if (m_action == MOVE_VALUE) { cursor = s_toolMove; }
if (m_action == Action::EraseValues) { cursor = s_toolErase; }
else if (m_action == Action::MoveValue) { cursor = s_toolMove; }
else { cursor = s_toolDraw; }
break;
}
case ERASE:
case EditMode::Erase:
{
cursor = s_toolErase;
break;
}
case DRAW_OUTVALUES:
case EditMode::DrawOutValues:
{
if (m_action == RESET_OUTVALUES) { cursor = s_toolErase; }
else if (m_action == MOVE_OUTVALUE) { cursor = s_toolMove; }
if (m_action == Action::ResetOutValues) { cursor = s_toolErase; }
else if (m_action == Action::MoveOutValue) { cursor = s_toolMove; }
else { cursor = s_toolDrawOut; }
break;
}
@@ -1400,7 +1400,7 @@ void AutomationEditor::resizeEvent(QResizeEvent * re)
if( Engine::getSong() )
{
Engine::getSong()->getPlayPos( Song::Mode_PlayAutomationClip
Engine::getSong()->getPlayPos( Song::PlayMode::AutomationClip
).m_timeLine->setFixedWidth( width() );
}
@@ -1525,7 +1525,7 @@ void AutomationEditor::play()
if( !m_clip->getTrack() )
{
if( Engine::getSong()->playMode() != Song::Mode_PlayMidiClip )
if( Engine::getSong()->playMode() != Song::PlayMode::MidiClip )
{
Engine::getSong()->stop();
Engine::getSong()->playMidiClip( getGUI()->pianoRoll()->currentMidiClip() );
@@ -1599,7 +1599,7 @@ void AutomationEditor::verScrolled(int new_pos )
void AutomationEditor::setEditMode(AutomationEditor::EditModes mode)
void AutomationEditor::setEditMode(AutomationEditor::EditMode mode)
{
if (m_editMode == mode)
return;
@@ -1614,13 +1614,13 @@ void AutomationEditor::setEditMode(AutomationEditor::EditModes mode)
void AutomationEditor::setEditMode(int mode)
{
setEditMode((AutomationEditor::EditModes) mode);
setEditMode((AutomationEditor::EditMode) mode);
}
void AutomationEditor::setProgressionType(AutomationClip::ProgressionTypes type)
void AutomationEditor::setProgressionType(AutomationClip::ProgressionType type)
{
if (validClip())
{
@@ -1633,7 +1633,7 @@ void AutomationEditor::setProgressionType(AutomationClip::ProgressionTypes type)
void AutomationEditor::setProgressionType(int type)
{
setProgressionType((AutomationClip::ProgressionTypes) type);
setProgressionType((AutomationClip::ProgressionType) type);
}
@@ -1655,7 +1655,7 @@ void AutomationEditor::updatePosition(const TimePos & t )
{
if( ( Engine::getSong()->isPlaying() &&
Engine::getSong()->playMode() ==
Song::Mode_PlayAutomationClip ) ||
Song::PlayMode::AutomationClip ) ||
m_scrollBack == true )
{
const int w = width() - VALUES_WIDTH;
@@ -1877,7 +1877,7 @@ AutomationEditorWindow::AutomationEditorWindow() :
connect(progression_type_group, SIGNAL(triggered(int)), m_editor, SLOT(setProgressionType(int)));
// setup tension-stuff
m_tensionKnob = new Knob( knobSmall_17, this, "Tension" );
m_tensionKnob = new Knob( KnobType::Small17, this, "Tension" );
m_tensionKnob->setModel(m_editor->m_tensionModel);
m_tensionKnob->setToolTip(tr("Tension value for spline"));
@@ -1989,15 +1989,15 @@ void AutomationEditorWindow::setCurrentClip(AutomationClip* clip)
switch(m_editor->m_clip->progressionType())
{
case AutomationClip::DiscreteProgression:
case AutomationClip::ProgressionType::Discrete:
m_discreteAction->setChecked(true);
m_tensionKnob->setEnabled(false);
break;
case AutomationClip::LinearProgression:
case AutomationClip::ProgressionType::Linear:
m_linearAction->setChecked(true);
m_tensionKnob->setEnabled(false);
break;
case AutomationClip::CubicHermiteProgression:
case AutomationClip::ProgressionType::CubicHermite:
m_cubicHermiteAction->setChecked(true);
m_tensionKnob->setEnabled(true);
break;

View File

@@ -73,7 +73,7 @@ void PatternEditor::removeSteps()
for (const auto& track : tl)
{
if (track->type() == Track::InstrumentTrack)
if (track->type() == Track::Type::Instrument)
{
auto p = static_cast<MidiClip*>(track->getClip(m_ps->currentPattern()));
p->removeSteps();
@@ -86,7 +86,7 @@ void PatternEditor::removeSteps()
void PatternEditor::addSampleTrack()
{
(void) Track::create( Track::SampleTrack, model() );
(void) Track::create( Track::Type::Sample, model() );
}
@@ -94,7 +94,7 @@ void PatternEditor::addSampleTrack()
void PatternEditor::addAutomationTrack()
{
(void) Track::create( Track::AutomationTrack, model() );
(void) Track::create( Track::Type::Automation, model() );
}
@@ -180,7 +180,7 @@ void PatternEditor::makeSteps( bool clone )
for (const auto& track : tl)
{
if (track->type() == Track::InstrumentTrack)
if (track->type() == Track::Type::Instrument)
{
auto p = static_cast<MidiClip*>(track->getClip(m_ps->currentPattern()));
if( clone )
@@ -306,7 +306,7 @@ QSize PatternEditorWindow::sizeHint() const
void PatternEditorWindow::play()
{
if (Engine::getSong()->playMode() != Song::Mode_PlayPattern)
if (Engine::getSong()->playMode() != Song::PlayMode::Pattern)
{
Engine::getSong()->playPattern();
}

File diff suppressed because it is too large Load Diff

View File

@@ -64,8 +64,8 @@ void PositionLine::paintEvent(QPaintEvent* pe)
// If gradient is enabled, we're in focus and we're playing, enable gradient
if (m_hasTailGradient &&
Engine::getSong()->isPlaying() &&
(Engine::getSong()->playMode() == Song::Mode_PlaySong ||
Engine::getSong()->playMode() == Song::Mode_PlayMidiClip))
(Engine::getSong()->playMode() == Song::PlayMode::Song ||
Engine::getSong()->playMode() == Song::PlayMode::MidiClip))
{
c.setAlpha(60);
gradient.setColorAt(w, c);

View File

@@ -82,7 +82,7 @@ SongEditor::SongEditor( Song * song ) :
m_proportionalSnap( false ),
m_scrollBack( false ),
m_smoothScroll( ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt() ),
m_mode(DrawMode),
m_mode(EditMode::Draw),
m_origin(),
m_scrollPos(),
m_mousePos(),
@@ -99,11 +99,11 @@ SongEditor::SongEditor( Song * song ) :
m_timeLine = new TimeLineWidget( m_trackHeadWidth, 32,
pixelsPerBar(),
m_song->m_playPos[Song::Mode_PlaySong],
m_song->getPlayPos(Song::PlayMode::Song),
m_currentPosition,
Song::Mode_PlaySong, this );
Song::PlayMode::Song, this );
connect( this, SIGNAL( positionChanged( const lmms::TimePos& ) ),
m_song->m_playPos[Song::Mode_PlaySong].m_timeLine,
m_song->getPlayPos(Song::PlayMode::Song).m_timeLine,
SLOT( updatePosition( const lmms::TimePos& ) ) );
connect( m_timeLine, SIGNAL( positionChanged( const lmms::TimePos& ) ),
this, SLOT( updatePosition( const lmms::TimePos& ) ) );
@@ -341,8 +341,8 @@ QString SongEditor::getSnapSizeString() const
void SongEditor::setHighQuality( bool hq )
{
Engine::audioEngine()->changeQuality( AudioEngine::qualitySettings(
hq ? AudioEngine::qualitySettings::Mode_HighQuality :
AudioEngine::qualitySettings::Mode_Draft ) );
hq ? AudioEngine::qualitySettings::Mode::HighQuality :
AudioEngine::qualitySettings::Mode::Draft ) );
}
@@ -456,17 +456,17 @@ void SongEditor::setEditMode( EditMode mode )
void SongEditor::setEditModeDraw()
{
setEditMode(DrawMode);
setEditMode(EditMode::Draw);
}
void SongEditor::setEditModeKnife()
{
setEditMode(KnifeMode);
setEditMode(EditMode::Knife);
}
void SongEditor::setEditModeSelect()
{
setEditMode(SelectMode);
setEditMode(EditMode::Select);
}
void SongEditor::toggleProportionalSnap()
@@ -496,7 +496,7 @@ void SongEditor::keyPressEvent( QKeyEvent * ke )
tick_t t = m_song->currentTick() - TimePos::ticksPerBar();
if( t >= 0 )
{
m_song->setPlayPos( t, Song::Mode_PlaySong );
m_song->setPlayPos( t, Song::PlayMode::Song );
}
}
else if( ke->key() == Qt::Key_Right )
@@ -504,12 +504,12 @@ void SongEditor::keyPressEvent( QKeyEvent * ke )
tick_t t = m_song->currentTick() + TimePos::ticksPerBar();
if( t < MaxSongLength )
{
m_song->setPlayPos( t, Song::Mode_PlaySong );
m_song->setPlayPos( t, Song::PlayMode::Song );
}
}
else if( ke->key() == Qt::Key_Home )
{
m_song->setPlayPos( 0, Song::Mode_PlaySong );
m_song->setPlayPos( 0, Song::PlayMode::Song );
}
else if( ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace )
{
@@ -560,7 +560,7 @@ void SongEditor::wheelEvent( QWheelEvent * we )
m_leftRightScroll->setValue(m_leftRightScroll->value() + bar - newBar);
// update timeline
m_song->m_playPos[Song::Mode_PlaySong].m_timeLine->setPixelsPerBar(pixelsPerBar());
m_song->getPlayPos(Song::PlayMode::Song).m_timeLine->setPixelsPerBar(pixelsPerBar());
// and make sure, all Clip's are resized and relocated
realignTracks();
}
@@ -788,8 +788,8 @@ void SongEditor::updatePosition( const TimePos & t )
trackOpWidth = TRACK_OP_WIDTH;
}
if( ( m_song->isPlaying() && m_song->m_playMode == Song::Mode_PlaySong
&& m_timeLine->autoScroll() == TimeLineWidget::AutoScrollEnabled) ||
if( ( m_song->isPlaying() && m_song->m_playMode == Song::PlayMode::Song
&& m_timeLine->autoScroll() == TimeLineWidget::AutoScrollState::Enabled) ||
m_scrollBack == true )
{
m_smoothScroll = ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt();
@@ -808,7 +808,7 @@ void SongEditor::updatePosition( const TimePos & t )
m_scrollBack = false;
}
const int x = m_song->m_playPos[Song::Mode_PlaySong].m_timeLine->
const int x = m_song->getPlayPos(Song::PlayMode::Song).m_timeLine->
markerX( t ) + 8;
if( x >= trackOpWidth + widgetWidth -1 )
{
@@ -872,7 +872,7 @@ void SongEditor::zoomingChanged()
int ppb = calculatePixelsPerBar();
setPixelsPerBar(ppb);
m_song->m_playPos[Song::Mode_PlaySong].m_timeLine->setPixelsPerBar(ppb);
m_song->getPlayPos(Song::PlayMode::Song).m_timeLine->setPixelsPerBar(ppb);
realignTracks();
updateRubberband();
m_timeLine->setSnapSize(getSnapSize());
@@ -895,7 +895,7 @@ void SongEditor::selectAllClips( bool select )
bool SongEditor::allowRubberband() const
{
return m_mode == SelectMode;
return m_mode == EditMode::Select;
}
@@ -903,7 +903,7 @@ bool SongEditor::allowRubberband() const
bool SongEditor::knifeMode() const
{
return m_mode == KnifeMode;
return m_mode == EditMode::Knife;
}
@@ -1104,7 +1104,7 @@ void SongEditorWindow::changeEvent(QEvent *event)
void SongEditorWindow::play()
{
emit playTriggered();
if( Engine::getSong()->playMode() != Song::Mode_PlaySong )
if( Engine::getSong()->playMode() != Song::PlayMode::Song )
{
Engine::getSong()->playSong();
}

View File

@@ -49,7 +49,7 @@ namespace
QPixmap * TimeLineWidget::s_posMarkerPixmap = nullptr;
TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb,
Song::PlayPos & pos, const TimePos & begin, Song::PlayModes mode,
Song::PlayPos & pos, const TimePos & begin, Song::PlayMode mode,
QWidget * parent ) :
QWidget( parent ),
m_inactiveLoopColor( 52, 63, 53, 64 ),
@@ -61,9 +61,9 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb,
m_loopRectangleVerticalPadding( 1 ),
m_barLineColor( 192, 192, 192 ),
m_barNumberColor( m_barLineColor.darker( 120 ) ),
m_autoScroll( AutoScrollEnabled ),
m_loopPoints( LoopPointsDisabled ),
m_behaviourAtStop( BackToZero ),
m_autoScroll( AutoScrollState::Enabled ),
m_loopPoints( LoopPointState::Disabled ),
m_behaviourAtStop( BehaviourAtStopState::BackToZero ),
m_changedPosition( true ),
m_xOffset( xoff ),
m_posMarkerX( 0 ),
@@ -74,7 +74,7 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb,
m_mode( mode ),
m_savedPos( -1 ),
m_hint( nullptr ),
m_action( NoAction ),
m_action( Action::NoAction ),
m_moveXOff( 0 )
{
m_loopPos[0] = 0;
@@ -157,7 +157,7 @@ void TimeLineWidget::addToolButtons( QToolBar * _tool_bar )
SLOT(toggleBehaviourAtStop(int)));
connect( this, SIGNAL(loadBehaviourAtStop(int)), behaviourAtStop,
SLOT(changeState(int)));
behaviourAtStop->changeState( BackToStart );
behaviourAtStop->changeState( static_cast<int>(BehaviourAtStopState::BackToStart) );
_tool_bar->addWidget( autoScroll );
_tool_bar->addWidget( loopPoints );
@@ -171,8 +171,8 @@ void TimeLineWidget::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
_this.setAttribute( "lp0pos", (int) loopBegin() );
_this.setAttribute( "lp1pos", (int) loopEnd() );
_this.setAttribute( "lpstate", m_loopPoints );
_this.setAttribute( "stopbehaviour", m_behaviourAtStop );
_this.setAttribute( "lpstate", static_cast<int>(m_loopPoints) );
_this.setAttribute( "stopbehaviour", static_cast<int>(m_behaviourAtStop) );
}
@@ -182,10 +182,10 @@ void TimeLineWidget::loadSettings( const QDomElement & _this )
{
m_loopPos[0] = _this.attribute( "lp0pos" ).toInt();
m_loopPos[1] = _this.attribute( "lp1pos" ).toInt();
m_loopPoints = static_cast<LoopPointStates>(
m_loopPoints = static_cast<LoopPointState>(
_this.attribute( "lpstate" ).toInt() );
update();
emit loopPointStateLoaded( m_loopPoints );
emit loopPointStateLoaded( static_cast<int>(m_loopPoints) );
if( _this.hasAttribute( "stopbehaviour" ) )
{
@@ -214,7 +214,7 @@ void TimeLineWidget::updatePosition( const TimePos & )
void TimeLineWidget::toggleAutoScroll( int _n )
{
m_autoScroll = static_cast<AutoScrollStates>( _n );
m_autoScroll = static_cast<AutoScrollState>( _n );
}
@@ -222,7 +222,7 @@ void TimeLineWidget::toggleAutoScroll( int _n )
void TimeLineWidget::toggleLoopPoints( int _n )
{
m_loopPoints = static_cast<LoopPointStates>( _n );
m_loopPoints = static_cast<LoopPointState>( _n );
update();
}
@@ -231,7 +231,7 @@ void TimeLineWidget::toggleLoopPoints( int _n )
void TimeLineWidget::toggleBehaviourAtStop( int _n )
{
m_behaviourAtStop = static_cast<BehaviourAtStopStates>( _n );
m_behaviourAtStop = static_cast<BehaviourAtStopState>( _n );
}
@@ -327,7 +327,7 @@ void TimeLineWidget::mousePressEvent( QMouseEvent* event )
}
if( event->button() == Qt::LeftButton && !(event->modifiers() & Qt::ShiftModifier) )
{
m_action = MovePositionMarker;
m_action = Action::MovePositionMarker;
if( event->x() - m_xOffset < s_posMarkerPixmap->width() )
{
m_moveXOff = event->x() - m_xOffset;
@@ -339,7 +339,7 @@ void TimeLineWidget::mousePressEvent( QMouseEvent* event )
}
else if( event->button() == Qt::LeftButton && (event->modifiers() & Qt::ShiftModifier) )
{
m_action = SelectSongClip;
m_action = Action::SelectSongClip;
m_initalXSelect = event->x();
}
else if( event->button() == Qt::RightButton )
@@ -348,12 +348,12 @@ void TimeLineWidget::mousePressEvent( QMouseEvent* event )
const TimePos t = m_begin + static_cast<int>( qMax( event->x() - m_xOffset - m_moveXOff, 0 ) * TimePos::ticksPerBar() / m_ppb );
const TimePos loopMid = ( m_loopPos[0] + m_loopPos[1] ) / 2;
m_action = t < loopMid ? MoveLoopBegin : MoveLoopEnd;
m_action = t < loopMid ? Action::MoveLoopBegin : Action::MoveLoopEnd;
std::sort(std::begin(m_loopPos), std::end(m_loopPos));
m_loopPos[( m_action == MoveLoopBegin ) ? 0 : 1] = t;
m_loopPos[( m_action == Action::MoveLoopBegin ) ? 0 : 1] = t;
}
if( m_action == MoveLoopBegin || m_action == MoveLoopEnd )
if( m_action == Action::MoveLoopBegin || m_action == Action::MoveLoopEnd )
{
delete m_hint;
m_hint = TextFloat::displayMessage( tr( "Hint" ),
@@ -373,13 +373,13 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
switch( m_action )
{
case MovePositionMarker:
case Action::MovePositionMarker:
m_pos.setTicks(t.getTicks());
Engine::getSong()->setToTime(t, m_mode);
if (!( Engine::getSong()->isPlaying()))
{
//Song::Mode_None is used when nothing is being played.
Engine::getSong()->setToTime(t, Song::Mode_None);
//Song::PlayMode::None is used when nothing is being played.
Engine::getSong()->setToTime(t, Song::PlayMode::None);
}
m_pos.setCurrentFrame( 0 );
m_pos.setJumped( true );
@@ -387,10 +387,10 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
positionMarkerMoved();
break;
case MoveLoopBegin:
case MoveLoopEnd:
case Action::MoveLoopBegin:
case Action::MoveLoopEnd:
{
const int i = m_action - MoveLoopBegin; // i == 0 || i == 1
const int i = m_action == Action::MoveLoopBegin ? 0 : 1;
const bool control = event->modifiers() & Qt::ControlModifier;
if (control)
{
@@ -409,13 +409,13 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
const int offset = control ? 1 : m_snapSize * TimePos::ticksPerBar();
// Note, swap 1 and 0 below and the behavior "skips" the other
// marking instead of pushing it.
if (m_action == MoveLoopBegin) { m_loopPos[0] -= offset; }
if (m_action == Action::MoveLoopBegin) { m_loopPos[0] -= offset; }
else { m_loopPos[1] += offset; }
}
update();
break;
}
case SelectSongClip:
case Action::SelectSongClip:
emit regionSelectedFromPixels( m_initalXSelect , event->x() );
break;
@@ -431,8 +431,8 @@ void TimeLineWidget::mouseReleaseEvent( QMouseEvent* event )
{
delete m_hint;
m_hint = nullptr;
if ( m_action == SelectSongClip ) { emit selectionFinished(); }
m_action = NoAction;
if ( m_action == Action::SelectSongClip ) { emit selectionFinished(); }
m_action = Action::NoAction;
}

View File

@@ -372,8 +372,8 @@ void TrackContainerView::dragEnterEvent( QDragEnterEvent * _dee )
QString( "presetfile,pluginpresetfile,samplefile,instrument,"
"importedproject,soundfontfile,patchfile,vstpluginfile,projectfile,"
"track_%1,track_%2" ).
arg( Track::InstrumentTrack ).
arg( Track::SampleTrack ) );
arg( static_cast<int>(Track::Type::Instrument) ).
arg( static_cast<int>(Track::Type::Sample) ) );
}
@@ -394,7 +394,7 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
QString value = StringPairDrag::decodeValue( _de );
if( type == "instrument" )
{
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, m_tc));
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, m_tc));
auto ilt = new InstrumentLoaderThread(this, it, value);
ilt->start();
//it->toggledInstrumentTrackButton( true );
@@ -404,7 +404,7 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
|| type == "soundfontfile" || type == "vstpluginfile"
|| type == "patchfile" )
{
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, m_tc));
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, m_tc));
PluginFactory::PluginInfoAndKey piakn =
getPluginFactory()->pluginSupportingExtension(FileItem::extension(value));
Instrument * i = it->loadInstrument(piakn.info.name(), &piakn.key);
@@ -415,7 +415,7 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
else if( type == "presetfile" )
{
DataFile dataFile( value );
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, m_tc));
auto it = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, m_tc));
it->setSimpleSerializing();
it->loadSettings( dataFile.content().toElement() );
//it->toggledInstrumentTrackButton( true );

View File

@@ -99,43 +99,43 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) :
s_lfoGraph = new QPixmap( embed::getIconPixmap( "lfo_graph" ) );
}
m_predelayKnob = new Knob( knobBright_26, this );
m_predelayKnob = new Knob( KnobType::Bright26, this );
m_predelayKnob->setLabel( tr( "DEL" ) );
m_predelayKnob->move( PREDELAY_KNOB_X, ENV_KNOBS_Y );
m_predelayKnob->setHintText( tr( "Pre-delay:" ), "" );
m_attackKnob = new Knob( knobBright_26, this );
m_attackKnob = new Knob( KnobType::Bright26, this );
m_attackKnob->setLabel( tr( "ATT" ) );
m_attackKnob->move( ATTACK_KNOB_X, ENV_KNOBS_Y );
m_attackKnob->setHintText( tr( "Attack:" ), "" );
m_holdKnob = new Knob( knobBright_26, this );
m_holdKnob = new Knob( KnobType::Bright26, this );
m_holdKnob->setLabel( tr( "HOLD" ) );
m_holdKnob->move( HOLD_KNOB_X, ENV_KNOBS_Y );
m_holdKnob->setHintText( tr( "Hold:" ), "" );
m_decayKnob = new Knob( knobBright_26, this );
m_decayKnob = new Knob( KnobType::Bright26, this );
m_decayKnob->setLabel( tr( "DEC" ) );
m_decayKnob->move( DECAY_KNOB_X, ENV_KNOBS_Y );
m_decayKnob->setHintText( tr( "Decay:" ), "" );
m_sustainKnob = new Knob( knobBright_26, this );
m_sustainKnob = new Knob( KnobType::Bright26, this );
m_sustainKnob->setLabel( tr( "SUST" ) );
m_sustainKnob->move( SUSTAIN_KNOB_X, ENV_KNOBS_Y );
m_sustainKnob->setHintText( tr( "Sustain:" ), "" );
m_releaseKnob = new Knob( knobBright_26, this );
m_releaseKnob = new Knob( KnobType::Bright26, this );
m_releaseKnob->setLabel( tr( "REL" ) );
m_releaseKnob->move( RELEASE_KNOB_X, ENV_KNOBS_Y );
m_releaseKnob->setHintText( tr( "Release:" ), "" );
m_amountKnob = new Knob( knobBright_26, this );
m_amountKnob = new Knob( KnobType::Bright26, this );
m_amountKnob->setLabel( tr( "AMT" ) );
m_amountKnob->move( AMOUNT_KNOB_X, ENV_GRAPH_Y );
m_amountKnob->setHintText( tr( "Modulation amount:" ), "" );
@@ -143,25 +143,25 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) :
m_lfoPredelayKnob = new Knob( knobBright_26, this );
m_lfoPredelayKnob = new Knob( KnobType::Bright26, this );
m_lfoPredelayKnob->setLabel( tr( "DEL" ) );
m_lfoPredelayKnob->move( LFO_PREDELAY_KNOB_X, LFO_KNOB_Y );
m_lfoPredelayKnob->setHintText( tr( "Pre-delay:" ), "" );
m_lfoAttackKnob = new Knob( knobBright_26, this );
m_lfoAttackKnob = new Knob( KnobType::Bright26, this );
m_lfoAttackKnob->setLabel( tr( "ATT" ) );
m_lfoAttackKnob->move( LFO_ATTACK_KNOB_X, LFO_KNOB_Y );
m_lfoAttackKnob->setHintText( tr( "Attack:" ), "" );
m_lfoSpeedKnob = new TempoSyncKnob( knobBright_26, this );
m_lfoSpeedKnob = new TempoSyncKnob( KnobType::Bright26, this );
m_lfoSpeedKnob->setLabel( tr( "SPD" ) );
m_lfoSpeedKnob->move( LFO_SPEED_KNOB_X, LFO_KNOB_Y );
m_lfoSpeedKnob->setHintText( tr( "Frequency:" ), "" );
m_lfoAmountKnob = new Knob( knobBright_26, this );
m_lfoAmountKnob = new Knob( KnobType::Bright26, this );
m_lfoAmountKnob->setLabel( tr( "AMT" ) );
m_lfoAmountKnob->move( LFO_AMOUNT_KNOB_X, LFO_KNOB_Y );
m_lfoAmountKnob->setHintText( tr( "Modulation amount:" ), "" );
@@ -310,7 +310,7 @@ void EnvelopeAndLfoView::dragEnterEvent( QDragEnterEvent * _dee )
{
StringPairDrag::processDragEnterEvent( _dee,
QString( "samplefile,clip_%1" ).arg(
Track::SampleTrack ) );
static_cast<int>(Track::Type::Sample) ) );
}
@@ -325,18 +325,18 @@ void EnvelopeAndLfoView::dropEvent( QDropEvent * _de )
m_params->m_userWave.setAudioFile(
StringPairDrag::decodeValue( _de ) );
m_userLfoBtn->model()->setValue( true );
m_params->m_lfoWaveModel.setValue(EnvelopeAndLfoParameters::UserDefinedWave);
m_params->m_lfoWaveModel.setValue(static_cast<int>(EnvelopeAndLfoParameters::LfoShape::UserDefinedWave));
_de->accept();
update();
}
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() );
m_params->m_userWave.setAudioFile( dataFile.content().
firstChildElement().firstChildElement().
firstChildElement().attribute( "src" ) );
m_userLfoBtn->model()->setValue( true );
m_params->m_lfoWaveModel.setValue(EnvelopeAndLfoParameters::UserDefinedWave);
m_params->m_lfoWaveModel.setValue(static_cast<int>(EnvelopeAndLfoParameters::LfoShape::UserDefinedWave));
_de->accept();
update();
}
@@ -459,29 +459,30 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
float phase = ( cur_sample -=
m_params->m_lfoPredelayFrames ) /
osc_frames;
switch( m_params->m_lfoWaveModel.value() )
switch( static_cast<EnvelopeAndLfoParameters::LfoShape>(m_params->m_lfoWaveModel.value()) )
{
case EnvelopeAndLfoParameters::SineWave:
case EnvelopeAndLfoParameters::LfoShape::SineWave:
default:
val = Oscillator::sinSample( phase );
break;
case EnvelopeAndLfoParameters::TriangleWave:
case EnvelopeAndLfoParameters::LfoShape::TriangleWave:
val = Oscillator::triangleSample(
phase );
break;
case EnvelopeAndLfoParameters::SawWave:
case EnvelopeAndLfoParameters::LfoShape::SawWave:
val = Oscillator::sawSample( phase );
break;
case EnvelopeAndLfoParameters::SquareWave:
case EnvelopeAndLfoParameters::LfoShape::SquareWave:
val = Oscillator::squareSample( phase );
break;
case EnvelopeAndLfoParameters::RandomWave:
case EnvelopeAndLfoParameters::LfoShape::RandomWave:
if( x % (int)( 900 * m_lfoSpeedKnob->value<float>() + 1 ) == 0 )
{
m_randomGraph = Oscillator::noiseSample( 0.0f );
}
val = m_randomGraph;
break;
case EnvelopeAndLfoParameters::UserDefinedWave:
case EnvelopeAndLfoParameters::LfoShape::UserDefinedWave:
val = m_params->m_userWave.
userWaveSample( phase );
break;
@@ -516,8 +517,8 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
void EnvelopeAndLfoView::lfoUserWaveChanged()
{
if( m_params->m_lfoWaveModel.value() ==
EnvelopeAndLfoParameters::UserDefinedWave )
if( static_cast<EnvelopeAndLfoParameters::LfoShape>(m_params->m_lfoWaveModel.value()) ==
EnvelopeAndLfoParameters::LfoShape::UserDefinedWave )
{
if( m_params->m_userWave.frames() <= 1 )
{

View File

@@ -44,7 +44,7 @@ InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( Instrume
m_cc( cc ),
m_chordsGroupBox( new GroupBox( tr( "STACKING" ) ) ),
m_chordsComboBox( new ComboBox() ),
m_chordRangeKnob( new Knob( knobBright_26 ) )
m_chordRangeKnob( new Knob( KnobType::Bright26 ) )
{
auto topLayout = new QHBoxLayout(this);
topLayout->setContentsMargins(0, 0, 0, 0);
@@ -98,13 +98,13 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti
m_a( arp ),
m_arpGroupBox( new GroupBox( tr( "ARPEGGIO" ) ) ),
m_arpComboBox( new ComboBox() ),
m_arpRangeKnob( new Knob( knobBright_26 ) ),
m_arpRepeatsKnob( new Knob( knobBright_26 ) ),
m_arpCycleKnob( new Knob( knobBright_26 ) ),
m_arpSkipKnob( new Knob( knobBright_26 ) ),
m_arpMissKnob( new Knob( knobBright_26 ) ),
m_arpTimeKnob( new TempoSyncKnob( knobBright_26 ) ),
m_arpGateKnob( new Knob( knobBright_26 ) ),
m_arpRangeKnob( new Knob( KnobType::Bright26 ) ),
m_arpRepeatsKnob( new Knob( KnobType::Bright26 ) ),
m_arpCycleKnob( new Knob( KnobType::Bright26 ) ),
m_arpSkipKnob( new Knob( KnobType::Bright26 ) ),
m_arpMissKnob( new Knob( KnobType::Bright26 ) ),
m_arpTimeKnob( new TempoSyncKnob( KnobType::Bright26 ) ),
m_arpGateKnob( new Knob( KnobType::Bright26 ) ),
m_arpDirectionComboBox( new ComboBox() ),
m_arpModeComboBox( new ComboBox() )
{

View File

@@ -80,13 +80,13 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) :
m_filterComboBox->setFont( pointSize<8>( m_filterComboBox->font() ) );
m_filterCutKnob = new Knob( knobBright_26, m_filterGroupBox );
m_filterCutKnob = new Knob( KnobType::Bright26, m_filterGroupBox );
m_filterCutKnob->setLabel( tr( "FREQ" ) );
m_filterCutKnob->move( 140, 18 );
m_filterCutKnob->setHintText( tr( "Cutoff frequency:" ), " " + tr( "Hz" ) );
m_filterResKnob = new Knob( knobBright_26, m_filterGroupBox );
m_filterResKnob = new Knob( KnobType::Bright26, m_filterGroupBox );
m_filterResKnob->setLabel( tr( "Q/RESO" ) );
m_filterResKnob->move( 196, 18 );
m_filterResKnob->setHintText( tr( "Q/Resonance:" ), "" );

View File

@@ -148,7 +148,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter;
// set up volume knob
m_volumeKnob = new Knob( knobBright_26, nullptr, tr( "Volume" ) );
m_volumeKnob = new Knob( KnobType::Bright26, nullptr, tr( "Volume" ) );
m_volumeKnob->setVolumeKnob( true );
m_volumeKnob->setHintText( tr( "Volume:" ), "%" );
@@ -162,7 +162,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
// set up panning knob
m_panningKnob = new Knob( knobBright_26, nullptr, tr( "Panning" ) );
m_panningKnob = new Knob( KnobType::Bright26, nullptr, tr( "Panning" ) );
m_panningKnob->setHintText( tr( "Panning:" ), "" );
basicControlsLayout->addWidget( m_panningKnob, 0, 1 );
@@ -178,7 +178,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
// set up pitch knob
m_pitchKnob = new Knob( knobBright_26, nullptr, tr( "Pitch" ) );
m_pitchKnob = new Knob( KnobType::Bright26, nullptr, tr( "Pitch" ) );
m_pitchKnob->setHintText( tr( "Pitch:" ), " " + tr( "cents" ) );
basicControlsLayout->addWidget( m_pitchKnob, 0, 3 );
@@ -356,7 +356,7 @@ void InstrumentTrackWindow::modelChanged()
m_mixerChannelNumber->setModel( &m_track->m_mixerChannelModel );
m_pianoView->setModel( &m_track->m_piano );
if( m_track->instrument() && m_track->instrument()->flags().testFlag( Instrument::IsNotBendable ) == false )
if( m_track->instrument() && m_track->instrument()->flags().testFlag( Instrument::Flag::IsNotBendable ) == false )
{
m_pitchKnob->setModel( &m_track->m_pitchModel );
m_pitchRangeSpinBox->setModel( &m_track->m_pitchRangeModel );
@@ -374,7 +374,7 @@ void InstrumentTrackWindow::modelChanged()
m_pitchRangeLabel->hide();
}
if (m_track->instrument() && m_track->instrument()->flags().testFlag(Instrument::IsMidiBased))
if (m_track->instrument() && m_track->instrument()->flags().testFlag(Instrument::Flag::IsMidiBased))
{
m_miscView->microtunerGroupBox()->hide();
m_track->m_microtuner.enabledModel()->setValue(false);
@@ -425,7 +425,7 @@ void InstrumentTrackWindow::saveSettingsBtnClicked()
!sfd.selectedFiles().isEmpty() &&
!sfd.selectedFiles().first().isEmpty() )
{
DataFile dataFile(DataFile::InstrumentTrackSettings);
DataFile dataFile(DataFile::Type::InstrumentTrackSettings);
QDomElement& content(dataFile.content());
m_track->setSimpleSerializing();
@@ -466,7 +466,7 @@ void InstrumentTrackWindow::updateInstrumentView()
m_tabWidget->addTab( m_instrumentView, tr( "Plugin" ), "plugin_tab", 0 );
m_tabWidget->setActiveTab( 0 );
m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) );
m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::Flag::IsSingleStreamed ) );
modelChanged(); // Get the instrument window to refresh
m_track->dataChanged(); // Get the text on the trackButton to change

View File

@@ -64,7 +64,7 @@ namespace lmms::gui
*/
auto WhiteKeys = std::array
{
Key_C, Key_D, Key_E, Key_F, Key_G, Key_A, Key_H
Key::C, Key::D, Key::E, Key::F, Key::G, Key::A, Key::H
} ;
@@ -95,7 +95,7 @@ PianoView::PianoView(QWidget *parent) :
QWidget(parent), /*!< Our parent */
ModelView(nullptr, this), /*!< Our view Model */
m_piano(nullptr), /*!< Our piano Model */
m_startKey(Key_C + Octave_3*KeysPerOctave), /*!< The first key displayed? */
m_startKey(Octave::Octave_3 + Key::C), /*!< The first key displayed? */
m_lastKey(-1), /*!< The last key displayed? */
m_movedNoteModel(nullptr) /*!< Key marker which is being moved */
{
@@ -138,7 +138,7 @@ PianoView::PianoView(QWidget *parent) :
m_pianoScroll = new QScrollBar( Qt::Horizontal, this );
m_pianoScroll->setSingleStep( 1 );
m_pianoScroll->setPageStep( 20 );
m_pianoScroll->setValue(Octave_3 * Piano::WhiteKeysPerOctave);
m_pianoScroll->setValue(static_cast<int>(Octave::Octave_3) * Piano::WhiteKeysPerOctave);
// and connect it to this widget
connect( m_pianoScroll, SIGNAL(valueChanged(int)),
@@ -155,14 +155,10 @@ PianoView::PianoView(QWidget *parent) :
connect(Engine::getSong(), SIGNAL(keymapListChanged(int)), this, SLOT(update()));
}
/*! \brief Map a keyboard key being pressed to a note in our keyboard view
*
* \param _k The keyboard scan code of the key being pressed.
* \todo check the scan codes for ',' = c, 'L' = c#, '.' = d, ':' = d#,
* '/' = d, '[' = f', '=' = f'#, ']' = g' - Paul's additions
*/
int PianoView::getKeyFromKeyEvent( QKeyEvent * _ke )
static int getKeyOffsetFromKeyEvent( QKeyEvent * _ke )
{
// TODO: check the scan codes for ',' = c, 'L' = c#, '.' = d, ':' = d#,
// '/' = d, '[' = f', '=' = f'#, ']' = g' - Paul's additions
#ifdef LMMS_BUILD_APPLE
const int k = _ke->nativeVirtualKey();
#else
@@ -297,8 +293,14 @@ int PianoView::getKeyFromKeyEvent( QKeyEvent * _ke )
return -100;
}
/*! \brief Map a keyboard key being pressed to a note in our keyboard view
*
*/
int PianoView::getKeyFromKeyEvent( QKeyEvent * ke )
{
const auto key = static_cast<Key>(getKeyOffsetFromKeyEvent(ke));
return DefaultOctave + key - KeysPerOctave;
}
/*! \brief Register a change to this piano display view
*
@@ -398,8 +400,8 @@ int PianoView::getKeyFromMouse( const QPoint & _p ) const
*/
void PianoView::pianoScrolled(int new_pos)
{
m_startKey = WhiteKeys[new_pos % Piano::WhiteKeysPerOctave] +
(new_pos / Piano::WhiteKeysPerOctave) * KeysPerOctave;
m_startKey = static_cast<Octave>(new_pos / Piano::WhiteKeysPerOctave)
+ WhiteKeys[new_pos % Piano::WhiteKeysPerOctave];
update();
}
@@ -625,8 +627,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
*/
void PianoView::keyPressEvent( QKeyEvent * _ke )
{
const int key_num = getKeyFromKeyEvent( _ke ) +
( DefaultOctave - 1 ) * KeysPerOctave;
const int key_num = getKeyFromKeyEvent( _ke );
if( _ke->isAutoRepeat() == false && key_num > -1 )
{
@@ -654,8 +655,7 @@ void PianoView::keyPressEvent( QKeyEvent * _ke )
*/
void PianoView::keyReleaseEvent( QKeyEvent * _ke )
{
const int key_num = getKeyFromKeyEvent( _ke ) +
( DefaultOctave - 1 ) * KeysPerOctave;
const int key_num = getKeyFromKeyEvent( _ke );
if( _ke->isAutoRepeat() == false && key_num > -1 )
{
if( m_piano != nullptr )
@@ -913,7 +913,7 @@ void PianoView::paintEvent( QPaintEvent * )
x += PW_WHITE_KEY_WIDTH;
if ((Keys)(cur_key % KeysPerOctave) == Key_C)
if ((Key)(cur_key % KeysPerOctave) == Key::C)
{
// label key of note C with "C" and number of current octave
p.drawText(x - PW_WHITE_KEY_WIDTH, LABEL_TEXT_SIZE + 2,
@@ -927,7 +927,7 @@ void PianoView::paintEvent( QPaintEvent * )
int white_cnt = 0;
int startKey = m_startKey;
if (startKey > 0 && Piano::isBlackKey(static_cast<Keys>(--startKey)))
if (startKey > 0 && Piano::isBlackKey(--startKey))
{
if (m_piano && m_piano->instrumentTrack()->isKeyMapped(startKey))
{

View File

@@ -30,7 +30,7 @@ namespace lmms::gui
{
MidiPortMenu::MidiPortMenu( MidiPort::Modes _mode ) :
MidiPortMenu::MidiPortMenu( MidiPort::Mode _mode ) :
ModelView( nullptr, this ),
m_mode( _mode )
{
@@ -46,12 +46,12 @@ MidiPortMenu::MidiPortMenu( MidiPort::Modes _mode ) :
void MidiPortMenu::modelChanged()
{
auto mp = castModel<MidiPort>();
if( m_mode == MidiPort::Input )
if( m_mode == MidiPort::Mode::Input )
{
connect( mp, SIGNAL(readablePortsChanged()),
this, SLOT(updateMenu()));
}
else if( m_mode == MidiPort::Output )
else if( m_mode == MidiPort::Mode::Output )
{
connect( mp, SIGNAL(writablePortsChanged()),
this, SLOT(updateMenu()));
@@ -64,12 +64,12 @@ void MidiPortMenu::modelChanged()
void MidiPortMenu::activatedPort( QAction * _item )
{
if( m_mode == MidiPort::Input )
if( m_mode == MidiPort::Mode::Input )
{
castModel<MidiPort>()->subscribeReadablePort( _item->text(),
_item->isChecked() );
}
else if( m_mode == MidiPort::Output )
else if( m_mode == MidiPort::Mode::Output )
{
castModel<MidiPort>()->subscribeWritablePort( _item->text(),
_item->isChecked() );
@@ -82,7 +82,7 @@ void MidiPortMenu::activatedPort( QAction * _item )
void MidiPortMenu::updateMenu()
{
auto mp = castModel<MidiPort>();
const MidiPort::Map & map = ( m_mode == MidiPort::Input ) ?
const MidiPort::Map & map = ( m_mode == MidiPort::Mode::Input ) ?
mp->readablePorts() : mp->writablePorts();
clear();
for( MidiPort::Map::ConstIterator it = map.begin();

View File

@@ -169,7 +169,7 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent,
// our port-menus when being clicked
if( !Engine::audioEngine()->midiClient()->isRaw() )
{
m_readablePorts = new MidiPortMenu( MidiPort::Input );
m_readablePorts = new MidiPortMenu( MidiPort::Mode::Input );
connect( m_readablePorts, SIGNAL(triggered(QAction*)),
this, SLOT(enableAutoDetect(QAction*)));
auto rp_btn = new ToolButton(m_midiGroupBox);
@@ -242,9 +242,9 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent,
{
cc = m_targetModel->controllerConnection();
if( cc && cc->getController()->type() != Controller::DummyController && Engine::getSong() )
if( cc && cc->getController()->type() != Controller::ControllerType::Dummy && Engine::getSong() )
{
if ( cc->getController()->type() == Controller::MidiController )
if ( cc->getController()->type() == Controller::ControllerType::Midi )
{
m_midiGroupBox->model()->setValue( true );
// ensure controller is created

View File

@@ -53,7 +53,7 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) :
EffectKeyList subPluginEffectKeys;
for (const Plugin::Descriptor* desc: getPluginFactory()->descriptors(Plugin::Effect))
for (const Plugin::Descriptor* desc: getPluginFactory()->descriptors(Plugin::Type::Effect))
{
if( desc->subPluginFeatures )
{

View File

@@ -66,7 +66,7 @@ ExportProjectDialog::ExportProjectDialog( const QString & _file_name,
// Add to combo box.
fileFormatCB->addItem( ProjectRenderer::tr(
ProjectRenderer::fileEncodeDevices[i].m_description ),
QVariant( ProjectRenderer::fileEncodeDevices[i].m_fileFormat ) // Format tag; later used for identification.
QVariant( static_cast<int>(ProjectRenderer::fileEncodeDevices[i].m_fileFormat) ) // Format tag; later used for identification.
);
// If this is our extension, select it.
@@ -142,13 +142,13 @@ OutputSettings::StereoMode mapToStereoMode(int index)
switch (index)
{
case 0:
return OutputSettings::StereoMode_Mono;
return OutputSettings::StereoMode::Mono;
case 1:
return OutputSettings::StereoMode_Stereo;
return OutputSettings::StereoMode::Stereo;
case 2:
return OutputSettings::StereoMode_JointStereo;
return OutputSettings::StereoMode::JointStereo;
default:
return OutputSettings::StereoMode_Stereo;
return OutputSettings::StereoMode::Stereo;
}
}
@@ -216,27 +216,27 @@ void ExportProjectDialog::onFileFormatChanged(int index)
// and adjust the UI properly.
QVariant format_tag = fileFormatCB->itemData(index);
bool successful_conversion = false;
auto exportFormat = static_cast<ProjectRenderer::ExportFileFormats>(
auto exportFormat = static_cast<ProjectRenderer::ExportFileFormat>(
format_tag.toInt(&successful_conversion)
);
Q_ASSERT(successful_conversion);
bool stereoModeVisible = (exportFormat == ProjectRenderer::MP3File);
bool stereoModeVisible = (exportFormat == ProjectRenderer::ExportFileFormat::MP3);
bool sampleRateControlsVisible = (exportFormat != ProjectRenderer::MP3File);
bool sampleRateControlsVisible = (exportFormat != ProjectRenderer::ExportFileFormat::MP3);
bool bitRateControlsEnabled =
(exportFormat == ProjectRenderer::OggFile ||
exportFormat == ProjectRenderer::MP3File);
(exportFormat == ProjectRenderer::ExportFileFormat::Ogg ||
exportFormat == ProjectRenderer::ExportFileFormat::MP3);
bool bitDepthControlEnabled =
(exportFormat == ProjectRenderer::WaveFile ||
exportFormat == ProjectRenderer::FlacFile);
(exportFormat == ProjectRenderer::ExportFileFormat::Wave ||
exportFormat == ProjectRenderer::ExportFileFormat::Flac);
bool variableBitrateVisible = !(exportFormat == ProjectRenderer::MP3File || exportFormat == ProjectRenderer::FlacFile);
bool variableBitrateVisible = !(exportFormat == ProjectRenderer::ExportFileFormat::MP3 || exportFormat == ProjectRenderer::ExportFileFormat::Flac);
#ifdef LMMS_HAVE_SF_COMPLEVEL
bool compressionLevelVisible = (exportFormat == ProjectRenderer::FlacFile);
bool compressionLevelVisible = (exportFormat == ProjectRenderer::ExportFileFormat::Flac);
compressionWidget->setVisible(compressionLevelVisible);
#endif
@@ -251,12 +251,12 @@ void ExportProjectDialog::onFileFormatChanged(int index)
void ExportProjectDialog::startBtnClicked()
{
m_ft = ProjectRenderer::NumFileFormats;
m_ft = ProjectRenderer::ExportFileFormat::Count;
// Get file format from current menu selection.
bool successful_conversion = false;
QVariant tag = fileFormatCB->itemData(fileFormatCB->currentIndex());
m_ft = static_cast<ProjectRenderer::ExportFileFormats>(
m_ft = static_cast<ProjectRenderer::ExportFileFormat>(
tag.toInt(&successful_conversion)
);

View File

@@ -91,7 +91,7 @@ inline void labelWidget(QWidget * w, const QString & txt)
SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
SetupDialog::SetupDialog(ConfigTab tab_to_open) :
m_displaydBFS(ConfigManager::inst()->value(
"app", "displaydbfs").toInt()),
m_tooltips(!ConfigManager::inst()->value(
@@ -837,7 +837,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
tr("Paths"), 4, true, true)->setIcon(
embed::getIconPixmap("setup_directories"));
m_tabBar->setActiveTab(tab_to_open);
m_tabBar->setActiveTab(static_cast<int>(tab_to_open));
// Horizontal layout ordering.
hlayout->addSpacing(2);

View File

@@ -87,7 +87,7 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH;
}
m_volumeKnob = new Knob( knobSmall_17, getTrackSettingsWidget(),
m_volumeKnob = new Knob( KnobType::Small17, getTrackSettingsWidget(),
tr( "Volume" ) );
m_volumeKnob->setVolumeKnob( true );
m_volumeKnob->setModel( &_it->m_volumeModel );
@@ -96,7 +96,7 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
m_volumeKnob->setLabel( tr( "VOL" ) );
m_volumeKnob->show();
m_panningKnob = new Knob( knobSmall_17, getTrackSettingsWidget(),
m_panningKnob = new Knob( KnobType::Small17, getTrackSettingsWidget(),
tr( "Panning" ) );
m_panningKnob->setModel( &_it->m_panningModel );
m_panningKnob->setHintText(tr("Panning:"), "%");
@@ -110,9 +110,9 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
if( !Engine::audioEngine()->midiClient()->isRaw() )
{
_it->m_midiPort.m_readablePortsMenu = new MidiPortMenu(
MidiPort::Input );
MidiPort::Mode::Input );
_it->m_midiPort.m_writablePortsMenu = new MidiPortMenu(
MidiPort::Output );
MidiPort::Mode::Output );
_it->m_midiPort.m_readablePortsMenu->setModel(
&_it->m_midiPort );
_it->m_midiPort.m_writablePortsMenu->setModel(

View File

@@ -59,7 +59,7 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
m_tlb->move(3, 1);
m_tlb->show();
m_volumeKnob = new Knob( knobSmall_17, getTrackSettingsWidget(),
m_volumeKnob = new Knob( KnobType::Small17, getTrackSettingsWidget(),
tr( "Track volume" ) );
m_volumeKnob->setVolumeKnob( true );
m_volumeKnob->setModel( &_t->m_volumeModel );
@@ -73,7 +73,7 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
m_volumeKnob->setLabel( tr( "VOL" ) );
m_volumeKnob->show();
m_panningKnob = new Knob( knobSmall_17, getTrackSettingsWidget(),
m_panningKnob = new Knob( KnobType::Small17, getTrackSettingsWidget(),
tr( "Panning" ) );
m_panningKnob->setModel( &_t->m_panningModel );
m_panningKnob->setHintText( tr( "Panning:" ), "%" );

View File

@@ -291,7 +291,7 @@ void TrackContentWidget::dragEnterEvent( QDragEnterEvent * dee )
else
{
StringPairDrag::processDragEnterEvent( dee, "clip_" +
QString::number( getTrack()->type() ) );
QString::number( static_cast<int>(getTrack()->type()) ) );
}
}
@@ -325,7 +325,7 @@ bool TrackContentWidget::canPasteSelection( TimePos clipPos, const QMimeData* md
QString value = decodeValue( md );
// We can only paste into tracks of the same type
if (type != ("clip_" + QString::number(t->type())))
if (type != ("clip_" + QString::number(static_cast<int>(t->type()))))
{
return false;
}
@@ -382,7 +382,7 @@ bool TrackContentWidget::canPasteSelection( TimePos clipPos, const QMimeData* md
}
// Track must be of the same type
auto startTrackType = clipElement.attributeNode("trackType").value().toInt();
auto startTrackType = static_cast<Track::Type>(clipElement.attributeNode("trackType").value().toInt());
Track * endTrack = tracks.at( finalTrackIndex );
if( startTrackType != endTrack->type() )
{
@@ -538,7 +538,7 @@ void TrackContentWidget::mousePressEvent( QMouseEvent * me )
// Enable box select if control is held when clicking an empty space
// (If we had clicked a Clip it would have intercepted the mouse event)
if( me->modifiers() & Qt::ControlModifier ){
getGUI()->songEditor()->m_editor->setEditMode(SongEditor::EditMode::SelectMode);
getGUI()->songEditor()->m_editor->setEditMode(SongEditor::EditMode::Select);
}
// Forward event to allow box select if the editor supports it and is in that mode
if( m_trackView->trackContainerView()->allowRubberband() == true )
@@ -655,7 +655,7 @@ void TrackContentWidget::contextMenuEvent( QContextMenuEvent * cme )
QMenu contextMenu( this );
QAction *pasteA = contextMenu.addAction( embed::getIconPixmap( "edit_paste" ),
tr( "Paste" ), [this, cme](){ contextMenuAction( cme, Paste ); } );
tr( "Paste" ), [this, cme](){ contextMenuAction( cme, ContextMenuAction::Paste ); } );
// If we can't paste in the current TCW for some reason, disable the action so the user knows
pasteA->setEnabled( canPasteSelection( getPosition( cme->x() ), getMimeData() ) ? true : false );
@@ -669,7 +669,7 @@ void TrackContentWidget::contextMenuAction( QContextMenuEvent * cme, ContextMenu
switch( action )
{
case Paste:
case ContextMenuAction::Paste:
// Paste the selection on the TimePos of the context menu event
TimePos clipPos = getPosition( cme->x() );

View File

@@ -187,7 +187,7 @@ void TrackLabelButton::mouseReleaseEvent( QMouseEvent *_me )
void TrackLabelButton::paintEvent( QPaintEvent * _pe )
{
if( m_trackView->getTrack()->type() == Track::InstrumentTrack )
if( m_trackView->getTrack()->type() == Track::Type::Instrument )
{
auto it = dynamic_cast<InstrumentTrack*>(m_trackView->getTrack());
const PixmapLoader * pl;

View File

@@ -137,12 +137,12 @@ void TrackOperationsWidget::mousePressEvent( QMouseEvent * me )
{
if( me->button() == Qt::LeftButton &&
me->modifiers() & Qt::ControlModifier &&
m_trackView->getTrack()->type() != Track::PatternTrack)
m_trackView->getTrack()->type() != Track::Type::Pattern)
{
DataFile dataFile( DataFile::DragNDropData );
DataFile dataFile( DataFile::Type::DragNDropData );
m_trackView->getTrack()->saveState( dataFile, dataFile.content() );
new StringPairDrag( QString( "track_%1" ).arg(
m_trackView->getTrack()->type() ),
static_cast<int>(m_trackView->getTrack()->type()) ),
dataFile.toString(), m_trackView->getTrackSettingsWidget()->grab(),
this );
}

View File

@@ -65,7 +65,7 @@ TrackView::TrackView( Track * track, TrackContainerView * tcv ) :
m_trackOperationsWidget( this ), /*!< Our trackOperationsWidget */
m_trackSettingsWidget( this ), /*!< Our trackSettingsWidget */
m_trackContentWidget( this ), /*!< Our trackContentWidget */
m_action( NoAction ) /*!< The action we're currently performing */
m_action( Action::None ) /*!< The action we're currently performing */
{
setAutoFillBackground( true );
QPalette pal;
@@ -207,7 +207,7 @@ void TrackView::modelChanged()
void TrackView::dragEnterEvent( QDragEnterEvent * dee )
{
StringPairDrag::processDragEnterEvent( dee, "track_" +
QString::number( m_track->type() ) );
QString::number( static_cast<int>(m_track->type()) ) );
}
@@ -225,7 +225,7 @@ void TrackView::dropEvent( QDropEvent * de )
{
QString type = StringPairDrag::decodeKey( de );
QString value = StringPairDrag::decodeValue( de );
if( type == ( "track_" + QString::number( m_track->type() ) ) )
if( type == ( "track_" + QString::number( static_cast<int>(m_track->type()) ) ) )
{
// value contains our XML-data so simply create a
// DataFile which does the rest for us...
@@ -278,7 +278,7 @@ void TrackView::mousePressEvent( QMouseEvent * me )
{
if( me->modifiers() & Qt::ShiftModifier )
{
m_action = ResizeTrack;
m_action = Action::Resize;
QCursor::setPos( mapToGlobal( QPoint( me->x(),
height() ) ) );
QCursor c( Qt::SizeVerCursor);
@@ -292,7 +292,7 @@ void TrackView::mousePressEvent( QMouseEvent * me )
return;
}
m_action = MoveTrack;
m_action = Action::Move;
QCursor c( Qt::SizeVerCursor );
QApplication::setOverrideCursor( c );
@@ -338,7 +338,7 @@ void TrackView::mouseMoveEvent( QMouseEvent * me )
{
QWidget::mouseMoveEvent( me );
}
else if( m_action == MoveTrack )
else if( m_action == Action::Move )
{
// look which track-widget the mouse-cursor is over
const int yPos =
@@ -362,7 +362,7 @@ void TrackView::mouseMoveEvent( QMouseEvent * me )
}
}
}
else if( m_action == ResizeTrack )
else if( m_action == Action::Resize )
{
setFixedHeight( qMax<int>( me->y(), MINIMAL_TRACK_HEIGHT ) );
m_trackContainerView->realignTracks();
@@ -383,7 +383,7 @@ void TrackView::mouseMoveEvent( QMouseEvent * me )
*/
void TrackView::mouseReleaseEvent( QMouseEvent * me )
{
m_action = NoAction;
m_action = Action::None;
while( QApplication::overrideCursor() != nullptr )
{
QApplication::restoreOverrideCursor();

View File

@@ -28,7 +28,7 @@ namespace lmms::gui
{
CustomTextKnob::CustomTextKnob( knobTypes _knob_num, QWidget * _parent, const QString & _name, const QString & _value_text ) :
CustomTextKnob::CustomTextKnob( KnobType _knob_num, QWidget * _parent, const QString & _name, const QString & _value_text ) :
Knob( _knob_num, _parent, _name ),
m_value_text( _value_text ) {}

View File

@@ -36,7 +36,7 @@ namespace lmms
namespace gui
{
Graph::Graph( QWidget * _parent, graphStyle _style, int _width,
Graph::Graph( QWidget * _parent, Style _style, int _width,
int _height ) :
QWidget( _parent ),
/* TODO: size, background? */
@@ -305,7 +305,7 @@ void Graph::paintEvent( QPaintEvent * )
switch( m_graphStyle )
{
case Graph::LinearStyle:
case Style::Linear:
p.setRenderHints( QPainter::Antialiasing, true );
for( int i=0; i < length; i++ )
@@ -329,7 +329,7 @@ void Graph::paintEvent( QPaintEvent * )
break;
case Graph::NearestStyle:
case Style::Nearest:
for( int i=0; i < length; i++ )
{
p.drawLine(2+static_cast<int>(i*xscale),
@@ -350,7 +350,7 @@ void Graph::paintEvent( QPaintEvent * )
2+static_cast<int>( ( (*samps)[length] - maxVal ) * yscale ) );
break;
case Graph::LinearNonCyclicStyle:
case Style::LinearNonCyclic:
p.setRenderHints( QPainter::Antialiasing, true );
for( int i=0; i < length; i++ )
@@ -369,7 +369,7 @@ void Graph::paintEvent( QPaintEvent * )
p.setRenderHints( QPainter::Antialiasing, false );
break;
case Graph::BarStyle:
case Style::Bar:
for( int i=0; i <= length; i++ )
{
p.fillRect( 2+static_cast<int>( i*xscale ),

View File

@@ -57,7 +57,7 @@ SimpleTextFloat * Knob::s_textFloat = nullptr;
Knob::Knob( knobTypes _knob_num, QWidget * _parent, const QString & _name ) :
Knob::Knob( KnobType _knob_num, QWidget * _parent, const QString & _name ) :
QWidget( _parent ),
FloatModelView( new FloatModel( 0, 0, 0, 1, nullptr, _name, true ), this ),
m_label( "" ),
@@ -75,7 +75,7 @@ Knob::Knob( knobTypes _knob_num, QWidget * _parent, const QString & _name ) :
}
Knob::Knob( QWidget * _parent, const QString & _name ) :
Knob( knobBright_26, _parent, _name )
Knob( KnobType::Bright26, _parent, _name )
{
}
@@ -106,15 +106,15 @@ void Knob::initUi( const QString & _name )
// overrides that color.
switch (knobNum())
{
case knobSmall_17:
case knobBright_26:
case knobDark_28:
case KnobType::Small17:
case KnobType::Bright26:
case KnobType::Dark28:
m_lineActiveColor = QApplication::palette().color(QPalette::Active, QPalette::WindowText);
m_arcActiveColor = QColor(QApplication::palette().color(
QPalette::Active, QPalette::WindowText));
m_arcActiveColor.setAlpha(70);
break;
case knobVintage_32:
case KnobType::Vintage32:
m_lineActiveColor = QApplication::palette().color(QPalette::Active, QPalette::Shadow);
m_arcActiveColor = QColor(QApplication::palette().color(
QPalette::Active, QPalette::Shadow));
@@ -132,24 +132,24 @@ void Knob::initUi( const QString & _name )
void Knob::onKnobNumUpdated()
{
if( m_knobNum != knobStyled )
if( m_knobNum != KnobType::Styled )
{
QString knobFilename;
switch (m_knobNum)
{
case knobDark_28:
case KnobType::Dark28:
knobFilename = "knob01";
break;
case knobBright_26:
case KnobType::Bright26:
knobFilename = "knob02";
break;
case knobSmall_17:
case KnobType::Small17:
knobFilename = "knob03";
break;
case knobVintage_32:
case KnobType::Vintage32:
knobFilename = "knob05";
break;
case knobStyled: // only here to stop the compiler from complaining
case KnobType::Styled: // only here to stop the compiler from complaining
break;
}
@@ -251,7 +251,7 @@ void Knob::setOuterRadius( float r )
knobTypes Knob::knobNum() const
KnobType Knob::knobNum() const
{
return m_knobNum;
}
@@ -259,7 +259,7 @@ knobTypes Knob::knobNum() const
void Knob::setknobNum( knobTypes k )
void Knob::setknobNum( KnobType k )
{
if( m_knobNum != k )
{
@@ -397,7 +397,7 @@ void Knob::drawKnob( QPainter * _p )
QPoint mid;
if( m_knobNum == knobStyled )
if( m_knobNum == KnobType::Styled )
{
p.setRenderHint( QPainter::Antialiasing );
@@ -448,17 +448,17 @@ void Knob::drawKnob( QPainter * _p )
p.setPen(QPen(currentLineColor, 2));
switch( m_knobNum )
{
case knobSmall_17:
case KnobType::Small17:
{
p.drawLine( calculateLine( mid, radius-2 ) );
break;
}
case knobBright_26:
case KnobType::Bright26:
{
p.drawLine( calculateLine( mid, radius-5 ) );
break;
}
case knobDark_28:
case KnobType::Dark28:
{
const float rb = qMax<float>( ( radius - 10 ) / 3.0,
0.0 );
@@ -468,12 +468,12 @@ void Knob::drawKnob( QPainter * _p )
p.drawLine( ln );
break;
}
case knobVintage_32:
case KnobType::Vintage32:
{
p.drawLine( calculateLine( mid, radius-2, 2 ) );
break;
}
case knobStyled:
case KnobType::Styled:
break;
}

View File

@@ -44,7 +44,7 @@ static const auto names = std::array<QString, 3>
LedCheckBox::LedCheckBox( const QString & _text, QWidget * _parent,
const QString & _name, LedColors _color ) :
const QString & _name, LedColor _color ) :
AutomatableButton( _parent, _name ),
m_text( _text )
{
@@ -55,7 +55,7 @@ LedCheckBox::LedCheckBox( const QString & _text, QWidget * _parent,
LedCheckBox::LedCheckBox( QWidget * _parent,
const QString & _name, LedColors _color ) :
const QString & _name, LedColor _color ) :
LedCheckBox( QString(), _parent, _name, _color )
{
}
@@ -103,16 +103,12 @@ void LedCheckBox::paintEvent( QPaintEvent * )
void LedCheckBox::initUi( LedColors _color )
void LedCheckBox::initUi( LedColor _color )
{
setCheckable( true );
if( _color >= NumColors || _color < Yellow )
{
_color = Yellow;
}
m_ledOnPixmap = new QPixmap( embed::getIconPixmap(
names[_color].toUtf8().constData() ) );
names[static_cast<std::size_t>(_color)].toUtf8().constData() ) );
m_ledOffPixmap = new QPixmap( embed::getIconPixmap( "led_off" ) );
setFont( pointSize<7>( font() ) );

View File

@@ -42,7 +42,7 @@ namespace lmms::gui
TempoSyncKnob::TempoSyncKnob( knobTypes _knob_num, QWidget * _parent,
TempoSyncKnob::TempoSyncKnob( KnobType _knob_num, QWidget * _parent,
const QString & _name ) :
Knob( _knob_num, _parent, _name ),
m_tempoSyncIcon( embed::getIconPixmap( "tempo_sync" ) ),
@@ -104,51 +104,51 @@ void TempoSyncKnob::contextMenuEvent( QContextMenuEvent * )
connect( syncMenu, SIGNAL(triggered(QAction*)),
model(), SLOT(setTempoSync(QAction*)));
syncMenu->addAction( embed::getIconPixmap( "note_none" ),
tr( "No Sync" ) )->setData( (int) TempoSyncKnobModel::SyncNone );
tr( "No Sync" ) )->setData( (int) TempoSyncKnobModel::SyncMode::None );
if( limit / 0.125f <= model()->maxValue() )
{
syncMenu->addAction( embed::getIconPixmap( "note_double_whole" ),
tr( "Eight beats" ) )->setData(
(int) TempoSyncKnobModel::SyncDoubleWholeNote );
(int) TempoSyncKnobModel::SyncMode::DoubleWholeNote );
}
if( limit / 0.25f <= model()->maxValue() )
{
syncMenu->addAction( embed::getIconPixmap( "note_whole" ),
tr( "Whole note" ) )->setData(
(int) TempoSyncKnobModel::SyncWholeNote );
(int) TempoSyncKnobModel::SyncMode::WholeNote );
}
if( limit / 0.5f <= model()->maxValue() )
{
syncMenu->addAction( embed::getIconPixmap( "note_half" ),
tr( "Half note" ) )->setData(
(int) TempoSyncKnobModel::SyncHalfNote );
(int) TempoSyncKnobModel::SyncMode::HalfNote );
}
if( limit <= model()->maxValue() )
{
syncMenu->addAction( embed::getIconPixmap( "note_quarter" ),
tr( "Quarter note" ) )->setData(
(int) TempoSyncKnobModel::SyncQuarterNote );
(int) TempoSyncKnobModel::SyncMode::QuarterNote );
}
if( limit / 2.0f <= model()->maxValue() )
{
syncMenu->addAction( embed::getIconPixmap( "note_eighth" ),
tr( "8th note" ) )->setData(
(int) TempoSyncKnobModel::SyncEighthNote );
(int) TempoSyncKnobModel::SyncMode::EighthNote );
}
if( limit / 4.0f <= model()->maxValue() )
{
syncMenu->addAction( embed::getIconPixmap( "note_sixteenth" ),
tr( "16th note" ) )->setData(
(int) TempoSyncKnobModel::SyncSixteenthNote );
(int) TempoSyncKnobModel::SyncMode::SixteenthNote );
}
syncMenu->addAction( embed::getIconPixmap( "note_thirtysecond" ),
tr( "32nd note" ) )->setData(
(int) TempoSyncKnobModel::SyncThirtysecondNote );
(int) TempoSyncKnobModel::SyncMode::ThirtysecondNote );
syncMenu->addAction( embed::getIconPixmap( "dont_know" ),
tr( "Custom..." ),
this, SLOT(showCustom())
)->setData(
(int) TempoSyncKnobModel::SyncCustom );
(int) TempoSyncKnobModel::SyncMode::Custom );
contextMenu.addSeparator();
}
@@ -162,11 +162,11 @@ void TempoSyncKnob::contextMenuEvent( QContextMenuEvent * )
void TempoSyncKnob::updateDescAndIcon()
{
if( model()->m_tempoSyncMode )
if( model()->m_tempoSyncMode != TempoSyncKnobModel::SyncMode::None )
{
switch( model()->m_tempoSyncMode )
{
case TempoSyncKnobModel::SyncCustom:
case TempoSyncKnobModel::SyncMode::Custom:
m_tempoSyncDescription = tr( "Custom " ) +
"(" +
QString::number( model()->m_custom.numeratorModel().value() ) +
@@ -174,31 +174,31 @@ void TempoSyncKnob::updateDescAndIcon()
QString::number( model()->m_custom.denominatorModel().value() ) +
")";
break;
case TempoSyncKnobModel::SyncDoubleWholeNote:
case TempoSyncKnobModel::SyncMode::DoubleWholeNote:
m_tempoSyncDescription = tr(
"Synced to Eight Beats" );
break;
case TempoSyncKnobModel::SyncWholeNote:
case TempoSyncKnobModel::SyncMode::WholeNote:
m_tempoSyncDescription = tr(
"Synced to Whole Note" );
break;
case TempoSyncKnobModel::SyncHalfNote:
case TempoSyncKnobModel::SyncMode::HalfNote:
m_tempoSyncDescription = tr(
"Synced to Half Note" );
break;
case TempoSyncKnobModel::SyncQuarterNote:
case TempoSyncKnobModel::SyncMode::QuarterNote:
m_tempoSyncDescription = tr(
"Synced to Quarter Note" );
break;
case TempoSyncKnobModel::SyncEighthNote:
case TempoSyncKnobModel::SyncMode::EighthNote:
m_tempoSyncDescription = tr(
"Synced to 8th Note" );
break;
case TempoSyncKnobModel::SyncSixteenthNote:
case TempoSyncKnobModel::SyncMode::SixteenthNote:
m_tempoSyncDescription = tr(
"Synced to 16th Note" );
break;
case TempoSyncKnobModel::SyncThirtysecondNote:
case TempoSyncKnobModel::SyncMode::ThirtysecondNote:
m_tempoSyncDescription = tr(
"Synced to 32nd Note" );
break;
@@ -210,38 +210,38 @@ void TempoSyncKnob::updateDescAndIcon()
m_tempoSyncDescription = tr( "Tempo Sync" );
}
if( m_custom != nullptr &&
model()->m_tempoSyncMode != TempoSyncKnobModel::SyncCustom )
model()->m_tempoSyncMode != TempoSyncKnobModel::SyncMode::Custom )
{
m_custom->parentWidget()->hide();
}
switch( model()->m_tempoSyncMode )
{
case TempoSyncKnobModel::SyncNone:
case TempoSyncKnobModel::SyncMode::None:
m_tempoSyncIcon = embed::getIconPixmap( "tempo_sync" );
break;
case TempoSyncKnobModel::SyncCustom:
case TempoSyncKnobModel::SyncMode::Custom:
m_tempoSyncIcon = embed::getIconPixmap( "dont_know" );
break;
case TempoSyncKnobModel::SyncDoubleWholeNote:
case TempoSyncKnobModel::SyncMode::DoubleWholeNote:
m_tempoSyncIcon = embed::getIconPixmap( "note_double_whole" );
break;
case TempoSyncKnobModel::SyncWholeNote:
case TempoSyncKnobModel::SyncMode::WholeNote:
m_tempoSyncIcon = embed::getIconPixmap( "note_whole" );
break;
case TempoSyncKnobModel::SyncHalfNote:
case TempoSyncKnobModel::SyncMode::HalfNote:
m_tempoSyncIcon = embed::getIconPixmap( "note_half" );
break;
case TempoSyncKnobModel::SyncQuarterNote:
case TempoSyncKnobModel::SyncMode::QuarterNote:
m_tempoSyncIcon = embed::getIconPixmap( "note_quarter" );
break;
case TempoSyncKnobModel::SyncEighthNote:
case TempoSyncKnobModel::SyncMode::EighthNote:
m_tempoSyncIcon = embed::getIconPixmap( "note_eighth" );
break;
case TempoSyncKnobModel::SyncSixteenthNote:
case TempoSyncKnobModel::SyncMode::SixteenthNote:
m_tempoSyncIcon = embed::getIconPixmap( "note_sixteenth" );
break;
case TempoSyncKnobModel::SyncThirtysecondNote:
case TempoSyncKnobModel::SyncMode::ThirtysecondNote:
m_tempoSyncIcon = embed::getIconPixmap( "note_thirtysecond" );
break;
default:
@@ -305,7 +305,7 @@ void TempoSyncKnob::showCustom()
m_custom->setModel( &model()->m_custom );
}
m_custom->parentWidget()->show();
model()->setTempoSync( TempoSyncKnobModel::SyncCustom );
model()->setTempoSync( TempoSyncKnobModel::SyncMode::Custom );
}

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