Macro cleanup (#6095)

Summary:

* `NULL` -> `nullptr`
* `gui` -> Function `getGUI()`
* `pluginFactory` -> Function `getPluginFactory()`
* `assert` (redefinition) -> using `NDEBUG` instead, which standard `assert` respects.
* `powf` (C stdlib symbol clash) -> removed and all expansions replaced with calls to `std::pow`.
* `exp10` (nonstandard function symbol clash) -> removed and all expansions replaced with calls to `std::pow`.
* `PATH_DEV_DSP` -> File-scope QString of identical name and value.
* `VST_SNC_SHM_KEY_FILE` -> constexpr char* with identical name and value.
* `MM_ALLOC` and `MM_FREE` -> Functions with identical name and implementation.
* `INVAL`, `OUTVAL`, etc. for automation nodes -> Functions with identical names and implementations.
* BandLimitedWave.h: All integer constant macros replaced with constexpr ints of same name and value.
* `FAST_RAND_MAX` -> constexpr int of same name and value.
* `QSTR_TO_STDSTR` -> Function with identical name and equivalent implementation.
* `CCONST` -> constexpr function template with identical name and implementation.
* `F_OPEN_UTF8` -> Function with identical name and equivalent implementation.
* `LADSPA_PATH_SEPARATOR` -> constexpr char with identical name and value.
* `UI_CTRL_KEY` -> constexpr char* with identical name and value.
* `ALIGN_SIZE` -> Renamed to `LMMS_ALIGN_SIZE` and converted from a macro to a constexpr size_t.
* `JACK_MIDI_BUFFER_MAX` -> constexpr size_t with identical name and value.
* versioninfo.h: `PLATFORM`, `MACHINE` and `COMPILER_VERSION` -> prefixed with `LMMS_BUILDCONF_` and converted from macros to constexpr char* literals.
* Header guard _OSCILLOSCOPE -> renamed to OSCILLOSCOPE_H
* Header guard _TIME_DISPLAY_WIDGET -> renamed to TIME_DISPLAY_WIDGET_H
* C-style typecasts in DrumSynth.cpp have been replaced with `static_cast`.
* constexpr numerical constants are initialized with assignment notation instead of curly brace intializers.
* In portsmf, `Alg_seq::operator[]` will throw an exception instead of returning null if the operator index is out of range.

Additionally, in many places, global constants that were declared as `const T foo = bar;` were changed from const to constexpr, leaving them const and making them potentially evaluable at compile time.

Some macros that only appeared in single source files and were unused in those files have been removed entirely.
This commit is contained in:
Levin Oehlmann
2021-09-30 18:01:27 +02:00
committed by GitHub
parent 32b454fbec
commit f742710758
291 changed files with 1807 additions and 1762 deletions

View File

@@ -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 );

View File

@@ -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 ),

View File

@@ -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()

View File

@@ -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<float>
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<int>
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<bool>
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 )

View File

@@ -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;

View File

@@ -53,6 +53,8 @@ public:
typedef QMap<int, AutomationNode> timeMap;
typedef QVector<QPointer<AutomatableModel>> 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

View File

@@ -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,

View File

