Reformat and modernize a bit
This commit is contained in:
@@ -58,16 +58,16 @@ public:
|
||||
* returns 0 to play now on the tick, -1 to not play at all and the new offset
|
||||
* that the note should be shifted if it is to be played later in this tick.
|
||||
*/
|
||||
virtual int isInTick(TimePos * curStart, fpp_t frames, f_cnt_t offset,
|
||||
Note * n, MidiClip* c);
|
||||
int amount() const {return m_amount;}
|
||||
virtual int isInTick(TimePos* curStart, fpp_t frames, f_cnt_t offset,
|
||||
Note* n, MidiClip* c);
|
||||
int amount() const { return m_amount; }
|
||||
|
||||
virtual void saveSettings(QDomDocument & doc, QDomElement & element);
|
||||
virtual void loadSettings(const QDomElement & element);
|
||||
|
||||
virtual QWidget * instantiateView(QWidget * parent);
|
||||
virtual QWidget* instantiateView(QWidget* parent);
|
||||
|
||||
virtual QString nodeName() const
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
/*
|
||||
* GrooveExperiments.h - A groove that's new
|
||||
*
|
||||
* Copyright (c) 2005-2008 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
**/
|
||||
|
||||
#ifndef GROOVEEXPERIMENTS_H
|
||||
#define GROOVEEXPERIMENTS_H
|
||||
|
||||
@@ -14,28 +37,25 @@ namespace lmms
|
||||
{
|
||||
|
||||
/**
|
||||
* A groove thats new
|
||||
* A groove that's new
|
||||
*/
|
||||
class GrooveExperiments : public Groove
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GrooveExperiments(QObject *parent = NULL);
|
||||
|
||||
virtual ~GrooveExperiments();
|
||||
GrooveExperiments(QObject* parent = nullptr);
|
||||
~GrooveExperiments() override;
|
||||
|
||||
void init();
|
||||
|
||||
int isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t offset, Note * n, MidiClip* c);
|
||||
int isInTick(TimePos* curStart, const fpp_t frames, const f_cnt_t offset, Note* n, MidiClip* c);
|
||||
|
||||
inline virtual QString nodeName() const
|
||||
{
|
||||
return "experiment";
|
||||
}
|
||||
|
||||
|
||||
|
||||
QWidget * instantiateView(QWidget * parent);
|
||||
QWidget* instantiateView(QWidget* parent);
|
||||
|
||||
public slots:
|
||||
// valid values are from 0 - 127
|
||||
@@ -43,7 +63,7 @@ public slots:
|
||||
|
||||
private:
|
||||
int m_framesPerTick;
|
||||
} ;
|
||||
};
|
||||
|
||||
|
||||
namespace gui
|
||||
@@ -53,19 +73,19 @@ class GrooveExperimentsView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GrooveExperimentsView(GrooveExperiments * groove, QWidget * parent = NULL);
|
||||
~GrooveExperimentsView();
|
||||
GrooveExperimentsView(GrooveExperiments* groove, QWidget* parent = nullptr);
|
||||
~GrooveExperimentsView() override;
|
||||
|
||||
public slots:
|
||||
void valueChanged();
|
||||
void modelChanged();
|
||||
|
||||
private:
|
||||
GrooveExperiments * m_groove;
|
||||
IntModel * m_sliderModel;
|
||||
AutomatableSlider * m_slider;
|
||||
GrooveExperiments* m_groove;
|
||||
IntModel* m_sliderModel;
|
||||
AutomatableSlider* m_slider;
|
||||
|
||||
} ;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/*
|
||||
* Groove.h - classes for addinng swing/funk/groove/slide (you can't name it but you can feel it)
|
||||
* to midi which is not precise enough at 192 ticks per tact to make your arse move.
|
||||
*
|
||||
* In it simplest terms a groove is a subtle delay on some notes in a pattern.
|
||||
* GrooveFactory.h - a factory class for grooves
|
||||
*
|
||||
* Copyright (c) 2005-2008 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
@@ -23,6 +20,7 @@
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
**/
|
||||
|
||||
#ifndef GROOVEFACTORY_H
|
||||
#define GROOVEFACTORY_H
|
||||
|
||||
@@ -33,9 +31,8 @@ namespace lmms
|
||||
|
||||
class GrooveFactory
|
||||
{
|
||||
|
||||
public:
|
||||
static Groove * create(QString grooveType);
|
||||
static Groove* create(const QString& grooveType);
|
||||
|
||||
private:
|
||||
GrooveFactory();
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
|
||||
/*
|
||||
* GrooveView.h - a view class for grooves
|
||||
*
|
||||
* Copyright (c) 2005-2008 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
**/
|
||||
|
||||
#ifndef GROOVEVIEW_H
|
||||
#define GROOVEVIEW_H
|
||||
@@ -17,8 +38,8 @@ class GrooveView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GrooveView(QWidget * parent);
|
||||
virtual ~GrooveView();
|
||||
GrooveView(QWidget* parent);
|
||||
~GrooveView() override;
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -29,10 +50,10 @@ public slots:
|
||||
void grooveChanged();
|
||||
|
||||
private:
|
||||
void setView(Groove * groove);
|
||||
void setView(Groove* groove);
|
||||
|
||||
QVBoxLayout * m_layout;
|
||||
QComboBox * m_comboBox;
|
||||
QVBoxLayout* m_layout;
|
||||
QComboBox* m_comboBox;
|
||||
};
|
||||
|
||||
} // namespace lmms
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
/*
|
||||
* HalfSwing.h - A groove that uses just the latter half of the Hydrogen Swing algorithm
|
||||
*
|
||||
* Copyright (c) 2005-2008 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
**/
|
||||
|
||||
#ifndef HALFSWING_H
|
||||
#define HALFSWING_H
|
||||
|
||||
@@ -14,26 +37,25 @@ namespace lmms
|
||||
{
|
||||
|
||||
/**
|
||||
* A groove thatjust latter half of the HydrogenSwing algo.
|
||||
* A groove that uses just the latter half of the Hydrogen Swing algorithm
|
||||
*/
|
||||
class HalfSwing : public Groove
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HalfSwing(QObject *parent = NULL);
|
||||
|
||||
virtual ~HalfSwing();
|
||||
HalfSwing(QObject* parent = nullptr);
|
||||
~HalfSwing() override;
|
||||
|
||||
void init();
|
||||
|
||||
int isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t offset, Note * n, MidiClip* c);
|
||||
int isInTick(TimePos* curStart, const fpp_t frames, const f_cnt_t offset, Note* n, MidiClip* c);
|
||||
|
||||
inline virtual QString nodeName() const
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "half";
|
||||
}
|
||||
|
||||
QWidget * instantiateView(QWidget * parent);
|
||||
QWidget* instantiateView(QWidget* parent);
|
||||
|
||||
public slots:
|
||||
// valid values are from 0 - 127
|
||||
@@ -51,19 +73,18 @@ class HalfSwingView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HalfSwingView(HalfSwing * halfSwing, QWidget * parent = NULL);
|
||||
~HalfSwingView();
|
||||
HalfSwingView(HalfSwing* halfSwing, QWidget* parent = nullptr);
|
||||
~HalfSwingView() override;
|
||||
|
||||
public slots:
|
||||
void valueChanged();
|
||||
void modelChanged();
|
||||
|
||||
private:
|
||||
HalfSwing * m_swing;
|
||||
IntModel * m_sliderModel;
|
||||
AutomatableSlider * m_slider;
|
||||
|
||||
} ;
|
||||
HalfSwing* m_swing;
|
||||
IntModel* m_sliderModel;
|
||||
AutomatableSlider* m_slider;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
/*
|
||||
* HydrogenSwing.h - A groove that mimics Hydrogen drum machine's swing feature
|
||||
*
|
||||
* Copyright (c) 2005-2008 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
**/
|
||||
|
||||
#ifndef HYDROGENSWING_H
|
||||
#define HYDROGENSWING_H
|
||||
|
||||
@@ -20,22 +43,21 @@ class HydrogenSwing : public Groove
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HydrogenSwing(QObject *parent = NULL);
|
||||
|
||||
virtual ~HydrogenSwing();
|
||||
HydrogenSwing(QObject *parent = nullptr);
|
||||
~HydrogenSwing() override;
|
||||
|
||||
void init();
|
||||
|
||||
int isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t offset, Note * n, MidiClip* c);
|
||||
int isInTick(TimePos* curStart, const fpp_t frames, const f_cnt_t offset, Note* n, MidiClip* c);
|
||||
|
||||
inline virtual QString nodeName() const
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "hydrogen";
|
||||
}
|
||||
|
||||
|
||||
|
||||
QWidget * instantiateView(QWidget * parent);
|
||||
QWidget* instantiateView(QWidget* parent);
|
||||
|
||||
public slots:
|
||||
// valid values are from 0 - 127
|
||||
@@ -53,7 +75,7 @@ class HydrogenSwingView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HydrogenSwingView(HydrogenSwing * swing, QWidget * parent = NULL);
|
||||
HydrogenSwingView(HydrogenSwing* swing, QWidget* parent = NULL);
|
||||
~HydrogenSwingView();
|
||||
|
||||
public slots:
|
||||
@@ -61,9 +83,9 @@ public slots:
|
||||
void modelChanged();
|
||||
|
||||
private:
|
||||
HydrogenSwing * m_swing;
|
||||
IntModel * m_sliderModel;
|
||||
AutomatableSlider * m_slider;
|
||||
HydrogenSwing* m_swing;
|
||||
IntModel* m_sliderModel;
|
||||
AutomatableSlider* m_slider;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ enum MidiEventTypes
|
||||
// system exclusive
|
||||
MidiSysEx= 0xF0,
|
||||
// system common - never in midi files
|
||||
TimePosCode= 0xF1,
|
||||
MidiTimeCode= 0xF1,
|
||||
MidiSongPosition = 0xF2,
|
||||
MidiSongSelect = 0xF3,
|
||||
MidiTuneRequest = 0xF6,
|
||||
@@ -75,7 +75,7 @@ enum MidiMetaEventTypes
|
||||
MidiEOT = 0x2f,
|
||||
MidiSetTempo = 0x51,
|
||||
MidiSMPTEOffset = 0x54,
|
||||
TimePosSignature = 0x58,
|
||||
MidiTimeSignature = 0x58,
|
||||
MidiKeySignature = 0x59,
|
||||
MidiSequencerEvent = 0x7f,
|
||||
MidiMetaCustom = 0x80,
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
/*
|
||||
* MidiSwing.h - A swing groove that adjusts by whole ticks
|
||||
*
|
||||
* Copyright (c) 2005-2008 teknopaul <teknopaul/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
**/
|
||||
|
||||
#ifndef MIDISWING_H
|
||||
#define MIDISWING_H
|
||||
|
||||
@@ -20,21 +43,19 @@ class MidiSwing : public Groove
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MidiSwing(QObject * parent = NULL);
|
||||
|
||||
~MidiSwing();
|
||||
MidiSwing(QObject* parent = nullptr);
|
||||
~MidiSwing() override;
|
||||
|
||||
// TODO why declaring this should it not come from super class?
|
||||
int isInTick(TimePos * cur_start, const fpp_t frames, const f_cnt_t offset, Note * n, MidiClip* c);
|
||||
int isInTick(TimePos * curStart, Note * n, MidiClip* c);
|
||||
int isInTick(TimePos* cur_start, const fpp_t frames, const f_cnt_t offset, Note* n, MidiClip* c);
|
||||
int isInTick(TimePos* curStart, Note* n, MidiClip* c);
|
||||
|
||||
inline virtual QString nodeName() const
|
||||
QString nodeName() const override
|
||||
{
|
||||
return "midi";
|
||||
}
|
||||
|
||||
QWidget * instantiateView(QWidget * parent);
|
||||
|
||||
QWidget* instantiateView(QWidget* parent);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
return m_globalAutomationTrack;
|
||||
}
|
||||
|
||||
Groove * globalGroove()
|
||||
Groove* globalGroove()
|
||||
{
|
||||
return m_globalGroove;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
bool guiSaveProject();
|
||||
bool guiSaveProjectAs(const QString & filename);
|
||||
bool saveProjectFile(const QString & filename, bool withResources = false);
|
||||
void setGlobalGroove(Groove * groove);
|
||||
void setGlobalGroove(Groove* groove);
|
||||
|
||||
const QString & projectFileName() const
|
||||
{
|
||||
@@ -454,7 +454,7 @@ private:
|
||||
void setProjectFileName(QString const & projectFileName);
|
||||
|
||||
AutomationTrack * m_globalAutomationTrack;
|
||||
Groove * m_globalGroove;
|
||||
Groove* m_globalGroove;
|
||||
|
||||
IntModel m_tempoModel;
|
||||
MeterModel m_timeSigModel;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
Groove::Groove(QObject *parent) :
|
||||
Groove::Groove(QObject* parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
@@ -21,15 +21,14 @@ Groove::Groove(QObject *parent) :
|
||||
* Default groove is no groove. Not even a wiggle.
|
||||
* @return 0 or -1
|
||||
*/
|
||||
int Groove::isInTick(TimePos * curStart, fpp_t frames, f_cnt_t offset,
|
||||
Note * n, MidiClip* c) {
|
||||
|
||||
int Groove::isInTick(TimePos* curStart, fpp_t frames, f_cnt_t offset,
|
||||
Note* n, MidiClip* c)
|
||||
{
|
||||
return n->pos().getTicks() == curStart->getTicks() ? 0 : -1;
|
||||
}
|
||||
|
||||
void Groove::setAmount(int amount)
|
||||
{
|
||||
|
||||
if (amount < 0) {
|
||||
amount = 0;
|
||||
}
|
||||
@@ -63,7 +62,7 @@ void Groove::loadSettings(const QDomElement & element)
|
||||
}
|
||||
}
|
||||
|
||||
QWidget * Groove::instantiateView(QWidget * parent)
|
||||
QWidget* Groove::instantiateView(QWidget* parent)
|
||||
{
|
||||
return new QLabel("");
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
GrooveExperiments::GrooveExperiments(QObject * parent) :
|
||||
GrooveExperiments::GrooveExperiments(QObject* parent) :
|
||||
Groove(parent)
|
||||
{
|
||||
m_amount = 0;
|
||||
@@ -55,20 +55,20 @@ GrooveExperiments::~GrooveExperiments()
|
||||
void GrooveExperiments::init()
|
||||
{
|
||||
|
||||
Song * s = Engine::getSong();
|
||||
connect(s, SIGNAL(projectLoaded()), this, SLOT(update()));
|
||||
connect(s, SIGNAL(lengthChanged(int)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update()));
|
||||
Song* s = Engine::getSong();
|
||||
connect(s, SIGNAL(projectLoaded()), this, SLOT(update()));
|
||||
connect(s, SIGNAL(lengthChanged(int)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(timeSignatureChanged(int, int)), this, SLOT(update()));
|
||||
|
||||
}
|
||||
|
||||
void GrooveExperiments::update()
|
||||
{
|
||||
m_framesPerTick = Engine::framesPerTick();
|
||||
m_framesPerTick = Engine::framesPerTick();
|
||||
}
|
||||
|
||||
int GrooveExperiments::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t offset, Note * n, MidiClip* c)
|
||||
int GrooveExperiments::isInTick(TimePos* curStart, const fpp_t frames, const f_cnt_t offset, Note* n, MidiClip* c)
|
||||
{
|
||||
// TODO why is this wrong on boot how do we set it once not every loop
|
||||
if (m_framesPerTick == 0)
|
||||
@@ -101,7 +101,7 @@ int GrooveExperiments::isInTick(TimePos * curStart, const fpp_t frames, const f_
|
||||
|
||||
float ticksToShift = ((posInEigth - 12) * -m_swingFactor);
|
||||
|
||||
f_cnt_t framesToShift = (int)(ticksToShift * m_framesPerTick);
|
||||
f_cnt_t framesToShift = (int)(ticksToShift* m_framesPerTick);
|
||||
|
||||
int tickOffset = (int)(framesToShift / m_framesPerTick); // round down
|
||||
|
||||
@@ -124,7 +124,7 @@ int GrooveExperiments::isInTick(TimePos * curStart, const fpp_t frames, const f_
|
||||
return n->pos().getTicks() == curStart->getTicks() ? 0 : -1;
|
||||
}
|
||||
|
||||
QWidget * GrooveExperiments::instantiateView(QWidget * parent)
|
||||
QWidget* GrooveExperiments::instantiateView(QWidget* parent)
|
||||
{
|
||||
return new gui::GrooveExperimentsView(this, parent);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ namespace gui
|
||||
|
||||
// VIEW //
|
||||
|
||||
GrooveExperimentsView::GrooveExperimentsView(GrooveExperiments * groove, QWidget * parent) :
|
||||
GrooveExperimentsView::GrooveExperimentsView(GrooveExperiments* groove, QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
m_sliderModel = new IntModel(0, 0, 127); // Unused
|
||||
|
||||
@@ -21,8 +21,8 @@ GrooveFactory::GrooveFactory()
|
||||
*
|
||||
* TODO this is a bit Java-like how does C++ do this kind of thing normally
|
||||
*/
|
||||
Groove * GrooveFactory::create(QString grooveType) {
|
||||
if (grooveType == NULL || grooveType == "none") {
|
||||
Groove* GrooveFactory::create(const QString& grooveType) {
|
||||
if (grooveType.isEmpty() || grooveType == "none") {
|
||||
return new Groove();
|
||||
}
|
||||
if (grooveType == "hydrogen") {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
HalfSwing::HalfSwing(QObject * parent) :
|
||||
HalfSwing::HalfSwing(QObject* parent) :
|
||||
Groove(parent)
|
||||
{
|
||||
m_amount = 0;
|
||||
@@ -57,10 +57,10 @@ HalfSwing::~HalfSwing()
|
||||
void HalfSwing::init()
|
||||
{
|
||||
|
||||
Song * s = Engine::getSong();
|
||||
connect(s, SIGNAL(projectLoaded()), this, SLOT(update()));
|
||||
connect(s, SIGNAL(lengthChanged(int)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update()));
|
||||
Song* s = Engine::getSong();
|
||||
connect(s, SIGNAL(projectLoaded()), this, SLOT(update()));
|
||||
connect(s, SIGNAL(lengthChanged(int)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(timeSignatureChanged(int, int)), this, SLOT(update()));
|
||||
|
||||
}
|
||||
@@ -72,8 +72,8 @@ void HalfSwing::update()
|
||||
}
|
||||
|
||||
|
||||
int HalfSwing::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t offset,
|
||||
Note * n, MidiClip* c)
|
||||
int HalfSwing::isInTick(TimePos* curStart, const fpp_t frames, const f_cnt_t offset,
|
||||
Note* n, MidiClip* c)
|
||||
{
|
||||
// TODO why is this wrong on boot how do we set it once not every loop
|
||||
if (m_framesPerTick == 0)
|
||||
@@ -109,7 +109,7 @@ int HalfSwing::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t of
|
||||
|
||||
float ticksToShift = ((posInEigth - 6) * -m_swingFactor);
|
||||
|
||||
f_cnt_t framesToShift = (int)(ticksToShift * m_framesPerTick);
|
||||
f_cnt_t framesToShift = (int)(ticksToShift* m_framesPerTick);
|
||||
|
||||
int tickOffset = (int)(framesToShift / m_framesPerTick); // round down
|
||||
|
||||
@@ -132,7 +132,7 @@ int HalfSwing::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t of
|
||||
return n->pos().getTicks() == curStart->getTicks() ? 0 : -1;
|
||||
}
|
||||
|
||||
QWidget * HalfSwing::instantiateView(QWidget * parent)
|
||||
QWidget* HalfSwing::instantiateView(QWidget* parent)
|
||||
{
|
||||
return new gui::HalfSwingView(this, parent);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace gui
|
||||
|
||||
// VIEW //
|
||||
|
||||
HalfSwingView::HalfSwingView(HalfSwing * halfSwing, QWidget * parent) :
|
||||
HalfSwingView::HalfSwingView(HalfSwing* halfSwing, QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
m_sliderModel = new IntModel(0, 0, 127); // Unused
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
HydrogenSwing::HydrogenSwing(QObject * _parent) :
|
||||
HydrogenSwing::HydrogenSwing(QObject* _parent) :
|
||||
Groove(_parent)
|
||||
{
|
||||
m_amount = 0;
|
||||
@@ -57,10 +57,10 @@ HydrogenSwing::~HydrogenSwing()
|
||||
void HydrogenSwing::init()
|
||||
{
|
||||
|
||||
Song * s = Engine::getSong();
|
||||
connect(s, SIGNAL(projectLoaded()), this, SLOT(update()));
|
||||
connect(s, SIGNAL(lengthChanged(int)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update()));
|
||||
Song* s = Engine::getSong();
|
||||
connect(s, SIGNAL(projectLoaded()), this, SLOT(update()));
|
||||
connect(s, SIGNAL(lengthChanged(int)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(tempoChanged(bpm_t)), this, SLOT(update()));
|
||||
connect(s, SIGNAL(timeSignatureChanged(int, int)), this, SLOT(update()));
|
||||
|
||||
}
|
||||
@@ -70,8 +70,8 @@ void HydrogenSwing::update()
|
||||
m_framesPerTick = Engine::framesPerTick();
|
||||
}
|
||||
|
||||
int HydrogenSwing::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t offset,
|
||||
Note * n, MidiClip* c)
|
||||
int HydrogenSwing::isInTick(TimePos* curStart, const fpp_t frames, const f_cnt_t offset,
|
||||
Note* n, MidiClip* c)
|
||||
{
|
||||
// TODO why is this wrong on boot how do we set it once not every loop
|
||||
if (m_framesPerTick == 0)
|
||||
@@ -113,7 +113,7 @@ int HydrogenSwing::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_
|
||||
|
||||
float ticksToShift = ((posInEigth - 6) * -m_swingFactor);
|
||||
|
||||
f_cnt_t framesToShift = (int)(ticksToShift * m_framesPerTick);
|
||||
f_cnt_t framesToShift = (int)(ticksToShift* m_framesPerTick);
|
||||
|
||||
int tickOffset = (int)(framesToShift / m_framesPerTick); // round down
|
||||
|
||||
@@ -136,7 +136,7 @@ int HydrogenSwing::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_
|
||||
return n->pos().getTicks() == curStart->getTicks() ? 0 : -1;
|
||||
}
|
||||
|
||||
QWidget * HydrogenSwing::instantiateView(QWidget * parent)
|
||||
QWidget* HydrogenSwing::instantiateView(QWidget* parent)
|
||||
{
|
||||
return new gui::HydrogenSwingView(this, parent);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace gui
|
||||
|
||||
// VIEW //
|
||||
|
||||
HydrogenSwingView::HydrogenSwingView(HydrogenSwing * swing, QWidget * parent) :
|
||||
HydrogenSwingView::HydrogenSwingView(HydrogenSwing* swing, QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
m_sliderModel = new IntModel(0, 0, 127); // Unused
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
MidiSwing::MidiSwing(QObject * parent) :
|
||||
MidiSwing::MidiSwing(QObject* parent) :
|
||||
Groove(parent)
|
||||
{
|
||||
}
|
||||
@@ -41,13 +41,13 @@ MidiSwing::~MidiSwing()
|
||||
|
||||
static int applyMidiSwing(int posInEight);
|
||||
|
||||
int MidiSwing::isInTick(TimePos * curStart, const fpp_t frames, const f_cnt_t offset,
|
||||
Note * n, MidiClip* c)
|
||||
int MidiSwing::isInTick(TimePos* curStart, const fpp_t frames, const f_cnt_t offset,
|
||||
Note* n, MidiClip* c)
|
||||
{
|
||||
return isInTick(curStart, n, c);
|
||||
}
|
||||
|
||||
int MidiSwing::isInTick(TimePos * curStart, Note * n, MidiClip* c)
|
||||
int MidiSwing::isInTick(TimePos* curStart, Note* n, MidiClip* c)
|
||||
{
|
||||
|
||||
// Where are we in the beat
|
||||
@@ -75,7 +75,7 @@ int MidiSwing::isInTick(TimePos * curStart, Note * n, MidiClip* c)
|
||||
|
||||
}
|
||||
|
||||
QWidget * MidiSwing::instantiateView(QWidget * parent)
|
||||
QWidget* MidiSwing::instantiateView(QWidget* parent)
|
||||
{
|
||||
return new QLabel("");
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
|
||||
m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 0.1f, this, tr( "Volume" ) ),
|
||||
m_panningModel( DefaultPanning, PanningLeft, PanningRight, 0.1f, this, tr( "Panning" ) ),
|
||||
m_audioPort( tr( "unnamed_track" ), true, &m_volumeModel, &m_panningModel, &m_mutedModel ),
|
||||
m_groove( NULL ),
|
||||
m_noGroove( NULL ),
|
||||
m_groove( nullptr ),
|
||||
m_noGroove( nullptr ),
|
||||
m_pitchModel( 0, MinPitchDefault, MaxPitchDefault, 1, this, tr( "Pitch" ) ),
|
||||
m_pitchRangeModel( 1, 1, 60, this, tr( "Pitch range" ) ),
|
||||
m_mixerChannelModel( 0, 0, 0, this, tr( "Mixer channel" ) ),
|
||||
@@ -217,7 +217,7 @@ InstrumentTrack::~InstrumentTrack()
|
||||
// now we're save deleting the instrument
|
||||
if( m_instrument ) delete m_instrument;
|
||||
|
||||
if (m_noGroove != NULL) {
|
||||
if (m_noGroove != nullptr) {
|
||||
delete m_noGroove;
|
||||
}
|
||||
}
|
||||
@@ -756,7 +756,7 @@ bool InstrumentTrack::play( const TimePos & _start, const fpp_t _frames,
|
||||
NoteVector::ConstIterator nit = notes.begin();
|
||||
|
||||
Groove * groove = this->groove();
|
||||
if ( groove == NULL ) {
|
||||
if (!groove) {
|
||||
groove = globalGroove;
|
||||
}
|
||||
int groove_offset = 0;
|
||||
@@ -812,7 +812,7 @@ Groove * InstrumentTrack::groove()
|
||||
{
|
||||
if (m_grooveOn)
|
||||
{
|
||||
// NULL: Use global groove
|
||||
// nullptr: Use global groove
|
||||
return m_groove;
|
||||
}
|
||||
else
|
||||
@@ -831,7 +831,7 @@ void InstrumentTrack::updateGroove()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_noGroove == NULL)
|
||||
if (!m_noGroove)
|
||||
{
|
||||
m_noGroove = new Groove();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user