inital M/V-hacks, improve project-unloading speed, fix wrong signal-slot-connection which made gate-parameter of effects not working

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms-mv@634 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-01-02 22:19:58 +00:00
parent 90f10112c0
commit ce128add00
79 changed files with 2284 additions and 2011 deletions

View File

@@ -31,6 +31,7 @@
#include "journalling_object.h"
#include "types.h"
#include "automatable_model.h"
class QLabel;
@@ -44,6 +45,7 @@ class groupBox;
class knob;
class notePlayHandle;
class tempoSyncKnob;
class comboBoxModel;
const int MAX_CHORD_POLYPHONY = 10;
@@ -101,20 +103,32 @@ private:
// chord-stuff
groupBox * m_chordsGroupBox;
boolModel * m_chordsEnabledModel;
comboBox * m_chordsComboBox;
comboBoxModel * m_chordsModel;
knob * m_chordRangeKnob;
floatModel * m_chordRangeModel;
// arpeggio-stuff
groupBox * m_arpGroupBox;
boolModel * m_arpEnabledModel;
comboBox * m_arpComboBox;
comboBoxModel * m_arpModel;
knob * m_arpRangeKnob;
floatModel * m_arpRangeModel;
tempoSyncKnob * m_arpTimeKnob;
floatModel * m_arpTimeModel;
knob * m_arpGateKnob;
floatModel * m_arpGateModel;
QLabel * m_arpDirectionLbl;
automatableButtonGroup * m_arpDirectionBtnGrp;
intModel * m_arpDirectionModel;
comboBox * m_arpModeComboBox;
comboBoxModel * m_arpModeModel;
friend class flpImport;

View File

@@ -28,37 +28,33 @@
#include <QtGui/QPushButton>
#include "automatable_object.h"
#include "automatable_model.h"
class automatableButtonGroup;
class automatableButton : public QPushButton, public automatableObject<bool,
signed char>
class automatableButton : public QPushButton, public boolModelView
{
Q_OBJECT
public:
automatableButton( QWidget * _parent, const QString & _name,
track * _track );
automatableButton( QWidget * _parent, const QString & _name );
virtual ~automatableButton();
virtual void setValue( const bool _on );
inline void setCheckable( bool _on )
{
QPushButton::setCheckable( _on );
setJournalling( _on );
model()->setJournalling( _on );
}
public slots:
virtual void update( void );
virtual void toggle( void );
virtual void setChecked( bool _on )
{
// QPushButton::setChecked is called in setValue()
setValue( _on );
// QPushButton::setChecked is called in update-slot
model()->setValue( _on );
}
@@ -74,16 +70,17 @@ private:
friend class automatableButtonGroup;
using QPushButton::setChecked;
using QPushButton::isChecked;
} ;
class automatableButtonGroup : public QWidget, public automatableObject<int>
class automatableButtonGroup : public QWidget, public intModelView
{
Q_OBJECT
public:
automatableButtonGroup( QWidget * _parent, const QString & _name,
track * _track );
automatableButtonGroup( QWidget * _parent, const QString & _name );
virtual ~automatableButtonGroup();
void addButton( automatableButton * _btn );
@@ -91,16 +88,16 @@ public:
void activateButton( automatableButton * _btn );
virtual void setValue( const int _value );
virtual void modelChanged( void );
private slots:
void updateButtons( void );
private:
QList<automatableButton *> m_buttons;
signals:
void valueChanged( int );
} ;

View File

