Improvements to controllers

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@902 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-04-08 08:23:58 +00:00
parent 40879221cf
commit 78f0a045cc
21 changed files with 1699 additions and 16 deletions

View File

@@ -32,13 +32,18 @@
#include "engine.h"
#include "mixer.h"
#include "mv_base.h"
class controllerDialog;
class controller;
class controller : public QObject
typedef QVector<controller *> controllerVector;
class controller : public model
{
Q_OBJECT
public:
controller( void );
controller( model * _parent );
virtual ~controller();
@@ -54,6 +59,10 @@ public:
m_sampleExact = _exact;
}
virtual QString publicName() const
{
return "Dummy Controller";
}
static int runningFrames();
static float runningTime();
@@ -61,7 +70,8 @@ public:
static void triggerFrameCounter( void );
static void resetFrameCounter( void );
private:
public slots:
virtual controllerDialog * createDialog( QWidget * _parent );
protected:
@@ -72,12 +82,11 @@ protected:
bool m_sampleExact;
static QVector<controller *> s_controllers;
static controllerVector s_controllers;
static unsigned int s_frames;
/*
QString publicName();
slots:
void trigger();
@@ -90,6 +99,7 @@ signals:
// Allow all attached models to unlink
void destroying( void );
friend class controllerDialog;
};
#endif

View File

@@ -0,0 +1,125 @@
/*
* controller_connection_dialog.h -
*
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _CONTROLLER_CONNECTION_DIALOG_H
#define _CONTROLLER_CONNECTION_DIALOG_H
#include <QtGui/QDialog>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStandardItemModel>
#include "controller.h"
#include "automatable_model.h"
class QLineEdit;
class QListView;
class QScrollArea;
class groupBox;
class lcdSpinBox;
class comboBox;
class controllerConnectionDialog : public QDialog
{
Q_OBJECT
public:
controllerConnectionDialog( QWidget * _parent);
virtual ~controllerConnectionDialog();
controller * chosenController( void )
{
return m_controller;
}
public slots:
// void setSelection( const effectKey & _selection );
void selectController( void );
private:
// effectKey m_currentSelection;
//
groupBox * m_midiGroupBox;
lcdSpinBox * m_midiChannel;
lcdSpinBox * m_midiController;
groupBox * m_userGroupBox;
comboBox * m_userController;
QLineEdit * m_mappingFunction;
controller * m_controller;
} ;
/*
class effectListWidget : public QWidget
{
Q_OBJECT
public:
effectListWidget( QWidget * _parent );
virtual ~effectListWidget();
inline effectKey getSelected( void )
{
return( m_currentSelection );
}
signals:
void highlighted( const effectKey & _key );
void addPlugin( const effectKey & _key );
void doubleClicked( const effectKey & _key );
protected:
virtual void resizeEvent( QResizeEvent * );
protected slots:
void rowChanged( const QModelIndex &, const QModelIndex & );
void onAddButtonReleased( void );
void onDoubleClicked( const QModelIndex & );
private:
QVector<plugin::descriptor> m_pluginDescriptors;
effectKeyList m_effectKeys;
effectKey m_currentSelection;
QLineEdit * m_filterEdit;
QListView * m_pluginList;
QStandardItemModel m_sourceModel;
QSortFilterProxyModel m_model;
QScrollArea * m_scrollArea;
QWidget * m_descriptionWidget;
} ;
*/
#endif

View File

@@ -0,0 +1,87 @@
/*
* controller_rack_view.h - view for song's controllers
*
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _CONTROLLER_RACK_VIEW_H
#define _CONTROLLER_RACK_VIEW_H
#include <QtGui/QWidget>
#include "types.h"
#include "mv_base.h"
class QPushButton;
class QScrollArea;
class QVBoxLayout;
class controllerView;
class controllerRackView : public QWidget, public modelView
{
Q_OBJECT
public:
controllerRackView();
virtual ~controllerRackView();
void clear( void );
public slots:
//void moveUp( effectView * _view );
//void moveDown( effectView * _view );
//void deletePlugin( effectView * _view );
private slots:
virtual void update( void );
void addController( void );
private:
/*virtual void modelChanged( void );
inline effectChain * fxChain( void )
{
return( castModel<effectChain>() );
}
inline const effectChain * fxChain( void ) const
{
return( castModel<effectChain>() );
}
*/
QVector<controllerView *> m_controllerViews;
QVBoxLayout * m_mainLayout;
//groupBox * m_effectsGroupBox;
QScrollArea * m_scrollArea;
QPushButton * m_addButton;
Uint32 m_lastY;
} ;
#endif

92
include/controller_view.h Normal file
View File

