Final patch for logscales and knob with def ctors.

This commit is contained in:
Johannes Lorenz
2014-04-09 13:18:01 +02:00
3 changed files with 70 additions and 47 deletions

View File

@@ -60,7 +60,6 @@
class ControllerConnection;
#include <cstdio>
class EXPORT AutomatableModel : public Model, public JournallingObject
{
Q_OBJECT
@@ -182,12 +181,11 @@ 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 )
void setScaleLogarithmic( bool setToTrue = true )
{
setScaleType(set_to_true ? Logarithmic : Linear);
setScaleType( setToTrue ? Logarithmic : Linear );
}
void setStep( const float step );
@@ -251,6 +249,10 @@ public slots:
protected:
//! returns a value which is in range between min() and
//! max() and aligned according to the step size (step size 0.05 -> value
//! 0.12345 becomes 0.10 etc.). You should always call it at the end after
//! doing your own calculations.
float fittedValue( float value ) const;
@@ -268,9 +270,13 @@ private:
void linkModel( AutomatableModel* model );
void unlinkModel( AutomatableModel* model );
//! @brief Scales @value from linear to logarithmic.
//! Value should be within [0,1]
template<class T> T logToLinearScale( T value ) const;
//! 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;
template<class T> void roundAt( T &value, const T &where ) const;
DataType m_dataType;