summaryrefslogtreecommitdiffstats
path: root/src/controleffectknob.cpp
blob: 6b8429a09ec7880e7fd7c0f2cf4fa8c226987e3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "controleffectknob.h"
#include "defs.h"

#include "effects/effectmanifestparameter.h"

ControlEffectKnob::ControlEffectKnob(ConfigKey key, double dMinValue, double dMaxValue)
        : ControlPotmeter(key, dMinValue, dMaxValue),
          m_type(0.0) {
    if (m_pControl) {
        m_pControl->setBehavior(
                new ControlLinPotmeterBehavior(dMinValue, dMaxValue));
    }
}

void ControlEffectKnob::setType(double v) {
    if (v == m_type || m_pControl == NULL) {
        return;
    }

    if (v == EffectManifestParameter::CONTROL_KNOB_LINEAR) {
        m_pControl->setBehavior(
                        new ControlLinPotmeterBehavior(m_dMinValue, m_dMaxValue));
    } else if (v == EffectManifestParameter::CONTROL_KNOB_LOGARITHMIC) {
        m_pControl->setBehavior(
                        new ControlLogPotmeterBehavior(m_dMinValue, m_dMaxValue));
    }
    m_type = v;
}