@@ -0,0 +1,92 @@
/*
* controller_view.h - view-component for an control
*
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _CONTROLLER_VIEW_H
#define _CONTROLLER_VIEW_H
#include <QtGui/QWidget>
#include "automatable_model.h"
#include "controller.h"
#include "mv_base.h"
class QGroupBox;
class QLabel;
class QPushButton;
class QMdiSubWindow;
//class controllerControlDialog;
//class knob;
class ledCheckBox;
//class tempoSyncKnob;
//class track;
class controllerView : public QWidget, public modelView
{
Q_OBJECT
public:
controllerView( controller * _controller, QWidget * _parent );
virtual ~controllerView();
/*
inline effect * getEffect( void )
{
return( castModel<effect>() );
}
inline const effect * getEffect( void ) const
{
return( castModel<effect>() );
}
*/
public slots:
void editControls( void );
//void deletePlugin( void );
//void displayHelp( void );
//void closeEffects( void );
signals:
//void moveUp( effectView * _plugin );
//void moveDown( effectView * _plugin );
//void deletePlugin( effectView * _plugin );
protected:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void modelChanged( void );
private:
QPixmap m_bg;
ledCheckBox * m_bypass;
QMdiSubWindow * m_subWindow;
controllerDialog * m_controllerDlg;
bool m_show;
} ;
#endif

View File

@@ -46,6 +46,7 @@ class projectNotes;
class song;
class songEditor;
class ladspa2LMMS;
class controllerRackView;
class engine
@@ -131,6 +132,11 @@ public:
return( s_dummyTC );
}
static controllerRackView * getControllerRackView( void )
{
return( s_controllerRackView );
}
static float framesPerTact64th( void )
{
return( s_framesPerTact64th );
@@ -154,6 +160,7 @@ private:
static bbTrackContainer * s_bbTrackContainer;
static projectJournal * s_projectJournal;
static dummyTrackContainer * s_dummyTC;
static controllerRackView * s_controllerRackView;
// GUI
static mainWindow * s_mainWindow;

128
include/lfo_controller.h Normal file
View File

@@ -0,0 +1,128 @@
/*
* lfo_controller.h - A LFO-based controller
* controller's settings
*
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _LFO_CONTROLLER_H
#define _LFO_CONTROLLER_H
#include <QtGui/QWidget>
#include "mv_base.h"
#include "automatable_model.h"
#include "controller.h"
#include "controller_dialog.h"
#include "tempo_sync_knob.h"
class automatableButtonGroup;
class knob;
class tempoSyncKnob;
class pixmapButton;
class oscillator;
class lfoController : public controller
{
Q_OBJECT
public:
lfoController( model * _parent );
virtual ~lfoController();
virtual QString publicName() const
{
return "LFO Controller";
}
enum LfoShapes
{
SineWave,
TriangleWave,
SawWave,
SquareWave,
UserDefinedWave,
NumLfoShapes
} ;
public slots:
virtual controllerDialog * createDialog( QWidget * _parent );
protected:
// The internal per-controller get-value function
virtual float value( int _offset );
/*
slots:
void trigger();
*/
floatModel m_lfoAttackModel;
tempoSyncKnobModel m_lfoSpeedModel;
floatModel m_lfoAmountModel;
intModel m_lfoWaveModel;
int m_duration;
int m_phaseCorrection;
friend class lfoControllerDialog;
};
class lfoControllerDialog : public controllerDialog
{
Q_OBJECT
public:
lfoControllerDialog( controller * _controller, QWidget * _parent );
virtual ~lfoControllerDialog();
public slots:
//void editControls( void );
//void deletePlugin( void );
//void displayHelp( void );
//void closeEffects( void );
signals:
protected:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void modelChanged( void );
lfoController * m_lfo;
knob * m_lfoAttackKnob;
tempoSyncKnob * m_lfoSpeedKnob;
knob * m_lfoAmountKnob;
pixmapButton * m_userLfoBtn;
automatableButtonGroup * m_lfoWaveBtnGrp;
} ;
#endif

View File

@@ -0,0 +1,60 @@
/*
* controller_dialog.h - per-controller-specific view for changing a
* controller's settings
*
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _LFO_CONTROLLER_H
#define _LFO_CONTROLLER_H
#include <QtGui/QWidget>
#include "automatable_model.h"
#include "controller.h"
#include "controller_dialog.h"
#include "mv_base.h"
class lfoControllerDialog : public controllerDialog
{
Q_OBJECT
public:
lfoControllerDialog( controller * _controller, QWidget * _parent );
virtual ~lfoControllerDialog();
public slots:
//void editControls( void );
//void deletePlugin( void );
//void displayHelp( void );
//void closeEffects( void );
signals:
protected:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void modelChanged( void );
} ;
#endif

View File

@@ -26,10 +26,13 @@
#ifndef _SONG_H
#define _SONG_H
#include <QtCore/QVector>
#include "track_container.h"
#include "automatable_model.h"
#include "automatable_slider.h"
#include "lcd_spinbox.h"
#include "controller.h"
class pattern;
@@ -165,6 +168,14 @@ public:
return( FALSE );
}
void addController( controller * _c );
// QT will implicitly share the Vector I believe..
controllerVector controllers( void ) const
{
return m_controllers;
}
public slots:
void play( void );
@@ -229,6 +240,8 @@ private:
sliderModel m_masterVolumeModel;
sliderModel m_masterPitchModel;
controllerVector m_controllers;
QString m_fileName;
QString m_oldFileName;
@@ -264,6 +277,7 @@ private:
friend class engine;
friend class songEditor;
friend class controllerRackView;
signals:
void tempoChanged( bpm_t _new_bpm );