Reformat and modernize a bit

This commit is contained in:
Hyunjin Song
2023-01-06 22:03:17 +09:00
parent 94221651d4
commit 9b3fe5e2ad
16 changed files with 219 additions and 118 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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