@@ -1,7 +1,7 @@
/*
* automatable_object.h - declaration of class automatableObject
* automatable_model.h - declaration of class automatableModel
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -23,13 +23,14 @@
*/
#ifndef _AUTOMATABLE_OBJECT_H
#define _AUTOMATABLE_OBJECT_H
#ifndef _AUTOMATABLE_MODEL_H
#define _AUTOMATABLE_MODEL_H
#include <math.h>
#include "journalling_object.h"
#include "level_object.h"
#include "mv_base.h"
#include <QtCore/QPointer>
@@ -38,18 +39,47 @@
class automationPattern;
class track;
// simple way to map a property of a view to a model
#define mapPropertyFromModelPtr(type,getfunc,setfunc,modelname) \
public: \
inline type getfunc( void ) const \
{ \
return( modelname->value() ); \
} \
public slots: \
inline void setfunc( const type _val ) \
{ \
modelname->setValue( _val ); \
}
#define mapPropertyFromModel(type,getfunc,setfunc,modelname) \
public: \
inline type getfunc( void ) const \
{ \
return( modelname.value() ); \
} \
public slots: \
inline void setfunc( const type _val ) \
{ \
modelname.setValue( _val ); \
}
template<typename T, typename EDIT_STEP_TYPE = T>
class automatableObject : public journallingObject, public levelObject
class automatableModel : public model, public journallingObject,
public levelObject
{
public:
typedef automatableObject<T, EDIT_STEP_TYPE> autoObj;
typedef automatableModel<T, EDIT_STEP_TYPE> autoModel;
automatableObject( track * _track = NULL, const T _val = 0,
const T _min = 0, const T _max = 0,
const T _step = defaultRelStep() );
automatableModel( const T _val = 0,
const T _min = 0,
const T _max = 0,
const T _step = defaultRelStep(),
::model * _parent = NULL,
bool _default_constructed = FALSE );
virtual ~automatableObject();
virtual ~automatableModel();
static inline T minRelStep( void )
{
@@ -72,6 +102,11 @@ public:
return( m_value );
}
inline virtual T initValue( void ) const
{
return( m_initValue );
}
inline virtual T minValue( void ) const
{
return( m_minValue );
@@ -94,14 +129,14 @@ public:
inline T fittedValue( T _value ) const;
T value( int _level ) const
inline T value( int _level ) const
{
return( fittedValue( _level * m_step ) );
}
virtual void setInitValue( const T _value );
inline virtual void setValue( const T _value );
virtual void setValue( const T _value );
inline virtual void incValue( int _steps )
{
@@ -111,11 +146,11 @@ public:
virtual void setRange( const T _min, const T _max,
const T _step = defaultRelStep() );
inline virtual void setStep( const T _step );
virtual void setStep( const T _step );
static void linkObjects( autoObj * _object1, autoObj * _object2 );
static void linkModels( autoModel * _model1, autoModel * _model2 );
static void unlinkObjects( autoObj * _object1, autoObj * _object2 );
static void unlinkModels( autoModel * _model1, autoModel * _model2 );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this,
@@ -126,11 +161,16 @@ public:
virtual QString nodeName( void ) const
{
return( "automatableobject" );
return( "automatablemodel" );
}
inline automationPattern * getAutomationPattern( void );
inline void setTrack( track * _track )
{
m_track = _track;
}
inline bool nullTrack( void )
{
return( m_track == NULL );
@@ -138,43 +178,44 @@ public:
void initAutomationPattern( void )
{
m_automation_pattern = new automationPattern( NULL, this );
m_automationPattern = new automationPattern( NULL, this );
}
void prepareJournalEntryFromOldVal( void );
void addJournalEntryFromOldToCurVal( void );
protected:
virtual void redoStep( journalEntry & _je );
virtual void undoStep( journalEntry & _je );
void prepareJournalEntryFromOldVal( void );
void addJournalEntryFromOldToCurVal( void );
inline void setFirstValue( void );
private:
T m_value;
T m_initValue;
T m_minValue;
T m_maxValue;
T m_step;
int m_curLevel;
QPointer<automationPattern> m_automation_pattern;
QPointer<automationPattern> m_automationPattern;
track * m_track;
// most objects will need this temporarily
T m_oldValue;
bool m_journalEntryReady;
typedef QVector<autoObj *> autoObjVector;
autoObjVector m_linkedObjects;
typedef QVector<autoModel *> autoModelVector;
autoModelVector m_linkedModels;
inline void linkObject( autoObj * _object );
inline void linkModel( autoModel * _model );
inline void unlinkObject( autoObj * _object );
inline void unlinkModel( autoModel * _model );
static inline T attributeValue( QString _value );
inline static T attributeValue( QString _value );
inline void syncAutomationPattern( void );
@@ -199,6 +240,57 @@ private:
template<typename T, typename EDIT_STEP_TYPE = T>
class automatableModelView : public modelView
{
public:
typedef automatableModel<T, EDIT_STEP_TYPE> autoModel;
typedef automatableModelView<T, EDIT_STEP_TYPE> autoModelView;
automatableModelView( void ) : modelView()
{
}
// some basic functions for convenience
autoModel * model( void )
{
return( castModel<autoModel>() );
}
const autoModel * model( void ) const
{
return( castModel<autoModel>() );
}
inline virtual T value( void ) const
{
return( model() ? model()->value() : 0 );
}
inline virtual void setValue( const T _value )
{
if( model() )
{
model()->setValue( _value );
}
}
} ;
//#include "automatable_model_templates.h"
#define generateModelPrimitive(type,type2) \
typedef automatableModel<type,type2> type##Model; \
typedef automatableModelView<type,type2> type##ModelView; \
// some model-primitives
generateModelPrimitive(bool,signed char);
generateModelPrimitive(float,float);
generateModelPrimitive(int,int);
#endif

View File

@@ -1,7 +1,7 @@
/*
* automatable_object_templates.h - definition of automatableObject templates
* automatable_model_templates.h - definition of automatableModel templates
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -23,12 +23,12 @@
*/
#ifndef _AUTOMATABLE_OBJECT_TEMPLATES_H
#define _AUTOMATABLE_OBJECT_TEMPLATES_H
#ifndef _AUTOMATABLE_MODEL_TEMPLATES_H
#define _AUTOMATABLE_MODEL_TEMPLATES_H
#include <QtXml/QDomElement>
#include "automatable_object.h"
#include "automatable_model.h"
#include "automation_editor.h"
#include "automation_pattern.h"
#include "engine.h"
@@ -37,15 +37,21 @@
template<typename T, typename EDIT_STEP_TYPE>
automatableObject<T, EDIT_STEP_TYPE>::automatableObject( track * _track,
const T _val, const T _min,
const T _max, const T _step ) :
automatableModel<T, EDIT_STEP_TYPE>::automatableModel(
const T _val,
const T _min,
const T _max,
const T _step,
::model * _parent,
bool _default_constructed ) :
model( _parent, _default_constructed ),
m_value( _val ),
m_initValue( _val ),
m_minValue( _min ),
m_maxValue( _max ),
m_step( _step ),
m_automation_pattern( NULL ),
m_track( _track ),
m_automationPattern( NULL ),
m_track( NULL ),
m_journalEntryReady( FALSE )
{
m_curLevel = level( _val );
@@ -57,13 +63,13 @@ automatableObject<T, EDIT_STEP_TYPE>::automatableObject( track * _track,
template<typename T, typename EDIT_STEP_TYPE>
automatableObject<T, EDIT_STEP_TYPE>::~automatableObject()
automatableModel<T, EDIT_STEP_TYPE>::~automatableModel()
{
delete m_automation_pattern;
while( m_linkedObjects.empty() == FALSE )
delete m_automationPattern;
while( m_linkedModels.empty() == FALSE )
{
m_linkedObjects.last()->unlinkObject( this );
m_linkedObjects.erase( m_linkedObjects.end() - 1 );
m_linkedModels.last()->unlinkModel( this );
m_linkedModels.erase( m_linkedModels.end() - 1 );
}
}
@@ -71,7 +77,7 @@ automatableObject<T, EDIT_STEP_TYPE>::~automatableObject()
template<typename T, typename EDIT_STEP_TYPE>
T automatableObject<T, EDIT_STEP_TYPE>::fittedValue( T _value ) const
T automatableModel<T, EDIT_STEP_TYPE>::fittedValue( T _value ) const
{
_value = tLimit<T>( _value, minValue(), maxValue() );
@@ -104,11 +110,12 @@ T automatableObject<T, EDIT_STEP_TYPE>::fittedValue( T _value ) const
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setInitValue( const T _value )
void automatableModel<T, EDIT_STEP_TYPE>::setInitValue( const T _value )
{
m_initValue = _value;
bool journalling = testAndSetJournalling( FALSE );
setValue( _value );
if( m_automation_pattern )
if( m_automationPattern )
{
setFirstValue();
}
@@ -119,7 +126,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::setInitValue( const T _value )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
void automatableModel<T, EDIT_STEP_TYPE>::setValue( const T _value )
{
const T old_val = m_value;
@@ -133,15 +140,15 @@ void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
static_cast<EDIT_STEP_TYPE>( m_value ) -
static_cast<EDIT_STEP_TYPE>( old_val ) ) );
// notify linked objects
// notify linked models
// doesn't work because of implicit typename T
// for( autoObjVector::iterator it =
// m_linkedObjects.begin();
// it != m_linkedObjects.end(); ++it )
for( int i = 0; i < m_linkedObjects.size(); ++i )
// for( autoModelVector::iterator it =
// m_linkedModels.begin();
// it != m_linkedModels.end(); ++it )
for( int i = 0; i < m_linkedModels.size(); ++i )
{
autoObj * it = m_linkedObjects[i];
autoModel * it = m_linkedModels[i];
if( value() != it->value() && it->fittedValue( value() )
!= it->value() )
{
@@ -151,6 +158,8 @@ void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
it->setJournalling( journalling );
}
}
setFirstValue();
emit dataChanged();
}
}
@@ -158,25 +167,30 @@ void automatableObject<T, EDIT_STEP_TYPE>::setValue( const T _value )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setRange( const T _min, const T _max,
void automatableModel<T, EDIT_STEP_TYPE>::setRange( const T _min, const T _max,
const T _step )
{
m_minValue = _min;
m_maxValue = _max;
if( m_minValue > m_maxValue )
if( ( m_maxValue != _max ) || ( m_minValue != _min ) )
{
qSwap<T>( m_minValue, m_maxValue );
m_minValue = _min;
m_maxValue = _max;
if( m_minValue > m_maxValue )
{
qSwap<T>( m_minValue, m_maxValue );
}
setStep( _step );
// re-adjust value
autoModel::setInitValue( value() );
emit propertiesChanged();
}
setStep( _step );
// re-adjust value
autoObj::setInitValue( value() );
}
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setStep( const T _step )
void automatableModel<T, EDIT_STEP_TYPE>::setStep( const T _step )
{
/*
const T intv = maxValue() - minValue();
@@ -201,26 +215,32 @@ void automatableObject<T, EDIT_STEP_TYPE>::setStep( const T _step )
m_step = minRelStep() * intv;
}
}*/
m_step = _step;
m_curLevel = level( m_value );
m_minLevel = level( m_minValue );
m_maxLevel = level( m_maxValue );
if( m_step != _step )
{
m_step = _step;
m_curLevel = level( m_value );
m_minLevel = level( m_minValue );
m_maxLevel = level( m_maxValue );
emit propertiesChanged();
}
}
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::linkObjects( autoObj * _object1,
autoObj * _object2 )
{
_object1->linkObject( _object2 );
_object2->linkObject( _object1 );
if( _object1->m_automation_pattern != _object2->m_automation_pattern )
template<typename T, typename EDIT_STEP_TYPE>
void automatableModel<T, EDIT_STEP_TYPE>::linkModels( autoModel * _model1,
autoModel * _model2 )
{
_model1->linkModel( _model2 );
_model2->linkModel( _model1 );
if( _model1->m_automationPattern != _model2->m_automationPattern )
{
delete _object2->m_automation_pattern;
_object2->m_automation_pattern = _object1->m_automation_pattern;
delete _model2->m_automationPattern;
_model2->m_automationPattern = _model1->m_automationPattern;
}
}
@@ -228,17 +248,17 @@ void automatableObject<T, EDIT_STEP_TYPE>::linkObjects( autoObj * _object1,
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::unlinkObjects( autoObj * _object1,
autoObj * _object2 )
void automatableModel<T, EDIT_STEP_TYPE>::unlinkModels( autoModel * _model1,
autoModel * _model2 )
{
_object1->unlinkObject( _object2 );
_object2->unlinkObject( _object1 );
_model1->unlinkModel( _model2 );
_model2->unlinkModel( _model1 );
if( _object1->m_automation_pattern && _object1->m_automation_pattern
== _object2->m_automation_pattern )
if( _model1->m_automationPattern && _model1->m_automationPattern
== _model2->m_automationPattern )
{
_object2->m_automation_pattern = new automationPattern(
*_object1->m_automation_pattern, _object2 );
_model2->m_automationPattern = new automationPattern(
*_model1->m_automationPattern, _model2 );
}
}
@@ -246,11 +266,11 @@ void automatableObject<T, EDIT_STEP_TYPE>::unlinkObjects( autoObj * _object1,
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
void automatableModel<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
QDomElement & _this,
const QString & _name )
{
if( m_automation_pattern && m_automation_pattern->getTimeMap().size()
if( m_automationPattern && m_automationPattern->getTimeMap().size()
> 1 )
{
QDomElement pattern_element;
@@ -267,7 +287,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
_this.appendChild( pattern_element );
}
QDomElement element = _doc.createElement( _name );
m_automation_pattern->saveSettings( _doc, element );
m_automationPattern->saveSettings( _doc, element );
pattern_element.appendChild( element );
}
else
@@ -280,7 +300,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::saveSettings( QDomDocument & _doc,
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::loadSettings(
void automatableModel<T, EDIT_STEP_TYPE>::loadSettings(
const QDomElement & _this,
const QString & _name )
{
@@ -290,8 +310,8 @@ void automatableObject<T, EDIT_STEP_TYPE>::loadSettings(
node = node.namedItem( _name );
if( node.isElement() )
{
m_automation_pattern->loadSettings( node.toElement() );
setLevel( m_automation_pattern->valueAt( 0 ) );
m_automationPattern->loadSettings( node.toElement() );
setLevel( m_automationPattern->valueAt( 0 ) );
return;
}
}
@@ -303,22 +323,22 @@ void automatableObject<T, EDIT_STEP_TYPE>::loadSettings(
template<typename T, typename EDIT_STEP_TYPE>
automationPattern * automatableObject<T, EDIT_STEP_TYPE>::getAutomationPattern(
automationPattern * automatableModel<T, EDIT_STEP_TYPE>::getAutomationPattern(
void )
{
if( !m_automation_pattern )
if( !m_automationPattern )
{
m_automation_pattern = new automationPattern( m_track, this );
m_automationPattern = new automationPattern( m_track, this );
syncAutomationPattern();
}
return( m_automation_pattern );
return( m_automationPattern );
}
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::redoStep( journalEntry & _je )
void automatableModel<T, EDIT_STEP_TYPE>::redoStep( journalEntry & _je )
{
bool journalling = testAndSetJournalling( FALSE );
setValue( static_cast<T>( value() + static_cast<EDIT_STEP_TYPE>(
@@ -330,7 +350,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::redoStep( journalEntry & _je )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::undoStep( journalEntry & _je )
void automatableModel<T, EDIT_STEP_TYPE>::undoStep( journalEntry & _je )
{
journalEntry je( _je.actionID(),
static_cast<EDIT_STEP_TYPE>( -_je.data().toDouble() ) );
@@ -341,7 +361,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::undoStep( journalEntry & _je )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::prepareJournalEntryFromOldVal( void )
void automatableModel<T, EDIT_STEP_TYPE>::prepareJournalEntryFromOldVal( void )
{
m_oldValue = value();
saveJournallingState( FALSE );
@@ -352,7 +372,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::prepareJournalEntryFromOldVal( void )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::addJournalEntryFromOldToCurVal(
void automatableModel<T, EDIT_STEP_TYPE>::addJournalEntryFromOldToCurVal(
void )
{
if( m_journalEntryReady )
@@ -371,14 +391,14 @@ void automatableObject<T, EDIT_STEP_TYPE>::addJournalEntryFromOldToCurVal(
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setFirstValue( void )
void automatableModel<T, EDIT_STEP_TYPE>::setFirstValue( void )
{
if( m_automation_pattern && m_automation_pattern->updateFirst() )
if( m_automationPattern && m_automationPattern->updateFirst() )
{
m_automation_pattern->putValue( 0, m_curLevel, FALSE );
m_automationPattern->putValue( 0, m_curLevel, FALSE );
if( engine::getAutomationEditor() &&
engine::getAutomationEditor()->currentPattern()
== m_automation_pattern )
== m_automationPattern )
{
engine::getAutomationEditor()->update();
}
@@ -389,12 +409,12 @@ void automatableObject<T, EDIT_STEP_TYPE>::setFirstValue( void )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::linkObject( autoObj * _object )
void automatableModel<T, EDIT_STEP_TYPE>::linkModel( autoModel * _model )
{
if( qFind( m_linkedObjects.begin(), m_linkedObjects.end(), _object )
== m_linkedObjects.end() )
if( qFind( m_linkedModels.begin(), m_linkedModels.end(), _model )
== m_linkedModels.end() )
{
m_linkedObjects.push_back( _object );
m_linkedModels.push_back( _model );
}
}
@@ -402,14 +422,14 @@ void automatableObject<T, EDIT_STEP_TYPE>::linkObject( autoObj * _object )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::unlinkObject( autoObj * _object )
void automatableModel<T, EDIT_STEP_TYPE>::unlinkModel( autoModel * _model )
{
if( qFind( m_linkedObjects.begin(), m_linkedObjects.end(), _object )
!= m_linkedObjects.end() )
if( qFind( m_linkedModels.begin(), m_linkedModels.end(), _model )
!= m_linkedModels.end() )
{
m_linkedObjects.erase( qFind( m_linkedObjects.begin(),
m_linkedObjects.end(),
_object ) );
m_linkedModels.erase( qFind( m_linkedModels.begin(),
m_linkedModels.end(),
_model ) );
}
}
@@ -417,14 +437,14 @@ void automatableObject<T, EDIT_STEP_TYPE>::unlinkObject( autoObj * _object )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::syncAutomationPattern( void )
void automatableModel<T, EDIT_STEP_TYPE>::syncAutomationPattern( void )
{
for( int i = 0; i < m_linkedObjects.size(); ++i )
for( int i = 0; i < m_linkedModels.size(); ++i )
{
autoObj * it = m_linkedObjects[i];
if( m_automation_pattern != it->m_automation_pattern )
autoModel * it = m_linkedModels[i];
if( m_automationPattern != it->m_automationPattern )
{
it->m_automation_pattern = m_automation_pattern;
it->m_automationPattern = m_automationPattern;
}
}
}
@@ -433,16 +453,16 @@ void automatableObject<T, EDIT_STEP_TYPE>::syncAutomationPattern( void )
template<typename T, typename EDIT_STEP_TYPE>
void automatableObject<T, EDIT_STEP_TYPE>::setLevel( int _level )
void automatableModel<T, EDIT_STEP_TYPE>::setLevel( int _level )
{
if( m_curLevel == _level )
{
return;
}
bool journalling = testAndSetJournalling( FALSE );
m_automation_pattern->setUpdateFirst( FALSE );
m_automationPattern->setUpdateFirst( FALSE );
setValue( _level * m_step );
m_automation_pattern->setUpdateFirst( TRUE );
m_automationPattern->setUpdateFirst( TRUE );
setJournalling( journalling );
}
@@ -450,7 +470,7 @@ void automatableObject<T, EDIT_STEP_TYPE>::setLevel( int _level )
template<>
inline float automatableObject<float>::minRelStep( void )
inline float automatableModel<float>::minRelStep( void )
{
return( 1.0e-10 );
}
@@ -459,7 +479,7 @@ inline float automatableObject<float>::minRelStep( void )
template<>
inline float automatableObject<float>::defaultRelStep( void )
inline float automatableModel<float>::defaultRelStep( void )
{
return( 1.0e-2 );
}
@@ -468,7 +488,7 @@ inline float automatableObject<float>::defaultRelStep( void )
template<>
inline float automatableObject<float>::minEps( void )
inline float automatableModel<float>::minEps( void )
{
return( 1.0e-10 );
}
@@ -477,7 +497,7 @@ inline float automatableObject<float>::minEps( void )
template<>
inline float automatableObject<float>::attributeValue( QString _value )
inline float automatableModel<float>::attributeValue( QString _value )
{
return( _value.toFloat() );
}
@@ -486,7 +506,7 @@ inline float automatableObject<float>::attributeValue( QString _value )
template<>
inline int automatableObject<int>::attributeValue( QString _value )
inline int automatableModel<int>::attributeValue( QString _value )
{
return( _value.toInt() );
}
@@ -495,7 +515,15 @@ inline int automatableObject<int>::attributeValue( QString _value )
template<>
inline bool automatableObject<bool, signed char>::attributeValue(
inline bool automatableModel<bool>::attributeValue( QString _value )
{
return( static_cast<bool>( _value.toInt() ) );
}
template<>
inline bool automatableModel<bool, signed char>::attributeValue(
QString _value )
{
return( static_cast<bool>( _value.toInt() ) );

View File

@@ -30,18 +30,18 @@
#include <QtXml/QDomElement>
class knob;
#include "automatable_model.h"
class automatableSlider : public QSlider
class automatableSlider : public QSlider, public automatableModelView<int>
{
Q_OBJECT
public:
automatableSlider( QWidget * _parent, const QString & _name,
class track * _track );
automatableSlider( QWidget * _parent, const QString & _name );
virtual ~automatableSlider();
virtual void setRange( int _min, int _max );
/* virtual void setRange( int _min, int _max );
virtual void setValue( int _value );
virtual void setInitValue( int _value );
@@ -51,11 +51,11 @@ public:
const QString & _name );
int logicValue( void );
void clearAutomationValues( void );
void clearAutomationValues( void );*/
bool showStatus( void )
{
return( m_show_status );
return( m_showStatus );
}
@@ -70,10 +70,11 @@ protected:
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void wheelEvent( QWheelEvent * _me );
virtual void modelChanged( void );
private:
knob * m_knob;
bool m_show_status;
bool m_showStatus;
private slots:
@@ -84,6 +85,7 @@ private slots:
} ;
typedef automatableSlider::autoModel sliderModel;
#endif

View File

@@ -27,17 +27,18 @@
#define _BB_EDITOR_H
#include "track_container.h"
#include "combobox.h"
class QPixmap;
class comboBox;
class toolButton;
class bbEditor : public trackContainer
{
Q_OBJECT
mapPropertyFromModelPtr(int,currentBB,setCurrentBB,m_bbComboBoxModel);
public:
virtual bool FASTCALL play( midiTime _start, const fpp_t _frames,
const f_cnt_t _frame_base,
@@ -58,11 +59,6 @@ public:
return( TRUE );
}
int currentBB( void ) const
{
return( m_currentBB );
}
tact FASTCALL lengthOfBB( const int _bb );
inline tact lengthOfCurrentBB( void )
{
@@ -80,7 +76,7 @@ public slots:
void play( void );
void stop( void );
void updateComboBox( void );
void setCurrentBB( int _bb );
void currentBBChanged( void );
protected:
@@ -95,15 +91,13 @@ private:
void FASTCALL createTCOsForBB( const int _bb );
int m_currentBB;
QWidget * m_toolBar;
toolButton * m_playButton;
toolButton * m_stopButton;
comboBox * m_bbComboBox;
comboBoxModel * m_bbComboBoxModel;
friend class engine;

View File

@@ -29,41 +29,93 @@
#include <QtGui/QWidget>
#include <QtCore/QVector>
#include <QtGui/QMenu>
#include <QtGui/QPixmap>
#include <QtCore/QPair>
#include "automatable_object.h"
#include "automatable_model.h"
#include "automatable_model_templates.h"
class QAction;
class comboBox : public QWidget, public automatableObject<int>
class comboBoxModel : public intModel
{
Q_OBJECT
public:
comboBox( QWidget * _parent, const QString & _name, track * _track );
virtual ~comboBox();
void addItem( const QString & _item, const QPixmap & _pixmap =
QPixmap() );
inline void clear( void )
comboBoxModel( ::model * _parent = NULL ) :
automatableModel<int>( 0, 0, 0, defaultRelStep(), _parent )
{
setRange( 0, 0 );
m_items.clear();
m_menu.clear();
update();
}
void addItem( const QString & _item, QPixmap * _data = NULL );
void clear( void );
int findText( const QString & _txt ) const;
QString currentText( void ) const
inline const QString & currentText( void ) const
{
return( m_items[value()].first );
}
void setValue( const int _idx );
inline const QPixmap * currentData( void ) const
{
return( m_items[value()].second );
}
inline const QString & itemText( int _i ) const
{
return( m_items[tLimit<int>( _i, minValue(), maxValue() )].
first );
}
inline const QPixmap * itemPixmap( int _i ) const
{
return( m_items[tLimit<int>( _i, minValue(), maxValue() )].
second );
}
inline int size( void ) const
{
return( m_items.size() );
}
private:
typedef QPair<QString, QPixmap *> item;
QVector<item> m_items;
signals:
void itemPixmapRemoved( QPixmap * _item );
} ;
class comboBox : public QWidget, public intModelView
{
Q_OBJECT
public:
comboBox( QWidget * _parent, const QString & _name = QString::null );
virtual ~comboBox();
comboBoxModel * model( void )
{
return( castModel<comboBoxModel>() );
}
const comboBoxModel * model( void ) const
{
return( castModel<comboBoxModel>() );
}
virtual void modelChanged( void )
{
if( model() != NULL )
{
connect( model(), SIGNAL( itemPixmapRemoved( QPixmap * ) ),
this, SLOT( deletePixmap( QPixmap * ) ) );
}
}
protected:
@@ -79,20 +131,17 @@ private:
QMenu m_menu;
typedef QPair<QString, QPixmap> item;
QVector<item> m_items;
bool m_pressed;
private slots:
void deletePixmap( QPixmap * _pixmap );
void setItem( QAction * _item );
/*
signals:
void activated( const QString & );
void valueChanged( int );
void valueChanged( int );*/
} ;

View File

@@ -27,14 +27,16 @@
#define _DETUNING_HELPER_H
#include "automatable_model.h"
#include "shared_object.h"
#include "automation_editor.h"
class detuningHelper : public automatableObject<float>, public sharedObject
class detuningHelper : public floatModel, public sharedObject
{
public:
detuningHelper( void ) :
autoObj( NULL )
autoModel( NULL )
{
}

View File

@@ -34,11 +34,14 @@
#include <Qt/QtXml>
#include "plugin.h"
#include "engine.h"
#include "mixer.h"
#include "automatable_model.h"
class effectControlDialog;
class track;
class rackPlugin;
class effect : public plugin
@@ -88,14 +91,9 @@ public:
m_running = FALSE;
}
inline bool isBypassed( void )
inline bool enabled( void )
{
return( m_bypass );
}
inline void setBypass( bool _mode )
{
m_bypass = _mode;
return( m_enabledModel.value() );
}
inline Uint32 getTimeout( void )
@@ -110,45 +108,41 @@ public:
inline float getWetLevel( void )
{
return( m_wetDry );
return( m_wetDryModel.value() );
}
inline float getDryLevel( void )
{
return( 1.0f - m_wetDry );
return( 1.0f - m_wetDryModel.value() );
}
inline void setWetLevel( float _wet )
{
m_wetDry = _wet;
}
inline float getGate( void )
{
return( m_gate );
const float level = m_gateModel.value();
return( level*level * m_processors *
engine::getMixer()->framesPerPeriod() );
}
void setGate( float _level );
inline Uint32 getBufferCount( void )
{
return( m_bufferCount );
}
inline void resetBufferCount( void )
{
m_bufferCount = 0;
}
inline void incrementBufferCount( void )
{
m_bufferCount++;
}
inline bool dontRun( void )
{
return( m_noRun );
}
inline void setDontRun( bool _state )
{
m_noRun = _state;
@@ -169,17 +163,20 @@ private:
descriptor::subPluginFeatures::key m_key;
ch_cnt_t m_processors;
bool m_okay;
bool m_noRun;
bool m_running;
bool m_bypass;
boolModel m_enabledModel;
Uint32 m_bufferCount;
Uint32 m_silenceTimeout;
float m_wetDry;
float m_gate;
floatModel m_wetDryModel;
floatModel m_gateModel;
friend class rackPlugin;
} ;

View File

@@ -33,6 +33,7 @@
#include "journalling_object.h"
#include "automatable_model.h"
#include "sample_buffer.h"
#include "types.h"
@@ -102,10 +103,7 @@ protected:
protected slots:
void updateAfterKnobChange( float );
void lfoWaveCh( int );
void lfoUserWaveCh( bool );
void x100Toggled( bool );
void lfoUserWaveChanged( void );
private:
@@ -126,6 +124,15 @@ private:
knob * m_releaseKnob;
knob * m_amountKnob;
// models
floatModel m_predelayModel;
floatModel m_attackModel;
floatModel m_holdModel;
floatModel m_decayModel;
floatModel m_sustainModel;
floatModel m_releaseModel;
floatModel m_amountModel;
float m_sustainLevel;
float m_amount;
float m_valueForZeroAmount;
@@ -135,6 +142,7 @@ private:
sample_t * m_pahdEnv;
sample_t * m_rEnv;
// LFO-stuff
knob * m_lfoPredelayKnob;
knob * m_lfoAttackKnob;
@@ -146,6 +154,17 @@ private:
ledCheckBox * m_x100Cb;
ledCheckBox * m_controlEnvAmountCb;
// models
floatModel m_lfoPredelayModel;
floatModel m_lfoAttackModel;
floatModel m_lfoSpeedModel;
floatModel m_lfoAmountModel;
intModel m_lfoWaveModel;
boolModel m_x100Model;
boolModel m_controlEnvAmountModel;
f_cnt_t m_lfoPredelayFrames;
f_cnt_t m_lfoAttackFrames;
f_cnt_t m_lfoOscillationFrames;
@@ -163,7 +182,7 @@ private:
SAW,
SQUARE,
USER
} m_lfoShape;
} ;
sample_t lfoShapeSample( fpp_t _frame_offset );
void updateLFOShapeData( void );

View File

@@ -31,10 +31,12 @@
#include <QtGui/QWidget>
#include "mixer.h"
#include "automatable_model.h"
class QLabel;
class comboBoxModel;
class instrumentTrack;
class comboBox;
class envelopeAndLFOWidget;
@@ -92,6 +94,11 @@ private:
knob * m_filterCutKnob;
knob * m_filterResKnob;
boolModel * m_filterEnabledModel;
comboBoxModel * m_filterModel;
floatModel * m_filterCutModel;
floatModel * m_filterResModel;
friend class flpImport;
} ;

View File

@@ -30,6 +30,7 @@
#include <QtGui/QDialog>
#include "export.h"
#include "automatable_model.h"
class QLabel;
@@ -37,6 +38,7 @@ class QPushButton;
class QProgressBar;
class comboBox;
class comboBoxModel;
class ledCheckBox;
class pixmapButton;
@@ -71,18 +73,22 @@ private:
static Sint16 s_availableBitrates[];
QString m_fileName;
QLabel * m_typeLbl;
comboBox * m_typeCombo;
comboBoxModel * m_typeModel;
QLabel * m_kbpsLbl;
comboBox * m_kbpsCombo;
comboBoxModel * m_kbpsModel;
ledCheckBox * m_vbrCb;
boolModel * m_vbrEnabledModel;
ledCheckBox * m_hqmCb;
boolModel * m_hqmEnabledModel;
QLabel * m_hourglassLbl;
QPushButton * m_exportBtn;
QPushButton * m_cancelBtn;
QProgressBar * m_exportProgressBar;
QString m_fileName;
fileTypes m_fileType;
bool m_deleteFile;

View File

@@ -28,38 +28,28 @@
#include <QtGui/QWidget>
#include "automatable_model.h"
#include "pixmap_button.h"
class QPixmap;
class groupBox : public QWidget
class groupBox : public QWidget, public boolModelView
{
Q_OBJECT
public:
groupBox( const QString & _caption, QWidget * _parent, track * _track );
groupBox( const QString & _caption, QWidget * _parent );
virtual ~groupBox();
bool isActive( void ) const
{
return( m_led->isChecked() );
}
void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name );
void loadSettings( const QDomElement & _this, const QString & _name );
virtual void modelChanged( void );
public slots:
void setState( bool _on, bool _anim = FALSE );
// void setState( bool _on, bool _anim = FALSE );
void animate( void );
signals:
void toggled( bool _state );
protected:
virtual void resizeEvent( QResizeEvent * _re );
virtual void mousePressEvent( QMouseEvent * _me );
@@ -78,4 +68,8 @@ private:
} ;
typedef groupBox::autoModel groupBoxModel;
#endif

View File

@@ -30,8 +30,11 @@
#include <QtGui/QPushButton>
#include <QtGui/QPainter>
#include "automatable_model.h"
#include "lcd_spinbox.h"
#include "midi_event_processor.h"
#include "mixer.h"
#include "surround_area.h"
#include "tab_widget.h"
#include "track.h"
@@ -56,6 +59,7 @@ class volumeKnob;
class instrumentTrack : public QWidget, public track, public midiEventProcessor
{
Q_OBJECT
mapPropertyFromModel(int,getVolume,setVolume,m_volumeModel);
public:
instrumentTrack( trackContainer * _tc );
virtual ~instrumentTrack();
@@ -100,13 +104,12 @@ public:
void FASTCALL setName( const QString & _new_name );
// volume & surround-position-stuff
void FASTCALL setVolume( volume _new_volume );
volume getVolume( void ) const;
void FASTCALL setSurroundAreaPos( const QPoint & _p );
/* void FASTCALL setVolume( volume _new_volume );
volume getVolume( void ) const;*/
void FASTCALL setBaseNote( Uint32 _new_note, bool _modified = TRUE );
// void FASTCALL setBaseNote( Uint32 _new_note, bool _modified = TRUE );
inline tones baseTone( void ) const
/* inline tones baseTone( void ) const
{
return( m_baseTone );
}
@@ -114,7 +117,7 @@ public:
inline octaves baseOctave( void ) const
{
return( m_baseOctave );
}
}*/
int FASTCALL masterKey( notePlayHandle * _n ) const;
@@ -158,9 +161,13 @@ public:
return( m_audioPort );
}
intModel * baseNoteModel( void )
{
return( &m_baseNoteModel );
}
public slots:
void surroundAreaPosChanged( const QPoint & _new_p );
void textChanged( const QString & _new_name );
void toggledInstrumentTrackButton( bool _on );
@@ -192,6 +199,8 @@ protected slots:
void midiOutSelected( void );
void midiConfigChanged( bool );
void updateBaseNote( void );
private:
trackTypes m_trackType;
@@ -204,13 +213,12 @@ private:
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
tones m_baseTone;
octaves m_baseOctave;
intModel m_baseNoteModel;
QList<notePlayHandle *> m_processHandles;
// widgets on the top of a instrument-track-window
// widgets on the top of an instrument-track-window
tabWidget * m_generalSettingsWidget;
QLineEdit * m_instrumentNameLE;
volumeKnob * m_volumeKnob;
@@ -218,7 +226,11 @@ private:
lcdSpinBox * m_effectChannelNumber;
QPushButton * m_saveSettingsBtn;
floatModel m_volumeModel;
surroundAreaModel m_surroundAreaModel;
lcdSpinBoxModel m_effectChannelModel;
// tab-widget with all children
tabWidget * m_tabWidget;
instrument * m_instrument;
@@ -245,9 +257,9 @@ private:
friend class presetPreviewPlayHandle;
friend class flpImport;
// base-tone stuff
/* // base-tone stuff
void FASTCALL setBaseTone( tones _new_tone );
void FASTCALL setBaseOctave( octaves _new_octave );
void FASTCALL setBaseOctave( octaves _new_octave );*/
} ;

View File

@@ -147,10 +147,6 @@ public:
// to be implemented by actual object
virtual QString nodeName( void ) const = 0;
protected:
void addJournalEntry( const journalEntry & _je );
inline bool isJournalling( void ) const
{
return( m_journalling );
@@ -169,6 +165,10 @@ protected:
}
protected:
void addJournalEntry( const journalEntry & _je );
// to be implemented by sub-objects
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this )

View File

@@ -32,7 +32,8 @@
#include <QtGui/QWidget>
#include <QtCore/QPoint>
#include "automatable_object.h"
#include "automatable_model.h"
#include "templates.h"
class QPixmap;
@@ -46,32 +47,20 @@ enum knobTypes
class knob : public QWidget, public automatableObject<float>
class knob : public QWidget, public floatModelView
{
Q_OBJECT
public:
knob( int _knob_num, QWidget * _parent, const QString & _name,
track * _track );
knob( int _knob_num, QWidget * _parent, const QString & _name );
virtual ~knob();
void setHintText( const QString & _txt_before,
const QString & _txt_after );
void setLabel( const QString & _txt );
void setTotalAngle( float _angle );
inline virtual void setInitValue( const float _val )
{
m_initValue = _val;
autoObj::setInitValue( _val );
}
virtual void setValue( const float _x );
virtual void setRange( const float _min, const float _max,
const float _step = 0.0 );
public slots:
void reset( void );
@@ -83,8 +72,8 @@ public slots:
signals:
void valueChanged( float value );
void valueChanged( void );
// void valueChanged( float value );
// void valueChanged( void );
void sliderPressed( void );
void sliderReleased( void );
void sliderMoved( float value );
@@ -102,8 +91,6 @@ protected:
QString m_hintTextBeforeValue;
QString m_hintTextAfterValue;
float m_initValue;
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
@@ -112,7 +99,6 @@ protected:
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _me );
virtual void resizeEvent( QResizeEvent * _me );
virtual void wheelEvent( QWheelEvent * _me );
void drawKnob( QPainter * _p );
@@ -122,16 +108,16 @@ protected:
private:
void layoutKnob( bool _update = TRUE );
void recalcAngle( void );
void valueChange( void );
void rangeChange( void );
inline float pageSize( void ) const
{
return( tMax<float>( ( model()->maxValue() -
model()->minValue() ) / 100.0f,
model()->step() ) );
}
void valueChange( void );
void buttonReleased( void );
float m_pageSize;
float m_angle;
float m_totalAngle;
int m_knobNum;
@@ -139,4 +125,7 @@ private:
} ;
typedef knob::autoModel knobModel;
#endif

View File

@@ -39,10 +39,10 @@
#endif
#include "journalling_object.h"
#include "automatable_model.h"
#include "knob.h"
class knob;
class ledCheckBox;
class track;
@@ -65,14 +65,14 @@ public:
void FASTCALL linkControls( ladspaControl * _control );
void FASTCALL unlinkControls( ladspaControl * _control );
inline ledCheckBox * getToggle( void )
inline boolModel * getToggledModel( void )
{
return( m_toggle );
return( &m_toggledModel );
}
inline knob * getKnob( void )
inline knobModel * getKnobModel( void )
{
return( m_knob );
return( &m_knobModel );
}
inline port_desc_t * getPort( void )
@@ -89,15 +89,18 @@ public:
return( "port" );
}
signals:
void changed( Uint16 _port, LADSPA_Data _value );
void linkChanged( Uint16 _port, bool _state );
protected slots:
void ledChange( bool _state );
void knobChange( float _value );
void portLink( bool _state );
void ledChanged( void );
void knobChanged( void );
void linkStateChanged( void );
private:
port_desc_t * m_port;
track * m_track;
@@ -105,6 +108,11 @@ private:
ledCheckBox * m_link;
ledCheckBox * m_toggle;
knob * m_knob;
};
boolModel m_linkEnabledModel;
boolModel m_toggledModel;
knobModel m_knobModel;
} ;
#endif

View File

@@ -29,33 +29,38 @@
#include <QtCore/QMap>
#include <QtGui/QLCDNumber>
#include "automatable_object.h"
#include "automatable_model.h"
class QLabel;
class lcdSpinBox : public QWidget, public automatableObject<int>
class lcdSpinBox : public QWidget, public automatableModelView<int>
{
Q_OBJECT
public:
lcdSpinBox( int _min, int _max, int _num_digits, QWidget * _parent,
const QString & _name, track * _track );
lcdSpinBox( int _num_digits, QWidget * _parent, const QString & _name =
QString::null );
virtual ~lcdSpinBox();
virtual void setStep( const int _step );
void setLabel( const QString & _txt );
inline void addTextForValue( int _val, const QString & _text )
{
m_textForValue[_val] = _text;
update();
}
virtual void modelChanged( void )
{
modelView::modelChanged();
update();
}
public slots:
virtual void setValue( const int _value );
virtual void setEnabled( bool _on );
virtual void update( void );
protected:
@@ -76,9 +81,10 @@ private:
signals:
void valueChanged( int );
void manualChange( void );
} ;
typedef lcdSpinBox::autoModel lcdSpinBoxModel;
#endif

View File

@@ -42,8 +42,8 @@ public:
} ;
ledCheckBox( const QString & _txt, QWidget * _parent,
const QString & _name, track * _track,
ledColors _color = YELLOW );
const QString & _name = QString::null,
ledColors _color = YELLOW );
virtual ~ledCheckBox();

View File

@@ -44,21 +44,26 @@ public:
inline int getNumerator( void )
{
return( m_numerator->value() );
return( m_numeratorModel->value() );
}
inline int getDenominator( void )
{
return( m_denominator->value() );
return( m_denominatorModel->value() );
}
private:
lcdSpinBox * m_numerator;
lcdSpinBox * m_denominator;
lcdSpinBoxModel * m_numeratorModel;
lcdSpinBoxModel * m_denominatorModel;
signals:
void numeratorChanged( int );
void denominatorChanged( int );
};
void numeratorChanged( void );
void denominatorChanged( void );
} ;
#endif

View File

@@ -29,7 +29,7 @@
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "automatable_model.h"
class QMenu;
@@ -61,14 +61,14 @@ public:
public slots:
void midiPortModeToggled( bool = FALSE );
void midiPortModeChanged( void );
protected slots:
void inputChannelChanged( int );
void outputChannelChanged( int );
void defaultVelInChanged( bool );
void defaultVelOutChanged( bool );
void inputChannelChanged( void );
void outputChannelChanged( void );
void defaultVelInChanged( void );
void defaultVelOutChanged( void );
void readablePortsChanged( void );
void writeablePortsChanged( void );
void activatedReadablePort( QAction * _item );
@@ -85,6 +85,12 @@ private:
ledCheckBox * m_sendCheckBox;
ledCheckBox * m_defaultVelocityInCheckBox;
ledCheckBox * m_defaultVelocityOutCheckBox;
intModel m_inputChannelModel;
intModel m_outputChannelModel;
boolModel m_receiveEnabledModel;
boolModel m_sendEnabledModel;
boolModel m_defaultVelocityInEnabledModel;
boolModel m_defaultVelocityOutEnabledModel;
QMenu * m_readablePorts;
QMenu * m_writeablePorts;

107
include/mv_base.h Normal file
View File

@@ -0,0 +1,107 @@
/*
* mv_base.h - base for M/V-architecture of LMMS
*
* Copyright (c) 2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 _MV_BASE_H
#define _MV_BASE_H
#include <QtCore/QObject>
class model : public QObject
{
Q_OBJECT
public:
model( model * _parent, bool _default_constructed = FALSE ) :
QObject( _parent ),
m_defaultConstructed( _default_constructed )
{
}
virtual ~model()
{
}
inline bool defaultConstructed( void )
{
return( m_defaultConstructed );
}
private:
bool m_defaultConstructed;
signals:
// emitted if actual data of the model (e.g. values) have changed
void dataChanged( void );
// emitted if properties of the model (e.g. ranges) have changed
void propertiesChanged( void );
} ;
class modelView
{
public:
modelView() :
m_model( NULL )
{
}
virtual ~modelView()
{
}
void setModel( model * _model, bool _old_model_valid = TRUE );
// sub-classes can re-implement this to track model-changes
virtual void modelChanged( void )
{
}
template<class T>
T * castModel( void )
{
return( dynamic_cast<T *>( m_model ) );
}
template<class T>
const T * castModel( void ) const
{
return( dynamic_cast<T *>( m_model ) );
}
private:
model * m_model;
} ;
#endif

View File

@@ -39,6 +39,7 @@ class QPixmap;
class QScrollBar;
class comboBox;
class comboBoxModel;
class notePlayHandle;
class pattern;
class timeLine;
@@ -125,7 +126,7 @@ protected slots:
void updatePosition( const midiTime & _t );
void zoomingChanged( const QString & _zfac );
void zoomingChanged( void );
private:
@@ -196,6 +197,11 @@ private:
comboBox * m_quantizeComboBox;
comboBox * m_noteLenComboBox;
comboBoxModel * m_zoomingModel;
comboBoxModel * m_quantizeModel;
comboBoxModel * m_noteLenModel;
pattern * m_pattern;
QScrollBar * m_leftRightScroll;

View File

@@ -33,6 +33,7 @@
#include "note.h"
#include "automatable_model.h"
class instrumentTrack;
@@ -56,11 +57,6 @@ public:
void setKeyState( int _key, bool _on = FALSE );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name );
virtual void loadSettings( const QDomElement & _this,
const QString & _name );
virtual void keyPressEvent( QKeyEvent * ke );
virtual void keyReleaseEvent( QKeyEvent * ke );
#ifndef BUILD_WIN32
@@ -95,14 +91,12 @@ private:
octaves m_startOctave;
int m_lastKey;
unsigned int m_keycode;
unsigned int m_keyCode;
knob * m_noteKnob;
private slots:
void pianoScrolled( int _new_pos );
void updateBaseNote( void );
} ;

View File

@@ -35,8 +35,7 @@ class pixmapButton : public automatableButton
{
Q_OBJECT
public:
pixmapButton( QWidget * _parent, const QString & _name,
track * _track );
pixmapButton( QWidget * _parent, const QString & _name );
virtual ~pixmapButton();
void setActiveGraphic( const QPixmap & _pm );

View File

@@ -22,12 +22,13 @@
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _RACK_PLUGIN_H
#define _RACK_PLUGIN_H
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "automatable_model.h"
class QGroupBox;
@@ -68,10 +69,10 @@ public:
public slots:
void editControls( void );
void bypassed( bool _state );
void setWetDry( float _value );
void setAutoQuit( float _value );
void setGate( float _value );
void updateAutoQuit( void );
/* void bypassChanged( void );
void updateWetDry( void );
void updateGate( void );*/
void moveUp( void );
void moveDown( void );
void deletePlugin( void );
@@ -87,6 +88,8 @@ protected:
void contextMenuEvent( QContextMenuEvent * _me );
private:
floatModel m_autoQuitModel;
ledCheckBox * m_bypass;
knob * m_wetDry;
tempoSyncKnob * m_autoQuit;
@@ -95,7 +98,7 @@ private:
QGroupBox * m_controls;
QLabel * m_label;
QPushButton * m_editButton;
QMdiSubWindow *m_subWindow;
QMdiSubWindow * m_subWindow;
effect * m_effect;
effectControlDialog * m_controlView;
track * m_track;

View File

@@ -30,6 +30,7 @@
#include "play_handle.h"
#include "sample_buffer.h"
#include "automatable_model.h"
class bbTrack;
class pattern;
@@ -38,9 +39,8 @@ class track;
class audioPort;
class samplePlayHandle : public QObject, public playHandle
class samplePlayHandle : public playHandle
{
Q_OBJECT
public:
samplePlayHandle( const QString & _sample_file );
samplePlayHandle( sampleBuffer * _sample_buffer );
@@ -68,9 +68,10 @@ public:
m_bbTrack = _bb_track;
}
public slots:
void setVolume( float _new_volume );
void setVolumeModel( floatModel * _model )
{
m_volumeModel = _model;
}
private:
@@ -83,7 +84,8 @@ private:
audioPort * m_audioPort;
const bool m_ownAudioPort;
float m_volume;
floatModel m_defaultVolumeModel;
floatModel * m_volumeModel;
track * m_track;
bbTrack * m_bbTrack;

View File

@@ -30,12 +30,12 @@
#include <QtGui/QDialog>
#include "track.h"
#include "volume_knob.h"
class QLabel;
class audioPort;
class effectLabel;
class sampleBuffer;
class volumeKnob;
//class sampleTCOSettingsDialog;
@@ -147,6 +147,7 @@ private:
audioPort * m_audioPort;
volumeKnob * m_volumeKnob;
knobModel m_volumeModel;
} ;

View File

@@ -99,7 +99,6 @@ private slots:
void toggleDisableChActInd( bool _disabled );
void toggleManualChPiano( bool _enabled );
void setParallelizingLevel( int _level );
private:
@@ -138,7 +137,6 @@ private:
bool m_disableChActInd;
bool m_manualChPiano;
int m_parLevel;
typedef QMap<QString, audioDevice::setupWidget *> aswMap;
typedef QMap<QString, midiClient::setupWidget *> mswMap;

View File

@@ -28,14 +28,14 @@
#define _SONG_EDITOR_H
#include "track_container.h"
#include "lcd_spinbox.h"
#include "automatable_slider.h"
class QLabel;
class QScrollBar;
class automatableSlider;
class comboBox;
class lcdSpinBox;
class pattern;
class textFloat;
class timeLine;
@@ -51,6 +51,8 @@ const Uint16 MAX_SONG_LENGTH = 9999;
class songEditor : public trackContainer
{
Q_OBJECT
mapPropertyFromModel(int,masterPitch,setMasterPitch,m_masterPitchModel);
mapPropertyFromModel(int,masterVolume,setMasterVolume,m_masterVolumeModel);
public:
enum playModes
{
@@ -154,8 +156,6 @@ public:
return( FALSE );
}
int masterPitch( void ) const;
public slots:
void play( void );
@@ -172,10 +172,6 @@ public slots:
void startExport( void );
void stopExport( void );
// set tempo in BPM (beats per minute)
void setTempo( int _new_bpm = DEFAULT_BPM );
void setMasterVolume( volume _vol );
void setMasterPitch( int _master_pitch );
void setModified( void );
@@ -198,6 +194,8 @@ protected slots:
void scrolled( int _new_pos );
void updateTimeLinePosition( void );
void setTempo( void );
void masterVolumeChanged( int _new_val );
void masterVolumePressed( void );
void masterVolumeMoved( int _new_val );
@@ -209,7 +207,7 @@ protected slots:
void updatePosition( const midiTime & _t );
void zoomingChanged( const QString & _zfac );
void zoomingChanged( void );
void doActions( void );
@@ -235,16 +233,22 @@ private:
track * m_automationTrack;
QScrollBar * m_leftRightScroll;
QWidget * m_toolBar;
toolButton * m_playButton;
toolButton * m_stopButton;
lcdSpinBox * m_bpmSpinBox;
lcdSpinBox * m_tempoSpinBox;
lcdSpinBoxModel m_tempoModel;
automatableSlider * m_masterVolumeSlider;
automatableSlider * m_masterPitchSlider;
sliderModel m_masterVolumeModel;
sliderModel m_masterPitchModel;
textFloat * m_mvsStatus;
textFloat * m_mpsStatus;
@@ -275,8 +279,6 @@ private:
bool m_scrollBack;
track * m_automation_track;
enum ACTIONS

View File

@@ -30,6 +30,7 @@
#include <QtGui/QWidget>
#include "automatable_model.h"
#include "mixer.h"
@@ -41,24 +42,70 @@ class track;
const int SURROUND_AREA_SIZE = 1024;
class surroundArea : public QWidget
class surroundAreaModel : public model
{
Q_OBJECT
mapPropertyFromModel(int,x,setX,m_posX);
mapPropertyFromModel(int,y,setY,m_posY);
public:
surroundAreaModel( ::model * _parent, track * _track = NULL,
bool _default_constructed = FALSE );
volumeVector getVolumeVector( float _v_scale ) const;
void saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name = "surpos" );
void loadSettings( const QDomElement & _this,
const QString & _name = "surpos" );
inline void prepareJournalEntryFromOldVal( void )
{
m_posX.prepareJournalEntryFromOldVal();
m_posY.prepareJournalEntryFromOldVal();
}
inline void addJournalEntryFromOldToCurVal( void )
{
m_posX.addJournalEntryFromOldToCurVal();
m_posY.addJournalEntryFromOldToCurVal();
}
automationPattern * automationPatternX( void )
{
return( m_posX.getAutomationPattern() );
}
automationPattern * automationPatternY( void )
{
return( m_posY.getAutomationPattern() );
}
private:
intModel m_posX;
intModel m_posY;
} ;
class surroundArea : public QWidget, public modelView
{
Q_OBJECT
public:
surroundArea( QWidget * _parent, const QString & _name,
track * _track );
surroundArea( QWidget * _parent, const QString & _name );
virtual ~surroundArea();
volumeVector getVolumeVector( float _v_scale ) const;
inline const QPoint & value( void ) const
{
return( m_sndSrcPos );
}
void FASTCALL setValue( const QPoint & _p );
void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _this,
const QString & _name = "surpos" );
void FASTCALL loadSettings( const QDomElement & _this,
const QString & _name = "surpos" );
surroundAreaModel * model( void )
{
return( castModel<surroundAreaModel>() );
}
const surroundAreaModel * model( void ) const
{
return( castModel<surroundAreaModel>() );
}
protected:
@@ -69,23 +116,9 @@ protected:
virtual void mouseReleaseEvent( QMouseEvent * _me );
signals:
void valueChanged( const QPoint & _p );
private:
QPoint m_sndSrcPos;
static QPixmap * s_backgroundArtwork;
knob * m_position_x;
knob * m_position_y;
private slots:
void updatePositionX( void );
void updatePositionY( void );
} ;

View File

@@ -54,7 +54,7 @@ public:
tempoSyncKnob( int _knob_num, QWidget * _parent, const QString & _name,
track * _track, float _scale = 1.0f );
float _scale = 1.0f );
virtual ~tempoSyncKnob();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
@@ -95,7 +95,7 @@ protected:
protected slots:
void calculateTempoSyncTime( bpm_t _bpm );
void updateCustom( int );
void updateCustom( void );
void showCustom( void );
private:
@@ -103,7 +103,7 @@ private:
float m_scale;
QPixmap m_tempoSyncIcon;
QString m_tempoSyncDescription;
tempoSyncMode m_tempoLastSyncMode;
QPointer<meterDialog> m_custom;

View File

@@ -34,8 +34,7 @@ class volumeKnob : public knob
{
Q_OBJECT
public:
volumeKnob( int _knob_num, QWidget * _parent, const QString & _name,
track * _track );
volumeKnob( int _knob_num, QWidget * _parent, const QString & _name );
virtual ~volumeKnob();