Merge branch 'master' into instr-sub-plugins

This commit is contained in:
Johannes Lorenz
2019-03-22 10:51:23 +01:00
144 changed files with 8061 additions and 3989 deletions

View File

@@ -34,6 +34,7 @@ class AudioPortAudioSetupUtil : public QObject
{
Q_OBJECT
public slots:
void updateBackends();
void updateDevices();
void updateChannels();
@@ -87,6 +88,7 @@ public:
virtual ~setupWidget();
virtual void saveSettings();
virtual void show();
private:
ComboBox * m_backend;

View File

@@ -283,6 +283,8 @@ protected:
private:
static bool mustQuoteName(const QString &name);
virtual void saveSettings( QDomDocument& doc, QDomElement& element )
{
saveSettings( doc, element, "value" );

View File

@@ -51,6 +51,7 @@ protected slots:
virtual void play() {}
virtual void record() {}
virtual void recordAccompany() {}
virtual void toggleStepRecording() {}
virtual void stop() {}
private slots:
@@ -64,7 +65,7 @@ protected:
///
/// \param record If set true, the editor's toolbar will contain record
/// buttons in addition to the play and stop buttons.
Editor(bool record = false);
Editor(bool record = false, bool record_step = false);
virtual ~Editor();
@@ -73,6 +74,7 @@ protected:
QAction* m_playAction;
QAction* m_recordAction;
QAction* m_recordAccompanyAction;
QAction* m_toggleStepRecordingAction;
QAction* m_stopAction;
};

View File

@@ -0,0 +1,53 @@
/*
* FxLineLcdSpinBox.h - a specialization of LcdSpnBox for setting FX channels
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/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 FX_LINE_LCD_SPIN_BOX_H
#define FX_LINE_LCD_SPIN_BOX_H
#include "LcdSpinBox.h"
class TrackView;
class FxLineLcdSpinBox : public LcdSpinBox
{
Q_OBJECT
public:
FxLineLcdSpinBox(int numDigits, QWidget * parent, const QString& name, TrackView * tv = NULL) :
LcdSpinBox(numDigits, parent, name), m_tv(tv)
{}
virtual ~FxLineLcdSpinBox() {}
void setTrackView(TrackView * tv);
protected:
virtual void mouseDoubleClickEvent(QMouseEvent* event);
virtual void contextMenuEvent(QContextMenuEvent* event);
private:
TrackView * m_tv;
};
#endif

View File

@@ -169,6 +169,7 @@ public slots:
void invert();
void shiftPhase( int _deg );
void clear();
void clearInvisible();
signals:
void lengthChanged();

View File

@@ -64,6 +64,8 @@ public:
// functions that can/should be re-implemented:
// --------------------------------------------------------------------
virtual bool hasNoteInput() const { return true; }
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes its
// output buffer only once per mixer-period

View File

@@ -42,14 +42,7 @@ public:
virtual void play( sampleFrame * _working_buffer )
{
// if the instrument is midi-based, we can safely render right away
if( m_instrument->flags() & Instrument::IsMidiBased )
{
m_instrument->play( _working_buffer );
return;
}
// if not, we need to ensure that all our nph's have been processed first
// ensure that all our nph's have been processed first
ConstNotePlayHandleList nphv = NotePlayHandle::nphsOfInstrumentTrack( m_instrument->instrumentTrack(), true );
bool nphsLeft;

View File

@@ -53,6 +53,7 @@ class InstrumentTrackWindow;
class InstrumentMidiIOView;
class InstrumentMiscView;
class Knob;
class FxLineLcdSpinBox;
class LcdSpinBox;
class LeftRightNav;
class midiPortMenu;
@@ -443,7 +444,7 @@ private:
QLabel * m_pitchLabel;
LcdSpinBox* m_pitchRangeSpinBox;
QLabel * m_pitchRangeLabel;
LcdSpinBox * m_effectChannelNumber;
FxLineLcdSpinBox * m_effectChannelNumber;

View File

@@ -74,6 +74,7 @@ class LMMS_EXPORT Knob : public QWidget, public FloatModelView
public:
Knob( knobTypes _knob_num, QWidget * _parent = NULL, const QString & _name = QString() );
Knob( QWidget * _parent = NULL, const QString & _name = QString() ); //!< default ctor
Knob( const Knob& other ) = delete;
virtual ~Knob();
// TODO: remove

View File

@@ -33,6 +33,10 @@ namespace MixHelpers
bool isSilent( const sampleFrame* src, int frames );
bool useNaNHandler();
void setNaNHandler( bool use );
bool sanitize( sampleFrame * src, int frames );
/*! \brief Add samples from src to dst */

View File

@@ -41,6 +41,10 @@ public:
m_displayName( _display_name ),
m_defaultConstructed( _default_constructed )
{
#if QT_VERSION < 0x050000
connect( this, SIGNAL( dataChanged() ), this,
SLOT( thisDataChanged() ), Qt::DirectConnection );
#endif
}
virtual ~Model()
@@ -85,6 +89,19 @@ signals:
// emitted if properties of the model (e.g. ranges) have changed
void propertiesChanged();
#if QT_VERSION < 0x050000
// emitted along with dataChanged(), but with this model as an argument
// workaround for when QObject::sender() and Qt5 are unavailable
void dataChanged( Model * );
private slots:
void thisDataChanged()
{
emit dataChanged( this );
}
signals:
#endif
} ;

