diff --git a/include/AudioEngine.h b/include/AudioEngine.h index 3b15518a1..93770ef72 100644 --- a/include/AudioEngine.h +++ b/include/AudioEngine.h @@ -37,6 +37,7 @@ #include "Note.h" #include "FifoBuffer.h" #include "AudioEngineProfiler.h" +#include "PlayHandle.h" class AudioDevice; @@ -283,7 +284,7 @@ public: inline bool hasFifoWriter() const { - return m_fifoWriter != NULL; + return m_fifoWriter != nullptr; } void pushInputFrames( sampleFrame * _ab, const f_cnt_t _frames ); diff --git a/include/AudioEngineWorkerThread.h b/include/AudioEngineWorkerThread.h index 7b4a83630..546a963b3 100644 --- a/include/AudioEngineWorkerThread.h +++ b/include/AudioEngineWorkerThread.h @@ -47,7 +47,8 @@ public: Dynamic // jobs can be added while processing queue } ; -#define JOB_QUEUE_SIZE 8192 + static constexpr size_t JOB_QUEUE_SIZE = 8192; + JobQueue() : m_items(), m_writeIndex( 0 ), diff --git a/include/AudioPort.h b/include/AudioPort.h index 0e48d90ed..5ce4fbc8a 100644 --- a/include/AudioPort.h +++ b/include/AudioPort.h @@ -42,8 +42,8 @@ class AudioPort : public ThreadableJob MM_OPERATORS public: AudioPort( const QString & _name, bool _has_effect_chain = true, - FloatModel * volumeModel = NULL, FloatModel * panningModel = NULL, - BoolModel * mutedModel = NULL ); + FloatModel * volumeModel = nullptr, FloatModel * panningModel = nullptr, + BoolModel * mutedModel = nullptr ); virtual ~AudioPort(); inline sampleFrame * buffer() diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index b61f761b5..88faeb4be 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -120,7 +120,7 @@ public: bool isAutomated() const; bool isAutomatedOrControlled() const { - return isAutomated() || m_controllerConnection != NULL; + return isAutomated() || m_controllerConnection != nullptr; } ControllerConnection* controllerConnection() const @@ -326,7 +326,7 @@ protected: const float min = 0, const float max = 0, const float step = 0, - Model* parent = NULL, + Model* parent = nullptr, const QString& displayName = QString(), bool defaultConstructed = false ); //! returns a value which is in range between min() and @@ -457,7 +457,7 @@ class LMMS_EXPORT FloatModel : public TypedAutomatableModel MODEL_IS_VISITABLE public: FloatModel( float val = 0, float min = 0, float max = 0, float step = 0, - Model * parent = NULL, + Model * parent = nullptr, const QString& displayName = QString(), bool defaultConstructed = false ) : TypedAutomatableModel( val, min, max, step, parent, displayName, defaultConstructed ) @@ -475,7 +475,7 @@ class LMMS_EXPORT IntModel : public TypedAutomatableModel MODEL_IS_VISITABLE public: IntModel( int val = 0, int min = 0, int max = 0, - Model* parent = NULL, + Model* parent = nullptr, const QString& displayName = QString(), bool defaultConstructed = false ) : TypedAutomatableModel( val, min, max, 1, parent, displayName, defaultConstructed ) @@ -491,7 +491,7 @@ class LMMS_EXPORT BoolModel : public TypedAutomatableModel MODEL_IS_VISITABLE public: BoolModel( const bool val = false, - Model* parent = NULL, + Model* parent = nullptr, const QString& displayName = QString(), bool defaultConstructed = false ) : TypedAutomatableModel( val, false, true, 1, parent, displayName, defaultConstructed ) diff --git a/include/AutomationNode.h b/include/AutomationNode.h index d65b7f426..0dbb4c649 100644 --- a/include/AutomationNode.h +++ b/include/AutomationNode.h @@ -26,14 +26,6 @@ #ifndef AUTOMATION_NODE_H #define AUTOMATION_NODE_H -// MACROs to help handling automation nodes -#define INVAL(x) ((x).value().getInValue()) -#define OUTVAL(x) ((x).value().getOutValue()) -#define OFFSET(x) ((x).value().getValueOffset()) -#define INTAN(x) ((x).value().getInTangent()) -#define OUTTAN(x) ((x).value().getOutTangent()) -#define POS(x) ((x).key()) - class AutomationPattern; diff --git a/include/AutomationPattern.h b/include/AutomationPattern.h index 1a98f4956..61a8af416 100644 --- a/include/AutomationPattern.h +++ b/include/AutomationPattern.h @@ -53,6 +53,8 @@ public: typedef QMap timeMap; typedef QVector> objectVector; + using TimemapIterator = timeMap::const_iterator; + AutomationPattern( AutomationTrack * _auto_track ); AutomationPattern( const AutomationPattern & _pat_to_copy ); virtual ~AutomationPattern() = default; @@ -207,5 +209,37 @@ private: } ; +//Short-hand functions to access node values in an automation pattern; +// replacement for CPP macros with the same purpose; could be refactored +// further in the future. +inline float INVAL(AutomationPattern::TimemapIterator it) +{ + return it->getInValue(); +} + +inline float OUTVAL(AutomationPattern::TimemapIterator it) +{ + return it->getOutValue(); +} + +inline float OFFSET(AutomationPattern::TimemapIterator it) +{ + return it->getValueOffset(); +} + +inline float INTAN(AutomationPattern::TimemapIterator it) +{ + return it->getInTangent(); +} + +inline float OUTTAN(AutomationPattern::TimemapIterator it) +{ + return it->getOutTangent(); +} + +inline int POS(AutomationPattern::TimemapIterator it) +{ + return it.key(); +} #endif diff --git a/include/BandLimitedWave.h b/include/BandLimitedWave.h index c05963ec4..1cd8d69ed 100644 --- a/include/BandLimitedWave.h +++ b/include/BandLimitedWave.h @@ -36,12 +36,12 @@ class QString; #include "Engine.h" #include "AudioEngine.h" -#define MAXLEN 11 -#define MIPMAPSIZE 2 << ( MAXLEN + 1 ) -#define MIPMAPSIZE3 3 << ( MAXLEN + 1 ) -#define MAXTBL 23 -#define MINTLEN 2 << 0 -#define MAXTLEN 3 << MAXLEN +constexpr int MAXLEN = 11; +constexpr int MIPMAPSIZE = 2 << ( MAXLEN + 1 ); +constexpr int MIPMAPSIZE3 = 3 << ( MAXLEN + 1 ); +constexpr int MAXTBL = 23; +constexpr int MINTLEN = 2 << 0; +constexpr int MAXTLEN = 3 << MAXLEN; // table for table sizes const int TLENS[MAXTBL+1] = { 2 << 0, 3 << 0, 2 << 1, 3 << 1, diff --git a/include/BasicFilters.h b/include/BasicFilters.h index c3a76d36e..180a5c8af 100644 --- a/include/BasicFilters.h +++ b/include/BasicFilters.h @@ -273,7 +273,7 @@ public: m_type = _idx == DoubleLowPass ? LowPass : Moog; - if( m_subFilter == NULL ) + if( m_subFilter == nullptr ) { m_subFilter = new BasicFilters( static_cast( @@ -286,7 +286,7 @@ public: m_doubleFilter( false ), m_sampleRate( (float) _sample_rate ), m_sampleRatio( 1.0f / m_sampleRate ), - m_subFilter( NULL ) + m_subFilter( nullptr ) { clearHistory(); } diff --git a/include/ComboBox.h b/include/ComboBox.h index 1ab1c240d..1f7dd43ff 100644 --- a/include/ComboBox.h +++ b/include/ComboBox.h @@ -36,7 +36,7 @@ class LMMS_EXPORT ComboBox : public QWidget, public IntModelView { Q_OBJECT public: - ComboBox( QWidget* parent = NULL, const QString& name = QString() ); + ComboBox( QWidget* parent = nullptr, const QString& name = QString() ); virtual ~ComboBox(); ComboBoxModel* model() diff --git a/include/ComboBoxModel.h b/include/ComboBoxModel.h index 24fa1055d..09ad1238a 100644 --- a/include/ComboBoxModel.h +++ b/include/ComboBoxModel.h @@ -39,7 +39,7 @@ class LMMS_EXPORT ComboBoxModel : public IntModel Q_OBJECT MODEL_IS_VISITABLE public: - ComboBoxModel( Model* parent = NULL, + ComboBoxModel( Model* parent = nullptr, const QString& displayName = QString(), bool isDefaultConstructed = false ) : IntModel( 0, 0, 0, parent, displayName, isDefaultConstructed ) diff --git a/include/ConfigManager.h b/include/ConfigManager.h index e5df02ff5..8a3d8073b 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -60,7 +60,7 @@ class LMMS_EXPORT ConfigManager : public QObject public: static inline ConfigManager * inst() { - if(s_instanceOfMe == NULL ) + if(s_instanceOfMe == nullptr ) { s_instanceOfMe = new ConfigManager(); } diff --git a/include/CustomTextKnob.h b/include/CustomTextKnob.h index baaf88205..aa7b9d573 100644 --- a/include/CustomTextKnob.h +++ b/include/CustomTextKnob.h @@ -9,9 +9,9 @@ class LMMS_EXPORT CustomTextKnob : public Knob protected: inline void setHintText( const QString & _txt_before, const QString & _txt_after ) {} // inaccessible public: - CustomTextKnob( knobTypes _knob_num, QWidget * _parent = NULL, const QString & _name = QString(), const QString & _value_text = QString() ); + CustomTextKnob( knobTypes _knob_num, QWidget * _parent = nullptr, const QString & _name = QString(), const QString & _value_text = QString() ); - CustomTextKnob( QWidget * _parent = NULL, const QString & _name = QString(), const QString & _value_text = QString() ); //!< default ctor + CustomTextKnob( QWidget * _parent = nullptr, const QString & _name = QString(), const QString & _value_text = QString() ); //!< default ctor CustomTextKnob( const Knob& other ) = delete; diff --git a/include/Delay.h b/include/Delay.h index 0e32a7635..5be1ac183 100644 --- a/include/Delay.h +++ b/include/Delay.h @@ -72,7 +72,7 @@ public: m_delay( 0 ), m_fraction( 0.0 ) { - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC(maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } virtual ~CombFeedback() @@ -85,7 +85,7 @@ public: if( maxDelay > m_size ) { MM_FREE( m_buffer ); - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC( maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } m_size = maxDelay; @@ -143,7 +143,7 @@ class CombFeedfwd m_delay( 0 ), m_fraction( 0.0 ) { - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC( maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } virtual ~CombFeedfwd() @@ -156,7 +156,7 @@ class CombFeedfwd if( maxDelay > m_size ) { MM_FREE( m_buffer ); - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC( maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } m_size = maxDelay; @@ -214,7 +214,7 @@ class CombFeedbackDualtap m_delay( 0 ), m_fraction( 0.0 ) { - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC( maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } virtual ~CombFeedbackDualtap() @@ -227,7 +227,7 @@ class CombFeedbackDualtap if( maxDelay > m_size ) { MM_FREE( m_buffer ); - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC( maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } m_size = maxDelay; @@ -295,7 +295,7 @@ public: m_delay( 0 ), m_fraction( 0.0 ) { - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC( maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } virtual ~AllpassDelay() @@ -308,7 +308,7 @@ public: if( maxDelay > m_size ) { MM_FREE( m_buffer ); - m_buffer = MM_ALLOC( frame, maxDelay ); + m_buffer = MM_ALLOC( maxDelay ); memset( m_buffer, 0, sizeof( frame ) * maxDelay ); } m_size = maxDelay; diff --git a/include/DummyEffect.h b/include/DummyEffect.h index 5509131be..92bfd5bdd 100644 --- a/include/DummyEffect.h +++ b/include/DummyEffect.h @@ -84,7 +84,7 @@ class DummyEffect : public Effect Q_OBJECT public: DummyEffect( Model * _parent, const QDomElement& originalPluginData ) : - Effect( NULL, _parent, NULL ), + Effect( nullptr, _parent, nullptr ), m_controls( this ), m_originalPluginData( originalPluginData ) { diff --git a/include/DummyInstrument.h b/include/DummyInstrument.h index 4dd341894..bbc112f96 100644 --- a/include/DummyInstrument.h +++ b/include/DummyInstrument.h @@ -39,7 +39,7 @@ class DummyInstrument : public Instrument { public: DummyInstrument( InstrumentTrack * _instrument_track ) : - Instrument( _instrument_track, NULL ) + Instrument( _instrument_track, nullptr ) { } diff --git a/include/DummyPlugin.h b/include/DummyPlugin.h index ec26da0a3..61a399889 100644 --- a/include/DummyPlugin.h +++ b/include/DummyPlugin.h @@ -34,7 +34,7 @@ class DummyPlugin : public Plugin { public: DummyPlugin() : - Plugin( NULL, NULL ) + Plugin( nullptr, nullptr ) { } diff --git a/include/EffectRackView.h b/include/EffectRackView.h index d2a9dd528..b590d8eb1 100644 --- a/include/EffectRackView.h +++ b/include/EffectRackView.h @@ -43,7 +43,7 @@ class EffectRackView : public QWidget, public ModelView { Q_OBJECT public: - EffectRackView( EffectChain* model, QWidget* parent = NULL ); + EffectRackView( EffectChain* model, QWidget* parent = nullptr ); virtual ~EffectRackView(); static constexpr int DEFAULT_WIDTH = 245; diff --git a/include/Engine.h b/include/Engine.h index 08a1f7ca3..835abc342 100644 --- a/include/Engine.h +++ b/include/Engine.h @@ -112,7 +112,7 @@ public: static inline LmmsCore * inst() { - if( s_instanceOfMe == NULL ) + if( s_instanceOfMe == nullptr ) { s_instanceOfMe = new LmmsCore(); } @@ -133,7 +133,7 @@ private: static inline void deleteHelper( T * * ptr ) { T * tmp = *ptr; - *ptr = NULL; + *ptr = nullptr; delete tmp; } diff --git a/include/ExportFilter.h b/include/ExportFilter.h index 3124b477b..dc33c2aa2 100644 --- a/include/ExportFilter.h +++ b/include/ExportFilter.h @@ -35,7 +35,7 @@ class LMMS_EXPORT ExportFilter : public Plugin { public: - ExportFilter( const Descriptor * _descriptor ) : Plugin( _descriptor, NULL ) {} + ExportFilter( const Descriptor * _descriptor ) : Plugin( _descriptor, nullptr ) {} virtual ~ExportFilter() {} diff --git a/include/FxLineLcdSpinBox.h b/include/FxLineLcdSpinBox.h index eeb104c5c..1f8081b1e 100644 --- a/include/FxLineLcdSpinBox.h +++ b/include/FxLineLcdSpinBox.h @@ -34,7 +34,7 @@ class FxLineLcdSpinBox : public LcdSpinBox { Q_OBJECT public: - FxLineLcdSpinBox(int numDigits, QWidget * parent, const QString& name, TrackView * tv = NULL) : + FxLineLcdSpinBox(int numDigits, QWidget * parent, const QString& name, TrackView * tv = nullptr) : LcdSpinBox(numDigits, parent, name), m_tv(tv) {} virtual ~FxLineLcdSpinBox() {} diff --git a/include/GroupBox.h b/include/GroupBox.h index 88428b1aa..77b0ec578 100644 --- a/include/GroupBox.h +++ b/include/GroupBox.h @@ -39,7 +39,7 @@ class GroupBox : public QWidget, public BoolModelView { Q_OBJECT public: - GroupBox( const QString & _caption, QWidget * _parent = NULL ); + GroupBox( const QString & _caption, QWidget * _parent = nullptr ); virtual ~GroupBox(); void modelChanged() override; diff --git a/include/GuiApplication.h b/include/GuiApplication.h index 9adeb886b..1536cc2ce 100644 --- a/include/GuiApplication.h +++ b/include/GuiApplication.h @@ -85,6 +85,7 @@ private: QLabel* m_loadingProgressLabel; }; -#define gui GuiApplication::instance() +// Short-hand function +LMMS_EXPORT GuiApplication* getGUI(); #endif // GUIAPPLICATION_H diff --git a/include/InlineAutomation.h b/include/InlineAutomation.h index aa47d6e33..9fd8362cc 100644 --- a/include/InlineAutomation.h +++ b/include/InlineAutomation.h @@ -36,7 +36,7 @@ public: InlineAutomation() : FloatModel(), sharedObject(), - m_autoPattern( NULL ) + m_autoPattern( nullptr ) { } @@ -52,7 +52,7 @@ public: bool hasAutomation() const { - if( m_autoPattern != NULL && m_autoPattern->getTimeMap().isEmpty() == false ) + if( m_autoPattern != nullptr && m_autoPattern->getTimeMap().isEmpty() == false ) { // Prevent saving inline automation if there's just one node at the beginning of // the pattern, which has a InValue equal to the value of model (which is going @@ -77,9 +77,9 @@ public: AutomationPattern * automationPattern() { - if( m_autoPattern == NULL ) + if( m_autoPattern == nullptr ) { - m_autoPattern = new AutomationPattern( NULL ); + m_autoPattern = new AutomationPattern( nullptr ); m_autoPattern->addObject( this ); } return m_autoPattern; diff --git a/include/InstrumentFunctionViews.h b/include/InstrumentFunctionViews.h index f222d8c94..6536a8db7 100644 --- a/include/InstrumentFunctionViews.h +++ b/include/InstrumentFunctionViews.h @@ -44,7 +44,7 @@ class InstrumentFunctionNoteStackingView : public QWidget, public ModelView { Q_OBJECT public: - InstrumentFunctionNoteStackingView( InstrumentFunctionNoteStacking* cc, QWidget* parent = NULL ); + InstrumentFunctionNoteStackingView( InstrumentFunctionNoteStacking* cc, QWidget* parent = nullptr ); virtual ~InstrumentFunctionNoteStackingView(); @@ -67,7 +67,7 @@ class InstrumentFunctionArpeggioView : public QWidget, public ModelView { Q_OBJECT public: - InstrumentFunctionArpeggioView( InstrumentFunctionArpeggio* arp, QWidget* parent = NULL ); + InstrumentFunctionArpeggioView( InstrumentFunctionArpeggio* arp, QWidget* parent = nullptr ); virtual ~InstrumentFunctionArpeggioView(); diff --git a/include/IoHelper.h b/include/IoHelper.h index 687e000d1..35ee8cb87 100644 --- a/include/IoHelper.h +++ b/include/IoHelper.h @@ -48,18 +48,24 @@ std::wstring toWString(const std::string& s) #ifdef LMMS_BUILD_WIN32 #include -#define F_OPEN_UTF8(a, b) _wfopen(toWString(a).data(), L##b) #else #ifdef LMMS_HAVE_UNISTD_H #include #endif -#define F_OPEN_UTF8(a, b) fopen((a).data(), b) #endif +FILE* F_OPEN_UTF8(std::string const& fname, const char* mode){ +#ifdef LMMS_BUILD_WIN32 + return _wfopen(toWString(fname).data(), toWString(mode).data()); +#else + return fopen(fname.data(), mode); +#endif +} + int fileToDescriptor(FILE* f, bool closeFile = true) { int fh; - if (f == NULL) {return -1;} + if (f == nullptr) {return -1;} #ifdef LMMS_BUILD_WIN32 fh = _dup(_fileno(f)); diff --git a/include/Knob.h b/include/Knob.h index 5b3ca9022..91aa6b478 100644 --- a/include/Knob.h +++ b/include/Knob.h @@ -79,8 +79,8 @@ class LMMS_EXPORT Knob : public QWidget, public FloatModelView void onKnobNumUpdated(); //!< to be called when you updated @a m_knobNum public: - Knob( knobTypes _knob_num, QWidget * _parent = NULL, const QString & _name = QString() ); - Knob( QWidget * _parent = NULL, const QString & _name = QString() ); //!< default ctor + Knob( knobTypes _knob_num, QWidget * _parent = nullptr, const QString & _name = QString() ); + Knob( QWidget * _parent = nullptr, const QString & _name = QString() ); //!< default ctor Knob( const Knob& other ) = delete; // TODO: remove diff --git a/include/LeftRightNav.h b/include/LeftRightNav.h index 02be085a4..935853054 100644 --- a/include/LeftRightNav.h +++ b/include/LeftRightNav.h @@ -33,7 +33,7 @@ class LeftRightNav : public QWidget { Q_OBJECT public: - LeftRightNav(QWidget *parent=NULL); + LeftRightNav(QWidget *parent=nullptr); PixmapButton* getLeftBtn(); PixmapButton* getRightBtn(); void setShortcuts(const QKeySequence &leftShortcut=Qt::Key_Minus, const QKeySequence &rightShortcut=Qt::Key_Plus); diff --git a/include/MemoryManager.h b/include/MemoryManager.h index 4c225e026..a5899d922 100644 --- a/include/MemoryManager.h +++ b/include/MemoryManager.h @@ -85,8 +85,18 @@ static void operator delete[] ( void * ptr ) \ } // for use in cases where overriding new/delete isn't a possibility -#define MM_ALLOC( type, count ) reinterpret_cast( MemoryManager::alloc( sizeof( type ) * count ) ) +template +T* MM_ALLOC(size_t count) +{ + return reinterpret_cast( + MemoryManager::alloc(sizeof(T) * count)); +} + // and just for symmetry... -#define MM_FREE( ptr ) MemoryManager::free( ptr ) +template +void MM_FREE(T* ptr) +{ + MemoryManager::free(ptr); +} #endif diff --git a/include/MidiEvent.h b/include/MidiEvent.h index a82c5d464..29a3c5df6 100644 --- a/include/MidiEvent.h +++ b/include/MidiEvent.h @@ -44,7 +44,7 @@ public: m_type( type ), m_metaEvent( MidiMetaInvalid ), m_channel( channel ), - m_sysExData( NULL ), + m_sysExData( nullptr ), m_sourcePort(sourcePort), m_source(source) { diff --git a/include/MidiJack.h b/include/MidiJack.h index 8ebb6925f..66525c3a9 100644 --- a/include/MidiJack.h +++ b/include/MidiJack.h @@ -42,7 +42,7 @@ #include "MidiClient.h" #include "AudioJack.h" -#define JACK_MIDI_BUFFER_MAX 64 /* events */ +constexpr size_t JACK_MIDI_BUFFER_MAX = 64; /* events */ class QLineEdit; diff --git a/include/MidiPort.h b/include/MidiPort.h index 9592147da..d5797a3e6 100644 --- a/include/MidiPort.h +++ b/include/MidiPort.h @@ -71,7 +71,7 @@ public: MidiPort( const QString& name, MidiClient* client, MidiEventProcessor* eventProcessor, - Model* parent = NULL, + Model* parent = nullptr, Mode mode = Disabled ); virtual ~MidiPort(); diff --git a/include/Note.h b/include/Note.h index 82c47ab71..219884471 100644 --- a/include/Note.h +++ b/include/Note.h @@ -91,7 +91,7 @@ public: int key = DefaultKey, volume_t volume = DefaultVolume, panning_t panning = DefaultPanning, - DetuningHelper * detuning = NULL ); + DetuningHelper * detuning = nullptr ); Note( const Note & note ); virtual ~Note(); diff --git a/include/NotePlayHandle.h b/include/NotePlayHandle.h index e97b4607f..cc78eec92 100644 --- a/include/NotePlayHandle.h +++ b/include/NotePlayHandle.h @@ -67,7 +67,7 @@ public: const f_cnt_t offset, const f_cnt_t frames, const Note& noteToPlay, - NotePlayHandle* parent = NULL, + NotePlayHandle* parent = nullptr, int midiEventChannel = -1, Origin origin = OriginPattern ); virtual ~NotePlayHandle(); @@ -344,7 +344,7 @@ public: const f_cnt_t offset, const f_cnt_t frames, const Note& noteToPlay, - NotePlayHandle* parent = NULL, + NotePlayHandle* parent = nullptr, int midiEventChannel = -1, NotePlayHandle::Origin origin = NotePlayHandle::OriginPattern ); static void release( NotePlayHandle * nph ); diff --git a/include/Oscilloscope.h b/include/Oscilloscope.h index 45e04832a..4072df478 100644 --- a/include/Oscilloscope.h +++ b/include/Oscilloscope.h @@ -23,8 +23,8 @@ */ -#ifndef _OSCILLOSCOPE -#define _OSCILLOSCOPE +#ifndef OSCILLOSCOPE_H +#define OSCILLOSCOPE_H #include #include @@ -73,4 +73,4 @@ private: QColor m_clippingColor; } ; -#endif +#endif // OSCILLOSCOPE_H diff --git a/include/PeakController.h b/include/PeakController.h index 74a3aab59..df3902ab2 100644 --- a/include/PeakController.h +++ b/include/PeakController.h @@ -41,7 +41,7 @@ class LMMS_EXPORT PeakController : public Controller Q_OBJECT public: PeakController( Model * _parent, - PeakControllerEffect *_peak_effect = NULL ); + PeakControllerEffect *_peak_effect = nullptr ); virtual ~PeakController(); diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 50da94189..dd32f7c81 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -137,7 +137,7 @@ public: bool hasValidPattern() const { - return m_pattern != NULL; + return m_pattern != nullptr; } Song::PlayModes desiredPlayModeForAccompany() const; diff --git a/include/Pitch.h b/include/Pitch.h index 2f866a1c5..17de48b94 100644 --- a/include/Pitch.h +++ b/include/Pitch.h @@ -29,9 +29,9 @@ typedef int16_t pitch_t; -const pitch_t CentsPerSemitone = 100; -const pitch_t MinPitchDefault = -CentsPerSemitone; -const pitch_t MaxPitchDefault = CentsPerSemitone; -const pitch_t DefaultPitch = 0; +constexpr pitch_t CentsPerSemitone = 100; +constexpr pitch_t MinPitchDefault = -CentsPerSemitone; +constexpr pitch_t MaxPitchDefault = CentsPerSemitone; +constexpr pitch_t DefaultPitch = 0; #endif diff --git a/include/Plugin.h b/include/Plugin.h index cb8995bf2..fb7e592bd 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -130,7 +130,7 @@ public: { typedef QMap AttributeMap; - inline Key( const Plugin::Descriptor * desc = NULL, + inline Key( const Plugin::Descriptor * desc = nullptr, const QString & name = QString(), const AttributeMap & am = AttributeMap() ) diff --git a/include/PluginFactory.h b/include/PluginFactory.h index 17b178108..a1f84f8d1 100644 --- a/include/PluginFactory.h +++ b/include/PluginFactory.h @@ -103,6 +103,7 @@ private: static std::unique_ptr s_instance; }; -#define pluginFactory PluginFactory::instance() +//Short-hand function +LMMS_EXPORT PluginFactory* getPluginFactory(); #endif // PLUGINFACTORY_H diff --git a/include/ProjectJournal.h b/include/ProjectJournal.h index cb487617b..d19d02d7e 100644 --- a/include/ProjectJournal.h +++ b/include/ProjectJournal.h @@ -74,7 +74,7 @@ public: // restoring a journalling object later void freeID( const jo_id_t _id ) { - reallocID( _id, NULL ); + reallocID( _id, nullptr ); } //! hack, not used when saving a file @@ -90,7 +90,7 @@ public: { return m_joIDs[_id]; } - return NULL; + return nullptr; } diff --git a/include/ProjectRenderer.h b/include/ProjectRenderer.h index 729abcc91..ce5d6af3c 100644 --- a/include/ProjectRenderer.h +++ b/include/ProjectRenderer.h @@ -64,7 +64,7 @@ public: bool isReady() const { - return m_fileDev != NULL; + return m_fileDev != nullptr; } static ExportFileFormats getFileFormatFromExtension( diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index 862370d1f..fd3ef5e09 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -92,6 +92,7 @@ typedef int32_t key_t; #include #include #include +#include #ifndef SYNC_WITH_SHM_FIFO #include @@ -137,7 +138,7 @@ public: #else m_shmID( -1 ), #endif - m_data( NULL ), + m_data( nullptr ), m_dataSem( QString() ), m_messageSem( QString() ), m_lockDepth( 0 ) @@ -157,7 +158,7 @@ public: } m_data = (shmData *) shmat( m_shmID, 0, 0 ); #endif - assert( m_data != NULL ); + assert( m_data != nullptr ); m_data->startPtr = m_data->endPtr = 0; static int k = 0; m_data->dataSem.semKey = ( getpid()<<10 ) + ++k; @@ -180,7 +181,7 @@ public: #else m_shmID( shmget( _shm_key, 0, 0 ) ), #endif - m_data( NULL ), + m_data( nullptr ), m_dataSem( QString() ), m_messageSem( QString() ), m_lockDepth( 0 ) @@ -196,7 +197,7 @@ public: m_data = (shmData *) shmat( m_shmID, 0, 0 ); } #endif - assert( m_data != NULL ); + assert( m_data != nullptr ); m_dataSem.setKey( QString::number( m_data->dataSem.semKey ) ); m_messageSem.setKey( QString::number( m_data->messageSem.semKey ) ); @@ -208,7 +209,7 @@ public: if( m_master ) { #ifndef USE_QT_SHMEM - shmctl( m_shmID, IPC_RMID, NULL ); + shmctl( m_shmID, IPC_RMID, nullptr ); #endif } #ifndef USE_QT_SHMEM @@ -1031,8 +1032,8 @@ RemotePluginBase::RemotePluginBase() : setlocale( LC_NUMERIC, "C" ); #endif #ifndef SYNC_WITH_SHM_FIFO - pthread_mutex_init( &m_receiveMutex, NULL ); - pthread_mutex_init( &m_sendMutex, NULL ); + pthread_mutex_init( &m_receiveMutex, nullptr ); + pthread_mutex_init( &m_sendMutex, nullptr ); #endif } @@ -1194,8 +1195,8 @@ RemotePluginClient::RemotePluginClient( const char * socketPath ) : m_shmObj(), m_shmQtID( "/usr/bin/lmms" ), #endif - m_vstSyncData( NULL ), - m_shm( NULL ), + m_vstSyncData( nullptr ), + m_shm( nullptr ), m_inputCount( 0 ), m_outputCount( 0 ), m_sampleRate( 44100 ), @@ -1400,10 +1401,10 @@ void RemotePluginClient::setShmKey( key_t _key, int _size ) debugMessage( buf ); } #else - if( m_shm != NULL ) + if( m_shm != nullptr ) { shmdt( m_shm ); - m_shm = NULL; + m_shm = nullptr; } // only called for detaching SHM? @@ -1429,9 +1430,9 @@ void RemotePluginClient::setShmKey( key_t _key, int _size ) void RemotePluginClient::doProcessing() { - if( m_shm != NULL ) + if( m_shm != nullptr ) { - process( (sampleFrame *)( m_inputCount > 0 ? m_shm : NULL ), + process( (sampleFrame *)( m_inputCount > 0 ? m_shm : nullptr ), (sampleFrame *)( m_shm + ( m_inputCount*m_bufferSize ) ) ); } @@ -1443,8 +1444,14 @@ void RemotePluginClient::doProcessing() -#endif +#else -#define QSTR_TO_STDSTR(s) std::string( s.toUtf8().constData() ) + +LMMS_EXPORT inline std::string QSTR_TO_STDSTR(QString const& qstr) +{ + return qstr.toStdString(); +} + +#endif #endif diff --git a/include/RmsHelper.h b/include/RmsHelper.h index 9c31dce41..f5f2770fa 100644 --- a/include/RmsHelper.h +++ b/include/RmsHelper.h @@ -32,7 +32,7 @@ class RmsHelper { public: RmsHelper( int size ) : - m_buffer( NULL ) + m_buffer( nullptr ) { setSize( size ); } diff --git a/include/SerializingObject.h b/include/SerializingObject.h index b61794d7c..fbcda9187 100644 --- a/include/SerializingObject.h +++ b/include/SerializingObject.h @@ -74,14 +74,14 @@ class SerializingObjectHook { public: SerializingObjectHook() : - m_hookedIn( NULL ) + m_hookedIn( nullptr ) { } virtual ~SerializingObjectHook() { - if( m_hookedIn != NULL ) + if( m_hookedIn != nullptr ) { - m_hookedIn->setHook( NULL ); + m_hookedIn->setHook( nullptr ); } } diff --git a/include/Song.h b/include/Song.h index 6bc19c6d4..9639ce14e 100644 --- a/include/Song.h +++ b/include/Song.h @@ -97,7 +97,7 @@ public: public: PlayPos( const int abs = 0 ) : TimePos( abs ), - m_timeLine( NULL ), + m_timeLine( nullptr ), m_currentFrame( 0.0f ) { } diff --git a/include/SubWindow.h b/include/SubWindow.h index 55d05425a..e2b1a9a37 100644 --- a/include/SubWindow.h +++ b/include/SubWindow.h @@ -55,7 +55,7 @@ class LMMS_EXPORT SubWindow : public QMdiSubWindow Q_PROPERTY( QColor borderColor READ borderColor WRITE setBorderColor ) public: - SubWindow( QWidget *parent = NULL, Qt::WindowFlags windowFlags = QFlag(0) ); + SubWindow( QWidget *parent = nullptr, Qt::WindowFlags windowFlags = QFlag(0) ); // same as QWidet::normalGeometry, but works properly under X11 (see https://bugreports.qt.io/browse/QTBUG-256) QRect getTrueNormalGeometry() const; QBrush activeColor() const; diff --git a/include/TabWidget.h b/include/TabWidget.h index 0cf15155b..4442ef643 100644 --- a/include/TabWidget.h +++ b/include/TabWidget.h @@ -42,7 +42,7 @@ public: bool usePixmap = false, bool resizable = false ); virtual ~TabWidget() = default; - void addTab( QWidget * w, const QString & name, const char *pixmap = NULL, int idx = -1 ); + void addTab( QWidget * w, const QString & name, const char *pixmap = nullptr, int idx = -1 ); void setActiveTab( int idx ); diff --git a/include/TempoSyncKnob.h b/include/TempoSyncKnob.h index 416abe1fc..12851f6e5 100644 --- a/include/TempoSyncKnob.h +++ b/include/TempoSyncKnob.h @@ -38,7 +38,7 @@ class LMMS_EXPORT TempoSyncKnob : public Knob { Q_OBJECT public: - TempoSyncKnob( knobTypes knobNum, QWidget* parent = NULL, const QString& name = QString() ); + TempoSyncKnob( knobTypes knobNum, QWidget* parent = nullptr, const QString& name = QString() ); virtual ~TempoSyncKnob(); const QString & syncDescription(); diff --git a/include/TextFloat.h b/include/TextFloat.h index 8f940c591..1df7ed46a 100644 --- a/include/TextFloat.h +++ b/include/TextFloat.h @@ -50,14 +50,14 @@ public: static TextFloat * displayMessage( const QString & _msg, int _timeout = 2000, - QWidget * _parent = NULL, + QWidget * _parent = nullptr, int _add_y_margin = 0 ); static TextFloat * displayMessage( const QString & _title, const QString & _msg, const QPixmap & _pixmap = QPixmap(), int _timeout = 2000, - QWidget * _parent = NULL ); + QWidget * _parent = nullptr ); void moveGlobal( QWidget * _w, const QPoint & _offset ) { diff --git a/include/TimeDisplayWidget.h b/include/TimeDisplayWidget.h index e7e5cb210..303ce6d5e 100644 --- a/include/TimeDisplayWidget.h +++ b/include/TimeDisplayWidget.h @@ -23,8 +23,8 @@ * */ -#ifndef _TIME_DISPLAY_WIDGET -#define _TIME_DISPLAY_WIDGET +#ifndef TIME_DISPLAY_WIDGET_H +#define TIME_DISPLAY_WIDGET_H #include #include @@ -67,4 +67,4 @@ private: } ; -#endif +#endif // TIME_DISPLAY_WIDGET_H diff --git a/include/TrackContainer.h b/include/TrackContainer.h index 00b391e10..895d4e6c3 100644 --- a/include/TrackContainer.h +++ b/include/TrackContainer.h @@ -58,7 +58,7 @@ public: virtual AutomationPattern * tempoAutomationPattern() { - return NULL; + return nullptr; } int countTracks( Track::TrackTypes _tt = Track::NumTrackTypes ) const; diff --git a/include/VstSyncData.h b/include/VstSyncData.h index 6c2f1bbd2..07694b81b 100644 --- a/include/VstSyncData.h +++ b/include/VstSyncData.h @@ -34,8 +34,8 @@ //#define VST_SNC_LATENCY // define file for ftok as shared memory shmget key -#define VST_SNC_SHM_KEY_FILE "/dev/null" -//#define VST_SNC_SHM_RND_KEY 3561653564469 +constexpr const char* VST_SNC_SHM_KEY_FILE = "/dev/null"; +//constexpr int64_t VST_SNC_SHM_RND_KEY = 3561653564469; diff --git a/include/aeffectx.h b/include/aeffectx.h index b7a78dfad..615972701 100644 --- a/include/aeffectx.h +++ b/include/aeffectx.h @@ -27,125 +27,132 @@ #define AEFFECTX_H #include +#include // Calling convention #define VST_CALL_CONV __cdecl -#define CCONST(a, b, c, d)( ( ( (int32_t) a ) << 24 ) | \ - ( ( (int32_t) b ) << 16 ) | \ - ( ( (int32_t) c ) << 8 ) | \ - ( ( (int32_t) d ) << 0 ) ) +template +constexpr int32_t CCONST(T a, T b, T c, T d) +{ + static_assert(std::is_convertible::value, "int32 compatibility required."); + return ( + static_cast(a) << 24 | + static_cast(b) << 16 | + static_cast(c) << 8 | + static_cast(d) << 0); +} -const int audioMasterAutomate = 0; -const int audioMasterVersion = 1; -const int audioMasterCurrentId = 2; -const int audioMasterIdle = 3; -const int audioMasterPinConnected = 4; +constexpr int audioMasterAutomate = 0; +constexpr int audioMasterVersion = 1; +constexpr int audioMasterCurrentId = 2; +constexpr int audioMasterIdle = 3; +constexpr int audioMasterPinConnected = 4; // unsupported? 5 -const int audioMasterWantMidi = 6; -const int audioMasterGetTime = 7; -const int audioMasterProcessEvents = 8; -const int audioMasterSetTime = 9; -const int audioMasterTempoAt = 10; -const int audioMasterGetNumAutomatableParameters = 11; -const int audioMasterGetParameterQuantization = 12; -const int audioMasterIOChanged = 13; -const int audioMasterNeedIdle = 14; -const int audioMasterSizeWindow = 15; -const int audioMasterGetSampleRate = 16; -const int audioMasterGetBlockSize = 17; -const int audioMasterGetInputLatency = 18; -const int audioMasterGetOutputLatency = 19; -const int audioMasterGetPreviousPlug = 20; -const int audioMasterGetNextPlug = 21; -const int audioMasterWillReplaceOrAccumulate = 22; -const int audioMasterGetCurrentProcessLevel = 23; -const int audioMasterGetAutomationState = 24; -const int audioMasterOfflineStart = 25; -const int audioMasterOfflineRead = 26; -const int audioMasterOfflineWrite = 27; -const int audioMasterOfflineGetCurrentPass = 28; -const int audioMasterOfflineGetCurrentMetaPass = 29; -const int audioMasterSetOutputSampleRate = 30; +constexpr int audioMasterWantMidi = 6; +constexpr int audioMasterGetTime = 7; +constexpr int audioMasterProcessEvents = 8; +constexpr int audioMasterSetTime = 9; +constexpr int audioMasterTempoAt = 10; +constexpr int audioMasterGetNumAutomatableParameters = 11; +constexpr int audioMasterGetParameterQuantization = 12; +constexpr int audioMasterIOChanged = 13; +constexpr int audioMasterNeedIdle = 14; +constexpr int audioMasterSizeWindow = 15; +constexpr int audioMasterGetSampleRate = 16; +constexpr int audioMasterGetBlockSize = 17; +constexpr int audioMasterGetInputLatency = 18; +constexpr int audioMasterGetOutputLatency = 19; +constexpr int audioMasterGetPreviousPlug = 20; +constexpr int audioMasterGetNextPlug = 21; +constexpr int audioMasterWillReplaceOrAccumulate = 22; +constexpr int audioMasterGetCurrentProcessLevel = 23; +constexpr int audioMasterGetAutomationState = 24; +constexpr int audioMasterOfflineStart = 25; +constexpr int audioMasterOfflineRead = 26; +constexpr int audioMasterOfflineWrite = 27; +constexpr int audioMasterOfflineGetCurrentPass = 28; +constexpr int audioMasterOfflineGetCurrentMetaPass = 29; +constexpr int audioMasterSetOutputSampleRate = 30; // unsupported? 31 -const int audioMasterGetSpeakerArrangement = 31; // deprecated in 2.4? -const int audioMasterGetVendorString = 32; -const int audioMasterGetProductString = 33; -const int audioMasterGetVendorVersion = 34; -const int audioMasterVendorSpecific = 35; -const int audioMasterSetIcon = 36; -const int audioMasterCanDo = 37; -const int audioMasterGetLanguage = 38; -const int audioMasterOpenWindow = 39; -const int audioMasterCloseWindow = 40; -const int audioMasterGetDirectory = 41; -const int audioMasterUpdateDisplay = 42; -const int audioMasterBeginEdit = 43; -const int audioMasterEndEdit = 44; -const int audioMasterOpenFileSelector = 45; -const int audioMasterCloseFileSelector = 46; // currently unused -const int audioMasterEditFile = 47; // currently unused -const int audioMasterGetChunkFile = 48; // currently unused -const int audioMasterGetInputSpeakerArrangement = 49; // currently unused +constexpr int audioMasterGetSpeakerArrangement = 31; // deprecated in 2.4? +constexpr int audioMasterGetVendorString = 32; +constexpr int audioMasterGetProductString = 33; +constexpr int audioMasterGetVendorVersion = 34; +constexpr int audioMasterVendorSpecific = 35; +constexpr int audioMasterSetIcon = 36; +constexpr int audioMasterCanDo = 37; +constexpr int audioMasterGetLanguage = 38; +constexpr int audioMasterOpenWindow = 39; +constexpr int audioMasterCloseWindow = 40; +constexpr int audioMasterGetDirectory = 41; +constexpr int audioMasterUpdateDisplay = 42; +constexpr int audioMasterBeginEdit = 43; +constexpr int audioMasterEndEdit = 44; +constexpr int audioMasterOpenFileSelector = 45; +constexpr int audioMasterCloseFileSelector = 46; // currently unused +constexpr int audioMasterEditFile = 47; // currently unused +constexpr int audioMasterGetChunkFile = 48; // currently unused +constexpr int audioMasterGetInputSpeakerArrangement = 49; // currently unused -const int effFlagsHasEditor = 1; -const int effFlagsCanReplacing = 1 << 4; // very likely -const int effFlagsIsSynth = 1 << 8; // currently unused +constexpr int effFlagsHasEditor = 1; +constexpr int effFlagsCanReplacing = 1 << 4; // very likely +constexpr int effFlagsIsSynth = 1 << 8; // currently unused -const int effOpen = 0; -const int effClose = 1; // currently unused -const int effSetProgram = 2; // currently unused -const int effGetProgram = 3; // currently unused -const int effGetProgramName = 5; // currently unused -const int effGetParamLabel = 6; -const int effGetParamDisplay = 7; -const int effGetParamName = 8; // currently unused -const int effSetSampleRate = 10; -const int effSetBlockSize = 11; -const int effMainsChanged = 12; -const int effEditGetRect = 13; -const int effEditOpen = 14; -const int effEditClose = 15; -const int effEditIdle = 19; -const int effEditTop = 20; -const int effSetChunk = 24; -const int effProcessEvents = 25; -const int effGetEffectName = 45; -const int effGetVendorString = 47; -const int effGetProductString = 48; -const int effGetVendorVersion = 49; -const int effCanDo = 51; // currently unused -const int effGetVstVersion = 58; // currently unused +constexpr int effOpen = 0; +constexpr int effClose = 1; // currently unused +constexpr int effSetProgram = 2; // currently unused +constexpr int effGetProgram = 3; // currently unused +constexpr int effGetProgramName = 5; // currently unused +constexpr int effGetParamLabel = 6; +constexpr int effGetParamDisplay = 7; +constexpr int effGetParamName = 8; // currently unused +constexpr int effSetSampleRate = 10; +constexpr int effSetBlockSize = 11; +constexpr int effMainsChanged = 12; +constexpr int effEditGetRect = 13; +constexpr int effEditOpen = 14; +constexpr int effEditClose = 15; +constexpr int effEditIdle = 19; +constexpr int effEditTop = 20; +constexpr int effSetChunk = 24; +constexpr int effProcessEvents = 25; +constexpr int effGetEffectName = 45; +constexpr int effGetVendorString = 47; +constexpr int effGetProductString = 48; +constexpr int effGetVendorVersion = 49; +constexpr int effCanDo = 51; // currently unused +constexpr int effGetVstVersion = 58; // currently unused -const int kEffectMagic = CCONST( 'V', 's', 't', 'P' ); -const int kVstLangEnglish = 1; -const int kVstMidiType = 1; +constexpr int kEffectMagic = CCONST( 'V', 's', 't', 'P' ); +constexpr int kVstLangEnglish = 1; +constexpr int kVstMidiType = 1; -const int kVstTransportChanged = 1; -const int kVstTransportPlaying = 1 << 1; -const int kVstTransportCycleActive = 1 << 2; -const int kVstTransportRecording = 1 << 3; // currently unused -const int kVstPpqPosValid = 1 << 9; -const int kVstTempoValid = 1 << 10; -const int kVstBarsValid = 1 << 11; -const int kVstCyclePosValid = 1 << 12; -const int kVstTimeSigValid = 1 << 13; -const int kVstSmpteValid = 1 << 14; // currently unused -const int kVstClockValid = 1 << 15; // currently unused +constexpr int kVstTransportChanged = 1; +constexpr int kVstTransportPlaying = 1 << 1; +constexpr int kVstTransportCycleActive = 1 << 2; +constexpr int kVstTransportRecording = 1 << 3; // currently unused +constexpr int kVstPpqPosValid = 1 << 9; +constexpr int kVstTempoValid = 1 << 10; +constexpr int kVstBarsValid = 1 << 11; +constexpr int kVstCyclePosValid = 1 << 12; +constexpr int kVstTimeSigValid = 1 << 13; +constexpr int kVstSmpteValid = 1 << 14; // currently unused +constexpr int kVstClockValid = 1 << 15; // currently unused // currently unused -const int kVstSmpte24fps = 0; -const int kVstSmpte25fps = 1; -const int kVstSmpte2997fps = 2; -const int kVstSmpte30fps = 3; -const int kVstSmpte2997dfps = 4; -const int kVstSmpte30dfps = 5; -const int kVstSmpteFilm16mm = 6; // very likely -const int kVstSmpteFilm35mm = 7; // very likely -const int kVstSmpte239fps = 10; -const int kVstSmpte249fps = 11; -const int kVstSmpte599fps = 12; -const int kVstSmpte60fps = 13; +constexpr int kVstSmpte24fps = 0; +constexpr int kVstSmpte25fps = 1; +constexpr int kVstSmpte2997fps = 2; +constexpr int kVstSmpte30fps = 3; +constexpr int kVstSmpte2997dfps = 4; +constexpr int kVstSmpte30dfps = 5; +constexpr int kVstSmpteFilm16mm = 6; // very likely +constexpr int kVstSmpteFilm35mm = 7; // very likely +constexpr int kVstSmpte239fps = 10; +constexpr int kVstSmpte249fps = 11; +constexpr int kVstSmpte599fps = 12; +constexpr int kVstSmpte60fps = 13; diff --git a/include/debug.h b/include/debug.h index 55173f0a1..f619da666 100644 --- a/include/debug.h +++ b/include/debug.h @@ -28,16 +28,14 @@ #include "lmmsconfig.h" -// set whether debug-stuff (like messages on the console, asserts and other -// additional range-checkings) should be compiled - -#ifdef LMMS_DEBUG - #include -#else - #ifndef assert - #define assert(x) ((void)(x)) - #endif +// Define standard macro NDEBUG when building without debug flag to make sure asserts become no-ops. +#ifndef LMMS_DEBUG +#ifndef NDEBUG + #define NDEBUG #endif +#endif + +#include #include diff --git a/include/embed.h b/include/embed.h index a99c35c0a..aa224580e 100644 --- a/include/embed.h +++ b/include/embed.h @@ -71,7 +71,7 @@ class PixmapLoader { public: PixmapLoader( const PixmapLoader * _ref ) : - m_name( _ref != NULL ? _ref->m_name : QString() ), + m_name( _ref != nullptr ? _ref->m_name : QString() ), m_xpm( _ref->m_xpm ) { } diff --git a/include/lmms_basics.h b/include/lmms_basics.h index f114f362c..e4ee16b30 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -109,9 +109,9 @@ inline bool typeInfo::isEqual( float x, float y ) -const ch_cnt_t DEFAULT_CHANNELS = 2; +constexpr ch_cnt_t DEFAULT_CHANNELS = 2; -const ch_cnt_t SURROUND_CHANNELS = +constexpr ch_cnt_t SURROUND_CHANNELS = #define LMMS_DISABLE_SURROUND #ifndef LMMS_DISABLE_SURROUND 4; @@ -119,28 +119,29 @@ const ch_cnt_t SURROUND_CHANNELS = 2; #endif - +constexpr char LADSPA_PATH_SEPERATOR = #ifdef LMMS_BUILD_WIN32 -#define LADSPA_PATH_SEPERATOR ';' +';'; #else -#define LADSPA_PATH_SEPERATOR ':' +':'; #endif using sampleFrame = std::array; using surroundSampleFrame = std::array; -#define ALIGN_SIZE 16 +constexpr size_t LMMS_ALIGN_SIZE = 16; #define STRINGIFY(s) STR(s) #define STR(PN) #PN // Abstract away GUI CTRL key (linux/windows) vs ⌘ (apple) +constexpr const char* UI_CTRL_KEY = #ifdef LMMS_BUILD_APPLE -# define UI_CTRL_KEY "⌘" +"⌘"; #else -# define UI_CTRL_KEY "Ctrl" +"Ctrl"; #endif #endif diff --git a/include/lmms_constants.h b/include/lmms_constants.h index 9a9e550fb..f5a86bc88 100644 --- a/include/lmms_constants.h +++ b/include/lmms_constants.h @@ -25,37 +25,37 @@ #ifndef LMMS_CONSTANTS_H #define LMMS_CONSTANTS_H -const long double LD_PI = 3.14159265358979323846264338327950288419716939937510; -const long double LD_2PI = LD_PI * 2.0; -const long double LD_PI_2 = LD_PI * 0.5; -const long double LD_PI_R = 1.0 / LD_PI; -const long double LD_PI_SQR = LD_PI * LD_PI; -const long double LD_E = 2.71828182845904523536028747135266249775724709369995; -const long double LD_E_R = 1.0 / LD_E; +constexpr long double LD_PI = 3.14159265358979323846264338327950288419716939937510; +constexpr long double LD_2PI = LD_PI * 2.0; +constexpr long double LD_PI_2 = LD_PI * 0.5; +constexpr long double LD_PI_R = 1.0 / LD_PI; +constexpr long double LD_PI_SQR = LD_PI * LD_PI; +constexpr long double LD_E = 2.71828182845904523536028747135266249775724709369995; +constexpr long double LD_E_R = 1.0 / LD_E; -const double D_PI = (double) LD_PI; -const double D_2PI = (double) LD_2PI; -const double D_PI_2 = (double) LD_PI_2; -const double D_PI_R = (double) LD_PI_R; -const double D_PI_SQR = (double) LD_PI_SQR; -const double D_E = (double) LD_E; -const double D_E_R = (double) LD_E_R; +constexpr double D_PI = (double) LD_PI; +constexpr double D_2PI = (double) LD_2PI; +constexpr double D_PI_2 = (double) LD_PI_2; +constexpr double D_PI_R = (double) LD_PI_R; +constexpr double D_PI_SQR = (double) LD_PI_SQR; +constexpr double D_E = (double) LD_E; +constexpr double D_E_R = (double) LD_E_R; -const float F_PI = (float) LD_PI; -const float F_2PI = (float) LD_2PI; -const float F_PI_2 = (float) LD_PI_2; -const float F_PI_R = (float) LD_PI_R; -const float F_PI_SQR = (float) LD_PI_SQR; -const float F_E = (float) LD_E; -const float F_E_R = (float) LD_E_R; +constexpr float F_PI = (float) LD_PI; +constexpr float F_2PI = (float) LD_2PI; +constexpr float F_PI_2 = (float) LD_PI_2; +constexpr float F_PI_R = (float) LD_PI_R; +constexpr float F_PI_SQR = (float) LD_PI_SQR; +constexpr float F_E = (float) LD_E; +constexpr float F_E_R = (float) LD_E_R; // Microtuner -const unsigned int MaxScaleCount = 10; //!< number of scales per project -const unsigned int MaxKeymapCount = 10; //!< number of keyboard mappings per project +constexpr unsigned int MaxScaleCount = 10; //!< number of scales per project +constexpr unsigned int MaxKeymapCount = 10; //!< number of keyboard mappings per project // Frequency ranges (in Hz). // Arbitrary low limit for logarithmic frequency scale; >1 Hz. -const int LOWEST_LOG_FREQ = 5; +constexpr int LOWEST_LOG_FREQ = 5; // Full range is defined by LOWEST_LOG_FREQ and current sample rate. enum FREQUENCY_RANGES @@ -67,14 +67,14 @@ enum FREQUENCY_RANGES FRANGE_HIGH }; -const int FRANGE_AUDIBLE_START = 20; -const int FRANGE_AUDIBLE_END = 20000; -const int FRANGE_BASS_START = 20; -const int FRANGE_BASS_END = 300; -const int FRANGE_MIDS_START = 200; -const int FRANGE_MIDS_END = 5000; -const int FRANGE_HIGH_START = 4000; -const int FRANGE_HIGH_END = 20000; +constexpr int FRANGE_AUDIBLE_START = 20; +constexpr int FRANGE_AUDIBLE_END = 20000; +constexpr int FRANGE_BASS_START = 20; +constexpr int FRANGE_BASS_END = 300; +constexpr int FRANGE_MIDS_START = 200; +constexpr int FRANGE_MIDS_END = 5000; +constexpr int FRANGE_HIGH_START = 4000; +constexpr int FRANGE_HIGH_END = 20000; // Amplitude ranges (in dBFS). // Reference: full scale sine wave (-1.0 to 1.0) is 0 dB. @@ -87,13 +87,13 @@ enum AMPLITUDE_RANGES ARANGE_SILENT }; -const int ARANGE_EXTENDED_START = -80; -const int ARANGE_EXTENDED_END = 20; -const int ARANGE_AUDIBLE_START = -50; -const int ARANGE_AUDIBLE_END = 0; -const int ARANGE_LOUD_START = -30; -const int ARANGE_LOUD_END = 0; -const int ARANGE_SILENT_START = -60; -const int ARANGE_SILENT_END = -10; +constexpr int ARANGE_EXTENDED_START = -80; +constexpr int ARANGE_EXTENDED_END = 20; +constexpr int ARANGE_AUDIBLE_START = -50; +constexpr int ARANGE_AUDIBLE_END = 0; +constexpr int ARANGE_LOUD_START = -30; +constexpr int ARANGE_LOUD_END = 0; +constexpr int ARANGE_SILENT_START = -60; +constexpr int ARANGE_SILENT_END = -10; #endif diff --git a/include/lmms_math.h b/include/lmms_math.h index 1ecebf4a3..a64bbd3d4 100644 --- a/include/lmms_math.h +++ b/include/lmms_math.h @@ -33,10 +33,6 @@ #include -#ifndef exp10 -#define exp10(x) std::pow( 10.0, x ) -#endif - #ifdef __INTEL_COMPILER static inline float absFraction( const float _x ) @@ -123,7 +119,7 @@ static inline float absFraction( float _x ) -#define FAST_RAND_MAX 32767 +constexpr int FAST_RAND_MAX = 32767; static inline int fast_rand() { static unsigned long next = 1; @@ -263,7 +259,7 @@ static inline float safeDbfsToAmp( float dbfs ) { return std::isinf( dbfs ) ? 0.0f - : exp10( dbfs * 0.05f ); + : std::pow(10.f, dbfs * 0.05f ); } @@ -281,7 +277,7 @@ static inline float ampToDbfs( float amp ) //! @return Linear amplitude static inline float dbfsToAmp( float dbfs ) { - return exp10( dbfs * 0.05f ); + return std::pow(10.f, dbfs * 0.05f ); } diff --git a/include/panning_constants.h b/include/panning_constants.h index bdabac63c..cf335ccfb 100644 --- a/include/panning_constants.h +++ b/include/panning_constants.h @@ -26,9 +26,9 @@ #ifndef PANNING_CONSTANTS_H #define PANNING_CONSTANTS_H -const panning_t PanningRight = ( 0 + 100 ); -const panning_t PanningLeft = - PanningRight; -const panning_t PanningCenter = 0; -const panning_t DefaultPanning = PanningCenter; +constexpr panning_t PanningRight = ( 0 + 100 ); +constexpr panning_t PanningLeft = - PanningRight; +constexpr panning_t PanningCenter = 0; +constexpr panning_t DefaultPanning = PanningCenter; #endif diff --git a/include/versioninfo.h b/include/versioninfo.h index b5965deba..1faab6804 100644 --- a/include/versioninfo.h +++ b/include/versioninfo.h @@ -1,61 +1,49 @@ #include "lmms_basics.h" #ifdef __GNUC__ -#define COMPILER_VERSION "GCC " __VERSION__ +constexpr const char* LMMS_BUILDCONF_COMPILER_VERSION = "GCC " __VERSION__; #elif defined(_MSC_VER) -#define COMPILER_VERSION "MSVC " STRINGIFY(_MSC_FULL_VER) +constexpr const char* LMMS_BUILDCONF_COMPILER_VERSION = "MSVC " STRINGIFY(_MSC_FULL_VER); #else -#define COMPILER_VERSION "unknown compiler" +constexpr const char* LMMS_BUILDCONF_COMPILER_VERSION = "unknown compiler"; #endif #ifdef LMMS_HOST_X86 -#define MACHINE "i386" -#endif - -#ifdef LMMS_HOST_X86_64 -#define MACHINE "x86_64" -#endif - -#ifdef LMMS_HOST_ARM32 -#define MACHINE "arm32" -#endif - -#ifdef LMMS_HOST_ARM64 -#define MACHINE "arm64" -#endif - -#ifdef LMMS_HOST_RISCV32 -#define MACHINE "riscv32" -#endif - -#ifdef LMMS_HOST_RISCV64 -#define MACHINE "riscv64" -#endif - -#ifndef MACHINE -#define MACHINE "unknown processor" +constexpr const char* LMMS_BUILDCONF_MACHINE = "i386"; +#elif defined(LMMS_HOST_X86_64) +constexpr const char* LMMS_BUILDCONF_MACHINE = "x86_64"; +#elif defined(LMMS_HOST_ARM32) +constexpr const char* LMMS_BUILDCONF_MACHINE = "arm32"; +#elif defined(LMMS_HOST_ARM64) +constexpr const char* LMMS_BUILDCONF_MACHINE = "arm64"; +#elif defined(LMMS_HOST_RISCV32) +constexpr const char* LMMS_BUILDCONF_MACHINE = "riscv32"; +#elif defined(LMMS_HOST_RISCV64) +constexpr const char* LMMS_BUILDCONF_MACHINE = "riscv64"; +#else +constexpr const char* LMMS_BUILDCONF_MACHINE = "unknown processor"; #endif #ifdef LMMS_BUILD_LINUX -#define PLATFORM "Linux" +constexpr const char* LMMS_BUILDCONF_PLATFORM = "Linux"; #endif #ifdef LMMS_BUILD_APPLE -#define PLATFORM "OS X" +constexpr const char* LMMS_BUILDCONF_PLATFORM = "OS X"; #endif #ifdef LMMS_BUILD_OPENBSD -#define PLATFORM "OpenBSD" +constexpr const char* LMMS_BUILDCONF_PLATFORM = "OpenBSD"; #endif #ifdef LMMS_BUILD_FREEBSD -#define PLATFORM "FreeBSD" +constexpr const char* LMMS_BUILDCONF_PLATFORM = "FreeBSD"; #endif #ifdef LMMS_BUILD_WIN32 -#define PLATFORM "win32" +constexpr const char* LMMS_BUILDCONF_PLATFORM = "win32"; #endif #ifdef LMMS_BUILD_HAIKU -#define PLATFORM "Haiku" +constexpr const char* LMMS_BUILDCONF_PLATFORM = "Haiku"; #endif diff --git a/include/volume.h b/include/volume.h index 9172395d6..5ea4ffc50 100644 --- a/include/volume.h +++ b/include/volume.h @@ -28,9 +28,9 @@ #include "lmms_basics.h" -const volume_t MinVolume = 0; -const volume_t MaxVolume = 200; -const volume_t DefaultVolume = 100; +constexpr volume_t MinVolume = 0; +constexpr volume_t MaxVolume = 200; +constexpr volume_t DefaultVolume = 100; typedef struct { diff --git a/plugins/Amplifier/Amplifier.cpp b/plugins/Amplifier/Amplifier.cpp index 176f0d012..2dfdc9d8c 100644 --- a/plugins/Amplifier/Amplifier.cpp +++ b/plugins/Amplifier/Amplifier.cpp @@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT amplifier_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/BassBooster/BassBooster.cpp b/plugins/BassBooster/BassBooster.cpp index c60198b05..f01e70720 100644 --- a/plugins/BassBooster/BassBooster.cpp +++ b/plugins/BassBooster/BassBooster.cpp @@ -39,8 +39,8 @@ Plugin::Descriptor PLUGIN_EXPORT bassbooster_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/Bitcrush/Bitcrush.cpp b/plugins/Bitcrush/Bitcrush.cpp index 339e5c777..206f6307d 100644 --- a/plugins/Bitcrush/Bitcrush.cpp +++ b/plugins/Bitcrush/Bitcrush.cpp @@ -46,8 +46,8 @@ Plugin::Descriptor PLUGIN_EXPORT bitcrush_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, }; } @@ -58,7 +58,7 @@ BitcrushEffect::BitcrushEffect( Model * parent, const Descriptor::SubPluginFeatu m_sampleRate( Engine::audioEngine()->processingSampleRate() ), m_filter( m_sampleRate ) { - m_buffer = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() * OS_RATE ); + m_buffer = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() * OS_RATE ); m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) ); m_needsUpdate = true; diff --git a/plugins/Compressor/Compressor.cpp b/plugins/Compressor/Compressor.cpp index b9cb8fb9e..6728f403f 100755 --- a/plugins/Compressor/Compressor.cpp +++ b/plugins/Compressor/Compressor.cpp @@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT compressor_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/Compressor/CompressorControlDialog.cpp b/plugins/Compressor/CompressorControlDialog.cpp index 47dc73ece..2e8ea835a 100755 --- a/plugins/Compressor/CompressorControlDialog.cpp +++ b/plugins/Compressor/CompressorControlDialog.cpp @@ -297,7 +297,7 @@ CompressorControlDialog::CompressorControlDialog(CompressorControls* controls) : lookaheadButton->setCheckable(true); lookaheadButton->setModel(&controls->m_lookaheadModel); - connect(gui->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(updateDisplay())); + connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(updateDisplay())); connect(&m_controls->m_peakmodeModel, SIGNAL(dataChanged()), this, SLOT(peakmodeChanged())); connect(&m_controls->m_stereoLinkModel, SIGNAL(dataChanged()), this, SLOT(stereoLinkChanged())); diff --git a/plugins/CrossoverEQ/CrossoverEQ.cpp b/plugins/CrossoverEQ/CrossoverEQ.cpp index d2a46eaee..92a3f6a6d 100644 --- a/plugins/CrossoverEQ/CrossoverEQ.cpp +++ b/plugins/CrossoverEQ/CrossoverEQ.cpp @@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT crossovereq_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, }; } @@ -60,9 +60,9 @@ CrossoverEQEffect::CrossoverEQEffect( Model* parent, const Descriptor::SubPlugin m_hp4( m_sampleRate ), m_needsUpdate( true ) { - m_tmp1 = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() ); - m_tmp2 = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() ); - m_work = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() ); + m_tmp1 = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); + m_tmp2 = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); + m_work = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); } CrossoverEQEffect::~CrossoverEQEffect() diff --git a/plugins/Delay/DelayEffect.cpp b/plugins/Delay/DelayEffect.cpp index d51cde53a..fc12cb820 100644 --- a/plugins/Delay/DelayEffect.cpp +++ b/plugins/Delay/DelayEffect.cpp @@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT delay_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; diff --git a/plugins/DualFilter/DualFilter.cpp b/plugins/DualFilter/DualFilter.cpp index b425ed6bd..19bed5436 100644 --- a/plugins/DualFilter/DualFilter.cpp +++ b/plugins/DualFilter/DualFilter.cpp @@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT dualfilter_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/Eq/EqControlsDialog.cpp b/plugins/Eq/EqControlsDialog.cpp index 00c8eaaa7..89ec7a595 100644 --- a/plugins/Eq/EqControlsDialog.cpp +++ b/plugins/Eq/EqControlsDialog.cpp @@ -118,7 +118,7 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) : freqKnob->setHintText( tr( "Frequency:" ), "Hz" ); // adds the Number Active buttons - PixmapButton * activeButton = new PixmapButton( this, NULL ); + PixmapButton * activeButton = new PixmapButton( this, nullptr ); activeButton->setCheckable(true); activeButton->setModel( m_parameterWidget->getBandModels( i )->active ); @@ -151,38 +151,38 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) : outSpecButton->move( 302, 240 ); //hp filter type - PixmapButton * hp12Button = new PixmapButton( this , NULL ); + PixmapButton * hp12Button = new PixmapButton( this , nullptr ); hp12Button->setModel( m_parameterWidget->getBandModels( 0 )->hp12 ); hp12Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "12dB" ) ); hp12Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "12dBoff" ) ); hp12Button->move( 79, 298 ); - PixmapButton * hp24Button = new PixmapButton( this , NULL ); + PixmapButton * hp24Button = new PixmapButton( this , nullptr ); hp24Button->setModel(m_parameterWidget->getBandModels( 0 )->hp24 ); hp24Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "24dB" ) ); hp24Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "24dBoff" ) ); hp24Button->move( 79 , 328 ); - PixmapButton * hp48Button = new PixmapButton( this , NULL ); + PixmapButton * hp48Button = new PixmapButton( this , nullptr ); hp48Button->setModel( m_parameterWidget->getBandModels(0)->hp48 ); hp48Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "48dB" ) ); hp48Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "48dBoff" ) ); hp48Button->move( 79, 358 ); //LP filter type - PixmapButton * lp12Button = new PixmapButton( this , NULL ); + PixmapButton * lp12Button = new PixmapButton( this , nullptr ); lp12Button->setModel( m_parameterWidget->getBandModels( 7 )->lp12 ); lp12Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "12dB" ) ); lp12Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "12dBoff" ) ); lp12Button->move( 387, 298 ); - PixmapButton * lp24Button = new PixmapButton( this , NULL ); + PixmapButton * lp24Button = new PixmapButton( this , nullptr ); lp24Button->setModel( m_parameterWidget->getBandModels( 7 )->lp24 ); lp24Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "24dB" ) ); lp24Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "24dBoff" ) ); lp24Button->move( 387, 328 ); - PixmapButton * lp48Button = new PixmapButton( this , NULL ); + PixmapButton * lp48Button = new PixmapButton( this , nullptr ); lp48Button->setModel( m_parameterWidget->getBandModels( 7 )->lp48 ); lp48Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "48dB" ) ); lp48Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "48dBoff" ) ); diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index d4ae121e7..f871596ec 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -44,8 +44,8 @@ Plugin::Descriptor PLUGIN_EXPORT eq_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/Eq/EqFader.h b/plugins/Eq/EqFader.h index c588c2b92..0df66f7b7 100644 --- a/plugins/Eq/EqFader.h +++ b/plugins/Eq/EqFader.h @@ -47,7 +47,7 @@ public: resize( 23, 80 ); m_lPeak = lPeak; m_rPeak = rPeak; - connect( gui->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) ); + connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) ); m_model = model; setPeak_L( 0 ); setPeak_R( 0 ); @@ -61,7 +61,7 @@ public: resize( 23, 116 ); m_lPeak = lPeak; m_rPeak = rPeak; - connect( gui->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) ); + connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) ); m_model = model; setPeak_L( 0 ); setPeak_R( 0 ); diff --git a/plugins/Eq/EqSpectrumView.cpp b/plugins/Eq/EqSpectrumView.cpp index cda23b123..27c320dfb 100644 --- a/plugins/Eq/EqSpectrumView.cpp +++ b/plugins/Eq/EqSpectrumView.cpp @@ -178,7 +178,7 @@ EqSpectrumView::EqSpectrumView(EqAnalyser *b, QWidget *_parent) : m_periodicalUpdate( false ) { setFixedSize( 450, 200 ); - connect( gui->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( periodicalUpdate() ) ); + connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( periodicalUpdate() ) ); setAttribute( Qt::WA_TranslucentBackground, true ); m_skipBands = MAX_BANDS * 0.5; float totalLength = log10( 20000 ); diff --git a/plugins/Flanger/FlangerEffect.cpp b/plugins/Flanger/FlangerEffect.cpp index dd086159b..2668b63c5 100644 --- a/plugins/Flanger/FlangerEffect.cpp +++ b/plugins/Flanger/FlangerEffect.cpp @@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT flanger_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; diff --git a/plugins/FreeBoy/FreeBoy.cpp b/plugins/FreeBoy/FreeBoy.cpp index 0bf0d2f84..f426f5387 100644 --- a/plugins/FreeBoy/FreeBoy.cpp +++ b/plugins/FreeBoy/FreeBoy.cpp @@ -60,7 +60,7 @@ Plugin::Descriptor PLUGIN_EXPORT freeboy_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, + nullptr, } ; } @@ -556,7 +556,7 @@ FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument, m_bassKnob->move( 5 + 3*32, 58 ); ToolTip::add( m_bassKnob, tr( "Bass" ) ); - m_ch1SweepDirButton = new PixmapButton( this, NULL ); + m_ch1SweepDirButton = new PixmapButton( this, nullptr ); m_ch1SweepDirButton->setCheckable( true ); m_ch1SweepDirButton->move( 167, 108 ); m_ch1SweepDirButton->setActiveGraphic( @@ -565,7 +565,7 @@ FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "btn_up" ) ); ToolTip::add( m_ch1SweepDirButton, tr( "Sweep direction" ) ); - m_ch1VolSweepDirButton = new PixmapButton( this, NULL ); + m_ch1VolSweepDirButton = new PixmapButton( this, nullptr ); m_ch1VolSweepDirButton->setCheckable( true ); m_ch1VolSweepDirButton->move( 207, 108 ); m_ch1VolSweepDirButton->setActiveGraphic( @@ -599,7 +599,7 @@ FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "btn_down" ) ); ToolTip::add( m_ch4VolSweepDirButton, tr( "Volume sweep direction" ) ); - m_ch4ShiftRegWidthButton = new PixmapButton( this, NULL ); + m_ch4ShiftRegWidthButton = new PixmapButton( this, nullptr ); m_ch4ShiftRegWidthButton->setCheckable( true ); m_ch4ShiftRegWidthButton->move( 207, 171 ); m_ch4ShiftRegWidthButton->setActiveGraphic( @@ -611,28 +611,28 @@ FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument, - m_ch1So1Button = new PixmapButton( this, NULL ); + m_ch1So1Button = new PixmapButton( this, nullptr ); m_ch1So1Button->setCheckable( true ); m_ch1So1Button->move( 208, 51 ); m_ch1So1Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "btn_on" ) ); m_ch1So1Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap("btn_off") ); ToolTip::add( m_ch1So1Button, tr( "Channel 1 to SO1 (Right)" ) ); - m_ch2So1Button = new PixmapButton( this, NULL ); + m_ch2So1Button = new PixmapButton( this, nullptr ); m_ch2So1Button->setCheckable( true ); m_ch2So1Button->move( 208, 51 + 12 ); m_ch2So1Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "btn_on" ) ); m_ch2So1Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap("btn_off") ); ToolTip::add( m_ch2So1Button, tr( "Channel 2 to SO1 (Right)" ) ); - m_ch3So1Button = new PixmapButton( this, NULL ); + m_ch3So1Button = new PixmapButton( this, nullptr ); m_ch3So1Button->setCheckable( true ); m_ch3So1Button->move( 208, 51 + 2*12 ); m_ch3So1Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "btn_on" ) ); m_ch3So1Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap("btn_off") ); ToolTip::add( m_ch3So1Button, tr( "Channel 3 to SO1 (Right)" ) ); - m_ch4So1Button = new PixmapButton( this, NULL ); + m_ch4So1Button = new PixmapButton( this, nullptr ); m_ch4So1Button->setCheckable( true ); m_ch4So1Button->setChecked( false ); m_ch4So1Button->move( 208, 51 + 3*12 ); @@ -640,28 +640,28 @@ FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument, m_ch4So1Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap("btn_off") ); ToolTip::add( m_ch4So1Button, tr( "Channel 4 to SO1 (Right)" ) ); - m_ch1So2Button = new PixmapButton( this, NULL ); + m_ch1So2Button = new PixmapButton( this, nullptr ); m_ch1So2Button->setCheckable( true ); m_ch1So2Button->move( 148, 51 ); m_ch1So2Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "btn_on" ) ); m_ch1So2Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap("btn_off") ); ToolTip::add( m_ch1So2Button, tr( "Channel 1 to SO2 (Left)" ) ); - m_ch2So2Button = new PixmapButton( this, NULL ); + m_ch2So2Button = new PixmapButton( this, nullptr ); m_ch2So2Button->setCheckable( true ); m_ch2So2Button->move( 148, 51 + 12 ); m_ch2So2Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "btn_on" ) ); m_ch2So2Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap("btn_off") ); ToolTip::add( m_ch2So2Button, tr( "Channel 2 to SO2 (Left)" ) ); - m_ch3So2Button = new PixmapButton( this, NULL ); + m_ch3So2Button = new PixmapButton( this, nullptr ); m_ch3So2Button->setCheckable( true ); m_ch3So2Button->move( 148, 51 + 2*12 ); m_ch3So2Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "btn_on" ) ); m_ch3So2Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap("btn_off") ); ToolTip::add( m_ch3So2Button, tr( "Channel 3 to SO2 (Left)" ) ); - m_ch4So2Button = new PixmapButton( this, NULL ); + m_ch4So2Button = new PixmapButton( this, nullptr ); m_ch4So2Button->setCheckable( true ); m_ch4So2Button->setChecked( false ); m_ch4So2Button->move( 148, 51 + 3*12 ); diff --git a/plugins/GigPlayer/GigPlayer.cpp b/plugins/GigPlayer/GigPlayer.cpp index 9c9f5a7d0..feed428d1 100644 --- a/plugins/GigPlayer/GigPlayer.cpp +++ b/plugins/GigPlayer/GigPlayer.cpp @@ -69,7 +69,7 @@ Plugin::Descriptor PLUGIN_EXPORT gigplayer_plugin_descriptor = Plugin::Instrument, new PluginPixmapLoader( "logo" ), "gig", - NULL, + nullptr, } ; } @@ -79,8 +79,8 @@ Plugin::Descriptor PLUGIN_EXPORT gigplayer_plugin_descriptor = GigInstrument::GigInstrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &gigplayer_plugin_descriptor ), - m_instance( NULL ), - m_instrument( NULL ), + m_instance( nullptr ), + m_instrument( nullptr ), m_filename( "" ), m_bankNum( 0, 0, 999, this, tr( "Bank" ) ), m_patchNum( 0, 0, 127, this, tr( "Patch" ) ), @@ -165,7 +165,7 @@ AutomatableModel * GigInstrument::childModel( const QString & _modelName ) qCritical() << "requested unknown model " << _modelName; - return NULL; + return nullptr; } @@ -184,15 +184,15 @@ void GigInstrument::freeInstance() QMutexLocker synthLock( &m_synthMutex ); QMutexLocker notesLock( &m_notesMutex ); - if( m_instance != NULL ) + if( m_instance != nullptr ) { delete m_instance; - m_instance = NULL; + m_instance = nullptr; // If we're changing instruments, we got to make sure that we // remove all pointers to the old samples and don't try accessing // that instrument again - m_instrument = NULL; + m_instrument = nullptr; m_notes.clear(); } } @@ -217,7 +217,7 @@ void GigInstrument::openFile( const QString & _gigFile, bool updateTrackName ) } catch( ... ) { - m_instance = NULL; + m_instance = nullptr; m_filename = ""; } } @@ -249,7 +249,7 @@ QString GigInstrument::getCurrentPatchName() { QMutexLocker locker( &m_synthMutex ); - if( m_instance == NULL ) + if( m_instance == nullptr ) { return ""; } @@ -259,7 +259,7 @@ QString GigInstrument::getCurrentPatchName() gig::Instrument * pInstrument = m_instance->gig.GetFirstInstrument(); - while( pInstrument != NULL ) + while( pInstrument != nullptr ) { int iBank = pInstrument->MIDIBank; int iProg = pInstrument->MIDIProgram; @@ -330,7 +330,7 @@ void GigInstrument::play( sampleFrame * _working_buffer ) m_synthMutex.lock(); m_notesMutex.lock(); - if( m_instance == NULL || m_instrument == NULL ) + if( m_instance == nullptr || m_instrument == nullptr ) { m_synthMutex.unlock(); m_notesMutex.unlock(); @@ -379,7 +379,7 @@ void GigInstrument::play( sampleFrame * _working_buffer ) // Delete if the ADSR for a sample is complete for normal // notes, or if a release sample, then if we've reached // the end of the sample - if( sample->sample == NULL || sample->adsr.done() || + if( sample->sample == nullptr || sample->adsr.done() || ( it->isRelease == true && sample->pos >= sample->sample->SamplesTotal - 1 ) ) { @@ -417,7 +417,7 @@ void GigInstrument::play( sampleFrame * _working_buffer ) for( QList::iterator sample = it->samples.begin(); sample != it->samples.end(); ++sample ) { - if( sample->sample == NULL || sample->region == NULL ) + if( sample->sample == nullptr || sample->region == nullptr ) { continue; } @@ -504,7 +504,7 @@ void GigInstrument::play( sampleFrame * _working_buffer ) _working_buffer[i][1] *= m_gain.value(); } - instrumentTrack()->processAudioBuffer( _working_buffer, frames, NULL ); + instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr ); } @@ -512,7 +512,7 @@ void GigInstrument::play( sampleFrame * _working_buffer ) void GigInstrument::loadSample( GigSample& sample, sampleFrame* sampleData, f_cnt_t samples ) { - if( sampleData == NULL || samples < 1 ) + if( sampleData == nullptr || samples < 1 ) { return; } @@ -523,7 +523,7 @@ void GigInstrument::loadSample( GigSample& sample, sampleFrame* sampleData, f_cn f_cnt_t loopStart = 0; f_cnt_t loopLength = 0; - if( sample.region->pSampleLoops != NULL ) + if( sample.region->pSampleLoops != nullptr ) { for( uint32_t i = 0; i < sample.region->SampleLoops; ++i ) { @@ -733,7 +733,7 @@ void GigInstrument::addSamples( GigNote & gignote, bool wantReleaseSample ) gig::Region* pRegion = m_instrument->GetFirstRegion(); - while( pRegion != NULL ) + while( pRegion != nullptr ) { Dimension dim = getDimensions( pRegion, gignote.velocity, wantReleaseSample ); gig::DimensionRegion * pDimRegion = pRegion->GetDimensionRegionByValue( dim.DimValues ); @@ -750,7 +750,7 @@ void GigInstrument::addSamples( GigNote & gignote, bool wantReleaseSample ) gignote.release = dim.release; } - if( pSample != NULL && pSample->SamplesTotal != 0 ) + if( pSample != nullptr && pSample->SamplesTotal != 0 ) { int keyLow = pRegion->KeyRange.low; int keyHigh = pRegion->KeyRange.high; @@ -791,7 +791,7 @@ Dimension GigInstrument::getDimensions( gig::Region * pRegion, int velocity, boo { Dimension dim; - if( pRegion == NULL ) + if( pRegion == nullptr ) { return dim; } @@ -873,11 +873,11 @@ void GigInstrument::getInstrument() QMutexLocker locker( &m_synthMutex ); - if( m_instance != NULL ) + if( m_instance != nullptr ) { gig::Instrument * pInstrument = m_instance->gig.GetFirstInstrument(); - while( pInstrument != NULL ) + while( pInstrument != nullptr ) { int iBank = pInstrument->MIDIBank; int iProg = pInstrument->MIDIProgram; @@ -1049,7 +1049,7 @@ void GigInstrumentView::showFileDialog() { GigInstrument * k = castModel(); - FileDialog ofd( NULL, tr( "Open GIG file" ) ); + FileDialog ofd( nullptr, tr( "Open GIG file" ) ); ofd.setFileMode( FileDialog::ExistingFiles ); QStringList types; @@ -1101,10 +1101,10 @@ void GigInstrumentView::showPatchDialog() GigSample::GigSample( gig::Sample * pSample, gig::DimensionRegion * pDimRegion, float attenuation, int interpolation, float desiredFreq ) : sample( pSample ), region( pDimRegion ), attenuation( attenuation ), - pos( 0 ), interpolation( interpolation ), srcState( NULL ), + pos( 0 ), interpolation( interpolation ), srcState( nullptr ), sampleFreq( 0 ), freqFactor( 1 ) { - if( sample != NULL && region != NULL ) + if( sample != nullptr && region != nullptr ) { // Note: we don't create the libsamplerate object here since we always // also call the copy constructor when appending to the end of the @@ -1134,7 +1134,7 @@ GigSample::GigSample( gig::Sample * pSample, gig::DimensionRegion * pDimRegion, GigSample::~GigSample() { - if( srcState != NULL ) + if( srcState != nullptr ) { src_delete( srcState ); } @@ -1146,7 +1146,7 @@ GigSample::~GigSample() GigSample::GigSample( const GigSample& g ) : sample( g.sample ), region( g.region ), attenuation( g.attenuation ), adsr( g.adsr ), pos( g.pos ), interpolation( g.interpolation ), - srcState( NULL ), sampleFreq( g.sampleFreq ), freqFactor( g.freqFactor ) + srcState( nullptr ), sampleFreq( g.sampleFreq ), freqFactor( g.freqFactor ) { // On the copy, we want to create the object updateSampleRate(); @@ -1163,11 +1163,11 @@ GigSample& GigSample::operator=( const GigSample& g ) adsr = g.adsr; pos = g.pos; interpolation = g.interpolation; - srcState = NULL; + srcState = nullptr; sampleFreq = g.sampleFreq; freqFactor = g.freqFactor; - if( g.srcState != NULL ) + if( g.srcState != nullptr ) { updateSampleRate(); } @@ -1180,7 +1180,7 @@ GigSample& GigSample::operator=( const GigSample& g ) void GigSample::updateSampleRate() { - if( srcState != NULL ) + if( srcState != nullptr ) { src_delete( srcState ); } @@ -1188,7 +1188,7 @@ void GigSample::updateSampleRate() int error = 0; srcState = src_new( interpolation, DEFAULT_CHANNELS, &error ); - if( srcState == NULL || error != 0 ) + if( srcState == nullptr || error != 0 ) { qCritical( "error while creating libsamplerate data structure in GigSample" ); } @@ -1200,7 +1200,7 @@ void GigSample::updateSampleRate() bool GigSample::convertSampleRate( sampleFrame & oldBuf, sampleFrame & newBuf, f_cnt_t oldSize, f_cnt_t newSize, float freq_factor, f_cnt_t& used ) { - if( srcState == NULL ) + if( srcState == nullptr ) { return false; } @@ -1264,7 +1264,7 @@ ADSR::ADSR( gig::DimensionRegion * region, int sampleRate ) attackPosition( 0 ), attackLength( 0 ), decayLength( 0 ), releasePosition( 0 ), releaseLength( 0 ) { - if( region != NULL ) + if( region != nullptr ) { // Parameters from GIG file preattack = 1.0 * region->EG1PreAttack / 1000; // EG1PreAttack is 0-1000 permille diff --git a/plugins/GigPlayer/PatchesDialog.cpp b/plugins/GigPlayer/PatchesDialog.cpp index 7be3bfd98..3d75dd216 100644 --- a/plugins/GigPlayer/PatchesDialog.cpp +++ b/plugins/GigPlayer/PatchesDialog.cpp @@ -66,7 +66,7 @@ PatchesDialog::PatchesDialog( QWidget * pParent, Qt::WindowFlags wflags ) // Setup UI struct... setupUi( this ); - m_pSynth = NULL; + m_pSynth = nullptr; m_iChan = 0; m_iBank = 0; m_iProg = 0; @@ -130,7 +130,7 @@ void PatchesDialog::setup( GigInstance * pSynth, int iChan, setWindowTitle( chanName + " - GIG patches" ); // set m_pSynth to NULL so we don't trigger any progChanged events - m_pSynth = NULL; + m_pSynth = nullptr; // Load bank list from actual synth stack... m_bankListView->setSortingEnabled( false ); @@ -142,7 +142,7 @@ void PatchesDialog::setup( GigInstance * pSynth, int iChan, //fluid_preset_t preset; - QTreeWidgetItem * pBankItem = NULL; + QTreeWidgetItem * pBankItem = nullptr; // Currently just use zero as the only bank int iBankDefault = -1; @@ -215,8 +215,8 @@ bool PatchesDialog::validateForm() { bool bValid = true; - bValid = bValid && ( m_bankListView->currentItem() != NULL ); - bValid = bValid && ( m_progListView->currentItem() != NULL ); + bValid = bValid && ( m_bankListView->currentItem() != nullptr ); + bValid = bValid && ( m_progListView->currentItem() != nullptr ); return bValid; } @@ -227,7 +227,7 @@ bool PatchesDialog::validateForm() // Realize a bank-program selection preset. void PatchesDialog::setBankProg( int iBank, int iProg ) { - if( m_pSynth == NULL ) + if( m_pSynth == nullptr ) { return; } @@ -295,7 +295,7 @@ QTreeWidgetItem * PatchesDialog::findBankItem( int iBank ) } else { - return NULL; + return nullptr; } } @@ -317,7 +317,7 @@ QTreeWidgetItem *PatchesDialog::findProgItem( int iProg ) } else { - return NULL; + return nullptr; } } @@ -327,14 +327,14 @@ QTreeWidgetItem *PatchesDialog::findProgItem( int iProg ) // Bank change slot. void PatchesDialog::bankChanged() { - if( m_pSynth == NULL ) + if( m_pSynth == nullptr ) { return; } QTreeWidgetItem * pBankItem = m_bankListView->currentItem(); - if( pBankItem == NULL ) + if( pBankItem == nullptr ) { return; } @@ -344,7 +344,7 @@ void PatchesDialog::bankChanged() // Clear up the program listview. m_progListView->setSortingEnabled( false ); m_progListView->clear(); - QTreeWidgetItem * pProgItem = NULL; + QTreeWidgetItem * pProgItem = nullptr; gig::Instrument * pInstrument = m_pSynth->gig.GetFirstInstrument(); @@ -386,7 +386,7 @@ void PatchesDialog::bankChanged() // Program change slot. void PatchesDialog::progChanged( QTreeWidgetItem * curr, QTreeWidgetItem * prev ) { - if( m_pSynth == NULL || curr == NULL ) + if( m_pSynth == nullptr || curr == nullptr ) { return; } diff --git a/plugins/HydrogenImport/HydrogenImport.cpp b/plugins/HydrogenImport/HydrogenImport.cpp index a786f56c1..c1f5deeac 100644 --- a/plugins/HydrogenImport/HydrogenImport.cpp +++ b/plugins/HydrogenImport/HydrogenImport.cpp @@ -34,9 +34,9 @@ Plugin::Descriptor PLUGIN_EXPORT hydrogenimport_plugin_descriptor = "frank mather", 0x0100, Plugin::ImportFilter, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, } ; } diff --git a/plugins/HydrogenImport/HydrogenImport.h b/plugins/HydrogenImport/HydrogenImport.h index 1c916f3c3..9818a1366 100644 --- a/plugins/HydrogenImport/HydrogenImport.h +++ b/plugins/HydrogenImport/HydrogenImport.h @@ -18,7 +18,7 @@ public: virtual PluginView * instantiateView( QWidget * ) { - return( NULL ); + return( nullptr ); } private: virtual bool tryImport( TrackContainer* tc ); diff --git a/plugins/LadspaEffect/LadspaControlDialog.cpp b/plugins/LadspaEffect/LadspaControlDialog.cpp index ed16cf9e1..0034dfd6d 100644 --- a/plugins/LadspaEffect/LadspaControlDialog.cpp +++ b/plugins/LadspaEffect/LadspaControlDialog.cpp @@ -38,8 +38,8 @@ LadspaControlDialog::LadspaControlDialog( LadspaControls * _ctl ) : EffectControlDialog( _ctl ), - m_effectLayout( NULL ), - m_stereoLink( NULL ) + m_effectLayout( nullptr ), + m_stereoLink( nullptr ) { QVBoxLayout * mainLay = new QVBoxLayout( this ); @@ -133,7 +133,7 @@ void LadspaControlDialog::updateEffectView( LadspaControls * _ctl ) m_effectLayout->addWidget( grouper ); } - if( _ctl->m_processors > 1 && m_stereoLink != NULL ) + if( _ctl->m_processors > 1 && m_stereoLink != nullptr ) { m_stereoLink->setModel( &_ctl->m_stereoLinkModel ); } diff --git a/plugins/LadspaEffect/LadspaEffect.cpp b/plugins/LadspaEffect/LadspaEffect.cpp index fd1257f41..c571a5827 100644 --- a/plugins/LadspaEffect/LadspaEffect.cpp +++ b/plugins/LadspaEffect/LadspaEffect.cpp @@ -60,7 +60,7 @@ Plugin::Descriptor PLUGIN_EXPORT ladspaeffect_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, + nullptr, new LadspaSubPluginFeatures( Plugin::Effect ) } ; @@ -70,12 +70,12 @@ Plugin::Descriptor PLUGIN_EXPORT ladspaeffect_plugin_descriptor = LadspaEffect::LadspaEffect( Model * _parent, const Descriptor::SubPluginFeatures::Key * _key ) : Effect( &ladspaeffect_plugin_descriptor, _parent, _key ), - m_controls( NULL ), + m_controls( nullptr ), m_maxSampleRate( 0 ), m_key( LadspaSubPluginFeatures::subPluginKeyToLadspaKey( _key ) ) { Ladspa2LMMS * manager = Engine::getLADSPAManager(); - if( manager->getDescription( m_key ) == NULL ) + if( manager->getDescription( m_key ) == nullptr ) { Engine::getSong()->collectError(tr( "Unknown LADSPA plugin %1 requested." ).arg( m_key.second ) ); @@ -108,7 +108,7 @@ void LadspaEffect::changeSampleRate() m_controls->saveState( dataFile, dataFile.content() ); LadspaControls * controls = m_controls; - m_controls = NULL; + m_controls = nullptr; m_pluginMutex.lock(); pluginDestruction(); @@ -139,7 +139,7 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, } int frames = _frames; - sampleFrame * o_buf = NULL; + sampleFrame * o_buf = nullptr; QVarLengthArray sBuf(_frames * DEFAULT_CHANNELS); if( m_maxSampleRate < Engine::audioEngine()->processingSampleRate() ) @@ -194,7 +194,7 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, break; } case CONTROL_RATE_INPUT: - if( pp->control == NULL ) + if( pp->control == nullptr ) { break; } @@ -254,7 +254,7 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf, } } - if( o_buf != NULL ) + if( o_buf != nullptr ) { sampleBack( _buf, o_buf, m_maxSampleRate ); } @@ -302,8 +302,8 @@ void LadspaEffect::pluginInstantiation() int inputch = 0; int outputch = 0; LADSPA_Data * inbuf [2]; - inbuf[0] = NULL; - inbuf[1] = NULL; + inbuf[0] = nullptr; + inbuf[1] = nullptr; for( ch_cnt_t proc = 0; proc < processorCount(); proc++ ) { multi_proc_t ports; @@ -314,8 +314,8 @@ void LadspaEffect::pluginInstantiation() p->name = manager->getPortName( m_key, port ); p->proc = proc; p->port_id = port; - p->control = NULL; - p->buffer = NULL; + p->control = nullptr; + p->buffer = nullptr; // Determine the port's category. if( manager->isPortAudio( m_key, port ) ) @@ -324,7 +324,7 @@ void LadspaEffect::pluginInstantiation() manager->isPortInput( m_key, port ) ) { p->rate = CHANNEL_IN; - p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() ); + p->buffer = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); inbuf[ inputch ] = p->buffer; inputch++; } @@ -339,24 +339,24 @@ void LadspaEffect::pluginInstantiation() } else { - p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() ); + p->buffer = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); m_inPlaceBroken = true; } } else if( manager->isPortInput( m_key, port ) ) { p->rate = AUDIO_RATE_INPUT; - p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() ); + p->buffer = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); } else { p->rate = AUDIO_RATE_OUTPUT; - p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() ); + p->buffer = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); } } else { - p->buffer = MM_ALLOC( LADSPA_Data, 1 ); + p->buffer = MM_ALLOC( 1 ); if( manager->isPortInput( m_key, port ) ) { @@ -475,7 +475,7 @@ void LadspaEffect::pluginInstantiation() // Instantiate the processing units. m_descriptor = manager->getDescriptor( m_key ); - if( m_descriptor == NULL ) + if( m_descriptor == nullptr ) { QMessageBox::warning( 0, "Effect", "Can't get LADSPA descriptor function: " + m_key.second, @@ -483,7 +483,7 @@ void LadspaEffect::pluginInstantiation() setOkay( false ); return; } - if( m_descriptor->run == NULL ) + if( m_descriptor->run == nullptr ) { QMessageBox::warning( 0, "Effect", "Plugin has no processor: " + m_key.second, @@ -494,7 +494,7 @@ void LadspaEffect::pluginInstantiation() { LADSPA_Handle effect = manager->instantiate( m_key, m_maxSampleRate ); - if( effect == NULL ) + if( effect == nullptr ) { QMessageBox::warning( 0, "Effect", "Can't get LADSPA instance: " + m_key.second, diff --git a/plugins/MidiExport/MidiExport.cpp b/plugins/MidiExport/MidiExport.cpp index c285180db..cdd8bb0fa 100644 --- a/plugins/MidiExport/MidiExport.cpp +++ b/plugins/MidiExport/MidiExport.cpp @@ -54,9 +54,9 @@ Plugin::Descriptor PLUGIN_EXPORT midiexport_plugin_descriptor = "Hyunjin Song ", 0x0100, Plugin::ExportFilter, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, } ; } diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index 5ed48a3c7..1429b41d7 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -70,9 +70,9 @@ Plugin::Descriptor PLUGIN_EXPORT midiimport_plugin_descriptor = "Tobias Doerffel ", 0x0100, Plugin::ImportFilter, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, } ; } @@ -103,10 +103,10 @@ bool MidiImport::tryImport( TrackContainer* tc ) } #ifdef LMMS_HAVE_FLUIDSYNTH - if( gui != NULL && + if( getGUI() != nullptr && ConfigManager::inst()->sf2File().isEmpty() ) { - QMessageBox::information( gui->mainWindow(), + QMessageBox::information( getGUI()->mainWindow(), tr( "Setup incomplete" ), tr( "You have not set up a default soundfont in " "the settings dialog (Edit->Settings). " @@ -116,9 +116,9 @@ bool MidiImport::tryImport( TrackContainer* tc ) "settings dialog and try again." ) ); } #else - if( gui ) + if( getGUI() != nullptr ) { - QMessageBox::information( gui->mainWindow(), + QMessageBox::information( getGUI()->mainWindow(), tr( "Setup incomplete" ), tr( "You did not compile LMMS with support for " "SoundFont2 player, which is used to add default " @@ -153,8 +153,8 @@ class smfMidiCC public: smfMidiCC() : - at( NULL ), - ap( NULL ), + at( nullptr ), + ap( nullptr ), lastPos( 0 ) { } @@ -181,8 +181,8 @@ public: void clear() { - at = NULL; - ap = NULL; + at = nullptr; + ap = nullptr; lastPos = 0; } @@ -213,9 +213,9 @@ class smfMidiChannel public: smfMidiChannel() : - it( NULL ), - p( NULL ), - it_inst( NULL ), + it( nullptr ), + p( nullptr ), + it_inst( nullptr ), isSF2( false ), hasNotes( false ) { } @@ -307,7 +307,7 @@ bool MidiImport::readSMF( TrackContainer* tc ) const int MIDI_CC_COUNT = 128 + 1; // 0-127 (128) + pitch bend const int preTrackSteps = 2; QProgressDialog pd( TrackContainer::tr( "Importing MIDI-file..." ), - TrackContainer::tr( "Cancel" ), 0, preTrackSteps, gui->mainWindow() ); + TrackContainer::tr( "Cancel" ), 0, preTrackSteps, getGUI()->mainWindow() ); pd.setWindowTitle( TrackContainer::tr( "Please wait..." ) ); pd.setWindowModality(Qt::WindowModal); pd.setMinimumDuration( 0 ); @@ -499,7 +499,7 @@ bool MidiImport::readSMF( TrackContainer* tc ) if( ccid <= 128 ) { double cc = evt->get_real_value(); - AutomatableModel * objModel = NULL; + AutomatableModel * objModel = nullptr; switch( ccid ) { @@ -539,9 +539,9 @@ bool MidiImport::readSMF( TrackContainer* tc ) } else { - if( ccs[ccid].at == NULL ) { + if( ccs[ccid].at == nullptr ) { ccs[ccid].create( tc, trackName + " > " + ( - objModel != NULL ? + objModel != nullptr ? objModel->displayName() : QString("CC %1").arg(ccid) ) ); } diff --git a/plugins/MidiImport/MidiImport.h b/plugins/MidiImport/MidiImport.h index 88bda9bb5..2edcbe926 100644 --- a/plugins/MidiImport/MidiImport.h +++ b/plugins/MidiImport/MidiImport.h @@ -42,7 +42,7 @@ public: virtual PluginView * instantiateView( QWidget * ) { - return( NULL ); + return( nullptr ); } diff --git a/plugins/MidiImport/portsmf/algrd_internal.h b/plugins/MidiImport/portsmf/algrd_internal.h index a045a1422..9fbe6da31 100644 --- a/plugins/MidiImport/portsmf/algrd_internal.h +++ b/plugins/MidiImport/portsmf/algrd_internal.h @@ -2,6 +2,4 @@ #include "allegro.h" -Alg_error alg_read(std::istream &file, Alg_seq_ptr new_seq, - double *offset_ptr = NULL); - +Alg_error alg_read(std::istream &file, Alg_seq_ptr new_seq, double *offset_ptr = nullptr); diff --git a/plugins/MidiImport/portsmf/allegro.cpp b/plugins/MidiImport/portsmf/allegro.cpp index 5664e910e..5f57839d5 100644 --- a/plugins/MidiImport/portsmf/allegro.cpp +++ b/plugins/MidiImport/portsmf/allegro.cpp @@ -207,12 +207,12 @@ Alg_parameters *Alg_parameters::remove_key(Alg_parameters **list, if (STREQL((*list)->parm.attr_name(), name)) { Alg_parameters_ptr p = *list; *list = p->next; - p->next = NULL; + p->next = nullptr; return p; // caller should free this pointer } list = &((*list)->next); } - return NULL; + return nullptr; } @@ -225,7 +225,7 @@ Alg_parameter_ptr Alg_parameters::find(Alg_attribute attr) return &(temp->parm); } } - return NULL; + return nullptr; } @@ -287,7 +287,7 @@ void Alg_event::set_string_value(const char *a, const char *value) parm.set_attr(attr); parm.s = value; set_parameter(&parm); - parm.s = NULL; // do this to prevent string from being freed + parm.s = nullptr; // do this to prevent string from being freed } @@ -416,7 +416,7 @@ bool Alg_event::has_attribute(const char *a) Alg_note* note = (Alg_note *) this; Alg_attribute attr = symbol_table.insert_string(a); Alg_parameter_ptr parm = note->parameters->find(attr); - return parm != NULL; + return parm != nullptr; } @@ -491,7 +491,7 @@ const char *Alg_event::get_atom_value(const char *a, const char *value) if (parm) return parm->a; // if default is a string, convert to an atom (unique // string in symbol table) and return it - return (value == NULL ? NULL : + return (value == nullptr ? nullptr : symbol_table.insert_string(value)); } @@ -1246,7 +1246,7 @@ void Alg_time_map::insert_beats(double start, double len) Alg_track::Alg_track(Alg_time_map *map, bool seconds) { type = 't'; - time_map = NULL; + time_map = nullptr; units_are_seconds = seconds; set_time_map(map); } @@ -1267,7 +1267,7 @@ Alg_event_ptr Alg_track::copy_event(Alg_event_ptr event) Alg_track::Alg_track(Alg_track &track) { type = 't'; - time_map = NULL; + time_map = nullptr; for (int i = 0; i < track.length(); i++) { append(copy_event(track.events[i])); } @@ -1280,7 +1280,7 @@ Alg_track::Alg_track(Alg_event_list_ref event_list, Alg_time_map_ptr map, bool units_are_seconds) { type = 't'; - time_map = NULL; + time_map = nullptr; for (int i = 0; i < event_list.length(); i++) { append(copy_event(event_list[i])); } @@ -1628,7 +1628,7 @@ void Alg_track::unserialize_track() // (although order shouldn't matter) Alg_parameters_ptr *list = ¬e->parameters; for (j = 0; j < param_num; j++) { - *list = new Alg_parameters(NULL); + *list = new Alg_parameters(nullptr); unserialize_parameter(&((*list)->parm)); list = &((*list)->next); } @@ -1677,7 +1677,7 @@ void Alg_track::unserialize_parameter(Alg_parameter_ptr parm_ptr) void Alg_track::set_time_map(Alg_time_map *map) { if (time_map) time_map->dereference(); - if (map == NULL) { + if (map == nullptr) { time_map = new Alg_time_map(); // new default map time_map->reference(); } else { @@ -2628,7 +2628,7 @@ void Alg_tracks::reset() delete tracks[i]; } if (tracks) delete [] tracks; - tracks = NULL; + tracks = nullptr; len = 0; maxlen = 0; } @@ -2880,8 +2880,7 @@ Alg_event_ptr const &Alg_seq::operator[](int i) } tr++; } - assert(false); // out of bounds - return NULL; + throw std::out_of_range{"Alg_seq::operator[] - Index out of range."}; } //#pragma warning(default: 4715) @@ -2954,7 +2953,7 @@ Alg_seq_ptr Alg_seq::cut(double start, double len, bool all) { double dur = get_dur(); // fix parameters to fall within existing sequence - if (start > dur) return NULL; // nothing to cut + if (start > dur) return nullptr; // nothing to cut if (start < 0) start = 0; // can't start before sequence starts if (start + len > dur) // can't cut after end: len = dur - start; @@ -3059,7 +3058,7 @@ Alg_track_ptr Alg_seq::copy_track(int track_num, double t, double len, bool all) Alg_seq *Alg_seq::copy(double start, double len, bool all) { // fix parameters to fall within existing sequence - if (start > get_dur()) return NULL; // nothing to copy + if (start > get_dur()) return nullptr; // nothing to copy if (start < 0) start = 0; // can't copy before sequence starts if (start + len > get_dur()) // can't copy after end: len = get_dur() - start; @@ -3445,7 +3444,7 @@ Alg_event_ptr Alg_iterator::next(bool *note_on, void **cookie_ptr, bool on; double when; if (!remove_next(events_ptr, index, on, cookie, offset, when)) { - return NULL; + return nullptr; } if (note_on) *note_on = on; Alg_event_ptr event = (*events_ptr)[index]; diff --git a/plugins/MidiImport/portsmf/allegro.h b/plugins/MidiImport/portsmf/allegro.h index 486939d94..22e4533a2 100644 --- a/plugins/MidiImport/portsmf/allegro.h +++ b/plugins/MidiImport/portsmf/allegro.h @@ -78,7 +78,7 @@ class Alg_atoms { public: Alg_atoms() { maxlen = len = 0; - atoms = NULL; + atoms = nullptr; } // Note: the code is possibly more correct and faster without the // following destructor, which will only run after the program takes @@ -250,7 +250,7 @@ public: // 'r' = real (double), 'l' = logical (bool), 'i' = integer (long), // 'a' = atom (char *), a unique string stored in Alg_seq // get the string value - const char *get_string_value(const char *attr, const char *value = NULL); + const char *get_string_value(const char *attr, const char *value = nullptr); // get the real value double get_real_value(const char *attr, double value = 0.0); // get the logical value @@ -258,7 +258,7 @@ public: // get the integer value long get_integer_value(const char *attr, long value = 0); // get the atom value - const char *get_atom_value(const char *attr, const char *value = NULL); + const char *get_atom_value(const char *attr, const char *value = nullptr); void delete_attribute(const char *attr); // delete an attribute/value pair // (ignore if no matching attribute/value pair exists) @@ -299,7 +299,7 @@ public: float loud; // dynamic corresponding to MIDI velocity double dur; // duration in seconds (normally to release point) Alg_parameters_ptr parameters; // attribute/value pair list - Alg_note() { type = 'n'; parameters = NULL; } + Alg_note() { type = 'n'; parameters = nullptr; } void show(); } *Alg_note_ptr; @@ -342,7 +342,7 @@ public: } Alg_events() { maxlen = len = 0; - events = NULL; + events = nullptr; last_note_off = 0; in_use = false; } @@ -394,7 +394,7 @@ public: // particularly fast on an Alg_seq. virtual Alg_event_ptr const &operator[](int i); Alg_event_list() { sequence_number = 0; - beat_dur = 0.0; real_dur = 0.0; events_owner = NULL; type = 'e'; } + beat_dur = 0.0; real_dur = 0.0; events_owner = nullptr; type = 'e'; } Alg_event_list(Alg_track *owner); char get_type() { return type; } @@ -457,7 +457,7 @@ public: } Alg_beats() { maxlen = len = 0; - beats = NULL; + beats = nullptr; expand(); beats[0].time = 0; beats[0].beat = 0; @@ -531,8 +531,8 @@ class Serial_buffer { long len; public: Serial_buffer() { - buffer = NULL; - ptr = NULL; + buffer = nullptr; + ptr = nullptr; len = 0; } virtual ~Serial_buffer() { } @@ -658,8 +658,8 @@ public: assert(i >= 0 && i < len); return events[i]; } - Alg_track() { units_are_seconds = false; time_map = NULL; - set_time_map(NULL); type = 't'; } + Alg_track() { units_are_seconds = false; time_map = nullptr; + set_time_map(nullptr); type = 't'; } // initialize empty track with a time map Alg_track(Alg_time_map *map, bool seconds); @@ -671,7 +671,7 @@ public: bool units_are_seconds); virtual ~Alg_track() { // note: do not call set_time_map(NULL)! if (time_map) time_map->dereference(); - time_map = NULL; } + time_map = nullptr; } // Returns a buffer containing a serialization of the // file. It will be an ASCII representation unless text is true. @@ -686,7 +686,7 @@ public: // If the track is really an Alg_seq and you need to access an // Alg_seq method, coerce to an Alg_seq with this function: Alg_seq_ptr to_alg_seq() { - return (get_type() == 's' ? (Alg_seq_ptr) this : NULL); } + return (get_type() == 's' ? (Alg_seq_ptr) this : nullptr); } // Are we using beats or seconds? bool get_units_are_seconds() { return units_are_seconds; } @@ -858,7 +858,7 @@ private: public: Alg_time_sigs() { maxlen = len = 0; - time_sigs = NULL; + time_sigs = nullptr; } Alg_time_sig &operator[](int i) { // fetch a time signature assert(i >= 0 && i < len); @@ -898,7 +898,7 @@ public: long length() { return len; } Alg_tracks() { maxlen = len = 0; - tracks = NULL; + tracks = nullptr; } ~Alg_tracks(); // Append a track to tracks. This Alg_tracks becomes the owner of track. @@ -959,7 +959,7 @@ public: seq = s; note_off_flag = note_off; maxlen = len = 0; - pending_events = NULL; + pending_events = nullptr; } // Normally, iteration is over the events in the one sequence used // to instatiate the iterator (see above), but with this method, you @@ -969,12 +969,12 @@ public: // before merging/sorting. You should call begin_seq() for each // sequence to be included in the iteration unless you call begin() // (see below). - void begin_seq(Alg_seq_ptr s, void *cookie = NULL, double offset = 0.0); + void begin_seq(Alg_seq_ptr s, void *cookie = nullptr, double offset = 0.0); ~Alg_iterator(); // Prepare to enumerate events in order. If note_off_flag is true, then // iteration_next will merge note-off events into the sequence. If you // call begin(), you should not normally call begin_seq(). See above. - void begin(void *cookie = NULL) { begin_seq(seq, cookie); } + void begin(void *cookie = nullptr) { begin_seq(seq, cookie); } // return next event (or NULL). If iteration_begin was called with // note_off_flag = true, and if note_on is not NULL, then *note_on // is set to true when the result value represents a note-on or update. @@ -984,8 +984,8 @@ public: // cookie corresponding to the event is stored at that address // If end_time is 0, iterate through the entire sequence, but if // end_time is non_zero, stop iterating at the last event before end_time - Alg_event_ptr next(bool *note_on = NULL, void **cookie_ptr = NULL, - double *offset_ptr = NULL, double end_time = 0); + Alg_event_ptr next(bool *note_on = nullptr, void **cookie_ptr = nullptr, + double *offset_ptr = nullptr, double end_time = 0); // Sometimes, the caller wants to receive note-off events for a subset // of the notes, typically the notes that are played and need to be // turned off. In this case, when a note is turned on, the client @@ -1027,9 +1027,9 @@ public: Alg_seq(Alg_track_ptr track) { seq_from_track(*track); } void seq_from_track(Alg_track_ref tr); // create from file: - Alg_seq(std::istream &file, bool smf, double *offset_ptr = NULL); + Alg_seq(std::istream &file, bool smf, double *offset_ptr = nullptr); // create from filename - Alg_seq(const char *filename, bool smf, double *offset_ptr = NULL); + Alg_seq(const char *filename, bool smf, double *offset_ptr = nullptr); virtual ~Alg_seq(); int get_read_error() { return error; } void serialize(void **buffer, long *bytes); diff --git a/plugins/MidiImport/portsmf/allegrord.cpp b/plugins/MidiImport/portsmf/allegrord.cpp index 2dc683afd..33541bc94 100644 --- a/plugins/MidiImport/portsmf/allegrord.cpp +++ b/plugins/MidiImport/portsmf/allegrord.cpp @@ -167,7 +167,7 @@ bool Alg_reader::parse() double new_pitch = 0.0; bool new_key_flag = false; // "K" syntax int new_key = 0; - Alg_parameters_ptr attributes = NULL; + Alg_parameters_ptr attributes = nullptr; if (line_parser.peek() == '#') { // look for #track line_parser.get_nonspace_quoted(field); @@ -299,7 +299,7 @@ bool Alg_reader::parse() if (parse_attribute(field, &parm)) { // enter attribute-value pair attributes = new Alg_parameters(attributes); attributes->parm = parm; - parm.s = NULL; // protect string from deletion by destructor + parm.s = nullptr; // protect string from deletion by destructor } } else { parse_error(field, 0, "Unknown field"); @@ -397,7 +397,7 @@ bool Alg_reader::parse() seq->add_event(new_upd, track_num); Alg_parameters_ptr p = attributes; attributes = attributes->next; - p->parm.s = NULL; // so we don't delete the string + p->parm.s = nullptr; // so we don't delete the string delete p; } } @@ -588,7 +588,7 @@ struct loud_lookup_struct { int val; } loud_lookup[] = { {"FFF", 127}, {"FF", 120}, {"F", 110}, {"MF", 100}, {"MP", 90}, {"P", 80}, {"PP", 70}, {"PPP", 60}, - {NULL, 0} }; + {nullptr, 0} }; double Alg_reader::parse_loud(string &field) diff --git a/plugins/MidiImport/portsmf/allegrosmfrd.cpp b/plugins/MidiImport/portsmf/allegrosmfrd.cpp index 279462762..b6b2d6334 100644 --- a/plugins/MidiImport/portsmf/allegrosmfrd.cpp +++ b/plugins/MidiImport/portsmf/allegrosmfrd.cpp @@ -41,7 +41,7 @@ public: Alg_midifile_reader(istream &f, Alg_seq_ptr new_seq) { file = &f; - note_list = NULL; + note_list = nullptr; seq = new_seq; channel_offset_per_track = 0; channel_offset_per_port = 16; @@ -137,7 +137,7 @@ void Alg_midifile_reader::Mf_endtrack() // note: track is already part of seq, so do not add it here // printf("finished track, length %d number %d\n", track->len, track_num / 100); channel_offset += seq->channel_offset_per_track; - track = NULL; + track = nullptr; double now = get_time(); if (seq->get_beat_dur() < now) seq->set_beat_dur(now); meta_channel = -1; @@ -255,7 +255,7 @@ void Alg_midifile_reader::update(int chan, int key, Alg_parameter_ptr param) update->parameter = *param; // prevent the destructor from destroying the string twice! // the new Update takes the string from param - if (param->attr_type() == 's') param->s = NULL; + if (param->attr_type() == 's') param->s = nullptr; track->append(update); } diff --git a/plugins/MidiImport/portsmf/allegrosmfwr.cpp b/plugins/MidiImport/portsmf/allegrosmfwr.cpp index 7cac9a041..427edc694 100644 --- a/plugins/MidiImport/portsmf/allegrosmfwr.cpp +++ b/plugins/MidiImport/portsmf/allegrosmfwr.cpp @@ -80,7 +80,7 @@ private: Alg_smf_write::Alg_smf_write(Alg_seq_ptr a_seq) { - out_file = NULL; + out_file = nullptr; // at 100bpm (a nominal tempo value), we would like a division // to represent 1ms of time. So @@ -124,19 +124,19 @@ Alg_smf_write::~Alg_smf_write() event_queue* push(event_queue *queue, event_queue *event) { // printf("push: %.6g, %c, %d\n", event->time, event->type, event->index); - if (queue == NULL) { - event->next = NULL; + if (queue == nullptr) { + event->next = nullptr; return event; } - event_queue *marker1 = NULL; + event_queue *marker1 = nullptr; event_queue *marker2 = queue; - while (marker2 != NULL && marker2->time <= event->time) { + while (marker2 != nullptr && marker2->time <= event->time) { marker1 = marker2; marker2 = marker2->next; } event->next = marker2; - if (marker1 != NULL) { + if (marker1 != nullptr) { marker1->next=event; return queue; } else return event; @@ -415,17 +415,17 @@ void Alg_smf_write::write_track(int i) { int j = 0; // note index Alg_events ¬es = seq->track_list[i]; - event_queue *pending = NULL; + event_queue *pending = nullptr; if (notes.length() > 0) { - pending = new event_queue('n', TICK_TIME(notes[j]->time, 0), 0, NULL); + pending = new event_queue('n', TICK_TIME(notes[j]->time, 0), 0, nullptr); } if (i == 0) { // track 0 may have tempo and timesig info if (seq->get_time_map()->last_tempo_flag || seq->get_time_map()->beats.len > 0) { - pending = push(pending, new event_queue('c', 0.0, 0, NULL)); + pending = push(pending, new event_queue('c', 0.0, 0, nullptr)); } if (seq->time_sig.length() > 0) { pending = push(pending, new event_queue('s', - TICK_TIME(seq->time_sig[0].beat, 0), 0, NULL)); + TICK_TIME(seq->time_sig[0].beat, 0), 0, nullptr)); } } while (pending) { @@ -436,7 +436,7 @@ void Alg_smf_write::write_track(int i) if (n->is_note()) { write_note(n, true); pending = push(pending, new event_queue('o', - TICK_TIME(n->time + n->dur, -1), current->index, NULL)); + TICK_TIME(n->time + n->dur, -1), current->index, nullptr)); } else if (n->is_update()) { Alg_update_ptr u = (Alg_update_ptr) n; write_update(u); diff --git a/plugins/MidiImport/portsmf/allegrowr.cpp b/plugins/MidiImport/portsmf/allegrowr.cpp index 3142cfd73..0b0dd445b 100644 --- a/plugins/MidiImport/portsmf/allegrowr.cpp +++ b/plugins/MidiImport/portsmf/allegrowr.cpp @@ -56,7 +56,7 @@ Alg_event_ptr Alg_seq::write_track_name(ostream &file, int n, // find a name and write it, return a pointer to it so the track // writer knows what update (if any) to skip { - Alg_event_ptr e = NULL; // e is the result, default is NULL + Alg_event_ptr e = nullptr; // e is the result, default is NULL file << "#track " << n; const char *attr = symbol_table.insert_string( n == 0 ? "seqnames" : "tracknames"); diff --git a/plugins/MidiImport/portsmf/mfmidi.cpp b/plugins/MidiImport/portsmf/mfmidi.cpp index 7ea4b6ba3..b6c99e0b8 100644 --- a/plugins/MidiImport/portsmf/mfmidi.cpp +++ b/plugins/MidiImport/portsmf/mfmidi.cpp @@ -446,7 +446,7 @@ Midifile_reader::Midifile_reader() void Midifile_reader::finalize() { if (Msgbuff) Mf_free(Msgbuff, Msgsize); - Msgbuff = NULL; + Msgbuff = nullptr; } diff --git a/plugins/MidiImport/portsmf/trace.cpp b/plugins/MidiImport/portsmf/trace.cpp index 38c050fe4..0738fee44 100644 --- a/plugins/MidiImport/portsmf/trace.cpp +++ b/plugins/MidiImport/portsmf/trace.cpp @@ -18,7 +18,7 @@ void trace(char *format, ...) _vsnprintf_s(msg, 256, _TRUNCATE, format, args); va_end(args); #ifdef _DEBUG - _CrtDbgReport(_CRT_WARN, NULL, NULL, NULL, msg); + _CrtDbgReport(_CRT_WARN, nullptr, nullptr, nullptr, msg); #else printf(msg); #endif diff --git a/plugins/MultitapEcho/MultitapEcho.cpp b/plugins/MultitapEcho/MultitapEcho.cpp index fec67c4dc..4134436bb 100644 --- a/plugins/MultitapEcho/MultitapEcho.cpp +++ b/plugins/MultitapEcho/MultitapEcho.cpp @@ -39,8 +39,8 @@ Plugin::Descriptor PLUGIN_EXPORT multitapecho_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -54,7 +54,7 @@ MultitapEchoEffect::MultitapEchoEffect( Model* parent, const Descriptor::SubPlug m_sampleRate( Engine::audioEngine()->processingSampleRate() ), m_sampleRatio( 1.0f / m_sampleRate ) { - m_work = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() ); + m_work = MM_ALLOC( Engine::audioEngine()->framesPerPeriod() ); m_buffer.reset(); m_stages = static_cast( m_controls.m_stages.value() ); updateFilters( 0, 19 ); diff --git a/plugins/MultitapEcho/MultitapEchoControls.cpp b/plugins/MultitapEcho/MultitapEchoControls.cpp index 54dd309c2..4f2fe63fe 100644 --- a/plugins/MultitapEcho/MultitapEchoControls.cpp +++ b/plugins/MultitapEcho/MultitapEchoControls.cpp @@ -149,7 +149,7 @@ void MultitapEchoControls::lpSamplesChanged( int begin, int end ) const float * samples = m_lpGraph.samples(); for( int i = begin; i <= end; ++i ) { - m_effect->m_lpFreq[i] = 20.0f * exp10( samples[i] ); + m_effect->m_lpFreq[i] = 20.0f * std::pow(10.f, samples[i] ); } m_effect->updateFilters( begin, end ); } diff --git a/plugins/OpulenZ/OpulenZ.cpp b/plugins/OpulenZ/OpulenZ.cpp index 7cc620923..fa3a6bbdd 100644 --- a/plugins/OpulenZ/OpulenZ.cpp +++ b/plugins/OpulenZ/OpulenZ.cpp @@ -75,7 +75,7 @@ Plugin::Descriptor PLUGIN_EXPORT opulenz_plugin_descriptor = Plugin::Instrument, new PluginPixmapLoader( "logo" ), "sbi", - NULL, + nullptr, }; // necessary for getting instance out of shared lib @@ -413,7 +413,7 @@ void OpulenzInstrument::play( sampleFrame * _working_buffer ) emulatorMutex.unlock(); // Throw the data to the track... - instrumentTrack()->processAudioBuffer( _working_buffer, frameCount, NULL ); + instrumentTrack()->processAudioBuffer( _working_buffer, frameCount, nullptr ); } @@ -693,7 +693,7 @@ OpulenzInstrumentView::OpulenzInstrumentView( Instrument * _instrument, knobname->move(xpos,ypos); #define BUTTON_GEN(buttname, tooltip, xpos, ypos) \ - buttname = new PixmapButton( this, NULL );\ + buttname = new PixmapButton( this, nullptr );\ buttname->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "led_on" ) );\ buttname->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "led_off" ) );\ buttname->setCheckable( true );\ @@ -701,7 +701,7 @@ OpulenzInstrumentView::OpulenzInstrumentView( Instrument * _instrument, buttname->move( xpos, ypos ); #define WAVEBUTTON_GEN(buttname, tooltip, xpos, ypos, icon_on, icon_off, buttgroup) \ - buttname = new PixmapButton( this, NULL );\ + buttname = new PixmapButton( this, nullptr );\ buttname->setActiveGraphic( PLUGIN_NAME::getIconPixmap( icon_on ) ); \ buttname->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( icon_off ) ); \ ToolTip::add( buttname, tr( tooltip ) );\ diff --git a/plugins/ReverbSC/ReverbSC.cpp b/plugins/ReverbSC/ReverbSC.cpp index 9149eefc5..da42e65dc 100644 --- a/plugins/ReverbSC/ReverbSC.cpp +++ b/plugins/ReverbSC/ReverbSC.cpp @@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT reverbsc_plugin_descriptor = 0x0123, Plugin::Effect, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/Sid/SidInstrument.cpp b/plugins/Sid/SidInstrument.cpp index 28831f7db..236b00589 100644 --- a/plugins/Sid/SidInstrument.cpp +++ b/plugins/Sid/SidInstrument.cpp @@ -83,8 +83,8 @@ Plugin::Descriptor PLUGIN_EXPORT sid_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -503,19 +503,19 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, m_cutKnob->setHintText( tr( "Cutoff frequency:" ), " Hz" ); m_cutKnob->move( 7 + 2*28, 64 ); - PixmapButton * hp_btn = new PixmapButton( this, NULL ); + PixmapButton * hp_btn = new PixmapButton( this, nullptr ); hp_btn->move( 140, 77 ); hp_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "hpred" ) ); hp_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "hp" ) ); ToolTip::add( hp_btn, tr( "High-pass filter ") ); - PixmapButton * bp_btn = new PixmapButton( this, NULL ); + PixmapButton * bp_btn = new PixmapButton( this, nullptr ); bp_btn->move( 164, 77 ); bp_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "bpred" ) ); bp_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "bp" ) ); ToolTip::add( bp_btn, tr( "Band-pass filter ") ); - PixmapButton * lp_btn = new PixmapButton( this, NULL ); + PixmapButton * lp_btn = new PixmapButton( this, nullptr ); lp_btn->move( 185, 77 ); lp_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "lpred" ) ); lp_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "lp" ) ); @@ -526,20 +526,20 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, m_passBtnGrp->addButton( bp_btn ); m_passBtnGrp->addButton( lp_btn ); - m_offButton = new PixmapButton( this, NULL ); + m_offButton = new PixmapButton( this, nullptr ); m_offButton->setCheckable( true ); m_offButton->move( 207, 77 ); m_offButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "3offred" ) ); m_offButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "3off" ) ); ToolTip::add( m_offButton, tr( "Voice 3 off ") ); - PixmapButton * mos6581_btn = new PixmapButton( this, NULL ); + PixmapButton * mos6581_btn = new PixmapButton( this, nullptr ); mos6581_btn->move( 170, 59 ); mos6581_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "6581red" ) ); mos6581_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "6581" ) ); ToolTip::add( mos6581_btn, tr( "MOS6581 SID ") ); - PixmapButton * mos8580_btn = new PixmapButton( this, NULL ); + PixmapButton * mos8580_btn = new PixmapButton( this, nullptr ); mos8580_btn->move( 207, 59 ); mos8580_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "8580red" ) ); mos8580_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "8580" ) ); @@ -575,7 +575,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, crsk->setHintText( tr("Coarse:"), " semitones" ); crsk->move( 147, 114 + i*50 ); - PixmapButton * pulse_btn = new PixmapButton( this, NULL ); + PixmapButton * pulse_btn = new PixmapButton( this, nullptr ); pulse_btn->move( 187, 101 + i*50 ); pulse_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pulsered" ) ); @@ -583,7 +583,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "pulse" ) ); ToolTip::add( pulse_btn, tr( "Pulse wave" ) ); - PixmapButton * triangle_btn = new PixmapButton( this, NULL ); + PixmapButton * triangle_btn = new PixmapButton( this, nullptr ); triangle_btn->move( 168, 101 + i*50 ); triangle_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "trianglered" ) ); @@ -591,7 +591,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "triangle" ) ); ToolTip::add( triangle_btn, tr( "Triangle wave" ) ); - PixmapButton * saw_btn = new PixmapButton( this, NULL ); + PixmapButton * saw_btn = new PixmapButton( this, nullptr ); saw_btn->move( 207, 101 + i*50 ); saw_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sawred" ) ); @@ -599,7 +599,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "saw" ) ); ToolTip::add( saw_btn, tr( "Saw wave" ) ); - PixmapButton * noise_btn = new PixmapButton( this, NULL ); + PixmapButton * noise_btn = new PixmapButton( this, nullptr ); noise_btn->move( 226, 101 + i*50 ); noise_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "noisered" ) ); @@ -615,7 +615,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, wfbg->addButton( saw_btn ); wfbg->addButton( noise_btn ); - PixmapButton * sync_btn = new PixmapButton( this, NULL ); + PixmapButton * sync_btn = new PixmapButton( this, nullptr ); sync_btn->setCheckable( true ); sync_btn->move( 207, 134 + i*50 ); sync_btn->setActiveGraphic( @@ -624,7 +624,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "sync" ) ); ToolTip::add( sync_btn, tr( "Sync" ) ); - PixmapButton * ringMod_btn = new PixmapButton( this, NULL ); + PixmapButton * ringMod_btn = new PixmapButton( this, nullptr ); ringMod_btn->setCheckable( true ); ringMod_btn->move( 170, 116 + i*50 ); ringMod_btn->setActiveGraphic( @@ -633,7 +633,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "ring" ) ); ToolTip::add( ringMod_btn, tr( "Ring modulation" ) ); - PixmapButton * filter_btn = new PixmapButton( this, NULL ); + PixmapButton * filter_btn = new PixmapButton( this, nullptr ); filter_btn->setCheckable( true ); filter_btn->move( 207, 116 + i*50 ); filter_btn->setActiveGraphic( @@ -642,7 +642,7 @@ SidInstrumentView::SidInstrumentView( Instrument * _instrument, PLUGIN_NAME::getIconPixmap( "filter" ) ); ToolTip::add( filter_btn, tr( "Filtered" ) ); - PixmapButton * test_btn = new PixmapButton( this, NULL ); + PixmapButton * test_btn = new PixmapButton( this, nullptr ); test_btn->setCheckable( true ); test_btn->move( 170, 134 + i*50 ); test_btn->setActiveGraphic( diff --git a/plugins/SpectrumAnalyzer/Analyzer.cpp b/plugins/SpectrumAnalyzer/Analyzer.cpp index bb0d644e5..e7b23d7b0 100644 --- a/plugins/SpectrumAnalyzer/Analyzer.cpp +++ b/plugins/SpectrumAnalyzer/Analyzer.cpp @@ -47,8 +47,8 @@ extern "C" { 0x0112, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, }; } diff --git a/plugins/SpectrumAnalyzer/SaProcessor.cpp b/plugins/SpectrumAnalyzer/SaProcessor.cpp index dba09b39c..3fa6c2048 100644 --- a/plugins/SpectrumAnalyzer/SaProcessor.cpp +++ b/plugins/SpectrumAnalyzer/SaProcessor.cpp @@ -77,15 +77,15 @@ SaProcessor::SaProcessor(const SaControls *controls) : SaProcessor::~SaProcessor() { - if (m_fftPlanL != NULL) {fftwf_destroy_plan(m_fftPlanL);} - if (m_fftPlanR != NULL) {fftwf_destroy_plan(m_fftPlanR);} - if (m_spectrumL != NULL) {fftwf_free(m_spectrumL);} - if (m_spectrumR != NULL) {fftwf_free(m_spectrumR);} + if (m_fftPlanL != nullptr) {fftwf_destroy_plan(m_fftPlanL);} + if (m_fftPlanR != nullptr) {fftwf_destroy_plan(m_fftPlanR);} + if (m_spectrumL != nullptr) {fftwf_free(m_spectrumL);} + if (m_spectrumR != nullptr) {fftwf_free(m_spectrumR);} - m_fftPlanL = NULL; - m_fftPlanR = NULL; - m_spectrumL = NULL; - m_spectrumR = NULL; + m_fftPlanL = nullptr; + m_fftPlanR = nullptr; + m_spectrumL = nullptr; + m_spectrumR = nullptr; } @@ -396,10 +396,10 @@ void SaProcessor::reallocateBuffers() QMutexLocker data_lock(&m_dataAccess); // destroy old FFT plan and free the result buffer - if (m_fftPlanL != NULL) {fftwf_destroy_plan(m_fftPlanL);} - if (m_fftPlanR != NULL) {fftwf_destroy_plan(m_fftPlanR);} - if (m_spectrumL != NULL) {fftwf_free(m_spectrumL);} - if (m_spectrumR != NULL) {fftwf_free(m_spectrumR);} + if (m_fftPlanL != nullptr) {fftwf_destroy_plan(m_fftPlanL);} + if (m_fftPlanR != nullptr) {fftwf_destroy_plan(m_fftPlanR);} + if (m_spectrumL != nullptr) {fftwf_free(m_spectrumL);} + if (m_spectrumR != nullptr) {fftwf_free(m_spectrumR);} // allocate new space, create new plan and resize containers m_fftWindow.resize(new_in_size, 1.0); @@ -413,7 +413,7 @@ void SaProcessor::reallocateBuffers() m_fftPlanL = fftwf_plan_dft_r2c_1d(new_fft_size, m_filteredBufferL.data(), m_spectrumL, FFTW_MEASURE); m_fftPlanR = fftwf_plan_dft_r2c_1d(new_fft_size, m_filteredBufferR.data(), m_spectrumR, FFTW_MEASURE); - if (m_fftPlanL == NULL || m_fftPlanR == NULL) + if (m_fftPlanL == nullptr || m_fftPlanR == nullptr) { #ifdef SA_DEBUG std::cerr << "Analyzer: failed to create new FFT plan!" << std::endl; diff --git a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp index 13aaeb724..849cba665 100644 --- a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp +++ b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp @@ -52,7 +52,7 @@ SaSpectrumView::SaSpectrumView(SaControls *controls, SaProcessor *processor, QWi setMinimumSize(360, 170); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - connect(gui->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(periodicUpdate())); + connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(periodicUpdate())); m_displayBufferL.resize(m_processor->binCount(), 0); m_displayBufferR.resize(m_processor->binCount(), 0); @@ -398,8 +398,8 @@ QPainterPath SaSpectrumView::makePath(std::vector &displayBuffer, float r // Draw background, grid and associated frequency and amplitude labels. void SaSpectrumView::drawGrid(QPainter &painter) { - std::vector> *freqTics = NULL; - std::vector> *ampTics = NULL; + std::vector> *freqTics = nullptr; + std::vector> *ampTics = nullptr; float pos = 0; float label_width = 24; float label_height = 15; diff --git a/plugins/SpectrumAnalyzer/SaWaterfallView.cpp b/plugins/SpectrumAnalyzer/SaWaterfallView.cpp index e015d31ef..510ba835b 100644 --- a/plugins/SpectrumAnalyzer/SaWaterfallView.cpp +++ b/plugins/SpectrumAnalyzer/SaWaterfallView.cpp @@ -49,7 +49,7 @@ SaWaterfallView::SaWaterfallView(SaControls *controls, SaProcessor *processor, Q setMinimumSize(300, 150); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - connect(gui->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(periodicUpdate())); + connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(periodicUpdate())); m_displayTop = 1; m_displayBottom = height() -2; diff --git a/plugins/Vectorscope/VectorView.cpp b/plugins/Vectorscope/VectorView.cpp index 330c666cf..f6db921cc 100644 --- a/plugins/Vectorscope/VectorView.cpp +++ b/plugins/Vectorscope/VectorView.cpp @@ -49,7 +49,7 @@ VectorView::VectorView(VecControls *controls, LocklessRingBuffer *i setMinimumSize(200, 200); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - connect(gui->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(periodicUpdate())); + connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(periodicUpdate())); m_displayBuffer.resize(sizeof qRgb(0,0,0) * m_displaySize * m_displaySize, 0); diff --git a/plugins/Vectorscope/Vectorscope.cpp b/plugins/Vectorscope/Vectorscope.cpp index b8f2c2ad5..b3c2b2dda 100644 --- a/plugins/Vectorscope/Vectorscope.cpp +++ b/plugins/Vectorscope/Vectorscope.cpp @@ -38,8 +38,8 @@ extern "C" { 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, }; } diff --git a/plugins/VstEffect/VstEffect.cpp b/plugins/VstEffect/VstEffect.cpp index fb805aed3..d3d722990 100644 --- a/plugins/VstEffect/VstEffect.cpp +++ b/plugins/VstEffect/VstEffect.cpp @@ -47,7 +47,7 @@ Plugin::Descriptor PLUGIN_EXPORT vsteffect_plugin_descriptor = 0x0200, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, + nullptr, new VstSubPluginFeatures( Plugin::Effect ) } ; @@ -126,8 +126,8 @@ bool VstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames ) void VstEffect::openPlugin( const QString & _plugin ) { - TextFloat * tf = NULL; - if( gui ) + TextFloat * tf = nullptr; + if( getGUI() != nullptr ) { tf = TextFloat::displayMessage( VstPlugin::tr( "Loading plugin" ), diff --git a/plugins/VstEffect/VstEffectControlDialog.cpp b/plugins/VstEffect/VstEffectControlDialog.cpp index 156eaae01..f160367d0 100644 --- a/plugins/VstEffect/VstEffectControlDialog.cpp +++ b/plugins/VstEffect/VstEffectControlDialog.cpp @@ -43,10 +43,10 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) : EffectControlDialog( _ctl ), - m_pluginWidget( NULL ), + m_pluginWidget( nullptr ), - m_plugin( NULL ), - tbLabel( NULL ) + m_plugin( nullptr ), + tbLabel( nullptr ) { QGridLayout * l = new QGridLayout( this ); l->setContentsMargins( 10, 10, 10, 10 ); @@ -55,8 +55,8 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) : bool embed_vst = false; - if( _ctl != NULL && _ctl->m_effect != NULL && - _ctl->m_effect->m_plugin != NULL ) + if( _ctl != nullptr && _ctl->m_effect != nullptr && + _ctl->m_effect->m_plugin != nullptr ) { m_plugin = _ctl->m_effect->m_plugin; embed_vst = m_plugin->embedMethod() != "none"; @@ -248,7 +248,7 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) : void VstEffectControlDialog::paintEvent( QPaintEvent * ) { - if( m_plugin != NULL && tbLabel != NULL ) + if( m_plugin != nullptr && tbLabel != nullptr ) { tbLabel->setText( tr( "Effect by: " ) + m_plugin->vendorString() + tr( "       
" ) + diff --git a/plugins/VstEffect/VstEffectControls.cpp b/plugins/VstEffect/VstEffectControls.cpp index e9133ff32..68181e2a0 100644 --- a/plugins/VstEffect/VstEffectControls.cpp +++ b/plugins/VstEffect/VstEffectControls.cpp @@ -38,9 +38,9 @@ VstEffectControls::VstEffectControls( VstEffect * _eff ) : EffectControls( _eff ), m_effect( _eff ), - m_subWindow( NULL ), - knobFModel( NULL ), - ctrHandle( NULL ), + m_subWindow( nullptr ), + knobFModel( nullptr ), + ctrHandle( nullptr ), lastPosInMenu (0), m_vstGuiVisible ( true ) // m_presetLabel ( NULL ) @@ -53,7 +53,7 @@ VstEffectControls::VstEffectControls( VstEffect * _eff ) : VstEffectControls::~VstEffectControls() { delete ctrHandle; - ctrHandle = NULL; + ctrHandle = nullptr; } @@ -64,7 +64,7 @@ void VstEffectControls::loadSettings( const QDomElement & _this ) //m_effect->closePlugin(); //m_effect->openPlugin( _this.attribute( "plugin" ) ); m_effect->m_pluginMutex.lock(); - if( m_effect->m_plugin != NULL ) + if( m_effect->m_plugin != nullptr ) { m_vstGuiVisible = _this.attribute( "guivisible" ).toInt(); @@ -105,7 +105,7 @@ void VstEffectControls::setParameter( Model * action ) { int knobUNID = action->displayName().toInt(); - if ( m_effect->m_plugin != NULL ) { + if ( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->setParam( knobUNID, knobFModel[knobUNID]->value() ); } } @@ -117,10 +117,10 @@ void VstEffectControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) { _this.setAttribute( "plugin", m_effect->m_key.attributes["file"] ); m_effect->m_pluginMutex.lock(); - if( m_effect->m_plugin != NULL ) + if( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->saveSettings( _doc, _this ); - if (knobFModel != NULL) { + if (knobFModel != nullptr) { const QMap & dump = m_effect->m_plugin->parameterDump(); paramCount = dump.size(); char paramStr[35]; @@ -141,7 +141,7 @@ void VstEffectControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) int VstEffectControls::controlCount() { - return m_effect->m_plugin != NULL ? 1 : 0; + return m_effect->m_plugin != nullptr ? 1 : 0; } @@ -158,10 +158,10 @@ EffectControlDialog *VstEffectControls::createView() void VstEffectControls::managePlugin( void ) { - if ( m_effect->m_plugin != NULL && m_subWindow == NULL ) { + if ( m_effect->m_plugin != nullptr && m_subWindow == nullptr ) { manageVSTEffectView * tt = new manageVSTEffectView( m_effect, this); ctrHandle = (QObject *)tt; - } else if (m_subWindow != NULL) { + } else if (m_subWindow != nullptr) { if (m_subWindow->widget()->isVisible() == false ) { m_scrollArea->show(); m_subWindow->show(); @@ -179,7 +179,7 @@ void VstEffectControls::managePlugin( void ) void VstEffectControls::savePreset( void ) { - if ( m_effect->m_plugin != NULL ) { + if ( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->savePreset( ); /* bool converted; QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0); @@ -197,7 +197,7 @@ void VstEffectControls::updateMenu( void ) { // get all presets - - if ( m_effect->m_plugin != NULL ) + if ( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->loadProgramNames(); ///QWidget::update(); @@ -231,7 +231,7 @@ void VstEffectControls::updateMenu( void ) void VstEffectControls::openPreset( void ) { - if ( m_effect->m_plugin != NULL ) { + if ( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->openPreset( ); bool converted; QString str = m_effect->m_plugin->currentProgramName().section("/", 0, 0); @@ -248,7 +248,7 @@ void VstEffectControls::openPreset( void ) void VstEffectControls::rollPreset( void ) { - if ( m_effect->m_plugin != NULL ) { + if ( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->rotateProgram( 1 ); bool converted; QString str = m_effect->m_plugin->currentProgramName().section("/", 0, 0); @@ -264,7 +264,7 @@ void VstEffectControls::rollPreset( void ) void VstEffectControls::rolrPreset( void ) { - if ( m_effect->m_plugin != NULL ) { + if ( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->rotateProgram( -1 ); bool converted; QString str = m_effect->m_plugin->currentProgramName().section("/", 0, 0); @@ -282,7 +282,7 @@ void VstEffectControls::selPreset( void ) QAction *action = qobject_cast(sender()); if (action) - if ( m_effect->m_plugin != NULL ) { + if ( m_effect->m_plugin != nullptr ) { lastPosInMenu = action->data().toInt(); m_effect->m_plugin->setProgram( lastPosInMenu ); //QWidget::update(); @@ -308,7 +308,7 @@ manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls * m_vi->m_scrollArea = new QScrollArea( widget ); l = new QGridLayout( widget ); - m_vi->m_subWindow = gui->mainWindow()->addWindowedWidget(NULL, Qt::SubWindow | + m_vi->m_subWindow = getGUI()->mainWindow()->addWindowedWidget(nullptr, Qt::SubWindow | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); m_vi->m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); m_vi->m_subWindow->setFixedSize( 960, 300); @@ -353,7 +353,7 @@ manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls * vstKnobs = new CustomTextKnob *[ m_vi->paramCount ]; bool hasKnobModel = true; - if (m_vi->knobFModel == NULL) { + if (m_vi->knobFModel == nullptr) { m_vi->knobFModel = new FloatModel *[ m_vi->paramCount ]; hasKnobModel = false; } @@ -479,7 +479,7 @@ void manageVSTEffectView::setParameter( Model * action ) { int knobUNID = action->displayName().toInt(); - if ( m_effect->m_plugin != NULL ) { + if ( m_effect->m_plugin != nullptr ) { m_effect->m_plugin->setParam( knobUNID, m_vi2->knobFModel[knobUNID]->value() ); syncParameterText(); } @@ -520,7 +520,7 @@ void manageVSTEffectView::syncParameterText() manageVSTEffectView::~manageVSTEffectView() { - if( m_vi2->knobFModel != NULL ) + if( m_vi2->knobFModel != nullptr ) { for( int i = 0; i < m_vi2->paramCount; i++ ) { @@ -529,34 +529,34 @@ manageVSTEffectView::~manageVSTEffectView() } } - if( vstKnobs != NULL ) + if( vstKnobs != nullptr ) { delete [] vstKnobs; - vstKnobs = NULL; + vstKnobs = nullptr; } - if( m_vi2->knobFModel != NULL ) + if( m_vi2->knobFModel != nullptr ) { delete [] m_vi2->knobFModel; - m_vi2->knobFModel = NULL; + m_vi2->knobFModel = nullptr; } - if( m_vi2->m_scrollArea != NULL ) + if( m_vi2->m_scrollArea != nullptr ) { delete m_vi2->m_scrollArea; - m_vi2->m_scrollArea = NULL; + m_vi2->m_scrollArea = nullptr; } - if( m_vi2->m_subWindow != NULL ) + if( m_vi2->m_subWindow != nullptr ) { m_vi2->m_subWindow->setAttribute( Qt::WA_DeleteOnClose ); m_vi2->m_subWindow->close(); - if( m_vi2->m_subWindow != NULL ) + if( m_vi2->m_subWindow != nullptr ) { delete m_vi2->m_subWindow; } - m_vi2->m_subWindow = NULL; + m_vi2->m_subWindow = nullptr; } //delete m_vi2->m_subWindow; //m_vi2->m_subWindow = NULL; diff --git a/plugins/Xpressive/ExprSynth.cpp b/plugins/Xpressive/ExprSynth.cpp index 4e5ba21e8..7d1cf13b6 100644 --- a/plugins/Xpressive/ExprSynth.cpp +++ b/plugins/Xpressive/ExprSynth.cpp @@ -370,7 +370,7 @@ class ExprFrontData public: ExprFrontData(int last_func_samples): m_rand_vec(SimpleRandom::generator()), - m_integ_func(NULL), + m_integ_func(nullptr), m_last_func(last_func_samples) {} ~ExprFrontData() @@ -670,7 +670,7 @@ size_t find_occurances(const std::string& haystack, const char* const needle) void ExprFront::setIntegrate(const unsigned int* const frameCounter, const unsigned int sample_rate) { - if (m_data->m_integ_func == NULL) + if (m_data->m_integ_func == nullptr) { const unsigned int ointeg = find_occurances(m_data->m_expression_string,"integrate"); if ( ointeg > 0 ) diff --git a/plugins/Xpressive/Xpressive.cpp b/plugins/Xpressive/Xpressive.cpp index f16322b1f..51b00de87 100644 --- a/plugins/Xpressive/Xpressive.cpp +++ b/plugins/Xpressive/Xpressive.cpp @@ -55,7 +55,7 @@ extern "C" { Plugin::Descriptor PLUGIN_EXPORT xpressive_plugin_descriptor = { STRINGIFY( PLUGIN_NAME), "Xpressive", QT_TRANSLATE_NOOP("PluginBrowser", "Mathematical expression parser"), "Orr Dvori", 0x0100, - Plugin::Instrument, new PluginPixmapLoader("logo"), NULL, NULL }; + Plugin::Instrument, new PluginPixmapLoader("logo"), nullptr, nullptr }; } @@ -202,7 +202,7 @@ void Xpressive::playNote(NotePlayHandle* nph, sampleFrame* working_buffer) { m_A2=m_parameterA2.value(); m_A3=m_parameterA3.value(); - if (nph->totalFramesPlayed() == 0 || nph->m_pluginData == NULL) { + if (nph->totalFramesPlayed() == 0 || nph->m_pluginData == nullptr) { ExprFront *exprO1 = new ExprFront(m_outputExpression[0].constData(),Engine::audioEngine()->processingSampleRate());//give the "last" function a whole second ExprFront *exprO2 = new ExprFront(m_outputExpression[1].constData(),Engine::audioEngine()->processingSampleRate()); @@ -315,37 +315,37 @@ XpressiveView::XpressiveView(Instrument * _instrument, QWidget * _parent) : PixmapButton * m_o2Btn; PixmapButton * m_helpBtn; - m_w1Btn = new PixmapButton(this, NULL); + m_w1Btn = new PixmapButton(this, nullptr); m_w1Btn->move(3, ROW_BTN); m_w1Btn->setActiveGraphic(PLUGIN_NAME::getIconPixmap("w1_active")); m_w1Btn->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("w1_inactive")); ToolTip::add(m_w1Btn, tr("Select oscillator W1")); - m_w2Btn = new PixmapButton(this, NULL); + m_w2Btn = new PixmapButton(this, nullptr); m_w2Btn->move(26, ROW_BTN); m_w2Btn->setActiveGraphic(PLUGIN_NAME::getIconPixmap("w2_active")); m_w2Btn->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("w2_inactive")); ToolTip::add(m_w2Btn, tr("Select oscillator W2")); - m_w3Btn = new PixmapButton(this, NULL); + m_w3Btn = new PixmapButton(this, nullptr); m_w3Btn->move(49, ROW_BTN); m_w3Btn->setActiveGraphic(PLUGIN_NAME::getIconPixmap("w3_active")); m_w3Btn->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("w3_inactive")); ToolTip::add(m_w3Btn, tr("Select oscillator W3")); - m_o1Btn = new PixmapButton(this, NULL); + m_o1Btn = new PixmapButton(this, nullptr); m_o1Btn->move(79, ROW_BTN); m_o1Btn->setActiveGraphic(PLUGIN_NAME::getIconPixmap("o1_active")); m_o1Btn->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("o1_inactive")); ToolTip::add(m_o1Btn, tr("Select output O1")); - m_o2Btn = new PixmapButton(this, NULL); + m_o2Btn = new PixmapButton(this, nullptr); m_o2Btn->move(101, ROW_BTN); m_o2Btn->setActiveGraphic(PLUGIN_NAME::getIconPixmap("o2_active")); m_o2Btn->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("o2_inactive")); ToolTip::add(m_o2Btn, tr("Select output O2")); - m_helpBtn = new PixmapButton(this, NULL); + m_helpBtn = new PixmapButton(this, nullptr); m_helpBtn->move(133, ROW_BTN); m_helpBtn->setActiveGraphic(PLUGIN_NAME::getIconPixmap("help_active")); m_helpBtn->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("help_inactive")); @@ -873,7 +873,7 @@ XpressiveHelpView::XpressiveHelpView():QTextEdit(s_helpText) { setWindowTitle ( "Xpressive Help" ); setTextInteractionFlags ( Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse ); - gui->mainWindow()->addWindowedWidget( this ); + getGUI()->mainWindow()->addWindowedWidget( this ); parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false ); parentWidget()->setWindowIcon( PLUGIN_NAME::getIconPixmap( "logo" ) ); parentWidget()->setFixedSize( 300, 500); diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 5f9fe59b2..b4f2576fd 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -65,7 +65,7 @@ Plugin::Descriptor PLUGIN_EXPORT audiofileprocessor_plugin_descriptor = Plugin::Instrument, new PluginPixmapLoader( "logo" ), "wav,ogg,ds,spx,au,voc,aif,aiff,flac,raw", - NULL, + nullptr, } ; } @@ -446,14 +446,14 @@ void audioFileProcessor::pointChanged( void ) -QPixmap * AudioFileProcessorView::s_artwork = NULL; +QPixmap * AudioFileProcessorView::s_artwork = nullptr; AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, QWidget * _parent ) : InstrumentViewFixedSize( _instrument, _parent ) { - if( s_artwork == NULL ) + if( s_artwork == nullptr ) { s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); @@ -1148,7 +1148,7 @@ void AudioFileProcessorWaveView::slideSamplePointByFrames( knobType _point, f_cn case start: break; } - if( a_knob == NULL ) + if( a_knob == nullptr ) { return; } diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index 54af6da3f..a79276f30 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -60,8 +60,8 @@ Plugin::Descriptor PLUGIN_EXPORT bitinvader_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -278,7 +278,7 @@ QString bitInvader::nodeName() const void bitInvader::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { - if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { float factor; diff --git a/plugins/carlabase/carla.cpp b/plugins/carlabase/carla.cpp index 0bb2c5d5f..01cbb8454 100644 --- a/plugins/carlabase/carla.cpp +++ b/plugins/carlabase/carla.cpp @@ -126,9 +126,9 @@ static const char* host_ui_open_file(NativeHostHandle, bool isDir, const char* t static QByteArray retStr; const QFileDialog::Options options(isDir ? QFileDialog::ShowDirsOnly : 0x0); - retStr = QFileDialog::getOpenFileName(QApplication::activeWindow(), title, "", filter, NULL, options).toUtf8(); + retStr = QFileDialog::getOpenFileName(QApplication::activeWindow(), title, "", filter, nullptr, options).toUtf8(); - return retStr.isEmpty() ? NULL : retStr.constData(); + return retStr.isEmpty() ? nullptr : retStr.constData(); } static const char* host_ui_save_file(NativeHostHandle, bool isDir, const char* title, const char* filter) @@ -136,9 +136,9 @@ static const char* host_ui_save_file(NativeHostHandle, bool isDir, const char* t static QByteArray retStr; const QFileDialog::Options options(isDir ? QFileDialog::ShowDirsOnly : 0x0); - retStr = QFileDialog::getSaveFileName(QApplication::activeWindow(), title, "", filter, NULL, options).toUtf8(); + retStr = QFileDialog::getSaveFileName(QApplication::activeWindow(), title, "", filter, nullptr, options).toUtf8(); - return retStr.isEmpty() ? NULL : retStr.constData(); + return retStr.isEmpty() ? nullptr : retStr.constData(); } // ----------------------------------------------------------------------- @@ -146,13 +146,13 @@ static const char* host_ui_save_file(NativeHostHandle, bool isDir, const char* t CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const Descriptor* const descriptor, const bool isPatchbay) : Instrument(instrumentTrack, descriptor), kIsPatchbay(isPatchbay), - fHandle(NULL), + fHandle(nullptr), fDescriptor(isPatchbay ? carla_get_native_patchbay_plugin() : carla_get_native_rack_plugin()), fMidiEventCount(0), m_paramModels() { fHost.handle = this; - fHost.uiName = NULL; + fHost.uiName = nullptr; fHost.uiParentId = 0; // carla/resources contains PyQt scripts required for launch @@ -182,9 +182,9 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D fTimeInfo.bbt.valid = true; // always valid fHandle = fDescriptor->instantiate(&fHost); - Q_ASSERT(fHandle != NULL); + Q_ASSERT(fHandle != nullptr); - if (fHandle != NULL && fDescriptor->activate != NULL) + if (fHandle != nullptr && fDescriptor->activate != nullptr) fDescriptor->activate(fHandle); // we need a play-handle which cares for calling play() @@ -216,28 +216,28 @@ CarlaInstrument::~CarlaInstrument() { Engine::audioEngine()->removePlayHandlesOfTypes(instrumentTrack(), PlayHandle::TypeNotePlayHandle | PlayHandle::TypeInstrumentPlayHandle); - if (fHost.resourceDir != NULL) + if (fHost.resourceDir != nullptr) { std::free((char*)fHost.resourceDir); - fHost.resourceDir = NULL; + fHost.resourceDir = nullptr; } - if (fHost.uiName != NULL) + if (fHost.uiName != nullptr) { std::free((char*)fHost.uiName); - fHost.uiName = NULL; + fHost.uiName = nullptr; } - if (fHandle == NULL) + if (fHandle == nullptr) return; - if (fDescriptor->deactivate != NULL) + if (fDescriptor->deactivate != nullptr) fDescriptor->deactivate(fHandle); - if (fDescriptor->cleanup != NULL) + if (fDescriptor->cleanup != nullptr) fDescriptor->cleanup(fHandle); - fHandle = NULL; + fHandle = nullptr; #if CARLA_VERSION_HEX >= CARLA_MIN_PARAM_VERSION clearParamModels(); @@ -349,12 +349,12 @@ QString CarlaInstrument::nodeName() const void CarlaInstrument::saveSettings(QDomDocument& doc, QDomElement& parent) { - if (fHandle == NULL || fDescriptor->get_state == NULL) + if (fHandle == nullptr || fDescriptor->get_state == nullptr) return; char* const state = fDescriptor->get_state(fHandle); - if (state == NULL) + if (state == nullptr) return; QDomDocument carlaDoc("carla"); @@ -479,7 +479,7 @@ void CarlaInstrument::updateParamModel(uint32_t index) void CarlaInstrument::loadSettings(const QDomElement& elem) { - if (fHandle == NULL || fDescriptor->set_state == NULL) + if (fHandle == nullptr || fDescriptor->set_state == nullptr) return; QDomDocument carlaDoc("carla"); @@ -500,9 +500,9 @@ void CarlaInstrument::play(sampleFrame* workingBuffer) std::memset(workingBuffer, 0, sizeof(sample_t)*bufsize*DEFAULT_CHANNELS); - if (fHandle == NULL) + if (fHandle == nullptr) { - instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, NULL); + instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, nullptr); return; } @@ -551,7 +551,7 @@ void CarlaInstrument::play(sampleFrame* workingBuffer) workingBuffer[i][1] = buf2[i]; } - instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, NULL); + instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, nullptr); } bool CarlaInstrument::handleMidiEvent(const MidiEvent& event, const TimePos&, f_cnt_t offset) @@ -604,7 +604,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid : InstrumentViewFixedSize(instrument, parent), fHandle(instrument->fHandle), fDescriptor(instrument->fDescriptor), - fTimerId(fHandle != NULL && fDescriptor->ui_idle != NULL ? startTimer(30) : 0), + fTimerId(fHandle != nullptr && fDescriptor->ui_idle != nullptr ? startTimer(30) : 0), m_carlaInstrument(instrument), m_parent(parent), m_paramsSubWindow(nullptr), @@ -671,7 +671,7 @@ CarlaInstrumentView::~CarlaInstrumentView() void CarlaInstrumentView::toggleUI(bool visible) { - if (fHandle != NULL && fDescriptor->ui_show != NULL) { + if (fHandle != nullptr && fDescriptor->ui_show != nullptr) { // TODO: remove when fixed upstream // change working path to location of carla.dll to avoid conflict with lmms #if defined(CARLA_OS_WIN32) || defined(CARLA_OS_WIN64) @@ -846,9 +846,9 @@ CarlaParamsView::CarlaParamsView(CarlaInstrumentView* const instrumentView, QWid verticalLayout->addWidget(splitter); // -- Sub window - CarlaParamsSubWindow* win = new CarlaParamsSubWindow(gui->mainWindow()->workspace()->viewport(), Qt::SubWindow | + CarlaParamsSubWindow* win = new CarlaParamsSubWindow(getGUI()->mainWindow()->workspace()->viewport(), Qt::SubWindow | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); - m_carlaInstrumentView->m_paramsSubWindow = gui->mainWindow()->workspace()->addSubWindow(win); + m_carlaInstrumentView->m_paramsSubWindow = getGUI()->mainWindow()->workspace()->addSubWindow(win); m_carlaInstrumentView->m_paramsSubWindow->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_carlaInstrumentView->m_paramsSubWindow->setMinimumHeight(200); diff --git a/plugins/carlapatchbay/carlapatchbay.cpp b/plugins/carlapatchbay/carlapatchbay.cpp index 4a0f634fe..c01112c05 100644 --- a/plugins/carlapatchbay/carlapatchbay.cpp +++ b/plugins/carlapatchbay/carlapatchbay.cpp @@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT carlapatchbay_plugin_descriptor = CARLA_VERSION_HEX, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; PLUGIN_EXPORT Plugin* lmms_plugin_main(Model* m, void*) diff --git a/plugins/carlarack/carlarack.cpp b/plugins/carlarack/carlarack.cpp index 451a774c9..c2f3cc128 100644 --- a/plugins/carlarack/carlarack.cpp +++ b/plugins/carlarack/carlarack.cpp @@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT carlarack_plugin_descriptor = CARLA_VERSION_HEX, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; PLUGIN_EXPORT Plugin* lmms_plugin_main(Model* m, void*) diff --git a/plugins/dynamics_processor/dynamics_processor.cpp b/plugins/dynamics_processor/dynamics_processor.cpp index 92b4d1443..0dae64504 100644 --- a/plugins/dynamics_processor/dynamics_processor.cpp +++ b/plugins/dynamics_processor/dynamics_processor.cpp @@ -44,8 +44,8 @@ Plugin::Descriptor PLUGIN_EXPORT dynamicsprocessor_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -77,12 +77,12 @@ dynProcEffect::~dynProcEffect() inline void dynProcEffect::calcAttack() { - m_attCoeff = exp10( ( DNF_LOG / ( m_dpControls.m_attackModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() ); + m_attCoeff = std::pow(10.f, ( DNF_LOG / ( m_dpControls.m_attackModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() ); } inline void dynProcEffect::calcRelease() { - m_relCoeff = exp10( ( -DNF_LOG / ( m_dpControls.m_releaseModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() ); + m_relCoeff = std::pow(10.f, ( -DNF_LOG / ( m_dpControls.m_releaseModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() ); } diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index 87b684e5f..1867f6f3b 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -51,8 +51,8 @@ Plugin::Descriptor PLUGIN_EXPORT kicker_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/ladspa_browser/ladspa_browser.cpp b/plugins/ladspa_browser/ladspa_browser.cpp index 7027e1ae4..193b1d4b3 100644 --- a/plugins/ladspa_browser/ladspa_browser.cpp +++ b/plugins/ladspa_browser/ladspa_browser.cpp @@ -55,8 +55,8 @@ Plugin::Descriptor PLUGIN_EXPORT ladspabrowser_plugin_descriptor = 0x0100, Plugin::Tool, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; @@ -72,7 +72,7 @@ PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * _parent, void * _data ) ladspaBrowser::ladspaBrowser() : - ToolPlugin( &ladspabrowser_plugin_descriptor, NULL ) + ToolPlugin( &ladspabrowser_plugin_descriptor, nullptr ) { } diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 7120bda64..2385073b2 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -89,8 +89,8 @@ Plugin::Descriptor PLUGIN_EXPORT lb302_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, }; } @@ -790,7 +790,7 @@ void lb302Synth::play( sampleFrame * _working_buffer ) const fpp_t frames = Engine::audioEngine()->framesPerPeriod(); process( _working_buffer, frames ); - instrumentTrack()->processAudioBuffer( _working_buffer, frames, NULL ); + instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr ); // release_frame = 0; //removed for issue # 1432 } @@ -801,7 +801,7 @@ void lb302Synth::deleteNotePluginData( NotePlayHandle * _n ) //printf("GONE\n"); if( m_playingNote == _n ) { - m_playingNote = NULL; + m_playingNote = nullptr; } } diff --git a/plugins/monstro/Monstro.cpp b/plugins/monstro/Monstro.cpp index 4658ad199..39f5fa66e 100644 --- a/plugins/monstro/Monstro.cpp +++ b/plugins/monstro/Monstro.cpp @@ -51,8 +51,8 @@ Plugin::Descriptor PLUGIN_EXPORT monstro_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -1036,7 +1036,7 @@ void MonstroInstrument::playNote( NotePlayHandle * _n, const fpp_t frames = _n->framesLeftForCurrentPeriod(); const f_cnt_t offset = _n->noteOffset(); - if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { _n->m_pluginData = new MonstroSynth( this, _n ); } @@ -1434,14 +1434,14 @@ void MonstroInstrument::updateSamplerate() void MonstroInstrument::updateSlope1() { const float slope = m_env1Slope.value(); - m_slope[0] = exp10( slope * -1.0f ); + m_slope[0] = std::pow(10.f, slope * -1.0f ); } void MonstroInstrument::updateSlope2() { const float slope = m_env2Slope.value(); - m_slope[1] = exp10( slope * -1.0f ); + m_slope[1] = std::pow(10.f, slope * -1.0f ); } @@ -1461,13 +1461,13 @@ MonstroView::MonstroView( Instrument * _instrument, // "tab buttons" - PixmapButton * m_opViewButton = new PixmapButton( this, NULL ); + PixmapButton * m_opViewButton = new PixmapButton( this, nullptr ); m_opViewButton -> move( 0,0 ); m_opViewButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "opview_active" ) ); m_opViewButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "opview_inactive" ) ); ToolTip::add( m_opViewButton, tr( "Operators view" ) ); - PixmapButton * m_matViewButton = new PixmapButton( this, NULL ); + PixmapButton * m_matViewButton = new PixmapButton( this, nullptr ); m_matViewButton -> move( 125,0 ); m_matViewButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "matview_active" ) ); m_matViewButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "matview_inactive" ) ); @@ -1722,25 +1722,25 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) makeknob( m_env2SlopeKnob, KNOBCOL7, E2ROW, tr( "Slope" ), "", "envKnob" ) // mod selector - PixmapButton * m_mixButton = new PixmapButton( view, NULL ); + PixmapButton * m_mixButton = new PixmapButton( view, nullptr ); m_mixButton -> move( 225, 185 ); m_mixButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_active" ) ); m_mixButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_inactive" ) ); ToolTip::add( m_mixButton, tr( "Mix osc 2 with osc 3" ) ); - PixmapButton * m_amButton = new PixmapButton( view, NULL ); + PixmapButton * m_amButton = new PixmapButton( view, nullptr ); m_amButton -> move( 225, 185 + 15 ); m_amButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "am_active" ) ); m_amButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "am_inactive" ) ); ToolTip::add( m_amButton, tr( "Modulate amplitude of osc 3 by osc 2" ) ); - PixmapButton * m_fmButton = new PixmapButton( view, NULL ); + PixmapButton * m_fmButton = new PixmapButton( view, nullptr ); m_fmButton -> move( 225, 185 + 15*2 ); m_fmButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_active" ) ); m_fmButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_inactive" ) ); ToolTip::add( m_fmButton, tr( "Modulate frequency of osc 3 by osc 2" ) ); - PixmapButton * m_pmButton = new PixmapButton( view, NULL ); + PixmapButton * m_pmButton = new PixmapButton( view, nullptr ); m_pmButton -> move( 225, 185 + 15*3 ); m_pmButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_active" ) ); m_pmButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_inactive" ) ); diff --git a/plugins/monstro/Monstro.h b/plugins/monstro/Monstro.h index 0bb1a8dcc..c8acde3f0 100644 --- a/plugins/monstro/Monstro.h +++ b/plugins/monstro/Monstro.h @@ -59,7 +59,7 @@ name ->setFixedSize( 20, 20 ); #define maketinyled( name, x, y, ttip ) \ - name = new PixmapButton( view, NULL ); \ + name = new PixmapButton( view, nullptr ); \ name -> setCheckable( true ); \ name -> move( x, y ); \ name -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "tinyled_on" ) ); \ diff --git a/plugins/nes/Nes.cpp b/plugins/nes/Nes.cpp index 98c5c8233..637fbfcd3 100644 --- a/plugins/nes/Nes.cpp +++ b/plugins/nes/Nes.cpp @@ -50,8 +50,8 @@ Plugin::Descriptor PLUGIN_EXPORT nes_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -558,7 +558,7 @@ void NesInstrument::playNote( NotePlayHandle * n, sampleFrame * workingBuffer ) const fpp_t frames = n->framesLeftForCurrentPeriod(); const f_cnt_t offset = n->noteOffset(); - if ( n->totalFramesPlayed() == 0 || n->m_pluginData == NULL ) + if ( n->totalFramesPlayed() == 0 || n->m_pluginData == nullptr ) { NesObject * nes = new NesObject( this, Engine::audioEngine()->processingSampleRate(), n ); n->m_pluginData = nes; @@ -727,7 +727,7 @@ void NesInstrument::updateFreq3() -QPixmap * NesInstrumentView::s_artwork = NULL; +QPixmap * NesInstrumentView::s_artwork = nullptr; NesInstrumentView::NesInstrumentView( Instrument * instrument, QWidget * parent ) : @@ -736,7 +736,7 @@ NesInstrumentView::NesInstrumentView( Instrument * instrument, QWidget * parent setAutoFillBackground( true ); QPalette pal; - if( s_artwork == NULL ) + if( s_artwork == nullptr ) { s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); } diff --git a/plugins/nes/Nes.h b/plugins/nes/Nes.h index bbf326d32..1646bae31 100644 --- a/plugins/nes/Nes.h +++ b/plugins/nes/Nes.h @@ -45,7 +45,7 @@ name ->setFixedSize( 29, 29 ); #define makenesled( name, x, y, ttip ) \ - name = new PixmapButton( this, NULL ); \ + name = new PixmapButton( this, nullptr ); \ name -> setCheckable( true ); \ name -> move( x, y ); \ name -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "nesled_on" ) ); \ @@ -53,7 +53,7 @@ ToolTip::add( name, ttip ); #define makedcled( name, x, y, ttip, active ) \ - PixmapButton * name = new PixmapButton( this, NULL ); \ + PixmapButton * name = new PixmapButton( this, nullptr ); \ name -> move( x, y ); \ name -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( active ) ); \ name -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "nesdc_off" ) ); \ diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index 3d28037c6..1dbc06b85 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -57,14 +57,14 @@ Plugin::Descriptor PLUGIN_EXPORT organic_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } -QPixmap * organicInstrumentView::s_artwork = NULL; -float * organicInstrument::s_harmonics = NULL; +QPixmap * organicInstrumentView::s_artwork = nullptr; +float * organicInstrument::s_harmonics = nullptr; /*********************************************************************** * @@ -114,7 +114,7 @@ organicInstrument::organicInstrument( InstrumentTrack * _instrument_track ) : m_osc[6]->m_harmonic = log2f( 5.0f ); // . m_osc[7]->m_harmonic = log2f( 6.0f ); // .*/ - if( s_harmonics == NULL ) + if( s_harmonics == nullptr ) { s_harmonics = new float[ NUM_HARMONICS ]; s_harmonics[0] = log2f( 0.5f ); @@ -230,7 +230,7 @@ void organicInstrument::playNote( NotePlayHandle * _n, const fpp_t frames = _n->framesLeftForCurrentPeriod(); const f_cnt_t offset = _n->noteOffset(); - if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { Oscillator * oscs_l[NUM_OSCILLATORS]; Oscillator * oscs_r[NUM_OSCILLATORS]; @@ -418,7 +418,7 @@ public: organicInstrumentView::organicInstrumentView( Instrument * _instrument, QWidget * _parent ) : InstrumentViewFixedSize( _instrument, _parent ), - m_oscKnobs( NULL ) + m_oscKnobs( nullptr ) { organicInstrument * oi = castModel(); @@ -455,7 +455,7 @@ organicInstrumentView::organicInstrumentView( Instrument * _instrument, oi, SLOT( randomiseSettings() ) ); - if( s_artwork == NULL ) + if( s_artwork == nullptr ) { s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); @@ -484,7 +484,7 @@ void organicInstrumentView::modelChanged() m_fx1Knob->setModel( &oi->m_fx1Model ); m_volKnob->setModel( &oi->m_volModel ); - if( m_oscKnobs != NULL ) + if( m_oscKnobs != nullptr ) { delete[] m_oscKnobs; } diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index 4c8ba41d1..896b6c330 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -62,7 +62,7 @@ Plugin::Descriptor PLUGIN_EXPORT patman_plugin_descriptor = Plugin::Instrument, new PluginPixmapLoader( "logo" ), "pat", - NULL, + nullptr, } ; @@ -395,7 +395,7 @@ void patmanInstrument::selectSample( NotePlayHandle * _n ) const float freq = _n->frequency(); float min_dist = HUGE_VALF; - SampleBuffer* sample = NULL; + SampleBuffer* sample = nullptr; for( QVector::iterator it = m_patchSamples.begin(); it != m_patchSamples.end(); ++it ) { @@ -418,7 +418,7 @@ void patmanInstrument::selectSample( NotePlayHandle * _n ) } else { - hdata->sample = new SampleBuffer( NULL, 0 ); + hdata->sample = new SampleBuffer( nullptr, 0 ); } hdata->state = new SampleBuffer::handleState( _n->hasDetuningInfo() ); @@ -444,7 +444,7 @@ PluginView * patmanInstrument::instantiateView( QWidget * _parent ) PatmanView::PatmanView( Instrument * _instrument, QWidget * _parent ) : InstrumentViewFixedSize( _instrument, _parent ), - m_pi( NULL ) + m_pi( nullptr ) { setAutoFillBackground( true ); QPalette pal; @@ -453,7 +453,7 @@ PatmanView::PatmanView( Instrument * _instrument, QWidget * _parent ) : setPalette( pal ); - m_openFileButton = new PixmapButton( this, NULL ); + m_openFileButton = new PixmapButton( this, nullptr ); m_openFileButton->setObjectName( "openFileButton" ); m_openFileButton->setCursor( QCursor( Qt::PointingHandCursor ) ); m_openFileButton->move( 227, 86 ); @@ -502,7 +502,7 @@ PatmanView::~PatmanView() void PatmanView::openFile( void ) { - FileDialog ofd( NULL, tr( "Open patch file" ) ); + FileDialog ofd( nullptr, tr( "Open patch file" ) ); ofd.setFileMode( FileDialog::ExistingFiles ); QStringList types; diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp index 64b8472bf..6db4fba5c 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -47,8 +47,8 @@ Plugin::Descriptor PLUGIN_EXPORT peakcontrollereffect_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -66,7 +66,7 @@ PeakControllerEffect::PeakControllerEffect( m_effectId( rand() ), m_peakControls( this ), m_lastSample( 0 ), - m_autoController( NULL ) + m_autoController( nullptr ) { m_autoController = new PeakController( Engine::getSong(), this ); if( !Engine::getSong()->isLoadingProject() && !PresetPreviewPlayHandle::isPreviewing() ) diff --git a/plugins/sf2_player/patches_dialog.cpp b/plugins/sf2_player/patches_dialog.cpp index fe49ab1b3..9586e7408 100644 --- a/plugins/sf2_player/patches_dialog.cpp +++ b/plugins/sf2_player/patches_dialog.cpp @@ -65,7 +65,7 @@ patchesDialog::patchesDialog( QWidget *pParent, Qt::WindowFlags wflags ) // Setup UI struct... setupUi( this ); - m_pSynth = NULL; + m_pSynth = nullptr; m_iChan = 0; m_iBank = 0; m_iProg = 0; @@ -128,7 +128,7 @@ void patchesDialog::setup ( fluid_synth_t * pSynth, int iChan, setWindowTitle( _chanName + " - Soundfont patches" ); // set m_pSynth to NULL so we don't trigger any progChanged events - m_pSynth = NULL; + m_pSynth = nullptr; // Load bank list from actual synth stack... m_bankListView->setSortingEnabled(false); @@ -139,7 +139,7 @@ void patchesDialog::setup ( fluid_synth_t * pSynth, int iChan, m_iChan = iChan; - QTreeWidgetItem *pBankItem = NULL; + QTreeWidgetItem *pBankItem = nullptr; // For all soundfonts (in reversed stack order) fill the available banks... int cSoundFonts = ::fluid_synth_sfcount(m_pSynth); for (int i = 0; i < cSoundFonts; i++) { @@ -209,8 +209,8 @@ bool patchesDialog::validateForm() { bool bValid = true; - bValid = bValid && (m_bankListView->currentItem() != NULL); - bValid = bValid && (m_progListView->currentItem() != NULL); + bValid = bValid && (m_bankListView->currentItem() != nullptr); + bValid = bValid && (m_progListView->currentItem() != nullptr); return bValid; } @@ -219,7 +219,7 @@ bool patchesDialog::validateForm() // Realize a bank-program selection preset. void patchesDialog::setBankProg ( int iBank, int iProg ) { - if (m_pSynth == NULL) + if (m_pSynth == nullptr) return; // just select the synth's program preset... @@ -278,7 +278,7 @@ QTreeWidgetItem *patchesDialog::findBankItem ( int iBank ) if (iter.hasNext()) return iter.next(); else - return NULL; + return nullptr; } @@ -293,7 +293,7 @@ QTreeWidgetItem *patchesDialog::findProgItem ( int iProg ) if (iter.hasNext()) return iter.next(); else - return NULL; + return nullptr; } @@ -301,11 +301,11 @@ QTreeWidgetItem *patchesDialog::findProgItem ( int iProg ) // Bank change slot. void patchesDialog::bankChanged (void) { - if (m_pSynth == NULL) + if (m_pSynth == nullptr) return; QTreeWidgetItem *pBankItem = m_bankListView->currentItem(); - if (pBankItem == NULL) + if (pBankItem == nullptr) return; int iBankSelected = pBankItem->text(0).toInt(); @@ -313,7 +313,7 @@ void patchesDialog::bankChanged (void) // Clear up the program listview. m_progListView->setSortingEnabled(false); m_progListView->clear(); - QTreeWidgetItem *pProgItem = NULL; + QTreeWidgetItem *pProgItem = nullptr; // For all soundfonts (in reversed stack order) fill the available programs... int cSoundFonts = ::fluid_synth_sfcount(m_pSynth); for (int i = 0; i < cSoundFonts && !pProgItem; i++) { @@ -358,7 +358,7 @@ void patchesDialog::bankChanged (void) // Program change slot. void patchesDialog::progChanged (QTreeWidgetItem * _curr, QTreeWidgetItem * _prev) { - if (m_pSynth == NULL || _curr == NULL) + if (m_pSynth == nullptr || _curr == nullptr) return; // Which preview state... diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 3eb23febb..2f42fc230 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -63,7 +63,7 @@ Plugin::Descriptor PLUGIN_EXPORT sf2player_plugin_descriptor = Plugin::Instrument, new PluginPixmapLoader( "logo" ), "sf2,sf3", - NULL, + nullptr, } ; } @@ -90,9 +90,9 @@ QMutex sf2Instrument::s_fontsMutex; sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &sf2player_plugin_descriptor ), - m_srcState( NULL ), + m_srcState( nullptr ), m_synth(nullptr), - m_font( NULL ), + m_font( nullptr ), m_fontId( 0 ), m_filename( "" ), m_lastMidiPitch( -1 ), @@ -120,7 +120,7 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) : #if QT_VERSION_CHECK(FLUIDSYNTH_VERSION_MAJOR, FLUIDSYNTH_VERSION_MINOR, FLUIDSYNTH_VERSION_MICRO) >= QT_VERSION_CHECK(1,1,9) // Deactivate all audio drivers in fluidsynth - const char *none[] = { NULL }; + const char *none[] = { nullptr }; fluid_audio_driver_register( none ); #endif m_settings = new_fluid_settings(); @@ -197,7 +197,7 @@ sf2Instrument::~sf2Instrument() freeFont(); delete_fluid_synth( m_synth ); delete_fluid_settings( m_settings ); - if( m_srcState != NULL ) + if( m_srcState != nullptr ) { src_delete( m_srcState ); } @@ -314,7 +314,7 @@ AutomatableModel * sf2Instrument::childModel( const QString & _modelName ) return &m_patchNum; } qCritical() << "requested unknown model " << _modelName; - return NULL; + return nullptr; } @@ -331,7 +331,7 @@ void sf2Instrument::freeFont() { m_synthMutex.lock(); - if ( m_font != NULL ) + if ( m_font != nullptr ) { s_fontsMutex.lock(); --(m_font->refCount); @@ -354,7 +354,7 @@ void sf2Instrument::freeFont() } s_fontsMutex.unlock(); - m_font = NULL; + m_font = nullptr; } m_synthMutex.unlock(); } @@ -588,13 +588,13 @@ void sf2Instrument::reloadSynth() if( m_internalSampleRate < Engine::audioEngine()->processingSampleRate() ) { m_synthMutex.lock(); - if( m_srcState != NULL ) + if( m_srcState != nullptr ) { src_delete( m_srcState ); } int error; m_srcState = src_new( Engine::audioEngine()->currentQualitySettings().libsrcInterpolation(), DEFAULT_CHANNELS, &error ); - if( m_srcState == NULL || error ) + if( m_srcState == nullptr || error ) { qCritical("error while creating libsamplerate data structure in Sf2Instrument::reloadSynth()"); } @@ -641,7 +641,7 @@ void sf2Instrument::playNote( NotePlayHandle * _n, sampleFrame * ) pluginData->midiNote = midiNote; pluginData->lastPanning = 0; pluginData->lastVelocity = _n->midiVelocity( baseVelocity ); - pluginData->fluidVoice = NULL; + pluginData->fluidVoice = nullptr; pluginData->isNew = true; pluginData->offset = _n->offset(); pluginData->noteOffSent = false; @@ -749,7 +749,7 @@ void sf2Instrument::play( sampleFrame * _working_buffer ) if( m_playingNotes.isEmpty() ) { renderFrames( frames, _working_buffer ); - instrumentTrack()->processAudioBuffer( _working_buffer, frames, NULL ); + instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr ); return; } @@ -807,7 +807,7 @@ void sf2Instrument::play( sampleFrame * _working_buffer ) { renderFrames( frames - currentFrame, _working_buffer + currentFrame ); } - instrumentTrack()->processAudioBuffer( _working_buffer, frames, NULL ); + instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr ); } @@ -815,7 +815,7 @@ void sf2Instrument::renderFrames( f_cnt_t frames, sampleFrame * buf ) { m_synthMutex.lock(); if( m_internalSampleRate < Engine::audioEngine()->processingSampleRate() && - m_srcState != NULL ) + m_srcState != nullptr ) { const fpp_t f = frames * m_internalSampleRate / Engine::audioEngine()->processingSampleRate(); #ifdef __GNUC__ @@ -1135,7 +1135,7 @@ void sf2InstrumentView::showFileDialog() { sf2Instrument * k = castModel(); - FileDialog ofd( NULL, tr( "Open SoundFont file" ) ); + FileDialog ofd( nullptr, tr( "Open SoundFont file" ) ); ofd.setFileMode( FileDialog::ExistingFiles ); QStringList types; diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index e02bc7285..bfdd22b55 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -68,8 +68,8 @@ Plugin::Descriptor PLUGIN_EXPORT sfxr_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -301,7 +301,7 @@ void SfxrSynth::update( sampleFrame * buffer, const int32_t frameNum ) //ssample*=2.0f*sound_vol; ssample*=0.025f; - if(buffer!=NULL) + if(buffer!=nullptr) { if(ssample>1.0f) ssample=1.0f; if(ssample<-1.0f) ssample=-1.0f; @@ -459,7 +459,7 @@ void sfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffe fpp_t frameNum = _n->framesLeftForCurrentPeriod(); const f_cnt_t offset = _n->noteOffset(); - if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { _n->m_pluginData = new SfxrSynth( this ); } @@ -603,7 +603,7 @@ sfxrInstrumentView::sfxrInstrumentView( Instrument * _instrument, QWidget * _parent ) : InstrumentViewFixedSize( _instrument, _parent ) { - srand(time(NULL)); + srand(time(nullptr)); setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); diff --git a/plugins/stereo_enhancer/stereo_enhancer.cpp b/plugins/stereo_enhancer/stereo_enhancer.cpp index f5afebd39..ad2ebd4e9 100644 --- a/plugins/stereo_enhancer/stereo_enhancer.cpp +++ b/plugins/stereo_enhancer/stereo_enhancer.cpp @@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT stereoenhancer_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/stereo_matrix/stereo_matrix.cpp b/plugins/stereo_matrix/stereo_matrix.cpp index afabf959b..cec730725 100644 --- a/plugins/stereo_matrix/stereo_matrix.cpp +++ b/plugins/stereo_matrix/stereo_matrix.cpp @@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT stereomatrix_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index 6a58f7cfa..a175b385d 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -56,8 +56,8 @@ Plugin::Descriptor PLUGIN_EXPORT malletsstk_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -288,7 +288,7 @@ void malletsInstrument::playNote( NotePlayHandle * _n, int p = m_presetsModel.value(); const float freq = _n->frequency(); - if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { // If newer projects, adjust velocity to within stk's limits float velocityAdjust = @@ -415,7 +415,7 @@ malletsInstrumentView::malletsInstrumentView( malletsInstrument * _instrument, m_spreadKnob->setHintText( tr( "Spread:" ), "" ); // try to inform user about missing Stk-installation - if( _instrument->m_filesMissing && gui != NULL ) + if( _instrument->m_filesMissing && getGUI() != nullptr ) { QMessageBox::information( 0, tr( "Missing files" ), tr( "Your Stk-installation seems to be " @@ -641,7 +641,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, } catch( ... ) { - m_voice = NULL; + m_voice = nullptr; } m_delay = new StkFloat[256]; @@ -690,7 +690,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, } catch( ... ) { - m_voice = NULL; + m_voice = nullptr; } m_delay = new StkFloat[256]; @@ -741,7 +741,7 @@ malletsSynth::malletsSynth( const StkFloat _pitch, } catch( ... ) { - m_voice = NULL; + m_voice = nullptr; } m_delay = new StkFloat[256]; diff --git a/plugins/stk/mallets/mallets.h b/plugins/stk/mallets/mallets.h index f50d20c67..e4b4cf48f 100644 --- a/plugins/stk/mallets/mallets.h +++ b/plugins/stk/mallets/mallets.h @@ -92,7 +92,7 @@ public: inline sample_t nextSampleLeft() { - if( m_voice == NULL ) + if( m_voice == nullptr ) { return( 0.0f ); } diff --git a/plugins/triple_oscillator/TripleOscillator.cpp b/plugins/triple_oscillator/TripleOscillator.cpp index dcb21bb8e..a39da6cb5 100644 --- a/plugins/triple_oscillator/TripleOscillator.cpp +++ b/plugins/triple_oscillator/TripleOscillator.cpp @@ -56,8 +56,8 @@ Plugin::Descriptor PLUGIN_EXPORT tripleoscillator_plugin_descriptor = 0x0110, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -312,7 +312,7 @@ QString TripleOscillator::nodeName() const void TripleOscillator::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { - if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { Oscillator * oscs_l[NUM_OF_OSCILLATORS]; Oscillator * oscs_r[NUM_OF_OSCILLATORS]; @@ -453,7 +453,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, const int osc_h = 52; // TODO: clean rewrite using layouts and all that... - PixmapButton * pm_osc1_btn = new PixmapButton( this, NULL ); + PixmapButton * pm_osc1_btn = new PixmapButton( this, nullptr ); pm_osc1_btn->move( mod_x, mod1_y ); pm_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_active" ) ); @@ -461,7 +461,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "pm_inactive" ) ); ToolTip::add( pm_osc1_btn, tr( "Modulate phase of oscillator 1 by oscillator 2" ) ); - PixmapButton * am_osc1_btn = new PixmapButton( this, NULL ); + PixmapButton * am_osc1_btn = new PixmapButton( this, nullptr ); am_osc1_btn->move( mod_x + 35, mod1_y ); am_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "am_active" ) ); @@ -469,7 +469,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "am_inactive" ) ); ToolTip::add( am_osc1_btn, tr( "Modulate amplitude of oscillator 1 by oscillator 2" ) ); - PixmapButton * mix_osc1_btn = new PixmapButton( this, NULL ); + PixmapButton * mix_osc1_btn = new PixmapButton( this, nullptr ); mix_osc1_btn->move( mod_x + 70, mod1_y ); mix_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_active" ) ); @@ -477,7 +477,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "mix_inactive" ) ); ToolTip::add( mix_osc1_btn, tr( "Mix output of oscillators 1 & 2" ) ); - PixmapButton * sync_osc1_btn = new PixmapButton( this, NULL ); + PixmapButton * sync_osc1_btn = new PixmapButton( this, nullptr ); sync_osc1_btn->move( mod_x + 105, mod1_y ); sync_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_active" ) ); @@ -486,7 +486,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, ToolTip::add( sync_osc1_btn, tr( "Synchronize oscillator 1 with " "oscillator 2" ) ); - PixmapButton * fm_osc1_btn = new PixmapButton( this, NULL ); + PixmapButton * fm_osc1_btn = new PixmapButton( this, nullptr ); fm_osc1_btn->move( mod_x + 140, mod1_y ); fm_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_active" ) ); @@ -503,7 +503,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, - PixmapButton * pm_osc2_btn = new PixmapButton( this, NULL ); + PixmapButton * pm_osc2_btn = new PixmapButton( this, nullptr ); pm_osc2_btn->move( mod_x, mod2_y ); pm_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_active" ) ); @@ -511,7 +511,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "pm_inactive" ) ); ToolTip::add( pm_osc2_btn, tr( "Modulate phase of oscillator 2 by oscillator 3" ) ); - PixmapButton * am_osc2_btn = new PixmapButton( this, NULL ); + PixmapButton * am_osc2_btn = new PixmapButton( this, nullptr ); am_osc2_btn->move( mod_x + 35, mod2_y ); am_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "am_active" ) ); @@ -519,7 +519,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "am_inactive" ) ); ToolTip::add( am_osc2_btn, tr( "Modulate amplitude of oscillator 2 by oscillator 3" ) ); - PixmapButton * mix_osc2_btn = new PixmapButton( this, NULL ); + PixmapButton * mix_osc2_btn = new PixmapButton( this, nullptr ); mix_osc2_btn->move( mod_x + 70, mod2_y ); mix_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_active" ) ); @@ -527,7 +527,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "mix_inactive" ) ); ToolTip::add( mix_osc2_btn, tr("Mix output of oscillators 2 & 3" ) ); - PixmapButton * sync_osc2_btn = new PixmapButton( this, NULL ); + PixmapButton * sync_osc2_btn = new PixmapButton( this, nullptr ); sync_osc2_btn->move( mod_x + 105, mod2_y ); sync_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_active" ) ); @@ -535,7 +535,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "sync_inactive" ) ); ToolTip::add( sync_osc2_btn, tr( "Synchronize oscillator 2 with oscillator 3" ) ); - PixmapButton * fm_osc2_btn = new PixmapButton( this, NULL ); + PixmapButton * fm_osc2_btn = new PixmapButton( this, nullptr ); fm_osc2_btn->move( mod_x + 140, mod2_y ); fm_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_active" ) ); @@ -605,7 +605,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, int btn_y = 96 + i * osc_h; - PixmapButton * sin_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * sin_wave_btn = new PixmapButton( this, nullptr ); sin_wave_btn->move( 128, btn_y ); sin_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sin_shape_active" ) ); @@ -615,7 +615,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, tr( "Sine wave" ) ); PixmapButton * triangle_wave_btn = - new PixmapButton( this, NULL ); + new PixmapButton( this, nullptr ); triangle_wave_btn->move( 143, btn_y ); triangle_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "triangle_shape_active" ) ); @@ -624,7 +624,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, ToolTip::add( triangle_wave_btn, tr( "Triangle wave") ); - PixmapButton * saw_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * saw_wave_btn = new PixmapButton( this, nullptr ); saw_wave_btn->move( 158, btn_y ); saw_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "saw_shape_active" ) ); @@ -633,7 +633,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, ToolTip::add( saw_wave_btn, tr( "Saw wave" ) ); - PixmapButton * sqr_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * sqr_wave_btn = new PixmapButton( this, nullptr ); sqr_wave_btn->move( 173, btn_y ); sqr_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "square_shape_active" ) ); @@ -643,7 +643,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, tr( "Square wave" ) ); PixmapButton * moog_saw_wave_btn = - new PixmapButton( this, NULL ); + new PixmapButton( this, nullptr ); moog_saw_wave_btn->move( 188, btn_y ); moog_saw_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "moog_saw_shape_active" ) ); @@ -652,7 +652,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, ToolTip::add( moog_saw_wave_btn, tr( "Moog-like saw wave" ) ); - PixmapButton * exp_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * exp_wave_btn = new PixmapButton( this, nullptr ); exp_wave_btn->move( 203, btn_y ); exp_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "exp_shape_active" ) ); @@ -661,7 +661,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, ToolTip::add( exp_wave_btn, tr( "Exponential wave" ) ); - PixmapButton * white_noise_btn = new PixmapButton( this, NULL ); + PixmapButton * white_noise_btn = new PixmapButton( this, nullptr ); white_noise_btn->move( 218, btn_y ); white_noise_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "white_noise_shape_active" ) ); @@ -670,7 +670,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, ToolTip::add( white_noise_btn, tr( "White noise" ) ); - PixmapButton * uwb = new PixmapButton( this, NULL ); + PixmapButton * uwb = new PixmapButton( this, nullptr ); uwb->move( 233, btn_y ); uwb->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "usr_shape_active" ) ); @@ -678,7 +678,7 @@ TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, "usr_shape_inactive" ) ); ToolTip::add( uwb, tr( "User-defined wave" ) ); - PixmapButton * uwt = new PixmapButton( this, NULL ); + PixmapButton * uwt = new PixmapButton( this, nullptr ); uwt->move( 110, btn_y ); uwt->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "wavetable_active" ) ); diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 837a5721f..97af8bc43 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -79,7 +79,7 @@ Plugin::Descriptor Q_DECL_EXPORT vestige_plugin_descriptor = Plugin::Instrument, new PluginPixmapLoader( "logo" ), "dll", - NULL, + nullptr, } ; } @@ -121,7 +121,7 @@ public: return; } if ( embedMethod() != "none" ) { - m_pluginSubWindow.reset(new vstSubWin( gui->mainWindow()->workspace() )); + m_pluginSubWindow.reset(new vstSubWin( getGUI()->mainWindow()->workspace() )); VstPlugin::createUI( m_pluginSubWindow.get() ); m_pluginSubWindow->setWidget(pluginWidget()); } else { @@ -141,18 +141,18 @@ private: }; -QPixmap * VestigeInstrumentView::s_artwork = NULL; -QPixmap * manageVestigeInstrumentView::s_artwork = NULL; +QPixmap * VestigeInstrumentView::s_artwork = nullptr; +QPixmap * manageVestigeInstrumentView::s_artwork = nullptr; vestigeInstrument::vestigeInstrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &vestige_plugin_descriptor ), - m_plugin( NULL ), + m_plugin( nullptr ), m_pluginMutex(), - m_subWindow( NULL ), - m_scrollArea( NULL ), - knobFModel( NULL ), - p_subWindow( NULL ) + m_subWindow( nullptr ), + m_scrollArea( nullptr ), + knobFModel( nullptr ), + p_subWindow( nullptr ) { // now we need a play-handle which cares for calling play() InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track ); @@ -168,14 +168,14 @@ vestigeInstrument::vestigeInstrument( InstrumentTrack * _instrument_track ) : vestigeInstrument::~vestigeInstrument() { - if (p_subWindow != NULL) { + if (p_subWindow != nullptr) { delete p_subWindow; - p_subWindow = NULL; + p_subWindow = nullptr; } - if (knobFModel != NULL) { + if (knobFModel != nullptr) { delete []knobFModel; - knobFModel = NULL; + knobFModel = nullptr; } Engine::audioEngine()->removePlayHandlesOfTypes( instrumentTrack(), @@ -197,11 +197,11 @@ void vestigeInstrument::loadSettings( const QDomElement & _this ) loadFile( plugin ); m_pluginMutex.lock(); - if( m_plugin != NULL ) + if( m_plugin != nullptr ) { m_plugin->loadSettings( _this ); - if (instrumentTrack() != NULL && instrumentTrack()->isPreviewMode()) + if (instrumentTrack() != nullptr && instrumentTrack()->isPreviewMode()) { m_plugin->hideUI(); } @@ -246,7 +246,7 @@ void vestigeInstrument::setParameter( Model * action ) { int knobUNID = action->displayName().toInt(); - if ( m_plugin != NULL ) { + if ( m_plugin != nullptr ) { m_plugin->setParam( knobUNID, knobFModel[knobUNID]->value() ); } } @@ -274,10 +274,10 @@ void vestigeInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this ) { _this.setAttribute( "plugin", PathUtil::toShortestRelative(m_pluginDLL) ); m_pluginMutex.lock(); - if( m_plugin != NULL ) + if( m_plugin != nullptr ) { m_plugin->saveSettings( _doc, _this ); - if (knobFModel != NULL) { + if (knobFModel != nullptr) { const QMap & dump = m_plugin->parameterDump(); paramCount = dump.size(); char paramStr[35]; @@ -330,7 +330,7 @@ QString vestigeInstrument::nodeName( void ) const void vestigeInstrument::loadFile( const QString & _file ) { m_pluginMutex.lock(); - const bool set_ch_name = ( m_plugin != NULL && + const bool set_ch_name = ( m_plugin != nullptr && instrumentTrack()->name() == m_plugin->name() ) || instrumentTrack()->name() == InstrumentTrack::tr( "Default preset" ) || instrumentTrack()->name() == displayName(); @@ -338,17 +338,17 @@ void vestigeInstrument::loadFile( const QString & _file ) m_pluginMutex.unlock(); // if the same is loaded don't load again (for preview) - if (instrumentTrack() != NULL && instrumentTrack()->isPreviewMode() && + if (instrumentTrack() != nullptr && instrumentTrack()->isPreviewMode() && m_pluginDLL == PathUtil::toShortestRelative( _file )) return; - if ( m_plugin != NULL ) + if ( m_plugin != nullptr ) { closePlugin(); } m_pluginDLL = PathUtil::toShortestRelative( _file ); - TextFloat * tf = NULL; - if( gui ) + TextFloat * tf = nullptr; + if( getGUI() != nullptr ) { tf = TextFloat::displayMessage( tr( "Loading plugin" ), @@ -368,7 +368,7 @@ void vestigeInstrument::loadFile( const QString & _file ) return; } - if ( !(instrumentTrack() != NULL && instrumentTrack()->isPreviewMode())) + if ( !(instrumentTrack() != nullptr && instrumentTrack()->isPreviewMode())) { m_plugin->createUI(nullptr); m_plugin->showUI(); @@ -395,15 +395,15 @@ void vestigeInstrument::play( sampleFrame * _buf ) const fpp_t frames = Engine::audioEngine()->framesPerPeriod(); - if( m_plugin == NULL ) + if( m_plugin == nullptr ) { m_pluginMutex.unlock(); return; } - m_plugin->process( NULL, _buf ); + m_plugin->process( nullptr, _buf ); - instrumentTrack()->processAudioBuffer( _buf, frames, NULL ); + instrumentTrack()->processAudioBuffer( _buf, frames, nullptr ); m_pluginMutex.unlock(); } @@ -414,7 +414,7 @@ void vestigeInstrument::play( sampleFrame * _buf ) bool vestigeInstrument::handleMidiEvent( const MidiEvent& event, const TimePos& time, f_cnt_t offset ) { m_pluginMutex.lock(); - if( m_plugin != NULL ) + if( m_plugin != nullptr ) { m_plugin->processMidiEvent( event, offset ); } @@ -429,7 +429,7 @@ bool vestigeInstrument::handleMidiEvent( const MidiEvent& event, const TimePos& void vestigeInstrument::closePlugin( void ) { // disconnect all signals - if( knobFModel != NULL ) + if( knobFModel != nullptr ) { for( int i = 0; i < paramCount; i++ ) { @@ -437,38 +437,38 @@ void vestigeInstrument::closePlugin( void ) } } - if( knobFModel != NULL ) + if( knobFModel != nullptr ) { delete [] knobFModel; - knobFModel = NULL; + knobFModel = nullptr; } - if( m_scrollArea != NULL ) + if( m_scrollArea != nullptr ) { // delete m_scrollArea; - m_scrollArea = NULL; + m_scrollArea = nullptr; } - if( m_subWindow != NULL ) + if( m_subWindow != nullptr ) { m_subWindow->setAttribute( Qt::WA_DeleteOnClose ); m_subWindow->close(); - if( m_subWindow != NULL ) + if( m_subWindow != nullptr ) { delete m_subWindow; } - m_subWindow = NULL; + m_subWindow = nullptr; } - if( p_subWindow != NULL ) + if( p_subWindow != nullptr ) { - p_subWindow = NULL; + p_subWindow = nullptr; } m_pluginMutex.lock(); delete m_plugin; - m_plugin = NULL; + m_plugin = nullptr; m_pluginMutex.unlock(); } @@ -488,7 +488,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, InstrumentViewFixedSize( _instrument, _parent ), lastPosInMenu (0) { - if( s_artwork == NULL ) + if( s_artwork == nullptr ) { s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) ); @@ -611,9 +611,9 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, void VestigeInstrumentView::managePlugin( void ) { - if ( m_vi->m_plugin != NULL && m_vi->m_subWindow == NULL ) { + if ( m_vi->m_plugin != nullptr && m_vi->m_subWindow == nullptr ) { m_vi->p_subWindow = new manageVestigeInstrumentView( _instrument2, _parent2, m_vi); - } else if (m_vi->m_subWindow != NULL) { + } else if (m_vi->m_subWindow != nullptr) { if (m_vi->m_subWindow->widget()->isVisible() == false ) { m_vi->m_scrollArea->show(); m_vi->m_subWindow->show(); @@ -629,7 +629,7 @@ void VestigeInstrumentView::updateMenu( void ) { // get all presets - - if ( m_vi->m_plugin != NULL ) + if ( m_vi->m_plugin != nullptr ) { m_vi->m_plugin->loadProgramNames(); QWidget::update(); @@ -676,7 +676,7 @@ void VestigeInstrumentView::modelChanged() void VestigeInstrumentView::openPlugin() { - FileDialog ofd( NULL, tr( "Open VST plugin" ) ); + FileDialog ofd( nullptr, tr( "Open VST plugin" ) ); // set filters QStringList types; @@ -704,9 +704,9 @@ void VestigeInstrumentView::openPlugin() } Engine::audioEngine()->requestChangeInModel(); - if (m_vi->p_subWindow != NULL) { + if (m_vi->p_subWindow != nullptr) { delete m_vi->p_subWindow; - m_vi->p_subWindow = NULL; + m_vi->p_subWindow = nullptr; } m_vi->loadFile( ofd.selectedFiles()[0] ); @@ -725,7 +725,7 @@ void VestigeInstrumentView::openPlugin() void VestigeInstrumentView::openPreset() { - if ( m_vi->m_plugin != NULL ) { + if ( m_vi->m_plugin != nullptr ) { m_vi->m_plugin->openPreset( ); bool converted; QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0); @@ -742,7 +742,7 @@ void VestigeInstrumentView::openPreset() void VestigeInstrumentView::savePreset() { - if ( m_vi->m_plugin != NULL ) + if ( m_vi->m_plugin != nullptr ) { m_vi->m_plugin->savePreset( ); /* bool converted; @@ -760,7 +760,7 @@ void VestigeInstrumentView::savePreset() void VestigeInstrumentView::nextProgram() { - if ( m_vi->m_plugin != NULL ) { + if ( m_vi->m_plugin != nullptr ) { m_vi->m_plugin->rotateProgram( 1 ); bool converted; QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0); @@ -776,7 +776,7 @@ void VestigeInstrumentView::nextProgram() void VestigeInstrumentView::previousProgram() { - if ( m_vi->m_plugin != NULL ) { + if ( m_vi->m_plugin != nullptr ) { m_vi->m_plugin->rotateProgram( -1 ); bool converted; QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0); @@ -794,7 +794,7 @@ void VestigeInstrumentView::selPreset( void ) QAction *action = qobject_cast(sender()); if (action) - if ( m_vi->m_plugin != NULL ) { + if ( m_vi->m_plugin != nullptr ) { lastPosInMenu = action->data().toInt(); m_vi->m_plugin->setProgram( action->data().toInt() ); QWidget::update(); @@ -806,7 +806,7 @@ void VestigeInstrumentView::selPreset( void ) void VestigeInstrumentView::toggleGUI( void ) { - if( m_vi == NULL || m_vi->m_plugin == NULL ) + if( m_vi == nullptr || m_vi->m_plugin == nullptr ) { return; } @@ -819,7 +819,7 @@ void VestigeInstrumentView::toggleGUI( void ) void VestigeInstrumentView::noteOffAll( void ) { m_vi->m_pluginMutex.lock(); - if( m_vi->m_plugin != NULL ) + if( m_vi->m_plugin != nullptr ) { for( int key = 0; key <= MidiMaxKey; ++key ) { @@ -881,7 +881,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) p.drawPixmap( 0, 0, *s_artwork ); - QString plugin_name = ( m_vi->m_plugin != NULL ) ? + QString plugin_name = ( m_vi->m_plugin != nullptr ) ? m_vi->m_plugin->name()/* + QString::number( m_plugin->version() )*/ : @@ -896,7 +896,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) p.drawText( 10, 211, tr( "Preset" ) ); // m_pluginMutex.lock(); - if( m_vi->m_plugin != NULL ) + if( m_vi->m_plugin != nullptr ) { p.setPen( QColor( 0, 0, 0 ) ); f.setBold( false ); @@ -907,7 +907,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) p.drawText( 10, 225, m_vi->m_plugin->currentProgramName() ); } - if( m_vi->m_subWindow != NULL ) + if( m_vi->m_subWindow != nullptr ) { m_vi->m_subWindow->setWindowTitle( m_vi->instrumentTrack()->name() + tr( " - VST plugin control" ) ); @@ -927,7 +927,7 @@ manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrume widget = new QWidget(this); l = new QGridLayout( this ); - m_vi->m_subWindow = gui->mainWindow()->addWindowedWidget(NULL, Qt::SubWindow | + m_vi->m_subWindow = getGUI()->mainWindow()->addWindowedWidget(nullptr, Qt::SubWindow | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); m_vi->m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ); m_vi->m_subWindow->setFixedWidth( 960 ); @@ -974,7 +974,7 @@ manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrume vstKnobs = new CustomTextKnob *[ m_vi->paramCount ]; bool hasKnobModel = true; - if (m_vi->knobFModel == NULL) { + if (m_vi->knobFModel == nullptr) { m_vi->knobFModel = new FloatModel *[ m_vi->paramCount ]; hasKnobModel = false; } @@ -1094,7 +1094,7 @@ void manageVestigeInstrumentView::displayAutomatedOnly( void ) manageVestigeInstrumentView::~manageVestigeInstrumentView() { - if( m_vi->knobFModel != NULL ) + if( m_vi->knobFModel != nullptr ) { for( int i = 0; i < m_vi->paramCount; i++ ) { @@ -1103,32 +1103,32 @@ manageVestigeInstrumentView::~manageVestigeInstrumentView() } } - if (vstKnobs != NULL) { + if (vstKnobs != nullptr) { delete []vstKnobs; - vstKnobs = NULL; + vstKnobs = nullptr; } - if( m_vi->knobFModel != NULL ) + if( m_vi->knobFModel != nullptr ) { delete [] m_vi->knobFModel; - m_vi->knobFModel = NULL; + m_vi->knobFModel = nullptr; } - if (m_vi->m_scrollArea != NULL) { + if (m_vi->m_scrollArea != nullptr) { delete m_vi->m_scrollArea; - m_vi->m_scrollArea = NULL; + m_vi->m_scrollArea = nullptr; } - if ( m_vi->m_subWindow != NULL ) { + if ( m_vi->m_subWindow != nullptr ) { m_vi->m_subWindow->setAttribute(Qt::WA_DeleteOnClose); m_vi->m_subWindow->close(); - if ( m_vi->m_subWindow != NULL ) + if ( m_vi->m_subWindow != nullptr ) delete m_vi->m_subWindow; - m_vi->m_subWindow = NULL; + m_vi->m_subWindow = nullptr; } - m_vi->p_subWindow = NULL; + m_vi->p_subWindow = nullptr; } @@ -1138,7 +1138,7 @@ void manageVestigeInstrumentView::setParameter( Model * action ) { int knobUNID = action->displayName().toInt(); - if ( m_vi->m_plugin != NULL ) { + if ( m_vi->m_plugin != nullptr ) { m_vi->m_plugin->setParam( knobUNID, m_vi->knobFModel[knobUNID]->value() ); syncParameterText(); } diff --git a/plugins/vibed/nine_button_selector.cpp b/plugins/vibed/nine_button_selector.cpp index edcfc2f51..222f232ee 100644 --- a/plugins/vibed/nine_button_selector.cpp +++ b/plugins/vibed/nine_button_selector.cpp @@ -52,13 +52,13 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, int _x, int _y, QWidget * _parent ): QWidget( _parent ), - IntModelView( new nineButtonSelectorModel(0, 8, _default, NULL, + IntModelView( new nineButtonSelectorModel(0, 8, _default, nullptr, QString(), true ), this ) { setFixedSize( 50, 50 ); move( _x, _y ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 1, 1 ); m_button->setActiveGraphic( _button0_on ); m_button->setInactiveGraphic( _button0_off ); @@ -67,7 +67,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button0Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 18, 1 ); m_button->setActiveGraphic( _button1_on ); m_button->setInactiveGraphic( _button1_off ); @@ -76,7 +76,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button1Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 35, 1 ); m_button->setActiveGraphic( _button2_on ); m_button->setInactiveGraphic( _button2_off ); @@ -85,7 +85,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button2Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 1, 18 ); m_button->setActiveGraphic( _button3_on ); m_button->setInactiveGraphic( _button3_off ); @@ -94,7 +94,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button3Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 18, 18 ); m_button->setActiveGraphic( _button4_on ); m_button->setInactiveGraphic( _button4_off ); @@ -103,7 +103,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button4Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 35, 18 ); m_button->setActiveGraphic( _button5_on ); m_button->setInactiveGraphic( _button5_off ); @@ -112,7 +112,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button5Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 1, 35 ); m_button->setActiveGraphic( _button6_on ); m_button->setInactiveGraphic( _button6_off ); @@ -121,7 +121,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button6Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 18, 35 ); m_button->setActiveGraphic( _button7_on ); m_button->setInactiveGraphic( _button7_off ); @@ -130,7 +130,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on, this, SLOT ( button7Clicked() ) ); m_buttons.append( m_button ); - m_button = new PixmapButton( this, NULL ); + m_button = new PixmapButton( this, nullptr ); m_button->move( 35, 35 ); m_button->setActiveGraphic( _button8_on ); m_button->setInactiveGraphic( _button8_off ); diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index bc9430ed4..8e582158f 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -54,8 +54,8 @@ Plugin::Descriptor PLUGIN_EXPORT vibedstrings_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, }; } @@ -273,7 +273,7 @@ QString vibed::nodeName() const void vibed::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { - if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { _n->m_pluginData = new stringContainer( _n->frequency(), Engine::audioEngine()->processingSampleRate(), diff --git a/plugins/vibed/vibrating_string.cpp b/plugins/vibed/vibrating_string.cpp index 117d878e7..aee2d2527 100644 --- a/plugins/vibed/vibrating_string.cpp +++ b/plugins/vibed/vibrating_string.cpp @@ -110,7 +110,7 @@ vibratingString::delayLine * vibratingString::initDelayLine( int _len, } else { - dl->data = NULL; + dl->data = nullptr; } dl->pointer = dl->data; diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 942c9e960..c949147eb 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -120,9 +120,9 @@ static bool HEADLESS = false; class RemoteVstPlugin; -RemoteVstPlugin * __plugin = NULL; +RemoteVstPlugin * __plugin = nullptr; -HWND __MessageHwnd = NULL; +HWND __MessageHwnd = nullptr; DWORD __processingThreadId = 0; @@ -135,7 +135,7 @@ std::string GetErrorAsString(DWORD errorMessageID) LPSTR messageBuffer = nullptr; size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); + nullptr, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, nullptr); std::string message(messageBuffer, size); @@ -174,7 +174,7 @@ public: { SuspendPlugin suspend( this ); pluginDispatch( effSetSampleRate, 0, 0, - NULL, (float) sampleRate() ); + nullptr, (float) sampleRate() ); } // set given buffer-size for plugin @@ -377,7 +377,7 @@ private: bool load( const std::string & _plugin_file ); int pluginDispatch( int cmd, int param1 = 0, int param2 = 0, - void * p = NULL, float f = 0 ) + void * p = nullptr, float f = 0 ) { if( m_plugin ) { @@ -444,9 +444,9 @@ RemoteVstPlugin::RemoteVstPlugin( key_t _shm_in, key_t _shm_out ) : RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) : RemotePluginClient( socketPath ), #endif - m_libInst( NULL ), - m_plugin( NULL ), - m_window( NULL ), + m_libInst( nullptr ), + m_plugin( nullptr ), + m_window( nullptr ), m_windowID( 0 ), m_windowWidth( 0 ), m_windowHeight( 0 ), @@ -455,16 +455,16 @@ RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) : m_processing( false ), m_messageList(), m_shouldGiveIdle( false ), - m_inputs( NULL ), - m_outputs( NULL ), + m_inputs( nullptr ), + m_outputs( nullptr ), m_shmValid( false ), m_midiEvents(), m_bpm( 0 ), m_currentSamplePos( 0 ), m_currentProgram( -1 ), - m_in( NULL ), + m_in( nullptr ), m_shmID( -1 ), - m_vstSyncData( NULL ) + m_vstSyncData( nullptr ) { __plugin = this; @@ -492,7 +492,7 @@ RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) : #else m_vstSyncData = RemotePluginClient::getQtVSTshm(); #endif - if( m_vstSyncData == NULL ) + if( m_vstSyncData == nullptr ) { fprintf(stderr, "RemoteVstPlugin.cpp: " "Failed to initialize shared memory for VST synchronization.\n" @@ -541,18 +541,18 @@ RemoteVstPlugin::~RemoteVstPlugin() { perror( "~RemoteVstPlugin::shmdt" ); } - if( m_vstSyncData != NULL ) + if( m_vstSyncData != nullptr ) { delete m_vstSyncData; - m_vstSyncData = NULL; + m_vstSyncData = nullptr; } } #endif - if( m_libInst != NULL ) + if( m_libInst != nullptr ) { FreeLibrary( m_libInst ); - m_libInst = NULL; + m_libInst = nullptr; } delete[] m_inputs; @@ -766,8 +766,8 @@ void RemoteVstPlugin::initEditor() } - HMODULE hInst = GetModuleHandle( NULL ); - if( hInst == NULL ) + HMODULE hInst = GetModuleHandle( nullptr ); + if( hInst == nullptr ) { debugMessage( "initEditor(): can't get module handle\n" ); return; @@ -783,8 +783,8 @@ void RemoteVstPlugin::initEditor() m_window = CreateWindowEx( WS_EX_APPWINDOW, "LVSL", pluginName(), dwStyle, - 0, 0, 10, 10, NULL, NULL, hInst, NULL ); - if( m_window == NULL ) + 0, 0, 10, 10, nullptr, nullptr, hInst, nullptr ); + if( m_window == nullptr ) { debugMessage( "initEditor(): cannot create editor window\n" ); return; @@ -839,7 +839,7 @@ void RemoteVstPlugin::hideEditor() { void RemoteVstPlugin::destroyEditor() { - if( m_window == NULL ) + if( m_window == nullptr ) { return; } @@ -847,7 +847,7 @@ void RemoteVstPlugin::destroyEditor() pluginDispatch( effEditClose ); // Destroying the window takes some time in Wine 1.8.5 DestroyWindow( m_window ); - m_window = NULL; + m_window = nullptr; } @@ -855,7 +855,7 @@ void RemoteVstPlugin::destroyEditor() bool RemoteVstPlugin::load( const std::string & _plugin_file ) { - if( ( m_libInst = LoadLibraryW( toWString(_plugin_file).c_str() ) ) == NULL ) + if( ( m_libInst = LoadLibraryW( toWString(_plugin_file).c_str() ) ) == nullptr ) { DWORD error = GetLastError(); debugMessage( "LoadLibrary failed: " + GetErrorAsString(error) ); @@ -866,24 +866,24 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file ) ( audioMasterCallback ); mainEntryPointer mainEntry = (mainEntryPointer) GetProcAddress( m_libInst, "VSTPluginMain" ); - if( mainEntry == NULL ) + if( mainEntry == nullptr ) { mainEntry = (mainEntryPointer) GetProcAddress( m_libInst, "VstPluginMain" ); } - if( mainEntry == NULL ) + if( mainEntry == nullptr ) { mainEntry = (mainEntryPointer) GetProcAddress( m_libInst, "main" ); } - if( mainEntry == NULL ) + if( mainEntry == nullptr ) { debugMessage( "could not find entry point\n" ); return false; } m_plugin = mainEntry( hostCallback ); - if( m_plugin == NULL ) + if( m_plugin == nullptr ) { debugMessage( "mainEntry procedure returned NULL\n" ); return false; @@ -1181,7 +1181,7 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file ) { if( m_plugin->flags & 32 ) { - void * chunk = NULL; + void * chunk = nullptr; const int len = pluginDispatch( 23, 0, 0, &chunk ); if( len > 0 ) { @@ -1312,7 +1312,7 @@ void RemoteVstPlugin::savePreset( const std::string & _file ) unsigned int chunk_size = 0; sBank * pBank = ( sBank* ) new char[ sizeof( sBank ) ]; char progName[ 128 ] = { 0 }; - char* data = NULL; + char* data = nullptr; const bool chunky = ( m_plugin->flags & ( 1 << 5 ) ) != 0; bool isPreset = _file.substr( _file.find_last_of( "." ) + 1 ) == "fxp"; int presNameLen = _file.find_last_of( "/" ) + _file.find_last_of( "\\" ) + 2; @@ -1410,7 +1410,7 @@ void RemoteVstPlugin::savePreset( const std::string & _file ) void RemoteVstPlugin::loadPresetFile( const std::string & _file ) { - void * chunk = NULL; + void * chunk = nullptr; unsigned int * pLen = new unsigned int[ 1 ]; unsigned int len = 0; sBank * pBank = (sBank*) new char[ sizeof( sBank ) ]; @@ -1566,8 +1566,8 @@ int RemoteVstPlugin::updateInOutCount() delete[] m_inputs; delete[] m_outputs; - m_inputs = NULL; - m_outputs = NULL; + m_inputs = nullptr; + m_outputs = nullptr; setInputOutputCount( inputCount(), outputCount() ); @@ -1617,7 +1617,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode, #endif // workaround for early callbacks by some plugins - if( __plugin && __plugin->m_plugin == NULL ) + if( __plugin && __plugin->m_plugin == nullptr ) { __plugin->m_plugin = _effect; } @@ -2074,8 +2074,8 @@ DWORD WINAPI RemoteVstPlugin::processingThread( LPVOID _param ) bool RemoteVstPlugin::setupMessageWindow() { - HMODULE hInst = GetModuleHandle( NULL ); - if( hInst == NULL ) + HMODULE hInst = GetModuleHandle( nullptr ); + if( hInst == nullptr ) { __plugin->debugMessage( "setupMessageWindow(): can't get " "module handle\n" ); @@ -2083,10 +2083,10 @@ bool RemoteVstPlugin::setupMessageWindow() } __MessageHwnd = CreateWindowEx( 0, "LVSL", "dummy", - 0, 0, 0, 0, 0, NULL, NULL, - hInst, NULL ); + 0, 0, 0, 0, 0, nullptr, nullptr, + hInst, nullptr ); // install GUI update timer - SetTimer( __MessageHwnd, 1000, 50, NULL ); + SetTimer( __MessageHwnd, 1000, 50, nullptr ); return true; } @@ -2097,7 +2097,7 @@ bool RemoteVstPlugin::setupMessageWindow() DWORD WINAPI RemoteVstPlugin::guiEventLoop() { MSG msg; - while( GetMessage( &msg, NULL, 0, 0 ) > 0 ) + while( GetMessage( &msg, nullptr, 0, 0 ) > 0 ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -2188,8 +2188,8 @@ int main( int _argc, char * * _argv ) } #endif - HMODULE hInst = GetModuleHandle( NULL ); - if( hInst == NULL ) + HMODULE hInst = GetModuleHandle( nullptr ); + if( hInst == nullptr ) { return -1; } @@ -2200,10 +2200,10 @@ int main( int _argc, char * * _argv ) wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInst; - wc.hIcon = LoadIcon( NULL, IDI_APPLICATION ); - wc.hCursor = LoadCursor( NULL, IDC_ARROW ); - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; + wc.hIcon = LoadIcon( nullptr, IDI_APPLICATION ); + wc.hCursor = LoadCursor( nullptr, IDC_ARROW ); + wc.hbrBackground = nullptr; + wc.lpszMenuName = nullptr; wc.lpszClassName = "LVSL"; if( !RegisterClass( &wc ) ) @@ -2265,8 +2265,8 @@ int main( int _argc, char * * _argv ) { return -1; } - if( CreateThread( NULL, 0, RemoteVstPlugin::processingThread, - __plugin, 0, NULL ) == NULL ) + if( CreateThread( nullptr, 0, RemoteVstPlugin::processingThread, + __plugin, 0, nullptr ) == nullptr ) { __plugin->debugMessage( "could not create " "processingThread\n" ); diff --git a/plugins/vst_base/VstPlugin.cpp b/plugins/vst_base/VstPlugin.cpp index 53d8cd315..2b14fc936 100644 --- a/plugins/vst_base/VstPlugin.cpp +++ b/plugins/vst_base/VstPlugin.cpp @@ -120,7 +120,7 @@ private: VstPlugin::VstPlugin( const QString & _plugin ) : m_plugin( PathUtil::toAbsolute(_plugin) ), m_pluginWindowID( 0 ), - m_embedMethod( gui + m_embedMethod( (getGUI() != nullptr) ? ConfigManager::inst()->vstEmbedMethod() : "headless" ), m_version( 0 ), @@ -243,7 +243,7 @@ void VstPlugin::saveSettings( QDomDocument & _doc, QDomElement & _this ) { if ( m_embedMethod != "none" ) { - if( pluginWidget() != NULL ) + if( pluginWidget() != nullptr ) { _this.setAttribute( "guivisible", pluginWidget()->isVisible() ); } @@ -386,13 +386,13 @@ bool VstPlugin::processMessage( const message & _m ) // so this is legal despite MSDN's warning SetWindowLongPtr( (HWND)(intptr_t) m_pluginWindowID, GWLP_HWNDPARENT, - (LONG_PTR) gui->mainWindow()->winId() ); + (LONG_PTR) getGUI()->mainWindow()->winId() ); #endif #ifdef LMMS_BUILD_LINUX XSetTransientForHint( QX11Info::display(), m_pluginWindowID, - gui->mainWindow()->winId() ); + getGUI()->mainWindow()->winId() ); #endif } break; @@ -478,7 +478,7 @@ QWidget *VstPlugin::editor() void VstPlugin::openPreset( ) { - FileDialog ofd( NULL, tr( "Open Preset" ), "", + FileDialog ofd( nullptr, tr( "Open Preset" ), "", tr( "Vst Plugin Preset (*.fxp *.fxb)" ) ); ofd.setFileMode( FileDialog::ExistingFiles ); if( ofd.exec () == QDialog::Accepted && @@ -558,7 +558,7 @@ void VstPlugin::savePreset( ) QString presName = currentProgramName().isEmpty() ? tr(": default") : currentProgramName(); presName.replace("\"", "'"); // QFileDialog unable to handle double quotes properly - FileDialog sfd( NULL, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"), + FileDialog sfd( nullptr, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"), tr( "Vst Plugin Preset (*.fxp *.fxb)" ) ); if( p_name != "" ) // remember last directory @@ -744,7 +744,7 @@ void VstPlugin::createUI( QWidget * parent ) SetWindowLong(pluginHandle, GWL_STYLE, style); SetParent(pluginHandle, targetHandle); - DWORD threadId = GetWindowThreadProcessId(pluginHandle, NULL); + DWORD threadId = GetWindowThreadProcessId(pluginHandle, nullptr); DWORD currentThreadId = GetCurrentThreadId(); AttachThreadInput(currentThreadId, threadId, true); diff --git a/plugins/vst_base/vst_base.cpp b/plugins/vst_base/vst_base.cpp index 7e4568382..2d7333dd3 100644 --- a/plugins/vst_base/vst_base.cpp +++ b/plugins/vst_base/vst_base.cpp @@ -39,8 +39,8 @@ Plugin::Descriptor VSTBASE_EXPORT vstbase_plugin_descriptor = "Tobias Doerffel ", 0x0100, Plugin::Library, - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/watsyn/Watsyn.cpp b/plugins/watsyn/Watsyn.cpp index b8788f8d9..d8b6f80f4 100644 --- a/plugins/watsyn/Watsyn.cpp +++ b/plugins/watsyn/Watsyn.cpp @@ -50,8 +50,8 @@ Plugin::Descriptor PLUGIN_EXPORT watsyn_plugin_descriptor = 0x0100, Plugin::Instrument, new PluginPixmapLoader( "logo" ), - NULL, - NULL, + nullptr, + nullptr, } ; } @@ -102,9 +102,9 @@ WatsynObject::~WatsynObject() void WatsynObject::renderOutput( fpp_t _frames ) { - if( m_abuf == NULL ) + if( m_abuf == nullptr ) m_abuf = new sampleFrame[m_fpp]; - if( m_bbuf == NULL ) + if( m_bbuf == nullptr ) m_bbuf = new sampleFrame[m_fpp]; for( fpp_t frame = 0; frame < _frames; frame++ ) @@ -330,7 +330,7 @@ WatsynInstrument::~WatsynInstrument() void WatsynInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { - if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == nullptr ) { WatsynObject * w = new WatsynObject( &A1_wave[0], @@ -722,25 +722,25 @@ WatsynView::WatsynView( Instrument * _instrument, // button groups next. // graph select buttons - PixmapButton * a1_selectButton = new PixmapButton( this, NULL ); + PixmapButton * a1_selectButton = new PixmapButton( this, nullptr ); a1_selectButton -> move( 4, 121 ); a1_selectButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "a1_active" ) ); a1_selectButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "a1_inactive" ) ); ToolTip::add( a1_selectButton, tr( "Select oscillator A1") ); - PixmapButton * a2_selectButton = new PixmapButton( this, NULL ); + PixmapButton * a2_selectButton = new PixmapButton( this, nullptr ); a2_selectButton -> move( 44, 121 ); a2_selectButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "a2_active" ) ); a2_selectButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "a2_inactive" ) ); ToolTip::add( a2_selectButton, tr( "Select oscillator A2") ); - PixmapButton * b1_selectButton = new PixmapButton( this, NULL ); + PixmapButton * b1_selectButton = new PixmapButton( this, nullptr ); b1_selectButton -> move( 84, 121 ); b1_selectButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "b1_active" ) ); b1_selectButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "b1_inactive" ) ); ToolTip::add( b1_selectButton, tr( "Select oscillator B1") ); - PixmapButton * b2_selectButton = new PixmapButton( this, NULL ); + PixmapButton * b2_selectButton = new PixmapButton( this, nullptr ); b2_selectButton -> move( 124, 121 ); b2_selectButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "b2_active" ) ); b2_selectButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "b2_inactive" ) ); @@ -755,25 +755,25 @@ WatsynView::WatsynView( Instrument * _instrument, m_selectedGraphGroup -> setModel( &w -> m_selectedGraph); // A-modulation button group - PixmapButton * amod_mixButton = new PixmapButton( this, NULL ); + PixmapButton * amod_mixButton = new PixmapButton( this, nullptr ); amod_mixButton -> move( 4, 50 ); amod_mixButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "amix_active" ) ); amod_mixButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "amix_inactive" ) ); ToolTip::add( amod_mixButton, tr( "Mix output of A2 to A1" ) ); - PixmapButton * amod_amButton = new PixmapButton( this, NULL ); + PixmapButton * amod_amButton = new PixmapButton( this, nullptr ); amod_amButton -> move( 4, 66 ); amod_amButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "aam_active" ) ); amod_amButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "aam_inactive" ) ); ToolTip::add( amod_amButton, tr( "Modulate amplitude of A1 by output of A2" ) ); - PixmapButton * amod_rmButton = new PixmapButton( this, NULL ); + PixmapButton * amod_rmButton = new PixmapButton( this, nullptr ); amod_rmButton -> move( 4, 82 ); amod_rmButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "arm_active" ) ); amod_rmButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "arm_inactive" ) ); ToolTip::add( amod_rmButton, tr( "Ring modulate A1 and A2" ) ); - PixmapButton * amod_pmButton = new PixmapButton( this, NULL ); + PixmapButton * amod_pmButton = new PixmapButton( this, nullptr ); amod_pmButton -> move( 4, 98 ); amod_pmButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "apm_active" ) ); amod_pmButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "apm_inactive" ) ); @@ -786,25 +786,25 @@ WatsynView::WatsynView( Instrument * _instrument, m_aModGroup -> addButton( amod_pmButton ); // B-modulation button group - PixmapButton * bmod_mixButton = new PixmapButton( this, NULL ); + PixmapButton * bmod_mixButton = new PixmapButton( this, nullptr ); bmod_mixButton -> move( 44, 50 ); bmod_mixButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "bmix_active" ) ); bmod_mixButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "bmix_inactive" ) ); ToolTip::add( bmod_mixButton, tr( "Mix output of B2 to B1" ) ); - PixmapButton * bmod_amButton = new PixmapButton( this, NULL ); + PixmapButton * bmod_amButton = new PixmapButton( this, nullptr ); bmod_amButton -> move( 44, 66 ); bmod_amButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "bam_active" ) ); bmod_amButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "bam_inactive" ) ); ToolTip::add( bmod_amButton, tr( "Modulate amplitude of B1 by output of B2" ) ); - PixmapButton * bmod_rmButton = new PixmapButton( this, NULL ); + PixmapButton * bmod_rmButton = new PixmapButton( this, nullptr ); bmod_rmButton -> move( 44, 82 ); bmod_rmButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "brm_active" ) ); bmod_rmButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "brm_inactive" ) ); ToolTip::add( bmod_rmButton, tr( "Ring modulate B1 and B2" ) ); - PixmapButton * bmod_pmButton = new PixmapButton( this, NULL ); + PixmapButton * bmod_pmButton = new PixmapButton( this, nullptr ); bmod_pmButton -> move( 44, 98 ); bmod_pmButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "bpm_active" ) ); bmod_pmButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "bpm_inactive" ) ); diff --git a/plugins/waveshaper/waveshaper.cpp b/plugins/waveshaper/waveshaper.cpp index 9f869e460..4fe082600 100644 --- a/plugins/waveshaper/waveshaper.cpp +++ b/plugins/waveshaper/waveshaper.cpp @@ -44,8 +44,8 @@ Plugin::Descriptor PLUGIN_EXPORT waveshaper_plugin_descriptor = 0x0100, Plugin::Effect, new PluginPixmapLoader("logo"), - NULL, - NULL, + nullptr, + nullptr, } ; } diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp index 0422751e9..b6a036ed2 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp @@ -36,14 +36,14 @@ #include "zynaddsubfx/src/Misc/Dump.h" -SYNTH_T* synth = NULL; +SYNTH_T* synth = nullptr; int LocalZynAddSubFx::s_instanceCount = 0; LocalZynAddSubFx::LocalZynAddSubFx() : - m_master( NULL ), - m_ioEngine( NULL ) + m_master( nullptr ), + m_ioEngine( nullptr ) { for( int i = 0; i < NumKeys; ++i ) { @@ -66,7 +66,7 @@ LocalZynAddSubFx::LocalZynAddSubFx() : synth->oscilsize = config.cfg.OscilSize; synth->alias(); - srand( time( NULL ) ); + srand( time( nullptr ) ); denormalkillbuf = new float[synth->buffersize]; for( int i = 0; i < synth->buffersize; ++i ) @@ -195,7 +195,7 @@ void LocalZynAddSubFx::setPresetDir( const std::string & _dir ) void LocalZynAddSubFx::setLmmsWorkingDir( const std::string & _dir ) { - if( config.workingDir != NULL ) + if( config.workingDir != nullptr ) { free( config.workingDir ); } diff --git a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp index 5b491d8c9..a31544217 100644 --- a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp @@ -62,8 +62,8 @@ public: sendMessage( IdInitDone ); waitForMessage( IdInitDone ); - pthread_mutex_init( &m_guiMutex, NULL ); - pthread_create( &m_messageThreadHandle, NULL, messageLoop, this ); + pthread_mutex_init( &m_guiMutex, nullptr ); + pthread_create( &m_messageThreadHandle, nullptr, messageLoop, this ); } virtual ~RemoteZynAddSubFx() @@ -153,7 +153,7 @@ public: _this->messageLoop(); - return NULL; + return nullptr; } void guiLoop(); @@ -174,7 +174,7 @@ private: void RemoteZynAddSubFx::guiLoop() { int exitProgram = 0; - MasterUI * ui = NULL; + MasterUI * ui = nullptr; while( !m_guiExit ) { diff --git a/plugins/zynaddsubfx/ZynAddSubFx.cpp b/plugins/zynaddsubfx/ZynAddSubFx.cpp index 02dbb7519..eaa4c6182 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/ZynAddSubFx.cpp @@ -66,7 +66,7 @@ Plugin::Descriptor PLUGIN_EXPORT zynaddsubfx_plugin_descriptor = Plugin::Instrument, new PluginPixmapLoader( "logo" ), "xiz", - NULL, + nullptr, } ; } @@ -110,8 +110,8 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument( InstrumentTrack * _instrumentTrack ) : Instrument( _instrumentTrack, &zynaddsubfx_plugin_descriptor ), m_hasGUI( false ), - m_plugin( NULL ), - m_remotePlugin( NULL ), + m_plugin( nullptr ), + m_remotePlugin( nullptr ), m_portamentoModel( 0, 0, 127, 1, this, tr( "Portamento" ) ), m_filterFreqModel( 64, 0, 127, 1, this, tr( "Filter frequency" ) ), m_filterQModel( 64, 0, 127, 1, this, tr( "Filter resonance" ) ), @@ -161,8 +161,8 @@ ZynAddSubFxInstrument::~ZynAddSubFxInstrument() m_pluginMutex.lock(); delete m_plugin; delete m_remotePlugin; - m_plugin = NULL; - m_remotePlugin = NULL; + m_plugin = nullptr; + m_remotePlugin = nullptr; m_pluginMutex.unlock(); } @@ -338,14 +338,14 @@ void ZynAddSubFxInstrument::play( sampleFrame * _buf ) if (!m_pluginMutex.tryLock(Engine::getSong()->isExporting() ? -1 : 0)) {return;} if( m_remotePlugin ) { - m_remotePlugin->process( NULL, _buf ); + m_remotePlugin->process( nullptr, _buf ); } else { m_plugin->processAudio( _buf ); } m_pluginMutex.unlock(); - instrumentTrack()->processAudioBuffer( _buf, Engine::audioEngine()->framesPerPeriod(), NULL ); + instrumentTrack()->processAudioBuffer( _buf, Engine::audioEngine()->framesPerPeriod(), nullptr ); } @@ -436,8 +436,8 @@ void ZynAddSubFxInstrument::initPlugin() m_pluginMutex.lock(); delete m_plugin; delete m_remotePlugin; - m_plugin = NULL; - m_remotePlugin = NULL; + m_plugin = nullptr; + m_remotePlugin = nullptr; if( m_hasGUI ) { diff --git a/src/core/AudioEngine.cpp b/src/core/AudioEngine.cpp index 8a5778522..0fb93462e 100644 --- a/src/core/AudioEngine.cpp +++ b/src/core/AudioEngine.cpp @@ -82,8 +82,8 @@ AudioEngine::AudioEngine( bool renderOnly ) : m_qualitySettings( qualitySettings::Mode_Draft ), m_masterGain( 1.0f ), m_isProcessing( false ), - m_audioDev( NULL ), - m_oldAudioDev( NULL ), + m_audioDev( nullptr ), + m_oldAudioDev( nullptr ), m_audioDevStartFailed( false ), m_profiler(), m_metronomeActive(false), @@ -222,7 +222,7 @@ void AudioEngine::startProcessing(bool needsFifo) } else { - m_fifoWriter = NULL; + m_fifoWriter = nullptr; } m_audioDev->startProcessing(); @@ -237,13 +237,13 @@ void AudioEngine::stopProcessing() { m_isProcessing = false; - if( m_fifoWriter != NULL ) + if( m_fifoWriter != nullptr ) { m_fifoWriter->finish(); m_fifoWriter->wait(); m_audioDev->stopProcessing(); delete m_fifoWriter; - m_fifoWriter = NULL; + m_fifoWriter = nullptr; } else { @@ -270,7 +270,7 @@ sample_rate_t AudioEngine::baseSampleRate() const sample_rate_t AudioEngine::outputSampleRate() const { - return m_audioDev != NULL ? m_audioDev->sampleRate() : + return m_audioDev != nullptr ? m_audioDev->sampleRate() : baseSampleRate(); } @@ -279,7 +279,7 @@ sample_rate_t AudioEngine::outputSampleRate() const sample_rate_t AudioEngine::inputSampleRate() const { - return m_audioDev != NULL ? m_audioDev->sampleRate() : + return m_audioDev != nullptr ? m_audioDev->sampleRate() : baseSampleRate(); } @@ -651,7 +651,7 @@ void AudioEngine::restoreAudioDevice() startProcessing(); } - m_oldAudioDev = NULL; + m_oldAudioDev = nullptr; } @@ -701,7 +701,7 @@ void AudioEngine::removePlayHandle(PlayHandle * ph) // Check m_newPlayHandles first because doing it the other way around // creates a race condition for( LocklessListElement * e = m_newPlayHandles.first(), - * ePrev = NULL; e; ePrev = e, e = e->next ) + * ePrev = nullptr; e; ePrev = e, e = e->next ) { if (e->value == ph) { @@ -955,7 +955,7 @@ bool AudioEngine::isMidiDevNameValid(QString name) AudioDevice * AudioEngine::tryAudioDevices() { bool success_ful = false; - AudioDevice * dev = NULL; + AudioDevice * dev = nullptr; QString dev_name = ConfigManager::inst()->value( "mixer", "audiodev" ); if( !isAudioDevNameValid( dev_name ) ) { @@ -1267,7 +1267,7 @@ void AudioEngine::fifoWriter::run() } // Let audio backend stop processing - write( NULL ); + write( nullptr ); m_fifo->waitUntilRead(); } diff --git a/src/core/AudioEngineWorkerThread.cpp b/src/core/AudioEngineWorkerThread.cpp index 5790b547a..c119f04a4 100644 --- a/src/core/AudioEngineWorkerThread.cpp +++ b/src/core/AudioEngineWorkerThread.cpp @@ -37,7 +37,7 @@ #endif AudioEngineWorkerThread::JobQueue AudioEngineWorkerThread::globalJobQueue; -QWaitCondition * AudioEngineWorkerThread::queueReadyWaitCond = NULL; +QWaitCondition * AudioEngineWorkerThread::queueReadyWaitCond = nullptr; QList AudioEngineWorkerThread::workerThreads; // implementation of internal JobQueue @@ -115,7 +115,7 @@ AudioEngineWorkerThread::AudioEngineWorkerThread( AudioEngine* audioEngine ) : m_quit( false ) { // initialize global static data - if( queueReadyWaitCond == NULL ) + if( queueReadyWaitCond == nullptr ) { queueReadyWaitCond = new QWaitCondition; } diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index 84d033cb6..bd2d478db 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -50,7 +50,7 @@ AutomatableModel::AutomatableModel( m_valueChanged( false ), m_setValueDepth( 0 ), m_hasStrictStepSize( false ), - m_controllerConnection( NULL ), + m_controllerConnection( nullptr ), m_valueBuffer( static_cast( Engine::audioEngine()->framesPerPeriod() ) ), m_lastUpdatedPeriod( -1 ), m_hasSampleExactData(false), @@ -604,7 +604,7 @@ ValueBuffer * AutomatableModel::valueBuffer() { return m_hasSampleExactData ? &m_valueBuffer - : NULL; + : nullptr; } float val = m_value; // make sure our m_value doesn't change midway @@ -644,7 +644,7 @@ ValueBuffer * AutomatableModel::valueBuffer() if (!m_controllerConnection) { - AutomatableModel* lm = NULL; + AutomatableModel* lm = nullptr; if (hasLinkedModels()) { lm = m_linkedModels.first(); @@ -678,7 +678,7 @@ ValueBuffer * AutomatableModel::valueBuffer() // in which case the recipient knows to use the static value() instead m_lastUpdatedPeriod = s_periodCounter; m_hasSampleExactData = false; - return NULL; + return nullptr; } @@ -689,7 +689,7 @@ void AutomatableModel::unlinkControllerConnection() m_controllerConnection->disconnect( this ); } - m_controllerConnection = NULL; + m_controllerConnection = nullptr; } @@ -737,7 +737,7 @@ float AutomatableModel::globalAutomationValueAt( const TimePos& time ) if( s <= time && e >= time ) { patternsInRange += ( *it ); } } - AutomationPattern * latestPattern = NULL; + AutomationPattern * latestPattern = nullptr; if( ! patternsInRange.isEmpty() ) { diff --git a/src/core/AutomationPattern.cpp b/src/core/AutomationPattern.cpp index a2b831d07..4fd043763 100644 --- a/src/core/AutomationPattern.cpp +++ b/src/core/AutomationPattern.cpp @@ -598,7 +598,7 @@ float *AutomationPattern::valuesAfter( const TimePos & _time ) const timeMap::const_iterator v = m_timeMap.lowerBound(_time); if( v == m_timeMap.end() || (v+1) == m_timeMap.end() ) { - return NULL; + return nullptr; } int numValues = POS(v + 1) - POS(v); @@ -859,7 +859,7 @@ const QString AutomationPattern::name() const { return TrackContentObject::name(); } - if( !m_objects.isEmpty() && m_objects.first() != NULL ) + if( !m_objects.isEmpty() && m_objects.first() != nullptr ) { return m_objects.first()->fullDisplayName(); } diff --git a/src/core/BBTrackContainer.cpp b/src/core/BBTrackContainer.cpp index f818684ec..15967000a 100644 --- a/src/core/BBTrackContainer.cpp +++ b/src/core/BBTrackContainer.cpp @@ -151,7 +151,7 @@ void BBTrackContainer::swapBB(int bb1, int bb2) void BBTrackContainer::updateBBTrack(TrackContentObject * tco) { BBTrack * t = BBTrack::findBBTrack(tco->startPosition() / DefaultTicksPerBar); - if (t != NULL) + if (t != nullptr) { t->dataChanged(); } diff --git a/src/core/BufferManager.cpp b/src/core/BufferManager.cpp index 79a0734f7..eb8764074 100644 --- a/src/core/BufferManager.cpp +++ b/src/core/BufferManager.cpp @@ -39,7 +39,7 @@ void BufferManager::init( fpp_t framesPerPeriod ) sampleFrame * BufferManager::acquire() { - return MM_ALLOC( sampleFrame, ::framesPerPeriod ); + return MM_ALLOC( ::framesPerPeriod ); } void BufferManager::clear( sampleFrame *ab, const f_cnt_t frames, const f_cnt_t offset ) diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index a41f8a8c0..b6cff1eed 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -53,7 +53,7 @@ static inline QString ensureTrailingSlash(const QString & s ) } -ConfigManager * ConfigManager::s_instanceOfMe = NULL; +ConfigManager * ConfigManager::s_instanceOfMe = nullptr; ConfigManager::ConfigManager() : @@ -493,9 +493,9 @@ void ConfigManager::loadConfigFile(const QString & configFile) #endif setBackgroundPicFile(value("paths", "backgroundtheme")); } - else if(gui) + else if(getGUI() != nullptr) { - QMessageBox::warning(NULL, MainWindow::tr("Configuration file"), + QMessageBox::warning(nullptr, MainWindow::tr("Configuration file"), MainWindow::tr("Error while parsing configuration file at line %1:%2: %3"). arg(errorLine). arg(errorCol). @@ -622,9 +622,9 @@ void ConfigManager::saveConfigFile() "the directory containing the " "file and try again!" ).arg(m_lmmsRcFile); - if(gui) + if(getGUI() != nullptr) { - QMessageBox::critical(NULL, title, message, + QMessageBox::critical(nullptr, title, message, QMessageBox::Ok, QMessageBox::NoButton); } diff --git a/src/core/Controller.cpp b/src/core/Controller.cpp index da1af20a5..3b1db245b 100644 --- a/src/core/Controller.cpp +++ b/src/core/Controller.cpp @@ -183,14 +183,14 @@ void Controller::resetFrameCounter() Controller * Controller::create( ControllerTypes _ct, Model * _parent ) { - static Controller * dummy = NULL; - Controller * c = NULL; + static Controller * dummy = nullptr; + Controller * c = nullptr; switch( _ct ) { case Controller::DummyController: if (!dummy) - dummy = new Controller( DummyController, NULL, + dummy = new Controller( DummyController, nullptr, QString() ); c = dummy; break; @@ -231,7 +231,7 @@ Controller * Controller::create( const QDomElement & _this, Model * _parent ) _parent ); } - if( c != NULL ) + if( c != nullptr ) { c->restoreState( _this ); } @@ -246,7 +246,7 @@ bool Controller::hasModel( const Model * m ) const for (QObject * c : children()) { AutomatableModel * am = qobject_cast(c); - if( am != NULL ) + if( am != nullptr ) { if( am == m ) { @@ -254,7 +254,7 @@ bool Controller::hasModel( const Model * m ) const } ControllerConnection * cc = am->controllerConnection(); - if( cc != NULL && cc->getController()->hasModel( m ) ) + if( cc != nullptr && cc->getController()->hasModel( m ) ) { return true; } diff --git a/src/core/ControllerConnection.cpp b/src/core/ControllerConnection.cpp index 7a7365591..03b054629 100644 --- a/src/core/ControllerConnection.cpp +++ b/src/core/ControllerConnection.cpp @@ -37,18 +37,18 @@ ControllerConnectionVector ControllerConnection::s_connections; ControllerConnection::ControllerConnection(Controller * _controller) : - m_controller( NULL ), + m_controller( nullptr ), m_controllerId( -1 ), m_ownsController(false) { - if( _controller != NULL ) + if( _controller != nullptr ) { setController( _controller ); } else { m_controller = Controller::create( Controller::DummyController, - NULL ); + nullptr ); } s_connections.append( this ); } @@ -57,7 +57,7 @@ ControllerConnection::ControllerConnection(Controller * _controller) : ControllerConnection::ControllerConnection( int _controllerId ) : - m_controller( Controller::create( Controller::DummyController, NULL ) ), + m_controller( Controller::create( Controller::DummyController, nullptr ) ), m_controllerId( _controllerId ), m_ownsController( false ) { @@ -95,7 +95,7 @@ void ControllerConnection::setController( Controller * _controller ) if( m_ownsController && m_controller ) { delete m_controller; - m_controller = NULL; + m_controller = nullptr; } if( m_controller && m_controller->type() != Controller::DummyController ) @@ -105,7 +105,7 @@ void ControllerConnection::setController( Controller * _controller ) if( !_controller ) { - m_controller = Controller::create( Controller::DummyController, NULL ); + m_controller = Controller::create( Controller::DummyController, nullptr ); } else { @@ -220,7 +220,7 @@ void ControllerConnection::loadSettings( const QDomElement & _this ) } else { - m_controller = Controller::create( Controller::DummyController, NULL ); + m_controller = Controller::create( Controller::DummyController, nullptr ); } } } diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index ec9056be2..82694b7da 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -137,9 +137,9 @@ DataFile::DataFile( const QString & _fileName ) : QFile inFile( _fileName ); if( !inFile.open( QIODevice::ReadOnly ) ) { - if( gui ) + if( getGUI() != nullptr ) { - QMessageBox::critical( NULL, + QMessageBox::critical( nullptr, SongEditor::tr( "Could not open file" ), SongEditor::tr( "Could not open file %1. You probably " "have no permissions to read this " @@ -208,7 +208,7 @@ bool DataFile::validate( QString extension ) case Type::UnknownType: if (! ( extension == "mmp" || extension == "mpt" || extension == "mmpz" || extension == "xpf" || extension == "xml" || - ( extension == "xiz" && ! pluginFactory->pluginSupportingExtension(extension).isNull()) || + ( extension == "xiz" && ! getPluginFactory()->pluginSupportingExtension(extension).isNull()) || extension == "sf2" || extension == "sf3" || extension == "pat" || extension == "mid" || extension == "dll" #ifdef LMMS_HAVE_LV2 @@ -290,7 +290,7 @@ bool DataFile::writeFile(const QString& filename, bool withResources) { // Small lambda function for displaying errors auto showError = [this](QString title, QString body){ - if (gui) + if (getGUI() != nullptr) { QMessageBox mb; mb.setWindowTitle(title); @@ -1005,7 +1005,7 @@ void DataFile::upgrade_0_4_0_beta1() m["plugin"] = sl.value( 0 ); m["file"] = sl.value( 1 ); } - EffectKey key( NULL, name, m ); + EffectKey key( nullptr, name, m ); el.appendChild( key.saveXML( *this ) ); } } @@ -1815,9 +1815,9 @@ void DataFile::loadData( const QByteArray & _data, const QString & _sourceFile ) if( line >= 0 && col >= 0 ) { qWarning() << "at line" << line << "column" << errorMsg; - if( gui ) + if( getGUI() != nullptr ) { - QMessageBox::critical( NULL, + QMessageBox::critical( nullptr, SongEditor::tr( "Error in file" ), SongEditor::tr( "The file %1 seems to contain " "errors and therefore can't be " @@ -1856,7 +1856,7 @@ void DataFile::loadData( const QByteArray & _data, const QString & _sourceFile ) if (createdWith.setCompareType(ProjectVersion::Minor) != openedWith.setCompareType(ProjectVersion::Minor) - && gui != nullptr && root.attribute("type") == "song" + && getGUI() != nullptr && root.attribute("type") == "song" ){ auto projectType = _sourceFile.endsWith(".mpt") ? SongEditor::tr("template") : SongEditor::tr("project"); diff --git a/src/core/DrumSynth.cpp b/src/core/DrumSynth.cpp index 859fe403f..d4f9fe167 100644 --- a/src/core/DrumSynth.cpp +++ b/src/core/DrumSynth.cpp @@ -29,13 +29,10 @@ #include #include -#include //sin(), exp(), etc. +#include //sin(), exp(), etc. #include -#ifdef LMMS_BUILD_WIN32 -#define powf pow -#endif #ifdef _MSC_VER //not #if LMMS_BUILD_WIN32 because we have strncasecmp in mingw @@ -45,10 +42,6 @@ using namespace std; -#define WORD __u16 -#define DWORD __u32 -#define WAVE_FORMAT_PCM 0x0001 - // const int Fs = 44100; const float TwoPi = 6.2831853f; const int MAX = 0; @@ -206,7 +199,7 @@ int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const c break; k = strtok(line, " \t="); - b = strtok(NULL, "\n\r\0"); + b = strtok(nullptr, "\n\r\0"); if (k != 0 && strcasecmp(k, key)==0) { if (b==0) { @@ -329,13 +322,13 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa timestretch *= Fs / 44100.f; DGain = 1.0f; //leave this here! - DGain = (float)powf(10.0, 0.05 * GetPrivateProfileFloat(sec,"Level",0,dsfile)); + DGain = static_cast(std::pow(10.0, 0.05 * GetPrivateProfileFloat(sec,"Level",0,dsfile))); MasterTune = GetPrivateProfileFloat(sec,"Tuning",0.0,dsfile); - MasterTune = (float)powf(1.0594631f, MasterTune + mem_tune); + MasterTune = static_cast(std::pow(1.0594631f, MasterTune + mem_tune)); MainFilter = 2 * GetPrivateProfileInt(sec,"Filter",0,dsfile); MFres = 0.0101f * GetPrivateProfileFloat(sec,"Resonance",0.0,dsfile); - MFres = (float)powf(MFres, 0.5f); + MFres = static_cast(std::pow(MFres, 0.5f)); HighPass = GetPrivateProfileInt(sec,"HighPass",0,dsfile); GetEnv(7, sec, "FilterEnv", dsfile); @@ -370,7 +363,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa TDroopRate = GetPrivateProfileFloat(sec,"Droop",0.f,dsfile); if(TDroopRate>0.f) { - TDroopRate = (float)powf(10.0f, (TDroopRate - 20.0f) / 30.0f); + TDroopRate = static_cast(std::pow(10.0f, (TDroopRate - 20.0f) / 30.0f)); TDroopRate = TDroopRate * -4.f / envData[1][MAX]; TDroop = 1; F2 = F1+((F2-F1)/(1.f-(float)exp(TDroopRate * envData[1][MAX]))); @@ -393,7 +386,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa OW1 = GetPrivateProfileInt(sec,"Wave1",0,dsfile); OW2 = GetPrivateProfileInt(sec,"Wave2",0,dsfile); OBal2 = (float)GetPrivateProfileInt(sec,"Param",50,dsfile); - ODrive = (float)powf(OBal2, 3.0f) / (float)powf(50.0f, 3.0f); + ODrive = static_cast(std::pow(OBal2, 3.0f)) / std::pow(50.0f, 3.0f); OBal2 *= 0.01f; OBal1 = 1.f - OBal2; Ophi1 = Tphi; @@ -453,8 +446,8 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa { DAtten = DGain * (short)LoudestEnv(); if(DAtten>32700) clippoint=32700; else clippoint=(short)DAtten; - DAtten = (float)powf(2.0, 2.0 * GetPrivateProfileInt(sec,"Bits",0,dsfile)); - DGain = DAtten * DGain * (float)powf(10.0, 0.05 * GetPrivateProfileInt(sec,"Clipping",0,dsfile)); + DAtten = static_cast(std::pow(2.0, 2.0 * GetPrivateProfileInt(sec,"Bits",0,dsfile))); + DGain = DAtten * DGain * static_cast(std::pow(10.0, 0.05 * GetPrivateProfileInt(sec,"Clipping",0,dsfile))); } //prepare envelopes @@ -466,7 +459,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa //if(wave!=NULL) free(wave); //wave = new int16_t[channels * (Length + 1280)]; //wave memory buffer wave = new int16_t[channels * Length]; //wave memory buffer - if(wave==NULL) {return 0;} + if(wave==nullptr) {return 0;} wavewords = 0; /* @@ -664,7 +657,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa MFtmp = envData[7][ENV]; if(MFtmp >0.2f) - MFfb = 1.001f - (float)powf(10.0f, MFtmp - 1); + MFfb = 1.001f - static_cast(std::pow(10.0f, MFtmp - 1)); else MFfb = 0.999f - 0.7824f * MFtmp; @@ -682,7 +675,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa MFtmp = envData[7][ENV]; if(MFtmp >0.2f) - MFfb = 1.001f - (float)powf(10.0f, MFtmp - 1); + MFfb = 1.001f - static_cast(std::pow(10.0f, MFtmp - 1)); else MFfb = 0.999f - 0.7824f * MFtmp; diff --git a/src/core/Effect.cpp b/src/core/Effect.cpp index ce305d1ab..e730db5a5 100644 --- a/src/core/Effect.cpp +++ b/src/core/Effect.cpp @@ -37,7 +37,7 @@ Effect::Effect( const Plugin::Descriptor * _desc, Model * _parent, const Descriptor::SubPluginFeatures::Key * _key ) : Plugin( _desc, _parent, _key ), - m_parent( NULL ), + m_parent( nullptr ), m_processors( 1 ), m_okay( true ), m_noRun( false ), @@ -49,7 +49,7 @@ Effect::Effect( const Plugin::Descriptor * _desc, m_autoQuitModel( 1.0f, 1.0f, 8000.0f, 100.0f, 1.0f, this, tr( "Decay" ) ), m_autoQuitDisabled( false ) { - m_srcState[0] = m_srcState[1] = NULL; + m_srcState[0] = m_srcState[1] = nullptr; reinitSRC(); if( ConfigManager::inst()->value( "ui", "disableautoquit").toInt() ) @@ -65,7 +65,7 @@ Effect::~Effect() { for( int i = 0; i < 2; ++i ) { - if( m_srcState[i] != NULL ) + if( m_srcState[i] != nullptr ) { src_delete( m_srcState[i] ); } @@ -118,7 +118,7 @@ Effect * Effect::instantiate( const QString& pluginName, { Plugin * p = Plugin::instantiateWithKey( pluginName, _parent, _key ); // check whether instantiated plugin is an effect - if( dynamic_cast( p ) != NULL ) + if( dynamic_cast( p ) != nullptr ) { // everything ok, so return pointer Effect * effect = dynamic_cast( p ); @@ -129,7 +129,7 @@ Effect * Effect::instantiate( const QString& pluginName, // not quite... so delete plugin and leave it up to the caller to instantiate a DummyEffect delete p; - return NULL; + return nullptr; } @@ -174,7 +174,7 @@ void Effect::reinitSRC() { for( int i = 0; i < 2; ++i ) { - if( m_srcState[i] != NULL ) + if( m_srcState[i] != nullptr ) { src_delete( m_srcState[i] ); } @@ -182,7 +182,7 @@ void Effect::reinitSRC() if( ( m_srcState[i] = src_new( Engine::audioEngine()->currentQualitySettings(). libsrcInterpolation(), - DEFAULT_CHANNELS, &error ) ) == NULL ) + DEFAULT_CHANNELS, &error ) ) == nullptr ) { qFatal( "Error: src_new() failed in effect.cpp!\n" ); } @@ -197,7 +197,7 @@ void Effect::resample( int _i, const sampleFrame * _src_buf, sampleFrame * _dst_buf, sample_rate_t _dst_sr, f_cnt_t _frames ) { - if( m_srcState[_i] == NULL ) + if( m_srcState[_i] == nullptr ) { return; } diff --git a/src/core/EffectChain.cpp b/src/core/EffectChain.cpp index 9c233bc41..2f5deaec4 100644 --- a/src/core/EffectChain.cpp +++ b/src/core/EffectChain.cpp @@ -36,7 +36,7 @@ EffectChain::EffectChain( Model * _parent ) : Model( _parent ), SerializingObject(), - m_enabledModel( false, NULL, tr( "Effects enabled" ) ) + m_enabledModel( false, nullptr, tr( "Effects enabled" ) ) { } @@ -97,7 +97,7 @@ void EffectChain::loadSettings( const QDomElement & _this ) Effect* e = Effect::instantiate( name.toUtf8(), this, &key ); - if( e != NULL && e->isOkay() && e->nodeName() == node.nodeName() ) + if( e != nullptr && e->isOkay() && e->nodeName() == node.nodeName() ) { e->restoreState( effectData ); } diff --git a/src/core/Engine.cpp b/src/core/Engine.cpp index b3c2b67a3..6dbde8613 100644 --- a/src/core/Engine.cpp +++ b/src/core/Engine.cpp @@ -38,15 +38,15 @@ #include "Oscillator.h" float LmmsCore::s_framesPerTick; -AudioEngine* LmmsCore::s_audioEngine = NULL; -FxMixer * LmmsCore::s_fxMixer = NULL; -BBTrackContainer * LmmsCore::s_bbTrackContainer = NULL; -Song * LmmsCore::s_song = NULL; -ProjectJournal * LmmsCore::s_projectJournal = NULL; +AudioEngine* LmmsCore::s_audioEngine = nullptr; +FxMixer * LmmsCore::s_fxMixer = nullptr; +BBTrackContainer * LmmsCore::s_bbTrackContainer = nullptr; +Song * LmmsCore::s_song = nullptr; +ProjectJournal * LmmsCore::s_projectJournal = nullptr; #ifdef LMMS_HAVE_LV2 Lv2Manager * LmmsCore::s_lv2Manager = nullptr; #endif -Ladspa2LMMS * LmmsCore::s_ladspaManager = NULL; +Ladspa2LMMS * LmmsCore::s_ladspaManager = nullptr; void* LmmsCore::s_dndPluginKey = nullptr; @@ -166,4 +166,4 @@ void *LmmsCore::pickDndPluginKey() -LmmsCore * LmmsCore::s_instanceOfMe = NULL; +LmmsCore * LmmsCore::s_instanceOfMe = nullptr; diff --git a/src/core/EnvelopeAndLfoParameters.cpp b/src/core/EnvelopeAndLfoParameters.cpp index 613f4d446..7dc948e3b 100644 --- a/src/core/EnvelopeAndLfoParameters.cpp +++ b/src/core/EnvelopeAndLfoParameters.cpp @@ -38,7 +38,7 @@ extern const float SECS_PER_LFO_OSCILLATION = 20.0f; const f_cnt_t minimumFrames = 1; -EnvelopeAndLfoParameters::LfoInstances * EnvelopeAndLfoParameters::s_lfoInstances = NULL; +EnvelopeAndLfoParameters::LfoInstances * EnvelopeAndLfoParameters::s_lfoInstances = nullptr; void EnvelopeAndLfoParameters::LfoInstances::trigger() @@ -102,8 +102,8 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters( m_valueForZeroAmount( _value_for_zero_amount ), m_pahdFrames( 0 ), m_rFrames( 0 ), - m_pahdEnv( NULL ), - m_rEnv( NULL ), + m_pahdEnv( nullptr ), + m_rEnv( nullptr ), m_pahdBufSize( 0 ), m_rBufSize( 0 ), m_lfoPredelayModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO pre-delay" ) ), @@ -117,12 +117,12 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters( m_controlEnvAmountModel( false, this, tr( "Modulate env amount" ) ), m_lfoFrame( 0 ), m_lfoAmountIsZero( false ), - m_lfoShapeData( NULL ) + m_lfoShapeData( nullptr ) { m_amountModel.setCenterValue( 0 ); m_lfoAmountModel.setCenterValue( 0 ); - if( s_lfoInstances == NULL ) + if( s_lfoInstances == nullptr ) { s_lfoInstances = new LfoInstances(); } @@ -195,7 +195,7 @@ EnvelopeAndLfoParameters::~EnvelopeAndLfoParameters() if( instances()->isEmpty() ) { delete instances(); - s_lfoInstances = NULL; + s_lfoInstances = nullptr; } } diff --git a/src/core/FxMixer.cpp b/src/core/FxMixer.cpp index e360c1f85..2d2b8cc89 100644 --- a/src/core/FxMixer.cpp +++ b/src/core/FxMixer.cpp @@ -39,7 +39,7 @@ FxRoute::FxRoute( FxChannel * from, FxChannel * to, float amount ) : m_from( from ), m_to( to ), - m_amount( amount, 0, 1, 0.001, NULL, + m_amount( amount, 0, 1, 0.001, nullptr, tr( "Amount to send from channel %1 to channel %2" ).arg( m_from->m_channelIndex ).arg( m_to->m_channelIndex ) ) { //qDebug( "created: %d to %d", m_from->m_channelIndex, m_to->m_channelIndex ); @@ -60,7 +60,7 @@ void FxRoute::updateName() FxChannel::FxChannel( int idx, Model * _parent ) : - m_fxChain( NULL ), + m_fxChain( nullptr ), m_hasInput( false ), m_stillRunning( false ), m_peakLeft( 0.0f ), @@ -189,7 +189,7 @@ void FxChannel::doProcessing() FxMixer::FxMixer() : - Model( NULL ), + Model( nullptr ), JournallingObject(), m_fxChannels() { @@ -467,7 +467,7 @@ FxRoute * FxMixer::createRoute( FxChannel * from, FxChannel * to, float amount ) { if( from == to ) { - return NULL; + return nullptr; } Engine::audioEngine()->requestChangeInModel(); FxRoute * route = new FxRoute( from, to, amount ); @@ -562,7 +562,7 @@ FloatModel * FxMixer::channelSendModel( fx_ch_t fromChannel, fx_ch_t toChannel ) { if( fromChannel == toChannel ) { - return NULL; + return nullptr; } const FxChannel * from = m_fxChannels[fromChannel]; const FxChannel * to = m_fxChannels[toChannel]; @@ -575,7 +575,7 @@ FloatModel * FxMixer::channelSendModel( fx_ch_t fromChannel, fx_ch_t toChannel ) } } - return NULL; + return nullptr; } diff --git a/src/core/ImportFilter.cpp b/src/core/ImportFilter.cpp index e29e9f1d4..6f41756a6 100644 --- a/src/core/ImportFilter.cpp +++ b/src/core/ImportFilter.cpp @@ -37,7 +37,7 @@ using std::unique_ptr; ImportFilter::ImportFilter( const QString & _file_name, const Descriptor * _descriptor ) : - Plugin( _descriptor, NULL ), + Plugin( _descriptor, nullptr ), m_file( _file_name ) { } @@ -64,10 +64,10 @@ void ImportFilter::import( const QString & _file_to_import, const bool j = Engine::projectJournal()->isJournalling(); Engine::projectJournal()->setJournalling( false ); - for (const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::ImportFilter)) + for (const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::ImportFilter)) { - unique_ptr p(Plugin::instantiate( desc->name, NULL, s.data() )); - if( dynamic_cast( p.get() ) != NULL && + unique_ptr p(Plugin::instantiate( desc->name, nullptr, s.data() )); + if( dynamic_cast( p.get() ) != nullptr && dynamic_cast( p.get() )->tryImport( tc ) ) { successful = true; @@ -79,7 +79,7 @@ void ImportFilter::import( const QString & _file_to_import, if( successful == false ) { - QMessageBox::information( NULL, + QMessageBox::information( nullptr, TrackContainer::tr( "Couldn't import file" ), TrackContainer::tr( "Couldn't find a filter for " "importing file %1.\n" @@ -99,7 +99,7 @@ bool ImportFilter::openFile() { if( m_file.open( QFile::ReadOnly ) == false ) { - QMessageBox::critical( NULL, + QMessageBox::critical( nullptr, TrackContainer::tr( "Couldn't open file" ), TrackContainer::tr( "Couldn't open file %1 " "for reading.\nPlease make " diff --git a/src/core/Instrument.cpp b/src/core/Instrument.cpp index 7ef95c81e..9b7267c0d 100644 --- a/src/core/Instrument.cpp +++ b/src/core/Instrument.cpp @@ -34,7 +34,7 @@ Instrument::Instrument(InstrumentTrack * _instrument_track, const Descriptor * _descriptor, const Descriptor::SubPluginFeatures::Key *key) : - Plugin(_descriptor, NULL/* _instrument_track*/, key), + Plugin(_descriptor, nullptr/* _instrument_track*/, key), m_instrumentTrack( _instrument_track ) { } diff --git a/src/core/JournallingObject.cpp b/src/core/JournallingObject.cpp index d61630cb9..729303c67 100644 --- a/src/core/JournallingObject.cpp +++ b/src/core/JournallingObject.cpp @@ -118,7 +118,7 @@ void JournallingObject::changeID( jo_id_t _id ) { JournallingObject * jo = Engine::projectJournal()-> journallingObject( _id ); - if( jo != NULL ) + if( jo != nullptr ) { QString used_by = jo->nodeName(); if( used_by == "automatablemodel" && diff --git a/src/core/LadspaControl.cpp b/src/core/LadspaControl.cpp index 68f2ee643..4dbcb77fc 100644 --- a/src/core/LadspaControl.cpp +++ b/src/core/LadspaControl.cpp @@ -142,7 +142,7 @@ ValueBuffer * LadspaControl::valueBuffer() case TOGGLED: case INTEGER: case ENUM: - return NULL; + return nullptr; case FLOATING: return m_knobModel.valueBuffer(); case TIME: @@ -152,7 +152,7 @@ ValueBuffer * LadspaControl::valueBuffer() break; } - return NULL; + return nullptr; } diff --git a/src/core/LadspaManager.cpp b/src/core/LadspaManager.cpp index 86acb661b..a7bccd3d4 100644 --- a/src/core/LadspaManager.cpp +++ b/src/core/LadspaManager.cpp @@ -86,7 +86,7 @@ LadspaManager::LadspaManager() LADSPA_Descriptor_Function descriptorFunction = ( LADSPA_Descriptor_Function ) plugin_lib.resolve( "ladspa_descriptor" ); - if( descriptorFunction != NULL ) + if( descriptorFunction != nullptr ) { addPlugins( descriptorFunction, f.fileName() ); @@ -132,7 +132,7 @@ ladspaManagerDescription * LadspaManager::getDescription( } else { - return( NULL ); + return( nullptr ); } } @@ -146,7 +146,7 @@ void LadspaManager::addPlugins( const LADSPA_Descriptor * descriptor; for( long pluginIndex = 0; - ( descriptor = _descriptor_func( pluginIndex ) ) != NULL; + ( descriptor = _descriptor_func( pluginIndex ) ) != nullptr; ++pluginIndex ) { ladspa_key_t key( _file, QString( descriptor->Label ) ); @@ -244,7 +244,7 @@ const LADSPA_PortDescriptor* LadspaManager::getPortDescriptor(const ladspa_key_t { return( & descriptor->PortDescriptors[_port] ); } - return( NULL ); + return( nullptr ); } const LADSPA_PortRangeHint *LadspaManager::getPortRangeHint(const ladspa_key_t &_plugin, uint32_t _port) @@ -254,7 +254,7 @@ const LADSPA_PortRangeHint *LadspaManager::getPortRangeHint(const ladspa_key_t & { return( & descriptor->PortRangeHints[_port] ); } - return( NULL ); + return( nullptr ); } @@ -565,7 +565,7 @@ const void * LadspaManager::getImplementationData( const ladspa_key_t & _plugin ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - return( descriptor ? descriptor->ImplementationData : NULL ); + return( descriptor ? descriptor->ImplementationData : nullptr ); } @@ -585,7 +585,7 @@ const LADSPA_Descriptor * LadspaManager::getDescriptor( } else { - return( NULL ); + return( nullptr ); } } @@ -599,7 +599,7 @@ LADSPA_Handle LadspaManager::instantiate( const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); return( descriptor ? ( descriptor->instantiate )( descriptor, _sample_rate ) : - NULL ); + nullptr ); } @@ -611,7 +611,7 @@ bool LadspaManager::connectPort( const ladspa_key_t & _plugin, LADSPA_Data * _data_location ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - if( descriptor && descriptor->connect_port != NULL && + if( descriptor && descriptor->connect_port != nullptr && _port < getPortCount( _plugin ) ) { ( descriptor->connect_port ) @@ -628,7 +628,7 @@ bool LadspaManager::activate( const ladspa_key_t & _plugin, LADSPA_Handle _instance ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - if( descriptor && descriptor->activate != NULL ) + if( descriptor && descriptor->activate != nullptr ) { ( descriptor->activate ) ( _instance ); return( true ); @@ -644,7 +644,7 @@ bool LadspaManager::run( const ladspa_key_t & _plugin, uint32_t _sample_count ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - if( descriptor && descriptor->run!= NULL ) + if( descriptor && descriptor->run!= nullptr ) { ( descriptor->run ) ( _instance, _sample_count ); return( true ); @@ -660,8 +660,8 @@ bool LadspaManager::runAdding( const ladspa_key_t & _plugin, uint32_t _sample_count ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - if( descriptor && descriptor->run_adding!= NULL - && descriptor->set_run_adding_gain != NULL ) + if( descriptor && descriptor->run_adding!= nullptr + && descriptor->set_run_adding_gain != nullptr ) { ( descriptor->run_adding ) ( _instance, _sample_count ); return( true ); @@ -677,8 +677,8 @@ bool LadspaManager::setRunAddingGain( const ladspa_key_t & _plugin, LADSPA_Data _gain ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - if( descriptor && descriptor->run_adding!= NULL - && descriptor->set_run_adding_gain != NULL ) + if( descriptor && descriptor->run_adding!= nullptr + && descriptor->set_run_adding_gain != nullptr ) { ( descriptor->set_run_adding_gain ) ( _instance, _gain ); return( true ); @@ -693,7 +693,7 @@ bool LadspaManager::deactivate( const ladspa_key_t & _plugin, LADSPA_Handle _instance ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - if( descriptor && descriptor->deactivate!= NULL ) + if( descriptor && descriptor->deactivate!= nullptr ) { ( descriptor->deactivate ) ( _instance ); return( true ); @@ -708,7 +708,7 @@ bool LadspaManager::cleanup( const ladspa_key_t & _plugin, LADSPA_Handle _instance ) { const LADSPA_Descriptor * descriptor = getDescriptor( _plugin ); - if( descriptor && descriptor->cleanup!= NULL ) + if( descriptor && descriptor->cleanup!= nullptr ) { ( descriptor->cleanup ) ( _instance ); return( true ); diff --git a/src/core/LfoController.cpp b/src/core/LfoController.cpp index 38fc8b43c..c58551510 100644 --- a/src/core/LfoController.cpp +++ b/src/core/LfoController.cpp @@ -102,7 +102,7 @@ void LfoController::updateValueBuffer() for( float& f : m_valueBuffer ) { - const float currentSample = m_sampleFunction != NULL + const float currentSample = m_sampleFunction != nullptr ? m_sampleFunction( phase ) : m_userDefSampleBuffer->userWaveSample( phase ); @@ -170,7 +170,7 @@ void LfoController::updateSampleFunction() m_sampleFunction = &Oscillator::noiseSample; break; case Oscillator::UserDefinedWave: - m_sampleFunction = NULL; + m_sampleFunction = nullptr; /*TODO: If C++11 is allowed, should change the type of m_sampleFunction be std::function and use the line below: diff --git a/src/core/LocklessAllocator.cpp b/src/core/LocklessAllocator.cpp index 4839a7bd9..9fab5f5ca 100644 --- a/src/core/LocklessAllocator.cpp +++ b/src/core/LocklessAllocator.cpp @@ -113,7 +113,7 @@ void * LocklessAllocator::alloc() if( !available ) { fprintf( stderr, "LocklessAllocator: No free space\n" ); - return NULL; + return nullptr; } } while (!m_available.compare_exchange_weak(available, available - 1)); diff --git a/src/core/MemoryHelper.cpp b/src/core/MemoryHelper.cpp index eb5a24d44..eaf10825b 100644 --- a/src/core/MemoryHelper.cpp +++ b/src/core/MemoryHelper.cpp @@ -33,14 +33,14 @@ void* MemoryHelper::alignedMalloc( size_t byteNum ) { char *ptr, *ptr2, *aligned_ptr; - int align_mask = ALIGN_SIZE - 1; + int align_mask = LMMS_ALIGN_SIZE - 1; - ptr = static_cast( malloc( byteNum + ALIGN_SIZE + sizeof( int ) ) ); + ptr = static_cast( malloc( byteNum + LMMS_ALIGN_SIZE + sizeof( int ) ) ); - if( ptr == NULL ) return NULL; + if( ptr == nullptr ) return nullptr; ptr2 = ptr + sizeof( int ); - aligned_ptr = ptr2 + ( ALIGN_SIZE - ( ( size_t ) ptr2 & align_mask ) ); + aligned_ptr = ptr2 + ( LMMS_ALIGN_SIZE - ( ( size_t ) ptr2 & align_mask ) ); ptr2 = aligned_ptr - sizeof( int ); *( ( int* ) ptr2 ) = ( int )( aligned_ptr - ptr ); diff --git a/src/core/Note.cpp b/src/core/Note.cpp index 080a555b5..16c36b1bc 100644 --- a/src/core/Note.cpp +++ b/src/core/Note.cpp @@ -44,7 +44,7 @@ Note::Note( const TimePos & length, const TimePos & pos, m_panning( qBound( PanningLeft, panning, PanningRight ) ), m_length( length ), m_pos( pos ), - m_detuning( NULL ) + m_detuning( nullptr ) { if( detuning ) { @@ -71,7 +71,7 @@ Note::Note( const Note & note ) : m_panning( note.m_panning ), m_length( note.m_length ), m_pos( note.m_pos ), - m_detuning( NULL ) + m_detuning( nullptr ) { if( note.m_detuning ) { @@ -208,7 +208,7 @@ void Note::loadSettings( const QDomElement & _this ) void Note::createDetuning() { - if( m_detuning == NULL ) + if( m_detuning == nullptr ) { m_detuning = new DetuningHelper; (void) m_detuning->automationPattern(); diff --git a/src/core/NotePlayHandle.cpp b/src/core/NotePlayHandle.cpp index f13df6d9a..f1a26dd7f 100644 --- a/src/core/NotePlayHandle.cpp +++ b/src/core/NotePlayHandle.cpp @@ -53,7 +53,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack, Origin origin ) : PlayHandle( TypeNotePlayHandle, _offset ), Note( n.length(), n.pos(), n.key(), n.getVolume(), n.getPanning(), n.detuning() ), - m_pluginData( NULL ), + m_pluginData( nullptr ), m_instrumentTrack( instrumentTrack ), m_frames( 0 ), m_totalFramesPlayed( 0 ), @@ -64,16 +64,16 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack, m_released( false ), m_releaseStarted( false ), m_hasMidiNote( false ), - m_hasParent( parent != NULL ), + m_hasParent( parent != nullptr ), m_parent( parent ), m_hadChildren( false ), m_muted( false ), - m_bbTrack( NULL ), + m_bbTrack( nullptr ), m_origTempo( Engine::getSong()->getTempo() ), m_origBaseNote( instrumentTrack->baseNote() ), m_frequency( 0 ), m_unpitchedFrequency( 0 ), - m_baseDetuning( NULL ), + m_baseDetuning( nullptr ), m_songGlobalParentOffset( 0 ), m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack->midiPort()->realOutputChannel() ), m_origin( origin ), @@ -133,14 +133,14 @@ NotePlayHandle::~NotePlayHandle() m_parent->m_subNotes.removeOne( this ); } - if( m_pluginData != NULL ) + if( m_pluginData != nullptr ) { m_instrumentTrack->deleteNotePluginData( this ); } if( m_instrumentTrack->m_notes[key()] == this ) { - m_instrumentTrack->m_notes[key()] = NULL; + m_instrumentTrack->m_notes[key()] = nullptr; } m_subNotes.clear(); @@ -458,7 +458,7 @@ int NotePlayHandle::index() const for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it ) { const NotePlayHandle * nph = dynamic_cast( *it ); - if( nph == NULL || nph->m_instrumentTrack != m_instrumentTrack || nph->isReleased() || nph->hasParent() ) + if( nph == nullptr || nph->m_instrumentTrack != m_instrumentTrack || nph->isReleased() || nph->hasParent() ) { continue; } @@ -482,7 +482,7 @@ ConstNotePlayHandleList NotePlayHandle::nphsOfInstrumentTrack( const InstrumentT for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it ) { const NotePlayHandle * nph = dynamic_cast( *it ); - if( nph != NULL && nph->m_instrumentTrack == _it && ( ( nph->isReleased() == false && nph->hasParent() == false ) || _all_ph == true ) ) + if( nph != nullptr && nph->m_instrumentTrack == _it && ( ( nph->isReleased() == false && nph->hasParent() == false ) || _all_ph == true ) ) { cnphv.push_back( nph ); } @@ -602,9 +602,9 @@ int NotePlayHandleManager::s_size; void NotePlayHandleManager::init() { - s_available = MM_ALLOC( NotePlayHandle*, INITIAL_NPH_CACHE ); + s_available = MM_ALLOC( INITIAL_NPH_CACHE ); - NotePlayHandle * n = MM_ALLOC( NotePlayHandle, INITIAL_NPH_CACHE ); + NotePlayHandle * n = MM_ALLOC( INITIAL_NPH_CACHE ); for( int i=0; i < INITIAL_NPH_CACHE; ++i ) { @@ -647,11 +647,11 @@ void NotePlayHandleManager::release( NotePlayHandle * nph ) void NotePlayHandleManager::extend( int c ) { s_size += c; - NotePlayHandle ** tmp = MM_ALLOC( NotePlayHandle*, s_size ); + NotePlayHandle ** tmp = MM_ALLOC( s_size ); MM_FREE( s_available ); s_available = tmp; - NotePlayHandle * n = MM_ALLOC( NotePlayHandle, c ); + NotePlayHandle * n = MM_ALLOC( c ); for( int i=0; i < c; ++i ) { diff --git a/src/core/Oscillator.cpp b/src/core/Oscillator.cpp index dcf64a144..16b99bb5f 100644 --- a/src/core/Oscillator.cpp +++ b/src/core/Oscillator.cpp @@ -180,7 +180,7 @@ void Oscillator::generateFromFFT(int bands, sample_t* table) void Oscillator::generateAntiAliasUserWaveTable(SampleBuffer *sampleBuffer) { - if (sampleBuffer->m_userAntiAliasWaveTable == NULL) {return;} + if (sampleBuffer->m_userAntiAliasWaveTable == nullptr) {return;} for (int i = 0; i < OscillatorConstants::WAVE_TABLES_PER_WAVEFORM_COUNT; ++i) { @@ -553,7 +553,7 @@ inline bool Oscillator::syncOk( float _osc_coeff ) float Oscillator::syncInit( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { - if( m_subOsc != NULL ) + if( m_subOsc != nullptr ) { m_subOsc->update( _ab, _frames, _chnl ); } diff --git a/src/core/PeakController.cpp b/src/core/PeakController.cpp index 6e2cf0be6..baa157801 100644 --- a/src/core/PeakController.cpp +++ b/src/core/PeakController.cpp @@ -65,7 +65,7 @@ PeakController::PeakController( Model * _parent, PeakController::~PeakController() { - if( m_peakEffect != NULL && m_peakEffect->effectChain() != NULL ) + if( m_peakEffect != nullptr && m_peakEffect->effectChain() != nullptr ) { m_peakEffect->effectChain()->removeEffect( m_peakEffect ); } @@ -128,7 +128,7 @@ void PeakController::handleDestroyedEffect( ) // possible race condition... //printf("disconnecting effect\n"); disconnect( m_peakEffect ); - m_peakEffect = NULL; + m_peakEffect = nullptr; //deleteLater(); delete this; } @@ -235,7 +235,7 @@ PeakController * PeakController::getControllerBySetting(const QDomElement & _thi } } - return NULL; + return nullptr; } diff --git a/src/core/Piano.cpp b/src/core/Piano.cpp index 565f1aa4f..62680efa7 100644 --- a/src/core/Piano.cpp +++ b/src/core/Piano.cpp @@ -59,7 +59,7 @@ static const Piano::KeyTypes KEY_ORDER[] = * \param _it the InstrumentTrack window to attach to */ Piano::Piano( InstrumentTrack* track ) : - Model( NULL ), /*!< base class ctor */ + Model( nullptr ), /*!< base class ctor */ m_instrumentTrack( track ), m_midiEvProc( track ) /*!< the InstrumentTrack Model */ { diff --git a/src/core/PlayHandle.cpp b/src/core/PlayHandle.cpp index a553ab66f..37149583f 100644 --- a/src/core/PlayHandle.cpp +++ b/src/core/PlayHandle.cpp @@ -59,7 +59,7 @@ void PlayHandle::doProcessing() } else { - play( NULL ); + play( nullptr ); } } diff --git a/src/core/Plugin.cpp b/src/core/Plugin.cpp index f12566549..753f5dfbd 100644 --- a/src/core/Plugin.cpp +++ b/src/core/Plugin.cpp @@ -49,7 +49,7 @@ static Plugin::Descriptor dummyPluginDescriptor = 0x0100, Plugin::Undefined, &dummyLoader, - NULL + nullptr } ; @@ -62,7 +62,7 @@ Plugin::Plugin(const Descriptor * descriptor, Model * parent, const m_descriptor(descriptor), m_key(key ? *key : Descriptor::SubPluginFeatures::Key(m_descriptor)) { - if( m_descriptor == NULL ) + if( m_descriptor == nullptr ) { m_descriptor = &dummyPluginDescriptor; } @@ -194,7 +194,7 @@ Plugin * Plugin::instantiateWithKey(const QString& pluginName, Model * parent, const Descriptor::SubPluginFeatures::Key *keyPtr = keyFromDnd ? static_cast(Engine::pickDndPluginKey()) : key; - const PluginFactory::PluginInfo& pi = pluginFactory->pluginInfo(pluginName.toUtf8()); + const PluginFactory::PluginInfo& pi = getPluginFactory()->pluginInfo(pluginName.toUtf8()); if(keyPtr) { // descriptor is not yet set when loading - set it now @@ -214,17 +214,17 @@ Plugin * Plugin::instantiateWithKey(const QString& pluginName, Model * parent, Plugin * Plugin::instantiate(const QString& pluginName, Model * parent, void *data) { - const PluginFactory::PluginInfo& pi = pluginFactory->pluginInfo(pluginName.toUtf8()); + const PluginFactory::PluginInfo& pi = getPluginFactory()->pluginInfo(pluginName.toUtf8()); Plugin* inst; if( pi.isNull() ) { - if( gui ) + if( getGUI() != nullptr ) { - QMessageBox::information( NULL, + QMessageBox::information( nullptr, tr( "Plugin not found" ), tr( "The plugin \"%1\" wasn't found or could not be loaded!\nReason: \"%2\"" ). - arg( pluginName ).arg( pluginFactory->errorString(pluginName) ), + arg( pluginName ).arg( getPluginFactory()->errorString(pluginName) ), QMessageBox::Ok | QMessageBox::Default ); } inst = new DummyPlugin(); @@ -241,9 +241,9 @@ Plugin * Plugin::instantiate(const QString& pluginName, Model * parent, } else { - if( gui ) + if( getGUI() != nullptr ) { - QMessageBox::information( NULL, + QMessageBox::information( nullptr, tr( "Error while loading plugin" ), tr( "Failed to load plugin \"%1\"!").arg( pluginName ), QMessageBox::Ok | QMessageBox::Default ); @@ -269,7 +269,7 @@ void Plugin::collectErrorForUI( QString errMsg ) PluginView * Plugin::createView( QWidget * parent ) { PluginView * pv = instantiateView( parent ); - if( pv != NULL ) + if( pv != nullptr ) { pv->setModel( this ); } @@ -280,7 +280,7 @@ PluginView * Plugin::createView( QWidget * parent ) Plugin::Descriptor::SubPluginFeatures::Key::Key( const QDomElement & key ) : - desc( NULL ), + desc( nullptr ), name( key.attribute( "key" ) ), attributes() { diff --git a/src/core/PluginFactory.cpp b/src/core/PluginFactory.cpp index 16f86a17a..05d0628a3 100644 --- a/src/core/PluginFactory.cpp +++ b/src/core/PluginFactory.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "lmmsconfig.h" #include "ConfigManager.h" @@ -94,11 +95,16 @@ void PluginFactory::setupSearchPaths() PluginFactory* PluginFactory::instance() { if (s_instance == nullptr) - s_instance.reset(new PluginFactory()); + s_instance = std::make_unique(); return s_instance.get(); } +PluginFactory* getPluginFactory() +{ + return PluginFactory::instance(); +} + const Plugin::DescriptorList PluginFactory::descriptors() const { return m_descriptors.values(); diff --git a/src/core/PresetPreviewPlayHandle.cpp b/src/core/PresetPreviewPlayHandle.cpp index f2ed35c78..a0e5da445 100644 --- a/src/core/PresetPreviewPlayHandle.cpp +++ b/src/core/PresetPreviewPlayHandle.cpp @@ -40,8 +40,8 @@ class PreviewTrackContainer : public TrackContainer { public: PreviewTrackContainer() : - m_previewInstrumentTrack( NULL ), - m_previewNote( NULL ), + m_previewInstrumentTrack( nullptr ), + m_previewNote( nullptr ), m_dataMutex() { setJournalling( false ); @@ -135,14 +135,14 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file, Instrument * i = s_previewTC->previewInstrumentTrack()->instrument(); const QString ext = QFileInfo( _preset_file ). suffix().toLower(); - if( i == NULL || !i->descriptor()->supportsFileType( ext ) ) + if( i == nullptr || !i->descriptor()->supportsFileType( ext ) ) { const PluginFactory::PluginInfoAndKey& infoAndKey = - pluginFactory->pluginSupportingExtension(ext); + getPluginFactory()->pluginSupportingExtension(ext); i = s_previewTC->previewInstrumentTrack()-> loadInstrument(infoAndKey.info.name(), &infoAndKey.key); } - if( i != NULL ) + if( i != nullptr ) { i->loadFile( _preset_file ); } @@ -244,7 +244,7 @@ void PresetPreviewPlayHandle::init() void PresetPreviewPlayHandle::cleanup() { delete s_previewTC; - s_previewTC = NULL; + s_previewTC = nullptr; } @@ -254,7 +254,7 @@ ConstNotePlayHandleList PresetPreviewPlayHandle::nphsOfInstrumentTrack( const InstrumentTrack * _it ) { ConstNotePlayHandleList cnphv; - if( s_previewTC->previewNote() != NULL && + if( s_previewTC->previewNote() != nullptr && s_previewTC->previewNote()->instrumentTrack() == _it ) { cnphv.push_back( s_previewTC->previewNote() ); diff --git a/src/core/ProjectJournal.cpp b/src/core/ProjectJournal.cpp index e3cd362cb..3d1e9078a 100644 --- a/src/core/ProjectJournal.cpp +++ b/src/core/ProjectJournal.cpp @@ -181,7 +181,7 @@ void ProjectJournal::clearJournal() for( JoIdMap::Iterator it = m_joIDs.begin(); it != m_joIDs.end(); ) { - if( it.value() == NULL ) + if( it.value() == nullptr ) { it = m_joIDs.erase( it ); } @@ -196,7 +196,7 @@ void ProjectJournal::stopAllJournalling() { for( JoIdMap::Iterator it = m_joIDs.begin(); it != m_joIDs.end(); ++it) { - if( it.value() != NULL ) + if( it.value() != nullptr ) { it.value()->setJournalling(false); } diff --git a/src/core/ProjectRenderer.cpp b/src/core/ProjectRenderer.cpp index 1013a96c7..05d50ca9b 100644 --- a/src/core/ProjectRenderer.cpp +++ b/src/core/ProjectRenderer.cpp @@ -55,7 +55,7 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] = #ifdef LMMS_HAVE_OGGVORBIS &AudioFileOgg::getInst #else - NULL + nullptr #endif }, { ProjectRenderer::MP3File, @@ -64,13 +64,13 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] = #ifdef LMMS_HAVE_MP3LAME &AudioFileMP3::getInst #else - NULL + nullptr #endif }, // Insert your own file-encoder infos here. // Maybe one day the user can add own encoders inside the program. - { ProjectRenderer::NumFileFormats, NULL, NULL, NULL } + { ProjectRenderer::NumFileFormats, nullptr, nullptr, nullptr } } ; @@ -82,7 +82,7 @@ ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySe ExportFileFormats exportFileFormat, const QString & outputFilename ) : QThread( Engine::audioEngine() ), - m_fileDev( NULL ), + m_fileDev( nullptr ), m_qualitySettings( qualitySettings ), m_progress( 0 ), m_abort( false ) @@ -99,7 +99,7 @@ ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySe if( !successful ) { delete m_fileDev; - m_fileDev = NULL; + m_fileDev = nullptr; } } } diff --git a/src/core/RemotePlugin.cpp b/src/core/RemotePlugin.cpp index 904d7940e..520ae4379 100644 --- a/src/core/RemotePlugin.cpp +++ b/src/core/RemotePlugin.cpp @@ -92,7 +92,7 @@ RemotePlugin::RemotePlugin() : m_shmID( 0 ), #endif m_shmSize( 0 ), - m_shm( NULL ), + m_shm( nullptr ), m_inputCount( DEFAULT_CHANNELS ), m_outputCount( DEFAULT_CHANNELS ) { @@ -161,7 +161,7 @@ RemotePlugin::~RemotePlugin() #ifndef USE_QT_SHMEM shmdt( m_shm ); - shmctl( m_shmID, IPC_RMID, NULL ); + shmctl( m_shmID, IPC_RMID, nullptr ); #endif } @@ -256,7 +256,7 @@ bool RemotePlugin::init(const QString &pluginExecutable, break; default: - m_socket = accept( m_server, NULL, NULL ); + m_socket = accept( m_server, nullptr, nullptr ); if ( m_socket == -1 ) { qWarning( "Unexpected socket error." ); @@ -284,14 +284,14 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf if( m_failed || !isRunning() ) { - if( _out_buf != NULL ) + if( _out_buf != nullptr ) { BufferManager::clear( _out_buf, frames ); } return false; } - if( m_shm == NULL ) + if( m_shm == nullptr ) { // m_shm being zero means we didn't initialize everything so // far so process one message each time (and hope we get @@ -303,7 +303,7 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf fetchAndProcessAllMessages(); unlock(); } - if( _out_buf != NULL ) + if( _out_buf != nullptr ) { BufferManager::clear( _out_buf, frames ); } @@ -314,7 +314,7 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf ch_cnt_t inputs = qMin( m_inputCount, DEFAULT_CHANNELS ); - if( _in_buf != NULL && inputs > 0 ) + if( _in_buf != nullptr && inputs > 0 ) { if( m_splitChannels ) { @@ -347,7 +347,7 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf lock(); sendMessage( IdStartProcessing ); - if( m_failed || _out_buf == NULL || m_outputCount == 0 ) + if( m_failed || _out_buf == nullptr || m_outputCount == 0 ) { unlock(); return false; @@ -431,13 +431,13 @@ void RemotePlugin::hideUI() void RemotePlugin::resizeSharedProcessingMemory() { const size_t s = ( m_inputCount+m_outputCount ) * Engine::audioEngine()->framesPerPeriod() * sizeof( float ); - if( m_shm != NULL ) + if( m_shm != nullptr ) { #ifdef USE_QT_SHMEM m_shmObj.detach(); #else shmdt( m_shm ); - shmctl( m_shmID, IPC_RMID, NULL ); + shmctl( m_shmID, IPC_RMID, nullptr ); #endif } diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index 392a69364..949a4667b 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -108,7 +108,7 @@ SampleBuffer::SampleBuffer(const sampleFrame * data, const f_cnt_t frames) { if (frames > 0) { - m_origData = MM_ALLOC(sampleFrame, frames); + m_origData = MM_ALLOC( frames); memcpy(m_origData, data, frames * BYTES_PER_FRAME); m_origFrames = frames; update(); @@ -123,7 +123,7 @@ SampleBuffer::SampleBuffer(const f_cnt_t frames) { if (frames > 0) { - m_origData = MM_ALLOC(sampleFrame, frames); + m_origData = MM_ALLOC( frames); memset(m_origData, 0, frames * BYTES_PER_FRAME); m_origFrames = frames; update(); @@ -139,9 +139,9 @@ SampleBuffer::SampleBuffer(const SampleBuffer& orig) m_audioFile = orig.m_audioFile; m_origFrames = orig.m_origFrames; - m_origData = (m_origFrames > 0) ? MM_ALLOC(sampleFrame, m_origFrames) : nullptr; + m_origData = (m_origFrames > 0) ? MM_ALLOC( m_origFrames) : nullptr; m_frames = orig.m_frames; - m_data = (m_frames > 0) ? MM_ALLOC(sampleFrame, m_frames) : nullptr; + m_data = (m_frames > 0) ? MM_ALLOC( m_frames) : nullptr; m_startFrame = orig.m_startFrame; m_endFrame = orig.m_endFrame; m_loopStartFrame = orig.m_loopStartFrame; @@ -251,7 +251,7 @@ void SampleBuffer::update(bool keepSettings) { // TODO: reverse- and amplification-property is not covered // by following code... - m_data = MM_ALLOC(sampleFrame, m_origFrames); + m_data = MM_ALLOC( m_origFrames); memcpy(m_data, m_origData, m_origFrames * BYTES_PER_FRAME); if (keepSettings == false) { @@ -325,7 +325,7 @@ void SampleBuffer::update(bool keepSettings) { // sample couldn't be decoded, create buffer containing // one sample-frame - m_data = MM_ALLOC(sampleFrame, 1); + m_data = MM_ALLOC( 1); memset(m_data, 0, sizeof(*m_data)); m_frames = 1; m_loopStartFrame = m_startFrame = 0; @@ -340,7 +340,7 @@ void SampleBuffer::update(bool keepSettings) { // neither an audio-file nor a buffer to copy from, so create // buffer containing one sample-frame - m_data = MM_ALLOC(sampleFrame, 1); + m_data = MM_ALLOC( 1); memset(m_data, 0, sizeof(*m_data)); m_frames = 1; m_loopStartFrame = m_startFrame = 0; @@ -368,7 +368,7 @@ void SampleBuffer::update(bool keepSettings) QString message = tr("Audio files are limited to %1 MB " "in size and %2 minutes of playing time" ).arg(fileSizeMax).arg(sampleLengthMax); - if (gui) + if (getGUI() != nullptr) { QMessageBox::information(nullptr, title, message, QMessageBox::Ok); @@ -389,7 +389,7 @@ void SampleBuffer::convertIntToFloat( { // following code transforms int-samples into float-samples and does amplifying & reversing const float fac = 1 / OUTPUT_SAMPLE_MULTIPLIER; - m_data = MM_ALLOC(sampleFrame, frames); + m_data = MM_ALLOC( frames); const int ch = (channels > 1) ? 1 : 0; // if reversing is on, we also reverse when scaling @@ -412,7 +412,7 @@ void SampleBuffer::directFloatWrite( ) { - m_data = MM_ALLOC(sampleFrame, frames); + m_data = MM_ALLOC( frames); const int ch = (channels > 1) ? 1 : 0; // if reversing is on, we also reverse when scaling @@ -440,7 +440,7 @@ void SampleBuffer::normalizeSampleRate(const sample_rate_t srcSR, bool keepSetti m_sampleRate = audioEngineSampleRate(); MM_FREE(m_data); m_frames = resampled->frames(); - m_data = MM_ALLOC(sampleFrame, m_frames); + m_data = MM_ALLOC( m_frames); memcpy(m_data, resampled->data(), m_frames * sizeof(sampleFrame)); delete resampled; } @@ -906,7 +906,7 @@ sampleFrame * SampleBuffer::getSampleFragment( } } - *tmp = MM_ALLOC(sampleFrame, frames); + *tmp = MM_ALLOC( frames); if (loopMode == LoopOff) { @@ -1506,14 +1506,14 @@ void SampleBuffer::loadFromBase64(const QString & data) m_origFrames = origData.size() / sizeof(sampleFrame); MM_FREE(m_origData); - m_origData = MM_ALLOC(sampleFrame, m_origFrames); + m_origData = MM_ALLOC( m_origFrames); memcpy(m_origData, origData.data(), origData.size()); #else /* LMMS_HAVE_FLAC_STREAM_DECODER_H */ m_origFrames = dsize / sizeof(sampleFrame); MM_FREE(m_origData); - m_origData = MM_ALLOC(sampleFrame, m_origFrames); + m_origData = MM_ALLOC( m_origFrames); memcpy(m_origData, dst, dsize); #endif diff --git a/src/core/SamplePlayHandle.cpp b/src/core/SamplePlayHandle.cpp index b46607f05..3c38a858f 100644 --- a/src/core/SamplePlayHandle.cpp +++ b/src/core/SamplePlayHandle.cpp @@ -41,8 +41,8 @@ SamplePlayHandle::SamplePlayHandle( SampleBuffer* sampleBuffer , bool ownAudioPo m_ownAudioPort( ownAudioPort ), m_defaultVolumeModel( DefaultVolume, MinVolume, MaxVolume, 1 ), m_volumeModel( &m_defaultVolumeModel ), - m_track( NULL ), - m_bbTrack( NULL ) + m_track( nullptr ), + m_bbTrack( nullptr ) { if (ownAudioPort) { diff --git a/src/core/SampleRecordHandle.cpp b/src/core/SampleRecordHandle.cpp index 9da1163bf..a86d19b79 100644 --- a/src/core/SampleRecordHandle.cpp +++ b/src/core/SampleRecordHandle.cpp @@ -38,7 +38,7 @@ SampleRecordHandle::SampleRecordHandle( SampleTCO* tco ) : m_framesRecorded( 0 ), m_minLength( tco->length() ), m_track( tco->getTrack() ), - m_bbTrack( NULL ), + m_bbTrack( nullptr ), m_tco( tco ) { } @@ -117,7 +117,7 @@ void SampleRecordHandle::createSampleBuffer( SampleBuffer** sampleBuf ) sampleFrame * data_ptr = data; - assert( data != NULL ); + assert( data != nullptr ); // now copy all buffers into big buffer for( bufferList::const_iterator it = m_buffers.begin(); it != m_buffers.end(); ++it ) diff --git a/src/core/SerializingObject.cpp b/src/core/SerializingObject.cpp index 2d53d9b72..bc79eb920 100644 --- a/src/core/SerializingObject.cpp +++ b/src/core/SerializingObject.cpp @@ -29,7 +29,7 @@ SerializingObject::SerializingObject() : - m_hook( NULL ) + m_hook( nullptr ) { } @@ -40,7 +40,7 @@ SerializingObject::~SerializingObject() { if( m_hook ) { - m_hook->m_hookedIn = NULL; + m_hook->m_hookedIn = nullptr; } } @@ -82,7 +82,7 @@ void SerializingObject::setHook( SerializingObjectHook* hook ) { if( m_hook ) { - m_hook->m_hookedIn = NULL; + m_hook->m_hookedIn = nullptr; } m_hook = hook; diff --git a/src/core/Song.cpp b/src/core/Song.cpp index e09a89ef1..09c00d933 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -89,7 +89,7 @@ Song::Song() : m_isCancelled( false ), m_playMode( Mode_None ), m_length( 0 ), - m_patternToPlay( NULL ), + m_patternToPlay( nullptr ), m_loopPattern( false ), m_elapsedTicks( 0 ), m_elapsedBars( 0 ), @@ -187,7 +187,7 @@ void Song::savePos() { TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine; - if( tl != NULL ) + if( tl != nullptr ) { tl->savePos( m_playPos[m_playMode] ); } @@ -549,7 +549,7 @@ void Song::playPattern( const Pattern* patternToPlay, bool loop ) m_patternToPlay = patternToPlay; m_loopPattern = loop; - if( m_patternToPlay != NULL ) + if( m_patternToPlay != nullptr ) { m_playMode = Mode_PlayPattern; m_playing = true; @@ -866,17 +866,17 @@ void Song::clearProject() Engine::audioEngine()->requestChangeInModel(); - if( gui && gui->getBBEditor() ) + if( getGUI() != nullptr && getGUI()->getBBEditor() ) { - gui->getBBEditor()->trackContainerView()->clearAllTracks(); + getGUI()->getBBEditor()->trackContainerView()->clearAllTracks(); } - if( gui && gui->songEditor() ) + if( getGUI() != nullptr && getGUI()->songEditor() ) { - gui->songEditor()->m_editor->clearAllTracks(); + getGUI()->songEditor()->m_editor->clearAllTracks(); } - if( gui && gui->fxMixerView() ) + if( getGUI() != nullptr && getGUI()->fxMixerView() ) { - gui->fxMixerView()->clear(); + getGUI()->fxMixerView()->clear(); } QCoreApplication::sendPostedEvents(); Engine::getBBTrackContainer()->clearAllTracks(); @@ -884,14 +884,14 @@ void Song::clearProject() Engine::fxMixer()->clear(); - if( gui && gui->automationEditor() ) + if( getGUI() != nullptr && getGUI()->automationEditor() ) { - gui->automationEditor()->setCurrentPattern( NULL ); + getGUI()->automationEditor()->setCurrentPattern( nullptr ); } - if( gui && gui->pianoRoll() ) + if( getGUI() != nullptr && getGUI()->pianoRoll() ) { - gui->pianoRoll()->reset(); + getGUI()->pianoRoll()->reset(); } m_tempoModel.reset(); @@ -910,9 +910,9 @@ void Song::clearProject() Engine::audioEngine()->doneChangeInModel(); - if( gui && gui->getProjectNotes() ) + if( getGUI() != nullptr && getGUI()->getProjectNotes() ) { - gui->getProjectNotes()->clear(); + getGUI()->getProjectNotes()->clear(); } removeAllControllers(); @@ -1035,9 +1035,9 @@ void Song::loadProject( const QString & fileName ) { cantLoadProject = true; - if (gui) + if (getGUI() != nullptr) { - QMessageBox::critical(NULL, tr("Aborting project load"), + QMessageBox::critical(nullptr, tr("Aborting project load"), tr("Project file contains local paths to plugins, which could be used to " "run malicious code.")); } @@ -1093,10 +1093,10 @@ void Song::loadProject( const QString & fileName ) if( !node.isNull() ) { Engine::fxMixer()->restoreState( node.toElement() ); - if( gui ) + if( getGUI() != nullptr ) { // refresh FxMixerView - gui->fxMixerView()->refreshDisplay(); + getGUI()->fxMixerView()->refreshDisplay(); } } @@ -1142,23 +1142,23 @@ void Song::loadProject( const QString & fileName ) { restoreKeymapStates(node.toElement()); } - else if( gui ) + else if( getGUI() != nullptr ) { - if( node.nodeName() == gui->getControllerRackView()->nodeName() ) + if( node.nodeName() == getGUI()->getControllerRackView()->nodeName() ) { - gui->getControllerRackView()->restoreState( node.toElement() ); + getGUI()->getControllerRackView()->restoreState( node.toElement() ); } - else if( node.nodeName() == gui->pianoRoll()->nodeName() ) + else if( node.nodeName() == getGUI()->pianoRoll()->nodeName() ) { - gui->pianoRoll()->restoreState( node.toElement() ); + getGUI()->pianoRoll()->restoreState( node.toElement() ); } - else if( node.nodeName() == gui->automationEditor()->m_editor->nodeName() ) + else if( node.nodeName() == getGUI()->automationEditor()->m_editor->nodeName() ) { - gui->automationEditor()->m_editor->restoreState( node.toElement() ); + getGUI()->automationEditor()->m_editor->restoreState( node.toElement() ); } - else if( node.nodeName() == gui->getProjectNotes()->nodeName() ) + else if( node.nodeName() == getGUI()->getProjectNotes()->nodeName() ) { - gui->getProjectNotes()->SerializingObject::restoreState( node.toElement() ); + getGUI()->getProjectNotes()->SerializingObject::restoreState( node.toElement() ); } else if( node.nodeName() == m_playPos[Mode_PlaySong].m_timeLine->nodeName() ) { @@ -1203,9 +1203,9 @@ void Song::loadProject( const QString & fileName ) if ( hasErrors()) { - if ( gui ) + if ( getGUI() != nullptr ) { - QMessageBox::warning( NULL, tr("LMMS Error report"), errorSummary(), + QMessageBox::warning( nullptr, tr("LMMS Error report"), errorSummary(), QMessageBox::Ok ); } else @@ -1239,12 +1239,12 @@ bool Song::saveProjectFile(const QString & filename, bool withResources) m_globalAutomationTrack->saveState( dataFile, dataFile.content() ); Engine::fxMixer()->saveState( dataFile, dataFile.content() ); - if( gui ) + if( getGUI() != nullptr ) { - gui->getControllerRackView()->saveState( dataFile, dataFile.content() ); - gui->pianoRoll()->saveState( dataFile, dataFile.content() ); - gui->automationEditor()->m_editor->saveState( dataFile, dataFile.content() ); - gui->getProjectNotes()->SerializingObject::saveState( dataFile, dataFile.content() ); + getGUI()->getControllerRackView()->saveState( dataFile, dataFile.content() ); + 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() ); } diff --git a/src/core/StepRecorder.cpp b/src/core/StepRecorder.cpp index 1413d5050..bd117f549 100644 --- a/src/core/StepRecorder.cpp +++ b/src/core/StepRecorder.cpp @@ -269,7 +269,7 @@ void StepRecorder::prepareNewStep() void StepRecorder::setCurrentPattern( Pattern* newPattern ) { - if(m_pattern != NULL && m_pattern != newPattern) + if(m_pattern != nullptr && m_pattern != newPattern) { dismissStep(); } diff --git a/src/core/ToolPlugin.cpp b/src/core/ToolPlugin.cpp index 63ed4bf02..6c2b0fed7 100644 --- a/src/core/ToolPlugin.cpp +++ b/src/core/ToolPlugin.cpp @@ -43,7 +43,7 @@ ToolPlugin::~ToolPlugin() ToolPlugin * ToolPlugin::instantiate( const QString & _plugin_name, Model * _parent ) { - Plugin * p = Plugin::instantiate( _plugin_name, _parent, NULL ); + Plugin * p = Plugin::instantiate( _plugin_name, _parent, nullptr ); // check whether instantiated plugin is a tool if( p->type() == Plugin::Tool ) { @@ -53,6 +53,6 @@ ToolPlugin * ToolPlugin::instantiate( const QString & _plugin_name, Model * _par // not quite... so delete plugin delete p; - return NULL; + return nullptr; } diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 783d93471..a79a79c65 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -107,7 +107,7 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc ) { Engine::audioEngine()->requestChangeInModel(); - Track * t = NULL; + Track * t = nullptr; switch( tt ) { @@ -150,7 +150,7 @@ Track * Track::create( const QDomElement & element, TrackContainer * tc ) Track * t = create( static_cast( element.attribute( "type" ).toInt() ), tc ); - if( t != NULL ) + if( t != nullptr ) { t->restoreState( element ); } diff --git a/src/core/TrackContainer.cpp b/src/core/TrackContainer.cpp index 84846a77c..3995981c6 100644 --- a/src/core/TrackContainer.cpp +++ b/src/core/TrackContainer.cpp @@ -43,7 +43,7 @@ #include "TextFloat.h" TrackContainer::TrackContainer() : - Model( NULL ), + Model( nullptr ), JournallingObject(), m_tracksMutex(), m_tracks() @@ -86,16 +86,16 @@ void TrackContainer::loadSettings( const QDomElement & _this ) clearAllTracks(); } - static QProgressDialog * pd = NULL; - bool was_null = ( pd == NULL ); - if( !journalRestore && gui != nullptr ) + static QProgressDialog * pd = nullptr; + bool was_null = ( pd == nullptr ); + if( !journalRestore && getGUI() != nullptr ) { - if( pd == NULL ) + if( pd == nullptr ) { pd = new QProgressDialog( tr( "Loading project..." ), tr( "Cancel" ), 0, Engine::getSong()->getLoadingTrackCount(), - gui->mainWindow() ); + getGUI()->mainWindow() ); pd->setWindowModality( Qt::ApplicationModal ); pd->setWindowTitle( tr( "Please wait..." ) ); pd->show(); @@ -105,14 +105,14 @@ void TrackContainer::loadSettings( const QDomElement & _this ) QDomNode node = _this.firstChild(); while( !node.isNull() ) { - if( pd != NULL ) + if( pd != nullptr ) { pd->setValue( pd->value() + 1 ); QCoreApplication::instance()->processEvents( QEventLoop::AllEvents, 100 ); if( pd->wasCanceled() ) { - if ( gui ) + if ( getGUI() != nullptr ) { TextFloat::displayMessage( tr( "Loading cancelled" ), tr( "Project loading was cancelled." ), @@ -130,7 +130,7 @@ void TrackContainer::loadSettings( const QDomElement & _this ) QString trackName = node.toElement().hasAttribute( "name" ) ? node.toElement().attribute( "name" ) : node.firstChild().toElement().attribute( "name" ); - if( pd != NULL ) + if( pd != nullptr ) { pd->setLabelText( tr("Loading Track %1 (%2/Total %3)").arg( trackName ). arg( pd->value() + 1 ).arg( Engine::getSong()->getLoadingTrackCount() ) ); @@ -140,12 +140,12 @@ void TrackContainer::loadSettings( const QDomElement & _this ) node = node.nextSibling(); } - if( pd != NULL ) + if( pd != nullptr ) { if( was_null ) { delete pd; - pd = NULL; + pd = nullptr; } } } diff --git a/src/core/VstSyncController.cpp b/src/core/VstSyncController.cpp index 215c59788..9caa92e09 100644 --- a/src/core/VstSyncController.cpp +++ b/src/core/VstSyncController.cpp @@ -42,7 +42,7 @@ VstSyncController::VstSyncController() : - m_syncData( NULL ), + m_syncData( nullptr ), m_shmID( -1 ), m_shm( "/usr/bin/lmms" ) { @@ -87,7 +87,7 @@ VstSyncController::VstSyncController() : qWarning( "VST sync support disabled in your configuration" ); } - if( m_syncData == NULL ) + if( m_syncData == nullptr ) { m_syncData = new VstSyncData; m_syncData->hasSHM = false; @@ -124,7 +124,7 @@ VstSyncController::~VstSyncController() #else if( shmdt( m_syncData ) != -1 ) { - shmctl( m_shmID, IPC_RMID, NULL ); + shmctl( m_shmID, IPC_RMID, nullptr ); } else { diff --git a/src/core/audio/AudioAlsa.cpp b/src/core/audio/AudioAlsa.cpp index 549c05d55..83c64f46c 100644 --- a/src/core/audio/AudioAlsa.cpp +++ b/src/core/audio/AudioAlsa.cpp @@ -41,9 +41,9 @@ AudioAlsa::AudioAlsa( bool & _success_ful, AudioEngine* _audioEngine ) : DEFAULT_CHANNELS, ConfigManager::inst()->value( "audioalsa", "channels" ).toInt(), SURROUND_CHANNELS ), _audioEngine ), - m_handle( NULL ), - m_hwParams( NULL ), - m_swParams( NULL ), + m_handle( nullptr ), + m_hwParams( nullptr ), + m_swParams( nullptr ), m_convertEndian( false ) { _success_ful = false; @@ -107,17 +107,17 @@ AudioAlsa::AudioAlsa( bool & _success_ful, AudioEngine* _audioEngine ) : AudioAlsa::~AudioAlsa() { stopProcessing(); - if( m_handle != NULL ) + if( m_handle != nullptr ) { snd_pcm_close( m_handle ); } - if( m_hwParams != NULL ) + if( m_hwParams != nullptr ) { snd_pcm_hw_params_free( m_hwParams ); } - if( m_swParams != NULL ) + if( m_swParams != nullptr ) { snd_pcm_sw_params_free( m_swParams ); } @@ -131,7 +131,7 @@ QString AudioAlsa::probeDevice() QString dev = ConfigManager::inst()->value( "audioalsa", "device" ); if( dev == "" ) { - if( getenv( "AUDIODEV" ) != NULL ) + if( getenv( "AUDIODEV" ) != nullptr ) { return getenv( "AUDIODEV" ); } @@ -171,7 +171,7 @@ AudioAlsa::DeviceInfoCollection AudioAlsa::getAvailableDevices() } char** n = hints; - while (*n != NULL) + while (*n != nullptr) { char *name = snd_device_name_get_hint(*n, "NAME"); char *description = snd_device_name_get_hint(*n, "DESC"); @@ -257,7 +257,7 @@ void AudioAlsa::applyQualitySettings() { setSampleRate( Engine::audioEngine()->processingSampleRate() ); - if( m_handle != NULL ) + if( m_handle != nullptr ) { snd_pcm_close( m_handle ); } diff --git a/src/core/audio/AudioDevice.cpp b/src/core/audio/AudioDevice.cpp index c0d3688a9..bc25f9ba8 100644 --- a/src/core/audio/AudioDevice.cpp +++ b/src/core/audio/AudioDevice.cpp @@ -41,7 +41,7 @@ AudioDevice::AudioDevice( const ch_cnt_t _channels, AudioEngine* _audioEngine ) int error; if( ( m_srcState = src_new( audioEngine()->currentQualitySettings().libsrcInterpolation(), - SURROUND_CHANNELS, &error ) ) == NULL ) + SURROUND_CHANNELS, &error ) ) == nullptr ) { printf( "Error: src_new() failed in audio_device.cpp!\n" ); } @@ -151,7 +151,7 @@ void AudioDevice::applyQualitySettings() int error; if( ( m_srcState = src_new( audioEngine()->currentQualitySettings().libsrcInterpolation(), - SURROUND_CHANNELS, &error ) ) == NULL ) + SURROUND_CHANNELS, &error ) ) == nullptr ) { printf( "Error: src_new() failed in audio_device.cpp!\n" ); } @@ -187,7 +187,7 @@ fpp_t AudioDevice::resample( const surroundSampleFrame * _src, const sample_rate_t _src_sr, const sample_rate_t _dst_sr ) { - if( m_srcState == NULL ) + if( m_srcState == nullptr ) { return _frames; } @@ -253,7 +253,7 @@ int AudioDevice::convertToS16( const surroundSampleFrame * _ab, void AudioDevice::clearS16Buffer( int_sample_t * _outbuf, const fpp_t _frames ) { - assert( _outbuf != NULL ); + assert( _outbuf != nullptr ); memset( _outbuf, 0, _frames * channels() * BYTES_PER_INT_SAMPLE ); } diff --git a/src/core/audio/AudioFileDevice.cpp b/src/core/audio/AudioFileDevice.cpp index 62f5871e7..e7d78bc36 100644 --- a/src/core/audio/AudioFileDevice.cpp +++ b/src/core/audio/AudioFileDevice.cpp @@ -52,9 +52,9 @@ AudioFileDevice::AudioFileDevice( OutputSettings const & outputSettings, "file and try again!" ).arg( _file ); - if( gui ) + if( getGUI() != nullptr ) { - QMessageBox::critical( NULL, title, message, + QMessageBox::critical( nullptr, title, message, QMessageBox::Ok, QMessageBox::NoButton ); } diff --git a/src/core/audio/AudioFileOgg.cpp b/src/core/audio/AudioFileOgg.cpp index 3024789b2..d9aa8b4f0 100644 --- a/src/core/audio/AudioFileOgg.cpp +++ b/src/core/audio/AudioFileOgg.cpp @@ -81,7 +81,7 @@ bool AudioFileOgg::startEncoding() vc.user_comments = &user_comments; vc.comment_lengths = &comment_length; vc.comments = 1; - vc.vendor = NULL; + vc.vendor = nullptr; m_channels = channels(); @@ -122,11 +122,11 @@ bool AudioFileOgg::startEncoding() if( useVariableBitRate ) { // Turn off management entirely (if it was turned on). - vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_SET, NULL ); + vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_SET, nullptr ); } else { - vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_AVG, NULL ); + vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_AVG, nullptr ); } vorbis_encode_setup_init( &m_vi ); @@ -210,7 +210,7 @@ void AudioFileOgg::writeBuffer( const surroundSampleFrame * _ab, while( vorbis_analysis_blockout( &m_vd, &m_vb ) == 1 ) { // Do the main analysis, creating a packet - vorbis_analysis( &m_vb, NULL ); + vorbis_analysis( &m_vb, nullptr ); vorbis_bitrate_addblock( &m_vb ); while( vorbis_bitrate_flushpacket( &m_vd, &m_op ) ) @@ -256,7 +256,7 @@ void AudioFileOgg::finishEncoding() if( m_ok ) { // just for flushing buffers... - writeBuffer( NULL, 0, 0.0f ); + writeBuffer( nullptr, 0, 0.0f ); // clean up ogg_stream_clear( &m_os ); diff --git a/src/core/audio/AudioFileWave.cpp b/src/core/audio/AudioFileWave.cpp index 6d2f7f771..94b84c0da 100644 --- a/src/core/audio/AudioFileWave.cpp +++ b/src/core/audio/AudioFileWave.cpp @@ -36,7 +36,7 @@ AudioFileWave::AudioFileWave( OutputSettings const & outputSettings, const QString & file, AudioEngine* audioEngine ) : AudioFileDevice( outputSettings, channels, file, audioEngine ), - m_sf( NULL ) + m_sf( nullptr ) { successful = outputFileOpened() && startEncoding(); } @@ -86,7 +86,7 @@ bool AudioFileWave::startEncoding() } // Prevent fold overs when encountering clipped data - sf_command(m_sf, SFC_SET_CLIPPING, NULL, SF_TRUE); + sf_command(m_sf, SFC_SET_CLIPPING, nullptr, SF_TRUE); sf_set_string ( m_sf, SF_STR_SOFTWARE, "LMMS" ); diff --git a/src/core/audio/AudioJack.cpp b/src/core/audio/AudioJack.cpp index 50053c7f6..aac1cda8e 100644 --- a/src/core/audio/AudioJack.cpp +++ b/src/core/audio/AudioJack.cpp @@ -47,9 +47,9 @@ AudioJack::AudioJack( bool & _success_ful, AudioEngine* _audioEngine ) : DEFAULT_CHANNELS, ConfigManager::inst()->value( "audiojack", "channels" ).toInt(), SURROUND_CHANNELS ), _audioEngine ), - m_client( NULL ), + m_client( nullptr ), m_active( false ), - m_midiClient( NULL ), + m_midiClient( nullptr ), m_tempOutBufs( new jack_default_audio_sample_t *[channels()] ), m_outBuf( new surroundSampleFrame[audioEngine()->framesPerPeriod()] ), m_framesDoneInCurBuf( 0 ), @@ -80,7 +80,7 @@ AudioJack::~AudioJack() } #endif - if( m_client != NULL ) + if( m_client != nullptr ) { if( m_active ) { @@ -103,7 +103,7 @@ void AudioJack::restartAfterZombified() { m_active = false; startProcessing(); - QMessageBox::information( gui->mainWindow(), + QMessageBox::information( getGUI()->mainWindow(), tr( "JACK client restarted" ), tr( "LMMS was kicked by JACK for some reason. " "Therefore the JACK backend of LMMS has been " @@ -112,7 +112,7 @@ void AudioJack::restartAfterZombified() } else { - QMessageBox::information( gui->mainWindow(), + QMessageBox::information( getGUI()->mainWindow(), tr( "JACK server down" ), tr( "The JACK server seems to have been shutdown " "and starting a new instance failed. " @@ -126,8 +126,8 @@ void AudioJack::restartAfterZombified() AudioJack* AudioJack::addMidiClient(MidiJack *midiClient) { - if( m_client == NULL ) - return NULL; + if( m_client == nullptr ) + return nullptr; m_midiClient = midiClient; @@ -143,12 +143,12 @@ bool AudioJack::initJackClient() clientName = "lmms"; } - const char * serverName = NULL; + const char * serverName = nullptr; jack_status_t status; m_client = jack_client_open( clientName.toLatin1().constData(), JackNullOption, &status, serverName ); - if( m_client == NULL ) + if( m_client == nullptr ) { printf( "jack_client_open() failed, status 0x%2.0x\n", status ); if( status & JackServerFailed ) @@ -187,7 +187,7 @@ bool AudioJack::initJackClient() name.toLatin1().constData(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0 ) ); - if( m_outputPorts.back() == NULL ) + if( m_outputPorts.back() == nullptr ) { printf( "no more JACK-ports available!\n" ); return false; @@ -202,7 +202,7 @@ bool AudioJack::initJackClient() void AudioJack::startProcessing() { - if( m_active || m_client == NULL ) + if( m_active || m_client == nullptr ) { m_stopped = false; return; @@ -222,10 +222,10 @@ void AudioJack::startProcessing() - const char * * ports = jack_get_ports( m_client, NULL, NULL, + const char * * ports = jack_get_ports( m_client, nullptr, nullptr, JackPortIsPhysical | JackPortIsInput ); - if( ports == NULL ) + if( ports == nullptr ) { printf( "no physical playback ports. you'll have to do " "connections at your own!\n" ); @@ -306,7 +306,7 @@ void AudioJack::unregisterPort( AudioPort * _port ) { for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch ) { - if( m_portMap[_port].ports[ch] != NULL ) + if( m_portMap[_port].ports[ch] != nullptr ) { jack_port_unregister( m_client, m_portMap[_port].ports[ch] ); @@ -369,7 +369,7 @@ int AudioJack::processCallback( jack_nframes_t _nframes, void * _udata ) { for( ch_cnt_t ch = 0; ch < channels(); ++ch ) { - if( it.value().ports[ch] == NULL ) + if( it.value().ports[ch] == nullptr ) { continue; } @@ -442,7 +442,7 @@ int AudioJack::staticProcessCallback( jack_nframes_t _nframes, void * _udata ) void AudioJack::shutdownCallback( void * _udata ) { AudioJack * _this = static_cast( _udata ); - _this->m_client = NULL; + _this->m_client = nullptr; _this->zombified(); } diff --git a/src/core/audio/AudioOss.cpp b/src/core/audio/AudioOss.cpp index 7de9d259f..76df85adc 100644 --- a/src/core/audio/AudioOss.cpp +++ b/src/core/audio/AudioOss.cpp @@ -58,12 +58,11 @@ #include "ConfigManager.h" -#ifndef _PATH_DEV_DSP +static const QString PATH_DEV_DSP = #if defined(__NetBSD__) || defined(__OpenBSD__) -#define _PATH_DEV_DSP "/dev/audio" +"/dev/audio"; #else -#define _PATH_DEV_DSP "/dev/dsp" -#endif +"/dev/dsp"; #endif @@ -204,13 +203,13 @@ QString AudioOss::probeDevice() { char * adev = getenv( "AUDIODEV" ); // Is there a standard // variable name? - if( adev != NULL ) + if( adev != nullptr ) { dev = adev; } else { - dev = _PATH_DEV_DSP; // default device + dev = PATH_DEV_DSP; // default device } } @@ -220,10 +219,10 @@ QString AudioOss::probeDevice() int instance = -1; while( 1 ) { - dev = _PATH_DEV_DSP + QString::number( ++instance ); + dev = PATH_DEV_DSP + QString::number( ++instance ); if( !QFileInfo( dev ).exists() ) { - dev = _PATH_DEV_DSP; + dev = PATH_DEV_DSP; break; } if( QFileInfo( dev ).isWritable() ) diff --git a/src/core/audio/AudioPort.cpp b/src/core/audio/AudioPort.cpp index 969f4b9f0..e3c4569f0 100644 --- a/src/core/audio/AudioPort.cpp +++ b/src/core/audio/AudioPort.cpp @@ -40,7 +40,7 @@ AudioPort::AudioPort( const QString & _name, bool _has_effect_chain, m_extOutputEnabled( false ), m_nextFxChannel( 0 ), m_name( "unnamed port" ), - m_effects( _has_effect_chain ? new EffectChain( NULL ) : NULL ), + m_effects( _has_effect_chain ? new EffectChain( nullptr ) : nullptr ), m_volumeModel( volumeModel ), m_panningModel( panningModel ), m_mutedModel( mutedModel ) diff --git a/src/core/audio/AudioPortAudio.cpp b/src/core/audio/AudioPortAudio.cpp index 4a73173ec..2bd2874c7 100644 --- a/src/core/audio/AudioPortAudio.cpp +++ b/src/core/audio/AudioPortAudio.cpp @@ -57,7 +57,7 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, AudioEngine * _audioEngine DEFAULT_CHANNELS, ConfigManager::inst()->value( "audioportaudio", "channels" ).toInt(), SURROUND_CHANNELS ), _audioEngine ), - m_paStream( NULL ), + m_paStream( nullptr ), m_wasPAInitError( false ), m_outBuf( new surroundSampleFrame[audioEngine()->framesPerPeriod()] ), m_outBufPos( 0 ) @@ -123,19 +123,19 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, AudioEngine * _audioEngine m_outputParameters.channelCount = channels(); m_outputParameters.sampleFormat = paFloat32; // 32 bit floating point output m_outputParameters.suggestedLatency = outLatency; - m_outputParameters.hostApiSpecificStreamInfo = NULL; + m_outputParameters.hostApiSpecificStreamInfo = nullptr; // Configure input parameters. m_inputParameters.device = inDevIdx; m_inputParameters.channelCount = DEFAULT_CHANNELS; m_inputParameters.sampleFormat = paFloat32; // 32 bit floating point input m_inputParameters.suggestedLatency = inLatency; - m_inputParameters.hostApiSpecificStreamInfo = NULL; + m_inputParameters.hostApiSpecificStreamInfo = nullptr; // Open an audio I/O stream. err = Pa_OpenStream( &m_paStream, - supportsCapture() ? &m_inputParameters : NULL, // The input parameter + supportsCapture() ? &m_inputParameters : nullptr, // The input parameter &m_outputParameters, // The outputparameter sampleRate(), samples, @@ -151,7 +151,7 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, AudioEngine * _audioEngine setSampleRate( 48000 ); err = Pa_OpenStream( &m_paStream, - supportsCapture() ? &m_inputParameters : NULL, // The input parameter + supportsCapture() ? &m_inputParameters : nullptr, // The input parameter &m_outputParameters, // The outputparameter sampleRate(), samples, @@ -234,7 +234,7 @@ void AudioPortAudio::applyQualitySettings() PaError err = Pa_OpenStream( &m_paStream, - supportsCapture() ? &m_inputParameters : NULL, // The input parameter + supportsCapture() ? &m_inputParameters : nullptr, // The input parameter &m_outputParameters, // The outputparameter sampleRate(), samples, diff --git a/src/core/audio/AudioPulseAudio.cpp b/src/core/audio/AudioPulseAudio.cpp index a384c46e5..5f82b64dc 100644 --- a/src/core/audio/AudioPulseAudio.cpp +++ b/src/core/audio/AudioPulseAudio.cpp @@ -49,7 +49,7 @@ AudioPulseAudio::AudioPulseAudio( bool & _success_ful, AudioEngine* _audioEngin DEFAULT_CHANNELS, ConfigManager::inst()->value( "audiopa", "channels" ).toInt(), SURROUND_CHANNELS ), _audioEngine ), - m_s( NULL ), + m_s( nullptr ), m_quit( false ), m_convertEndian( false ) { @@ -78,7 +78,7 @@ QString AudioPulseAudio::probeDevice() QString dev = ConfigManager::inst()->value( "audiopa", "device" ); if( dev.isEmpty() ) { - if( getenv( "AUDIODEV" ) != NULL ) + if( getenv( "AUDIODEV" ) != nullptr ) { return getenv( "AUDIODEV" ); } @@ -161,7 +161,7 @@ static void context_state_callback(pa_context *c, void *userdata) case PA_CONTEXT_READY: { qDebug( "Connection established.\n" ); - _this->m_s = pa_stream_new( c, "lmms", &_this->m_sampleSpec, NULL); + _this->m_s = pa_stream_new( c, "lmms", &_this->m_sampleSpec, nullptr); pa_stream_set_state_callback( _this->m_s, stream_state_callback, _this ); pa_stream_set_write_callback( _this->m_s, stream_write_callback, _this ); @@ -181,10 +181,10 @@ static void context_state_callback(pa_context *c, void *userdata) buffer_attr.tlength = pa_usec_to_bytes( latency * PA_USEC_PER_MSEC, &_this->m_sampleSpec ); - pa_stream_connect_playback( _this->m_s, NULL, &buffer_attr, + pa_stream_connect_playback( _this->m_s, nullptr, &buffer_attr, PA_STREAM_ADJUST_LATENCY, - NULL, // volume - NULL ); + nullptr, // volume + nullptr ); _this->signalConnected( true ); break; } @@ -213,7 +213,7 @@ void AudioPulseAudio::run() pa_mainloop_api * mainloop_api = pa_mainloop_get_api( mainLoop ); pa_context *context = pa_context_new( mainloop_api, "lmms" ); - if ( context == NULL ) + if ( context == nullptr ) { qCritical( "pa_context_new() failed." ); return; @@ -223,10 +223,10 @@ void AudioPulseAudio::run() pa_context_set_state_callback( context, context_state_callback, this ); // connect the context - pa_context_connect( context, NULL, (pa_context_flags) 0, NULL ); + pa_context_connect( context, nullptr, (pa_context_flags) 0, nullptr ); while (!m_connectedSemaphore.tryAcquire()) { - pa_mainloop_iterate(mainLoop, 1, NULL); + pa_mainloop_iterate(mainLoop, 1, nullptr); } // run the main loop @@ -282,7 +282,7 @@ void AudioPulseAudio::streamWriteCallback( pa_stream *s, size_t length ) m_convertEndian ); if( bytes > 0 ) { - pa_stream_write( m_s, pcmbuf, bytes, NULL, 0, + pa_stream_write( m_s, pcmbuf, bytes, nullptr, 0, PA_SEEK_RELATIVE ); } fd += frames; diff --git a/src/core/audio/AudioSampleRecorder.cpp b/src/core/audio/AudioSampleRecorder.cpp index 1e7090694..a33308c99 100644 --- a/src/core/audio/AudioSampleRecorder.cpp +++ b/src/core/audio/AudioSampleRecorder.cpp @@ -77,7 +77,7 @@ void AudioSampleRecorder::createSampleBuffer( SampleBuffer** sampleBuf ) sampleFrame * data_ptr = data; - assert( data != NULL ); + assert( data != nullptr ); // now copy all buffers into big buffer for( BufferList::ConstIterator it = m_buffers.begin(); diff --git a/src/core/audio/AudioSdl.cpp b/src/core/audio/AudioSdl.cpp index ffea3cb66..50991642c 100644 --- a/src/core/audio/AudioSdl.cpp +++ b/src/core/audio/AudioSdl.cpp @@ -75,7 +75,7 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) : SDL_AudioSpec actual; #ifdef LMMS_HAVE_SDL2 - m_outputDevice = SDL_OpenAudioDevice (NULL, + m_outputDevice = SDL_OpenAudioDevice (nullptr, 0, &m_audioHandle, &actual, @@ -105,7 +105,7 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) : m_inputAudioHandle = m_audioHandle; m_inputAudioHandle.callback = sdlInputAudioCallback; - m_inputDevice = SDL_OpenAudioDevice (NULL, + m_inputDevice = SDL_OpenAudioDevice (nullptr, 1, &m_inputAudioHandle, &actual, diff --git a/src/core/audio/AudioSndio.cpp b/src/core/audio/AudioSndio.cpp index 7d9098734..4bd978744 100644 --- a/src/core/audio/AudioSndio.cpp +++ b/src/core/audio/AudioSndio.cpp @@ -61,14 +61,14 @@ AudioSndio::AudioSndio(bool & _success_ful, AudioEngine * _audioEngine) : if (dev == "") { - m_hdl = sio_open( NULL, SIO_PLAY, 0 ); + m_hdl = sio_open( nullptr, SIO_PLAY, 0 ); } else { m_hdl = sio_open( dev.toLatin1().constData(), SIO_PLAY, 0 ); } - if( m_hdl == NULL ) + if( m_hdl == nullptr ) { printf( "sndio: failed opening audio-device\n" ); return; @@ -123,10 +123,10 @@ AudioSndio::AudioSndio(bool & _success_ful, AudioEngine * _audioEngine) : AudioSndio::~AudioSndio() { stopProcessing(); - if (m_hdl != NULL) + if (m_hdl != nullptr) { sio_close( m_hdl ); - m_hdl = NULL; + m_hdl = nullptr; } } diff --git a/src/core/audio/AudioSoundIo.cpp b/src/core/audio/AudioSoundIo.cpp index 80dd03cb0..c8ef04542 100644 --- a/src/core/audio/AudioSoundIo.cpp +++ b/src/core/audio/AudioSoundIo.cpp @@ -43,9 +43,9 @@ AudioSoundIo::AudioSoundIo( bool & outSuccessful, AudioEngine * _audioEngine ) : SURROUND_CHANNELS ), _audioEngine ) { outSuccessful = false; - m_soundio = NULL; - m_outstream = NULL; - m_outBuf = NULL; + m_soundio = nullptr; + m_outstream = nullptr; + m_outBuf = nullptr; m_disconnectErr = 0; m_outBufFrameIndex = 0; m_outBufFramesTotal = 0; @@ -206,7 +206,7 @@ AudioSoundIo::~AudioSoundIo() if (m_soundio) { soundio_destroy(m_soundio); - m_soundio = NULL; + m_soundio = nullptr; } } @@ -261,7 +261,7 @@ void AudioSoundIo::stopProcessing() if (m_outBuf) { delete[] m_outBuf; - m_outBuf = NULL; + m_outBuf = nullptr; } } @@ -503,7 +503,7 @@ AudioSoundIo::setupWidget::~setupWidget() if (m_soundio) { soundio_destroy(m_soundio); - m_soundio = NULL; + m_soundio = nullptr; } } diff --git a/src/core/base64.cpp b/src/core/base64.cpp index 4fb3008d9..c04300dcf 100644 --- a/src/core/base64.cpp +++ b/src/core/base64.cpp @@ -34,7 +34,7 @@ namespace base64 QVariant decode( const QString & _b64, QVariant::Type _force_type ) { - char * dst = NULL; + char * dst = nullptr; int dsize = 0; base64::decode( _b64, &dst, &dsize ); QByteArray ba( dst, dsize ); diff --git a/src/core/fft_helpers.cpp b/src/core/fft_helpers.cpp index 0dcf77e3a..9e49c5544 100644 --- a/src/core/fft_helpers.cpp +++ b/src/core/fft_helpers.cpp @@ -35,7 +35,7 @@ */ float maximum(const float *abs_spectrum, unsigned int spec_size) { - if (abs_spectrum == NULL) {return -1;} + if (abs_spectrum == nullptr) {return -1;} if (spec_size == 0) {return -1;} float maxi = 0; @@ -60,7 +60,7 @@ float maximum(const std::vector &abs_spectrum) */ int normalize(const float *abs_spectrum, float *norm_spectrum, unsigned int bin_count, unsigned int block_size) { - if (abs_spectrum == NULL || norm_spectrum == NULL) {return -1;} + if (abs_spectrum == nullptr || norm_spectrum == nullptr) {return -1;} if (bin_count == 0 || block_size == 0) {return -1;} block_size /= 2; @@ -100,7 +100,7 @@ int notEmpty(const std::vector &spectrum) */ int precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool normalized) { - if (window == NULL) {return -1;} + if (window == nullptr) {return -1;} float gain = 0; float a0; @@ -162,7 +162,7 @@ int precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool */ int absspec(const fftwf_complex *complex_buffer, float *absspec_buffer, unsigned int compl_length) { - if (complex_buffer == NULL || absspec_buffer == NULL) {return -1;} + if (complex_buffer == nullptr || absspec_buffer == nullptr) {return -1;} if (compl_length == 0) {return -1;} for (unsigned int i = 0; i < compl_length; i++) @@ -183,7 +183,7 @@ int absspec(const fftwf_complex *complex_buffer, float *absspec_buffer, unsigned */ int compressbands(const float *absspec_buffer, float *compressedband, int num_old, int num_new, int bottom, int top) { - if (absspec_buffer == NULL || compressedband == NULL) {return -1;} + if (absspec_buffer == nullptr || compressedband == nullptr) {return -1;} if (num_old < num_new) {return -1;} if (num_old <= 0 || num_new <= 0) {return -1;} if (bottom < 0) {bottom = 0;} diff --git a/src/core/lv2/Lv2Evbuf.cpp b/src/core/lv2/Lv2Evbuf.cpp index 335dfd362..0c9081815 100644 --- a/src/core/lv2/Lv2Evbuf.cpp +++ b/src/core/lv2/Lv2Evbuf.cpp @@ -144,7 +144,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter, uint8_t** data) { *frames = *type = *size = 0; - *data = NULL; + *data = nullptr; if (!lv2_evbuf_is_valid(iter)) { return false; diff --git a/src/core/main.cpp b/src/core/main.cpp index e9171505d..9912d2348 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -148,7 +148,7 @@ void printVersion( char *executableName ) "License as published by the Free Software Foundation; either\n" "version 2 of the License, or (at your option) any later version.\n\n" "Try \"%s --help\" for more information.\n\n", LMMS_VERSION, - PLATFORM, MACHINE, QT_VERSION_STR, COMPILER_VERSION, + LMMS_BUILDCONF_PLATFORM, LMMS_BUILDCONF_MACHINE, QT_VERSION_STR, LMMS_BUILDCONF_COMPILER_VERSION, LMMS_PROJECT_COPYRIGHT, executableName ); } @@ -793,7 +793,7 @@ int main( int argc, char * * argv ) { fprintf( stderr, "Signal initialization failed.\n" ); } - if ( sigaction( SIGPIPE, &sa, NULL ) ) + if ( sigaction( SIGPIPE, &sa, nullptr ) ) { fprintf( stderr, "Signal initialization failed.\n" ); } @@ -928,12 +928,12 @@ int main( int argc, char * * argv ) mb.exec(); if( mb.clickedButton() == discard ) { - gui->mainWindow()->sessionCleanup(); + getGUI()->mainWindow()->sessionCleanup(); } else if( mb.clickedButton() == recover ) // Recover { fileToLoad = recoveryFile; - gui->mainWindow()->setSession( MainWindow::SessionState::Recover ); + getGUI()->mainWindow()->setSession( MainWindow::SessionState::Recover ); } else // Exit { @@ -945,10 +945,10 @@ int main( int argc, char * * argv ) // [Settel] workaround: showMaximized() doesn't work with // FVWM2 unless the window is already visible -> show() first - gui->mainWindow()->show(); + getGUI()->mainWindow()->show(); if( fullscreen ) { - gui->mainWindow()->showMaximized(); + getGUI()->mainWindow()->showMaximized(); } // Handle macOS-style FileOpen QEvents @@ -1008,7 +1008,7 @@ int main( int argc, char * * argv ) // instances of LMMS. if( autoSaveEnabled ) { - gui->mainWindow()->autoSaveTimerReset(); + getGUI()->mainWindow()->autoSaveTimerReset(); } } diff --git a/src/core/midi/MidiAlsaRaw.cpp b/src/core/midi/MidiAlsaRaw.cpp index b6ebdcdbd..a4fcae19e 100644 --- a/src/core/midi/MidiAlsaRaw.cpp +++ b/src/core/midi/MidiAlsaRaw.cpp @@ -45,7 +45,7 @@ MidiAlsaRaw::MidiAlsaRaw() : return; } - snd_rawmidi_read( m_input, NULL, 0 ); + snd_rawmidi_read( m_input, nullptr, 0 ); snd_rawmidi_nonblock( m_input, 1 ); m_npfds = snd_rawmidi_poll_descriptors_count( m_input ); @@ -80,7 +80,7 @@ QString MidiAlsaRaw::probeDevice() QString dev = ConfigManager::inst()->value( "MidiAlsaRaw", "device" ); if( dev == "" ) { - if( getenv( "MIDIDEV" ) != NULL ) + if( getenv( "MIDIDEV" ) != nullptr ) { return getenv( "MIDIDEV" ); } diff --git a/src/core/midi/MidiAlsaSeq.cpp b/src/core/midi/MidiAlsaSeq.cpp index 5dfe346fc..c47dcf6cf 100644 --- a/src/core/midi/MidiAlsaSeq.cpp +++ b/src/core/midi/MidiAlsaSeq.cpp @@ -71,7 +71,7 @@ static QString portName( snd_seq_t * _seq, const snd_seq_addr_t * _addr ) MidiAlsaSeq::MidiAlsaSeq() : MidiClient(), m_seqMutex(), - m_seqHandle( NULL ), + m_seqHandle( nullptr ), m_queueID( -1 ), m_quit( false ), m_portListUpdateTimer( this ) @@ -97,7 +97,7 @@ MidiAlsaSeq::MidiAlsaSeq() : snd_seq_set_queue_tempo( m_seqHandle, m_queueID, tempo ); snd_seq_queue_tempo_free( tempo ); - snd_seq_start_queue( m_seqHandle, m_queueID, NULL ); + snd_seq_start_queue( m_seqHandle, m_queueID, nullptr ); changeQueueTempo( Engine::getSong()->getTempo() ); connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( changeQueueTempo( bpm_t ) ), Qt::DirectConnection ); @@ -130,7 +130,7 @@ MidiAlsaSeq::~MidiAlsaSeq() wait( EventPollTimeOut*2 ); m_seqMutex.lock(); - snd_seq_stop_queue( m_seqHandle, m_queueID, NULL ); + snd_seq_stop_queue( m_seqHandle, m_queueID, nullptr ); snd_seq_free_queue( m_seqHandle, m_queueID ); snd_seq_close( m_seqHandle ); m_seqMutex.unlock(); @@ -145,7 +145,7 @@ QString MidiAlsaSeq::probeDevice() QString dev = ConfigManager::inst()->value( "Midialsaseq", "device" ); if( dev.isEmpty() ) { - if( getenv( "MIDIDEV" ) != NULL ) + if( getenv( "MIDIDEV" ) != nullptr ) { return getenv( "MIDIDEV" ); } @@ -505,8 +505,8 @@ void MidiAlsaSeq::run() } m_seqMutex.unlock(); - snd_seq_addr_t * source = NULL; - MidiPort * dest = NULL; + snd_seq_addr_t * source = nullptr; + MidiPort * dest = nullptr; for( int i = 0; i < m_portIDs.size(); ++i ) { if( m_portIDs.values()[i][0] == ev->dest.port ) @@ -521,7 +521,7 @@ void MidiAlsaSeq::run() } } - if( dest == NULL ) + if( dest == nullptr ) { continue; } @@ -622,7 +622,7 @@ void MidiAlsaSeq::changeQueueTempo( bpm_t _bpm ) m_seqMutex.lock(); snd_seq_change_queue_tempo( m_seqHandle, m_queueID, - 60000000 / (int) _bpm, NULL ); + 60000000 / (int) _bpm, nullptr ); snd_seq_drain_output( m_seqHandle ); m_seqMutex.unlock(); diff --git a/src/core/midi/MidiController.cpp b/src/core/midi/MidiController.cpp index 43e30a077..051ab978a 100644 --- a/src/core/midi/MidiController.cpp +++ b/src/core/midi/MidiController.cpp @@ -151,7 +151,7 @@ QString MidiController::nodeName() const ControllerDialog * MidiController::createDialog( QWidget * _parent ) { - return NULL; + return nullptr; } diff --git a/src/core/midi/MidiJack.cpp b/src/core/midi/MidiJack.cpp index 55cbbbece..c6e687343 100644 --- a/src/core/midi/MidiJack.cpp +++ b/src/core/midi/MidiJack.cpp @@ -56,14 +56,14 @@ static void JackMidiShutdown(void *arg) QString msg_short = MidiJack::tr("JACK server down"); //: When JACK(JACK Audio Connection Kit) disconnects, it will show the following message (dialog message) QString msg_long = MidiJack::tr("The JACK server seems to be shuted down."); - QMessageBox::information( gui->mainWindow(), msg_short, msg_long ); + QMessageBox::information( getGUI()->mainWindow(), msg_short, msg_long ); } MidiJack::MidiJack() : MidiClientRaw(), m_jackClient( nullptr ), - m_input_port( NULL ), - m_output_port( NULL ), + m_input_port( nullptr ), + m_output_port( nullptr ), m_quit( false ) { // if jack is currently used for audio then we share the connection @@ -77,9 +77,9 @@ MidiJack::MidiJack() : // if a jack connection has been created for audio we use that m_jackAudio->addMidiClient(this); }else{ - m_jackAudio = NULL; + m_jackAudio = nullptr; m_jackClient = jack_client_open(probeDevice().toLatin1().data(), - JackNoStartServer, NULL); + JackNoStartServer, nullptr); if(m_jackClient) { @@ -155,10 +155,10 @@ MidiJack::~MidiJack() jack_client_t* MidiJack::jackClient() { - if( m_jackAudio == NULL && m_jackClient == NULL) - return NULL; + if( m_jackAudio == nullptr && m_jackClient == nullptr) + return nullptr; - if( m_jackAudio == NULL && m_jackClient ) + if( m_jackAudio == nullptr && m_jackClient ) return m_jackClient; return m_jackAudio->jackClient(); diff --git a/src/core/midi/MidiOss.cpp b/src/core/midi/MidiOss.cpp index c1c990b0b..77f324442 100644 --- a/src/core/midi/MidiOss.cpp +++ b/src/core/midi/MidiOss.cpp @@ -67,7 +67,7 @@ QString MidiOss::probeDevice() QString dev = ConfigManager::inst()->value( "midioss", "device" ); if( dev.isEmpty() ) { - if( getenv( "MIDIDEV" ) != NULL ) + if( getenv( "MIDIDEV" ) != nullptr ) { return getenv( "MIDIDEV" ); } diff --git a/src/core/midi/MidiPort.cpp b/src/core/midi/MidiPort.cpp index 84d9cc8d1..99790add6 100644 --- a/src/core/midi/MidiPort.cpp +++ b/src/core/midi/MidiPort.cpp @@ -41,8 +41,8 @@ MidiPort::MidiPort( const QString& name, Model* parent, Mode mode ) : Model( parent ), - m_readablePortsMenu( NULL ), - m_writablePortsMenu( NULL ), + m_readablePortsMenu( nullptr ), + m_writablePortsMenu( nullptr ), m_midiClient( client ), m_midiEventProcessor( eventProcessor ), m_mode( mode ), diff --git a/src/core/midi/MidiSndio.cpp b/src/core/midi/MidiSndio.cpp index 4a1ed0614..29fa4d84f 100644 --- a/src/core/midi/MidiSndio.cpp +++ b/src/core/midi/MidiSndio.cpp @@ -48,14 +48,14 @@ MidiSndio::MidiSndio( void ) : if (dev == "") { - m_hdl = mio_open( NULL, MIO_IN | MIO_OUT, 0 ); + m_hdl = mio_open( nullptr, MIO_IN | MIO_OUT, 0 ); } else { m_hdl = mio_open( dev.toLatin1().constData(), MIO_IN | MIO_OUT, 0 ); } - if( m_hdl == NULL ) + if( m_hdl == nullptr ) { printf( "sndio: failed opening sndio midi device\n" ); return; diff --git a/src/gui/AboutDialog.cpp b/src/gui/AboutDialog.cpp index 11672e6a2..e3f016b5e 100644 --- a/src/gui/AboutDialog.cpp +++ b/src/gui/AboutDialog.cpp @@ -41,10 +41,10 @@ AboutDialog::AboutDialog(QWidget* parent) : versionLabel->setText( versionLabel->text(). arg( LMMS_VERSION ). - arg( PLATFORM ). - arg( MACHINE ). + arg( LMMS_BUILDCONF_PLATFORM ). + arg( LMMS_BUILDCONF_MACHINE ). arg( QT_VERSION_STR ). - arg( COMPILER_VERSION ) ); + arg( LMMS_BUILDCONF_COMPILER_VERSION ) ); versionLabel->setTextInteractionFlags( versionLabel->textInteractionFlags() | Qt::TextSelectableByMouse ); diff --git a/src/gui/AutomatableModelView.cpp b/src/gui/AutomatableModelView.cpp index 8cf3a4ab0..6427134dc 100644 --- a/src/gui/AutomatableModelView.cpp +++ b/src/gui/AutomatableModelView.cpp @@ -213,7 +213,7 @@ void AutomatableModelViewSlots::execConnectionDialog() AutomatableModel* m = m_amv->modelUntyped(); m->displayName(); - ControllerConnectionDialog d( gui->mainWindow(), m ); + ControllerConnectionDialog d( getGUI()->mainWindow(), m ); if( d.exec() == 1 ) { @@ -251,7 +251,7 @@ void AutomatableModelViewSlots::removeConnection() if( m->controllerConnection() ) { delete m->controllerConnection(); - m->setControllerConnection( NULL ); + m->setControllerConnection( nullptr ); } } @@ -260,7 +260,7 @@ void AutomatableModelViewSlots::removeConnection() void AutomatableModelViewSlots::editSongGlobalAutomation() { - gui->automationEditor()->open( + getGUI()->automationEditor()->open( AutomationPattern::globalAutomationPattern(m_amv->modelUntyped()) ); } diff --git a/src/gui/AutomationPatternView.cpp b/src/gui/AutomationPatternView.cpp index 73a3b65a5..fefc3152e 100644 --- a/src/gui/AutomationPatternView.cpp +++ b/src/gui/AutomationPatternView.cpp @@ -41,7 +41,7 @@ #include "Engine.h" -QPixmap * AutomationPatternView::s_pat_rec = NULL; +QPixmap * AutomationPatternView::s_pat_rec = nullptr; AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern, TrackView * _parent ) : @@ -51,7 +51,7 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern, { connect( m_pat, SIGNAL( dataChanged() ), this, SLOT( update() ) ); - connect( gui->automationEditor(), SIGNAL( currentPatternChanged() ), + connect( getGUI()->automationEditor(), SIGNAL( currentPatternChanged() ), this, SLOT( update() ) ); setAttribute( Qt::WA_OpaquePaintEvent, true ); @@ -59,7 +59,7 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern, ToolTip::add(this, m_pat->name()); setStyle( QApplication::style() ); - if( s_pat_rec == NULL ) { s_pat_rec = new QPixmap( embed::getIconPixmap( + if( s_pat_rec == nullptr ) { s_pat_rec = new QPixmap( embed::getIconPixmap( "pat_rec" ) ); } update(); @@ -77,7 +77,8 @@ AutomationPatternView::~AutomationPatternView() void AutomationPatternView::openInAutomationEditor() { - if(gui) gui->automationEditor()->open(m_pat); + if(getGUI() != nullptr) + getGUI()->automationEditor()->open(m_pat); } @@ -125,9 +126,9 @@ void AutomationPatternView::disconnectObject( QAction * _a ) update(); //If automation editor is opened, update its display after disconnection - if( gui->automationEditor() ) + if( getGUI()->automationEditor() ) { - gui->automationEditor()->m_editor->updateAfterPatternChange(); + getGUI()->automationEditor()->m_editor->updateAfterPatternChange(); } //if there is no more connection connected to the AutomationPattern @@ -256,7 +257,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) QLinearGradient lingrad( 0, 0, 0, height() ); QColor c = getColorForDisplay( painter.background().color() ); bool muted = m_pat->getTrack()->isMuted() || m_pat->isMuted(); - bool current = gui->automationEditor()->currentPattern() == m_pat; + bool current = getGUI()->automationEditor()->currentPattern() == m_pat; lingrad.setColorAt( 1, c.darker( 300 ) ); lingrad.setColorAt( 0, c ); @@ -439,7 +440,7 @@ void AutomationPatternView::dropEvent( QDropEvent * _de ) AutomatableModel * mod = dynamic_cast( Engine::projectJournal()-> journallingObject( val.toInt() ) ); - if( mod != NULL ) + if( mod != nullptr ) { bool added = m_pat->addObject( mod ); if ( !added ) @@ -453,10 +454,10 @@ void AutomationPatternView::dropEvent( QDropEvent * _de ) } update(); - if( gui->automationEditor() && - gui->automationEditor()->currentPattern() == m_pat ) + if( getGUI()->automationEditor() && + getGUI()->automationEditor()->currentPattern() == m_pat ) { - gui->automationEditor()->setCurrentPattern( m_pat ); + getGUI()->automationEditor()->setCurrentPattern( m_pat ); } } else diff --git a/src/gui/AutomationTrackView.cpp b/src/gui/AutomationTrackView.cpp index 13bcddc00..9242c081a 100644 --- a/src/gui/AutomationTrackView.cpp +++ b/src/gui/AutomationTrackView.cpp @@ -63,7 +63,7 @@ void AutomationTrackView::dropEvent( QDropEvent * _de ) AutomatableModel * mod = dynamic_cast( Engine::projectJournal()-> journallingObject( val.toInt() ) ); - if( mod != NULL ) + if( mod != nullptr ) { TimePos pos = TimePos( trackContainerView()-> currentPosition() + diff --git a/src/gui/BBTCOView.cpp b/src/gui/BBTCOView.cpp index a09f1bd0c..f15206460 100644 --- a/src/gui/BBTCOView.cpp +++ b/src/gui/BBTCOView.cpp @@ -162,7 +162,7 @@ void BBTCOView::openInBBEditor() { Engine::getBBTrackContainer()->setCurrentBB( m_bbTCO->bbTrackIndex() ); - gui->mainWindow()->toggleBBEditorWin( true ); + getGUI()->mainWindow()->toggleBBEditorWin( true ); } diff --git a/src/gui/BBTrackView.cpp b/src/gui/BBTrackView.cpp index 83feb4d8d..8bec7e8ef 100644 --- a/src/gui/BBTrackView.cpp +++ b/src/gui/BBTrackView.cpp @@ -53,7 +53,7 @@ BBTrackView::BBTrackView( BBTrack * _bbt, TrackContainerView* tcv ) : BBTrackView::~BBTrackView() { - gui->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] ); + getGUI()->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] ); } @@ -61,7 +61,7 @@ BBTrackView::~BBTrackView() bool BBTrackView::close() { - gui->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] ); + getGUI()->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] ); return TrackView::close(); } @@ -71,6 +71,6 @@ bool BBTrackView::close() void BBTrackView::clickedTrackLabel() { Engine::getBBTrackContainer()->setCurrentBB( m_bbTrack->index() ); - gui->getBBEditor()->parentWidget()->show(); - gui->getBBEditor()->setFocus( Qt::ActiveWindowFocusReason ); + getGUI()->getBBEditor()->parentWidget()->show(); + getGUI()->getBBEditor()->setFocus( Qt::ActiveWindowFocusReason ); } \ No newline at end of file diff --git a/src/gui/ControllerConnectionDialog.cpp b/src/gui/ControllerConnectionDialog.cpp index 7d9a769af..b72914716 100644 --- a/src/gui/ControllerConnectionDialog.cpp +++ b/src/gui/ControllerConnectionDialog.cpp @@ -126,11 +126,11 @@ private: ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, const AutomatableModel * _target_model ) : QDialog( _parent ), - m_readablePorts( NULL ), + m_readablePorts( nullptr ), m_midiAutoDetect( false ), - m_controller( NULL ), + m_controller( nullptr ), m_targetModel( _target_model ), - m_midiController( NULL ) + m_midiController( nullptr ) { setWindowIcon( embed::getIconPixmap( "setup_audio" ) ); setWindowTitle( tr( "Connection Settings" ) ); @@ -239,7 +239,7 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, // Crazy MIDI View stuff // TODO, handle by making this a model for the Dialog "view" - ControllerConnection * cc = NULL; + ControllerConnection * cc = nullptr; if( m_targetModel ) { cc = m_targetModel->controllerConnection(); diff --git a/src/gui/EffectControlDialog.cpp b/src/gui/EffectControlDialog.cpp index dc273a6a3..3439835d1 100644 --- a/src/gui/EffectControlDialog.cpp +++ b/src/gui/EffectControlDialog.cpp @@ -31,7 +31,7 @@ EffectControlDialog::EffectControlDialog( EffectControls * _controls ) : - QWidget( NULL ), + QWidget( nullptr ), ModelView( _controls, this ), m_effectControls( _controls ) { diff --git a/src/gui/EffectSelectDialog.cpp b/src/gui/EffectSelectDialog.cpp index 4423ea707..56e30d4b2 100644 --- a/src/gui/EffectSelectDialog.cpp +++ b/src/gui/EffectSelectDialog.cpp @@ -39,7 +39,7 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) : ui( new Ui::EffectSelectDialog ), m_sourceModel(), m_model(), - m_descriptionWidget( NULL ) + m_descriptionWidget( nullptr ) { ui->setupUi( this ); @@ -49,7 +49,7 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) : EffectKeyList subPluginEffectKeys; - for (const Plugin::Descriptor* desc: pluginFactory->descriptors(Plugin::Effect)) + for (const Plugin::Descriptor* desc: getPluginFactory()->descriptors(Plugin::Effect)) { if( desc->subPluginFeatures ) { @@ -174,7 +174,7 @@ void EffectSelectDialog::rowChanged( const QModelIndex & _idx, const QModelIndex & ) { delete m_descriptionWidget; - m_descriptionWidget = NULL; + m_descriptionWidget = nullptr; if( m_model.mapToSource( _idx ).row() < 0 ) { diff --git a/src/gui/ExportProjectDialog.cpp b/src/gui/ExportProjectDialog.cpp index aa9f9ede6..c3bf074e0 100644 --- a/src/gui/ExportProjectDialog.cpp +++ b/src/gui/ExportProjectDialog.cpp @@ -120,7 +120,7 @@ void ExportProjectDialog::accept() m_renderManager.reset(nullptr); QDialog::accept(); - gui->mainWindow()->resetWindowTitle(); + getGUI()->mainWindow()->resetWindowTitle(); } @@ -197,7 +197,7 @@ void ExportProjectDialog::startExport() connect( m_renderManager.get(), SIGNAL( finished() ), this, SLOT( accept() ) ) ; connect( m_renderManager.get(), SIGNAL( finished() ), - gui->mainWindow(), SLOT( resetWindowTitle() ) ); + getGUI()->mainWindow(), SLOT( resetWindowTitle() ) ); if ( m_multiExport ) { @@ -293,6 +293,6 @@ void ExportProjectDialog::startBtnClicked() void ExportProjectDialog::updateTitleBar( int _prog ) { - gui->mainWindow()->setWindowTitle( + getGUI()->mainWindow()->setWindowTitle( tr( "Rendering: %1%" ).arg( _prog ) ); } diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index c91f09630..08bd04a22 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -626,7 +626,7 @@ void FileBrowserTreeWidget::previewFileItem(FileItem* file) else if ( (ext == "xiz" || ext == "sf2" || ext == "sf3" || ext == "gig" || ext == "pat") - && !pluginFactory->pluginSupportingExtension(ext).isNull()) + && !getPluginFactory()->pluginSupportingExtension(ext).isNull()) { const bool isPlugin = file->handling() == FileItem::LoadByPlugin; newPPH = new PresetPreviewPlayHandle(fileName, isPlugin); @@ -755,7 +755,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it) switch( f->handling() ) { case FileItem::LoadAsProject: - if( gui->mainWindow()->mayChangeProject(true) ) + if( getGUI()->mainWindow()->mayChangeProject(true) ) { Engine::getSong()->loadProject( f->fullName() ); } @@ -769,7 +769,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it) !i->descriptor()->supportsFileType( e ) ) { PluginFactory::PluginInfoAndKey piakn = - pluginFactory->pluginSupportingExtension(e); + getPluginFactory()->pluginSupportingExtension(e); i = it->loadInstrument(piakn.info.name(), &piakn.key); } i->loadFile( f->fullName() ); @@ -886,7 +886,7 @@ void FileBrowserTreeWidget::sendToActiveInstrumentTrack( FileItem* item ) { // get all windows opened in the workspace QList pl = - gui->mainWindow()->workspace()-> + getGUI()->mainWindow()->workspace()-> subWindowList( QMdiArea::StackingOrder ); QListIterator w( pl ); w.toBack(); @@ -1228,7 +1228,7 @@ void FileItem::determineFileType( void ) m_type = PresetFile; m_handling = LoadAsPreset; } - else if( ext == "xiz" && ! pluginFactory->pluginSupportingExtension(ext).isNull() ) + else if( ext == "xiz" && ! getPluginFactory()->pluginSupportingExtension(ext).isNull() ) { m_type = PresetFile; m_handling = LoadByPlugin; @@ -1262,7 +1262,7 @@ void FileItem::determineFileType( void ) } if( m_handling == NotSupported && - !ext.isEmpty() && ! pluginFactory->pluginSupportingExtension(ext).isNull() ) + !ext.isEmpty() && ! getPluginFactory()->pluginSupportingExtension(ext).isNull() ) { m_handling = LoadByPlugin; // classify as sample if not classified by anything yet but can diff --git a/src/gui/FxMixerView.cpp b/src/gui/FxMixerView.cpp index 08832c22b..9b235e654 100644 --- a/src/gui/FxMixerView.cpp +++ b/src/gui/FxMixerView.cpp @@ -54,7 +54,7 @@ FxMixerView::FxMixerView() : QWidget(), - ModelView( NULL, this ), + ModelView( nullptr, this ), SerializingObjectHook() { FxMixer * m = Engine::fxMixer(); @@ -149,12 +149,12 @@ FxMixerView::FxMixerView() : updateGeometry(); // timer for updating faders - connect( gui->mainWindow(), SIGNAL( periodicUpdate() ), + connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateFaders() ) ); // add ourself to workspace - QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget( this ); + QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); @@ -365,7 +365,7 @@ void FxMixerView::updateFxLine(int index) thisLine->setToolTip( Engine::fxMixer()->effectChannel( index )->m_name ); FloatModel * sendModel = mix->channelSendModel(selIndex, index); - if( sendModel == NULL ) + if( sendModel == nullptr ) { // does not send, hide send knob thisLine->m_sendKnob->setVisible(false); diff --git a/src/gui/GuiApplication.cpp b/src/gui/GuiApplication.cpp index a3f39e796..4624cf2ff 100644 --- a/src/gui/GuiApplication.cpp +++ b/src/gui/GuiApplication.cpp @@ -58,12 +58,16 @@ GuiApplication* GuiApplication::instance() return s_instance; } +GuiApplication* getGUI() +{ + return GuiApplication::instance(); +} GuiApplication::GuiApplication() { // prompt the user to create the LMMS working directory (e.g. ~/Documents/lmms) if it doesn't exist if ( !ConfigManager::inst()->hasWorkingDir() && - QMessageBox::question( NULL, + QMessageBox::question( nullptr, tr( "Working directory" ), tr( "The LMMS working directory %1 does not " "exist. Create it now? You can change the directory " @@ -185,7 +189,7 @@ void GuiApplication::displayInitProgress(const QString &msg) void GuiApplication::childDestroyed(QObject *obj) { - // when any object that can be reached via gui->mainWindow(), gui->fxMixerView(), etc + // when any object that can be reached via getGUI()->mainWindow(), getGUI()->fxMixerView(), etc // is destroyed, ensure that their accessor functions will return null instead of a garbage pointer. if (obj == m_mainWindow) { @@ -237,9 +241,9 @@ QFont GuiApplication::getWin32SystemFont() if ( pointSize < 0 ) { // height is in pixels, convert to points - HDC hDC = GetDC( NULL ); + HDC hDC = GetDC( nullptr ); pointSize = MulDiv( abs( pointSize ), 72, GetDeviceCaps( hDC, LOGPIXELSY ) ); - ReleaseDC( NULL, hDC ); + ReleaseDC( nullptr, hDC ); } return QFont( QString::fromUtf8( metrics.lfMessageFont.lfFaceName ), pointSize ); diff --git a/src/gui/InstrumentView.cpp b/src/gui/InstrumentView.cpp index f6d214926..42839f7d0 100644 --- a/src/gui/InstrumentView.cpp +++ b/src/gui/InstrumentView.cpp @@ -44,7 +44,7 @@ InstrumentView::~InstrumentView() { if( instrumentTrackWindow() ) { - instrumentTrackWindow()->m_instrumentView = NULL; + instrumentTrackWindow()->m_instrumentView = nullptr; } } @@ -53,7 +53,7 @@ InstrumentView::~InstrumentView() void InstrumentView::setModel( Model * _model, bool ) { - if( dynamic_cast( _model ) != NULL ) + if( dynamic_cast( _model ) != nullptr ) { ModelView::setModel( _model ); instrumentTrackWindow()->setWindowIcon( model()->logo()->pixmap() ); diff --git a/src/gui/LfoControllerDialog.cpp b/src/gui/LfoControllerDialog.cpp index 0a6a8edc7..943894a71 100644 --- a/src/gui/LfoControllerDialog.cpp +++ b/src/gui/LfoControllerDialog.cpp @@ -86,7 +86,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent m_phaseKnob->move( CD_LFO_PHASE_CD_KNOB_X, CD_LFO_CD_KNOB_Y ); m_phaseKnob->setHintText( tr( "Phase offset:" ) , "" + tr( " degrees" ) ); - PixmapButton * sin_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * sin_wave_btn = new PixmapButton( this, nullptr ); sin_wave_btn->move( CD_LFO_SHAPES_X, CD_LFO_SHAPES_Y ); sin_wave_btn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); @@ -96,7 +96,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent tr( "Sine wave" ) ); PixmapButton * triangle_wave_btn = - new PixmapButton( this, NULL ); + new PixmapButton( this, nullptr ); triangle_wave_btn->move( CD_LFO_SHAPES_X + 15, CD_LFO_SHAPES_Y ); triangle_wave_btn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); @@ -105,7 +105,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ToolTip::add( triangle_wave_btn, tr( "Triangle wave" ) ); - PixmapButton * saw_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * saw_wave_btn = new PixmapButton( this, nullptr ); saw_wave_btn->move( CD_LFO_SHAPES_X + 30, CD_LFO_SHAPES_Y ); saw_wave_btn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); @@ -114,7 +114,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ToolTip::add( saw_wave_btn, tr( "Saw wave" ) ); - PixmapButton * sqr_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * sqr_wave_btn = new PixmapButton( this, nullptr ); sqr_wave_btn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y ); sqr_wave_btn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); @@ -124,7 +124,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent tr( "Square wave" ) ); PixmapButton * moog_saw_wave_btn = - new PixmapButton( this, NULL ); + new PixmapButton( this, nullptr ); moog_saw_wave_btn->move( CD_LFO_SHAPES_X, CD_LFO_SHAPES_Y + 15 ); moog_saw_wave_btn->setActiveGraphic( embed::getIconPixmap( "moog_saw_wave_active" ) ); @@ -133,7 +133,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ToolTip::add( moog_saw_wave_btn, tr( "Moog saw wave" ) ); - PixmapButton * exp_wave_btn = new PixmapButton( this, NULL ); + PixmapButton * exp_wave_btn = new PixmapButton( this, nullptr ); exp_wave_btn->move( CD_LFO_SHAPES_X + 15, CD_LFO_SHAPES_Y + 15 ); exp_wave_btn->setActiveGraphic( embed::getIconPixmap( "exp_wave_active" ) ); @@ -142,7 +142,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ToolTip::add( exp_wave_btn, tr( "Exponential wave" ) ); - PixmapButton * white_noise_btn = new PixmapButton( this, NULL ); + PixmapButton * white_noise_btn = new PixmapButton( this, nullptr ); white_noise_btn->move( CD_LFO_SHAPES_X + 30, CD_LFO_SHAPES_Y + 15 ); white_noise_btn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); @@ -151,7 +151,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ToolTip::add( white_noise_btn, tr( "White noise" ) ); - m_userWaveBtn = new PixmapButton( this, NULL ); + m_userWaveBtn = new PixmapButton( this, nullptr ); m_userWaveBtn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y + 15 ); m_userWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); @@ -174,7 +174,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent m_waveBtnGrp->addButton( m_userWaveBtn ); - PixmapButton * x1 = new PixmapButton( this, NULL ); + PixmapButton * x1 = new PixmapButton( this, nullptr ); x1->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y +7); x1->setActiveGraphic( embed::getIconPixmap( "lfo_x1_active" ) ); @@ -183,7 +183,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ToolTip::add( x1, tr( "Mutliply modulation frequency by 1" )); - PixmapButton * x100 = new PixmapButton( this, NULL ); + PixmapButton * x100 = new PixmapButton( this, nullptr ); x100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y - 8 ); x100->setActiveGraphic( embed::getIconPixmap( "lfo_x100_active" ) ); @@ -192,7 +192,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent ToolTip::add( x100, tr( "Mutliply modulation frequency by 100" )); - PixmapButton * d100 = new PixmapButton( this, NULL ); + PixmapButton * d100 = new PixmapButton( this, nullptr ); d100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y + 22 ); d100->setActiveGraphic( embed::getIconPixmap( "lfo_d100_active" ) ); diff --git a/src/gui/LmmsStyle.cpp b/src/gui/LmmsStyle.cpp index 1f6d6f1cd..bc0115f49 100644 --- a/src/gui/LmmsStyle.cpp +++ b/src/gui/LmmsStyle.cpp @@ -34,7 +34,7 @@ #include "LmmsStyle.h" -QPalette * LmmsStyle::s_palette = NULL; +QPalette * LmmsStyle::s_palette = nullptr; QLinearGradient getGradient( const QColor & _col, const QRectF & _rect ) { @@ -131,7 +131,7 @@ LmmsStyle::LmmsStyle() : file.open( QIODevice::ReadOnly ); qApp->setStyleSheet( file.readAll() ); - if( s_palette != NULL ) { qApp->setPalette( *s_palette ); } + if( s_palette != nullptr ) { qApp->setPalette( *s_palette ); } setBaseStyle( QStyleFactory::create( "Fusion" ) ); } @@ -141,7 +141,7 @@ LmmsStyle::LmmsStyle() : QPalette LmmsStyle::standardPalette( void ) const { - if( s_palette != NULL) { return * s_palette; } + if( s_palette != nullptr) { return * s_palette; } QPalette pal = QProxyStyle::standardPalette(); diff --git a/src/gui/Lv2ViewBase.cpp b/src/gui/Lv2ViewBase.cpp index 24bb4fbe0..5dedc5b13 100644 --- a/src/gui/Lv2ViewBase.cpp +++ b/src/gui/Lv2ViewBase.cpp @@ -177,7 +177,7 @@ Lv2ViewBase::Lv2ViewBase(QWidget* meAsWidget, Lv2ControlBase *ctrlBase) m_helpButton->setCheckable(true); btnBox->addWidget(m_helpButton); - m_helpWindow = gui->mainWindow()->addWindowedWidget(infoLabel); + m_helpWindow = getGUI()->mainWindow()->addWindowedWidget(infoLabel); m_helpWindow->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); m_helpWindow->setAttribute(Qt::WA_DeleteOnClose, false); diff --git a/src/gui/MainApplication.cpp b/src/gui/MainApplication.cpp index 8eee9b5d0..64aeb73a5 100644 --- a/src/gui/MainApplication.cpp +++ b/src/gui/MainApplication.cpp @@ -51,7 +51,7 @@ bool MainApplication::event(QEvent* event) m_queuedFile = fileEvent->file(); if(Engine::getSong()) { - if(gui->mainWindow()->mayChangeProject(true)) + if(getGUI()->mainWindow()->mayChangeProject(true)) { qDebug() << "Loading file " << m_queuedFile; Engine::getSong()->loadProject(m_queuedFile); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index cc20c2bc8..72f9522af 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -93,10 +93,10 @@ void disableAutoKeyAccelerators(QWidget* mainWindow) MainWindow::MainWindow() : - m_workspace( NULL ), - m_toolsMenu( NULL ), + m_workspace( nullptr ), + m_toolsMenu( nullptr ), m_autoSaveTimer( this ), - m_viewMenu( NULL ), + m_viewMenu( nullptr ), m_metronomeToggle( 0 ), m_session( Normal ) { @@ -273,9 +273,9 @@ MainWindow::~MainWindow() // TODO: Close tools // dependencies are such that the editors must be destroyed BEFORE Song is deletect in Engine::destroy // see issue #2015 on github - delete gui->automationEditor(); - delete gui->pianoRoll(); - delete gui->songEditor(); + delete getGUI()->automationEditor(); + delete getGUI()->pianoRoll(); + delete getGUI()->songEditor(); // destroy engine which will do further cleanups etc. Engine::destroy(); } @@ -390,10 +390,10 @@ void MainWindow::finalize() m_toolsMenu = new QMenu( this ); - for( const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::Tool) ) + for( const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::Tool) ) { m_toolsMenu->addAction( desc->logo->pixmap(), desc->displayName ); - m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/NULL ) + m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/nullptr ) ->createView(this) ); } if( !m_toolsMenu->isEmpty() ) @@ -586,10 +586,10 @@ void MainWindow::finalize() // Add editor subwindows for (QWidget* widget : std::list{ - gui->automationEditor(), - gui->getBBEditor(), - gui->pianoRoll(), - gui->songEditor() + getGUI()->automationEditor(), + getGUI()->getBBEditor(), + getGUI()->pianoRoll(), + getGUI()->songEditor() }) { QMdiSubWindow* window = addWindowedWidget(widget); @@ -598,13 +598,13 @@ void MainWindow::finalize() window->resize(widget->sizeHint()); } - gui->automationEditor()->parentWidget()->hide(); - gui->getBBEditor()->parentWidget()->move( 610, 5 ); - gui->getBBEditor()->parentWidget()->hide(); - gui->pianoRoll()->parentWidget()->move(5, 5); - gui->pianoRoll()->parentWidget()->hide(); - gui->songEditor()->parentWidget()->move(5, 5); - gui->songEditor()->parentWidget()->show(); + getGUI()->automationEditor()->parentWidget()->hide(); + getGUI()->getBBEditor()->parentWidget()->move( 610, 5 ); + getGUI()->getBBEditor()->parentWidget()->hide(); + getGUI()->pianoRoll()->parentWidget()->move(5, 5); + getGUI()->pianoRoll()->parentWidget()->hide(); + getGUI()->songEditor()->parentWidget()->move(5, 5); + getGUI()->songEditor()->parentWidget()->show(); // reset window title every time we change the state of a subwindow to show the correct title for( const QMdiSubWindow * subWindow : workspace()->subWindowList() ) @@ -745,7 +745,7 @@ void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de ) { // If our widget is the main content of a window (e.g. piano roll, FxMixer, etc), // we really care about the position of the *window* - not the position of the widget within its window - if( _w->parentWidget() != NULL && + if( _w->parentWidget() != nullptr && _w->parentWidget()->inherits( "QMdiSubWindow" ) ) { _w = _w->parentWidget(); @@ -782,7 +782,7 @@ void MainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de ) { // If our widget is the main content of a window (e.g. piano roll, FxMixer, etc), // we really care about the position of the *window* - not the position of the widget within its window - if ( _w->parentWidget() != NULL && + if ( _w->parentWidget() != nullptr && _w->parentWidget()->inherits( "QMdiSubWindow" ) ) { _w = _w->parentWidget(); @@ -1053,10 +1053,10 @@ void MainWindow::refocus() { QList editors; editors - << gui->songEditor()->parentWidget() - << gui->getBBEditor()->parentWidget() - << gui->pianoRoll()->parentWidget() - << gui->automationEditor()->parentWidget(); + << getGUI()->songEditor()->parentWidget() + << getGUI()->getBBEditor()->parentWidget() + << getGUI()->pianoRoll()->parentWidget() + << getGUI()->automationEditor()->parentWidget(); bool found = false; QList::Iterator editor; @@ -1078,7 +1078,7 @@ void MainWindow::refocus() void MainWindow::toggleBBEditorWin( bool forceShow ) { - toggleWindow( gui->getBBEditor(), forceShow ); + toggleWindow( getGUI()->getBBEditor(), forceShow ); } @@ -1086,7 +1086,7 @@ void MainWindow::toggleBBEditorWin( bool forceShow ) void MainWindow::toggleSongEditorWin() { - toggleWindow( gui->songEditor() ); + toggleWindow( getGUI()->songEditor() ); } @@ -1094,7 +1094,7 @@ void MainWindow::toggleSongEditorWin() void MainWindow::toggleProjectNotesWin() { - toggleWindow( gui->getProjectNotes() ); + toggleWindow( getGUI()->getProjectNotes() ); } @@ -1102,7 +1102,7 @@ void MainWindow::toggleProjectNotesWin() void MainWindow::togglePianoRollWin() { - toggleWindow( gui->pianoRoll() ); + toggleWindow( getGUI()->pianoRoll() ); } @@ -1110,7 +1110,7 @@ void MainWindow::togglePianoRollWin() void MainWindow::toggleAutomationEditorWin() { - toggleWindow( gui->automationEditor() ); + toggleWindow( getGUI()->automationEditor() ); } @@ -1118,14 +1118,14 @@ void MainWindow::toggleAutomationEditorWin() void MainWindow::toggleFxMixerWin() { - toggleWindow( gui->fxMixerView() ); + toggleWindow( getGUI()->fxMixerView() ); } void MainWindow::toggleMicrotunerWin() { - toggleWindow( gui->getMicrotunerConfig() ); + toggleWindow( getGUI()->getMicrotunerConfig() ); } @@ -1265,7 +1265,7 @@ void MainWindow::onToggleMetronome() void MainWindow::toggleControllerRack() { - toggleWindow( gui->getControllerRackView() ); + toggleWindow( getGUI()->getControllerRackView() ); } @@ -1273,29 +1273,29 @@ void MainWindow::toggleControllerRack() void MainWindow::updatePlayPauseIcons() { - gui->songEditor()->setPauseIcon( false ); - gui->automationEditor()->setPauseIcon( false ); - gui->getBBEditor()->setPauseIcon( false ); - gui->pianoRoll()->setPauseIcon( false ); + getGUI()->songEditor()->setPauseIcon( false ); + getGUI()->automationEditor()->setPauseIcon( false ); + getGUI()->getBBEditor()->setPauseIcon( false ); + getGUI()->pianoRoll()->setPauseIcon( false ); if( Engine::getSong()->isPlaying() ) { switch( Engine::getSong()->playMode() ) { case Song::Mode_PlaySong: - gui->songEditor()->setPauseIcon( true ); + getGUI()->songEditor()->setPauseIcon( true ); break; case Song::Mode_PlayAutomationPattern: - gui->automationEditor()->setPauseIcon( true ); + getGUI()->automationEditor()->setPauseIcon( true ); break; case Song::Mode_PlayBB: - gui->getBBEditor()->setPauseIcon( true ); + getGUI()->getBBEditor()->setPauseIcon( true ); break; case Song::Mode_PlayPattern: - gui->pianoRoll()->setPauseIcon( true ); + getGUI()->pianoRoll()->setPauseIcon( true ); break; default: @@ -1520,7 +1520,7 @@ void MainWindow::exportProject(bool multiExport) { QString const & projectFileName = Engine::getSong()->projectFileName(); - FileDialog efd( gui->mainWindow() ); + FileDialog efd( getGUI()->mainWindow() ); if ( multiExport ) { @@ -1595,7 +1595,7 @@ void MainWindow::exportProject(bool multiExport) } } - ExportProjectDialog epd( exportFileName, gui->mainWindow(), multiExport ); + ExportProjectDialog epd( exportFileName, getGUI()->mainWindow(), multiExport ); epd.exec(); } } @@ -1678,7 +1678,7 @@ void MainWindow::onSongStopped() if( tl ) { - SongEditorWindow* songEditor = gui->songEditor(); + SongEditorWindow* songEditor = getGUI()->songEditor(); switch( tl->behaviourAtStop() ) { case TimeLineWidget::BackToZero: diff --git a/src/gui/MidiCCRackView.cpp b/src/gui/MidiCCRackView.cpp index 4d932fd1c..a77cceede 100644 --- a/src/gui/MidiCCRackView.cpp +++ b/src/gui/MidiCCRackView.cpp @@ -47,7 +47,7 @@ MidiCCRackView::MidiCCRackView(InstrumentTrack * track) : setWindowIcon(embed::getIconPixmap("midi_cc_rack")); setWindowTitle(tr("MIDI CC Rack - %1").arg(m_track->name())); - QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget(this); + QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this); // Remove maximize button Qt::WindowFlags flags = subWin->windowFlags(); diff --git a/src/gui/ModelView.cpp b/src/gui/ModelView.cpp index f9031ea94..055f0846d 100644 --- a/src/gui/ModelView.cpp +++ b/src/gui/ModelView.cpp @@ -39,7 +39,7 @@ ModelView::ModelView( Model* model, QWidget* widget ) : ModelView::~ModelView() { - if( m_model != NULL && m_model->isDefaultConstructed() ) + if( m_model != nullptr && m_model->isDefaultConstructed() ) { delete m_model; } @@ -50,7 +50,7 @@ ModelView::~ModelView() void ModelView::setModel( Model* model, bool isOldModelValid ) { - if( isOldModelValid && m_model != NULL ) + if( isOldModelValid && m_model != nullptr ) { if( m_model->isDefaultConstructed() ) { @@ -86,7 +86,7 @@ void ModelView::unsetModel() void ModelView::doConnections() { - if( m_model != NULL ) + if( m_model != nullptr ) { QObject::connect( m_model, SIGNAL( dataChanged() ), widget(), SLOT( update() ) ); QObject::connect( m_model, SIGNAL( propertiesChanged() ), widget(), SLOT( update() ) ); diff --git a/src/gui/PatternView.cpp b/src/gui/PatternView.cpp index 9de17fd8b..165a1235c 100644 --- a/src/gui/PatternView.cpp +++ b/src/gui/PatternView.cpp @@ -45,28 +45,28 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) : m_mutedNoteBorderColor(100, 100, 100, 220), m_legacySEBB(ConfigManager::inst()->value("ui","legacysebb","0").toInt()) { - connect( gui->pianoRoll(), SIGNAL( currentPatternChanged() ), + connect( getGUI()->pianoRoll(), SIGNAL( currentPatternChanged() ), this, SLOT( update() ) ); - if( s_stepBtnOn0 == NULL ) + if( s_stepBtnOn0 == nullptr ) { s_stepBtnOn0 = new QPixmap( embed::getIconPixmap( "step_btn_on_0" ) ); } - if( s_stepBtnOn200 == NULL ) + if( s_stepBtnOn200 == nullptr ) { s_stepBtnOn200 = new QPixmap( embed::getIconPixmap( "step_btn_on_200" ) ); } - if( s_stepBtnOff == NULL ) + if( s_stepBtnOff == nullptr ) { s_stepBtnOff = new QPixmap( embed::getIconPixmap( "step_btn_off" ) ); } - if( s_stepBtnOffLight == NULL ) + if( s_stepBtnOffLight == nullptr ) { s_stepBtnOffLight = new QPixmap( embed::getIconPixmap( "step_btn_off_light" ) ); @@ -100,10 +100,10 @@ void PatternView::update() void PatternView::openInPianoRoll() { - gui->pianoRoll()->setCurrentPattern( m_pat ); - gui->pianoRoll()->parentWidget()->show(); - gui->pianoRoll()->show(); - gui->pianoRoll()->setFocus(); + getGUI()->pianoRoll()->setCurrentPattern( m_pat ); + getGUI()->pianoRoll()->parentWidget()->show(); + getGUI()->pianoRoll()->show(); + getGUI()->pianoRoll()->setFocus(); } @@ -112,10 +112,10 @@ void PatternView::openInPianoRoll() void PatternView::setGhostInPianoRoll() { - gui->pianoRoll()->setGhostPattern( m_pat ); - gui->pianoRoll()->parentWidget()->show(); - gui->pianoRoll()->show(); - gui->pianoRoll()->setFocus(); + getGUI()->pianoRoll()->setGhostPattern( m_pat ); + getGUI()->pianoRoll()->parentWidget()->show(); + getGUI()->pianoRoll()->show(); + getGUI()->pianoRoll()->setFocus(); } @@ -209,7 +209,7 @@ void PatternView::mousePressEvent( QMouseEvent * _me ) Note * n = m_pat->noteAtStep( step ); - if( n == NULL ) + if( n == nullptr ) { m_pat->addStepNote( step ); } @@ -222,9 +222,9 @@ void PatternView::mousePressEvent( QMouseEvent * _me ) Engine::getSong()->setModified(); update(); - if( gui->pianoRoll()->currentPattern() == m_pat ) + if( getGUI()->pianoRoll()->currentPattern() == m_pat ) { - gui->pianoRoll()->update(); + getGUI()->pianoRoll()->update(); } } else @@ -276,7 +276,7 @@ void PatternView::wheelEvent(QWheelEvent * we) n = m_pat->addStepNote( step ); n->setVolume( 0 ); } - if( n != NULL ) + if( n != nullptr ) { int vol = n->getVolume(); @@ -291,9 +291,9 @@ void PatternView::wheelEvent(QWheelEvent * we) Engine::getSong()->setModified(); update(); - if( gui->pianoRoll()->currentPattern() == m_pat ) + if( getGUI()->pianoRoll()->currentPattern() == m_pat ) { - gui->pianoRoll()->update(); + getGUI()->pianoRoll()->update(); } } we->accept(); @@ -331,7 +331,7 @@ void PatternView::paintEvent( QPaintEvent * ) QColor c; bool const muted = m_pat->getTrack()->isMuted() || m_pat->isMuted(); - bool current = gui->pianoRoll()->currentPattern() == m_pat; + bool current = getGUI()->pianoRoll()->currentPattern() == m_pat; bool beatPattern = m_pat->m_patternType == Pattern::BeatPattern; if( beatPattern ) diff --git a/src/gui/PluginBrowser.cpp b/src/gui/PluginBrowser.cpp index f27ba51c3..0f8a07f78 100644 --- a/src/gui/PluginBrowser.cpp +++ b/src/gui/PluginBrowser.cpp @@ -156,7 +156,7 @@ void PluginBrowser::addPlugins() m_descTree->clear(); // Fetch and sort all instrument plugin descriptors - auto descs = pluginFactory->descriptors(Plugin::Instrument); + auto descs = getPluginFactory()->descriptors(Plugin::Instrument); std::sort(descs.begin(), descs.end(), [](auto d1, auto d2) { diff --git a/src/gui/SampleTrackView.cpp b/src/gui/SampleTrackView.cpp index 743cffcaf..1f53c55e5 100644 --- a/src/gui/SampleTrackView.cpp +++ b/src/gui/SampleTrackView.cpp @@ -104,12 +104,12 @@ void SampleTrackView::updateIndicator() SampleTrackView::~SampleTrackView() { - if(m_window != NULL) + if(m_window != nullptr) { - m_window->setSampleTrackView(NULL); + m_window->setSampleTrackView(nullptr); m_window->parentWidget()->hide(); } - m_window = NULL; + m_window = nullptr; } @@ -210,7 +210,7 @@ void SampleTrackView::dropEvent(QDropEvent *de) /*! \brief Create and assign a new FX Channel for this track */ void SampleTrackView::createFxLine() { - int channelIndex = gui->fxMixerView()->addNewChannel(); + int channelIndex = getGUI()->fxMixerView()->addNewChannel(); auto channel = Engine::fxMixer()->effectChannel(channelIndex); channel->m_name = getTrack()->name(); @@ -227,5 +227,5 @@ void SampleTrackView::assignFxLine(int channelIndex) { model()->effectChannelModel()->setValue(channelIndex); - gui->fxMixerView()->setCurrentFxLine(channelIndex); + getGUI()->fxMixerView()->setCurrentFxLine(channelIndex); } \ No newline at end of file diff --git a/src/gui/SampleTrackWindow.cpp b/src/gui/SampleTrackWindow.cpp index 0f8baa741..595669629 100644 --- a/src/gui/SampleTrackWindow.cpp +++ b/src/gui/SampleTrackWindow.cpp @@ -39,7 +39,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : QWidget(), - ModelView(NULL, this), + ModelView(nullptr, this), m_track(tv->model()), m_stv(tv) { @@ -84,7 +84,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter; // set up volume knob - m_volumeKnob = new Knob(knobBright_26, NULL, tr("Sample volume")); + m_volumeKnob = new Knob(knobBright_26, nullptr, tr("Sample volume")); m_volumeKnob->setVolumeKnob(true); m_volumeKnob->setHintText(tr("Volume:"), "%"); @@ -98,7 +98,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : // set up panning knob - m_panningKnob = new Knob(knobBright_26, NULL, tr("Panning")); + m_panningKnob = new Knob(knobBright_26, nullptr, tr("Panning")); m_panningKnob->setHintText(tr("Panning:"), ""); basicControlsLayout->addWidget(m_panningKnob, 0, 1); @@ -114,7 +114,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : // setup spinbox for selecting FX-channel - m_effectChannelNumber = new FxLineLcdSpinBox(2, NULL, tr("FX channel"), m_stv); + m_effectChannelNumber = new FxLineLcdSpinBox(2, nullptr, tr("FX channel"), m_stv); basicControlsLayout->addWidget(m_effectChannelNumber, 0, 3); basicControlsLayout->setAlignment(m_effectChannelNumber, widgetAlignment); @@ -135,7 +135,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : setModel(tv->model()); - QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget(this); + QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; @@ -232,7 +232,7 @@ void SampleTrackWindow::closeEvent(QCloseEvent* ce) { ce->ignore(); - if(gui->mainWindow()->workspace()) + if(getGUI()->mainWindow()->workspace()) { parentWidget()->hide(); } diff --git a/src/gui/SetupDialog.cpp b/src/gui/SetupDialog.cpp index 1ca89140f..5f7cdc04a 100644 --- a/src/gui/SetupDialog.cpp +++ b/src/gui/SetupDialog.cpp @@ -80,7 +80,7 @@ inline void labelWidget(QWidget * w, const QString & txt) title->setFont(pointSize<12>(f)); - assert(dynamic_cast(w->layout()) != NULL); + assert(dynamic_cast(w->layout()) != nullptr); dynamic_cast(w->layout())->addSpacing(5); dynamic_cast(w->layout())->addWidget(title); diff --git a/src/gui/StringPairDrag.cpp b/src/gui/StringPairDrag.cpp index b08f4adc5..6aa5da170 100644 --- a/src/gui/StringPairDrag.cpp +++ b/src/gui/StringPairDrag.cpp @@ -67,9 +67,9 @@ StringPairDrag::~StringPairDrag() { // during a drag, we might have lost key-press-events, so reset // modifiers of main-win - if( gui->mainWindow() ) + if( getGUI()->mainWindow() ) { - gui->mainWindow()->clearKeyModifiers(); + getGUI()->mainWindow()->clearKeyModifiers(); } } diff --git a/src/gui/TimeLineWidget.cpp b/src/gui/TimeLineWidget.cpp index e7e7ca113..c9c951901 100644 --- a/src/gui/TimeLineWidget.cpp +++ b/src/gui/TimeLineWidget.cpp @@ -40,7 +40,7 @@ #include "SongEditor.h" -QPixmap * TimeLineWidget::s_posMarkerPixmap = NULL; +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, @@ -66,14 +66,14 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb, m_begin( begin ), m_mode( mode ), m_savedPos( -1 ), - m_hint( NULL ), + m_hint( nullptr ), m_action( NoAction ), m_moveXOff( 0 ) { m_loopPos[0] = 0; m_loopPos[1] = DefaultTicksPerBar; - if( s_posMarkerPixmap == NULL ) + if( s_posMarkerPixmap == nullptr ) { s_posMarkerPixmap = new QPixmap( embed::getIconPixmap( "playpos_marker" ) ); @@ -100,9 +100,9 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb, TimeLineWidget::~TimeLineWidget() { - if( gui->songEditor() ) + if( getGUI()->songEditor() ) { - m_pos.m_timeLine = NULL; + m_pos.m_timeLine = nullptr; } delete m_hint; } @@ -392,7 +392,7 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event ) { // no ctrl-press-hint when having ctrl pressed delete m_hint; - m_hint = NULL; + m_hint = nullptr; m_loopPos[i] = t; } else @@ -431,7 +431,7 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event ) void TimeLineWidget::mouseReleaseEvent( QMouseEvent* event ) { delete m_hint; - m_hint = NULL; + m_hint = nullptr; if ( m_action == SelectSongTCO ) { emit selectionFinished(); } m_action = NoAction; } diff --git a/src/gui/ToolPluginView.cpp b/src/gui/ToolPluginView.cpp index 7a8a15b86..a85a7ff6d 100644 --- a/src/gui/ToolPluginView.cpp +++ b/src/gui/ToolPluginView.cpp @@ -34,9 +34,9 @@ ToolPluginView::ToolPluginView( ToolPlugin * _toolPlugin ) : - PluginView( _toolPlugin, NULL ) + PluginView( _toolPlugin, nullptr ) { - gui->mainWindow()->addWindowedWidget( this ); + getGUI()->mainWindow()->addWindowedWidget( this ); parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false ); setWindowTitle( _toolPlugin->displayName() ); diff --git a/src/gui/TrackContainerView.cpp b/src/gui/TrackContainerView.cpp index c70bbe265..7201427be 100644 --- a/src/gui/TrackContainerView.cpp +++ b/src/gui/TrackContainerView.cpp @@ -50,7 +50,7 @@ using namespace std; TrackContainerView::TrackContainerView( TrackContainer * _tc ) : QWidget(), - ModelView( NULL, this ), + ModelView( nullptr, this ), JournallingObject(), SerializingObjectHook(), m_currentPosition( 0, 0 ), @@ -294,7 +294,7 @@ const TrackView * TrackContainerView::trackViewAt( const int _y ) const return( *it ); } } - return( NULL ); + return( nullptr ); } @@ -390,7 +390,7 @@ void TrackContainerView::dropEvent( QDropEvent * _de ) Track::create( Track::InstrumentTrack, m_tc ) ); PluginFactory::PluginInfoAndKey piakn = - pluginFactory->pluginSupportingExtension(FileItem::extension(value)); + getPluginFactory()->pluginSupportingExtension(FileItem::extension(value)); Instrument * i = it->loadInstrument(piakn.info.name(), &piakn.key); i->loadFile( value ); //it->toggledInstrumentTrackButton( true ); @@ -415,7 +415,7 @@ void TrackContainerView::dropEvent( QDropEvent * _de ) else if( type == "projectfile") { - if( gui->mainWindow()->mayChangeProject(true) ) + if( getGUI()->mainWindow()->mayChangeProject(true) ) { Engine::getSong()->loadProject( value ); } diff --git a/src/gui/TrackContentObjectView.cpp b/src/gui/TrackContentObjectView.cpp index f9d95a1d5..48b5a0127 100644 --- a/src/gui/TrackContentObjectView.cpp +++ b/src/gui/TrackContentObjectView.cpp @@ -62,7 +62,7 @@ const int RESIZE_GRIP_WIDTH = 4; * beside the cursor as you move or resize elements of a track about. * This pointer keeps track of it, as you only ever need one at a time. */ -TextFloat * TrackContentObjectView::s_textFloat = NULL; +TextFloat * TrackContentObjectView::s_textFloat = nullptr; /*! \brief Create a new trackContentObjectView @@ -76,7 +76,7 @@ TextFloat * TrackContentObjectView::s_textFloat = NULL; TrackContentObjectView::TrackContentObjectView( TrackContentObject * tco, TrackView * tv ) : selectableObject( tv->getTrackContentWidget() ), - ModelView( NULL, this ), + ModelView( nullptr, this ), m_trackView( tv ), m_initialTCOPos( TimePos(0) ), m_initialTCOEnd( TimePos(0) ), @@ -85,7 +85,7 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * tco, m_initialMousePos( QPoint( 0, 0 ) ), m_initialMouseGlobalPos( QPoint( 0, 0 ) ), m_initialOffsets( QVector() ), - m_hint( NULL ), + m_hint( nullptr ), m_mutedColor( 0, 0, 0 ), m_mutedBackgroundColor( 0, 0, 0 ), m_selectedColor( 0, 0, 0 ), @@ -100,7 +100,7 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * tco, m_cursorSetYet( false ), m_needsUpdate( true ) { - if( s_textFloat == NULL ) + if( s_textFloat == nullptr ) { s_textFloat = new TextFloat; s_textFloat->setPixmap( embed::getIconPixmap( "clock" ) ); @@ -119,7 +119,7 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * tco, connect( m_tco, SIGNAL( lengthChanged() ), this, SLOT( updateLength() ) ); - connect( gui->songEditor()->m_editor->zoomingModel(), SIGNAL( dataChanged() ), this, SLOT( updateLength() ) ); + connect( getGUI()->songEditor()->m_editor->zoomingModel(), SIGNAL( dataChanged() ), this, SLOT( updateLength() ) ); connect( m_tco, SIGNAL( positionChanged() ), this, SLOT( updatePosition() ) ); connect( m_tco, SIGNAL( destroyedTCO() ), this, SLOT( close() ) ); @@ -473,7 +473,7 @@ void TrackContentObjectView::dropEvent( QDropEvent * de ) // Don't allow pasting a tco into itself. QObject* qwSource = de->source(); - if( qwSource != NULL && + if( qwSource != nullptr && dynamic_cast( qwSource ) == this ) { return; @@ -653,7 +653,7 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me ) } else { - gui->songEditor()->m_editor->selectAllTcos( false ); + getGUI()->songEditor()->m_editor->selectAllTcos( false ); m_tco->addJournalCheckPoint(); // Move, Resize and ResizeLeft @@ -797,7 +797,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me ) { TrackContentObjectView * tcov = dynamic_cast( *it ); - if( tcov != NULL ) + if( tcov != nullptr ) { tcoViews.push_back( tcov ); } @@ -805,7 +805,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me ) } else { - gui->songEditor()->m_editor->selectAllTcos( false ); + getGUI()->songEditor()->m_editor->selectAllTcos( false ); tcoViews.push_back( this ); } // Clear the action here because mouseReleaseEvent will not get @@ -829,7 +829,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me ) if( me->modifiers() & Qt::ControlModifier ) { delete m_hint; - m_hint = NULL; + m_hint = nullptr; } const float ppb = m_trackView->trackContainerView()->pixelsPerBar(); @@ -862,7 +862,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me ) { TrackContentObjectView * tcov = dynamic_cast( *it ); - if( tcov == NULL ) { continue; } + if( tcov == nullptr ) { continue; } tcos.push_back( tcov->m_tco ); int index = std::distance( so.begin(), it ); leftmost = std::min(leftmost, m_initialOffsets[index].getTicks()); @@ -879,7 +879,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me ) } else if( m_action == Resize || m_action == ResizeLeft ) { - const float snapSize = gui->songEditor()->m_editor->getSnapSize(); + const float snapSize = getGUI()->songEditor()->m_editor->getSnapSize(); // Length in ticks of one snap increment const TimePos snapLength = TimePos( (int)(snapSize * TimePos::ticksPerBar()) ); @@ -1021,7 +1021,7 @@ void TrackContentObjectView::mouseReleaseEvent( QMouseEvent * me ) m_action = NoAction; delete m_hint; - m_hint = NULL; + m_hint = nullptr; s_textFloat->hide(); updateCursor(me); selectableObject::mouseReleaseEvent( me ); @@ -1147,7 +1147,7 @@ void TrackContentObjectView::contextMenuAction( ContextMenuAction action ) QVector TrackContentObjectView::getClickedTCOs() { // Get a list of selected selectableObjects - QVector sos = gui->songEditor()->m_editor->selectedObjects(); + QVector sos = getGUI()->songEditor()->m_editor->selectedObjects(); // Convert to a list of selected TCOVs QVector selection; @@ -1315,7 +1315,7 @@ void TrackContentObjectView::mergeTCOs(QVector tcovs) track->restoreJournallingState(); // Update song Engine::getSong()->setModified(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); } @@ -1341,7 +1341,7 @@ void TrackContentObjectView::setInitialOffsets() { TrackContentObjectView * tcov = dynamic_cast( *it ); - if( tcov == NULL ) + if( tcov == nullptr ) { continue; } @@ -1398,10 +1398,10 @@ TimePos TrackContentObjectView::draggedTCOPos( QMouseEvent * me ) else if ( me->modifiers() & Qt::ShiftModifier ) { // If shift is held, quantize position (Default in 1.2.0 and earlier) // or end position, whichever is closest to the actual position - TimePos startQ = newPos.quantize( gui->songEditor()->m_editor->getSnapSize() ); + TimePos startQ = newPos.quantize( getGUI()->songEditor()->m_editor->getSnapSize() ); // Find start position that gives snapped clip end position TimePos endQ = ( newPos + m_tco->length() ); - endQ = endQ.quantize( gui->songEditor()->m_editor->getSnapSize() ); + endQ = endQ.quantize( getGUI()->songEditor()->m_editor->getSnapSize() ); endQ = endQ - m_tco->length(); // Select the position closest to actual position if ( abs(newPos - startQ) < abs(newPos - endQ) ) newPos = startQ; @@ -1409,7 +1409,7 @@ TimePos TrackContentObjectView::draggedTCOPos( QMouseEvent * me ) } else { // Otherwise, quantize moved distance (preserves user offsets) - newPos = m_initialTCOPos + offset.quantize( gui->songEditor()->m_editor->getSnapSize() ); + newPos = m_initialTCOPos + offset.quantize( getGUI()->songEditor()->m_editor->getSnapSize() ); } return newPos; } @@ -1439,7 +1439,7 @@ int TrackContentObjectView::knifeMarkerPos( QMouseEvent * me ) TimePos TrackContentObjectView::quantizeSplitPos( TimePos midiPos, bool shiftMode ) { - const float snapSize = gui->songEditor()->m_editor->getSnapSize(); + const float snapSize = getGUI()->songEditor()->m_editor->getSnapSize(); if ( shiftMode ) { //If shift is held we quantize the length of the new left clip... const TimePos leftPos = midiPos.quantize( snapSize ); diff --git a/src/gui/TrackView.cpp b/src/gui/TrackView.cpp index d255810e2..5ede84d97 100644 --- a/src/gui/TrackView.cpp +++ b/src/gui/TrackView.cpp @@ -58,7 +58,7 @@ */ TrackView::TrackView( Track * track, TrackContainerView * tcv ) : QWidget( tcv->contentWidget() ), /*!< The Track Container View's content widget. */ - ModelView( NULL, this ), /*!< The model view of this track */ + ModelView( nullptr, this ), /*!< The model view of this track */ m_track( track ), /*!< The track we're displaying */ m_trackContainerView( tcv ), /*!< The track Container View we're displayed in */ m_trackOperationsWidget( this ), /*!< Our trackOperationsWidget */ @@ -81,7 +81,7 @@ TrackView::TrackView( Track * track, TrackContainerView * tcv ) : layout->addWidget( &m_trackContentWidget, 1 ); setFixedHeight( m_track->getHeight() ); - resizeEvent( NULL ); + resizeEvent( nullptr ); setAcceptDrops( true ); setAttribute( Qt::WA_DeleteOnClose, true ); @@ -172,7 +172,7 @@ QMenu * TrackView::createFxMenu(QString title, QString newFxLabel) { Q_UNUSED(title) Q_UNUSED(newFxLabel) - return NULL; + return nullptr; } @@ -196,7 +196,7 @@ bool TrackView::close() void TrackView::modelChanged() { m_track = castModel(); - Q_ASSERT( m_track != NULL ); + Q_ASSERT( m_track != nullptr ); connect( m_track, SIGNAL( destroyedTrack() ), this, SLOT( close() ) ); m_trackOperationsWidget.m_muteBtn->setModel( &m_track->m_mutedModel ); m_trackOperationsWidget.m_soloBtn->setModel( &m_track->m_soloModel ); @@ -356,7 +356,7 @@ void TrackView::mouseMoveEvent( QMouseEvent * me ) // qDebug( "y position %d", yPos ); // a track-widget not equal to ourself? - if( trackAtY != NULL && trackAtY != this ) + if( trackAtY != nullptr && trackAtY != this ) { // then move us up/down there! if( me->y() < 0 ) @@ -391,7 +391,7 @@ void TrackView::mouseMoveEvent( QMouseEvent * me ) void TrackView::mouseReleaseEvent( QMouseEvent * me ) { m_action = NoAction; - while( QApplication::overrideCursor() != NULL ) + while( QApplication::overrideCursor() != nullptr ) { QApplication::restoreOverrideCursor(); } diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index ea880529c..5bdd92b49 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -279,7 +279,7 @@ void AutomationEditor::update() // Note detuning? if( m_pattern && !m_pattern->getTrack() ) { - gui->pianoRoll()->update(); + getGUI()->pianoRoll()->update(); } } @@ -1529,7 +1529,7 @@ void AutomationEditor::play() if( Engine::getSong()->playMode() != Song::Mode_PlayPattern ) { Engine::getSong()->stop(); - Engine::getSong()->playPattern( gui->pianoRoll()->currentPattern() ); + Engine::getSong()->playPattern( getGUI()->pianoRoll()->currentPattern() ); } else if( Engine::getSong()->isStopped() == false ) { @@ -1537,7 +1537,7 @@ void AutomationEditor::play() } else { - Engine::getSong()->playPattern( gui->pianoRoll()->currentPattern() ); + Engine::getSong()->playPattern( getGUI()->pianoRoll()->currentPattern() ); } } else if( inBBEditor() ) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index e08c85080..b0a93149e 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -113,14 +113,14 @@ const int NUM_TRIPLET_LENGTHS = 5; -QPixmap * PianoRoll::s_toolDraw = NULL; -QPixmap * PianoRoll::s_toolErase = NULL; -QPixmap * PianoRoll::s_toolSelect = NULL; -QPixmap * PianoRoll::s_toolMove = NULL; -QPixmap * PianoRoll::s_toolOpen = NULL; +QPixmap * PianoRoll::s_toolDraw = nullptr; +QPixmap * PianoRoll::s_toolErase = nullptr; +QPixmap * PianoRoll::s_toolSelect = nullptr; +QPixmap * PianoRoll::s_toolMove = nullptr; +QPixmap * PianoRoll::s_toolOpen = nullptr; QPixmap* PianoRoll::s_toolKnife = nullptr; -TextFloat * PianoRoll::s_textFloat = NULL; +TextFloat * PianoRoll::s_textFloat = nullptr; static QString s_noteStrings[12] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}; @@ -149,18 +149,18 @@ const QVector PianoRoll::m_zoomYLevels = PianoRoll::PianoRoll() : m_nemStr( QVector() ), - m_noteEditMenu( NULL ), - m_semiToneMarkerMenu( NULL ), + m_noteEditMenu( nullptr ), + m_semiToneMarkerMenu( nullptr ), m_zoomingModel(), m_zoomingYModel(), m_quantizeModel(), m_noteLenModel(), m_scaleModel(), m_chordModel(), - m_pattern( NULL ), + m_pattern( nullptr ), m_currentPosition(), m_recording( false ), - m_currentNote( NULL ), + m_currentNote( nullptr ), m_action( ActionNone ), m_noteEditMode( NoteEditVolume ), m_moveBoundaryLeft( 0 ), @@ -255,23 +255,23 @@ PianoRoll::PianoRoll() : m_semiToneMarkerMenu->addAction( copyAllNotesAction ); // init pixmaps - if( s_toolDraw == NULL ) + if( s_toolDraw == nullptr ) { s_toolDraw = new QPixmap( embed::getIconPixmap( "edit_draw" ) ); } - if( s_toolErase == NULL ) + if( s_toolErase == nullptr ) { s_toolErase= new QPixmap( embed::getIconPixmap( "edit_erase" ) ); } - if( s_toolSelect == NULL ) + if( s_toolSelect == nullptr ) { s_toolSelect = new QPixmap( embed::getIconPixmap( "edit_select" ) ); } - if( s_toolMove == NULL ) + if( s_toolMove == nullptr ) { s_toolMove = new QPixmap( embed::getIconPixmap( "edit_move" ) ); } - if( s_toolOpen == NULL ) + if( s_toolOpen == nullptr ) { s_toolOpen = new QPixmap( embed::getIconPixmap( "automation" ) ); } @@ -281,7 +281,7 @@ PianoRoll::PianoRoll() : } // init text-float - if( s_textFloat == NULL ) + if( s_textFloat == nullptr ) { s_textFloat = new TextFloat; } @@ -782,7 +782,7 @@ void PianoRoll::fitNoteLengths(bool fill) } update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); Engine::getSong()->setModified(); } @@ -808,7 +808,7 @@ void PianoRoll::constrainNoteLengths(bool constrainMax) } update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); Engine::getSong()->setModified(); } @@ -850,7 +850,7 @@ void PianoRoll::setCurrentPattern( Pattern* newPattern ) if( Engine::getSong()->isPlaying() && Engine::getSong()->playMode() == Song::Mode_PlayPattern ) { - Engine::getSong()->playPattern( NULL ); + Engine::getSong()->playPattern( nullptr ); } if(m_stepRecorder.isRecording()) @@ -861,7 +861,7 @@ void PianoRoll::setCurrentPattern( Pattern* newPattern ) // set new data m_pattern = newPattern; m_currentPosition = 0; - m_currentNote = NULL; + m_currentNote = nullptr; m_startKey = INITIAL_START_KEY; m_stepRecorder.setCurrentPattern(newPattern); @@ -897,7 +897,7 @@ void PianoRoll::setCurrentPattern( Pattern* newPattern ) // resizeEvent() does the rest for us (scrolling, range-checking // of start-notes and so on...) - resizeEvent( NULL ); + resizeEvent( nullptr ); // make sure to always get informed about the pattern being destroyed connect( m_pattern, SIGNAL( destroyedPattern( Pattern* ) ), this, SLOT( hidePattern( Pattern* ) ) ); @@ -922,7 +922,7 @@ void PianoRoll::hidePattern( Pattern* pattern ) { if( m_pattern == pattern ) { - setCurrentPattern( NULL ); + setCurrentPattern( nullptr ); } } @@ -1170,7 +1170,7 @@ void PianoRoll::removeSelection() void PianoRoll::clearSelectedNotes() { - if( m_pattern != NULL ) + if( m_pattern != nullptr ) { for( Note *note : m_pattern->notes() ) { @@ -1200,7 +1200,7 @@ void PianoRoll::shiftSemiTone(NoteVector notes, int amount) m_pattern->dataChanged(); //We modified the song update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); } @@ -1231,7 +1231,7 @@ void PianoRoll::shiftPos(NoteVector notes, int amount) m_pattern->dataChanged(); // we modified the song update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); } @@ -1361,7 +1361,7 @@ void PianoRoll::keyPressEvent(QKeyEvent* ke) { Pattern * p = direction > 0 ? m_pattern->nextPattern() : m_pattern->previousPattern(); - if(p != NULL) + if(p != nullptr) { setCurrentPattern(p); } @@ -1636,7 +1636,7 @@ void PianoRoll::mousePressEvent(QMouseEvent * me ) } detuningPattern = n->detuning()->automationPattern(); connect(detuningPattern.data(), SIGNAL(dataChanged()), this, SLOT(update())); - gui->automationEditor()->open(detuningPattern); + getGUI()->automationEditor()->open(detuningPattern); return; } @@ -1735,7 +1735,7 @@ void PianoRoll::mousePressEvent(QMouseEvent * me ) // whether this action creates new note(s) or not bool is_new_note = false; - Note * created_new_note = NULL; + Note * created_new_note = nullptr; // did it reach end of vector because // there's no note?? if( it == notes.begin()-1 ) @@ -1886,7 +1886,7 @@ void PianoRoll::mousePressEvent(QMouseEvent * me ) // added new notes, so must update engine, song, etc Engine::getSong()->setModified(); update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); } } @@ -2007,7 +2007,7 @@ void PianoRoll::mouseDoubleClickEvent(QMouseEvent * me ) // make sure we're on a note if( nv.size() > 0 ) { - const Note * closest = NULL; + const Note * closest = nullptr; int closest_dist = 9999999; // if we caught multiple notes and we're not editing a // selection, find the closest... @@ -2309,7 +2309,7 @@ void PianoRoll::mouseReleaseEvent( QMouseEvent * me ) pauseChordNotes(m_lastKey); } - m_currentNote = NULL; + m_currentNote = nullptr; if (m_action != ActionKnife) { @@ -3644,7 +3644,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) currentKeyCol.setAlpha( 64 ); // horizontal line for the key under the cursor - if(hasValidPattern() && gui->pianoRoll()->hasFocus()) + if(hasValidPattern() && getGUI()->pianoRoll()->hasFocus()) { int key_num = getKey( mapFromGlobal( QCursor::pos() ).y() ); p.fillRect( 10, keyAreaBottom() + 3 - m_keyLineHeight * @@ -3656,9 +3656,9 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) p.fillRect( QRect( 0, keyAreaBottom(), width()-PR_RIGHT_MARGIN, NOTE_EDIT_RESIZE_BAR ), editAreaCol ); - if (gui->pianoRoll()->hasFocus()) + if (getGUI()->pianoRoll()->hasFocus()) { - const QPixmap * cursor = NULL; + const QPixmap * cursor = nullptr; // draw current edit-mode-icon below the cursor switch( m_editMode ) { @@ -3682,7 +3682,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) case ModeEditKnife: cursor = s_toolKnife; break; } QPoint mousePosition = mapFromGlobal( QCursor::pos() ); - if( cursor != NULL && mousePosition.y() > keyAreaTop() && mousePosition.x() > noteEditLeft()) + if( cursor != nullptr && mousePosition.y() > keyAreaTop() && mousePosition.x() > noteEditLeft()) { p.drawPixmap( mousePosition + QPoint( 8, 8 ), *cursor ); } @@ -4361,7 +4361,7 @@ void PianoRoll::cutSelectedNotes() } update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); } @@ -4411,7 +4411,7 @@ void PianoRoll::pasteNotes() // least one note... Engine::getSong()->setModified(); update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); } } @@ -4432,7 +4432,7 @@ bool PianoRoll::deleteSelectedNotes() Engine::getSong()->setModified(); update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); return true; } @@ -4623,7 +4623,7 @@ void PianoRoll::quantizeNotes(QuantizeActions mode) } update(); - gui->songEditor()->update(); + getGUI()->songEditor()->update(); Engine::getSong()->setModified(); } @@ -4662,7 +4662,7 @@ TimePos PianoRoll::newNoteLen() const bool PianoRoll::mouseOverNote() { - return hasValidPattern() && noteUnderMouse() != NULL; + return hasValidPattern() && noteUnderMouse() != nullptr; } @@ -4677,7 +4677,7 @@ Note * PianoRoll::noteUnderMouse() || pos.y() < PR_TOP_MARGIN || pos.y() > keyAreaBottom() ) { - return NULL; + return nullptr; } int key_num = getKey( pos.y() ); @@ -4698,7 +4698,7 @@ Note * PianoRoll::noteUnderMouse() } } - return NULL; + return nullptr; } void PianoRoll::changeSnapMode() @@ -5006,7 +5006,7 @@ PianoRollWindow::PianoRollWindow() : setFocusPolicy( Qt::StrongFocus ); setFocus(); setWindowIcon( embed::getIconPixmap( "piano" ) ); - setCurrentPattern( NULL ); + setCurrentPattern( nullptr ); // Connections connect( m_editor, SIGNAL( currentPatternChanged() ), this, SIGNAL( currentPatternChanged() ) ); @@ -5270,7 +5270,7 @@ void PianoRollWindow::importPattern() // Overwrite confirmation. if (!m_editor->m_pattern->empty() && QMessageBox::warning( - NULL, + nullptr, tr("Import pattern."), tr("You are about to import a pattern, this will " "overwrite your current pattern. Do you want to " diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index 2105282fc..6024b9184 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -104,37 +104,37 @@ SongEditor::SongEditor( Song * song ) : // add some essential widgets to global tool-bar - QWidget * tb = gui->mainWindow()->toolBar(); + QWidget * tb = getGUI()->mainWindow()->toolBar(); - gui->mainWindow()->addSpacingToToolBar( 40 ); + getGUI()->mainWindow()->addSpacingToToolBar( 40 ); m_tempoSpinBox = new LcdSpinBox( 3, tb, tr( "Tempo" ) ); m_tempoSpinBox->setModel( &m_song->m_tempoModel ); m_tempoSpinBox->setLabel( tr( "TEMPO" ) ); ToolTip::add( m_tempoSpinBox, tr( "Tempo in BPM" ) ); - int tempoSpinBoxCol = gui->mainWindow()->addWidgetToToolBar( m_tempoSpinBox, 0 ); + int tempoSpinBoxCol = getGUI()->mainWindow()->addWidgetToToolBar( m_tempoSpinBox, 0 ); #if 0 toolButton * hq_btn = new toolButton( embed::getIconPixmap( "hq_mode" ), tr( "High quality mode" ), - NULL, NULL, tb ); + nullptr, nullptr, tb ); hq_btn->setCheckable( true ); connect( hq_btn, SIGNAL( toggled( bool ) ), this, SLOT( setHighQuality( bool ) ) ); hq_btn->setFixedWidth( 42 ); - gui->mainWindow()->addWidgetToToolBar( hq_btn, 1, col ); + getGUI()->mainWindow()->addWidgetToToolBar( hq_btn, 1, col ); #endif - gui->mainWindow()->addWidgetToToolBar( new TimeDisplayWidget, 1, tempoSpinBoxCol ); + getGUI()->mainWindow()->addWidgetToToolBar( new TimeDisplayWidget, 1, tempoSpinBoxCol ); - gui->mainWindow()->addSpacingToToolBar( 10 ); + getGUI()->mainWindow()->addSpacingToToolBar( 10 ); m_timeSigDisplay = new MeterDialog( this, true ); m_timeSigDisplay->setModel( &m_song->m_timeSigModel ); - gui->mainWindow()->addWidgetToToolBar( m_timeSigDisplay ); + getGUI()->mainWindow()->addWidgetToToolBar( m_timeSigDisplay ); - gui->mainWindow()->addSpacingToToolBar( 10 ); + getGUI()->mainWindow()->addSpacingToToolBar( 10 ); QLabel * master_vol_lbl = new QLabel( tb ); @@ -163,11 +163,11 @@ SongEditor::SongEditor( Song * song ) : m_mvsStatus->setTitle( tr( "Master volume" ) ); m_mvsStatus->setPixmap( embed::getIconPixmap( "master_volume" ) ); - gui->mainWindow()->addWidgetToToolBar( master_vol_lbl ); - gui->mainWindow()->addWidgetToToolBar( m_masterVolumeSlider ); + getGUI()->mainWindow()->addWidgetToToolBar( master_vol_lbl ); + getGUI()->mainWindow()->addWidgetToToolBar( m_masterVolumeSlider ); - gui->mainWindow()->addSpacingToToolBar( 10 ); + getGUI()->mainWindow()->addSpacingToToolBar( 10 ); QLabel * master_pitch_lbl = new QLabel( tb ); @@ -195,10 +195,10 @@ SongEditor::SongEditor( Song * song ) : m_mpsStatus->setTitle( tr( "Master pitch" ) ); m_mpsStatus->setPixmap( embed::getIconPixmap( "master_pitch" ) ); - gui->mainWindow()->addWidgetToToolBar( master_pitch_lbl ); - gui->mainWindow()->addWidgetToToolBar( m_masterPitchSlider ); + getGUI()->mainWindow()->addWidgetToToolBar( master_pitch_lbl ); + getGUI()->mainWindow()->addWidgetToToolBar( m_masterPitchSlider ); - gui->mainWindow()->addSpacingToToolBar( 10 ); + getGUI()->mainWindow()->addSpacingToToolBar( 10 ); // create widget for oscilloscope- and cpu-load-widget QWidget * vc_w = new QWidget( tb ); @@ -212,7 +212,7 @@ SongEditor::SongEditor( Song * song ) : vcw_layout->addWidget( new CPULoadWidget( vc_w ) ); vcw_layout->addStretch(); - gui->mainWindow()->addWidgetToToolBar( vc_w ); + getGUI()->mainWindow()->addWidgetToToolBar( vc_w ); static_cast( layout() )->insertWidget( 0, m_timeLine ); @@ -751,7 +751,7 @@ static inline void animateScroll( QScrollBar *scrollBar, int newVal, bool smooth { // do smooth scroll animation using QTimeLine QTimeLine *t = scrollBar->findChild(); - if( t == NULL ) + if( t == nullptr ) { t = new QTimeLine( 600, scrollBar ); t->setFrameRange( scrollBar->value(), newVal ); @@ -912,7 +912,7 @@ ComboBoxModel *SongEditor::snappingModel() const SongEditorWindow::SongEditorWindow(Song* song) : Editor(Engine::audioEngine()->audioDev()->supportsCapture(), false), m_editor(new SongEditor(song)), - m_crtlAction( NULL ), + m_crtlAction( nullptr ), m_snapSizeLabel( new QLabel( m_toolBar ) ) { setWindowTitle( tr( "Song-Editor" ) ); @@ -1103,7 +1103,7 @@ void SongEditorWindow::recordAccompany() void SongEditorWindow::stop() { m_editor->m_song->stop(); - gui->pianoRoll()->stopRecording(); + getGUI()->pianoRoll()->stopRecording(); } @@ -1126,7 +1126,7 @@ void SongEditorWindow::adjustUiAfterProjectLoad() // make sure to bring us to front as the song editor is the central // widget in a song and when just opening a song in order to listen to // it, it's very annyoing to manually bring up the song editor each time - gui->mainWindow()->workspace()->setActiveSubWindow( + getGUI()->mainWindow()->workspace()->setActiveSubWindow( qobject_cast( parentWidget() ) ); connect( qobject_cast( parentWidget() ), SIGNAL( focusLost() ), this, SLOT( lostFocus() ) ); m_editor->scrolled(0); diff --git a/src/gui/menus/RecentProjectsMenu.cpp b/src/gui/menus/RecentProjectsMenu.cpp index 6f32b0df5..dc7b3bd2b 100644 --- a/src/gui/menus/RecentProjectsMenu.cpp +++ b/src/gui/menus/RecentProjectsMenu.cpp @@ -67,7 +67,7 @@ void RecentProjectsMenu::fillMenu() void RecentProjectsMenu::openProject(QAction * _action ) { - auto mainWindow = gui->mainWindow(); + auto mainWindow = getGUI()->mainWindow(); if (mainWindow->mayChangeProject(true)) { const QString f = _action->text().replace("&&", "&"); diff --git a/src/gui/menus/TemplatesMenu.cpp b/src/gui/menus/TemplatesMenu.cpp index b944b7cf1..9f89e3a9f 100644 --- a/src/gui/menus/TemplatesMenu.cpp +++ b/src/gui/menus/TemplatesMenu.cpp @@ -23,7 +23,7 @@ TemplatesMenu::TemplatesMenu(QWidget *parent) : void TemplatesMenu::createNewProjectFromTemplate(QAction * _action) { - if( gui->mainWindow()->mayChangeProject(true) ) + if( getGUI()->mainWindow()->mayChangeProject(true) ) { const QString& templateFilePath = _action->data().toString(); Engine::getSong()->createNewProjectFromTemplate(templateFilePath); diff --git a/src/gui/widgets/AutomatableButton.cpp b/src/gui/widgets/AutomatableButton.cpp index 1d9cecce8..80df31913 100644 --- a/src/gui/widgets/AutomatableButton.cpp +++ b/src/gui/widgets/AutomatableButton.cpp @@ -36,8 +36,8 @@ AutomatableButton::AutomatableButton( QWidget * _parent, const QString & _name ) : QPushButton( _parent ), - BoolModelView( new BoolModel( false, NULL, _name, true ), this ), - m_group( NULL ) + BoolModelView( new BoolModel( false, nullptr, _name, true ), this ), + m_group( nullptr ) { setWindowTitle( _name ); doConnections(); @@ -49,7 +49,7 @@ AutomatableButton::AutomatableButton( QWidget * _parent, AutomatableButton::~AutomatableButton() { - if( m_group != NULL ) + if( m_group != nullptr ) { m_group->removeButton( this ); } @@ -87,9 +87,9 @@ void AutomatableButton::contextMenuEvent( QContextMenuEvent * _me ) // button, the context-menu appears while mouse-cursor is still hidden // and it isn't shown again until user does something which causes // an QApplication::restoreOverrideCursor()-call... - mouseReleaseEvent( NULL ); + mouseReleaseEvent( nullptr ); - if ( m_group != NULL ) + if ( m_group != nullptr ) { CaptionMenu contextMenu( m_group->model()->displayName() ); m_group->addDefaultActions( &contextMenu ); @@ -157,7 +157,7 @@ void AutomatableButton::mouseReleaseEvent( QMouseEvent * _me ) void AutomatableButton::toggle() { - if( isCheckable() && m_group != NULL ) + if( isCheckable() && m_group != nullptr ) { if( model()->value() == false ) { @@ -180,7 +180,7 @@ void AutomatableButton::toggle() automatableButtonGroup::automatableButtonGroup( QWidget * _parent, const QString & _name ) : QWidget( _parent ), - IntModelView( new IntModel( 0, 0, 0, NULL, _name, true ), this ) + IntModelView( new IntModel( 0, 0, 0, nullptr, _name, true ), this ) { hide(); setWindowTitle( _name ); @@ -194,7 +194,7 @@ automatableButtonGroup::~automatableButtonGroup() for( QList::iterator it = m_buttons.begin(); it != m_buttons.end(); ++it ) { - ( *it )->m_group = NULL; + ( *it )->m_group = nullptr; } } @@ -221,7 +221,7 @@ void automatableButtonGroup::addButton( AutomatableButton * _btn ) void automatableButtonGroup::removeButton( AutomatableButton * _btn ) { m_buttons.erase( std::find( m_buttons.begin(), m_buttons.end(), _btn ) ); - _btn->m_group = NULL; + _btn->m_group = nullptr; } diff --git a/src/gui/widgets/AutomatableSlider.cpp b/src/gui/widgets/AutomatableSlider.cpp index 61799ce9c..cd162a057 100644 --- a/src/gui/widgets/AutomatableSlider.cpp +++ b/src/gui/widgets/AutomatableSlider.cpp @@ -36,7 +36,7 @@ AutomatableSlider::AutomatableSlider( QWidget * _parent, const QString & _name ) : QSlider( _parent ), - IntModelView( new IntModel( 0, 0, 0, NULL, _name, true ), this ), + IntModelView( new IntModel( 0, 0, 0, nullptr, _name, true ), this ), m_showStatus( false ) { setWindowTitle( _name ); diff --git a/src/gui/widgets/ComboBox.cpp b/src/gui/widgets/ComboBox.cpp index 4ef43bee7..9f18bb7cd 100644 --- a/src/gui/widgets/ComboBox.cpp +++ b/src/gui/widgets/ComboBox.cpp @@ -38,32 +38,32 @@ #include "MainWindow.h" -QPixmap * ComboBox::s_background = NULL; -QPixmap * ComboBox::s_arrow = NULL; -QPixmap * ComboBox::s_arrowSelected = NULL; +QPixmap * ComboBox::s_background = nullptr; +QPixmap * ComboBox::s_arrow = nullptr; +QPixmap * ComboBox::s_arrowSelected = nullptr; const int CB_ARROW_BTN_WIDTH = 18; ComboBox::ComboBox( QWidget * _parent, const QString & _name ) : QWidget( _parent ), - IntModelView( new ComboBoxModel( NULL, QString(), true ), this ), + IntModelView( new ComboBoxModel( nullptr, QString(), true ), this ), m_menu( this ), m_pressed( false ) { setFixedHeight( ComboBox::DEFAULT_HEIGHT ); - if( s_background == NULL ) + if( s_background == nullptr ) { s_background = new QPixmap( embed::getIconPixmap( "combobox_bg" ) ); } - if( s_arrow == NULL ) + if( s_arrow == nullptr ) { s_arrow = new QPixmap( embed::getIconPixmap( "combobox_arrow" ) ); } - if( s_arrowSelected == NULL ) + if( s_arrowSelected == nullptr ) { s_arrowSelected = new QPixmap( embed::getIconPixmap( "combobox_arrow_selected" ) ); } @@ -104,7 +104,7 @@ void ComboBox::selectPrevious() void ComboBox::contextMenuEvent( QContextMenuEvent * event ) { - if( model() == NULL || event->x() <= width() - CB_ARROW_BTN_WIDTH ) + if( model() == nullptr || event->x() <= width() - CB_ARROW_BTN_WIDTH ) { QWidget::contextMenuEvent( event ); return; @@ -120,7 +120,7 @@ void ComboBox::contextMenuEvent( QContextMenuEvent * event ) void ComboBox::mousePressEvent( QMouseEvent* event ) { - if( model() == NULL ) + if( model() == nullptr ) { return; } diff --git a/src/gui/widgets/ControllerRackView.cpp b/src/gui/widgets/ControllerRackView.cpp index 621c41c73..d6b7cc410 100644 --- a/src/gui/widgets/ControllerRackView.cpp +++ b/src/gui/widgets/ControllerRackView.cpp @@ -75,7 +75,7 @@ ControllerRackView::ControllerRackView( ) : layout->addWidget( m_addButton ); this->setLayout( layout ); - QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget( this ); + QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget( this ); // No maximize button Qt::WindowFlags flags = subWin->windowFlags(); diff --git a/src/gui/widgets/ControllerView.cpp b/src/gui/widgets/ControllerView.cpp index b61ce12c4..a0cdf0893 100644 --- a/src/gui/widgets/ControllerView.cpp +++ b/src/gui/widgets/ControllerView.cpp @@ -47,8 +47,8 @@ ControllerView::ControllerView( Controller * _model, QWidget * _parent ) : QFrame( _parent ), ModelView( _model, this ), - m_subWindow( NULL ), - m_controllerDlg( NULL ), + m_subWindow( nullptr ), + m_controllerDlg( nullptr ), m_show( true ) { this->setFrameStyle( QFrame::StyledPanel ); @@ -75,9 +75,9 @@ ControllerView::ControllerView( Controller * _model, QWidget * _parent ) : vBoxLayout->addWidget(m_nameLabel); - m_controllerDlg = getController()->createDialog( gui->mainWindow()->workspace() ); + m_controllerDlg = getController()->createDialog( getGUI()->mainWindow()->workspace() ); - m_subWindow = gui->mainWindow()->addWindowedWidget( m_controllerDlg ); + m_subWindow = getGUI()->mainWindow()->addWindowedWidget( m_controllerDlg ); Qt::WindowFlags flags = m_subWindow->windowFlags(); flags &= ~Qt::WindowMaximizeButtonHint; diff --git a/src/gui/widgets/EffectRackView.cpp b/src/gui/widgets/EffectRackView.cpp index c0761e7f8..def51123b 100644 --- a/src/gui/widgets/EffectRackView.cpp +++ b/src/gui/widgets/EffectRackView.cpp @@ -36,7 +36,7 @@ EffectRackView::EffectRackView( EffectChain* model, QWidget* parent ) : QWidget( parent ), - ModelView( NULL, this ) + ModelView( nullptr, this ) { QVBoxLayout* mainLayout = new QVBoxLayout( this ); mainLayout->setMargin( 5 ); diff --git a/src/gui/widgets/EffectView.cpp b/src/gui/widgets/EffectView.cpp index 936a786d0..b99fdf349 100644 --- a/src/gui/widgets/EffectView.cpp +++ b/src/gui/widgets/EffectView.cpp @@ -46,8 +46,8 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : PluginView( _model, _parent ), m_bg( embed::getIconPixmap( "effect_plugin" ) ), - m_subWindow( NULL ), - m_controlView( NULL ) + m_subWindow( nullptr ), + m_controlView( nullptr ) { setFixedSize( EffectView::DEFAULT_WIDTH, 60 ); @@ -96,7 +96,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : m_controlView = effect()->controls()->createView(); if( m_controlView ) { - m_subWindow = gui->mainWindow()->addWindowedWidget( m_controlView ); + m_subWindow = getGUI()->mainWindow()->addWindowedWidget( m_controlView ); if ( !m_controlView->isResizable() ) { diff --git a/src/gui/widgets/EnvelopeAndLfoView.cpp b/src/gui/widgets/EnvelopeAndLfoView.cpp index 0df232819..586d01473 100644 --- a/src/gui/widgets/EnvelopeAndLfoView.cpp +++ b/src/gui/widgets/EnvelopeAndLfoView.cpp @@ -75,21 +75,21 @@ const int LFO_SHAPES_X = LFO_GRAPH_X;//PREDELAY_KNOB_X; const int LFO_SHAPES_Y = LFO_GRAPH_Y + 50; -QPixmap * EnvelopeAndLfoView::s_envGraph = NULL; -QPixmap * EnvelopeAndLfoView::s_lfoGraph = NULL; +QPixmap * EnvelopeAndLfoView::s_envGraph = nullptr; +QPixmap * EnvelopeAndLfoView::s_lfoGraph = nullptr; EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) : QWidget( _parent ), - ModelView( NULL, this ), - m_params( NULL ) + ModelView( nullptr, this ), + m_params( nullptr ) { - if( s_envGraph == NULL ) + if( s_envGraph == nullptr ) { s_envGraph = new QPixmap( embed::getIconPixmap( "envelope_graph" ) ); } - if( s_lfoGraph == NULL ) + if( s_lfoGraph == nullptr ) { s_lfoGraph = new QPixmap( embed::getIconPixmap( "lfo_graph" ) ); } @@ -162,35 +162,35 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) : m_lfoAmountKnob->setHintText( tr( "Modulation amount:" ), "" ); - PixmapButton * sin_lfo_btn = new PixmapButton( this, NULL ); + PixmapButton * sin_lfo_btn = new PixmapButton( this, nullptr ); sin_lfo_btn->move( LFO_SHAPES_X, LFO_SHAPES_Y ); sin_lfo_btn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); sin_lfo_btn->setInactiveGraphic( embed::getIconPixmap( "sin_wave_inactive" ) ); - PixmapButton * triangle_lfo_btn = new PixmapButton( this, NULL ); + PixmapButton * triangle_lfo_btn = new PixmapButton( this, nullptr ); triangle_lfo_btn->move( LFO_SHAPES_X+15, LFO_SHAPES_Y ); triangle_lfo_btn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); triangle_lfo_btn->setInactiveGraphic( embed::getIconPixmap( "triangle_wave_inactive" ) ); - PixmapButton * saw_lfo_btn = new PixmapButton( this, NULL ); + PixmapButton * saw_lfo_btn = new PixmapButton( this, nullptr ); saw_lfo_btn->move( LFO_SHAPES_X+30, LFO_SHAPES_Y ); saw_lfo_btn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); saw_lfo_btn->setInactiveGraphic( embed::getIconPixmap( "saw_wave_inactive" ) ); - PixmapButton * sqr_lfo_btn = new PixmapButton( this, NULL ); + PixmapButton * sqr_lfo_btn = new PixmapButton( this, nullptr ); sqr_lfo_btn->move( LFO_SHAPES_X+45, LFO_SHAPES_Y ); sqr_lfo_btn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); sqr_lfo_btn->setInactiveGraphic( embed::getIconPixmap( "square_wave_inactive" ) ); - m_userLfoBtn = new PixmapButton( this, NULL ); + m_userLfoBtn = new PixmapButton( this, nullptr ); m_userLfoBtn->move( LFO_SHAPES_X+75, LFO_SHAPES_Y ); m_userLfoBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); @@ -200,7 +200,7 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) : connect( m_userLfoBtn, SIGNAL( toggled( bool ) ), this, SLOT( lfoUserWaveChanged() ) ); - PixmapButton * random_lfo_btn = new PixmapButton( this, NULL ); + PixmapButton * random_lfo_btn = new PixmapButton( this, nullptr ); random_lfo_btn->move( LFO_SHAPES_X+60, LFO_SHAPES_Y ); random_lfo_btn->setActiveGraphic( embed::getIconPixmap( "random_wave_active" ) ); diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index 089964ec7..17a97e898 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -58,10 +58,10 @@ #include "MainWindow.h" -TextFloat * Fader::s_textFloat = NULL; -QPixmap * Fader::s_back = NULL; -QPixmap * Fader::s_leds = NULL; -QPixmap * Fader::s_knob = NULL; +TextFloat * Fader::s_textFloat = nullptr; +QPixmap * Fader::s_back = nullptr; +QPixmap * Fader::s_leds = nullptr; +QPixmap * Fader::s_knob = nullptr; Fader::Fader( FloatModel * _model, const QString & _name, QWidget * _parent ) : QWidget( _parent ), @@ -79,7 +79,7 @@ Fader::Fader( FloatModel * _model, const QString & _name, QWidget * _parent ) : m_peakRed( 0, 0, 0 ), m_peakYellow( 0, 0, 0 ) { - if( s_textFloat == NULL ) + if( s_textFloat == nullptr ) { s_textFloat = new TextFloat; } @@ -121,7 +121,7 @@ Fader::Fader( FloatModel * model, const QString & name, QWidget * parent, QPixma m_peakGreen( 0, 0, 0 ), m_peakRed( 0, 0, 0 ) { - if( s_textFloat == NULL ) + if( s_textFloat == nullptr ) { s_textFloat = new TextFloat; } diff --git a/src/gui/widgets/FxLine.cpp b/src/gui/widgets/FxLine.cpp index 4baad0e89..4ea927279 100644 --- a/src/gui/widgets/FxLine.cpp +++ b/src/gui/widgets/FxLine.cpp @@ -55,8 +55,8 @@ bool FxLine::eventFilter( QObject *dist, QEvent *event ) } const int FxLine::FxLineHeight = 287; -QPixmap * FxLine::s_sendBgArrow = NULL; -QPixmap * FxLine::s_receiveBgArrow = NULL; +QPixmap * FxLine::s_sendBgArrow = nullptr; +QPixmap * FxLine::s_receiveBgArrow = nullptr; FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex ) : QWidget( _parent ), @@ -207,8 +207,8 @@ QString FxLine::elideName( const QString & name ) void FxLine::paintEvent( QPaintEvent * ) { - bool sendToThis = Engine::fxMixer()->channelSendModel( m_mv->currentFxLine()->m_channelIndex, m_channelIndex ) != NULL; - bool receiveFromThis = Engine::fxMixer()->channelSendModel( m_channelIndex, m_mv->currentFxLine()->m_channelIndex ) != NULL; + bool sendToThis = Engine::fxMixer()->channelSendModel( m_mv->currentFxLine()->m_channelIndex, m_channelIndex ) != nullptr; + bool receiveFromThis = Engine::fxMixer()->channelSendModel( m_channelIndex, m_mv->currentFxLine()->m_channelIndex ) != nullptr; QPainter painter; painter.begin( this ); drawFxLine( &painter, this, m_mv->currentFxLine() == this, sendToThis, receiveFromThis ); @@ -307,7 +307,7 @@ void FxLine::renameFinished() void FxLine::removeChannel() { - FxMixerView * mix = gui->fxMixerView(); + FxMixerView * mix = getGUI()->fxMixerView(); mix->deleteChannel( m_channelIndex ); } @@ -316,7 +316,7 @@ void FxLine::removeChannel() void FxLine::removeUnusedChannels() { - FxMixerView * mix = gui->fxMixerView(); + FxMixerView * mix = getGUI()->fxMixerView(); mix->deleteUnusedChannels(); } @@ -325,7 +325,7 @@ void FxLine::removeUnusedChannels() void FxLine::moveChannelLeft() { - FxMixerView * mix = gui->fxMixerView(); + FxMixerView * mix = getGUI()->fxMixerView(); mix->moveChannelLeft( m_channelIndex ); } @@ -334,7 +334,7 @@ void FxLine::moveChannelLeft() void FxLine::moveChannelRight() { - FxMixerView * mix = gui->fxMixerView(); + FxMixerView * mix = getGUI()->fxMixerView(); mix->moveChannelRight( m_channelIndex ); } diff --git a/src/gui/widgets/FxLineLcdSpinBox.cpp b/src/gui/widgets/FxLineLcdSpinBox.cpp index 5edf50c6c..44515762b 100644 --- a/src/gui/widgets/FxLineLcdSpinBox.cpp +++ b/src/gui/widgets/FxLineLcdSpinBox.cpp @@ -36,11 +36,11 @@ void FxLineLcdSpinBox::setTrackView(TrackView * tv) void FxLineLcdSpinBox::mouseDoubleClickEvent(QMouseEvent* event) { - gui->fxMixerView()->setCurrentFxLine(model()->value()); + getGUI()->fxMixerView()->setCurrentFxLine(model()->value()); - gui->fxMixerView()->parentWidget()->show(); - gui->fxMixerView()->show();// show fxMixer window - gui->fxMixerView()->setFocus();// set focus to fxMixer window + getGUI()->fxMixerView()->parentWidget()->show(); + getGUI()->fxMixerView()->show();// show fxMixer window + getGUI()->fxMixerView()->setFocus();// set focus to fxMixer window //engine::getFxMixerView()->raise(); } diff --git a/src/gui/widgets/Graph.cpp b/src/gui/widgets/Graph.cpp index 773a6f51b..350b07f03 100644 --- a/src/gui/widgets/Graph.cpp +++ b/src/gui/widgets/Graph.cpp @@ -37,7 +37,7 @@ Graph::Graph( QWidget * _parent, graphStyle _style, int _width, int _height ) : QWidget( _parent ), /* TODO: size, background? */ - ModelView( new graphModel( -1.0, 1.0, 128, NULL, true ), this ), + ModelView( new graphModel( -1.0, 1.0, 128, nullptr, true ), this ), m_graphStyle( _style ) { m_mouseDown = false; diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index 06b8e1c5c..b8378d54f 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -37,7 +37,7 @@ GroupBox::GroupBox( const QString & _caption, QWidget * _parent ) : QWidget( _parent ), - BoolModelView( NULL, this ), + BoolModelView( nullptr, this ), m_caption( _caption ), m_titleBarHeight( 11 ) { @@ -47,7 +47,7 @@ GroupBox::GroupBox( const QString & _caption, QWidget * _parent ) : m_led->setActiveGraphic( embed::getIconPixmap( "led_green" ) ); m_led->setInactiveGraphic( embed::getIconPixmap( "led_off" ) ); - setModel( new BoolModel( false, NULL, _caption, true ) ); + setModel( new BoolModel( false, nullptr, _caption, true ) ); setAutoFillBackground( true ); unsetCursor(); } diff --git a/src/gui/widgets/InstrumentFunctionViews.cpp b/src/gui/widgets/InstrumentFunctionViews.cpp index 43f6b2b9b..feba2a332 100644 --- a/src/gui/widgets/InstrumentFunctionViews.cpp +++ b/src/gui/widgets/InstrumentFunctionViews.cpp @@ -36,7 +36,7 @@ InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( InstrumentFunctionNoteStacking* cc, QWidget* parent ) : QWidget( parent ), - ModelView( NULL, this ), + ModelView( nullptr, this ), m_cc( cc ), m_chordsGroupBox( new GroupBox( tr( "STACKING" ) ) ), m_chordsComboBox( new ComboBox() ), @@ -90,7 +90,7 @@ void InstrumentFunctionNoteStackingView::modelChanged() InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFunctionArpeggio* arp, QWidget* parent ) : QWidget( parent ), - ModelView( NULL, this ), + ModelView( nullptr, this ), m_a( arp ), m_arpGroupBox( new GroupBox( tr( "ARPEGGIO" ) ) ), m_arpComboBox( new ComboBox() ), diff --git a/src/gui/widgets/InstrumentMidiIOView.cpp b/src/gui/widgets/InstrumentMidiIOView.cpp index 1c49c066a..8c511f95a 100644 --- a/src/gui/widgets/InstrumentMidiIOView.cpp +++ b/src/gui/widgets/InstrumentMidiIOView.cpp @@ -42,9 +42,9 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : QWidget( parent ), - ModelView( NULL, this ), - m_rpBtn( NULL ), - m_wpBtn( NULL ) + ModelView( nullptr, this ), + m_rpBtn( nullptr ), + m_wpBtn( nullptr ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setMargin( 5 ); diff --git a/src/gui/widgets/InstrumentSoundShapingView.cpp b/src/gui/widgets/InstrumentSoundShapingView.cpp index 24a52fad2..47dc389aa 100644 --- a/src/gui/widgets/InstrumentSoundShapingView.cpp +++ b/src/gui/widgets/InstrumentSoundShapingView.cpp @@ -49,8 +49,8 @@ const int FILTER_GROUPBOX_HEIGHT = 245-FILTER_GROUPBOX_Y; InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : QWidget( _parent ), - ModelView( NULL, this ), - m_ss( NULL ) + ModelView( nullptr, this ), + m_ss( nullptr ) { m_targetsTabWidget = new TabWidget( tr( "TARGET" ), this ); m_targetsTabWidget->setGeometry( TARGETS_TABWIDGET_X, @@ -63,7 +63,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_envLfoViews[i] = new EnvelopeAndLfoView( m_targetsTabWidget ); m_targetsTabWidget->addTab( m_envLfoViews[i], tr( InstrumentSoundShaping::targetNames[i][0] ), - NULL ); + nullptr ); } diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index 35c2bfc13..0c98734d2 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -50,14 +50,14 @@ #include "StringPairDrag.h" #include "TextFloat.h" -TextFloat * Knob::s_textFloat = NULL; +TextFloat * Knob::s_textFloat = nullptr; Knob::Knob( knobTypes _knob_num, QWidget * _parent, const QString & _name ) : QWidget( _parent ), - FloatModelView( new FloatModel( 0, 0, 0, 1, NULL, _name, true ), this ), + FloatModelView( new FloatModel( 0, 0, 0, 1, nullptr, _name, true ), this ), m_label( "" ), m_isHtmlLabel(false), m_tdRenderer(nullptr), @@ -82,7 +82,7 @@ Knob::Knob( QWidget * _parent, const QString & _name ) : void Knob::initUi( const QString & _name ) { - if( s_textFloat == NULL ) + if( s_textFloat == nullptr ) { s_textFloat = new TextFloat; } @@ -490,7 +490,7 @@ float Knob::getValue( const QPoint & _p ) value = .4f * _p.y(); // if shift pressed we want slower movement - if( gui->mainWindow()->isShiftPressed() ) + if( getGUI()->mainWindow()->isShiftPressed() ) { value /= 4.0f; value = qBound( -4.0f, value, 4.0f ); @@ -507,7 +507,7 @@ void Knob::contextMenuEvent( QContextMenuEvent * ) // button, the context-menu appears while mouse-cursor is still hidden // and it isn't shown again until user does something which causes // an QApplication::restoreOverrideCursor()-call... - mouseReleaseEvent( NULL ); + mouseReleaseEvent( nullptr ); CaptionMenu contextMenu( model()->displayName(), this ); addDefaultActions( &contextMenu ); @@ -550,7 +550,7 @@ void Knob::dropEvent( QDropEvent * _de ) AutomatableModel * mod = dynamic_cast( Engine::projectJournal()-> journallingObject( val.toInt() ) ); - if( mod != NULL ) + if( mod != nullptr ) { AutomatableModel::linkModels( model(), mod ); mod->setValue( model()->value() ); @@ -644,7 +644,7 @@ void Knob::mouseReleaseEvent( QMouseEvent* event ) void Knob::focusOutEvent( QFocusEvent * _fe ) { // make sure we don't loose mouse release event - mouseReleaseEvent( NULL ); + mouseReleaseEvent( nullptr ); QWidget::focusOutEvent( _fe ); } @@ -796,7 +796,7 @@ void Knob::enterValue() void Knob::friendlyUpdate() { - if (model() && (model()->controllerConnection() == NULL || + if (model() && (model()->controllerConnection() == nullptr || model()->controllerConnection()->getController()->frequentUpdates() == false || Controller::runningFrames() % (256*4) == 0)) { @@ -825,7 +825,7 @@ QString Knob::displayValue() const void Knob::doConnections() { - if( model() != NULL ) + if( model() != nullptr ) { QObject::connect( model(), SIGNAL( dataChanged() ), this, SLOT( friendlyUpdate() ) ); diff --git a/src/gui/widgets/LadspaControlView.cpp b/src/gui/widgets/LadspaControlView.cpp index 39ed1c3ea..e04a52351 100644 --- a/src/gui/widgets/LadspaControlView.cpp +++ b/src/gui/widgets/LadspaControlView.cpp @@ -43,7 +43,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent, layout->setMargin( 0 ); layout->setSpacing( 0 ); - LedCheckBox * link = NULL; + LedCheckBox * link = nullptr; if( m_ctl->m_link ) { @@ -53,7 +53,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent, layout->addWidget( link ); } - Knob * knb = NULL; + Knob * knb = nullptr; switch( m_ctl->port()->data_type ) { @@ -63,7 +63,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent, m_ctl->port()->name, this, QString(), LedCheckBox::Green ); toggle->setModel( m_ctl->toggledModel() ); layout->addWidget( toggle ); - if( link != NULL ) + if( link != nullptr ) { setFixedSize( link->width() + toggle->width(), toggle->height() ); @@ -90,7 +90,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent, break; } - if( knb != NULL ) + if( knb != nullptr ) { if( m_ctl->port()->data_type != TIME ) { @@ -103,7 +103,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent, knb->setLabel( m_ctl->port()->name ); knb->setHintText( tr( "Value:" ), "" ); layout->addWidget( knb ); - if( link != NULL ) + if( link != nullptr ) { setFixedSize( link->width() + knb->width(), knb->height() ); diff --git a/src/gui/widgets/LcdFloatSpinBox.cpp b/src/gui/widgets/LcdFloatSpinBox.cpp index 566e13fc4..a28d54b9b 100644 --- a/src/gui/widgets/LcdFloatSpinBox.cpp +++ b/src/gui/widgets/LcdFloatSpinBox.cpp @@ -153,7 +153,7 @@ void LcdFloatSpinBox::mouseMoveEvent(QMouseEvent* event) if (m_mouseMoving) { int dy = event->globalY() - m_origMousePos.y(); - if (gui->mainWindow()->isShiftPressed()) { dy = qBound(-4, dy/4, 4); } + if (getGUI()->mainWindow()->isShiftPressed()) { dy = qBound(-4, dy/4, 4); } if (dy > 1 || dy < -1) { model()->setValue(model()->value() - dy / 2 * getStep()); diff --git a/src/gui/widgets/LcdSpinBox.cpp b/src/gui/widgets/LcdSpinBox.cpp index f57ddca0b..630b2b8ec 100644 --- a/src/gui/widgets/LcdSpinBox.cpp +++ b/src/gui/widgets/LcdSpinBox.cpp @@ -40,7 +40,7 @@ LcdSpinBox::LcdSpinBox( int numDigits, QWidget* parent, const QString& name ) : LcdWidget( numDigits, parent, name ), - IntModelView( new IntModel( 0, 0, 0, NULL, name, true ), this ), + IntModelView( new IntModel( 0, 0, 0, nullptr, name, true ), this ), m_remainder( 0.f ), m_mouseMoving( false ), m_lastMousePos(), @@ -53,7 +53,7 @@ LcdSpinBox::LcdSpinBox( int numDigits, QWidget* parent, const QString& name ) : LcdSpinBox::LcdSpinBox( int numDigits, const QString& style, QWidget* parent, const QString& name ) : LcdWidget( numDigits, style, parent, name ), - IntModelView( new IntModel( 0, 0, 0, NULL, name, true ), this ), + IntModelView( new IntModel( 0, 0, 0, nullptr, name, true ), this ), m_remainder( 0.f ), m_mouseMoving( false ), m_lastMousePos(), diff --git a/src/gui/widgets/MeterDialog.cpp b/src/gui/widgets/MeterDialog.cpp index 5510cbad4..b1e3ffad4 100644 --- a/src/gui/widgets/MeterDialog.cpp +++ b/src/gui/widgets/MeterDialog.cpp @@ -37,7 +37,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : QWidget( _parent ), - ModelView( NULL, this ) + ModelView( nullptr, this ) { QVBoxLayout * vlayout = new QVBoxLayout( this ); vlayout->setSpacing( 0 ); diff --git a/src/gui/widgets/MicrotunerConfig.cpp b/src/gui/widgets/MicrotunerConfig.cpp index 519956ed1..9646e2f3a 100644 --- a/src/gui/widgets/MicrotunerConfig.cpp +++ b/src/gui/widgets/MicrotunerConfig.cpp @@ -177,7 +177,7 @@ MicrotunerConfig::MicrotunerConfig() : this->setLayout(microtunerLayout); // Add to the main window and setup fixed size etc. - QMdiSubWindow *subWin = gui->mainWindow()->addWindowedWidget(this); + QMdiSubWindow *subWin = getGUI()->mainWindow()->addWindowedWidget(this); subWin->setAttribute(Qt::WA_DeleteOnClose, false); subWin->setMinimumWidth(300); diff --git a/src/gui/widgets/MidiPortMenu.cpp b/src/gui/widgets/MidiPortMenu.cpp index a65448ae9..1cdb43f68 100644 --- a/src/gui/widgets/MidiPortMenu.cpp +++ b/src/gui/widgets/MidiPortMenu.cpp @@ -29,7 +29,7 @@ MidiPortMenu::MidiPortMenu( MidiPort::Modes _mode ) : - ModelView( NULL, this ), + ModelView( nullptr, this ), m_mode( _mode ) { setFont( pointSize<9>( font() ) ); diff --git a/src/gui/widgets/Oscilloscope.cpp b/src/gui/widgets/Oscilloscope.cpp index a18a4a490..2a8f04acb 100644 --- a/src/gui/widgets/Oscilloscope.cpp +++ b/src/gui/widgets/Oscilloscope.cpp @@ -88,7 +88,7 @@ void Oscilloscope::setActive( bool _active ) m_active = _active; if( m_active ) { - connect( gui->mainWindow(), + connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( update() ) ); connect( Engine::audioEngine(), @@ -97,7 +97,7 @@ void Oscilloscope::setActive( bool _active ) } else { - disconnect( gui->mainWindow(), + disconnect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( update() ) ); disconnect( Engine::audioEngine(), diff --git a/src/gui/widgets/PixmapButton.cpp b/src/gui/widgets/PixmapButton.cpp index eb2553cf7..f792fcac7 100644 --- a/src/gui/widgets/PixmapButton.cpp +++ b/src/gui/widgets/PixmapButton.cpp @@ -57,7 +57,7 @@ void PixmapButton::paintEvent( QPaintEvent * ) { QPainter p( this ); - if( ( model() != NULL && model()->value() ) || m_pressed ) + if( ( model() != nullptr && model()->value() ) || m_pressed ) { if( !m_activePixmap.isNull() ) { @@ -132,7 +132,7 @@ void PixmapButton::setInactiveGraphic( const QPixmap & _pm, bool _update ) QSize PixmapButton::sizeHint() const { - if( ( model() != NULL && model()->value() ) || m_pressed ) + if( ( model() != nullptr && model()->value() ) || m_pressed ) { return m_activePixmap.size() / devicePixelRatio(); } diff --git a/src/gui/widgets/ProjectNotes.cpp b/src/gui/widgets/ProjectNotes.cpp index 7fc35b446..6fac73208 100644 --- a/src/gui/widgets/ProjectNotes.cpp +++ b/src/gui/widgets/ProjectNotes.cpp @@ -45,7 +45,7 @@ ProjectNotes::ProjectNotes() : - QMainWindow( gui->mainWindow()->workspace() ) + QMainWindow( getGUI()->mainWindow()->workspace() ) { m_edit = new QTextEdit( this ); m_edit->setAutoFillBackground( true ); @@ -70,7 +70,7 @@ ProjectNotes::ProjectNotes() : setWindowTitle( tr( "Project Notes" ) ); setWindowIcon( embed::getIconPixmap( "project_notes" ) ); - gui->mainWindow()->addWindowedWidget( this ); + getGUI()->mainWindow()->addWindowedWidget( this ); parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false ); parentWidget()->move( 700, 10 ); parentWidget()->resize( 400, 300 ); diff --git a/src/gui/widgets/Rubberband.cpp b/src/gui/widgets/Rubberband.cpp index 0a4e891b5..b0bd5cc06 100644 --- a/src/gui/widgets/Rubberband.cpp +++ b/src/gui/widgets/Rubberband.cpp @@ -74,7 +74,7 @@ void RubberBand::resizeEvent( QResizeEvent * _re ) QVector RubberBand::selectableObjects() const { QVector so; - if( parentWidget() == NULL ) + if( parentWidget() == nullptr ) { return( so ); } diff --git a/src/gui/widgets/SendButtonIndicator.cpp b/src/gui/widgets/SendButtonIndicator.cpp index ad8d631ba..f0229b6a7 100644 --- a/src/gui/widgets/SendButtonIndicator.cpp +++ b/src/gui/widgets/SendButtonIndicator.cpp @@ -2,8 +2,8 @@ #include "FxMixer.h" -QPixmap * SendButtonIndicator::s_qpmOff = NULL; -QPixmap * SendButtonIndicator::s_qpmOn = NULL; +QPixmap * SendButtonIndicator::s_qpmOff = nullptr; +QPixmap * SendButtonIndicator::s_qpmOn = nullptr; SendButtonIndicator:: SendButtonIndicator( QWidget * _parent, FxLine * _owner, FxMixerView * _mv) : @@ -33,7 +33,7 @@ void SendButtonIndicator::mousePressEvent( QMouseEvent * e ) int from = m_mv->currentFxLine()->channelIndex(); int to = m_parent->channelIndex(); FloatModel * sendModel = mix->channelSendModel(from, to); - if( sendModel == NULL ) + if( sendModel == nullptr ) { // not sending. create a mixer send. mix->createChannelSend( from, to ); @@ -57,5 +57,5 @@ FloatModel * SendButtonIndicator::getSendModel() void SendButtonIndicator::updateLightStatus() { - setPixmap( getSendModel() == NULL ? *s_qpmOff : *s_qpmOn ); + setPixmap( getSendModel() == nullptr ? *s_qpmOff : *s_qpmOn ); } diff --git a/src/gui/widgets/SideBar.cpp b/src/gui/widgets/SideBar.cpp index 36c417b93..130616e55 100644 --- a/src/gui/widgets/SideBar.cpp +++ b/src/gui/widgets/SideBar.cpp @@ -131,8 +131,8 @@ void SideBar::appendTab( SideBarWidget *widget ) void SideBar::toggleButton( QAbstractButton * button ) { - QToolButton *toolButton = NULL; - QWidget *activeWidget = NULL; + QToolButton *toolButton = nullptr; + QWidget *activeWidget = nullptr; for( auto it = m_widgets.begin(); it != m_widgets.end(); ++it ) { diff --git a/src/gui/widgets/TempoSyncKnob.cpp b/src/gui/widgets/TempoSyncKnob.cpp index d769fd831..a141c0003 100644 --- a/src/gui/widgets/TempoSyncKnob.cpp +++ b/src/gui/widgets/TempoSyncKnob.cpp @@ -42,7 +42,7 @@ TempoSyncKnob::TempoSyncKnob( knobTypes _knob_num, QWidget * _parent, Knob( _knob_num, _parent, _name ), m_tempoSyncIcon( embed::getIconPixmap( "tempo_sync" ) ), m_tempoSyncDescription( tr( "Tempo Sync" ) ), - m_custom( NULL ) + m_custom( nullptr ) { } @@ -62,11 +62,11 @@ TempoSyncKnob::~TempoSyncKnob() void TempoSyncKnob::modelChanged() { - if( model() == NULL ) + if( model() == nullptr ) { qWarning( "no TempoSyncKnobModel has been set!" ); } - if( m_custom != NULL ) + if( m_custom != nullptr ) { m_custom->setModel( &model()->m_custom ); } @@ -82,7 +82,7 @@ void TempoSyncKnob::modelChanged() void TempoSyncKnob::contextMenuEvent( QContextMenuEvent * ) { - mouseReleaseEvent( NULL ); + mouseReleaseEvent( nullptr ); CaptionMenu contextMenu( model()->displayName(), this ); addDefaultActions( &contextMenu ); @@ -204,7 +204,7 @@ void TempoSyncKnob::updateDescAndIcon() { m_tempoSyncDescription = tr( "Tempo Sync" ); } - if( m_custom != NULL && + if( m_custom != nullptr && model()->m_tempoSyncMode != TempoSyncKnobModel::SyncCustom ) { m_custom->parentWidget()->hide(); @@ -288,10 +288,10 @@ void TempoSyncKnob::setSyncIcon( const QPixmap & _new_icon ) void TempoSyncKnob::showCustom() { - if( m_custom == NULL ) + if( m_custom == nullptr ) { - m_custom = new MeterDialog( gui->mainWindow()->workspace() ); - QMdiSubWindow * subWindow = gui->mainWindow()->addWindowedWidget( m_custom ); + m_custom = new MeterDialog( getGUI()->mainWindow()->workspace() ); + QMdiSubWindow * subWindow = getGUI()->mainWindow()->addWindowedWidget( m_custom ); Qt::WindowFlags flags = subWindow->windowFlags(); flags &= ~Qt::WindowMaximizeButtonHint; subWindow->setWindowFlags( flags ); diff --git a/src/gui/widgets/TextFloat.cpp b/src/gui/widgets/TextFloat.cpp index 5027a5ade..5a93b55c6 100644 --- a/src/gui/widgets/TextFloat.cpp +++ b/src/gui/widgets/TextFloat.cpp @@ -33,7 +33,7 @@ TextFloat::TextFloat() : - QWidget( gui->mainWindow(), Qt::ToolTip ), + QWidget( getGUI()->mainWindow(), Qt::ToolTip ), m_title(), m_text(), m_pixmap() @@ -88,9 +88,9 @@ void TextFloat::setVisibilityTimeOut( int _msecs ) TextFloat * TextFloat::displayMessage( const QString & _msg, int _timeout, QWidget * _parent, int _add_y_margin ) { - QWidget * mw = gui->mainWindow(); + QWidget * mw = getGUI()->mainWindow(); TextFloat * tf = new TextFloat; - if( _parent != NULL ) + if( _parent != nullptr ) { tf->moveGlobal( _parent, QPoint( _parent->width() + 2, 0 ) ); } diff --git a/src/gui/widgets/TimeDisplayWidget.cpp b/src/gui/widgets/TimeDisplayWidget.cpp index 01604a9dc..bc5e5d604 100644 --- a/src/gui/widgets/TimeDisplayWidget.cpp +++ b/src/gui/widgets/TimeDisplayWidget.cpp @@ -54,7 +54,7 @@ TimeDisplayWidget::TimeDisplayWidget() : // update labels of LCD spinboxes setDisplayMode( m_displayMode ); - connect( gui->mainWindow(), SIGNAL( periodicUpdate() ), + connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateTime() ) ); } diff --git a/src/gui/widgets/ToolButton.cpp b/src/gui/widgets/ToolButton.cpp index 21363f66b..f5ef3560a 100644 --- a/src/gui/widgets/ToolButton.cpp +++ b/src/gui/widgets/ToolButton.cpp @@ -34,7 +34,7 @@ ToolButton::ToolButton( const QPixmap & _pixmap, const QString & _tooltip, { setAutoFillBackground( false ); - if( _receiver != NULL && _slot != NULL ) + if( _receiver != nullptr && _slot != nullptr ) { connect( this, SIGNAL( clicked() ), _receiver, _slot ); } diff --git a/src/gui/widgets/TrackContentWidget.cpp b/src/gui/widgets/TrackContentWidget.cpp index d7dee1a1b..4c2c10529 100644 --- a/src/gui/widgets/TrackContentWidget.cpp +++ b/src/gui/widgets/TrackContentWidget.cpp @@ -199,7 +199,7 @@ void TrackContentWidget::update() */ void TrackContentWidget::changePosition( const TimePos & newPos ) { - if( m_trackView->trackContainerView() == gui->getBBEditor()->trackContainerView() ) + if( m_trackView->trackContainerView() == getGUI()->getBBEditor()->trackContainerView() ) { const int curBB = Engine::getBBTrackContainer()->currentBB(); setUpdatesEnabled( false ); @@ -473,7 +473,7 @@ bool TrackContentWidget::pasteSelection( TimePos tcoPos, const QMimeData * md, b // TODO -- Need to draw the hovericon either way, or ghost the TCOs // onto their final position. - float snapSize = gui->songEditor()->m_editor->getSnapSize(); + float snapSize = getGUI()->songEditor()->m_editor->getSnapSize(); // All patterns should be offset the same amount as the grabbed pattern TimePos offset = TimePos(tcoPos - grabbedTCOPos); // Users expect clips to "fall" backwards, so bias the offset @@ -507,7 +507,7 @@ bool TrackContentWidget::pasteSelection( TimePos tcoPos, const QMimeData * md, b // The new position is the old position plus the offset. TimePos pos = tcoElement.attributeNode( "pos" ).value().toInt() + offset; // If we land on ourselves, offset by one snap - TimePos shift = TimePos::ticksPerBar() * gui->songEditor()->m_editor->getSnapSize(); + TimePos shift = TimePos::ticksPerBar() * getGUI()->songEditor()->m_editor->getSnapSize(); if (offset == 0 && initialTrackIndex == currentTrackIndex) { pos += shift; } TrackContentObject * tco = t->createTCO( pos ); @@ -550,7 +550,7 @@ void TrackContentWidget::mousePressEvent( QMouseEvent * me ) // Enable box select if control is held when clicking an empty space // (If we had clicked a TCO it would have intercepted the mouse event) if( me->modifiers() & Qt::ControlModifier ){ - gui->songEditor()->m_editor->setEditMode(SongEditor::EditMode::SelectMode); + getGUI()->songEditor()->m_editor->setEditMode(SongEditor::EditMode::SelectMode); } // Forward event to allow box select if the editor supports it and is in that mode if( m_trackView->trackContainerView()->allowRubberband() == true ) @@ -583,7 +583,7 @@ void TrackContentWidget::mousePressEvent( QMouseEvent * me ) void TrackContentWidget::mouseReleaseEvent( QMouseEvent * me ) { - gui->songEditor()->syncEditMode(); + getGUI()->songEditor()->syncEditMode(); QWidget::mouseReleaseEvent(me); } @@ -601,7 +601,7 @@ void TrackContentWidget::paintEvent( QPaintEvent * pe ) int ppb = static_cast( tcv->pixelsPerBar() ); QPainter p( this ); // Don't draw background on BB-Editor - if( m_trackView->trackContainerView() != gui->getBBEditor()->trackContainerView() ) + if( m_trackView->trackContainerView() != getGUI()->getBBEditor()->trackContainerView() ) { p.drawTiledPixmap( rect(), m_background, QPoint( tcv->currentPosition().getBar() * ppb, 0 ) ); diff --git a/src/tracks/BBTrack.cpp b/src/tracks/BBTrack.cpp index 8d5345697..9df773ddc 100644 --- a/src/tracks/BBTrack.cpp +++ b/src/tracks/BBTrack.cpp @@ -223,7 +223,7 @@ BBTrack * BBTrack::findBBTrack( int _bb_num ) return it.key(); } } - return NULL; + return nullptr; } @@ -233,7 +233,7 @@ void BBTrack::swapBBTracks( Track * _track1, Track * _track2 ) { BBTrack * t1 = dynamic_cast( _track1 ); BBTrack * t2 = dynamic_cast( _track2 ); - if( t1 != NULL && t2 != NULL ) + if( t1 != nullptr && t2 != nullptr ) { qSwap( s_infoMap[t1], s_infoMap[t2] ); Engine::getBBTrackContainer()->swapBB( s_infoMap[t1], diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 9290c01d5..1e7bcb794 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -106,7 +106,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : m_pitchRangeModel( 1, 1, 60, this, tr( "Pitch range" ) ), m_effectChannelModel( 0, 0, 0, this, tr( "FX channel" ) ), m_useMasterPitchModel( true, this, tr( "Master pitch") ), - m_instrument( NULL ), + m_instrument( nullptr ), m_soundShaping( this ), m_arpeggio( this ), m_noteStacking( this ), @@ -123,7 +123,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : for( int i = 0; i < NumKeys; ++i ) { - m_notes[i] = NULL; + m_notes[i] = nullptr; m_runningMidiNotes[i] = 0; } @@ -246,7 +246,7 @@ InstrumentTrack::~InstrumentTrack() if (m_hasAutoMidiDev) { autoAssignMidiDevice(false); - s_autoAssignedTrack = NULL; + s_autoAssignedTrack = nullptr; } // kill all running notes and the iph @@ -302,7 +302,7 @@ void InstrumentTrack::processAudioBuffer( sampleFrame* buf, const fpp_t frames, // instruments using instrument-play-handles will call this method // without any knowledge about notes, so they pass NULL for n, which // is no problem for us since we just bypass the envelopes+LFOs - if( m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) == false && n != NULL ) + if( m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) == false && n != nullptr ) { const f_cnt_t offset = n->noteOffset(); m_soundShaping.processAudioBuffer( buf + offset, frames - offset, n ); @@ -384,12 +384,12 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim this, offset, typeInfo::max() / 2, Note( TimePos(), TimePos(), event.key(), event.volume( midiPort()->baseVelocity() ) ), - NULL, event.channel(), + nullptr, event.channel(), NotePlayHandle::OriginMidiInput ); m_notes[event.key()] = nph; if( ! Engine::audioEngine()->addPlayHandle( nph ) ) { - m_notes[event.key()] = NULL; + m_notes[event.key()] = nullptr; } } eventHandled = true; @@ -397,7 +397,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim } case MidiNoteOff: - if( m_notes[event.key()] != NULL ) + if( m_notes[event.key()] != nullptr ) { // do actual note off and remove internal reference to NotePlayHandle (which itself will // be deleted later automatically) @@ -409,14 +409,14 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim { m_sustainedNotes << m_notes[event.key()]; } - m_notes[event.key()] = NULL; + m_notes[event.key()] = nullptr; Engine::audioEngine()->doneChangeInModel(); } eventHandled = true; break; case MidiKeyPressure: - if( m_notes[event.key()] != NULL ) + if( m_notes[event.key()] != nullptr ) { // setVolume() calls processOutEvent() with MidiKeyPressure so the // attached instrument will receive the event as well @@ -475,7 +475,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim switch( event.metaEvent() ) { case MidiNotePanning: - if( m_notes[event.key()] != NULL ) + if( m_notes[event.key()] != nullptr ) { eventHandled = true; m_notes[event.key()]->setPanning( event.panning() ); @@ -506,7 +506,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim void InstrumentTrack::processOutEvent( const MidiEvent& event, const TimePos& time, f_cnt_t offset ) { // do nothing if we do not have an instrument instance (e.g. when loading settings) - if( m_instrument == NULL ) + if( m_instrument == nullptr ) { return; } @@ -569,7 +569,7 @@ void InstrumentTrack::silenceAllNotes( bool removeIPH ) m_midiNotesMutex.lock(); for( int i = 0; i < NumKeys; ++i ) { - m_notes[i] = NULL; + m_notes[i] = nullptr; m_runningMidiNotes[i] = 0; } m_midiNotesMutex.unlock(); @@ -592,7 +592,7 @@ void InstrumentTrack::silenceAllNotes( bool removeIPH ) f_cnt_t InstrumentTrack::beatLen( NotePlayHandle * _n ) const { - if( m_instrument != NULL ) + if( m_instrument != nullptr ) { const f_cnt_t len = m_instrument->beatLen( _n ); if( len > 0 ) @@ -613,7 +613,7 @@ void InstrumentTrack::playNote( NotePlayHandle* n, sampleFrame* workingBuffer ) m_noteStacking.processNote( n ); m_arpeggio.processNote( n ); - if( n->isMasterNote() == false && m_instrument != NULL ) + if( n->isMasterNote() == false && m_instrument != nullptr ) { // all is done, so now lets play the note! m_instrument->playNote( n, workingBuffer ); @@ -625,7 +625,7 @@ void InstrumentTrack::playNote( NotePlayHandle* n, sampleFrame* workingBuffer ) QString InstrumentTrack::instrumentName() const { - if( m_instrument != NULL ) + if( m_instrument != nullptr ) { return m_instrument->displayName(); } @@ -637,7 +637,7 @@ QString InstrumentTrack::instrumentName() const void InstrumentTrack::deleteNotePluginData( NotePlayHandle* n ) { - if( m_instrument != NULL ) + if( m_instrument != nullptr ) { m_instrument->deleteNotePluginData( n ); } @@ -736,7 +736,7 @@ bool InstrumentTrack::play( const TimePos & _start, const fpp_t _frames, const float frames_per_tick = Engine::framesPerTick(); tcoVector tcos; - ::BBTrack * bb_track = NULL; + ::BBTrack * bb_track = nullptr; if( _tco_num >= 0 ) { TrackContentObject * tco = getTCO( _tco_num ); @@ -772,7 +772,7 @@ bool InstrumentTrack::play( const TimePos & _start, const fpp_t _frames, Pattern* p = dynamic_cast( *it ); // everything which is not a pattern won't be played // A pattern playing in the Piano Roll window will always play - if(p == NULL || + if(p == nullptr || (Engine::getSong()->playMode() != Song::Mode_PlayPattern && (*it)->isMuted())) { @@ -872,7 +872,7 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument& doc, QDomElement m_midiCCModel[i]->saveSettings(doc, midiCC, "cc" + QString::number(i)); } - if( m_instrument != NULL ) + if( m_instrument != nullptr ) { QDomElement i = doc.createElement( "instrument" ); i.setAttribute( "name", m_instrument->descriptor()->name ); @@ -974,7 +974,7 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement else { delete m_instrument; - m_instrument = NULL; + m_instrument = nullptr; m_instrument = Instrument::instantiate( node.toElement().attribute("name"), this, &key); m_instrument->restoreState(node.firstChildElement()); @@ -996,7 +996,7 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement !node.toElement().hasAttribute( "id" )) { delete m_instrument; - m_instrument = NULL; + m_instrument = nullptr; m_instrument = Instrument::instantiate( node.nodeName(), this, nullptr, true); if (m_instrument->nodeName() == node.nodeName()) @@ -1078,7 +1078,7 @@ Instrument * InstrumentTrack::loadInstrument(const QString & _plugin_name, -InstrumentTrack *InstrumentTrack::s_autoAssignedTrack = NULL; +InstrumentTrack *InstrumentTrack::s_autoAssignedTrack = nullptr; /*! \brief Automatically assign a midi controller to this track, based on the midiautoassign setting * @@ -1117,7 +1117,7 @@ void InstrumentTrack::autoAssignMidiDevice(bool assign) InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerView* tcv ) : TrackView( _it, tcv ), - m_window( NULL ), + m_window( nullptr ), m_lastPos( -1, -1 ) { setAcceptDrops( true ); @@ -1269,9 +1269,9 @@ void InstrumentTrackView::toggleMidiCCRack() InstrumentTrackWindow * InstrumentTrackView::topLevelInstrumentTrackWindow() { - InstrumentTrackWindow * w = NULL; + InstrumentTrackWindow * w = nullptr; for( const QMdiSubWindow * sw : - gui->mainWindow()->workspace()->subWindowList( + getGUI()->mainWindow()->workspace()->subWindowList( QMdiArea::ActivationHistoryOrder ) ) { if( sw->isVisible() && sw->widget()->inherits( "InstrumentTrackWindow" ) ) @@ -1289,7 +1289,7 @@ InstrumentTrackWindow * InstrumentTrackView::topLevelInstrumentTrackWindow() /*! \brief Create and assign a new FX Channel for this track */ void InstrumentTrackView::createFxLine() { - int channelIndex = gui->fxMixerView()->addNewChannel(); + int channelIndex = getGUI()->fxMixerView()->addNewChannel(); auto channel = Engine::fxMixer()->effectChannel(channelIndex); channel->m_name = getTrack()->name(); @@ -1306,7 +1306,7 @@ void InstrumentTrackView::assignFxLine(int channelIndex) { model()->effectChannelModel()->setValue( channelIndex ); - gui->fxMixerView()->setCurrentFxLine( channelIndex ); + getGUI()->fxMixerView()->setCurrentFxLine( channelIndex ); } @@ -1457,10 +1457,10 @@ QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel) // #### ITW: InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : QWidget(), - ModelView( NULL, this ), + ModelView( nullptr, this ), m_track( _itv->model() ), m_itv( _itv ), - m_instrumentView( NULL ) + m_instrumentView( nullptr ) { setAcceptDrops( true ); @@ -1516,7 +1516,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter; // set up volume knob - m_volumeKnob = new Knob( knobBright_26, NULL, tr( "Volume" ) ); + m_volumeKnob = new Knob( knobBright_26, nullptr, tr( "Volume" ) ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->setHintText( tr( "Volume:" ), "%" ); @@ -1530,7 +1530,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // set up panning knob - m_panningKnob = new Knob( knobBright_26, NULL, tr( "Panning" ) ); + m_panningKnob = new Knob( knobBright_26, nullptr, tr( "Panning" ) ); m_panningKnob->setHintText( tr( "Panning:" ), "" ); basicControlsLayout->addWidget( m_panningKnob, 0, 1 ); @@ -1546,7 +1546,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // set up pitch knob - m_pitchKnob = new Knob( knobBright_26, NULL, tr( "Pitch" ) ); + m_pitchKnob = new Knob( knobBright_26, nullptr, tr( "Pitch" ) ); m_pitchKnob->setHintText( tr( "Pitch:" ), " " + tr( "cents" ) ); basicControlsLayout->addWidget( m_pitchKnob, 0, 3 ); @@ -1559,7 +1559,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // set up pitch range knob - m_pitchRangeSpinBox= new LcdSpinBox( 2, NULL, tr( "Pitch range (semitones)" ) ); + m_pitchRangeSpinBox= new LcdSpinBox( 2, nullptr, tr( "Pitch range (semitones)" ) ); basicControlsLayout->addWidget( m_pitchRangeSpinBox, 0, 4 ); basicControlsLayout->setAlignment( m_pitchRangeSpinBox, widgetAlignment ); @@ -1574,7 +1574,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // setup spinbox for selecting FX-channel - m_effectChannelNumber = new FxLineLcdSpinBox( 2, NULL, tr( "FX channel" ), m_itv ); + m_effectChannelNumber = new FxLineLcdSpinBox( 2, nullptr, tr( "FX channel" ), m_itv ); basicControlsLayout->addWidget( m_effectChannelNumber, 0, 6 ); basicControlsLayout->setAlignment( m_effectChannelNumber, widgetAlignment ); @@ -1655,7 +1655,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : vlayout->addWidget( m_pianoView ); setModel( _itv->model() ); - QMdiSubWindow* subWin = gui->mainWindow()->addWindowedWidget( this ); + QMdiSubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; @@ -1737,7 +1737,7 @@ void InstrumentTrackWindow::modelChanged() { m_pitchKnob->hide(); m_pitchLabel->hide(); - m_pitchKnob->setModel( NULL ); + m_pitchKnob->setModel( nullptr ); m_pitchRangeSpinBox->hide(); m_pitchRangeLabel->hide(); } @@ -1822,7 +1822,7 @@ void InstrumentTrackWindow::updateName() void InstrumentTrackWindow::updateInstrumentView() { delete m_instrumentView; - if( m_track->m_instrument != NULL ) + if( m_track->m_instrument != nullptr ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); m_tabWidget->addTab( m_instrumentView, tr( "Plugin" ), "plugin_tab", 0 ); @@ -1880,7 +1880,7 @@ void InstrumentTrackWindow::closeEvent( QCloseEvent* event ) { event->ignore(); - if( gui->mainWindow()->workspace() ) + if( getGUI()->mainWindow()->workspace() ) { parentWidget()->hide(); } @@ -1951,7 +1951,7 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event ) if( !i->descriptor()->supportsFileType( ext ) ) { PluginFactory::PluginInfoAndKey piakn = - pluginFactory->pluginSupportingExtension(ext); + getPluginFactory()->pluginSupportingExtension(ext); i = m_track->loadInstrument(piakn.info.name(), &piakn.key); } diff --git a/src/tracks/Pattern.cpp b/src/tracks/Pattern.cpp index cd505c717..215fab774 100644 --- a/src/tracks/Pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -33,10 +33,10 @@ #include -QPixmap * PatternView::s_stepBtnOn0 = NULL; -QPixmap * PatternView::s_stepBtnOn200 = NULL; -QPixmap * PatternView::s_stepBtnOff = NULL; -QPixmap * PatternView::s_stepBtnOffLight = NULL; +QPixmap * PatternView::s_stepBtnOn0 = nullptr; +QPixmap * PatternView::s_stepBtnOn200 = nullptr; +QPixmap * PatternView::s_stepBtnOff = nullptr; +QPixmap * PatternView::s_stepBtnOffLight = nullptr; @@ -196,9 +196,9 @@ TimePos Pattern::beatPatternLength() const Note * Pattern::addNote( const Note & _new_note, const bool _quant_pos ) { Note * new_note = new Note( _new_note ); - if( _quant_pos && gui->pianoRoll() ) + if( _quant_pos && getGUI()->pianoRoll() ) { - new_note->quantizePos( gui->pianoRoll()->quantization() ); + new_note->quantizePos( getGUI()->pianoRoll()->quantization() ); } instrumentTrack()->lock(); @@ -252,7 +252,7 @@ Note * Pattern::noteAtStep( int _step ) return *it; } } - return NULL; + return nullptr; } @@ -486,7 +486,7 @@ Pattern * Pattern::adjacentPatternByOffset(int offset) const { QVector tcos = m_instrumentTrack->getTCOs(); int tcoNum = m_instrumentTrack->getTCONum(this); - return dynamic_cast(tcos.value(tcoNum + offset, NULL)); + return dynamic_cast(tcos.value(tcoNum + offset, nullptr)); } @@ -565,9 +565,11 @@ void Pattern::updateBBTrack() Engine::getBBTrackContainer()->updateBBTrack( this ); } - if( gui && gui->pianoRoll() && gui->pianoRoll()->currentPattern() == this ) + if( getGUI() != nullptr + && getGUI()->pianoRoll() + && getGUI()->pianoRoll()->currentPattern() == this ) { - gui->pianoRoll()->update(); + getGUI()->pianoRoll()->update(); } } diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 5f380b806..ef1c8bfc4 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -67,7 +67,7 @@ bool SampleTrack::play( const TimePos & _start, const fpp_t _frames, bool played_a_note = false; // will be return variable tcoVector tcos; - ::BBTrack * bb_track = NULL; + ::BBTrack * bb_track = nullptr; if( _tco_num >= 0 ) { if (_start > getTCO(_tco_num)->length())