@@ -273,7 +273,7 @@ public:
m_type = _idx == DoubleLowPass
? LowPass
: Moog;
if( m_subFilter == NULL )
if( m_subFilter == nullptr )
{
m_subFilter = new BasicFilters<CHANNELS>(
static_cast<sample_rate_t>(
@@ -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();
}

View File

@@ -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()

View File

@@ -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 )

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -72,7 +72,7 @@ public:
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = MM_ALLOC( frame, maxDelay );
m_buffer = MM_ALLOC<frame>(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<frame>( 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<frame>( 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<frame>( 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<frame>( 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<frame>( 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<frame>( 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<frame>( maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;

View File

@@ -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 )
{

View File

@@ -39,7 +39,7 @@ class DummyInstrument : public Instrument
{
public:
DummyInstrument( InstrumentTrack * _instrument_track ) :
Instrument( _instrument_track, NULL )
Instrument( _instrument_track, nullptr )
{
}

View File

@@ -34,7 +34,7 @@ class DummyPlugin : public Plugin
{
public:
DummyPlugin() :
Plugin( NULL, NULL )
Plugin( nullptr, nullptr )
{
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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() {}

View File

@@ -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() {}

View File

@@ -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;

View File

@@ -85,6 +85,7 @@ private:
QLabel* m_loadingProgressLabel;
};
#define gui GuiApplication::instance()
// Short-hand function
LMMS_EXPORT GuiApplication* getGUI();
#endif // GUIAPPLICATION_H

View File

@@ -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;

View File

@@ -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();

View File

@@ -48,18 +48,24 @@ std::wstring toWString(const std::string& s)
#ifdef LMMS_BUILD_WIN32
#include <io.h>
#define F_OPEN_UTF8(a, b) _wfopen(toWString(a).data(), L##b)
#else
#ifdef LMMS_HAVE_UNISTD_H
#include <unistd.h>
#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));

View File

@@ -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

View File

@@ -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);

View File

@@ -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<type*>( MemoryManager::alloc( sizeof( type ) * count ) )
template<typename T>
T* MM_ALLOC(size_t count)
{
return reinterpret_cast<T*>(
MemoryManager::alloc(sizeof(T) * count));
}
// and just for symmetry...
#define MM_FREE( ptr ) MemoryManager::free( ptr )
template<typename T>
void MM_FREE(T* ptr)
{
MemoryManager::free(ptr);
}
#endif

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -71,7 +71,7 @@ public:
MidiPort( const QString& name,
MidiClient* client,
MidiEventProcessor* eventProcessor,
Model* parent = NULL,
Model* parent = nullptr,
Mode mode = Disabled );
virtual ~MidiPort();

View File

@@ -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();

View File

@@ -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 );

View File

@@ -23,8 +23,8 @@
*/
#ifndef _OSCILLOSCOPE
#define _OSCILLOSCOPE
#ifndef OSCILLOSCOPE_H
#define OSCILLOSCOPE_H
#include <QWidget>
#include <QPixmap>
@@ -73,4 +73,4 @@ private:
QColor m_clippingColor;
} ;
#endif
#endif // OSCILLOSCOPE_H

View File

@@ -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();

View File

@@ -137,7 +137,7 @@ public:
bool hasValidPattern() const
{
return m_pattern != NULL;
return m_pattern != nullptr;
}
Song::PlayModes desiredPlayModeForAccompany() const;

View File

@@ -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

View File

@@ -130,7 +130,7 @@ public:
{
typedef QMap<QString, QString> AttributeMap;
inline Key( const Plugin::Descriptor * desc = NULL,
inline Key( const Plugin::Descriptor * desc = nullptr,
const QString & name = QString(),
const AttributeMap & am = AttributeMap()
)

View File

@@ -103,6 +103,7 @@ private:
static std::unique_ptr<PluginFactory> s_instance;
};
#define pluginFactory PluginFactory::instance()
//Short-hand function
LMMS_EXPORT PluginFactory* getPluginFactory();
#endif // PLUGINFACTORY_H

View File

@@ -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;
}

View File

@@ -64,7 +64,7 @@ public:
bool isReady() const
{
return m_fileDev != NULL;
return m_fileDev != nullptr;
}
static ExportFileFormats getFileFormatFromExtension(

View File

@@ -92,6 +92,7 @@ typedef int32_t key_t;
#include <QtCore/QMutex>
#include <QtCore/QProcess>
#include <QtCore/QThread>
#include <QtCore/QString>
#ifndef SYNC_WITH_SHM_FIFO
#include <poll.h>
@@ -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

View File

@@ -32,7 +32,7 @@ class RmsHelper
{
public:
RmsHelper( int size ) :
m_buffer( NULL )
m_buffer( nullptr )
{
setSize( size );
}

View File

@@ -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 );
}
}

View File

@@ -97,7 +97,7 @@ public:
public:
PlayPos( const int abs = 0 ) :
TimePos( abs ),
m_timeLine( NULL ),
m_timeLine( nullptr ),
m_currentFrame( 0.0f )
{
}

View File

@@ -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;

View File

@@ -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 );

View File

@@ -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();

View File

@@ -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 )
{

View File

@@ -23,8 +23,8 @@
*
*/
#ifndef _TIME_DISPLAY_WIDGET
#define _TIME_DISPLAY_WIDGET
#ifndef TIME_DISPLAY_WIDGET_H
#define TIME_DISPLAY_WIDGET_H
#include <QWidget>
#include <QHBoxLayout>
@@ -67,4 +67,4 @@ private:
} ;
#endif
#endif // TIME_DISPLAY_WIDGET_H

View File

@@ -58,7 +58,7 @@ public:
virtual AutomationPattern * tempoAutomationPattern()
{
return NULL;
return nullptr;
}
int countTracks( Track::TrackTypes _tt = Track::NumTrackTypes ) const;

View File

@@ -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;

View File

@@ -27,125 +27,132 @@
#define AEFFECTX_H
#include <stdint.h>
#include <type_traits>
// 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<typename T>
constexpr int32_t CCONST(T a, T b, T c, T d)
{
static_assert(std::is_convertible<T,int32_t>::value, "int32 compatibility required.");
return (
static_cast<int32_t>(a) << 24 |
static_cast<int32_t>(b) << 16 |
static_cast<int32_t>(c) << 8 |
static_cast<int32_t>(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;

View File

@@ -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 <assert.h>
#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 <cassert>
#include <cstdio>

View File

@@ -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 )
{
}

View File

@@ -109,9 +109,9 @@ inline bool typeInfo<float>::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<sample_t, DEFAULT_CHANNELS>;
using surroundSampleFrame = std::array<sample_t, SURROUND_CHANNELS>;
#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

View File

@@ -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

View File

@@ -33,10 +33,6 @@
#include <cmath>
#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 );
}

View File

@@ -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

View File

@@ -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

View File

@@ -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
{

View File

@@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT amplifier_plugin_descriptor =
0x0100,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL,
nullptr,
nullptr,
} ;
}

View File

@@ -39,8 +39,8 @@ Plugin::Descriptor PLUGIN_EXPORT bassbooster_plugin_descriptor =
0x0100,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL,
nullptr,
nullptr,
} ;
}

View File

@@ -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<sampleFrame>( Engine::audioEngine()->framesPerPeriod() * OS_RATE );
m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) );
m_needsUpdate = true;

View File

@@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT compressor_plugin_descriptor =
0x0100,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL,
nullptr,
nullptr,
} ;
}