View File

@@ -187,6 +187,7 @@ public slots:
protected slots:
void openInPianoRoll();
void setGhostInPianoRoll();
void resetName();
void changeName();

View File

@@ -38,6 +38,8 @@
#include "lmms_basics.h"
#include "Song.h"
#include "ToolTip.h"
#include "StepRecorder.h"
#include "StepRecorderWidget.h"
class QPainter;
class QPixmap;
@@ -59,7 +61,9 @@ class PianoRoll : public QWidget
Q_PROPERTY( QColor lineColor READ lineColor WRITE setLineColor )
Q_PROPERTY( QColor noteModeColor READ noteModeColor WRITE setNoteModeColor )
Q_PROPERTY( QColor noteColor READ noteColor WRITE setNoteColor )
Q_PROPERTY( QColor ghostNoteColor READ ghostNoteColor WRITE setGhostNoteColor )
Q_PROPERTY( QColor noteTextColor READ noteTextColor WRITE setNoteTextColor )
Q_PROPERTY( QColor ghostNoteTextColor READ ghostNoteTextColor WRITE setGhostNoteTextColor )
Q_PROPERTY( QColor barColor READ barColor WRITE setBarColor )
Q_PROPERTY( QColor selectedNoteColor READ selectedNoteColor WRITE setSelectedNoteColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
@@ -68,6 +72,8 @@ class PianoRoll : public QWidget
Q_PROPERTY( QColor markedSemitoneColor READ markedSemitoneColor WRITE setMarkedSemitoneColor )
Q_PROPERTY( int noteOpacity READ noteOpacity WRITE setNoteOpacity )
Q_PROPERTY( bool noteBorders READ noteBorders WRITE setNoteBorders )
Q_PROPERTY( int ghostNoteOpacity READ ghostNoteOpacity WRITE setGhostNoteOpacity )
Q_PROPERTY( bool ghostNoteBorders READ ghostNoteBorders WRITE setGhostNoteBorders )
Q_PROPERTY( QColor backgroundShade READ backgroundShade WRITE setBackgroundShade )
public:
enum EditModes
@@ -87,6 +93,8 @@ public:
void showPanTextFloat(panning_t pan, const QPoint &pos, int timeout=-1);
void setCurrentPattern( Pattern* newPattern );
void setGhostPattern( Pattern* newPattern );
void loadGhostNotes( const QDomElement & de );
inline void stopRecording()
{
@@ -98,6 +106,11 @@ public:
return m_recording;
}
inline bool isStepRecording() const
{
return m_stepRecorder.isRecording();
}
const Pattern* currentPattern() const
{
return m_pattern;
@@ -141,6 +154,14 @@ public:
void setNoteOpacity( const int i );
bool noteBorders() const;
void setNoteBorders( const bool b );
QColor ghostNoteColor() const;
void setGhostNoteColor( const QColor & c );
QColor ghostNoteTextColor() const;
void setGhostNoteTextColor( const QColor & c );
int ghostNoteOpacity() const;
void setGhostNoteOpacity( const int i );
bool ghostNoteBorders() const;
void setGhostNoteBorders( const bool b );
QColor backgroundShade() const;
void setBackgroundShade( const QColor & c );
@@ -175,6 +196,7 @@ protected slots:
void play();
void record();
void recordAccompany();
bool toggleStepRecording();
void stop();
void startRecordNote( const Note & n );
@@ -192,9 +214,11 @@ protected slots:
void updatePosition(const MidiTime & t );
void updatePositionAccompany(const MidiTime & t );
void updatePositionStepRecording(const MidiTime & t );
void zoomingChanged();
void quantizeChanged();
void noteLengthChanged();
void quantizeNotes();
void updateSemiToneMarkerMenu();
@@ -206,9 +230,12 @@ protected slots:
void selectRegionFromPixels( int xStart, int xEnd );
void clearGhostPattern();
signals:
void currentPatternChanged();
void ghostPatternSet(bool);
void semiToneMarkerMenuScaleSetEnabled(bool);
void semiToneMarkerMenuChordSetEnabled(bool);
@@ -309,6 +336,13 @@ private:
static const QVector<double> m_zoomLevels;
Pattern* m_pattern;
NoteVector m_ghostNotes;
inline const NoteVector & ghostNotes() const
{
return m_ghostNotes;
}
QScrollBar * m_leftRightScroll;
QScrollBar * m_topBottomScroll;
@@ -381,6 +415,9 @@ private:
friend class PianoRollWindow;
StepRecorderWidget m_stepRecorderWidget;
StepRecorder m_stepRecorder;
// qproperty fields
QColor m_barLineColor;
QColor m_beatLineColor;
@@ -388,6 +425,8 @@ private:
QColor m_noteModeColor;
QColor m_noteColor;
QColor m_noteTextColor;
QColor m_ghostNoteColor;
QColor m_ghostNoteTextColor;
QColor m_barColor;
QColor m_selectedNoteColor;
QColor m_textColor;
@@ -395,7 +434,9 @@ private:
QColor m_textShadow;
QColor m_markedSemitoneColor;
int m_noteOpacity;
int m_ghostNoteOpacity;
bool m_noteBorders;
bool m_ghostNoteBorders;
QColor m_backgroundShade;
signals:
@@ -412,7 +453,8 @@ public:
PianoRollWindow();
const Pattern* currentPattern() const;
void setCurrentPattern(Pattern* pattern);
void setCurrentPattern( Pattern* pattern );
void setGhostPattern( Pattern* pattern );
int quantization() const;
@@ -420,6 +462,7 @@ public:
void stop();
void record();
void recordAccompany();
void toggleStepRecording();
void stopRecording();
bool isRecording() const;
@@ -444,10 +487,14 @@ signals:
private slots:
void patternRenamed();
void updateAfterPatternChange();
void ghostPatternSet( bool state );
private:
void patternRenamed();
void focusInEvent(QFocusEvent * event);
void stopStepRecording();
void updateStepRecordingIcon();
PianoRoll* m_editor;
@@ -456,6 +503,7 @@ private:
ComboBox * m_noteLenComboBox;
ComboBox * m_scaleComboBox;
ComboBox * m_chordComboBox;
QPushButton * m_clearGhostButton;
};

View File

@@ -77,6 +77,7 @@ public:
}
static jo_id_t idToSave( jo_id_t id );
static jo_id_t idFromSave( jo_id_t id );
void clearJournal();
void stopAllJournalling();

