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

@@ -82,8 +82,8 @@ AudioEngine::AudioEngine( bool renderOnly ) :
m_qualitySettings( qualitySettings::Mode_Draft ),
m_masterGain( 1.0f ),
m_isProcessing( false ),
m_audioDev( NULL ),
m_oldAudioDev( NULL ),
m_audioDev( nullptr ),
m_oldAudioDev( nullptr ),
m_audioDevStartFailed( false ),
m_profiler(),
m_metronomeActive(false),
@@ -222,7 +222,7 @@ void AudioEngine::startProcessing(bool needsFifo)
}
else
{
m_fifoWriter = NULL;
m_fifoWriter = nullptr;
}
m_audioDev->startProcessing();
@@ -237,13 +237,13 @@ void AudioEngine::stopProcessing()
{
m_isProcessing = false;
if( m_fifoWriter != NULL )
if( m_fifoWriter != nullptr )
{
m_fifoWriter->finish();
m_fifoWriter->wait();
m_audioDev->stopProcessing();
delete m_fifoWriter;
m_fifoWriter = NULL;
m_fifoWriter = nullptr;
}
else
{
@@ -270,7 +270,7 @@ sample_rate_t AudioEngine::baseSampleRate() const
sample_rate_t AudioEngine::outputSampleRate() const
{
return m_audioDev != NULL ? m_audioDev->sampleRate() :
return m_audioDev != nullptr ? m_audioDev->sampleRate() :
baseSampleRate();
}
@@ -279,7 +279,7 @@ sample_rate_t AudioEngine::outputSampleRate() const
sample_rate_t AudioEngine::inputSampleRate() const
{
return m_audioDev != NULL ? m_audioDev->sampleRate() :
return m_audioDev != nullptr ? m_audioDev->sampleRate() :
baseSampleRate();
}
@@ -651,7 +651,7 @@ void AudioEngine::restoreAudioDevice()
startProcessing();
}
m_oldAudioDev = NULL;
m_oldAudioDev = nullptr;
}
@@ -701,7 +701,7 @@ void AudioEngine::removePlayHandle(PlayHandle * ph)
// Check m_newPlayHandles first because doing it the other way around
// creates a race condition
for( LocklessListElement * e = m_newPlayHandles.first(),
* ePrev = NULL; e; ePrev = e, e = e->next )
* ePrev = nullptr; e; ePrev = e, e = e->next )
{
if (e->value == ph)
{
@@ -955,7 +955,7 @@ bool AudioEngine::isMidiDevNameValid(QString name)
AudioDevice * AudioEngine::tryAudioDevices()
{
bool success_ful = false;
AudioDevice * dev = NULL;
AudioDevice * dev = nullptr;
QString dev_name = ConfigManager::inst()->value( "mixer", "audiodev" );
if( !isAudioDevNameValid( dev_name ) )
{
@@ -1267,7 +1267,7 @@ void AudioEngine::fifoWriter::run()
}
// Let audio backend stop processing
write( NULL );
write( nullptr );
m_fifo->waitUntilRead();
}

View File

@@ -37,7 +37,7 @@
#endif
AudioEngineWorkerThread::JobQueue AudioEngineWorkerThread::globalJobQueue;
QWaitCondition * AudioEngineWorkerThread::queueReadyWaitCond = NULL;
QWaitCondition * AudioEngineWorkerThread::queueReadyWaitCond = nullptr;
QList<AudioEngineWorkerThread *> AudioEngineWorkerThread::workerThreads;
// implementation of internal JobQueue
@@ -115,7 +115,7 @@ AudioEngineWorkerThread::AudioEngineWorkerThread( AudioEngine* audioEngine ) :
m_quit( false )
{
// initialize global static data
if( queueReadyWaitCond == NULL )
if( queueReadyWaitCond == nullptr )
{
queueReadyWaitCond = new QWaitCondition;
}

View File

@@ -50,7 +50,7 @@ AutomatableModel::AutomatableModel(
m_valueChanged( false ),
m_setValueDepth( 0 ),
m_hasStrictStepSize( false ),
m_controllerConnection( NULL ),
m_controllerConnection( nullptr ),
m_valueBuffer( static_cast<int>( Engine::audioEngine()->framesPerPeriod() ) ),
m_lastUpdatedPeriod( -1 ),
m_hasSampleExactData(false),
@@ -604,7 +604,7 @@ ValueBuffer * AutomatableModel::valueBuffer()
{
return m_hasSampleExactData
? &m_valueBuffer
: NULL;
: nullptr;
}
float val = m_value; // make sure our m_value doesn't change midway
@@ -644,7 +644,7 @@ ValueBuffer * AutomatableModel::valueBuffer()
if (!m_controllerConnection)
{
AutomatableModel* lm = NULL;
AutomatableModel* lm = nullptr;
if (hasLinkedModels())
{
lm = m_linkedModels.first();
@@ -678,7 +678,7 @@ ValueBuffer * AutomatableModel::valueBuffer()
// in which case the recipient knows to use the static value() instead
m_lastUpdatedPeriod = s_periodCounter;
m_hasSampleExactData = false;
return NULL;
return nullptr;
}
@@ -689,7 +689,7 @@ void AutomatableModel::unlinkControllerConnection()
m_controllerConnection->disconnect( this );
}
m_controllerConnection = NULL;
m_controllerConnection = nullptr;
}
@@ -737,7 +737,7 @@ float AutomatableModel::globalAutomationValueAt( const TimePos& time )
if( s <= time && e >= time ) { patternsInRange += ( *it ); }
}
AutomationPattern * latestPattern = NULL;
AutomationPattern * latestPattern = nullptr;
if( ! patternsInRange.isEmpty() )
{

View File

@@ -598,7 +598,7 @@ float *AutomationPattern::valuesAfter( const TimePos & _time ) const
timeMap::const_iterator v = m_timeMap.lowerBound(_time);
if( v == m_timeMap.end() || (v+1) == m_timeMap.end() )
{
return NULL;
return nullptr;
}
int numValues = POS(v + 1) - POS(v);
@@ -859,7 +859,7 @@ const QString AutomationPattern::name() const
{
return TrackContentObject::name();
}
if( !m_objects.isEmpty() && m_objects.first() != NULL )
if( !m_objects.isEmpty() && m_objects.first() != nullptr )
{
return m_objects.first()->fullDisplayName();
}

View File

@@ -151,7 +151,7 @@ void BBTrackContainer::swapBB(int bb1, int bb2)
void BBTrackContainer::updateBBTrack(TrackContentObject * tco)
{
BBTrack * t = BBTrack::findBBTrack(tco->startPosition() / DefaultTicksPerBar);
if (t != NULL)
if (t != nullptr)
{
t->dataChanged();
}

View File

@@ -39,7 +39,7 @@ void BufferManager::init( fpp_t framesPerPeriod )
sampleFrame * BufferManager::acquire()
{
return MM_ALLOC( sampleFrame, ::framesPerPeriod );
return MM_ALLOC<sampleFrame>( ::framesPerPeriod );
}
void BufferManager::clear( sampleFrame *ab, const f_cnt_t frames, const f_cnt_t offset )

View File

@@ -53,7 +53,7 @@ static inline QString ensureTrailingSlash(const QString & s )
}
ConfigManager * ConfigManager::s_instanceOfMe = NULL;
ConfigManager * ConfigManager::s_instanceOfMe = nullptr;
ConfigManager::ConfigManager() :
@@ -493,9 +493,9 @@ void ConfigManager::loadConfigFile(const QString & configFile)
#endif
setBackgroundPicFile(value("paths", "backgroundtheme"));
}
else if(gui)
else if(getGUI() != nullptr)
{
QMessageBox::warning(NULL, MainWindow::tr("Configuration file"),
QMessageBox::warning(nullptr, MainWindow::tr("Configuration file"),
MainWindow::tr("Error while parsing configuration file at line %1:%2: %3").
arg(errorLine).
arg(errorCol).
@@ -622,9 +622,9 @@ void ConfigManager::saveConfigFile()
"the directory containing the "
"file and try again!"
).arg(m_lmmsRcFile);
if(gui)
if(getGUI() != nullptr)
{
QMessageBox::critical(NULL, title, message,
QMessageBox::critical(nullptr, title, message,
QMessageBox::Ok,
QMessageBox::NoButton);
}

View File

@@ -183,14 +183,14 @@ void Controller::resetFrameCounter()
Controller * Controller::create( ControllerTypes _ct, Model * _parent )
{
static Controller * dummy = NULL;
Controller * c = NULL;
static Controller * dummy = nullptr;
Controller * c = nullptr;
switch( _ct )
{
case Controller::DummyController:
if (!dummy)
dummy = new Controller( DummyController, NULL,
dummy = new Controller( DummyController, nullptr,
QString() );
c = dummy;
break;
@@ -231,7 +231,7 @@ Controller * Controller::create( const QDomElement & _this, Model * _parent )
_parent );
}
if( c != NULL )
if( c != nullptr )
{
c->restoreState( _this );
}
@@ -246,7 +246,7 @@ bool Controller::hasModel( const Model * m ) const
for (QObject * c : children())
{
AutomatableModel * am = qobject_cast<AutomatableModel*>(c);
if( am != NULL )
if( am != nullptr )
{
if( am == m )
{
@@ -254,7 +254,7 @@ bool Controller::hasModel( const Model * m ) const
}
ControllerConnection * cc = am->controllerConnection();
if( cc != NULL && cc->getController()->hasModel( m ) )
if( cc != nullptr && cc->getController()->hasModel( m ) )
{
return true;
}

View File

@@ -37,18 +37,18 @@ ControllerConnectionVector ControllerConnection::s_connections;
ControllerConnection::ControllerConnection(Controller * _controller) :
m_controller( NULL ),
m_controller( nullptr ),
m_controllerId( -1 ),
m_ownsController(false)
{
if( _controller != NULL )
if( _controller != nullptr )
{
setController( _controller );
}
else
{
m_controller = Controller::create( Controller::DummyController,
NULL );
nullptr );
}
s_connections.append( this );
}
@@ -57,7 +57,7 @@ ControllerConnection::ControllerConnection(Controller * _controller) :
ControllerConnection::ControllerConnection( int _controllerId ) :
m_controller( Controller::create( Controller::DummyController, NULL ) ),
m_controller( Controller::create( Controller::DummyController, nullptr ) ),
m_controllerId( _controllerId ),
m_ownsController( false )
{
@@ -95,7 +95,7 @@ void ControllerConnection::setController( Controller * _controller )
if( m_ownsController && m_controller )
{
delete m_controller;
m_controller = NULL;
m_controller = nullptr;
}
if( m_controller && m_controller->type() != Controller::DummyController )
@@ -105,7 +105,7 @@ void ControllerConnection::setController( Controller * _controller )
if( !_controller )
{
m_controller = Controller::create( Controller::DummyController, NULL );
m_controller = Controller::create( Controller::DummyController, nullptr );
}
else
{
@@ -220,7 +220,7 @@ void ControllerConnection::loadSettings( const QDomElement & _this )
}
else
{
m_controller = Controller::create( Controller::DummyController, NULL );
m_controller = Controller::create( Controller::DummyController, nullptr );
}
}
}

View File

@@ -137,9 +137,9 @@ DataFile::DataFile( const QString & _fileName ) :
QFile inFile( _fileName );
if( !inFile.open( QIODevice::ReadOnly ) )
{
if( gui )
if( getGUI() != nullptr )
{
QMessageBox::critical( NULL,
QMessageBox::critical( nullptr,
SongEditor::tr( "Could not open file" ),
SongEditor::tr( "Could not open file %1. You probably "
"have no permissions to read this "
@@ -208,7 +208,7 @@ bool DataFile::validate( QString extension )
case Type::UnknownType:
if (! ( extension == "mmp" || extension == "mpt" || extension == "mmpz" ||
extension == "xpf" || extension == "xml" ||
( extension == "xiz" && ! pluginFactory->pluginSupportingExtension(extension).isNull()) ||
( extension == "xiz" && ! getPluginFactory()->pluginSupportingExtension(extension).isNull()) ||
extension == "sf2" || extension == "sf3" || extension == "pat" || extension == "mid" ||
extension == "dll"
#ifdef LMMS_HAVE_LV2
@@ -290,7 +290,7 @@ bool DataFile::writeFile(const QString& filename, bool withResources)
{
// Small lambda function for displaying errors
auto showError = [this](QString title, QString body){
if (gui)
if (getGUI() != nullptr)
{
QMessageBox mb;
mb.setWindowTitle(title);
@@ -1005,7 +1005,7 @@ void DataFile::upgrade_0_4_0_beta1()
m["plugin"] = sl.value( 0 );
m["file"] = sl.value( 1 );
}
EffectKey key( NULL, name, m );
EffectKey key( nullptr, name, m );
el.appendChild( key.saveXML( *this ) );
}
}
@@ -1815,9 +1815,9 @@ void DataFile::loadData( const QByteArray & _data, const QString & _sourceFile )
if( line >= 0 && col >= 0 )
{
qWarning() << "at line" << line << "column" << errorMsg;
if( gui )
if( getGUI() != nullptr )
{
QMessageBox::critical( NULL,
QMessageBox::critical( nullptr,
SongEditor::tr( "Error in file" ),
SongEditor::tr( "The file %1 seems to contain "
"errors and therefore can't be "
@@ -1856,7 +1856,7 @@ void DataFile::loadData( const QByteArray & _data, const QString & _sourceFile )
if (createdWith.setCompareType(ProjectVersion::Minor)
!= openedWith.setCompareType(ProjectVersion::Minor)
&& gui != nullptr && root.attribute("type") == "song"
&& getGUI() != nullptr && root.attribute("type") == "song"
){
auto projectType = _sourceFile.endsWith(".mpt") ?
SongEditor::tr("template") : SongEditor::tr("project");

View File

@@ -29,13 +29,10 @@
#include <sstream>
#include <cstring>
#include <math.h> //sin(), exp(), etc.
#include <cmath> //sin(), exp(), etc.
#include <QFile>
#ifdef LMMS_BUILD_WIN32
#define powf pow
#endif
#ifdef _MSC_VER
//not #if LMMS_BUILD_WIN32 because we have strncasecmp in mingw
@@ -45,10 +42,6 @@
using namespace std;
#define WORD __u16
#define DWORD __u32
#define WAVE_FORMAT_PCM 0x0001
// const int Fs = 44100;
const float TwoPi = 6.2831853f;
const int MAX = 0;
@@ -206,7 +199,7 @@ int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const c
break;
k = strtok(line, " \t=");
b = strtok(NULL, "\n\r\0");
b = strtok(nullptr, "\n\r\0");
if (k != 0 && strcasecmp(k, key)==0) {
if (b==0) {
@@ -329,13 +322,13 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
timestretch *= Fs / 44100.f;
DGain = 1.0f; //leave this here!
DGain = (float)powf(10.0, 0.05 * GetPrivateProfileFloat(sec,"Level",0,dsfile));
DGain = static_cast<float>(std::pow(10.0, 0.05 * GetPrivateProfileFloat(sec,"Level",0,dsfile)));
MasterTune = GetPrivateProfileFloat(sec,"Tuning",0.0,dsfile);
MasterTune = (float)powf(1.0594631f, MasterTune + mem_tune);
MasterTune = static_cast<float>(std::pow(1.0594631f, MasterTune + mem_tune));
MainFilter = 2 * GetPrivateProfileInt(sec,"Filter",0,dsfile);
MFres = 0.0101f * GetPrivateProfileFloat(sec,"Resonance",0.0,dsfile);
MFres = (float)powf(MFres, 0.5f);
MFres = static_cast<float>(std::pow(MFres, 0.5f));
HighPass = GetPrivateProfileInt(sec,"HighPass",0,dsfile);
GetEnv(7, sec, "FilterEnv", dsfile);
@@ -370,7 +363,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
TDroopRate = GetPrivateProfileFloat(sec,"Droop",0.f,dsfile);
if(TDroopRate>0.f)
{
TDroopRate = (float)powf(10.0f, (TDroopRate - 20.0f) / 30.0f);
TDroopRate = static_cast<float>(std::pow(10.0f, (TDroopRate - 20.0f) / 30.0f));
TDroopRate = TDroopRate * -4.f / envData[1][MAX];
TDroop = 1;
F2 = F1+((F2-F1)/(1.f-(float)exp(TDroopRate * envData[1][MAX])));
@@ -393,7 +386,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
OW1 = GetPrivateProfileInt(sec,"Wave1",0,dsfile);
OW2 = GetPrivateProfileInt(sec,"Wave2",0,dsfile);
OBal2 = (float)GetPrivateProfileInt(sec,"Param",50,dsfile);
ODrive = (float)powf(OBal2, 3.0f) / (float)powf(50.0f, 3.0f);
ODrive = static_cast<float>(std::pow(OBal2, 3.0f)) / std::pow(50.0f, 3.0f);
OBal2 *= 0.01f;
OBal1 = 1.f - OBal2;
Ophi1 = Tphi;
@@ -453,8 +446,8 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
{
DAtten = DGain * (short)LoudestEnv();
if(DAtten>32700) clippoint=32700; else clippoint=(short)DAtten;
DAtten = (float)powf(2.0, 2.0 * GetPrivateProfileInt(sec,"Bits",0,dsfile));
DGain = DAtten * DGain * (float)powf(10.0, 0.05 * GetPrivateProfileInt(sec,"Clipping",0,dsfile));
DAtten = static_cast<float>(std::pow(2.0, 2.0 * GetPrivateProfileInt(sec,"Bits",0,dsfile)));
DGain = DAtten * DGain * static_cast<float>(std::pow(10.0, 0.05 * GetPrivateProfileInt(sec,"Clipping",0,dsfile)));
}
//prepare envelopes
@@ -466,7 +459,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
//if(wave!=NULL) free(wave);
//wave = new int16_t[channels * (Length + 1280)]; //wave memory buffer
wave = new int16_t[channels * Length]; //wave memory buffer
if(wave==NULL) {return 0;}
if(wave==nullptr) {return 0;}
wavewords = 0;
/*
@@ -664,7 +657,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
MFtmp = envData[7][ENV];
if(MFtmp >0.2f)
MFfb = 1.001f - (float)powf(10.0f, MFtmp - 1);
MFfb = 1.001f - static_cast<float>(std::pow(10.0f, MFtmp - 1));
else
MFfb = 0.999f - 0.7824f * MFtmp;
@@ -682,7 +675,7 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa
MFtmp = envData[7][ENV];
if(MFtmp >0.2f)
MFfb = 1.001f - (float)powf(10.0f, MFtmp - 1);
MFfb = 1.001f - static_cast<float>(std::pow(10.0f, MFtmp - 1));
else
MFfb = 0.999f - 0.7824f * MFtmp;

View File

@@ -37,7 +37,7 @@ Effect::Effect( const Plugin::Descriptor * _desc,
Model * _parent,
const Descriptor::SubPluginFeatures::Key * _key ) :
Plugin( _desc, _parent, _key ),
m_parent( NULL ),
m_parent( nullptr ),
m_processors( 1 ),
m_okay( true ),
m_noRun( false ),
@@ -49,7 +49,7 @@ Effect::Effect( const Plugin::Descriptor * _desc,
m_autoQuitModel( 1.0f, 1.0f, 8000.0f, 100.0f, 1.0f, this, tr( "Decay" ) ),
m_autoQuitDisabled( false )
{
m_srcState[0] = m_srcState[1] = NULL;
m_srcState[0] = m_srcState[1] = nullptr;
reinitSRC();
if( ConfigManager::inst()->value( "ui", "disableautoquit").toInt() )
@@ -65,7 +65,7 @@ Effect::~Effect()
{
for( int i = 0; i < 2; ++i )
{
if( m_srcState[i] != NULL )
if( m_srcState[i] != nullptr )
{
src_delete( m_srcState[i] );
}
@@ -118,7 +118,7 @@ Effect * Effect::instantiate( const QString& pluginName,
{
Plugin * p = Plugin::instantiateWithKey( pluginName, _parent, _key );
// check whether instantiated plugin is an effect
if( dynamic_cast<Effect *>( p ) != NULL )
if( dynamic_cast<Effect *>( p ) != nullptr )
{
// everything ok, so return pointer
Effect * effect = dynamic_cast<Effect *>( p );
@@ -129,7 +129,7 @@ Effect * Effect::instantiate( const QString& pluginName,
// not quite... so delete plugin and leave it up to the caller to instantiate a DummyEffect
delete p;
return NULL;
return nullptr;
}
@@ -174,7 +174,7 @@ void Effect::reinitSRC()
{
for( int i = 0; i < 2; ++i )
{
if( m_srcState[i] != NULL )
if( m_srcState[i] != nullptr )
{
src_delete( m_srcState[i] );
}
@@ -182,7 +182,7 @@ void Effect::reinitSRC()
if( ( m_srcState[i] = src_new(
Engine::audioEngine()->currentQualitySettings().
libsrcInterpolation(),
DEFAULT_CHANNELS, &error ) ) == NULL )
DEFAULT_CHANNELS, &error ) ) == nullptr )
{
qFatal( "Error: src_new() failed in effect.cpp!\n" );
}
@@ -197,7 +197,7 @@ void Effect::resample( int _i, const sampleFrame * _src_buf,
sampleFrame * _dst_buf, sample_rate_t _dst_sr,
f_cnt_t _frames )
{
if( m_srcState[_i] == NULL )
if( m_srcState[_i] == nullptr )
{
return;
}

View File

@@ -36,7 +36,7 @@
EffectChain::EffectChain( Model * _parent ) :
Model( _parent ),
SerializingObject(),
m_enabledModel( false, NULL, tr( "Effects enabled" ) )
m_enabledModel( false, nullptr, tr( "Effects enabled" ) )
{
}
@@ -97,7 +97,7 @@ void EffectChain::loadSettings( const QDomElement & _this )
Effect* e = Effect::instantiate( name.toUtf8(), this, &key );
if( e != NULL && e->isOkay() && e->nodeName() == node.nodeName() )
if( e != nullptr && e->isOkay() && e->nodeName() == node.nodeName() )
{
e->restoreState( effectData );
}

View File

@@ -38,15 +38,15 @@
#include "Oscillator.h"
float LmmsCore::s_framesPerTick;
AudioEngine* LmmsCore::s_audioEngine = NULL;
FxMixer * LmmsCore::s_fxMixer = NULL;
BBTrackContainer * LmmsCore::s_bbTrackContainer = NULL;
Song * LmmsCore::s_song = NULL;
ProjectJournal * LmmsCore::s_projectJournal = NULL;
AudioEngine* LmmsCore::s_audioEngine = nullptr;
FxMixer * LmmsCore::s_fxMixer = nullptr;
BBTrackContainer * LmmsCore::s_bbTrackContainer = nullptr;
Song * LmmsCore::s_song = nullptr;
ProjectJournal * LmmsCore::s_projectJournal = nullptr;
#ifdef LMMS_HAVE_LV2
Lv2Manager * LmmsCore::s_lv2Manager = nullptr;
#endif
Ladspa2LMMS * LmmsCore::s_ladspaManager = NULL;
Ladspa2LMMS * LmmsCore::s_ladspaManager = nullptr;
void* LmmsCore::s_dndPluginKey = nullptr;
@@ -166,4 +166,4 @@ void *LmmsCore::pickDndPluginKey()
LmmsCore * LmmsCore::s_instanceOfMe = NULL;
LmmsCore * LmmsCore::s_instanceOfMe = nullptr;

View File

@@ -38,7 +38,7 @@ extern const float SECS_PER_LFO_OSCILLATION = 20.0f;
const f_cnt_t minimumFrames = 1;
EnvelopeAndLfoParameters::LfoInstances * EnvelopeAndLfoParameters::s_lfoInstances = NULL;
EnvelopeAndLfoParameters::LfoInstances * EnvelopeAndLfoParameters::s_lfoInstances = nullptr;
void EnvelopeAndLfoParameters::LfoInstances::trigger()
@@ -102,8 +102,8 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters(
m_valueForZeroAmount( _value_for_zero_amount ),
m_pahdFrames( 0 ),
m_rFrames( 0 ),
m_pahdEnv( NULL ),
m_rEnv( NULL ),
m_pahdEnv( nullptr ),
m_rEnv( nullptr ),
m_pahdBufSize( 0 ),
m_rBufSize( 0 ),
m_lfoPredelayModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO pre-delay" ) ),
@@ -117,12 +117,12 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters(
m_controlEnvAmountModel( false, this, tr( "Modulate env amount" ) ),
m_lfoFrame( 0 ),
m_lfoAmountIsZero( false ),
m_lfoShapeData( NULL )
m_lfoShapeData( nullptr )
{
m_amountModel.setCenterValue( 0 );
m_lfoAmountModel.setCenterValue( 0 );
if( s_lfoInstances == NULL )
if( s_lfoInstances == nullptr )
{
s_lfoInstances = new LfoInstances();
}
@@ -195,7 +195,7 @@ EnvelopeAndLfoParameters::~EnvelopeAndLfoParameters()
if( instances()->isEmpty() )
{
delete instances();
s_lfoInstances = NULL;
s_lfoInstances = nullptr;
}
}

View File

@@ -39,7 +39,7 @@
FxRoute::FxRoute( FxChannel * from, FxChannel * to, float amount ) :
m_from( from ),
m_to( to ),
m_amount( amount, 0, 1, 0.001, NULL,
m_amount( amount, 0, 1, 0.001, nullptr,
tr( "Amount to send from channel %1 to channel %2" ).arg( m_from->m_channelIndex ).arg( m_to->m_channelIndex ) )
{
//qDebug( "created: %d to %d", m_from->m_channelIndex, m_to->m_channelIndex );
@@ -60,7 +60,7 @@ void FxRoute::updateName()
FxChannel::FxChannel( int idx, Model * _parent ) :
m_fxChain( NULL ),
m_fxChain( nullptr ),
m_hasInput( false ),
m_stillRunning( false ),
m_peakLeft( 0.0f ),
@@ -189,7 +189,7 @@ void FxChannel::doProcessing()
FxMixer::FxMixer() :
Model( NULL ),
Model( nullptr ),
JournallingObject(),
m_fxChannels()
{
@@ -467,7 +467,7 @@ FxRoute * FxMixer::createRoute( FxChannel * from, FxChannel * to, float amount )
{
if( from == to )
{
return NULL;
return nullptr;
}
Engine::audioEngine()->requestChangeInModel();
FxRoute * route = new FxRoute( from, to, amount );
@@ -562,7 +562,7 @@ FloatModel * FxMixer::channelSendModel( fx_ch_t fromChannel, fx_ch_t toChannel )
{
if( fromChannel == toChannel )
{
return NULL;
return nullptr;
}
const FxChannel * from = m_fxChannels[fromChannel];
const FxChannel * to = m_fxChannels[toChannel];
@@ -575,7 +575,7 @@ FloatModel * FxMixer::channelSendModel( fx_ch_t fromChannel, fx_ch_t toChannel )
}
}
return NULL;
return nullptr;
}

View File

@@ -37,7 +37,7 @@ using std::unique_ptr;
ImportFilter::ImportFilter( const QString & _file_name,
const Descriptor * _descriptor ) :
Plugin( _descriptor, NULL ),
Plugin( _descriptor, nullptr ),
m_file( _file_name )
{
}
@@ -64,10 +64,10 @@ void ImportFilter::import( const QString & _file_to_import,
const bool j = Engine::projectJournal()->isJournalling();
Engine::projectJournal()->setJournalling( false );
for (const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::ImportFilter))
for (const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::ImportFilter))
{
unique_ptr<Plugin> p(Plugin::instantiate( desc->name, NULL, s.data() ));
if( dynamic_cast<ImportFilter *>( p.get() ) != NULL &&
unique_ptr<Plugin> p(Plugin::instantiate( desc->name, nullptr, s.data() ));
if( dynamic_cast<ImportFilter *>( p.get() ) != nullptr &&
dynamic_cast<ImportFilter *>( p.get() )->tryImport( tc ) )
{
successful = true;
@@ -79,7 +79,7 @@ void ImportFilter::import( const QString & _file_to_import,
if( successful == false )
{
QMessageBox::information( NULL,
QMessageBox::information( nullptr,
TrackContainer::tr( "Couldn't import file" ),
TrackContainer::tr( "Couldn't find a filter for "
"importing file %1.\n"
@@ -99,7 +99,7 @@ bool ImportFilter::openFile()
{
if( m_file.open( QFile::ReadOnly ) == false )
{
QMessageBox::critical( NULL,
QMessageBox::critical( nullptr,
TrackContainer::tr( "Couldn't open file" ),
TrackContainer::tr( "Couldn't open file %1 "
"for reading.\nPlease make "

View File

@@ -34,7 +34,7 @@
Instrument::Instrument(InstrumentTrack * _instrument_track,
const Descriptor * _descriptor,
const Descriptor::SubPluginFeatures::Key *key) :
Plugin(_descriptor, NULL/* _instrument_track*/, key),
Plugin(_descriptor, nullptr/* _instrument_track*/, key),
m_instrumentTrack( _instrument_track )
{
}

View File

@@ -118,7 +118,7 @@ void JournallingObject::changeID( jo_id_t _id )
{
JournallingObject * jo = Engine::projectJournal()->
journallingObject( _id );
if( jo != NULL )
if( jo != nullptr )
{
QString used_by = jo->nodeName();
if( used_by == "automatablemodel" &&

View File

@@ -142,7 +142,7 @@ ValueBuffer * LadspaControl::valueBuffer()
case TOGGLED:
case INTEGER:
case ENUM:
return NULL;
return nullptr;
case FLOATING:
return m_knobModel.valueBuffer();
case TIME:
@@ -152,7 +152,7 @@ ValueBuffer * LadspaControl::valueBuffer()
break;
}
return NULL;
return nullptr;
}

View File

@@ -86,7 +86,7 @@ LadspaManager::LadspaManager()
LADSPA_Descriptor_Function descriptorFunction =
( LADSPA_Descriptor_Function ) plugin_lib.resolve(
"ladspa_descriptor" );
if( descriptorFunction != NULL )
if( descriptorFunction != nullptr )
{
addPlugins( descriptorFunction,
f.fileName() );
@@ -132,7 +132,7 @@ ladspaManagerDescription * LadspaManager::getDescription(
}
else
{
return( NULL );
return( nullptr );
}
}
@@ -146,7 +146,7 @@ void LadspaManager::addPlugins(
const LADSPA_Descriptor * descriptor;
for( long pluginIndex = 0;
( descriptor = _descriptor_func( pluginIndex ) ) != NULL;
( descriptor = _descriptor_func( pluginIndex ) ) != nullptr;
++pluginIndex )
{
ladspa_key_t key( _file, QString( descriptor->Label ) );
@@ -244,7 +244,7 @@ const LADSPA_PortDescriptor* LadspaManager::getPortDescriptor(const ladspa_key_t
{
return( & descriptor->PortDescriptors[_port] );
}
return( NULL );
return( nullptr );
}
const LADSPA_PortRangeHint *LadspaManager::getPortRangeHint(const ladspa_key_t &_plugin, uint32_t _port)
@@ -254,7 +254,7 @@ const LADSPA_PortRangeHint *LadspaManager::getPortRangeHint(const ladspa_key_t &
{
return( & descriptor->PortRangeHints[_port] );
}
return( NULL );
return( nullptr );
}
@@ -565,7 +565,7 @@ const void * LadspaManager::getImplementationData(
const ladspa_key_t & _plugin )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
return( descriptor ? descriptor->ImplementationData : NULL );
return( descriptor ? descriptor->ImplementationData : nullptr );
}
@@ -585,7 +585,7 @@ const LADSPA_Descriptor * LadspaManager::getDescriptor(
}
else
{
return( NULL );
return( nullptr );
}
}
@@ -599,7 +599,7 @@ LADSPA_Handle LadspaManager::instantiate(
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
return( descriptor ?
( descriptor->instantiate )( descriptor, _sample_rate ) :
NULL );
nullptr );
}
@@ -611,7 +611,7 @@ bool LadspaManager::connectPort( const ladspa_key_t & _plugin,
LADSPA_Data * _data_location )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
if( descriptor && descriptor->connect_port != NULL &&
if( descriptor && descriptor->connect_port != nullptr &&
_port < getPortCount( _plugin ) )
{
( descriptor->connect_port )
@@ -628,7 +628,7 @@ bool LadspaManager::activate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
if( descriptor && descriptor->activate != NULL )
if( descriptor && descriptor->activate != nullptr )
{
( descriptor->activate ) ( _instance );
return( true );
@@ -644,7 +644,7 @@ bool LadspaManager::run( const ladspa_key_t & _plugin,
uint32_t _sample_count )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
if( descriptor && descriptor->run!= NULL )
if( descriptor && descriptor->run!= nullptr )
{
( descriptor->run ) ( _instance, _sample_count );
return( true );
@@ -660,8 +660,8 @@ bool LadspaManager::runAdding( const ladspa_key_t & _plugin,
uint32_t _sample_count )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
if( descriptor && descriptor->run_adding!= NULL
&& descriptor->set_run_adding_gain != NULL )
if( descriptor && descriptor->run_adding!= nullptr
&& descriptor->set_run_adding_gain != nullptr )
{
( descriptor->run_adding ) ( _instance, _sample_count );
return( true );
@@ -677,8 +677,8 @@ bool LadspaManager::setRunAddingGain( const ladspa_key_t & _plugin,
LADSPA_Data _gain )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
if( descriptor && descriptor->run_adding!= NULL
&& descriptor->set_run_adding_gain != NULL )
if( descriptor && descriptor->run_adding!= nullptr
&& descriptor->set_run_adding_gain != nullptr )
{
( descriptor->set_run_adding_gain ) ( _instance, _gain );
return( true );
@@ -693,7 +693,7 @@ bool LadspaManager::deactivate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
if( descriptor && descriptor->deactivate!= NULL )
if( descriptor && descriptor->deactivate!= nullptr )
{
( descriptor->deactivate ) ( _instance );
return( true );
@@ -708,7 +708,7 @@ bool LadspaManager::cleanup( const ladspa_key_t & _plugin,
LADSPA_Handle _instance )
{
const LADSPA_Descriptor * descriptor = getDescriptor( _plugin );
if( descriptor && descriptor->cleanup!= NULL )
if( descriptor && descriptor->cleanup!= nullptr )
{
( descriptor->cleanup ) ( _instance );
return( true );

View File

@@ -102,7 +102,7 @@ void LfoController::updateValueBuffer()
for( float& f : m_valueBuffer )
{
const float currentSample = m_sampleFunction != NULL
const float currentSample = m_sampleFunction != nullptr
? m_sampleFunction( phase )
: m_userDefSampleBuffer->userWaveSample( phase );
@@ -170,7 +170,7 @@ void LfoController::updateSampleFunction()
m_sampleFunction = &Oscillator::noiseSample;
break;
case Oscillator::UserDefinedWave:
m_sampleFunction = NULL;
m_sampleFunction = nullptr;
/*TODO: If C++11 is allowed, should change the type of
m_sampleFunction be std::function<sample_t(const float)>
and use the line below:

View File

@@ -113,7 +113,7 @@ void * LocklessAllocator::alloc()
if( !available )
{
fprintf( stderr, "LocklessAllocator: No free space\n" );
return NULL;
return nullptr;
}
}
while (!m_available.compare_exchange_weak(available, available - 1));

View File

@@ -33,14 +33,14 @@
void* MemoryHelper::alignedMalloc( size_t byteNum )
{
char *ptr, *ptr2, *aligned_ptr;
int align_mask = ALIGN_SIZE - 1;
int align_mask = LMMS_ALIGN_SIZE - 1;
ptr = static_cast<char*>( malloc( byteNum + ALIGN_SIZE + sizeof( int ) ) );
ptr = static_cast<char*>( malloc( byteNum + LMMS_ALIGN_SIZE + sizeof( int ) ) );
if( ptr == NULL ) return NULL;
if( ptr == nullptr ) return nullptr;
ptr2 = ptr + sizeof( int );
aligned_ptr = ptr2 + ( ALIGN_SIZE - ( ( size_t ) ptr2 & align_mask ) );
aligned_ptr = ptr2 + ( LMMS_ALIGN_SIZE - ( ( size_t ) ptr2 & align_mask ) );
ptr2 = aligned_ptr - sizeof( int );
*( ( int* ) ptr2 ) = ( int )( aligned_ptr - ptr );

View File

@@ -44,7 +44,7 @@ Note::Note( const TimePos & length, const TimePos & pos,
m_panning( qBound( PanningLeft, panning, PanningRight ) ),
m_length( length ),
m_pos( pos ),
m_detuning( NULL )
m_detuning( nullptr )
{
if( detuning )
{
@@ -71,7 +71,7 @@ Note::Note( const Note & note ) :
m_panning( note.m_panning ),
m_length( note.m_length ),
m_pos( note.m_pos ),
m_detuning( NULL )
m_detuning( nullptr )
{
if( note.m_detuning )
{
@@ -208,7 +208,7 @@ void Note::loadSettings( const QDomElement & _this )
void Note::createDetuning()
{
if( m_detuning == NULL )
if( m_detuning == nullptr )
{
m_detuning = new DetuningHelper;
(void) m_detuning->automationPattern();

View File

@@ -53,7 +53,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
Origin origin ) :
PlayHandle( TypeNotePlayHandle, _offset ),
Note( n.length(), n.pos(), n.key(), n.getVolume(), n.getPanning(), n.detuning() ),
m_pluginData( NULL ),
m_pluginData( nullptr ),
m_instrumentTrack( instrumentTrack ),
m_frames( 0 ),
m_totalFramesPlayed( 0 ),
@@ -64,16 +64,16 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
m_released( false ),
m_releaseStarted( false ),
m_hasMidiNote( false ),
m_hasParent( parent != NULL ),
m_hasParent( parent != nullptr ),
m_parent( parent ),
m_hadChildren( false ),
m_muted( false ),
m_bbTrack( NULL ),
m_bbTrack( nullptr ),
m_origTempo( Engine::getSong()->getTempo() ),
m_origBaseNote( instrumentTrack->baseNote() ),
m_frequency( 0 ),
m_unpitchedFrequency( 0 ),
m_baseDetuning( NULL ),
m_baseDetuning( nullptr ),
m_songGlobalParentOffset( 0 ),
m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack->midiPort()->realOutputChannel() ),
m_origin( origin ),
@@ -133,14 +133,14 @@ NotePlayHandle::~NotePlayHandle()
m_parent->m_subNotes.removeOne( this );
}
if( m_pluginData != NULL )
if( m_pluginData != nullptr )
{
m_instrumentTrack->deleteNotePluginData( this );
}
if( m_instrumentTrack->m_notes[key()] == this )
{
m_instrumentTrack->m_notes[key()] = NULL;
m_instrumentTrack->m_notes[key()] = nullptr;
}
m_subNotes.clear();
@@ -458,7 +458,7 @@ int NotePlayHandle::index() const
for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it )
{
const NotePlayHandle * nph = dynamic_cast<const NotePlayHandle *>( *it );
if( nph == NULL || nph->m_instrumentTrack != m_instrumentTrack || nph->isReleased() || nph->hasParent() )
if( nph == nullptr || nph->m_instrumentTrack != m_instrumentTrack || nph->isReleased() || nph->hasParent() )
{
continue;
}
@@ -482,7 +482,7 @@ ConstNotePlayHandleList NotePlayHandle::nphsOfInstrumentTrack( const InstrumentT
for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it )
{
const NotePlayHandle * nph = dynamic_cast<const NotePlayHandle *>( *it );
if( nph != NULL && nph->m_instrumentTrack == _it && ( ( nph->isReleased() == false && nph->hasParent() == false ) || _all_ph == true ) )
if( nph != nullptr && nph->m_instrumentTrack == _it && ( ( nph->isReleased() == false && nph->hasParent() == false ) || _all_ph == true ) )
{
cnphv.push_back( nph );
}
@@ -602,9 +602,9 @@ int NotePlayHandleManager::s_size;
void NotePlayHandleManager::init()
{
s_available = MM_ALLOC( NotePlayHandle*, INITIAL_NPH_CACHE );
s_available = MM_ALLOC<NotePlayHandle*>( INITIAL_NPH_CACHE );
NotePlayHandle * n = MM_ALLOC( NotePlayHandle, INITIAL_NPH_CACHE );
NotePlayHandle * n = MM_ALLOC<NotePlayHandle>( INITIAL_NPH_CACHE );
for( int i=0; i < INITIAL_NPH_CACHE; ++i )
{
@@ -647,11 +647,11 @@ void NotePlayHandleManager::release( NotePlayHandle * nph )
void NotePlayHandleManager::extend( int c )
{
s_size += c;
NotePlayHandle ** tmp = MM_ALLOC( NotePlayHandle*, s_size );
NotePlayHandle ** tmp = MM_ALLOC<NotePlayHandle*>( s_size );
MM_FREE( s_available );
s_available = tmp;
NotePlayHandle * n = MM_ALLOC( NotePlayHandle, c );
NotePlayHandle * n = MM_ALLOC<NotePlayHandle>( c );
for( int i=0; i < c; ++i )
{

View File

@@ -180,7 +180,7 @@ void Oscillator::generateFromFFT(int bands, sample_t* table)
void Oscillator::generateAntiAliasUserWaveTable(SampleBuffer *sampleBuffer)
{
if (sampleBuffer->m_userAntiAliasWaveTable == NULL) {return;}
if (sampleBuffer->m_userAntiAliasWaveTable == nullptr) {return;}
for (int i = 0; i < OscillatorConstants::WAVE_TABLES_PER_WAVEFORM_COUNT; ++i)
{
@@ -553,7 +553,7 @@ inline bool Oscillator::syncOk( float _osc_coeff )
float Oscillator::syncInit( sampleFrame * _ab, const fpp_t _frames,
const ch_cnt_t _chnl )
{
if( m_subOsc != NULL )
if( m_subOsc != nullptr )
{
m_subOsc->update( _ab, _frames, _chnl );
}

View File

@@ -65,7 +65,7 @@ PeakController::PeakController( Model * _parent,
PeakController::~PeakController()
{
if( m_peakEffect != NULL && m_peakEffect->effectChain() != NULL )
if( m_peakEffect != nullptr && m_peakEffect->effectChain() != nullptr )
{
m_peakEffect->effectChain()->removeEffect( m_peakEffect );
}
@@ -128,7 +128,7 @@ void PeakController::handleDestroyedEffect( )
// possible race condition...
//printf("disconnecting effect\n");
disconnect( m_peakEffect );
m_peakEffect = NULL;
m_peakEffect = nullptr;
//deleteLater();
delete this;
}
@@ -235,7 +235,7 @@ PeakController * PeakController::getControllerBySetting(const QDomElement & _thi
}
}
return NULL;
return nullptr;
}

View File

@@ -59,7 +59,7 @@ static const Piano::KeyTypes KEY_ORDER[] =
* \param _it the InstrumentTrack window to attach to
*/
Piano::Piano( InstrumentTrack* track ) :
Model( NULL ), /*!< base class ctor */
Model( nullptr ), /*!< base class ctor */
m_instrumentTrack( track ),
m_midiEvProc( track ) /*!< the InstrumentTrack Model */
{

View File

@@ -59,7 +59,7 @@ void PlayHandle::doProcessing()
}
else
{
play( NULL );
play( nullptr );
}
}

View File

@@ -49,7 +49,7 @@ static Plugin::Descriptor dummyPluginDescriptor =
0x0100,
Plugin::Undefined,
&dummyLoader,
NULL
nullptr
} ;
@@ -62,7 +62,7 @@ Plugin::Plugin(const Descriptor * descriptor, Model * parent, const
m_descriptor(descriptor),
m_key(key ? *key : Descriptor::SubPluginFeatures::Key(m_descriptor))
{
if( m_descriptor == NULL )
if( m_descriptor == nullptr )
{
m_descriptor = &dummyPluginDescriptor;
}
@@ -194,7 +194,7 @@ Plugin * Plugin::instantiateWithKey(const QString& pluginName, Model * parent,
const Descriptor::SubPluginFeatures::Key *keyPtr = keyFromDnd
? static_cast<Plugin::Descriptor::SubPluginFeatures::Key*>(Engine::pickDndPluginKey())
: key;
const PluginFactory::PluginInfo& pi = pluginFactory->pluginInfo(pluginName.toUtf8());
const PluginFactory::PluginInfo& pi = getPluginFactory()->pluginInfo(pluginName.toUtf8());
if(keyPtr)
{
// descriptor is not yet set when loading - set it now
@@ -214,17 +214,17 @@ Plugin * Plugin::instantiateWithKey(const QString& pluginName, Model * parent,
Plugin * Plugin::instantiate(const QString& pluginName, Model * parent,
void *data)
{
const PluginFactory::PluginInfo& pi = pluginFactory->pluginInfo(pluginName.toUtf8());
const PluginFactory::PluginInfo& pi = getPluginFactory()->pluginInfo(pluginName.toUtf8());
Plugin* inst;
if( pi.isNull() )
{
if( gui )
if( getGUI() != nullptr )
{
QMessageBox::information( NULL,
QMessageBox::information( nullptr,
tr( "Plugin not found" ),
tr( "The plugin \"%1\" wasn't found or could not be loaded!\nReason: \"%2\"" ).
arg( pluginName ).arg( pluginFactory->errorString(pluginName) ),
arg( pluginName ).arg( getPluginFactory()->errorString(pluginName) ),
QMessageBox::Ok | QMessageBox::Default );
}
inst = new DummyPlugin();
@@ -241,9 +241,9 @@ Plugin * Plugin::instantiate(const QString& pluginName, Model * parent,
}
else
{
if( gui )
if( getGUI() != nullptr )
{
QMessageBox::information( NULL,
QMessageBox::information( nullptr,
tr( "Error while loading plugin" ),
tr( "Failed to load plugin \"%1\"!").arg( pluginName ),
QMessageBox::Ok | QMessageBox::Default );
@@ -269,7 +269,7 @@ void Plugin::collectErrorForUI( QString errMsg )
PluginView * Plugin::createView( QWidget * parent )
{
PluginView * pv = instantiateView( parent );
if( pv != NULL )
if( pv != nullptr )
{
pv->setModel( this );
}
@@ -280,7 +280,7 @@ PluginView * Plugin::createView( QWidget * parent )
Plugin::Descriptor::SubPluginFeatures::Key::Key( const QDomElement & key ) :
desc( NULL ),
desc( nullptr ),
name( key.attribute( "key" ) ),
attributes()
{

View File

@@ -28,6 +28,7 @@
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QLibrary>
#include <memory>
#include "lmmsconfig.h"
#include "ConfigManager.h"
@@ -94,11 +95,16 @@ void PluginFactory::setupSearchPaths()
PluginFactory* PluginFactory::instance()
{
if (s_instance == nullptr)
s_instance.reset(new PluginFactory());
s_instance = std::make_unique<PluginFactory>();
return s_instance.get();
}
PluginFactory* getPluginFactory()
{
return PluginFactory::instance();
}
const Plugin::DescriptorList PluginFactory::descriptors() const
{
return m_descriptors.values();

View File

@@ -40,8 +40,8 @@ class PreviewTrackContainer : public TrackContainer
{
public:
PreviewTrackContainer() :
m_previewInstrumentTrack( NULL ),
m_previewNote( NULL ),
m_previewInstrumentTrack( nullptr ),
m_previewNote( nullptr ),
m_dataMutex()
{
setJournalling( false );
@@ -135,14 +135,14 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
Instrument * i = s_previewTC->previewInstrumentTrack()->instrument();
const QString ext = QFileInfo( _preset_file ).
suffix().toLower();
if( i == NULL || !i->descriptor()->supportsFileType( ext ) )
if( i == nullptr || !i->descriptor()->supportsFileType( ext ) )
{
const PluginFactory::PluginInfoAndKey& infoAndKey =
pluginFactory->pluginSupportingExtension(ext);
getPluginFactory()->pluginSupportingExtension(ext);
i = s_previewTC->previewInstrumentTrack()->
loadInstrument(infoAndKey.info.name(), &infoAndKey.key);
}
if( i != NULL )
if( i != nullptr )
{
i->loadFile( _preset_file );
}
@@ -244,7 +244,7 @@ void PresetPreviewPlayHandle::init()
void PresetPreviewPlayHandle::cleanup()
{
delete s_previewTC;
s_previewTC = NULL;
s_previewTC = nullptr;
}
@@ -254,7 +254,7 @@ ConstNotePlayHandleList PresetPreviewPlayHandle::nphsOfInstrumentTrack(
const InstrumentTrack * _it )
{
ConstNotePlayHandleList cnphv;
if( s_previewTC->previewNote() != NULL &&
if( s_previewTC->previewNote() != nullptr &&
s_previewTC->previewNote()->instrumentTrack() == _it )
{
cnphv.push_back( s_previewTC->previewNote() );

View File

@@ -181,7 +181,7 @@ void ProjectJournal::clearJournal()
for( JoIdMap::Iterator it = m_joIDs.begin(); it != m_joIDs.end(); )
{
if( it.value() == NULL )
if( it.value() == nullptr )
{
it = m_joIDs.erase( it );
}
@@ -196,7 +196,7 @@ void ProjectJournal::stopAllJournalling()
{
for( JoIdMap::Iterator it = m_joIDs.begin(); it != m_joIDs.end(); ++it)
{
if( it.value() != NULL )
if( it.value() != nullptr )
{
it.value()->setJournalling(false);
}

View File

@@ -55,7 +55,7 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] =
#ifdef LMMS_HAVE_OGGVORBIS
&AudioFileOgg::getInst
#else
NULL
nullptr
#endif
},
{ ProjectRenderer::MP3File,
@@ -64,13 +64,13 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] =
#ifdef LMMS_HAVE_MP3LAME
&AudioFileMP3::getInst
#else
NULL
nullptr
#endif
},
// Insert your own file-encoder infos here.
// Maybe one day the user can add own encoders inside the program.
{ ProjectRenderer::NumFileFormats, NULL, NULL, NULL }
{ ProjectRenderer::NumFileFormats, nullptr, nullptr, nullptr }
} ;
@@ -82,7 +82,7 @@ ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySe
ExportFileFormats exportFileFormat,
const QString & outputFilename ) :
QThread( Engine::audioEngine() ),
m_fileDev( NULL ),
m_fileDev( nullptr ),
m_qualitySettings( qualitySettings ),
m_progress( 0 ),
m_abort( false )
@@ -99,7 +99,7 @@ ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySe
if( !successful )
{
delete m_fileDev;
m_fileDev = NULL;
m_fileDev = nullptr;
}
}
}

View File

@@ -92,7 +92,7 @@ RemotePlugin::RemotePlugin() :
m_shmID( 0 ),
#endif
m_shmSize( 0 ),
m_shm( NULL ),
m_shm( nullptr ),
m_inputCount( DEFAULT_CHANNELS ),
m_outputCount( DEFAULT_CHANNELS )
{
@@ -161,7 +161,7 @@ RemotePlugin::~RemotePlugin()
#ifndef USE_QT_SHMEM
shmdt( m_shm );
shmctl( m_shmID, IPC_RMID, NULL );
shmctl( m_shmID, IPC_RMID, nullptr );
#endif
}
@@ -256,7 +256,7 @@ bool RemotePlugin::init(const QString &pluginExecutable,
break;
default:
m_socket = accept( m_server, NULL, NULL );
m_socket = accept( m_server, nullptr, nullptr );
if ( m_socket == -1 )
{
qWarning( "Unexpected socket error." );
@@ -284,14 +284,14 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf
if( m_failed || !isRunning() )
{
if( _out_buf != NULL )
if( _out_buf != nullptr )
{
BufferManager::clear( _out_buf, frames );
}
return false;
}
if( m_shm == NULL )
if( m_shm == nullptr )
{
// m_shm being zero means we didn't initialize everything so
// far so process one message each time (and hope we get
@@ -303,7 +303,7 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf
fetchAndProcessAllMessages();
unlock();
}
if( _out_buf != NULL )
if( _out_buf != nullptr )
{
BufferManager::clear( _out_buf, frames );
}
@@ -314,7 +314,7 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf
ch_cnt_t inputs = qMin<ch_cnt_t>( m_inputCount, DEFAULT_CHANNELS );
if( _in_buf != NULL && inputs > 0 )
if( _in_buf != nullptr && inputs > 0 )
{
if( m_splitChannels )
{
@@ -347,7 +347,7 @@ bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf
lock();
sendMessage( IdStartProcessing );
if( m_failed || _out_buf == NULL || m_outputCount == 0 )
if( m_failed || _out_buf == nullptr || m_outputCount == 0 )
{
unlock();
return false;
@@ -431,13 +431,13 @@ void RemotePlugin::hideUI()
void RemotePlugin::resizeSharedProcessingMemory()
{
const size_t s = ( m_inputCount+m_outputCount ) * Engine::audioEngine()->framesPerPeriod() * sizeof( float );
if( m_shm != NULL )
if( m_shm != nullptr )
{
#ifdef USE_QT_SHMEM
m_shmObj.detach();
#else
shmdt( m_shm );
shmctl( m_shmID, IPC_RMID, NULL );
shmctl( m_shmID, IPC_RMID, nullptr );
#endif
}

View File

@@ -108,7 +108,7 @@ SampleBuffer::SampleBuffer(const sampleFrame * data, const f_cnt_t frames)
{
if (frames > 0)
{
m_origData = MM_ALLOC(sampleFrame, frames);
m_origData = MM_ALLOC<sampleFrame>( frames);
memcpy(m_origData, data, frames * BYTES_PER_FRAME);
m_origFrames = frames;
update();
@@ -123,7 +123,7 @@ SampleBuffer::SampleBuffer(const f_cnt_t frames)
{
if (frames > 0)
{
m_origData = MM_ALLOC(sampleFrame, frames);
m_origData = MM_ALLOC<sampleFrame>( frames);
memset(m_origData, 0, frames * BYTES_PER_FRAME);
m_origFrames = frames;
update();
@@ -139,9 +139,9 @@ SampleBuffer::SampleBuffer(const SampleBuffer& orig)
m_audioFile = orig.m_audioFile;
m_origFrames = orig.m_origFrames;
m_origData = (m_origFrames > 0) ? MM_ALLOC(sampleFrame, m_origFrames) : nullptr;
m_origData = (m_origFrames > 0) ? MM_ALLOC<sampleFrame>( m_origFrames) : nullptr;
m_frames = orig.m_frames;
m_data = (m_frames > 0) ? MM_ALLOC(sampleFrame, m_frames) : nullptr;
m_data = (m_frames > 0) ? MM_ALLOC<sampleFrame>( m_frames) : nullptr;
m_startFrame = orig.m_startFrame;
m_endFrame = orig.m_endFrame;
m_loopStartFrame = orig.m_loopStartFrame;
@@ -251,7 +251,7 @@ void SampleBuffer::update(bool keepSettings)
{
// TODO: reverse- and amplification-property is not covered
// by following code...
m_data = MM_ALLOC(sampleFrame, m_origFrames);
m_data = MM_ALLOC<sampleFrame>( m_origFrames);
memcpy(m_data, m_origData, m_origFrames * BYTES_PER_FRAME);
if (keepSettings == false)
{
@@ -325,7 +325,7 @@ void SampleBuffer::update(bool keepSettings)
{
// sample couldn't be decoded, create buffer containing
// one sample-frame
m_data = MM_ALLOC(sampleFrame, 1);
m_data = MM_ALLOC<sampleFrame>( 1);
memset(m_data, 0, sizeof(*m_data));
m_frames = 1;
m_loopStartFrame = m_startFrame = 0;
@@ -340,7 +340,7 @@ void SampleBuffer::update(bool keepSettings)
{
// neither an audio-file nor a buffer to copy from, so create
// buffer containing one sample-frame
m_data = MM_ALLOC(sampleFrame, 1);
m_data = MM_ALLOC<sampleFrame>( 1);
memset(m_data, 0, sizeof(*m_data));
m_frames = 1;
m_loopStartFrame = m_startFrame = 0;
@@ -368,7 +368,7 @@ void SampleBuffer::update(bool keepSettings)
QString message = tr("Audio files are limited to %1 MB "
"in size and %2 minutes of playing time"
).arg(fileSizeMax).arg(sampleLengthMax);
if (gui)
if (getGUI() != nullptr)
{
QMessageBox::information(nullptr,
title, message, QMessageBox::Ok);
@@ -389,7 +389,7 @@ void SampleBuffer::convertIntToFloat(
{
// following code transforms int-samples into float-samples and does amplifying & reversing
const float fac = 1 / OUTPUT_SAMPLE_MULTIPLIER;
m_data = MM_ALLOC(sampleFrame, frames);
m_data = MM_ALLOC<sampleFrame>( frames);
const int ch = (channels > 1) ? 1 : 0;
// if reversing is on, we also reverse when scaling
@@ -412,7 +412,7 @@ void SampleBuffer::directFloatWrite(
)
{
m_data = MM_ALLOC(sampleFrame, frames);
m_data = MM_ALLOC<sampleFrame>( frames);
const int ch = (channels > 1) ? 1 : 0;
// if reversing is on, we also reverse when scaling
@@ -440,7 +440,7 @@ void SampleBuffer::normalizeSampleRate(const sample_rate_t srcSR, bool keepSetti
m_sampleRate = audioEngineSampleRate();
MM_FREE(m_data);
m_frames = resampled->frames();
m_data = MM_ALLOC(sampleFrame, m_frames);
m_data = MM_ALLOC<sampleFrame>( m_frames);
memcpy(m_data, resampled->data(), m_frames * sizeof(sampleFrame));
delete resampled;
}
@@ -906,7 +906,7 @@ sampleFrame * SampleBuffer::getSampleFragment(
}
}
*tmp = MM_ALLOC(sampleFrame, frames);
*tmp = MM_ALLOC<sampleFrame>( frames);
if (loopMode == LoopOff)
{
@@ -1506,14 +1506,14 @@ void SampleBuffer::loadFromBase64(const QString & data)
m_origFrames = origData.size() / sizeof(sampleFrame);
MM_FREE(m_origData);
m_origData = MM_ALLOC(sampleFrame, m_origFrames);
m_origData = MM_ALLOC<sampleFrame>( m_origFrames);
memcpy(m_origData, origData.data(), origData.size());
#else /* LMMS_HAVE_FLAC_STREAM_DECODER_H */
m_origFrames = dsize / sizeof(sampleFrame);
MM_FREE(m_origData);
m_origData = MM_ALLOC(sampleFrame, m_origFrames);
m_origData = MM_ALLOC<sampleFrame>( m_origFrames);
memcpy(m_origData, dst, dsize);
#endif

View File

@@ -41,8 +41,8 @@ SamplePlayHandle::SamplePlayHandle( SampleBuffer* sampleBuffer , bool ownAudioPo
m_ownAudioPort( ownAudioPort ),
m_defaultVolumeModel( DefaultVolume, MinVolume, MaxVolume, 1 ),
m_volumeModel( &m_defaultVolumeModel ),
m_track( NULL ),
m_bbTrack( NULL )
m_track( nullptr ),
m_bbTrack( nullptr )
{
if (ownAudioPort)
{

View File

@@ -38,7 +38,7 @@ SampleRecordHandle::SampleRecordHandle( SampleTCO* tco ) :
m_framesRecorded( 0 ),
m_minLength( tco->length() ),
m_track( tco->getTrack() ),
m_bbTrack( NULL ),
m_bbTrack( nullptr ),
m_tco( tco )
{
}
@@ -117,7 +117,7 @@ void SampleRecordHandle::createSampleBuffer( SampleBuffer** sampleBuf )
sampleFrame * data_ptr = data;
assert( data != NULL );
assert( data != nullptr );
// now copy all buffers into big buffer
for( bufferList::const_iterator it = m_buffers.begin(); it != m_buffers.end(); ++it )

View File

@@ -29,7 +29,7 @@
SerializingObject::SerializingObject() :
m_hook( NULL )
m_hook( nullptr )
{
}
@@ -40,7 +40,7 @@ SerializingObject::~SerializingObject()
{
if( m_hook )
{
m_hook->m_hookedIn = NULL;
m_hook->m_hookedIn = nullptr;
}
}
@@ -82,7 +82,7 @@ void SerializingObject::setHook( SerializingObjectHook* hook )
{
if( m_hook )
{
m_hook->m_hookedIn = NULL;
m_hook->m_hookedIn = nullptr;
}
m_hook = hook;

View File

@@ -89,7 +89,7 @@ Song::Song() :
m_isCancelled( false ),
m_playMode( Mode_None ),
m_length( 0 ),
m_patternToPlay( NULL ),
m_patternToPlay( nullptr ),
m_loopPattern( false ),
m_elapsedTicks( 0 ),
m_elapsedBars( 0 ),
@@ -187,7 +187,7 @@ void Song::savePos()
{
TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine;
if( tl != NULL )
if( tl != nullptr )
{
tl->savePos( m_playPos[m_playMode] );
}
@@ -549,7 +549,7 @@ void Song::playPattern( const Pattern* patternToPlay, bool loop )
m_patternToPlay = patternToPlay;
m_loopPattern = loop;
if( m_patternToPlay != NULL )
if( m_patternToPlay != nullptr )
{
m_playMode = Mode_PlayPattern;
m_playing = true;
@@ -866,17 +866,17 @@ void Song::clearProject()
Engine::audioEngine()->requestChangeInModel();
if( gui && gui->getBBEditor() )
if( getGUI() != nullptr && getGUI()->getBBEditor() )
{
gui->getBBEditor()->trackContainerView()->clearAllTracks();
getGUI()->getBBEditor()->trackContainerView()->clearAllTracks();
}
if( gui && gui->songEditor() )
if( getGUI() != nullptr && getGUI()->songEditor() )
{
gui->songEditor()->m_editor->clearAllTracks();
getGUI()->songEditor()->m_editor->clearAllTracks();
}
if( gui && gui->fxMixerView() )
if( getGUI() != nullptr && getGUI()->fxMixerView() )
{
gui->fxMixerView()->clear();
getGUI()->fxMixerView()->clear();
}
QCoreApplication::sendPostedEvents();
Engine::getBBTrackContainer()->clearAllTracks();
@@ -884,14 +884,14 @@ void Song::clearProject()
Engine::fxMixer()->clear();
if( gui && gui->automationEditor() )
if( getGUI() != nullptr && getGUI()->automationEditor() )
{
gui->automationEditor()->setCurrentPattern( NULL );
getGUI()->automationEditor()->setCurrentPattern( nullptr );
}
if( gui && gui->pianoRoll() )
if( getGUI() != nullptr && getGUI()->pianoRoll() )
{
gui->pianoRoll()->reset();
getGUI()->pianoRoll()->reset();
}
m_tempoModel.reset();
@@ -910,9 +910,9 @@ void Song::clearProject()
Engine::audioEngine()->doneChangeInModel();
if( gui && gui->getProjectNotes() )
if( getGUI() != nullptr && getGUI()->getProjectNotes() )
{
gui->getProjectNotes()->clear();
getGUI()->getProjectNotes()->clear();
}
removeAllControllers();
@@ -1035,9 +1035,9 @@ void Song::loadProject( const QString & fileName )
{
cantLoadProject = true;
if (gui)
if (getGUI() != nullptr)
{
QMessageBox::critical(NULL, tr("Aborting project load"),
QMessageBox::critical(nullptr, tr("Aborting project load"),
tr("Project file contains local paths to plugins, which could be used to "
"run malicious code."));
}
@@ -1093,10 +1093,10 @@ void Song::loadProject( const QString & fileName )
if( !node.isNull() )
{
Engine::fxMixer()->restoreState( node.toElement() );
if( gui )
if( getGUI() != nullptr )
{
// refresh FxMixerView
gui->fxMixerView()->refreshDisplay();
getGUI()->fxMixerView()->refreshDisplay();
}
}
@@ -1142,23 +1142,23 @@ void Song::loadProject( const QString & fileName )
{
restoreKeymapStates(node.toElement());
}
else if( gui )
else if( getGUI() != nullptr )
{
if( node.nodeName() == gui->getControllerRackView()->nodeName() )
if( node.nodeName() == getGUI()->getControllerRackView()->nodeName() )
{
gui->getControllerRackView()->restoreState( node.toElement() );
getGUI()->getControllerRackView()->restoreState( node.toElement() );
}
else if( node.nodeName() == gui->pianoRoll()->nodeName() )
else if( node.nodeName() == getGUI()->pianoRoll()->nodeName() )
{
gui->pianoRoll()->restoreState( node.toElement() );
getGUI()->pianoRoll()->restoreState( node.toElement() );
}
else if( node.nodeName() == gui->automationEditor()->m_editor->nodeName() )
else if( node.nodeName() == getGUI()->automationEditor()->m_editor->nodeName() )
{
gui->automationEditor()->m_editor->restoreState( node.toElement() );
getGUI()->automationEditor()->m_editor->restoreState( node.toElement() );
}
else if( node.nodeName() == gui->getProjectNotes()->nodeName() )
else if( node.nodeName() == getGUI()->getProjectNotes()->nodeName() )
{
gui->getProjectNotes()->SerializingObject::restoreState( node.toElement() );
getGUI()->getProjectNotes()->SerializingObject::restoreState( node.toElement() );
}
else if( node.nodeName() == m_playPos[Mode_PlaySong].m_timeLine->nodeName() )
{
@@ -1203,9 +1203,9 @@ void Song::loadProject( const QString & fileName )
if ( hasErrors())
{
if ( gui )
if ( getGUI() != nullptr )
{
QMessageBox::warning( NULL, tr("LMMS Error report"), errorSummary(),
QMessageBox::warning( nullptr, tr("LMMS Error report"), errorSummary(),
QMessageBox::Ok );
}
else
@@ -1239,12 +1239,12 @@ bool Song::saveProjectFile(const QString & filename, bool withResources)
m_globalAutomationTrack->saveState( dataFile, dataFile.content() );
Engine::fxMixer()->saveState( dataFile, dataFile.content() );
if( gui )
if( getGUI() != nullptr )
{
gui->getControllerRackView()->saveState( dataFile, dataFile.content() );
gui->pianoRoll()->saveState( dataFile, dataFile.content() );
gui->automationEditor()->m_editor->saveState( dataFile, dataFile.content() );
gui->getProjectNotes()->SerializingObject::saveState( dataFile, dataFile.content() );
getGUI()->getControllerRackView()->saveState( dataFile, dataFile.content() );
getGUI()->pianoRoll()->saveState( dataFile, dataFile.content() );
getGUI()->automationEditor()->m_editor->saveState( dataFile, dataFile.content() );
getGUI()->getProjectNotes()->SerializingObject::saveState( dataFile, dataFile.content() );
m_playPos[Mode_PlaySong].m_timeLine->saveState( dataFile, dataFile.content() );
}

View File

@@ -269,7 +269,7 @@ void StepRecorder::prepareNewStep()
void StepRecorder::setCurrentPattern( Pattern* newPattern )
{
if(m_pattern != NULL && m_pattern != newPattern)
if(m_pattern != nullptr && m_pattern != newPattern)
{
dismissStep();
}

View File

@@ -43,7 +43,7 @@ ToolPlugin::~ToolPlugin()
ToolPlugin * ToolPlugin::instantiate( const QString & _plugin_name, Model * _parent )
{
Plugin * p = Plugin::instantiate( _plugin_name, _parent, NULL );
Plugin * p = Plugin::instantiate( _plugin_name, _parent, nullptr );
// check whether instantiated plugin is a tool
if( p->type() == Plugin::Tool )
{
@@ -53,6 +53,6 @@ ToolPlugin * ToolPlugin::instantiate( const QString & _plugin_name, Model * _par
// not quite... so delete plugin
delete p;
return NULL;
return nullptr;
}

View File

@@ -107,7 +107,7 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc )
{
Engine::audioEngine()->requestChangeInModel();
Track * t = NULL;
Track * t = nullptr;
switch( tt )
{
@@ -150,7 +150,7 @@ Track * Track::create( const QDomElement & element, TrackContainer * tc )
Track * t = create(
static_cast<TrackTypes>( element.attribute( "type" ).toInt() ),
tc );
if( t != NULL )
if( t != nullptr )
{
t->restoreState( element );
}

View File

@@ -43,7 +43,7 @@
#include "TextFloat.h"
TrackContainer::TrackContainer() :
Model( NULL ),
Model( nullptr ),
JournallingObject(),
m_tracksMutex(),
m_tracks()
@@ -86,16 +86,16 @@ void TrackContainer::loadSettings( const QDomElement & _this )
clearAllTracks();
}
static QProgressDialog * pd = NULL;
bool was_null = ( pd == NULL );
if( !journalRestore && gui != nullptr )
static QProgressDialog * pd = nullptr;
bool was_null = ( pd == nullptr );
if( !journalRestore && getGUI() != nullptr )
{
if( pd == NULL )
if( pd == nullptr )
{
pd = new QProgressDialog( tr( "Loading project..." ),
tr( "Cancel" ), 0,
Engine::getSong()->getLoadingTrackCount(),
gui->mainWindow() );
getGUI()->mainWindow() );
pd->setWindowModality( Qt::ApplicationModal );
pd->setWindowTitle( tr( "Please wait..." ) );
pd->show();
@@ -105,14 +105,14 @@ void TrackContainer::loadSettings( const QDomElement & _this )
QDomNode node = _this.firstChild();
while( !node.isNull() )
{
if( pd != NULL )
if( pd != nullptr )
{
pd->setValue( pd->value() + 1 );
QCoreApplication::instance()->processEvents(
QEventLoop::AllEvents, 100 );
if( pd->wasCanceled() )
{
if ( gui )
if ( getGUI() != nullptr )
{
TextFloat::displayMessage( tr( "Loading cancelled" ),
tr( "Project loading was cancelled." ),
@@ -130,7 +130,7 @@ void TrackContainer::loadSettings( const QDomElement & _this )
QString trackName = node.toElement().hasAttribute( "name" ) ?
node.toElement().attribute( "name" ) :
node.firstChild().toElement().attribute( "name" );
if( pd != NULL )
if( pd != nullptr )
{
pd->setLabelText( tr("Loading Track %1 (%2/Total %3)").arg( trackName ).
arg( pd->value() + 1 ).arg( Engine::getSong()->getLoadingTrackCount() ) );
@@ -140,12 +140,12 @@ void TrackContainer::loadSettings( const QDomElement & _this )
node = node.nextSibling();
}
if( pd != NULL )
if( pd != nullptr )
{
if( was_null )
{
delete pd;
pd = NULL;
pd = nullptr;
}
}
}

View File

@@ -42,7 +42,7 @@
VstSyncController::VstSyncController() :
m_syncData( NULL ),
m_syncData( nullptr ),
m_shmID( -1 ),
m_shm( "/usr/bin/lmms" )
{
@@ -87,7 +87,7 @@ VstSyncController::VstSyncController() :
qWarning( "VST sync support disabled in your configuration" );
}
if( m_syncData == NULL )
if( m_syncData == nullptr )
{
m_syncData = new VstSyncData;
m_syncData->hasSHM = false;
@@ -124,7 +124,7 @@ VstSyncController::~VstSyncController()
#else
if( shmdt( m_syncData ) != -1 )
{
shmctl( m_shmID, IPC_RMID, NULL );
shmctl( m_shmID, IPC_RMID, nullptr );
}
else
{

View File

@@ -41,9 +41,9 @@ AudioAlsa::AudioAlsa( bool & _success_ful, AudioEngine* _audioEngine ) :
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audioalsa", "channels" ).toInt(),
SURROUND_CHANNELS ), _audioEngine ),
m_handle( NULL ),
m_hwParams( NULL ),
m_swParams( NULL ),
m_handle( nullptr ),
m_hwParams( nullptr ),
m_swParams( nullptr ),
m_convertEndian( false )
{
_success_ful = false;
@@ -107,17 +107,17 @@ AudioAlsa::AudioAlsa( bool & _success_ful, AudioEngine* _audioEngine ) :
AudioAlsa::~AudioAlsa()
{
stopProcessing();
if( m_handle != NULL )
if( m_handle != nullptr )
{
snd_pcm_close( m_handle );
}
if( m_hwParams != NULL )
if( m_hwParams != nullptr )
{
snd_pcm_hw_params_free( m_hwParams );
}
if( m_swParams != NULL )
if( m_swParams != nullptr )
{
snd_pcm_sw_params_free( m_swParams );
}
@@ -131,7 +131,7 @@ QString AudioAlsa::probeDevice()
QString dev = ConfigManager::inst()->value( "audioalsa", "device" );
if( dev == "" )
{
if( getenv( "AUDIODEV" ) != NULL )
if( getenv( "AUDIODEV" ) != nullptr )
{
return getenv( "AUDIODEV" );
}
@@ -171,7 +171,7 @@ AudioAlsa::DeviceInfoCollection AudioAlsa::getAvailableDevices()
}
char** n = hints;
while (*n != NULL)
while (*n != nullptr)
{
char *name = snd_device_name_get_hint(*n, "NAME");
char *description = snd_device_name_get_hint(*n, "DESC");
@@ -257,7 +257,7 @@ void AudioAlsa::applyQualitySettings()
{
setSampleRate( Engine::audioEngine()->processingSampleRate() );
if( m_handle != NULL )
if( m_handle != nullptr )
{
snd_pcm_close( m_handle );
}

View File

@@ -41,7 +41,7 @@ AudioDevice::AudioDevice( const ch_cnt_t _channels, AudioEngine* _audioEngine )
int error;
if( ( m_srcState = src_new(
audioEngine()->currentQualitySettings().libsrcInterpolation(),
SURROUND_CHANNELS, &error ) ) == NULL )
SURROUND_CHANNELS, &error ) ) == nullptr )
{
printf( "Error: src_new() failed in audio_device.cpp!\n" );
}
@@ -151,7 +151,7 @@ void AudioDevice::applyQualitySettings()
int error;
if( ( m_srcState = src_new(
audioEngine()->currentQualitySettings().libsrcInterpolation(),
SURROUND_CHANNELS, &error ) ) == NULL )
SURROUND_CHANNELS, &error ) ) == nullptr )
{
printf( "Error: src_new() failed in audio_device.cpp!\n" );
}
@@ -187,7 +187,7 @@ fpp_t AudioDevice::resample( const surroundSampleFrame * _src,
const sample_rate_t _src_sr,
const sample_rate_t _dst_sr )
{
if( m_srcState == NULL )
if( m_srcState == nullptr )
{
return _frames;
}
@@ -253,7 +253,7 @@ int AudioDevice::convertToS16( const surroundSampleFrame * _ab,
void AudioDevice::clearS16Buffer( int_sample_t * _outbuf, const fpp_t _frames )
{
assert( _outbuf != NULL );
assert( _outbuf != nullptr );
memset( _outbuf, 0, _frames * channels() * BYTES_PER_INT_SAMPLE );
}

View File

@@ -52,9 +52,9 @@ AudioFileDevice::AudioFileDevice( OutputSettings const & outputSettings,
"file and try again!"
).arg( _file );
if( gui )
if( getGUI() != nullptr )
{
QMessageBox::critical( NULL, title, message,
QMessageBox::critical( nullptr, title, message,
QMessageBox::Ok,
QMessageBox::NoButton );
}

View File

@@ -81,7 +81,7 @@ bool AudioFileOgg::startEncoding()
vc.user_comments = &user_comments;
vc.comment_lengths = &comment_length;
vc.comments = 1;
vc.vendor = NULL;
vc.vendor = nullptr;
m_channels = channels();
@@ -122,11 +122,11 @@ bool AudioFileOgg::startEncoding()
if( useVariableBitRate )
{
// Turn off management entirely (if it was turned on).
vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_SET, NULL );
vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_SET, nullptr );
}
else
{
vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_AVG, NULL );
vorbis_encode_ctl( &m_vi, OV_ECTL_RATEMANAGE_AVG, nullptr );
}
vorbis_encode_setup_init( &m_vi );
@@ -210,7 +210,7 @@ void AudioFileOgg::writeBuffer( const surroundSampleFrame * _ab,
while( vorbis_analysis_blockout( &m_vd, &m_vb ) == 1 )
{
// Do the main analysis, creating a packet
vorbis_analysis( &m_vb, NULL );
vorbis_analysis( &m_vb, nullptr );
vorbis_bitrate_addblock( &m_vb );
while( vorbis_bitrate_flushpacket( &m_vd, &m_op ) )
@@ -256,7 +256,7 @@ void AudioFileOgg::finishEncoding()
if( m_ok )
{
// just for flushing buffers...
writeBuffer( NULL, 0, 0.0f );
writeBuffer( nullptr, 0, 0.0f );
// clean up
ogg_stream_clear( &m_os );

View File

@@ -36,7 +36,7 @@ AudioFileWave::AudioFileWave( OutputSettings const & outputSettings,
const QString & file,
AudioEngine* audioEngine ) :
AudioFileDevice( outputSettings, channels, file, audioEngine ),
m_sf( NULL )
m_sf( nullptr )
{
successful = outputFileOpened() && startEncoding();
}
@@ -86,7 +86,7 @@ bool AudioFileWave::startEncoding()
}
// Prevent fold overs when encountering clipped data
sf_command(m_sf, SFC_SET_CLIPPING, NULL, SF_TRUE);
sf_command(m_sf, SFC_SET_CLIPPING, nullptr, SF_TRUE);
sf_set_string ( m_sf, SF_STR_SOFTWARE, "LMMS" );

View File

@@ -47,9 +47,9 @@ AudioJack::AudioJack( bool & _success_ful, AudioEngine* _audioEngine ) :
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audiojack", "channels" ).toInt(),
SURROUND_CHANNELS ), _audioEngine ),
m_client( NULL ),
m_client( nullptr ),
m_active( false ),
m_midiClient( NULL ),
m_midiClient( nullptr ),
m_tempOutBufs( new jack_default_audio_sample_t *[channels()] ),
m_outBuf( new surroundSampleFrame[audioEngine()->framesPerPeriod()] ),
m_framesDoneInCurBuf( 0 ),
@@ -80,7 +80,7 @@ AudioJack::~AudioJack()
}
#endif
if( m_client != NULL )
if( m_client != nullptr )
{
if( m_active )
{
@@ -103,7 +103,7 @@ void AudioJack::restartAfterZombified()
{
m_active = false;
startProcessing();
QMessageBox::information( gui->mainWindow(),
QMessageBox::information( getGUI()->mainWindow(),
tr( "JACK client restarted" ),
tr( "LMMS was kicked by JACK for some reason. "
"Therefore the JACK backend of LMMS has been "
@@ -112,7 +112,7 @@ void AudioJack::restartAfterZombified()
}
else
{
QMessageBox::information( gui->mainWindow(),
QMessageBox::information( getGUI()->mainWindow(),
tr( "JACK server down" ),
tr( "The JACK server seems to have been shutdown "
"and starting a new instance failed. "
@@ -126,8 +126,8 @@ void AudioJack::restartAfterZombified()
AudioJack* AudioJack::addMidiClient(MidiJack *midiClient)
{
if( m_client == NULL )
return NULL;
if( m_client == nullptr )
return nullptr;
m_midiClient = midiClient;
@@ -143,12 +143,12 @@ bool AudioJack::initJackClient()
clientName = "lmms";
}
const char * serverName = NULL;
const char * serverName = nullptr;
jack_status_t status;
m_client = jack_client_open( clientName.toLatin1().constData(),
JackNullOption, &status,
serverName );
if( m_client == NULL )
if( m_client == nullptr )
{
printf( "jack_client_open() failed, status 0x%2.0x\n", status );
if( status & JackServerFailed )
@@ -187,7 +187,7 @@ bool AudioJack::initJackClient()
name.toLatin1().constData(),
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0 ) );
if( m_outputPorts.back() == NULL )
if( m_outputPorts.back() == nullptr )
{
printf( "no more JACK-ports available!\n" );
return false;
@@ -202,7 +202,7 @@ bool AudioJack::initJackClient()
void AudioJack::startProcessing()
{
if( m_active || m_client == NULL )
if( m_active || m_client == nullptr )
{
m_stopped = false;
return;
@@ -222,10 +222,10 @@ void AudioJack::startProcessing()
const char * * ports = jack_get_ports( m_client, NULL, NULL,
const char * * ports = jack_get_ports( m_client, nullptr, nullptr,
JackPortIsPhysical |
JackPortIsInput );
if( ports == NULL )
if( ports == nullptr )
{
printf( "no physical playback ports. you'll have to do "
"connections at your own!\n" );
@@ -306,7 +306,7 @@ void AudioJack::unregisterPort( AudioPort * _port )
{
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
{
if( m_portMap[_port].ports[ch] != NULL )
if( m_portMap[_port].ports[ch] != nullptr )
{
jack_port_unregister( m_client,
m_portMap[_port].ports[ch] );
@@ -369,7 +369,7 @@ int AudioJack::processCallback( jack_nframes_t _nframes, void * _udata )
{
for( ch_cnt_t ch = 0; ch < channels(); ++ch )
{
if( it.value().ports[ch] == NULL )
if( it.value().ports[ch] == nullptr )
{
continue;
}
@@ -442,7 +442,7 @@ int AudioJack::staticProcessCallback( jack_nframes_t _nframes, void * _udata )
void AudioJack::shutdownCallback( void * _udata )
{
AudioJack * _this = static_cast<AudioJack *>( _udata );
_this->m_client = NULL;
_this->m_client = nullptr;
_this->zombified();
}

View File

@@ -58,12 +58,11 @@
#include "ConfigManager.h"
#ifndef _PATH_DEV_DSP
static const QString PATH_DEV_DSP =
#if defined(__NetBSD__) || defined(__OpenBSD__)
#define _PATH_DEV_DSP "/dev/audio"
"/dev/audio";
#else
#define _PATH_DEV_DSP "/dev/dsp"
#endif
"/dev/dsp";
#endif
@@ -204,13 +203,13 @@ QString AudioOss::probeDevice()
{
char * adev = getenv( "AUDIODEV" ); // Is there a standard
// variable name?
if( adev != NULL )
if( adev != nullptr )
{
dev = adev;
}
else
{
dev = _PATH_DEV_DSP; // default device
dev = PATH_DEV_DSP; // default device
}
}
@@ -220,10 +219,10 @@ QString AudioOss::probeDevice()
int instance = -1;
while( 1 )
{
dev = _PATH_DEV_DSP + QString::number( ++instance );
dev = PATH_DEV_DSP + QString::number( ++instance );
if( !QFileInfo( dev ).exists() )
{
dev = _PATH_DEV_DSP;
dev = PATH_DEV_DSP;
break;
}
if( QFileInfo( dev ).isWritable() )

View File

@@ -40,7 +40,7 @@ AudioPort::AudioPort( const QString & _name, bool _has_effect_chain,
m_extOutputEnabled( false ),
m_nextFxChannel( 0 ),
m_name( "unnamed port" ),
m_effects( _has_effect_chain ? new EffectChain( NULL ) : NULL ),
m_effects( _has_effect_chain ? new EffectChain( nullptr ) : nullptr ),
m_volumeModel( volumeModel ),
m_panningModel( panningModel ),
m_mutedModel( mutedModel )

View File

@@ -57,7 +57,7 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, AudioEngine * _audioEngine
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audioportaudio", "channels" ).toInt(),
SURROUND_CHANNELS ), _audioEngine ),
m_paStream( NULL ),
m_paStream( nullptr ),
m_wasPAInitError( false ),
m_outBuf( new surroundSampleFrame[audioEngine()->framesPerPeriod()] ),
m_outBufPos( 0 )
@@ -123,19 +123,19 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, AudioEngine * _audioEngine
m_outputParameters.channelCount = channels();
m_outputParameters.sampleFormat = paFloat32; // 32 bit floating point output
m_outputParameters.suggestedLatency = outLatency;
m_outputParameters.hostApiSpecificStreamInfo = NULL;
m_outputParameters.hostApiSpecificStreamInfo = nullptr;
// Configure input parameters.
m_inputParameters.device = inDevIdx;
m_inputParameters.channelCount = DEFAULT_CHANNELS;
m_inputParameters.sampleFormat = paFloat32; // 32 bit floating point input
m_inputParameters.suggestedLatency = inLatency;
m_inputParameters.hostApiSpecificStreamInfo = NULL;
m_inputParameters.hostApiSpecificStreamInfo = nullptr;
// Open an audio I/O stream.
err = Pa_OpenStream(
&m_paStream,
supportsCapture() ? &m_inputParameters : NULL, // The input parameter
supportsCapture() ? &m_inputParameters : nullptr, // The input parameter
&m_outputParameters, // The outputparameter
sampleRate(),
samples,
@@ -151,7 +151,7 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, AudioEngine * _audioEngine
setSampleRate( 48000 );
err = Pa_OpenStream(
&m_paStream,
supportsCapture() ? &m_inputParameters : NULL, // The input parameter
supportsCapture() ? &m_inputParameters : nullptr, // The input parameter
&m_outputParameters, // The outputparameter
sampleRate(),
samples,
@@ -234,7 +234,7 @@ void AudioPortAudio::applyQualitySettings()
PaError err = Pa_OpenStream(
&m_paStream,
supportsCapture() ? &m_inputParameters : NULL, // The input parameter
supportsCapture() ? &m_inputParameters : nullptr, // The input parameter
&m_outputParameters, // The outputparameter
sampleRate(),
samples,

View File

@@ -49,7 +49,7 @@ AudioPulseAudio::AudioPulseAudio( bool & _success_ful, AudioEngine* _audioEngin
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audiopa", "channels" ).toInt(),
SURROUND_CHANNELS ), _audioEngine ),
m_s( NULL ),
m_s( nullptr ),
m_quit( false ),
m_convertEndian( false )
{
@@ -78,7 +78,7 @@ QString AudioPulseAudio::probeDevice()
QString dev = ConfigManager::inst()->value( "audiopa", "device" );
if( dev.isEmpty() )
{
if( getenv( "AUDIODEV" ) != NULL )
if( getenv( "AUDIODEV" ) != nullptr )
{
return getenv( "AUDIODEV" );
}
@@ -161,7 +161,7 @@ static void context_state_callback(pa_context *c, void *userdata)
case PA_CONTEXT_READY:
{
qDebug( "Connection established.\n" );
_this->m_s = pa_stream_new( c, "lmms", &_this->m_sampleSpec, NULL);
_this->m_s = pa_stream_new( c, "lmms", &_this->m_sampleSpec, nullptr);
pa_stream_set_state_callback( _this->m_s, stream_state_callback, _this );
pa_stream_set_write_callback( _this->m_s, stream_write_callback, _this );
@@ -181,10 +181,10 @@ static void context_state_callback(pa_context *c, void *userdata)
buffer_attr.tlength = pa_usec_to_bytes( latency * PA_USEC_PER_MSEC,
&_this->m_sampleSpec );
pa_stream_connect_playback( _this->m_s, NULL, &buffer_attr,
pa_stream_connect_playback( _this->m_s, nullptr, &buffer_attr,
PA_STREAM_ADJUST_LATENCY,
NULL, // volume
NULL );
nullptr, // volume
nullptr );
_this->signalConnected( true );
break;
}
@@ -213,7 +213,7 @@ void AudioPulseAudio::run()
pa_mainloop_api * mainloop_api = pa_mainloop_get_api( mainLoop );
pa_context *context = pa_context_new( mainloop_api, "lmms" );
if ( context == NULL )
if ( context == nullptr )
{
qCritical( "pa_context_new() failed." );
return;
@@ -223,10 +223,10 @@ void AudioPulseAudio::run()
pa_context_set_state_callback( context, context_state_callback, this );
// connect the context
pa_context_connect( context, NULL, (pa_context_flags) 0, NULL );
pa_context_connect( context, nullptr, (pa_context_flags) 0, nullptr );
while (!m_connectedSemaphore.tryAcquire()) {
pa_mainloop_iterate(mainLoop, 1, NULL);
pa_mainloop_iterate(mainLoop, 1, nullptr);
}
// run the main loop
@@ -282,7 +282,7 @@ void AudioPulseAudio::streamWriteCallback( pa_stream *s, size_t length )
m_convertEndian );
if( bytes > 0 )
{
pa_stream_write( m_s, pcmbuf, bytes, NULL, 0,
pa_stream_write( m_s, pcmbuf, bytes, nullptr, 0,
PA_SEEK_RELATIVE );
}
fd += frames;

View File

@@ -77,7 +77,7 @@ void AudioSampleRecorder::createSampleBuffer( SampleBuffer** sampleBuf )
sampleFrame * data_ptr = data;
assert( data != NULL );
assert( data != nullptr );
// now copy all buffers into big buffer
for( BufferList::ConstIterator it = m_buffers.begin();

View File

@@ -75,7 +75,7 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
SDL_AudioSpec actual;
#ifdef LMMS_HAVE_SDL2
m_outputDevice = SDL_OpenAudioDevice (NULL,
m_outputDevice = SDL_OpenAudioDevice (nullptr,
0,
&m_audioHandle,
&actual,
@@ -105,7 +105,7 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
m_inputAudioHandle = m_audioHandle;
m_inputAudioHandle.callback = sdlInputAudioCallback;
m_inputDevice = SDL_OpenAudioDevice (NULL,
m_inputDevice = SDL_OpenAudioDevice (nullptr,
1,
&m_inputAudioHandle,
&actual,

View File

@@ -61,14 +61,14 @@ AudioSndio::AudioSndio(bool & _success_ful, AudioEngine * _audioEngine) :
if (dev == "")
{
m_hdl = sio_open( NULL, SIO_PLAY, 0 );
m_hdl = sio_open( nullptr, SIO_PLAY, 0 );
}
else
{
m_hdl = sio_open( dev.toLatin1().constData(), SIO_PLAY, 0 );
}
if( m_hdl == NULL )
if( m_hdl == nullptr )
{
printf( "sndio: failed opening audio-device\n" );
return;
@@ -123,10 +123,10 @@ AudioSndio::AudioSndio(bool & _success_ful, AudioEngine * _audioEngine) :
AudioSndio::~AudioSndio()
{
stopProcessing();
if (m_hdl != NULL)
if (m_hdl != nullptr)
{
sio_close( m_hdl );
m_hdl = NULL;
m_hdl = nullptr;
}
}

View File

@@ -43,9 +43,9 @@ AudioSoundIo::AudioSoundIo( bool & outSuccessful, AudioEngine * _audioEngine ) :
SURROUND_CHANNELS ), _audioEngine )
{
outSuccessful = false;
m_soundio = NULL;
m_outstream = NULL;
m_outBuf = NULL;
m_soundio = nullptr;
m_outstream = nullptr;
m_outBuf = nullptr;
m_disconnectErr = 0;
m_outBufFrameIndex = 0;
m_outBufFramesTotal = 0;
@@ -206,7 +206,7 @@ AudioSoundIo::~AudioSoundIo()
if (m_soundio)
{
soundio_destroy(m_soundio);
m_soundio = NULL;
m_soundio = nullptr;
}
}
@@ -261,7 +261,7 @@ void AudioSoundIo::stopProcessing()
if (m_outBuf)
{
delete[] m_outBuf;
m_outBuf = NULL;
m_outBuf = nullptr;
}
}
@@ -503,7 +503,7 @@ AudioSoundIo::setupWidget::~setupWidget()
if (m_soundio)
{
soundio_destroy(m_soundio);
m_soundio = NULL;
m_soundio = nullptr;
}
}

View File

@@ -34,7 +34,7 @@ namespace base64
QVariant decode( const QString & _b64, QVariant::Type _force_type )
{
char * dst = NULL;
char * dst = nullptr;
int dsize = 0;
base64::decode( _b64, &dst, &dsize );
QByteArray ba( dst, dsize );

View File

@@ -35,7 +35,7 @@
*/
float maximum(const float *abs_spectrum, unsigned int spec_size)
{
if (abs_spectrum == NULL) {return -1;}
if (abs_spectrum == nullptr) {return -1;}
if (spec_size == 0) {return -1;}
float maxi = 0;
@@ -60,7 +60,7 @@ float maximum(const std::vector<float> &abs_spectrum)
*/
int normalize(const float *abs_spectrum, float *norm_spectrum, unsigned int bin_count, unsigned int block_size)
{
if (abs_spectrum == NULL || norm_spectrum == NULL) {return -1;}
if (abs_spectrum == nullptr || norm_spectrum == nullptr) {return -1;}
if (bin_count == 0 || block_size == 0) {return -1;}
block_size /= 2;
@@ -100,7 +100,7 @@ int notEmpty(const std::vector<float> &spectrum)
*/
int precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool normalized)
{
if (window == NULL) {return -1;}
if (window == nullptr) {return -1;}
float gain = 0;
float a0;
@@ -162,7 +162,7 @@ int precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool
*/
int absspec(const fftwf_complex *complex_buffer, float *absspec_buffer, unsigned int compl_length)
{
if (complex_buffer == NULL || absspec_buffer == NULL) {return -1;}
if (complex_buffer == nullptr || absspec_buffer == nullptr) {return -1;}
if (compl_length == 0) {return -1;}
for (unsigned int i = 0; i < compl_length; i++)
@@ -183,7 +183,7 @@ int absspec(const fftwf_complex *complex_buffer, float *absspec_buffer, unsigned
*/
int compressbands(const float *absspec_buffer, float *compressedband, int num_old, int num_new, int bottom, int top)
{
if (absspec_buffer == NULL || compressedband == NULL) {return -1;}
if (absspec_buffer == nullptr || compressedband == nullptr) {return -1;}
if (num_old < num_new) {return -1;}
if (num_old <= 0 || num_new <= 0) {return -1;}
if (bottom < 0) {bottom = 0;}

View File

@@ -144,7 +144,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter,
uint8_t** data)
{
*frames = *type = *size = 0;
*data = NULL;
*data = nullptr;
if (!lv2_evbuf_is_valid(iter)) {
return false;

View File

@@ -148,7 +148,7 @@ void printVersion( char *executableName )
"License as published by the Free Software Foundation; either\n"
"version 2 of the License, or (at your option) any later version.\n\n"
"Try \"%s --help\" for more information.\n\n", LMMS_VERSION,
PLATFORM, MACHINE, QT_VERSION_STR, COMPILER_VERSION,
LMMS_BUILDCONF_PLATFORM, LMMS_BUILDCONF_MACHINE, QT_VERSION_STR, LMMS_BUILDCONF_COMPILER_VERSION,
LMMS_PROJECT_COPYRIGHT, executableName );
}
@@ -793,7 +793,7 @@ int main( int argc, char * * argv )
{
fprintf( stderr, "Signal initialization failed.\n" );
}
if ( sigaction( SIGPIPE, &sa, NULL ) )
if ( sigaction( SIGPIPE, &sa, nullptr ) )
{
fprintf( stderr, "Signal initialization failed.\n" );
}
@@ -928,12 +928,12 @@ int main( int argc, char * * argv )
mb.exec();
if( mb.clickedButton() == discard )
{
gui->mainWindow()->sessionCleanup();
getGUI()->mainWindow()->sessionCleanup();
}
else if( mb.clickedButton() == recover ) // Recover
{
fileToLoad = recoveryFile;
gui->mainWindow()->setSession( MainWindow::SessionState::Recover );
getGUI()->mainWindow()->setSession( MainWindow::SessionState::Recover );
}
else // Exit
{
@@ -945,10 +945,10 @@ int main( int argc, char * * argv )
// [Settel] workaround: showMaximized() doesn't work with
// FVWM2 unless the window is already visible -> show() first
gui->mainWindow()->show();
getGUI()->mainWindow()->show();
if( fullscreen )
{
gui->mainWindow()->showMaximized();
getGUI()->mainWindow()->showMaximized();
}
// Handle macOS-style FileOpen QEvents
@@ -1008,7 +1008,7 @@ int main( int argc, char * * argv )
// instances of LMMS.
if( autoSaveEnabled )
{
gui->mainWindow()->autoSaveTimerReset();
getGUI()->mainWindow()->autoSaveTimerReset();
}
}

View File

@@ -45,7 +45,7 @@ MidiAlsaRaw::MidiAlsaRaw() :
return;
}
snd_rawmidi_read( m_input, NULL, 0 );
snd_rawmidi_read( m_input, nullptr, 0 );
snd_rawmidi_nonblock( m_input, 1 );
m_npfds = snd_rawmidi_poll_descriptors_count( m_input );
@@ -80,7 +80,7 @@ QString MidiAlsaRaw::probeDevice()
QString dev = ConfigManager::inst()->value( "MidiAlsaRaw", "device" );
if( dev == "" )
{
if( getenv( "MIDIDEV" ) != NULL )
if( getenv( "MIDIDEV" ) != nullptr )
{
return getenv( "MIDIDEV" );
}

View File

@@ -71,7 +71,7 @@ static QString portName( snd_seq_t * _seq, const snd_seq_addr_t * _addr )
MidiAlsaSeq::MidiAlsaSeq() :
MidiClient(),
m_seqMutex(),
m_seqHandle( NULL ),
m_seqHandle( nullptr ),
m_queueID( -1 ),
m_quit( false ),
m_portListUpdateTimer( this )
@@ -97,7 +97,7 @@ MidiAlsaSeq::MidiAlsaSeq() :
snd_seq_set_queue_tempo( m_seqHandle, m_queueID, tempo );
snd_seq_queue_tempo_free( tempo );
snd_seq_start_queue( m_seqHandle, m_queueID, NULL );
snd_seq_start_queue( m_seqHandle, m_queueID, nullptr );
changeQueueTempo( Engine::getSong()->getTempo() );
connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
this, SLOT( changeQueueTempo( bpm_t ) ), Qt::DirectConnection );
@@ -130,7 +130,7 @@ MidiAlsaSeq::~MidiAlsaSeq()
wait( EventPollTimeOut*2 );
m_seqMutex.lock();
snd_seq_stop_queue( m_seqHandle, m_queueID, NULL );
snd_seq_stop_queue( m_seqHandle, m_queueID, nullptr );
snd_seq_free_queue( m_seqHandle, m_queueID );
snd_seq_close( m_seqHandle );
m_seqMutex.unlock();
@@ -145,7 +145,7 @@ QString MidiAlsaSeq::probeDevice()
QString dev = ConfigManager::inst()->value( "Midialsaseq", "device" );
if( dev.isEmpty() )
{
if( getenv( "MIDIDEV" ) != NULL )
if( getenv( "MIDIDEV" ) != nullptr )
{
return getenv( "MIDIDEV" );
}
@@ -505,8 +505,8 @@ void MidiAlsaSeq::run()
}
m_seqMutex.unlock();
snd_seq_addr_t * source = NULL;
MidiPort * dest = NULL;
snd_seq_addr_t * source = nullptr;
MidiPort * dest = nullptr;
for( int i = 0; i < m_portIDs.size(); ++i )
{
if( m_portIDs.values()[i][0] == ev->dest.port )
@@ -521,7 +521,7 @@ void MidiAlsaSeq::run()
}
}
if( dest == NULL )
if( dest == nullptr )
{
continue;
}
@@ -622,7 +622,7 @@ void MidiAlsaSeq::changeQueueTempo( bpm_t _bpm )
m_seqMutex.lock();
snd_seq_change_queue_tempo( m_seqHandle, m_queueID,
60000000 / (int) _bpm, NULL );
60000000 / (int) _bpm, nullptr );
snd_seq_drain_output( m_seqHandle );
m_seqMutex.unlock();

View File

@@ -151,7 +151,7 @@ QString MidiController::nodeName() const
ControllerDialog * MidiController::createDialog( QWidget * _parent )
{
return NULL;
return nullptr;
}

View File

@@ -56,14 +56,14 @@ static void JackMidiShutdown(void *arg)
QString msg_short = MidiJack::tr("JACK server down");
//: When JACK(JACK Audio Connection Kit) disconnects, it will show the following message (dialog message)
QString msg_long = MidiJack::tr("The JACK server seems to be shuted down.");
QMessageBox::information( gui->mainWindow(), msg_short, msg_long );
QMessageBox::information( getGUI()->mainWindow(), msg_short, msg_long );
}
MidiJack::MidiJack() :
MidiClientRaw(),
m_jackClient( nullptr ),
m_input_port( NULL ),
m_output_port( NULL ),
m_input_port( nullptr ),
m_output_port( nullptr ),
m_quit( false )
{
// if jack is currently used for audio then we share the connection
@@ -77,9 +77,9 @@ MidiJack::MidiJack() :
// if a jack connection has been created for audio we use that
m_jackAudio->addMidiClient(this);
}else{
m_jackAudio = NULL;
m_jackAudio = nullptr;
m_jackClient = jack_client_open(probeDevice().toLatin1().data(),
JackNoStartServer, NULL);
JackNoStartServer, nullptr);
if(m_jackClient)
{
@@ -155,10 +155,10 @@ MidiJack::~MidiJack()
jack_client_t* MidiJack::jackClient()
{
if( m_jackAudio == NULL && m_jackClient == NULL)
return NULL;
if( m_jackAudio == nullptr && m_jackClient == nullptr)
return nullptr;
if( m_jackAudio == NULL && m_jackClient )
if( m_jackAudio == nullptr && m_jackClient )
return m_jackClient;
return m_jackAudio->jackClient();

View File

@@ -67,7 +67,7 @@ QString MidiOss::probeDevice()
QString dev = ConfigManager::inst()->value( "midioss", "device" );
if( dev.isEmpty() )
{
if( getenv( "MIDIDEV" ) != NULL )
if( getenv( "MIDIDEV" ) != nullptr )
{
return getenv( "MIDIDEV" );
}

View File

@@ -41,8 +41,8 @@ MidiPort::MidiPort( const QString& name,
Model* parent,
Mode mode ) :
Model( parent ),
m_readablePortsMenu( NULL ),
m_writablePortsMenu( NULL ),
m_readablePortsMenu( nullptr ),
m_writablePortsMenu( nullptr ),
m_midiClient( client ),
m_midiEventProcessor( eventProcessor ),
m_mode( mode ),

View File

@@ -48,14 +48,14 @@ MidiSndio::MidiSndio( void ) :
if (dev == "")
{
m_hdl = mio_open( NULL, MIO_IN | MIO_OUT, 0 );
m_hdl = mio_open( nullptr, MIO_IN | MIO_OUT, 0 );
}
else
{
m_hdl = mio_open( dev.toLatin1().constData(), MIO_IN | MIO_OUT, 0 );
}
if( m_hdl == NULL )
if( m_hdl == nullptr )
{
printf( "sndio: failed opening sndio midi device\n" );
return;

View File

@@ -41,10 +41,10 @@ AboutDialog::AboutDialog(QWidget* parent) :
versionLabel->setText( versionLabel->text().
arg( LMMS_VERSION ).
arg( PLATFORM ).
arg( MACHINE ).
arg( LMMS_BUILDCONF_PLATFORM ).
arg( LMMS_BUILDCONF_MACHINE ).
arg( QT_VERSION_STR ).
arg( COMPILER_VERSION ) );
arg( LMMS_BUILDCONF_COMPILER_VERSION ) );
versionLabel->setTextInteractionFlags(
versionLabel->textInteractionFlags() |
Qt::TextSelectableByMouse );

View File

@@ -213,7 +213,7 @@ void AutomatableModelViewSlots::execConnectionDialog()
AutomatableModel* m = m_amv->modelUntyped();
m->displayName();
ControllerConnectionDialog d( gui->mainWindow(), m );
ControllerConnectionDialog d( getGUI()->mainWindow(), m );
if( d.exec() == 1 )
{
@@ -251,7 +251,7 @@ void AutomatableModelViewSlots::removeConnection()
if( m->controllerConnection() )
{
delete m->controllerConnection();
m->setControllerConnection( NULL );
m->setControllerConnection( nullptr );
}
}
@@ -260,7 +260,7 @@ void AutomatableModelViewSlots::removeConnection()
void AutomatableModelViewSlots::editSongGlobalAutomation()
{
gui->automationEditor()->open(
getGUI()->automationEditor()->open(
AutomationPattern::globalAutomationPattern(m_amv->modelUntyped())
);
}

View File

@@ -41,7 +41,7 @@
#include "Engine.h"
QPixmap * AutomationPatternView::s_pat_rec = NULL;
QPixmap * AutomationPatternView::s_pat_rec = nullptr;
AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,
TrackView * _parent ) :
@@ -51,7 +51,7 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,
{
connect( m_pat, SIGNAL( dataChanged() ),
this, SLOT( update() ) );
connect( gui->automationEditor(), SIGNAL( currentPatternChanged() ),
connect( getGUI()->automationEditor(), SIGNAL( currentPatternChanged() ),
this, SLOT( update() ) );
setAttribute( Qt::WA_OpaquePaintEvent, true );
@@ -59,7 +59,7 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,
ToolTip::add(this, m_pat->name());
setStyle( QApplication::style() );
if( s_pat_rec == NULL ) { s_pat_rec = new QPixmap( embed::getIconPixmap(
if( s_pat_rec == nullptr ) { s_pat_rec = new QPixmap( embed::getIconPixmap(
"pat_rec" ) ); }
update();
@@ -77,7 +77,8 @@ AutomationPatternView::~AutomationPatternView()
void AutomationPatternView::openInAutomationEditor()
{
if(gui) gui->automationEditor()->open(m_pat);
if(getGUI() != nullptr)
getGUI()->automationEditor()->open(m_pat);
}
@@ -125,9 +126,9 @@ void AutomationPatternView::disconnectObject( QAction * _a )
update();
//If automation editor is opened, update its display after disconnection
if( gui->automationEditor() )
if( getGUI()->automationEditor() )
{
gui->automationEditor()->m_editor->updateAfterPatternChange();
getGUI()->automationEditor()->m_editor->updateAfterPatternChange();
}
//if there is no more connection connected to the AutomationPattern
@@ -256,7 +257,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
QLinearGradient lingrad( 0, 0, 0, height() );
QColor c = getColorForDisplay( painter.background().color() );
bool muted = m_pat->getTrack()->isMuted() || m_pat->isMuted();
bool current = gui->automationEditor()->currentPattern() == m_pat;
bool current = getGUI()->automationEditor()->currentPattern() == m_pat;
lingrad.setColorAt( 1, c.darker( 300 ) );
lingrad.setColorAt( 0, c );
@@ -439,7 +440,7 @@ void AutomationPatternView::dropEvent( QDropEvent * _de )
AutomatableModel * mod = dynamic_cast<AutomatableModel *>(
Engine::projectJournal()->
journallingObject( val.toInt() ) );
if( mod != NULL )
if( mod != nullptr )
{
bool added = m_pat->addObject( mod );
if ( !added )
@@ -453,10 +454,10 @@ void AutomationPatternView::dropEvent( QDropEvent * _de )
}
update();
if( gui->automationEditor() &&
gui->automationEditor()->currentPattern() == m_pat )
if( getGUI()->automationEditor() &&
getGUI()->automationEditor()->currentPattern() == m_pat )
{
gui->automationEditor()->setCurrentPattern( m_pat );
getGUI()->automationEditor()->setCurrentPattern( m_pat );
}
}
else

View File

@@ -63,7 +63,7 @@ void AutomationTrackView::dropEvent( QDropEvent * _de )
AutomatableModel * mod = dynamic_cast<AutomatableModel *>(
Engine::projectJournal()->
journallingObject( val.toInt() ) );
if( mod != NULL )
if( mod != nullptr )
{
TimePos pos = TimePos( trackContainerView()->
currentPosition() +

View File

@@ -162,7 +162,7 @@ void BBTCOView::openInBBEditor()
{
Engine::getBBTrackContainer()->setCurrentBB( m_bbTCO->bbTrackIndex() );
gui->mainWindow()->toggleBBEditorWin( true );
getGUI()->mainWindow()->toggleBBEditorWin( true );
}

View File

@@ -53,7 +53,7 @@ BBTrackView::BBTrackView( BBTrack * _bbt, TrackContainerView* tcv ) :
BBTrackView::~BBTrackView()
{
gui->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
getGUI()->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
}
@@ -61,7 +61,7 @@ BBTrackView::~BBTrackView()
bool BBTrackView::close()
{
gui->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
getGUI()->getBBEditor()->removeBBView( BBTrack::s_infoMap[m_bbTrack] );
return TrackView::close();
}
@@ -71,6 +71,6 @@ bool BBTrackView::close()
void BBTrackView::clickedTrackLabel()
{
Engine::getBBTrackContainer()->setCurrentBB( m_bbTrack->index() );
gui->getBBEditor()->parentWidget()->show();
gui->getBBEditor()->setFocus( Qt::ActiveWindowFocusReason );
getGUI()->getBBEditor()->parentWidget()->show();
getGUI()->getBBEditor()->setFocus( Qt::ActiveWindowFocusReason );
}

View File

@@ -126,11 +126,11 @@ private:
ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent,
const AutomatableModel * _target_model ) :
QDialog( _parent ),
m_readablePorts( NULL ),
m_readablePorts( nullptr ),
m_midiAutoDetect( false ),
m_controller( NULL ),
m_controller( nullptr ),
m_targetModel( _target_model ),
m_midiController( NULL )
m_midiController( nullptr )
{
setWindowIcon( embed::getIconPixmap( "setup_audio" ) );
setWindowTitle( tr( "Connection Settings" ) );
@@ -239,7 +239,7 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent,
// Crazy MIDI View stuff
// TODO, handle by making this a model for the Dialog "view"
ControllerConnection * cc = NULL;
ControllerConnection * cc = nullptr;
if( m_targetModel )
{
cc = m_targetModel->controllerConnection();

View File

@@ -31,7 +31,7 @@
EffectControlDialog::EffectControlDialog( EffectControls * _controls ) :
QWidget( NULL ),
QWidget( nullptr ),
ModelView( _controls, this ),
m_effectControls( _controls )
{

View File

@@ -39,7 +39,7 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) :
ui( new Ui::EffectSelectDialog ),
m_sourceModel(),
m_model(),
m_descriptionWidget( NULL )
m_descriptionWidget( nullptr )
{
ui->setupUi( this );
@@ -49,7 +49,7 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) :
EffectKeyList subPluginEffectKeys;
for (const Plugin::Descriptor* desc: pluginFactory->descriptors(Plugin::Effect))
for (const Plugin::Descriptor* desc: getPluginFactory()->descriptors(Plugin::Effect))
{
if( desc->subPluginFeatures )
{
@@ -174,7 +174,7 @@ void EffectSelectDialog::rowChanged( const QModelIndex & _idx,
const QModelIndex & )
{
delete m_descriptionWidget;
m_descriptionWidget = NULL;
m_descriptionWidget = nullptr;
if( m_model.mapToSource( _idx ).row() < 0 )
{

View File

@@ -120,7 +120,7 @@ void ExportProjectDialog::accept()
m_renderManager.reset(nullptr);
QDialog::accept();
gui->mainWindow()->resetWindowTitle();
getGUI()->mainWindow()->resetWindowTitle();
}
@@ -197,7 +197,7 @@ void ExportProjectDialog::startExport()
connect( m_renderManager.get(), SIGNAL( finished() ),
this, SLOT( accept() ) ) ;
connect( m_renderManager.get(), SIGNAL( finished() ),
gui->mainWindow(), SLOT( resetWindowTitle() ) );
getGUI()->mainWindow(), SLOT( resetWindowTitle() ) );
if ( m_multiExport )
{
@@ -293,6 +293,6 @@ void ExportProjectDialog::startBtnClicked()
void ExportProjectDialog::updateTitleBar( int _prog )
{
gui->mainWindow()->setWindowTitle(
getGUI()->mainWindow()->setWindowTitle(
tr( "Rendering: %1%" ).arg( _prog ) );
}

View File

@@ -626,7 +626,7 @@ void FileBrowserTreeWidget::previewFileItem(FileItem* file)
else if (
(ext == "xiz" || ext == "sf2" || ext == "sf3" ||
ext == "gig" || ext == "pat")
&& !pluginFactory->pluginSupportingExtension(ext).isNull())
&& !getPluginFactory()->pluginSupportingExtension(ext).isNull())
{
const bool isPlugin = file->handling() == FileItem::LoadByPlugin;
newPPH = new PresetPreviewPlayHandle(fileName, isPlugin);
@@ -755,7 +755,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it)
switch( f->handling() )
{
case FileItem::LoadAsProject:
if( gui->mainWindow()->mayChangeProject(true) )
if( getGUI()->mainWindow()->mayChangeProject(true) )
{
Engine::getSong()->loadProject( f->fullName() );
}
@@ -769,7 +769,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it)
!i->descriptor()->supportsFileType( e ) )
{
PluginFactory::PluginInfoAndKey piakn =
pluginFactory->pluginSupportingExtension(e);
getPluginFactory()->pluginSupportingExtension(e);
i = it->loadInstrument(piakn.info.name(), &piakn.key);
}
i->loadFile( f->fullName() );
@@ -886,7 +886,7 @@ void FileBrowserTreeWidget::sendToActiveInstrumentTrack( FileItem* item )
{
// get all windows opened in the workspace
QList<QMdiSubWindow*> pl =
gui->mainWindow()->workspace()->
getGUI()->mainWindow()->workspace()->
subWindowList( QMdiArea::StackingOrder );
QListIterator<QMdiSubWindow *> w( pl );
w.toBack();
@@ -1228,7 +1228,7 @@ void FileItem::determineFileType( void )
m_type = PresetFile;
m_handling = LoadAsPreset;
}
else if( ext == "xiz" && ! pluginFactory->pluginSupportingExtension(ext).isNull() )
else if( ext == "xiz" && ! getPluginFactory()->pluginSupportingExtension(ext).isNull() )
{
m_type = PresetFile;
m_handling = LoadByPlugin;
@@ -1262,7 +1262,7 @@ void FileItem::determineFileType( void )
}
if( m_handling == NotSupported &&
!ext.isEmpty() && ! pluginFactory->pluginSupportingExtension(ext).isNull() )
!ext.isEmpty() && ! getPluginFactory()->pluginSupportingExtension(ext).isNull() )
{
m_handling = LoadByPlugin;
// classify as sample if not classified by anything yet but can

View File

@@ -54,7 +54,7 @@
FxMixerView::FxMixerView() :
QWidget(),
ModelView( NULL, this ),
ModelView( nullptr, this ),
SerializingObjectHook()
{
FxMixer * m = Engine::fxMixer();
@@ -149,12 +149,12 @@ FxMixerView::FxMixerView() :
updateGeometry();
// timer for updating faders
connect( gui->mainWindow(), SIGNAL( periodicUpdate() ),
connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ),
this, SLOT( updateFaders() ) );
// add ourself to workspace
QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget( this );
QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget( this );
Qt::WindowFlags flags = subWin->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );
@@ -365,7 +365,7 @@ void FxMixerView::updateFxLine(int index)
thisLine->setToolTip( Engine::fxMixer()->effectChannel( index )->m_name );
FloatModel * sendModel = mix->channelSendModel(selIndex, index);
if( sendModel == NULL )
if( sendModel == nullptr )
{
// does not send, hide send knob
thisLine->m_sendKnob->setVisible(false);

View File

@@ -58,12 +58,16 @@ GuiApplication* GuiApplication::instance()
return s_instance;
}
GuiApplication* getGUI()
{
return GuiApplication::instance();
}
GuiApplication::GuiApplication()
{
// prompt the user to create the LMMS working directory (e.g. ~/Documents/lmms) if it doesn't exist
if ( !ConfigManager::inst()->hasWorkingDir() &&
QMessageBox::question( NULL,
QMessageBox::question( nullptr,
tr( "Working directory" ),
tr( "The LMMS working directory %1 does not "
"exist. Create it now? You can change the directory "
@@ -185,7 +189,7 @@ void GuiApplication::displayInitProgress(const QString &msg)
void GuiApplication::childDestroyed(QObject *obj)
{
// when any object that can be reached via gui->mainWindow(), gui->fxMixerView(), etc
// when any object that can be reached via getGUI()->mainWindow(), getGUI()->fxMixerView(), etc
// is destroyed, ensure that their accessor functions will return null instead of a garbage pointer.
if (obj == m_mainWindow)
{
@@ -237,9 +241,9 @@ QFont GuiApplication::getWin32SystemFont()
if ( pointSize < 0 )
{
// height is in pixels, convert to points
HDC hDC = GetDC( NULL );
HDC hDC = GetDC( nullptr );
pointSize = MulDiv( abs( pointSize ), 72, GetDeviceCaps( hDC, LOGPIXELSY ) );
ReleaseDC( NULL, hDC );
ReleaseDC( nullptr, hDC );
}
return QFont( QString::fromUtf8( metrics.lfMessageFont.lfFaceName ), pointSize );

View File

@@ -44,7 +44,7 @@ InstrumentView::~InstrumentView()
{
if( instrumentTrackWindow() )
{
instrumentTrackWindow()->m_instrumentView = NULL;
instrumentTrackWindow()->m_instrumentView = nullptr;
}
}
@@ -53,7 +53,7 @@ InstrumentView::~InstrumentView()
void InstrumentView::setModel( Model * _model, bool )
{
if( dynamic_cast<Instrument *>( _model ) != NULL )
if( dynamic_cast<Instrument *>( _model ) != nullptr )
{
ModelView::setModel( _model );
instrumentTrackWindow()->setWindowIcon( model()->logo()->pixmap() );

View File

@@ -86,7 +86,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
m_phaseKnob->move( CD_LFO_PHASE_CD_KNOB_X, CD_LFO_CD_KNOB_Y );
m_phaseKnob->setHintText( tr( "Phase offset:" ) , "" + tr( " degrees" ) );
PixmapButton * sin_wave_btn = new PixmapButton( this, NULL );
PixmapButton * sin_wave_btn = new PixmapButton( this, nullptr );
sin_wave_btn->move( CD_LFO_SHAPES_X, CD_LFO_SHAPES_Y );
sin_wave_btn->setActiveGraphic( embed::getIconPixmap(
"sin_wave_active" ) );
@@ -96,7 +96,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
tr( "Sine wave" ) );
PixmapButton * triangle_wave_btn =
new PixmapButton( this, NULL );
new PixmapButton( this, nullptr );
triangle_wave_btn->move( CD_LFO_SHAPES_X + 15, CD_LFO_SHAPES_Y );
triangle_wave_btn->setActiveGraphic(
embed::getIconPixmap( "triangle_wave_active" ) );
@@ -105,7 +105,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
ToolTip::add( triangle_wave_btn,
tr( "Triangle wave" ) );
PixmapButton * saw_wave_btn = new PixmapButton( this, NULL );
PixmapButton * saw_wave_btn = new PixmapButton( this, nullptr );
saw_wave_btn->move( CD_LFO_SHAPES_X + 30, CD_LFO_SHAPES_Y );
saw_wave_btn->setActiveGraphic( embed::getIconPixmap(
"saw_wave_active" ) );
@@ -114,7 +114,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
ToolTip::add( saw_wave_btn,
tr( "Saw wave" ) );
PixmapButton * sqr_wave_btn = new PixmapButton( this, NULL );
PixmapButton * sqr_wave_btn = new PixmapButton( this, nullptr );
sqr_wave_btn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y );
sqr_wave_btn->setActiveGraphic( embed::getIconPixmap(
"square_wave_active" ) );
@@ -124,7 +124,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
tr( "Square wave" ) );
PixmapButton * moog_saw_wave_btn =
new PixmapButton( this, NULL );
new PixmapButton( this, nullptr );
moog_saw_wave_btn->move( CD_LFO_SHAPES_X, CD_LFO_SHAPES_Y + 15 );
moog_saw_wave_btn->setActiveGraphic(
embed::getIconPixmap( "moog_saw_wave_active" ) );
@@ -133,7 +133,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
ToolTip::add( moog_saw_wave_btn,
tr( "Moog saw wave" ) );
PixmapButton * exp_wave_btn = new PixmapButton( this, NULL );
PixmapButton * exp_wave_btn = new PixmapButton( this, nullptr );
exp_wave_btn->move( CD_LFO_SHAPES_X + 15, CD_LFO_SHAPES_Y + 15 );
exp_wave_btn->setActiveGraphic( embed::getIconPixmap(
"exp_wave_active" ) );
@@ -142,7 +142,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
ToolTip::add( exp_wave_btn,
tr( "Exponential wave" ) );
PixmapButton * white_noise_btn = new PixmapButton( this, NULL );
PixmapButton * white_noise_btn = new PixmapButton( this, nullptr );
white_noise_btn->move( CD_LFO_SHAPES_X + 30, CD_LFO_SHAPES_Y + 15 );
white_noise_btn->setActiveGraphic(
embed::getIconPixmap( "white_noise_wave_active" ) );
@@ -151,7 +151,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
ToolTip::add( white_noise_btn,
tr( "White noise" ) );
m_userWaveBtn = new PixmapButton( this, NULL );
m_userWaveBtn = new PixmapButton( this, nullptr );
m_userWaveBtn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y + 15 );
m_userWaveBtn->setActiveGraphic( embed::getIconPixmap(
"usr_wave_active" ) );
@@ -174,7 +174,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
m_waveBtnGrp->addButton( m_userWaveBtn );
PixmapButton * x1 = new PixmapButton( this, NULL );
PixmapButton * x1 = new PixmapButton( this, nullptr );
x1->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y +7);
x1->setActiveGraphic( embed::getIconPixmap(
"lfo_x1_active" ) );
@@ -183,7 +183,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
ToolTip::add( x1,
tr( "Mutliply modulation frequency by 1" ));
PixmapButton * x100 = new PixmapButton( this, NULL );
PixmapButton * x100 = new PixmapButton( this, nullptr );
x100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y - 8 );
x100->setActiveGraphic( embed::getIconPixmap(
"lfo_x100_active" ) );
@@ -192,7 +192,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
ToolTip::add( x100,
tr( "Mutliply modulation frequency by 100" ));
PixmapButton * d100 = new PixmapButton( this, NULL );
PixmapButton * d100 = new PixmapButton( this, nullptr );
d100->move( CD_LFO_MULTIPLIER_X, CD_LFO_SHAPES_Y + 22 );
d100->setActiveGraphic( embed::getIconPixmap(
"lfo_d100_active" ) );

View File

@@ -34,7 +34,7 @@
#include "LmmsStyle.h"
QPalette * LmmsStyle::s_palette = NULL;
QPalette * LmmsStyle::s_palette = nullptr;
QLinearGradient getGradient( const QColor & _col, const QRectF & _rect )
{
@@ -131,7 +131,7 @@ LmmsStyle::LmmsStyle() :
file.open( QIODevice::ReadOnly );
qApp->setStyleSheet( file.readAll() );
if( s_palette != NULL ) { qApp->setPalette( *s_palette ); }
if( s_palette != nullptr ) { qApp->setPalette( *s_palette ); }
setBaseStyle( QStyleFactory::create( "Fusion" ) );
}
@@ -141,7 +141,7 @@ LmmsStyle::LmmsStyle() :
QPalette LmmsStyle::standardPalette( void ) const
{
if( s_palette != NULL) { return * s_palette; }
if( s_palette != nullptr) { return * s_palette; }
QPalette pal = QProxyStyle::standardPalette();

View File

@@ -177,7 +177,7 @@ Lv2ViewBase::Lv2ViewBase(QWidget* meAsWidget, Lv2ControlBase *ctrlBase)
m_helpButton->setCheckable(true);
btnBox->addWidget(m_helpButton);
m_helpWindow = gui->mainWindow()->addWindowedWidget(infoLabel);
m_helpWindow = getGUI()->mainWindow()->addWindowedWidget(infoLabel);
m_helpWindow->setSizePolicy(QSizePolicy::Minimum,
QSizePolicy::Expanding);
m_helpWindow->setAttribute(Qt::WA_DeleteOnClose, false);

View File

@@ -51,7 +51,7 @@ bool MainApplication::event(QEvent* event)
m_queuedFile = fileEvent->file();
if(Engine::getSong())
{
if(gui->mainWindow()->mayChangeProject(true))
if(getGUI()->mainWindow()->mayChangeProject(true))
{
qDebug() << "Loading file " << m_queuedFile;
Engine::getSong()->loadProject(m_queuedFile);

View File

@@ -93,10 +93,10 @@ void disableAutoKeyAccelerators(QWidget* mainWindow)
MainWindow::MainWindow() :
m_workspace( NULL ),
m_toolsMenu( NULL ),
m_workspace( nullptr ),
m_toolsMenu( nullptr ),
m_autoSaveTimer( this ),
m_viewMenu( NULL ),
m_viewMenu( nullptr ),
m_metronomeToggle( 0 ),
m_session( Normal )
{
@@ -273,9 +273,9 @@ MainWindow::~MainWindow()
// TODO: Close tools
// dependencies are such that the editors must be destroyed BEFORE Song is deletect in Engine::destroy
// see issue #2015 on github
delete gui->automationEditor();
delete gui->pianoRoll();
delete gui->songEditor();
delete getGUI()->automationEditor();
delete getGUI()->pianoRoll();
delete getGUI()->songEditor();
// destroy engine which will do further cleanups etc.
Engine::destroy();
}
@@ -390,10 +390,10 @@ void MainWindow::finalize()
m_toolsMenu = new QMenu( this );
for( const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::Tool) )
for( const Plugin::Descriptor* desc : getPluginFactory()->descriptors(Plugin::Tool) )
{
m_toolsMenu->addAction( desc->logo->pixmap(), desc->displayName );
m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/NULL )
m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/nullptr )
->createView(this) );
}
if( !m_toolsMenu->isEmpty() )
@@ -586,10 +586,10 @@ void MainWindow::finalize()
// Add editor subwindows
for (QWidget* widget : std::list<QWidget*>{
gui->automationEditor(),
gui->getBBEditor(),
gui->pianoRoll(),
gui->songEditor()
getGUI()->automationEditor(),
getGUI()->getBBEditor(),
getGUI()->pianoRoll(),
getGUI()->songEditor()
})
{
QMdiSubWindow* window = addWindowedWidget(widget);
@@ -598,13 +598,13 @@ void MainWindow::finalize()
window->resize(widget->sizeHint());
}
gui->automationEditor()->parentWidget()->hide();
gui->getBBEditor()->parentWidget()->move( 610, 5 );
gui->getBBEditor()->parentWidget()->hide();
gui->pianoRoll()->parentWidget()->move(5, 5);
gui->pianoRoll()->parentWidget()->hide();
gui->songEditor()->parentWidget()->move(5, 5);
gui->songEditor()->parentWidget()->show();
getGUI()->automationEditor()->parentWidget()->hide();
getGUI()->getBBEditor()->parentWidget()->move( 610, 5 );
getGUI()->getBBEditor()->parentWidget()->hide();
getGUI()->pianoRoll()->parentWidget()->move(5, 5);
getGUI()->pianoRoll()->parentWidget()->hide();
getGUI()->songEditor()->parentWidget()->move(5, 5);
getGUI()->songEditor()->parentWidget()->show();
// reset window title every time we change the state of a subwindow to show the correct title
for( const QMdiSubWindow * subWindow : workspace()->subWindowList() )
@@ -745,7 +745,7 @@ void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
{
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
// we really care about the position of the *window* - not the position of the widget within its window
if( _w->parentWidget() != NULL &&
if( _w->parentWidget() != nullptr &&
_w->parentWidget()->inherits( "QMdiSubWindow" ) )
{
_w = _w->parentWidget();
@@ -782,7 +782,7 @@ void MainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
{
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
// we really care about the position of the *window* - not the position of the widget within its window
if ( _w->parentWidget() != NULL &&
if ( _w->parentWidget() != nullptr &&
_w->parentWidget()->inherits( "QMdiSubWindow" ) )
{
_w = _w->parentWidget();
@@ -1053,10 +1053,10 @@ void MainWindow::refocus()
{
QList<QWidget*> editors;
editors
<< gui->songEditor()->parentWidget()
<< gui->getBBEditor()->parentWidget()
<< gui->pianoRoll()->parentWidget()
<< gui->automationEditor()->parentWidget();
<< getGUI()->songEditor()->parentWidget()
<< getGUI()->getBBEditor()->parentWidget()
<< getGUI()->pianoRoll()->parentWidget()
<< getGUI()->automationEditor()->parentWidget();
bool found = false;
QList<QWidget*>::Iterator editor;
@@ -1078,7 +1078,7 @@ void MainWindow::refocus()
void MainWindow::toggleBBEditorWin( bool forceShow )
{
toggleWindow( gui->getBBEditor(), forceShow );
toggleWindow( getGUI()->getBBEditor(), forceShow );
}
@@ -1086,7 +1086,7 @@ void MainWindow::toggleBBEditorWin( bool forceShow )
void MainWindow::toggleSongEditorWin()
{
toggleWindow( gui->songEditor() );
toggleWindow( getGUI()->songEditor() );
}
@@ -1094,7 +1094,7 @@ void MainWindow::toggleSongEditorWin()
void MainWindow::toggleProjectNotesWin()
{
toggleWindow( gui->getProjectNotes() );
toggleWindow( getGUI()->getProjectNotes() );
}
@@ -1102,7 +1102,7 @@ void MainWindow::toggleProjectNotesWin()
void MainWindow::togglePianoRollWin()
{
toggleWindow( gui->pianoRoll() );
toggleWindow( getGUI()->pianoRoll() );
}
@@ -1110,7 +1110,7 @@ void MainWindow::togglePianoRollWin()
void MainWindow::toggleAutomationEditorWin()
{
toggleWindow( gui->automationEditor() );
toggleWindow( getGUI()->automationEditor() );
}
@@ -1118,14 +1118,14 @@ void MainWindow::toggleAutomationEditorWin()
void MainWindow::toggleFxMixerWin()
{
toggleWindow( gui->fxMixerView() );
toggleWindow( getGUI()->fxMixerView() );
}
void MainWindow::toggleMicrotunerWin()
{
toggleWindow( gui->getMicrotunerConfig() );
toggleWindow( getGUI()->getMicrotunerConfig() );
}
@@ -1265,7 +1265,7 @@ void MainWindow::onToggleMetronome()
void MainWindow::toggleControllerRack()
{
toggleWindow( gui->getControllerRackView() );
toggleWindow( getGUI()->getControllerRackView() );
}
@@ -1273,29 +1273,29 @@ void MainWindow::toggleControllerRack()
void MainWindow::updatePlayPauseIcons()
{
gui->songEditor()->setPauseIcon( false );
gui->automationEditor()->setPauseIcon( false );
gui->getBBEditor()->setPauseIcon( false );
gui->pianoRoll()->setPauseIcon( false );
getGUI()->songEditor()->setPauseIcon( false );
getGUI()->automationEditor()->setPauseIcon( false );
getGUI()->getBBEditor()->setPauseIcon( false );
getGUI()->pianoRoll()->setPauseIcon( false );
if( Engine::getSong()->isPlaying() )
{
switch( Engine::getSong()->playMode() )
{
case Song::Mode_PlaySong:
gui->songEditor()->setPauseIcon( true );
getGUI()->songEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayAutomationPattern:
gui->automationEditor()->setPauseIcon( true );
getGUI()->automationEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayBB:
gui->getBBEditor()->setPauseIcon( true );
getGUI()->getBBEditor()->setPauseIcon( true );
break;
case Song::Mode_PlayPattern:
gui->pianoRoll()->setPauseIcon( true );
getGUI()->pianoRoll()->setPauseIcon( true );
break;
default:
@@ -1520,7 +1520,7 @@ void MainWindow::exportProject(bool multiExport)
{
QString const & projectFileName = Engine::getSong()->projectFileName();
FileDialog efd( gui->mainWindow() );
FileDialog efd( getGUI()->mainWindow() );
if ( multiExport )
{
@@ -1595,7 +1595,7 @@ void MainWindow::exportProject(bool multiExport)
}
}
ExportProjectDialog epd( exportFileName, gui->mainWindow(), multiExport );
ExportProjectDialog epd( exportFileName, getGUI()->mainWindow(), multiExport );
epd.exec();
}
}
@@ -1678,7 +1678,7 @@ void MainWindow::onSongStopped()
if( tl )
{
SongEditorWindow* songEditor = gui->songEditor();
SongEditorWindow* songEditor = getGUI()->songEditor();
switch( tl->behaviourAtStop() )
{
case TimeLineWidget::BackToZero:

View File

@@ -47,7 +47,7 @@ MidiCCRackView::MidiCCRackView(InstrumentTrack * track) :
setWindowIcon(embed::getIconPixmap("midi_cc_rack"));
setWindowTitle(tr("MIDI CC Rack - %1").arg(m_track->name()));
QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget(this);
QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this);
// Remove maximize button
Qt::WindowFlags flags = subWin->windowFlags();

View File

@@ -39,7 +39,7 @@ ModelView::ModelView( Model* model, QWidget* widget ) :
ModelView::~ModelView()
{
if( m_model != NULL && m_model->isDefaultConstructed() )
if( m_model != nullptr && m_model->isDefaultConstructed() )
{
delete m_model;
}
@@ -50,7 +50,7 @@ ModelView::~ModelView()
void ModelView::setModel( Model* model, bool isOldModelValid )
{
if( isOldModelValid && m_model != NULL )
if( isOldModelValid && m_model != nullptr )
{
if( m_model->isDefaultConstructed() )
{
@@ -86,7 +86,7 @@ void ModelView::unsetModel()
void ModelView::doConnections()
{
if( m_model != NULL )
if( m_model != nullptr )
{
QObject::connect( m_model, SIGNAL( dataChanged() ), widget(), SLOT( update() ) );
QObject::connect( m_model, SIGNAL( propertiesChanged() ), widget(), SLOT( update() ) );

View File

@@ -45,28 +45,28 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) :
m_mutedNoteBorderColor(100, 100, 100, 220),
m_legacySEBB(ConfigManager::inst()->value("ui","legacysebb","0").toInt())
{
connect( gui->pianoRoll(), SIGNAL( currentPatternChanged() ),
connect( getGUI()->pianoRoll(), SIGNAL( currentPatternChanged() ),
this, SLOT( update() ) );
if( s_stepBtnOn0 == NULL )
if( s_stepBtnOn0 == nullptr )
{
s_stepBtnOn0 = new QPixmap( embed::getIconPixmap(
"step_btn_on_0" ) );
}
if( s_stepBtnOn200 == NULL )
if( s_stepBtnOn200 == nullptr )
{
s_stepBtnOn200 = new QPixmap( embed::getIconPixmap(
"step_btn_on_200" ) );
}
if( s_stepBtnOff == NULL )
if( s_stepBtnOff == nullptr )
{
s_stepBtnOff = new QPixmap( embed::getIconPixmap(
"step_btn_off" ) );
}
if( s_stepBtnOffLight == NULL )
if( s_stepBtnOffLight == nullptr )
{
s_stepBtnOffLight = new QPixmap( embed::getIconPixmap(
"step_btn_off_light" ) );
@@ -100,10 +100,10 @@ void PatternView::update()
void PatternView::openInPianoRoll()
{
gui->pianoRoll()->setCurrentPattern( m_pat );
gui->pianoRoll()->parentWidget()->show();
gui->pianoRoll()->show();
gui->pianoRoll()->setFocus();
getGUI()->pianoRoll()->setCurrentPattern( m_pat );
getGUI()->pianoRoll()->parentWidget()->show();
getGUI()->pianoRoll()->show();
getGUI()->pianoRoll()->setFocus();
}
@@ -112,10 +112,10 @@ void PatternView::openInPianoRoll()
void PatternView::setGhostInPianoRoll()
{
gui->pianoRoll()->setGhostPattern( m_pat );
gui->pianoRoll()->parentWidget()->show();
gui->pianoRoll()->show();
gui->pianoRoll()->setFocus();
getGUI()->pianoRoll()->setGhostPattern( m_pat );
getGUI()->pianoRoll()->parentWidget()->show();
getGUI()->pianoRoll()->show();
getGUI()->pianoRoll()->setFocus();
}
@@ -209,7 +209,7 @@ void PatternView::mousePressEvent( QMouseEvent * _me )
Note * n = m_pat->noteAtStep( step );
if( n == NULL )
if( n == nullptr )
{
m_pat->addStepNote( step );
}
@@ -222,9 +222,9 @@ void PatternView::mousePressEvent( QMouseEvent * _me )
Engine::getSong()->setModified();
update();
if( gui->pianoRoll()->currentPattern() == m_pat )
if( getGUI()->pianoRoll()->currentPattern() == m_pat )
{
gui->pianoRoll()->update();
getGUI()->pianoRoll()->update();
}
}
else
@@ -276,7 +276,7 @@ void PatternView::wheelEvent(QWheelEvent * we)
n = m_pat->addStepNote( step );
n->setVolume( 0 );
}
if( n != NULL )
if( n != nullptr )
{
int vol = n->getVolume();
@@ -291,9 +291,9 @@ void PatternView::wheelEvent(QWheelEvent * we)
Engine::getSong()->setModified();
update();
if( gui->pianoRoll()->currentPattern() == m_pat )
if( getGUI()->pianoRoll()->currentPattern() == m_pat )
{
gui->pianoRoll()->update();
getGUI()->pianoRoll()->update();
}
}
we->accept();
@@ -331,7 +331,7 @@ void PatternView::paintEvent( QPaintEvent * )
QColor c;
bool const muted = m_pat->getTrack()->isMuted() || m_pat->isMuted();
bool current = gui->pianoRoll()->currentPattern() == m_pat;
bool current = getGUI()->pianoRoll()->currentPattern() == m_pat;
bool beatPattern = m_pat->m_patternType == Pattern::BeatPattern;
if( beatPattern )

View File

@@ -156,7 +156,7 @@ void PluginBrowser::addPlugins()
m_descTree->clear();
// Fetch and sort all instrument plugin descriptors
auto descs = pluginFactory->descriptors(Plugin::Instrument);
auto descs = getPluginFactory()->descriptors(Plugin::Instrument);
std::sort(descs.begin(), descs.end(),
[](auto d1, auto d2)
{

View File

@@ -104,12 +104,12 @@ void SampleTrackView::updateIndicator()
SampleTrackView::~SampleTrackView()
{
if(m_window != NULL)
if(m_window != nullptr)
{
m_window->setSampleTrackView(NULL);
m_window->setSampleTrackView(nullptr);
m_window->parentWidget()->hide();
}
m_window = NULL;
m_window = nullptr;
}
@@ -210,7 +210,7 @@ void SampleTrackView::dropEvent(QDropEvent *de)
/*! \brief Create and assign a new FX Channel for this track */
void SampleTrackView::createFxLine()
{
int channelIndex = gui->fxMixerView()->addNewChannel();
int channelIndex = getGUI()->fxMixerView()->addNewChannel();
auto channel = Engine::fxMixer()->effectChannel(channelIndex);
channel->m_name = getTrack()->name();
@@ -227,5 +227,5 @@ void SampleTrackView::assignFxLine(int channelIndex)
{
model()->effectChannelModel()->setValue(channelIndex);
gui->fxMixerView()->setCurrentFxLine(channelIndex);
getGUI()->fxMixerView()->setCurrentFxLine(channelIndex);
}

View File

@@ -39,7 +39,7 @@
SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
QWidget(),
ModelView(NULL, this),
ModelView(nullptr, this),
m_track(tv->model()),
m_stv(tv)
{
@@ -84,7 +84,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter;
// set up volume knob
m_volumeKnob = new Knob(knobBright_26, NULL, tr("Sample volume"));
m_volumeKnob = new Knob(knobBright_26, nullptr, tr("Sample volume"));
m_volumeKnob->setVolumeKnob(true);
m_volumeKnob->setHintText(tr("Volume:"), "%");
@@ -98,7 +98,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
// set up panning knob
m_panningKnob = new Knob(knobBright_26, NULL, tr("Panning"));
m_panningKnob = new Knob(knobBright_26, nullptr, tr("Panning"));
m_panningKnob->setHintText(tr("Panning:"), "");
basicControlsLayout->addWidget(m_panningKnob, 0, 1);
@@ -114,7 +114,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
// setup spinbox for selecting FX-channel
m_effectChannelNumber = new FxLineLcdSpinBox(2, NULL, tr("FX channel"), m_stv);
m_effectChannelNumber = new FxLineLcdSpinBox(2, nullptr, tr("FX channel"), m_stv);
basicControlsLayout->addWidget(m_effectChannelNumber, 0, 3);
basicControlsLayout->setAlignment(m_effectChannelNumber, widgetAlignment);
@@ -135,7 +135,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
setModel(tv->model());
QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget(this);
QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this);
Qt::WindowFlags flags = subWin->windowFlags();
flags |= Qt::MSWindowsFixedSizeDialogHint;
flags &= ~Qt::WindowMaximizeButtonHint;
@@ -232,7 +232,7 @@ void SampleTrackWindow::closeEvent(QCloseEvent* ce)
{
ce->ignore();
if(gui->mainWindow()->workspace())
if(getGUI()->mainWindow()->workspace())
{
parentWidget()->hide();
}

View File

@@ -80,7 +80,7 @@ inline void labelWidget(QWidget * w, const QString & txt)
title->setFont(pointSize<12>(f));
assert(dynamic_cast<QBoxLayout *>(w->layout()) != NULL);
assert(dynamic_cast<QBoxLayout *>(w->layout()) != nullptr);
dynamic_cast<QBoxLayout *>(w->layout())->addSpacing(5);
dynamic_cast<QBoxLayout *>(w->layout())->addWidget(title);

View File

@@ -67,9 +67,9 @@ StringPairDrag::~StringPairDrag()
{
// during a drag, we might have lost key-press-events, so reset
// modifiers of main-win
if( gui->mainWindow() )
if( getGUI()->mainWindow() )
{
gui->mainWindow()->clearKeyModifiers();
getGUI()->mainWindow()->clearKeyModifiers();
}
}

View File

@@ -40,7 +40,7 @@
#include "SongEditor.h"
QPixmap * TimeLineWidget::s_posMarkerPixmap = NULL;
QPixmap * TimeLineWidget::s_posMarkerPixmap = nullptr;
TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb,
Song::PlayPos & pos, const TimePos & begin, Song::PlayModes mode,
@@ -66,14 +66,14 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb,
m_begin( begin ),
m_mode( mode ),
m_savedPos( -1 ),
m_hint( NULL ),
m_hint( nullptr ),
m_action( NoAction ),
m_moveXOff( 0 )
{
m_loopPos[0] = 0;
m_loopPos[1] = DefaultTicksPerBar;
if( s_posMarkerPixmap == NULL )
if( s_posMarkerPixmap == nullptr )
{
s_posMarkerPixmap = new QPixmap( embed::getIconPixmap(
"playpos_marker" ) );
@@ -100,9 +100,9 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppb,
TimeLineWidget::~TimeLineWidget()
{
if( gui->songEditor() )
if( getGUI()->songEditor() )
{
m_pos.m_timeLine = NULL;
m_pos.m_timeLine = nullptr;
}
delete m_hint;
}
@@ -392,7 +392,7 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
{
// no ctrl-press-hint when having ctrl pressed
delete m_hint;
m_hint = NULL;
m_hint = nullptr;
m_loopPos[i] = t;
}
else
@@ -431,7 +431,7 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
void TimeLineWidget::mouseReleaseEvent( QMouseEvent* event )
{
delete m_hint;
m_hint = NULL;
m_hint = nullptr;
if ( m_action == SelectSongTCO ) { emit selectionFinished(); }
m_action = NoAction;
}

View File

@@ -34,9 +34,9 @@
ToolPluginView::ToolPluginView( ToolPlugin * _toolPlugin ) :
PluginView( _toolPlugin, NULL )
PluginView( _toolPlugin, nullptr )
{
gui->mainWindow()->addWindowedWidget( this );
getGUI()->mainWindow()->addWindowedWidget( this );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
setWindowTitle( _toolPlugin->displayName() );

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