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

Adds support for MIDI CC events inside LMMS #5581

Merged
merged 51 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
374abf2
First commit
IanCaio Jul 10, 2020
f1603ea
Updates the MIDI CC Rack GUI
IanCaio Jul 11, 2020
53fe0d0
Keeps working on the MIDI CC Rack GUI
IanCaio Jul 11, 2020
755cf12
Add class members
IanCaio Jul 11, 2020
7599fec
Starts implementing the track ComboBox syncing
IanCaio Jul 11, 2020
fb71375
Updates tracks ComboBox when tracks are moved
IanCaio Jul 12, 2020
c58fbbe
Merge branch 'master' into feature/midiCCSupport
IanCaio Jul 12, 2020
a309207
Merge branch 'master' into feature/midiCCSupport
IanCaio Jul 12, 2020
cfead27
Starts implementing the CC controllers models
IanCaio Jul 13, 2020
f73d42f
Implements the CC event handling itself
IanCaio Jul 14, 2020
72addfe
Adds the enable/disable functionality for MIDI CC
IanCaio Jul 14, 2020
65a2bc0
Changes shortcuts and titles
IanCaio Jul 14, 2020
7546e22
Merge branch 'master' into feature/midiCCSupport
IanCaio Jul 14, 2020
f2d5302
Removes unused comment
IanCaio Jul 14, 2020
15141a9
Fix SEGFAULT bug and hide MIDI CC rack at start up
IanCaio Jul 14, 2020
6dc7018
Save/Load MIDI controllers models on project file
IanCaio Jul 15, 2020
cedcf6b
Uses lambda functions instead of QSignalMapper
IanCaio Jul 15, 2020
0ff2835
Corrects tooltip of MIDI CC rack
IanCaio Jul 15, 2020
64c83ff
Removes unused header
IanCaio Jul 15, 2020
36a6de3
Includes the MIDI CC Rack in the View Menu
IanCaio Jul 18, 2020
73216f4
Merge branch 'master' into feature/midiCCSupport
IanCaio Aug 2, 2020
c40fc49
Replaces constant with existent one from Midi.h
IanCaio Aug 3, 2020
e0a3939
Processes MIDI CC rack events as hardware ones
IanCaio Aug 3, 2020
d18b25b
Merge branch 'master' into feature/midiCCSupport
IanCaio Sep 9, 2020
6abd130
Fixes a Segmentation Fault bug
IanCaio Sep 9, 2020
279832a
Merge branch 'master' into feature/midiCCSupport
IanCaio Sep 13, 2020
56363bf
Fixes mistake on processInEvent logic
IanCaio Sep 13, 2020
91d9d06
Fixes memory leak and "used ID" bug
IanCaio Sep 14, 2020
df544ee
Merge branch 'master' into feature/midiCCSupport
IanCaio Sep 20, 2020
39c21b6
Changes MIDI CC Rack GUI
IanCaio Sep 21, 2020
b3e2479
Fixes bug where CC events are ignored on export
IanCaio Sep 21, 2020
527a959
Removes argument from MidiEvent copy constructor
IanCaio Sep 22, 2020
b8081a4
Changes variable fromHardware to ignoreOnExport
IanCaio Nov 16, 2020
19018c3
Remove unused signals
IanCaio Nov 16, 2020
23911d2
Randomizes MIDI CC rack position
IanCaio Nov 16, 2020
b104f99
Merge branch 'master' into feature/midiCCSupport
IanCaio Nov 16, 2020
c0a5c66
Merge branch 'master' into feature/midiCCSupport
IanCaio Nov 24, 2020
aba42c2
Fixes some code style issues
IanCaio Nov 24, 2020
babeb8e
Merge branch 'master' into feature/midiCCSupport
IanCaio Nov 29, 2020
d791b7e
Moves MidiCCRackView.cpp to src/gui
IanCaio Nov 29, 2020
df71382
Removes track label and increases knobs per row
IanCaio Nov 29, 2020
7d78af8
Adds tr and remove unnecessary QString conversions
IanCaio Nov 29, 2020
c928f97
Uses std::unique_ptr for the MIDI CC models
IanCaio Nov 29, 2020
aa6345b
Implements the MidiCCRackView destructor
IanCaio Nov 29, 2020
2e2b7c0
Uses lazy creation on the MidiCCRackView
IanCaio Nov 29, 2020
f4e5662
Merge branch 'master' into feature/midiCCSupport
IanCaio Nov 30, 2020
9d1aab6
Changes access specifiers and destructor
IanCaio Nov 30, 2020
6bc6d8b
Changes MIDI CC Rack icon
IanCaio Nov 30, 2020
2c6a55f
Uses the MIDI CC icon on the menu action too
IanCaio Nov 30, 2020
4a4cead
Reorganizes included headers
IanCaio Nov 30, 2020
291ebc4
Changes code to use std::make_unique
IanCaio Nov 30, 2020
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/classic/midi_cc_rack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/default/midi_cc_rack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions include/GuiApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MainWindow;
class PianoRollWindow;
class ProjectNotes;
class SongEditorWindow;
class MidiCCRackView;

