buttons switch LEDs
This commit is contained in:
parent
9dc95dc07f
commit
d7fcc9c0b0
|
@ -55,7 +55,9 @@ class Chassis : public Plugin {
|
|||
|
||||
pChorus,
|
||||
|
||||
parameterCount
|
||||
parameterCount,
|
||||
|
||||
btn16, btn8, btn4, btnPls, btnSaw, btnCh0, btnCh1, btnCh2
|
||||
};
|
||||
|
||||
Chassis();
|
||||
|
|
|
@ -157,13 +157,18 @@ DistrhoUIchassis::DistrhoUIchassis() : UI(Art::backgroundWidth, Art::backgroundH
|
|||
xBtn16ft = new ImageButton(this, Image(Art::orngBtnUp, Art::orngBtnWidth, Art::orngBtnHeight, kImageFormatRGB),
|
||||
Image(Art::orngBtnDn, Art::orngBtnWidth, Art::orngBtnHeight, kImageFormatRGB));
|
||||
xBtn16ft->setAbsolutePos(149,103);
|
||||
xBtn16ft->setId(Chassis::btn16);
|
||||
xBtn16ft->setCallback(this);
|
||||
xBtn8ft = new ImageButton(this, Image(Art::orngBtnUp, Art::orngBtnWidth, Art::orngBtnHeight, kImageFormatRGB),
|
||||
Image(Art::orngBtnDn, Art::orngBtnWidth, Art::orngBtnHeight, kImageFormatRGB));
|
||||
xBtn8ft->setAbsolutePos(190,103);
|
||||
xBtn8ft->setId(Chassis::btn8);
|
||||
xBtn8ft->setCallback(this);
|
||||
xBtn4ft = new ImageButton(this, Image(Art::orngBtnUp, Art::orngBtnWidth, Art::orngBtnHeight, kImageFormatRGB),
|
||||
Image(Art::orngBtnDn, Art::orngBtnWidth, Art::orngBtnHeight, kImageFormatRGB));
|
||||
xBtn4ft->setAbsolutePos(231,103);
|
||||
|
||||
xBtn4ft->setId(Chassis::btn4);
|
||||
xBtn4ft->setCallback(this);
|
||||
programLoaded(0);
|
||||
}
|
||||
|
||||
|
@ -271,6 +276,17 @@ void DistrhoUIchassis::imageSliderValueChanged(ImageSlider* slider, float value)
|
|||
setParameterValue(slider->getId(), value);
|
||||
}
|
||||
|
||||
void DistrhoUIchassis::imageButtonClicked(ImageButton *imgBtn, int) {
|
||||
int id = imgBtn->getId();
|
||||
//printf("imagebutton %d\n", id);
|
||||
switch (id) {
|
||||
case Chassis::btn16: sw1 &= 0xf8; sw1 |= 0x01; break;
|
||||
case Chassis::btn8: sw1 &= 0xf8; sw1 |= 0x02; break;
|
||||
case Chassis::btn4: sw1 &= 0xf8; sw1 |= 0x04; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void DistrhoUIchassis::onDisplay() {
|
||||
const GraphicsContext& context(getGraphicsContext());
|
||||
fImgBackground.draw(context);
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
START_NAMESPACE_DISTRHO
|
||||
|
||||
class DistrhoUIchassis : public UI,
|
||||
public ImageSlider::Callback {
|
||||
public ImageSlider::Callback,
|
||||
public ImageButton::Callback {
|
||||
public:
|
||||
DistrhoUIchassis();
|
||||
~DistrhoUIchassis() override;
|
||||
|
@ -22,6 +23,8 @@ class DistrhoUIchassis : public UI,
|
|||
void imageSliderDragFinished(ImageSlider* slider) override;
|
||||
void imageSliderValueChanged(ImageSlider* slider, float value) override;
|
||||
|
||||
void imageButtonClicked(ImageButton *imageButton, int button) override;
|
||||
|
||||
private:
|
||||
Image fImgBackground;
|
||||
Image fImgLedOn;
|
||||
|
|
Loading…
Reference in New Issue