Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Groove Quantization #4232

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
957ec6b
Initial global groove quantization feature
tresf Mar 9, 2018
46fa180
Remove Studio Controller
Mar 11, 2018
3866cef
Move Groove to global toolbar
Mar 14, 2018
46a2f78
Use AutomatableSlider & IntModel...
Mar 14, 2018
d6529ae
Update old homepage URL and program name
PhysSong Mar 14, 2018
ad9ea6f
Reduce code duplications
PhysSong Mar 14, 2018
217c31a
Reformat code
PhysSong Mar 28, 2018
81e0fe2
Do more reformattings
PhysSong Mar 28, 2018
8fa33a8
Reorder the swings
Mar 28, 2018
9e23b2a
Remove unused code
Mar 31, 2018
3760e46
Move enable/disable groove per instrument track...
Apr 28, 2018
7117d90
Merge branch 'master' into groove
PhysSong Apr 30, 2018
1b9f282
Merge remote-tracking branch 'lmms/master' into groove
May 22, 2018
df329e6
Merge branch 'master' into groove
PhysSong Jun 15, 2018
6122d0f
Merge branch 'master' into groove
PhysSong Nov 19, 2019
14f894c
Remove exprtk.hpp.patch
PhysSong Nov 19, 2019
170c8b9
Minor formatting changes
PhysSong Nov 19, 2019
b2057ae
Merge branch 'master' into groove
PhysSong Feb 5, 2022
fe9c8b6
Merge branch 'master' into groove
PhysSong Mar 3, 2022
1dbf6aa
Fix includes
PhysSong Mar 3, 2022
193c30f
Merge branch 'master' into groove
PhysSong Jun 18, 2022
9422165
Merge branch 'master' into groove
PhysSong Jan 6, 2023
9b3fe5e
Reformat and modernize a bit
PhysSong Jan 6, 2023
dfc7eab
Fix namespace comments
PhysSong Jan 7, 2023
cbcde94
Merge branch 'master' into groove
PhysSong Apr 16, 2024
013aef5
Remove connections to a nonexistent signal
PhysSong Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/themes/default/groove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions include/Groove.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* 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.
*
* 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 GROOVE_H
#define GROOVE_H

#include <QWidget>

#include "lmms_basics.h"
#include "TimePos.h"
#include "Note.h"
#include "MidiClip.h"
#include "SerializingObject.h"

namespace lmms
{

class Groove : public QObject, public SerializingObject
{
Q_OBJECT

public:
Groove(QObject* parent = nullptr);

/*
* Groove should return true if the note should be played in the curr_time tick,
* at the start of the tick or any time before the next tick.
*
* cur_start - the tick about to be played
* n - the note to be played, or not played
* p - the pattern to which the note belongs
*
* default implementation (no groove) would be return n.pos() == cur_start ? 0 : -1;
*
* 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 void saveSettings(QDomDocument & doc, QDomElement & element);
virtual void loadSettings(const QDomElement & element);

virtual QWidget* instantiateView(QWidget* parent);

QString nodeName() const override
{
return "none";
}

signals:
void amountChanged(int newAmount);

public slots:
void setAmount(int amount);

protected:
int m_amount;
float m_swingFactor; // = (m_amount / 127)
};

} // namespace lmms

#endif // GROOVE_H
93 changes: 93 additions & 0 deletions include/GrooveExperiments.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* 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

#include <QObject>

#include "AutomatableSlider.h"
#include "Groove.h"
#include "lmms_basics.h"
#include "TimePos.h"
#include "Note.h"
#include "MidiClip.h"

namespace lmms
{

/**
* A groove that's new
*/
class GrooveExperiments : public Groove
{
Q_OBJECT
public:
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);

inline virtual QString nodeName() const
{
return "experiment";
}

QWidget* instantiateView(QWidget* parent);

public slots:

Check notice on line 60 in include/GrooveExperiments.h

View check run for this annotation

codefactor.io / CodeFactor

include/GrooveExperiments.h#L60

Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
// valid values are from 0 - 127
void update();

private:
int m_framesPerTick;
};


namespace gui
{

class GrooveExperimentsView : public QWidget
{
Q_OBJECT
public:
GrooveExperimentsView(GrooveExperiments* groove, QWidget* parent = nullptr);
~GrooveExperimentsView() override;

public slots:
void valueChanged();

private:
GrooveExperiments* m_groove;
IntModel* m_sliderModel;
AutomatableSlider* m_slider;

};

} // namespace gui

} // namespace lmms

#endif // GROOVEEXPERIMENTS_H
43 changes: 43 additions & 0 deletions include/GrooveFactory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* GrooveFactory.h - a factory 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 GROOVEFACTORY_H
#define GROOVEFACTORY_H

#include "Groove.h"

namespace lmms
{

class GrooveFactory
{
public:
static Groove* create(const QString& grooveType);

private:
GrooveFactory();
};

} // namespace lmms

#endif // GROOVEFACTORY_H
61 changes: 61 additions & 0 deletions include/GrooveView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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

#include <QWidget>
#include <QVBoxLayout>
#include <QComboBox>

#include "Groove.h"
#include "SerializingObject.h"

namespace lmms::gui
{

class GrooveView : public QWidget
{
Q_OBJECT
public:
GrooveView(QWidget* parent);
~GrooveView() override;

void clear();

signals:

public slots:
void update();
void grooveChanged();

private:
void setView(Groove* groove);

QVBoxLayout* m_layout;
QComboBox* m_comboBox;
};

} // namespace lmms::gui

#endif // GROOVEVIEW_H
3 changes: 3 additions & 0 deletions include/GuiApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace lmms::gui

class AutomationEditorWindow;
class ControllerRackView;
class GrooveView;
class MixerView;
class MainWindow;
class MicrotunerConfig;
Expand All @@ -58,6 +59,7 @@ class LMMS_EXPORT GuiApplication : public QObject
#endif

MainWindow* mainWindow() { return m_mainWindow; }
GrooveView* grooveView() { return m_grooveView; }
MixerView* mixerView() { return m_mixerView; }
SongEditorWindow* songEditor() { return m_songEditor; }
PatternEditorWindow* patternEditor() { return m_patternEditor; }
Expand All @@ -77,6 +79,7 @@ private slots:
static GuiApplication* s_instance;

MainWindow* m_mainWindow;
GrooveView* m_grooveView;
MixerView* m_mixerView;
SongEditorWindow* m_songEditor;
AutomationEditorWindow* m_automationEditor;
Expand Down
Loading
Loading