class LMMS_EXPORT GuiApplication : public QObject
{
Expand All @@ -57,6 +58,7 @@ class LMMS_EXPORT GuiApplication : public QObject
ProjectNotes* getProjectNotes() { return m_projectNotes; }
AutomationEditorWindow* automationEditor() { return m_automationEditor; }
ControllerRackView* getControllerRackView() { return m_controllerRackView; }
MidiCCRackView* getMidiCCRackView() { return m_midiCCRackView; }

public slots:
void displayInitProgress(const QString &msg);
Expand All @@ -75,6 +77,7 @@ private slots:
PianoRollWindow* m_pianoRoll;
ProjectNotes* m_projectNotes;
ControllerRackView* m_controllerRackView;
MidiCCRackView* m_midiCCRackView;
QLabel* m_loadingProgressLabel;
};

Expand Down
6 changes: 6 additions & 0 deletions include/InstrumentTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "Pitch.h"
#include "Plugin.h"
#include "Track.h"
#include "MidiCCRackView.h"



Expand Down Expand Up @@ -221,6 +222,9 @@ class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor

void autoAssignMidiDevice( bool );

BoolModel *m_midiCCEnable;
FloatModel *m_midiCCModel[MIDI_CC_MAX_CONTROLLERS];

signals:
void instrumentChanged();
void midiNoteOn( const Note& );
Expand All @@ -229,6 +233,8 @@ class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor
void newNote();
void endNote();

public slots:
void processCCEvent(int controller);

protected:
QString nodeName() const override
Expand Down
1 change: 1 addition & 0 deletions include/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public slots:
void togglePianoRollWin();
void toggleControllerRack();
void toggleFullscreen();
void toggleMidiCCRack();

void updatePlayPauseIcons();

Expand Down
49 changes: 49 additions & 0 deletions include/MidiCCRackView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ifndef MIDI_CC_RACK_VIEW_H
#define MIDI_CC_RACK_VIEW_H

#include <QWidget>
#include <QCloseEvent>

#include "SerializingObject.h"
#include "lmms_basics.h"
#include "ComboBox.h"
#include "ComboBoxModel.h"
#include "Knob.h"
#include "TrackContainer.h"
#include "GroupBox.h"

const int MIDI_CC_MAX_CONTROLLERS = 128;

class InstrumentTrack;

class MidiCCRackView : public QWidget, public SerializingObject
{
Q_OBJECT
public:
MidiCCRackView();
virtual ~MidiCCRackView();

void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;

inline QString nodeName() const override
{
return "MidiCCRackView";
}

public slots:
void updateTracksComboBox();
void updateKnobsModels();

private:
ComboBox *m_trackComboBox;
ComboBoxModel *m_trackComboBoxModel;
TrackContainer::TrackList m_tracks; // List with pointers to the ComboBox tracks themselfs

GroupBox *m_midiCCGroupBox; // MIDI CC GroupBox (used to enable disable MIDI CC)

Knob *m_controllerKnob[MIDI_CC_MAX_CONTROLLERS]; // Holds the knob widgets for each controller

};

#endif
2 changes: 2 additions & 0 deletions include/TrackContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class LMMS_EXPORT TrackContainer : public Model, public JournallingObject

signals:
void trackAdded( Track * _track );
void trackRemoved();
void trackRenamed();

