Logscales, merged.

This commit is contained in:
Johannes Lorenz
2014-03-22 08:30:06 +01:00
parent d6445b34b3
commit 2b8e5c3992
6 changed files with 151 additions and 29 deletions

View File

@@ -60,13 +60,19 @@
class ControllerConnection;
#include <cstdio>
class EXPORT AutomatableModel : public Model, public JournallingObject
{
Q_OBJECT
public:
typedef QVector<AutomatableModel *> AutoModelVector;
enum ScaleType
{
Linear,
Logarithmic
};
enum DataType
{
Float,
@@ -175,6 +181,14 @@ public:
}
void setRange( const float min, const float max, const float step = 1 );
void setScaleType( ScaleType sc ) {
printf("Settings scale to: %d\n", (int)sc);
m_scaleType = sc;
}
void setScaleLogarithmic( bool set_to_true = true )
{
setScaleType(set_to_true ? Logarithmic : Linear);
}
void setStep( const float step );
@@ -193,8 +207,14 @@ public:
void unlinkAllModels();
/*! \brief Saves settings (value, automation links and controller connections) of AutomatableModel into
specified DOM element using <name> as attribute/node name */
/**
* @brief Saves settings (value, automation links and controller connections) of AutomatableModel into
* specified DOM element using <name> as attribute/node name
* @param doc TODO
* @param element Where this option shall be saved.
* Depending on the model, this can be done in an attribute or in a subnode.
* @param name Name to store this model as.
*/
virtual void saveSettings( QDomDocument& doc, QDomElement& element, const QString& name );
/*! \brief Loads settings (value, automation links and controller connections) of AutomatableModel from
@@ -248,8 +268,13 @@ private:
void linkModel( AutomatableModel* model );
void unlinkModel( AutomatableModel* model );
//! rounds @a value to @a where if it is close to it
//! @param value will be modified to rounded value
template<class T> void round_at(T &value, const T &where) const;
DataType m_dataType;
ScaleType m_scaleType; //! scale type, linear by default
float m_value;
float m_initValue;
float m_minValue;
@@ -267,6 +292,7 @@ private:
bool m_hasLinkedModels;
//! NULL if not appended to controller, otherwise connection info
ControllerConnection* m_controllerConnection;

View File

@@ -100,7 +100,7 @@ protected:
//virtual controllerDialog * createDialog( QWidget * _parent );
Controller * m_controller;
QString m_targetName;
int m_controllerId;
int m_controllerId;
bool m_ownsController;

View File

@@ -51,6 +51,8 @@ typedef enum BufferData
NONE
} buffer_data_t;
//! This struct is used to hold port descriptions internally
//! which where received from the ladspa plugin
typedef struct PortDescription
{
QString name;
@@ -64,6 +66,9 @@ typedef struct PortDescription
LADSPA_Data min;
LADSPA_Data def;
LADSPA_Data value;
//! This is true iff ladspa suggests logscale
//! Note however that the model can still decide to use a linear scale
bool suggests_logscale;
LADSPA_Data * buffer;
LadspaControl * control;
} port_desc_t;