Support FX Mixer for sample tracks and add controls to sample track window (#3866)

This work is based on https://github.com/LMMS/lmms/pull/3632 by @grejppi.
This commit is contained in:
Hyunjin Song
2019-03-11 17:06:39 +09:00
committed by GitHub
parent 5eb6b138aa
commit 61c3f87ee6
11 changed files with 614 additions and 85 deletions

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

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

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

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