View File

@@ -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()));

View File

@@ -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<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
m_tmp2 = MM_ALLOC<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
m_work = MM_ALLOC<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
}
CrossoverEQEffect::~CrossoverEQEffect()

View File

@@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT delay_plugin_descriptor =
0x0100,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL,
nullptr,
nullptr,
} ;

View File

@@ -41,8 +41,8 @@ Plugin::Descriptor PLUGIN_EXPORT dualfilter_plugin_descriptor =
0x0100,
Plugin::Effect,
new PluginPixmapLoader( "logo" ),
NULL,
NULL,
nullptr,
nullptr,
} ;
}

View File

@@ -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" ) );

View File

@@ -44,8 +44,8 @@ Plugin::Descriptor PLUGIN_EXPORT eq_plugin_descriptor =
0x0100,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL,
nullptr,
nullptr,
} ;
}

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT flanger_plugin_descriptor =
0x0100,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL,
nullptr,
nullptr,
} ;

View File

@@ -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 );

View File

@@ -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<GigSample>::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<GigInstrument>();
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

View File

@@ -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;
}

View File

@@ -34,9 +34,9 @@ Plugin::Descriptor PLUGIN_EXPORT hydrogenimport_plugin_descriptor =
"frank mather",
0x0100,
Plugin::ImportFilter,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
} ;
}

View File

@@ -18,7 +18,7 @@ public:
virtual PluginView * instantiateView( QWidget * )
{
return( NULL );
return( nullptr );
}
private:
virtual bool tryImport( TrackContainer* tc );

View File

@@ -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 );
}

View File

@@ -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<sample_t> 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<LADSPA_Data>( 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<LADSPA_Data>( 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<LADSPA_Data>( Engine::audioEngine()->framesPerPeriod() );
}
else
{
p->rate = AUDIO_RATE_OUTPUT;
p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() );
p->buffer = MM_ALLOC<LADSPA_Data>( Engine::audioEngine()->framesPerPeriod() );
}
}
else
{
p->buffer = MM_ALLOC( LADSPA_Data, 1 );
p->buffer = MM_ALLOC<LADSPA_Data>( 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,

View File

@@ -54,9 +54,9 @@ Plugin::Descriptor PLUGIN_EXPORT midiexport_plugin_descriptor =
"Hyunjin Song <tteu.ingog/at/gmail.com>",
0x0100,
Plugin::ExportFilter,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
} ;
}

View File

@@ -70,9 +70,9 @@ Plugin::Descriptor PLUGIN_EXPORT midiimport_plugin_descriptor =
"Tobias Doerffel <tobydox/at/users/dot/sf/dot/net>",
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) ) );
}

View File

@@ -42,7 +42,7 @@ public:
virtual PluginView * instantiateView( QWidget * )
{
return( NULL );
return( nullptr );
}

View File

@@ -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);

View File

@@ -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 = &note->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];

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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 &notes = 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);

View File

@@ -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");

View File

@@ -446,7 +446,7 @@ Midifile_reader::Midifile_reader()
void Midifile_reader::finalize()
{
if (Msgbuff) Mf_free(Msgbuff, Msgsize);
Msgbuff = NULL;
Msgbuff = nullptr;
}

View File

@@ -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

View File

@@ -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<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
m_buffer.reset();
m_stages = static_cast<int>( m_controls.m_stages.value() );
updateFilters( 0, 19 );

View File

@@ -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 );
}

View File

@@ -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 ) );\

View File

@@ -40,8 +40,8 @@ Plugin::Descriptor PLUGIN_EXPORT reverbsc_plugin_descriptor =
0x0123,
Plugin::Effect,
new PluginPixmapLoader( "logo" ),
NULL,
NULL,
nullptr,
nullptr,
} ;
}

View File

@@ -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(

View File

@@ -47,8 +47,8 @@ extern "C" {
0x0112,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL,
nullptr,
nullptr,
};
}

View File

@@ -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;

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