Play automation pattern when midi controller connected (#5657)
* Play automation pattern when midi controller connected * empty line removed * Improved for clarity * removed midi specific controller logic * formatting changes * comments added Co-authored-by: IanCaio <iancaio_dev@hotmail.com> Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "ValueBuffer.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "ModelVisitor.h"
|
||||
#include "ControllerConnection.h"
|
||||
|
||||
// simple way to map a property of a view to a model
|
||||
#define mapPropertyFromModelPtr(type,getfunc,setfunc,modelname) \
|
||||
@@ -148,7 +149,18 @@ public:
|
||||
template<class T>
|
||||
inline T value( int frameOffset = 0 ) const
|
||||
{
|
||||
if( hasLinkedModels() || m_controllerConnection != NULL )
|
||||
if (m_controllerConnection)
|
||||
{
|
||||
if (!m_useControllerValue)
|
||||
{
|
||||
return castValue<T>(m_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return castValue<T>(controllerValue(frameOffset));
|
||||
}
|
||||
}
|
||||
else if (hasLinkedModels())
|
||||
{
|
||||
return castValue<T>( controllerValue( frameOffset ) );
|
||||
}
|
||||
@@ -298,9 +310,15 @@ public:
|
||||
s_periodCounter = 0;
|
||||
}
|
||||
|
||||
bool useControllerValue()
|
||||
{
|
||||
return m_useControllerValue;
|
||||
}
|
||||
|
||||
public slots:
|
||||
virtual void reset();
|
||||
void unlinkControllerConnection();
|
||||
void setUseControllerValue(bool b = true);
|
||||
|
||||
|
||||
protected:
|
||||
@@ -395,6 +413,8 @@ private:
|
||||
// prevent several threads from attempting to write the same vb at the same time
|
||||
QMutex m_valueBufferMutex;
|
||||
|
||||
bool m_useControllerValue;
|
||||
|
||||
signals:
|
||||
void initValueChanged( float val );
|
||||
void destroyed( jo_id_t id );
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "Controller.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "ValueBuffer.h"
|
||||
@@ -47,7 +48,7 @@ class LMMS_EXPORT ControllerConnection : public QObject, public JournallingObjec
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
ControllerConnection( Controller * _controller );
|
||||
ControllerConnection(Controller * _controller, AutomatableModel * contmod);
|
||||
ControllerConnection( int _controllerId );
|
||||
|
||||
virtual ~ControllerConnection();
|
||||
@@ -98,7 +99,6 @@ public:
|
||||
return classNodeName();
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void deleteConnection();
|
||||
|
||||
@@ -112,6 +112,8 @@ protected:
|
||||
|
||||
static ControllerConnectionVector s_connections;
|
||||
|
||||
AutomatableModel * m_controlledModel;
|
||||
|
||||
signals:
|
||||
// The value changed while the mixer isn't running (i.e: MIDI CC)
|
||||
void valueChanged();
|
||||
|
||||
@@ -470,6 +470,8 @@ private:
|
||||
TimePos m_exportSongEnd;
|
||||
TimePos m_exportEffectiveLength;
|
||||
|
||||
AutomatedValueMap m_oldAutomatedValues;
|
||||
|
||||
friend class LmmsCore;
|
||||
friend class SongEditor;
|
||||
friend class mainWindow;
|
||||
|
||||
Reference in New Issue
Block a user