summaryrefslogtreecommitdiff
path: root/muse/awl
diff options
context:
space:
mode:
Diffstat (limited to 'muse/awl')
-rw-r--r--muse/awl/aslider.cpp43
-rw-r--r--muse/awl/aslider.h10
-rw-r--r--muse/awl/volslider.cpp33
-rw-r--r--muse/awl/volslider.h5
4 files changed, 86 insertions, 5 deletions
diff --git a/muse/awl/aslider.cpp b/muse/awl/aslider.cpp
index 3c5b1780..95151f18 100644
--- a/muse/awl/aslider.cpp
+++ b/muse/awl/aslider.cpp
@@ -191,8 +191,47 @@ void AbstractSlider::valueChange()
double AbstractSlider::value() const
{
- return _log ? (_value <= _minValue) ? 0.0f : pow(10.0, _value*0.05f)
- : _value;
+ return _log ? pow(10.0, _value*0.05f) : _value;
}
+
+
+//---------------------------------------------------------
+// minLogValue
+//---------------------------------------------------------
+
+//double AbstractSlider::minValue() const {
+// return _log ? pow(10.0, _minValue*0.05f) : _minValue;
+//}
+
+//---------------------------------------------------------
+// setMinLogValue
+//---------------------------------------------------------
+
+void AbstractSlider::setMinLogValue(double val) {
+ if (_log) {
+ if (val == 0.0f) _minValue = -100;
+ else _minValue = fast_log10(val) * 20.0f;
+ }
+ else _minValue = val;
}
+//---------------------------------------------------------
+// maxLogValue
+//---------------------------------------------------------
+
+//double AbstractSlider::maxValue() const {
+// return _log ? pow(10.0, _maxValue*0.05f) : _maxValue;
+//}
+
+//---------------------------------------------------------
+// setMaxLogValue
+//---------------------------------------------------------
+
+void AbstractSlider::setMaxLogValue(double val) {
+ if (_log) {
+ _maxValue = fast_log10(val) * 20.0f;
+ }
+ else _maxValue = val;
+}
+
+}
diff --git a/muse/awl/aslider.h b/muse/awl/aslider.h
index 058114e3..6650aece 100644
--- a/muse/awl/aslider.h
+++ b/muse/awl/aslider.h
@@ -104,14 +104,20 @@ class AbstractSlider : public QWidget {
virtual double value() const;
- double minValue() const { return _minValue; }
+ double minValue() const { return _minValue; }
void setMinValue(double v) { _minValue = v; }
- double maxValue() const { return _maxValue; }
+ void setMinLogValue(double v);
+ double maxValue() const {return _maxValue; }
void setMaxValue(double v) { _maxValue = v; }
+ void setMaxLogValue(double v);
void setRange(double a, double b) {
setMinValue(a);
setMaxValue(b);
}
+ void setLogRange(double a, double b) {
+ setMinLogValue(a);
+ setMaxLogValue(b);
+ }
bool log() const { return _log; }
void setLog(bool v) { _log = v; }
double lineStep() const { return _lineStep; }
diff --git a/muse/awl/volslider.cpp b/muse/awl/volslider.cpp
index dc4eddac..59f1b8cf 100644
--- a/muse/awl/volslider.cpp
+++ b/muse/awl/volslider.cpp
@@ -50,5 +50,36 @@ void VolSlider::mouseDoubleClickEvent(QMouseEvent* ev)
valueChange();
update();
}
-}
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void VolSlider::setValue(double val)
+ {
+ if (_log) {
+ if (val == 0.0f)
+ _value = _minValue;
+ else {
+ _value = fast_log10(val) * 20.0f;
+ if (_value < _minValue)
+ _value = _minValue;
+ }
+ }
+ else
+ _value = val;
+ update();
+ }
+
+//---------------------------------------------------------
+// value
+//---------------------------------------------------------
+
+double VolSlider::value() const
+ {
+ return _log ? (_value <= _minValue) ? 0.0f : pow(10.0, _value*0.05f)
+ : _value;
+ }
+
+}
diff --git a/muse/awl/volslider.h b/muse/awl/volslider.h
index cbea8ca9..22b4000f 100644
--- a/muse/awl/volslider.h
+++ b/muse/awl/volslider.h
@@ -42,8 +42,13 @@ class VolSlider : public Slider {
protected:
virtual void mouseDoubleClickEvent(QMouseEvent*);
+ public slots:
+ virtual void setValue(double v);
+
public:
VolSlider(QWidget* parent = 0);
+
+ virtual double value() const;
};
}