122 lines
3.6 KiB
C++
122 lines
3.6 KiB
C++
|
|
#include "ui.hpp"
|
|
|
|
#include "alphaosc.hpp"
|
|
|
|
START_NAMESPACE_DISTRHO
|
|
|
|
namespace Art = Artwork;
|
|
|
|
DistrhoUIAlphaOsc::DistrhoUIAlphaOsc() : UI(Art::bgWidth, Art::bgHeight, true),
|
|
fImgBackground(Art::bgData, Art::bgWidth, Art::bgHeight, kImageFormatRGB)
|
|
|
|
{
|
|
Image whiteSlider(Art::sliderData, Art::sliderWidth, Art::sliderHeight, kImageFormatRGBA);
|
|
|
|
xSliderSqrMode = new ImageSlider(this, whiteSlider);
|
|
xSliderSqrMode->setId(AlphaOsc::pSqrMode);
|
|
xSliderSqrMode->setStartPos(32, 36);
|
|
xSliderSqrMode->setEndPos(32, 84);
|
|
xSliderSqrMode->setRange(0, 3.0f);
|
|
xSliderSqrMode->setInverted(true);
|
|
xSliderSqrMode->setStep(1);
|
|
xSliderSqrMode->setCallback(this);
|
|
|
|
xSliderSawMode = new ImageSlider(this, whiteSlider);
|
|
xSliderSawMode->setId(AlphaOsc::pSawMode);
|
|
xSliderSawMode->setStartPos(87, 36);
|
|
xSliderSawMode->setEndPos(87, 117);
|
|
xSliderSawMode->setRange(0, 5.0f);
|
|
xSliderSawMode->setInverted(true);
|
|
xSliderSawMode->setStep(1);
|
|
xSliderSawMode->setCallback(this);
|
|
|
|
xSliderSubMode = new ImageSlider(this, whiteSlider);
|
|
xSliderSubMode->setId(AlphaOsc::pSubMode);
|
|
xSliderSubMode->setStartPos(142, 36);
|
|
xSliderSubMode->setEndPos(1425, 117);
|
|
xSliderSubMode->setRange(0, 5.0f);
|
|
xSliderSubMode->setInverted(true);
|
|
xSliderSubMode->setStep(1);
|
|
xSliderSubMode->setCallback(this);
|
|
|
|
xSliderSubLevel = new ImageSlider(this, whiteSlider);
|
|
xSliderSubLevel->setId(AlphaOsc::pSubLevel);
|
|
xSliderSubLevel->setStartPos(202, 36);
|
|
xSliderSubLevel->setEndPos(202, 117);
|
|
xSliderSubLevel->setRange(0, 1.0f);
|
|
xSliderSubLevel->setInverted(true);
|
|
xSliderSubLevel->setCallback(this);
|
|
|
|
xSliderPWMDepth = new ImageSlider(this, whiteSlider);
|
|
xSliderPWMDepth->setId(AlphaOsc::pPWMDepth);
|
|
xSliderPWMDepth->setStartPos(272, 36);
|
|
xSliderPWMDepth->setEndPos(272, 117);
|
|
xSliderPWMDepth->setRange(0, 1.0f);
|
|
xSliderPWMDepth->setInverted(true);
|
|
xSliderPWMDepth->setCallback(this);
|
|
|
|
xSliderPWMRate = new ImageSlider(this, whiteSlider);
|
|
xSliderPWMRate->setId(AlphaOsc::pPWMRate);
|
|
xSliderPWMRate->setStartPos(312, 36);
|
|
xSliderPWMRate->setEndPos(312, 117);
|
|
xSliderPWMRate->setRange(0, 1.0f);
|
|
xSliderPWMRate->setInverted(true);
|
|
xSliderPWMRate->setCallback(this);
|
|
|
|
// default settings
|
|
xSliderSubMode->setValue(2.0f);
|
|
|
|
}
|
|
|
|
void DistrhoUIAlphaOsc::parameterChanged(uint32_t index, float value) {
|
|
switch (index) {
|
|
case AlphaOsc::pSqrMode:
|
|
xSliderSqrMode->setValue(value);
|
|
break;
|
|
|
|
case AlphaOsc::pSawMode:
|
|
xSliderSawMode->setValue(value);
|
|
break;
|
|
|
|
case AlphaOsc::pSubMode:
|
|
xSliderSubMode->setValue(value);
|
|
break;
|
|
|
|
case AlphaOsc::pSubLevel:
|
|
xSliderSubLevel->setValue(value);
|
|
break;
|
|
|
|
case AlphaOsc::pPWMDepth:
|
|
xSliderPWMDepth->setValue(value);
|
|
break;
|
|
|
|
case AlphaOsc::pPWMRate:
|
|
xSliderPWMRate->setValue(value);
|
|
break;
|
|
}
|
|
}
|
|
|
|
void DistrhoUIAlphaOsc::imageSliderDragStarted(ImageSlider* slider) {
|
|
editParameter(slider->getId(), true);
|
|
}
|
|
|
|
void DistrhoUIAlphaOsc::imageSliderDragFinished(ImageSlider* slider) {
|
|
editParameter(slider->getId(), false);
|
|
}
|
|
|
|
void DistrhoUIAlphaOsc::imageSliderValueChanged(ImageSlider* slider, float value) {
|
|
setParameterValue(slider->getId(), value);
|
|
}
|
|
|
|
void DistrhoUIAlphaOsc::onDisplay() {
|
|
const GraphicsContext& context(getGraphicsContext());
|
|
fImgBackground.draw(context);
|
|
};
|
|
|
|
UI* createUI() {
|
|
return new DistrhoUIAlphaOsc();
|
|
}
|
|
|
|
END_NAMESPACE_DISTRHO
|