View File

@@ -754,9 +754,15 @@ public:
ProcessWatcher( RemotePlugin * );
virtual ~ProcessWatcher() = default;
void quit()
void stop()
{
m_quit = true;
quit();
}
void reset()
{
m_quit = false;
}
private:
@@ -862,6 +868,9 @@ private:
QProcess m_process;
ProcessWatcher m_watcher;
QString m_exec;
QStringList m_args;
QMutex m_commMutex;
bool m_splitChannels;
#ifdef USE_QT_SHMEM

View File

@@ -26,13 +26,19 @@
#define SAMPLE_TRACK_H
#include <QDialog>
#include <QLayout>
#include "AudioPort.h"
#include "FxMixer.h"
#include "FxLineLcdSpinBox.h"
#include "Track.h"
class EffectRackView;
class Knob;
class SampleBuffer;
class SampleTrackWindow;
class TrackLabelButton;
class QLineEdit;
class SampleTCO : public TrackContentObject
@@ -140,6 +146,11 @@ public:
QDomElement & _parent );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
inline IntModel * effectChannelModel()
{
return &m_effectChannelModel;
}
inline AudioPort * audioPort()
{
return &m_audioPort;
@@ -153,15 +164,18 @@ public:
public slots:
void updateTcos();
void setPlayingTcos( bool isPlaying );
void updateEffectChannel();
private:
FloatModel m_volumeModel;
FloatModel m_panningModel;
IntModel m_effectChannelModel;
AudioPort m_audioPort;
friend class SampleTrackView;
friend class SampleTrackWindow;
} ;
@@ -174,6 +188,24 @@ public:
SampleTrackView( SampleTrack* Track, TrackContainerView* tcv );
virtual ~SampleTrackView();
SampleTrackWindow * getSampleTrackWindow()
{
return m_window;
}
SampleTrack * model()
{
return castModel<SampleTrack>();
}
const SampleTrack * model() const
{
return castModel<SampleTrack>();
}
virtual QMenu * createFxMenu( QString title, QString newFxLabel );
public slots:
void showEffects();
@@ -187,12 +219,77 @@ protected:
}
private slots:
void assignFxLine( int channelIndex );
void createFxLine();
private:
EffectRackView * m_effectRack;
QWidget * m_effWindow;
SampleTrackWindow * m_window;
Knob * m_volumeKnob;
Knob * m_panningKnob;
TrackLabelButton * m_tlb;
friend class SampleTrackWindow;
} ;
class SampleTrackWindow : public QWidget, public ModelView, public SerializingObjectHook
{
Q_OBJECT
public:
SampleTrackWindow(SampleTrackView * tv);
virtual ~SampleTrackWindow();
SampleTrack * model()
{
return castModel<SampleTrack>();
}
const SampleTrack * model() const
{
return castModel<SampleTrack>();
}
void setSampleTrackView(SampleTrackView * tv);
SampleTrackView *sampleTrackView()
{
return m_stv;
}
public slots:
void textChanged(const QString & new_name);
void toggleVisibility(bool on);
void updateName();
protected:
// capture close-events for toggling sample-track-button
virtual void closeEvent(QCloseEvent * ce);
virtual void saveSettings(QDomDocument & doc, QDomElement & element);
virtual void loadSettings(const QDomElement & element);
private:
virtual void modelChanged();
SampleTrack * m_track;
SampleTrackView * m_stv;
// widgets on the top of an sample-track-window
QLineEdit * m_nameLineEdit;
Knob * m_volumeKnob;
Knob * m_panningKnob;
FxLineLcdSpinBox * m_effectChannelNumber;
EffectRackView * m_effectRack;
} ;