protected:
static AutomatedValueMap automatedValuesFromTracks(const TrackList &tracks, MidiTime timeStart, int tcoNum = -1);
Expand Down
1 change: 1 addition & 0 deletions include/TrackContainerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public slots:

signals:
void positionChanged( const MidiTime & _pos );
void movedTrackView();


} ;
Expand Down
5 changes: 5 additions & 0 deletions src/core/TrackContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ void TrackContainer::addTrack( Track * _track )
m_tracksMutex.unlock();
_track->unlock();
emit trackAdded( _track );

connect( _track, SIGNAL( nameChanged() ),
this, SIGNAL( trackRenamed() ) );
}
}

Expand All @@ -207,6 +210,8 @@ void TrackContainer::removeTrack( Track * _track )
{
Engine::getSong()->setModified();
}

emit trackRemoved();
}
}

Expand Down
1 change: 1 addition & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ SET(LMMS_SRCS
gui/widgets/ControlLayout.cpp
gui/widgets/LinkedModelGroupViews.cpp
gui/widgets/MeterDialog.cpp
gui/widgets/MidiCCRackView.cpp
gui/widgets/MidiPortMenu.cpp
gui/widgets/NStateButton.cpp
gui/widgets/Oscilloscope.cpp
Expand Down
5 changes: 5 additions & 0 deletions src/gui/GuiApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "PianoRoll.h"
#include "ProjectNotes.h"
#include "SongEditor.h"
#include "MidiCCRackView.h"

#include <QApplication>
#include <QDir>
Expand Down Expand Up @@ -151,6 +152,10 @@ GuiApplication::GuiApplication()
m_automationEditor = new AutomationEditorWindow;
connect(m_automationEditor, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*)));

displayInitProgress(tr("Preparing MIDI CC rack"));
m_midiCCRackView = new MidiCCRackView;
connect(m_midiCCRackView, SIGNAL(destroyed(QObject*)), this, SLOT(childDestroyed(QObject*)));

splashScreen.finish(m_mainWindow);
m_mainWindow->finalize();

Expand Down
18 changes: 18 additions & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "AutomationEditor.h"
#include "BBEditor.h"
#include "ControllerRackView.h"
#include "MidiCCRackView.h"
#include "embed.h"
#include "Engine.h"
#include "ExportProjectDialog.h"
Expand Down Expand Up @@ -537,13 +538,22 @@ void MainWindow::finalize()
m_toolBar );
project_notes_window->setShortcut( Qt::CTRL + Qt::Key_7 );

ToolButton * midi_cc_rack_window = new ToolButton(
embed::getIconPixmap( "midi_cc_rack" ),
tr( "Show/hide MIDI CC rack") +
" (F12)",
this, SLOT( toggleMidiCCRack() ),
m_toolBar );
midi_cc_rack_window->setShortcut( Qt::CTRL + Qt::Key_8 );

m_toolBarLayout->addWidget( song_editor_window, 1, 1 );
m_toolBarLayout->addWidget( bb_editor_window, 1, 2 );
m_toolBarLayout->addWidget( piano_roll_window, 1, 3 );
m_toolBarLayout->addWidget( automation_editor_window, 1, 4 );
m_toolBarLayout->addWidget( fx_mixer_window, 1, 5 );
m_toolBarLayout->addWidget( controllers_window, 1, 6 );
m_toolBarLayout->addWidget( project_notes_window, 1, 7 );
m_toolBarLayout->addWidget( midi_cc_rack_window, 1, 8 );
m_toolBarLayout->setColumnStretch( 100, 1 );

// setup-dialog opened before?
Expand Down Expand Up @@ -1243,6 +1253,14 @@ void MainWindow::toggleControllerRack()



void MainWindow::toggleMidiCCRack()
{
toggleWindow( gui->getMidiCCRackView() );
}




void MainWindow::updatePlayPauseIcons()
{
gui->songEditor()->setPauseIcon( false );
Expand Down
2 changes: 2 additions & 0 deletions src/gui/TrackContainerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ void TrackContainerView::moveTrackView( TrackView * trackView, int indexTo )
m_trackViews.move( indexFrom, indexTo );

realignTracks();

emit movedTrackView();
}


Expand Down
Loading