Add initial controller support for MIDI CC and various tweaks
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1040 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -47,14 +47,14 @@ class controller : public model, public journallingObject
|
||||
public:
|
||||
enum ControllerTypes
|
||||
{
|
||||
DummyController,
|
||||
DummyController,
|
||||
LfoController,
|
||||
MidiController,
|
||||
/*
|
||||
MidiController,
|
||||
XYController,
|
||||
XYController,
|
||||
PeakController,
|
||||
*/
|
||||
NumControllerTypes
|
||||
NumControllerTypes
|
||||
} ;
|
||||
|
||||
controller( ControllerTypes _type, model * _parent );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* controller_connection.h - declaration of a controller connect, which
|
||||
* controller_connection.h - declaration of a controller connect, which
|
||||
* provides a definition of the link between a controller and
|
||||
* model, also handles deferred creation of links while
|
||||
* loading project
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "mv_base.h"
|
||||
#include "journalling_object.h"
|
||||
|
||||
class controllerConnection;
|
||||
class controllerConnection;
|
||||
|
||||
typedef QVector<controllerConnection *> controllerConnectionVector;
|
||||
|
||||
@@ -51,26 +51,26 @@ public:
|
||||
|
||||
virtual ~controllerConnection();
|
||||
|
||||
inline controller * getController( void )
|
||||
{
|
||||
return m_controller;
|
||||
}
|
||||
inline controller * getController( void )
|
||||
{
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
inline void setController( controller * _controller );
|
||||
inline void setController( controller * _controller );
|
||||
|
||||
inline void setController( int _controllerId );
|
||||
inline void setController( int _controllerId );
|
||||
|
||||
float currentValue( int _offset )
|
||||
{
|
||||
return m_controller->currentValue( _offset );
|
||||
}
|
||||
float currentValue( int _offset )
|
||||
{
|
||||
return m_controller->currentValue( _offset );
|
||||
}
|
||||
|
||||
inline bool isFinalized( void )
|
||||
{
|
||||
return m_controllerId < 0;
|
||||
}
|
||||
inline bool isFinalized( void )
|
||||
{
|
||||
return m_controllerId < 0;
|
||||
}
|
||||
|
||||
static void finalizeConnections( void );
|
||||
static void finalizeConnections( void );
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
@@ -80,9 +80,10 @@ protected:
|
||||
//virtual controllerDialog * createDialog( QWidget * _parent );
|
||||
|
||||
controller * m_controller;
|
||||
int m_controllerId;
|
||||
int m_controllerId;
|
||||
bool m_ownsController;
|
||||
|
||||
static controllerConnectionVector s_connections;
|
||||
static controllerConnectionVector s_connections;
|
||||
|
||||
signals:
|
||||
// The value changed while the mixer isn't running (i.e: MIDI CC)
|
||||
|
||||
@@ -40,7 +40,9 @@ class QListView;
|
||||
class QScrollArea;
|
||||
class groupBox;
|
||||
class lcdSpinBox;
|
||||
class ledCheckBox;
|
||||
class comboBox;
|
||||
class autoDetectMidiController;
|
||||
|
||||
|
||||
|
||||
@@ -59,13 +61,19 @@ public:
|
||||
public slots:
|
||||
// void setSelection( const effectKey & _selection );
|
||||
void selectController( void );
|
||||
|
||||
void midiToggled( void );
|
||||
void userToggled( void );
|
||||
void autoDetectToggled( void );
|
||||
|
||||
void midiValueChanged( void );
|
||||
|
||||
private:
|
||||
// effectKey m_currentSelection;
|
||||
//
|
||||
|
||||
groupBox * m_midiGroupBox;
|
||||
lcdSpinBox * m_midiChannel;
|
||||
lcdSpinBox * m_midiController;
|
||||
lcdSpinBox * m_midiChannelSpinBox;
|
||||
lcdSpinBox * m_midiControllerSpinBox;
|
||||
ledCheckBox * m_midiAutoDetectCheckBox;
|
||||
boolModel m_midiAutoDetect;
|
||||
|
||||
groupBox * m_userGroupBox;
|
||||
comboBox * m_userController;
|
||||
@@ -74,53 +82,8 @@ private:
|
||||
|
||||
controller * m_controller;
|
||||
|
||||
// Temporary midiController
|
||||
autoDetectMidiController * m_midiController;
|
||||
} ;
|
||||
|
||||
|
||||
/*
|
||||
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
|
||||
|
||||
@@ -79,7 +79,8 @@ enum midiMetaEvents
|
||||
} ;
|
||||
|
||||
|
||||
const Sint8 MIDI_CHANNEL_COUNT = 16;
|
||||
const Uint8 MIDI_CHANNEL_COUNT = 16;
|
||||
const Uint8 MIDI_CONTROLLER_COUNT = 128;
|
||||
|
||||
|
||||
struct midiEvent
|
||||
@@ -129,6 +130,7 @@ struct midiEvent
|
||||
union
|
||||
{
|
||||
Uint16 m_param[2]; // first/second parameter (key/velocity)
|
||||
Uint8 m_bytes[4]; // raw bytes
|
||||
Uint32 m_sysExDataLen; // len of m_sysExData
|
||||
} m_data;
|
||||
|
||||
|
||||
97
include/midi_controller.h
Normal file
97
include/midi_controller.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* midi_controller.h - A controller to receive MIDI control-changes
|
||||
*
|
||||
* 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 _MIDI_CONTROLLER_H
|
||||
#define _MIDI_CONTROLLER_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include "mv_base.h"
|
||||
#include "automatable_model.h"
|
||||
#include "controller.h"
|
||||
#include "controller_dialog.h"
|
||||
#include "midi_event_processor.h"
|
||||
|
||||
|
||||
class midiPort;
|
||||
|
||||
|
||||
class midiController : public controller, public midiEventProcessor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
midiController( model * _parent );
|
||||
virtual ~midiController();
|
||||
|
||||
virtual QString publicName() const
|
||||
{
|
||||
return "MIDI Controller";
|
||||
}
|
||||
|
||||
virtual void processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
bool _lock = TRUE );
|
||||
|
||||
virtual void processOutEvent( const midiEvent& _me,
|
||||
const midiTime & _time)
|
||||
{
|
||||
// No output yet
|
||||
}
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
virtual QString nodeName( void ) const;
|
||||
|
||||
virtual intModel * midiChannelModel( void )
|
||||
{
|
||||
return &m_midiChannel;
|
||||
}
|
||||
|
||||
|
||||
virtual intModel * midiControllerModel( void )
|
||||
{
|
||||
return &m_midiController;
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
virtual controllerDialog * createDialog( QWidget * _parent );
|
||||
void updateMidiPort();
|
||||
|
||||
protected:
|
||||
|
||||
// The internal per-controller get-value function
|
||||
virtual float value( int _offset );
|
||||
|
||||
intModel m_midiChannel;
|
||||
intModel m_midiController;
|
||||
|
||||
midiPort * m_midiPort;
|
||||
|
||||
float m_lastValue;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user