View File

@@ -138,6 +138,7 @@ private:
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
bool m_NaNHandler;
bool m_hqAudioDev;
QString m_lang;
QStringList m_languages;

View File

@@ -103,8 +103,6 @@ public:
} ;
void processNextBuffer();
inline int getLoadingTrackCount() const
@@ -203,9 +201,23 @@ public:
{
return m_recording;
}
inline void setLoopRenderCount(int count)
{
if (count < 1)
m_loopRenderCount = 1;
else
m_loopRenderCount = count;
m_loopRenderRemaining = m_loopRenderCount;
}
inline int getLoopRenderCount() const
{
return m_loopRenderCount;
}
bool isExportDone() const;
std::pair<MidiTime, MidiTime> getExportEndpoints() const;
int getExportProgress() const;
inline void setRenderBetweenMarkers( bool renderBetweenMarkers )
{
@@ -424,7 +436,14 @@ private:
tact_t m_elapsedTacts;
VstSyncController m_vstSyncController;
int m_loopRenderCount;
int m_loopRenderRemaining;
MidiTime m_exportSongBegin;
MidiTime m_exportLoopBegin;
MidiTime m_exportLoopEnd;
MidiTime m_exportSongEnd;
MidiTime m_exportEffectiveLength;
friend class LmmsCore;
friend class SongEditor;

View File

@@ -159,6 +159,7 @@ public:
protected:
virtual void resizeEvent( QResizeEvent * event );
virtual void changeEvent( QEvent * );
protected slots:
void play();

143
include/StepRecorder.h Normal file
View File

@@ -0,0 +1,143 @@
/*
* 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 STEP_RECORDER_H
#define STEP_RECORDER_H
#include <QTime>
#include <QTimer>
#include <QObject>
#include <QKeyEvent>
#include "Note.h"
#include "lmms_basics.h"
#include "Pattern.h"
class PianoRoll;
class StepRecorderWidget;
class StepRecorder : public QObject
{
Q_OBJECT
public:
StepRecorder(PianoRoll& pianoRoll, StepRecorderWidget& stepRecorderWidget);
void initialize();
void start(const MidiTime& currentPosition,const MidiTime& stepLength);
void stop();
void notePressed(const Note & n);
void noteReleased(const Note & n);
bool keyPressEvent(QKeyEvent* ke);
bool mousePressEvent(QMouseEvent* ke);
void setCurrentPattern(Pattern* newPattern);
void setStepsLength(const MidiTime& newLength);
QVector<Note*> getCurStepNotes();
bool isRecording() const
{
return m_isRecording;
}
QColor curStepNoteColor() const
{
return QColor(245,3,139); // radiant pink
}
private slots:
void removeNotesReleasedForTooLong();
private:
void stepForwards();
void stepBackwards();
void applyStep();
void dismissStep();
void prepareNewStep();
MidiTime getCurStepEndPos();
void updateCurStepNotes();
void updateWidget();
bool allCurStepNotesReleased();
PianoRoll& m_pianoRoll;
StepRecorderWidget& m_stepRecorderWidget;
bool m_isRecording = false;
MidiTime m_curStepStartPos = 0;
MidiTime m_curStepEndPos = 0;
MidiTime m_stepsLength;
MidiTime m_curStepLength; // current step length refers to the step currently recorded. it may defer from m_stepsLength
// since the user can make current step larger
QTimer m_updateReleasedTimer;
Pattern* m_pattern;
class StepNote
{
public:
StepNote(const Note & note) : m_note(note), m_pressed(true) {};
void setPressed()
{
m_pressed = true;
}
void setReleased()
{
m_pressed = false;
releasedTimer.start();
}
int timeSinceReleased()
{
return releasedTimer.elapsed();
}
bool isPressed() const
{
return m_pressed;
}
bool isReleased() const
{
return !m_pressed;
}
Note m_note;
private:
bool m_pressed;
QTime releasedTimer;
} ;
QVector<StepNote*> m_curStepNotes; // contains the current recorded step notes (i.e. while user still press the notes; before they are applied to the pattern)
StepNote* findCurStepNote(const int key);
bool m_isStepInProgress = false;
};
#endif //STEP_RECORDER_H

View File

@@ -0,0 +1,92 @@
/*
* StepRecorderWidget.h - widget that provide gui markers for step recording
*
* 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 STEP_RECOREDER_WIDGET_H
#define STEP_RECOREDER_WIDGET_H
#include "lmms_basics.h"
#include "Note.h"
#include <QWidget>
#include <QColor>
#include <QPainter>
class StepRecorderWidget : public QWidget
{
Q_OBJECT
public:
StepRecorderWidget(
QWidget * parent,
const int ppt,
const int marginTop,
const int marginBottom,
const int marginLeft,
const int marginRight);
//API used by PianoRoll
void setPixelsPerTact(int ppt);
void setCurrentPosition(MidiTime currentPosition);
void setBottomMargin(const int marginBottom);
//API used by StepRecorder
void setStepsLength(MidiTime stepsLength);
void setStartPosition(MidiTime pos);
void setEndPosition(MidiTime pos);
void showHint();
private:
virtual void paintEvent(QPaintEvent * pe);
int xCoordOfTick(int tick);
void drawVerLine(QPainter* painter, int x, const QColor& color, int top, int bottom);
void drawVerLine(QPainter* painter, const MidiTime& pos, const QColor& color, int top, int bottom);
void updateBoundaries();
MidiTime m_stepsLength;
MidiTime m_curStepStartPos;
MidiTime m_curStepEndPos;
int m_ppt; // pixels per tact
MidiTime m_currentPosition; // current position showed by on PianoRoll
QColor m_colorLineStart;
QColor m_colorLineEnd;
// boundaries within piano roll window
int m_top;
int m_bottom;
int m_left;
int m_right;
const int m_marginTop;
int m_marginBottom; // not const since can change on resize of edit-note area
const int m_marginLeft;
const int m_marginRight;
signals:
void positionChanged(const MidiTime & t);
} ;
#endif //STEP_RECOREDER_WIDGET_H

View File

@@ -92,7 +92,6 @@ private:
bool m_hasFocus;
static void elideText( QLabel *label, QString text );
bool isMaximized();
void adjustTitleBar();
private slots:

View File

@@ -675,6 +675,10 @@ public:
virtual void update();
// Create a menu for assigning/creating channels for this track
// Currently instrument track and sample track supports it
virtual QMenu * createFxMenu(QString title, QString newFxLabel);
public slots:
virtual bool close();

View File

@@ -39,7 +39,7 @@ public:
VstSyncController();
~VstSyncController();
void setAbsolutePosition( int ticks );
void setAbsolutePosition( double ticks );
void setPlaybackState( bool enabled )
{

View File

@@ -42,7 +42,7 @@
struct VstSyncData
{
bool isPlaying;
float ppqPos;
double ppqPos;
int timeSigNumer;
int timeSigDenom;
bool isCycle;