95 lines
2.8 KiB
C++
95 lines
2.8 KiB
C++
|
|
#include "ui.hpp"
|
|
|
|
#include "chassis.hpp"
|
|
|
|
START_NAMESPACE_DISTRHO
|
|
|
|
namespace Art = Artwork;
|
|
|
|
DistrhoUIchassis::DistrhoUIchassis() : UI(Art::backgroundWidth, Art::backgroundHeight, true),
|
|
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatRGB)
|
|
|
|
{
|
|
Image orangeSlider(Art::orangeData, Art::orangeWidth, Art::orangeHeight, kImageFormatRGBA);
|
|
|
|
Image greenSlider(Art::greenData, Art::orangeWidth, Art::orangeHeight, kImageFormatRGBA);
|
|
|
|
|
|
xSliderLFORate = new ImageSlider(this, orangeSlider);
|
|
xSliderLFORate->setId(Chassis::paramLFORate);
|
|
xSliderLFORate->setStartPos(50, 72);
|
|
xSliderLFORate->setEndPos(50, 150);
|
|
xSliderLFORate->setRange(0, 1.0f);
|
|
xSliderLFORate->setCallback(this);
|
|
|
|
xSliderLFODelay = new ImageSlider(this, orangeSlider);
|
|
xSliderLFODelay->setId(Chassis::paramLFODelay);
|
|
xSliderLFODelay->setStartPos(92, 72);
|
|
xSliderLFODelay->setEndPos(92, 150);
|
|
xSliderLFODelay->setRange(0, 1.0f);
|
|
xSliderLFODelay->setCallback(this);
|
|
|
|
xSliderLFODepth = new ImageSlider(this, greenSlider);
|
|
xSliderLFODepth->setId(Chassis::paramLFODepth);
|
|
xSliderLFODepth->setStartPos(291, 72);
|
|
xSliderLFODepth->setEndPos(291, 150);
|
|
xSliderLFODepth->setRange(0, 1.0f);
|
|
xSliderLFODepth->setCallback(this);
|
|
|
|
programLoaded(0);
|
|
}
|
|
|
|
DistrhoUIchassis::~DistrhoUIchassis() {
|
|
printf("Called destructor for UI\n");
|
|
}
|
|
|
|
void DistrhoUIchassis::programLoaded(uint32_t index) {
|
|
// printf("in programLoaded %d\n", i
|
|
switch (index) {
|
|
case Chassis::paramLFORate:
|
|
xSliderLFORate->setValue(0.5);
|
|
printf("set lforate\n");
|
|
break;
|
|
case Chassis::paramLFODelay:
|
|
xSliderLFODelay->setValue(0.5);
|
|
printf("set lfoDelay\n");
|
|
break;
|
|
}
|
|
}
|
|
void DistrhoUIchassis::parameterChanged(uint32_t index, float value) {
|
|
// printf("in parameterchanged %d %f\n", index, value);
|
|
if (index == Chassis::paramLFORate) {
|
|
xSliderLFORate->setValue(value);
|
|
printf("changed lforate\n");
|
|
}
|
|
if (index == Chassis::paramLFODelay) {
|
|
xSliderLFODelay->setValue(value);
|
|
printf("changed lfoDelay\n");
|
|
}
|
|
}
|
|
|
|
void DistrhoUIchassis::imageSliderDragStarted(ImageSlider* slider) {
|
|
editParameter(slider->getId(), true);
|
|
}
|
|
|
|
void DistrhoUIchassis::imageSliderDragFinished(ImageSlider* slider) {
|
|
editParameter(slider->getId(), false);
|
|
}
|
|
|
|
void DistrhoUIchassis::imageSliderValueChanged(ImageSlider* slider, float value) {
|
|
printf("%f\n", value);
|
|
setParameterValue(slider->getId(), value);
|
|
}
|
|
|
|
void DistrhoUIchassis::onDisplay() {
|
|
const GraphicsContext& context(getGraphicsContext());
|
|
fImgBackground.draw(context);
|
|
};
|
|
|
|
UI* createUI() {
|
|
return new DistrhoUIchassis();
|
|
}
|
|
|
|
END_NAMESPACE_DISTRHO
|