Volume and Pan knobs at top-right corner
This commit is contained in:
parent
b71d56fc2e
commit
73ab9f4858
4 changed files with 77 additions and 23 deletions
|
|
@ -3,7 +3,7 @@ version 1.0305
|
|||
header_name {.h}
|
||||
code_name {.cxx}
|
||||
widget_class mainView {open
|
||||
xywh {571 362 800 475} type Double
|
||||
xywh {659 319 800 475} type Double
|
||||
class LogicalGroup visible
|
||||
} {
|
||||
Fl_Box {} {
|
||||
|
|
@ -121,7 +121,7 @@ widget_class mainView {open
|
|||
class ChevronValueDropDown
|
||||
}
|
||||
}
|
||||
Fl_Group {} {open selected
|
||||
Fl_Group {} {open
|
||||
xywh {570 5 225 100} box ROUNDED_BOX
|
||||
class RoundedGroup
|
||||
} {
|
||||
|
|
@ -134,20 +134,22 @@ widget_class mainView {open
|
|||
xywh {610 70 60 5} labelsize 12 hide
|
||||
class ValueLabel
|
||||
}
|
||||
Fl_Dial volumeSlider_ {
|
||||
comment {tag=kTagSetVolume}
|
||||
xywh {680 20 48 48} value 0.5
|
||||
class StyledKnob
|
||||
}
|
||||
Fl_Box volumeLabel_ {
|
||||
label {0.0 dB}
|
||||
xywh {675 70 60 22} labelsize 12
|
||||
class ValueLabel
|
||||
}
|
||||
Fl_Box {} {
|
||||
xywh {745 20 35 55} box BORDER_BOX
|
||||
class VMeter
|
||||
}
|
||||
Fl_Box volumeCCKnob_ {
|
||||
label Volume
|
||||
comment {tag=kTagSetCCVolume} selected
|
||||
xywh {580 10 70 90} box BORDER_BOX labelsize 12 align 17
|
||||
class KnobCCBox
|
||||
}
|
||||
Fl_Box panCCKnob_ {
|
||||
label Pan
|
||||
comment {tag=kTagSetCCPan}
|
||||
xywh {655 10 70 90} box BORDER_BOX labelsize 12 align 17
|
||||
class KnobCCBox
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Group {subPanels_[kPanelGeneral]} {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ struct Editor::Impl : EditorController::Receiver, IControlListener {
|
|||
kTagPreviousSfzFile,
|
||||
kTagNextSfzFile,
|
||||
kTagFileOperations,
|
||||
kTagSetVolume,
|
||||
kTagSetMainVolume,
|
||||
kTagSetNumVoices,
|
||||
kTagSetOversampling,
|
||||
kTagSetPreloadSize,
|
||||
|
|
@ -82,6 +82,8 @@ struct Editor::Impl : EditorController::Receiver, IControlListener {
|
|||
kTagSetScalaRootKey,
|
||||
kTagSetTuningFrequency,
|
||||
kTagSetStretchedTuning,
|
||||
kTagSetCCVolume,
|
||||
kTagSetCCPan,
|
||||
kTagChooseUserFilesDir,
|
||||
kTagFirstChangePanel,
|
||||
kTagLastChangePanel = kTagFirstChangePanel + kNumPanels - 1,
|
||||
|
|
@ -128,6 +130,18 @@ struct Editor::Impl : EditorController::Receiver, IControlListener {
|
|||
|
||||
SControlsPanel* controlsPanel_ = nullptr;
|
||||
|
||||
SKnobCCBox* volumeCCKnob_ = nullptr;
|
||||
SKnobCCBox* panCCKnob_ = nullptr;
|
||||
|
||||
CControl* getSecondaryCCControl(unsigned cc)
|
||||
{
|
||||
switch (cc) {
|
||||
case 7: return volumeCCKnob_ ? volumeCCKnob_->getControl() : nullptr;
|
||||
case 10: return panCCKnob_ ? panCCKnob_->getControl() : nullptr;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void uiReceiveValue(EditId id, const EditValue& v) override;
|
||||
void uiReceiveMessage(const char* path, const char* sig, const sfizz_arg_t* args) override;
|
||||
|
||||
|
|
@ -826,12 +840,19 @@ void Editor::Impl::createFrameContents()
|
|||
menu->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||
return menu;
|
||||
};
|
||||
auto createKnobCCBox = [this, &theme](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int) {
|
||||
auto createKnobCCBox = [this, &theme](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int fontsize) {
|
||||
SKnobCCBox* box = new SKnobCCBox(bounds, this, tag);
|
||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||
box->setNameLabelText(label);
|
||||
box->setNameLabelFont(font);
|
||||
box->setNameLabelFontColor(theme->text);
|
||||
box->setKnobFont(font);
|
||||
box->setKnobFontColor(theme->text);
|
||||
box->setKnobLineIndicatorColor(theme->knobLineIndicatorColor);
|
||||
box->setValueToStringFunction([](float value, std::string& text) -> bool {
|
||||
text = std::to_string(std::lround(value * 127));
|
||||
return true;
|
||||
});
|
||||
return box;
|
||||
};
|
||||
auto createBackground = [&background](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
||||
|
|
@ -1005,6 +1026,7 @@ void Editor::Impl::createFrameContents()
|
|||
if (SControlsPanel* panel = controlsPanel_) {
|
||||
panel->ValueChangeFunction = [this](uint32_t cc, float value) {
|
||||
performCCValueChange(cc, value);
|
||||
updateCCValue(cc, value);
|
||||
};
|
||||
panel->BeginEditFunction = [this](uint32_t cc) {
|
||||
performCCBeginEdit(cc);
|
||||
|
|
@ -1014,6 +1036,15 @@ void Editor::Impl::createFrameContents()
|
|||
};
|
||||
}
|
||||
|
||||
if (SKnobCCBox* box = volumeCCKnob_) {
|
||||
unsigned ccNumber = 7;
|
||||
box->setCCLabelText(("CC " + std::to_string(ccNumber)).c_str());
|
||||
}
|
||||
if (SKnobCCBox* box = panCCKnob_) {
|
||||
unsigned ccNumber = 10;
|
||||
box->setCCLabelText(("CC " + std::to_string(ccNumber)).c_str());
|
||||
}
|
||||
|
||||
updateKeyswitchNameLabel();
|
||||
|
||||
///
|
||||
|
|
@ -1483,12 +1514,18 @@ void Editor::Impl::updateCCValue(unsigned cc, float value)
|
|||
{
|
||||
if (SControlsPanel* panel = controlsPanel_)
|
||||
panel->setControlValue(cc, value);
|
||||
|
||||
if (CControl* other = getSecondaryCCControl(cc))
|
||||
other->setValue(value);
|
||||
}
|
||||
|
||||
void Editor::Impl::updateCCDefaultValue(unsigned cc, float value)
|
||||
{
|
||||
if (SControlsPanel* panel = controlsPanel_)
|
||||
panel->setControlDefaultValue(cc, value);
|
||||
|
||||
if (CControl* other = getSecondaryCCControl(cc))
|
||||
other->setDefaultValue(value);
|
||||
}
|
||||
|
||||
void Editor::Impl::updateCCLabel(unsigned cc, const char* label)
|
||||
|
|
@ -1652,11 +1689,21 @@ void Editor::Impl::valueChanged(CControl* ctl)
|
|||
changeScalaFile(std::string());
|
||||
break;
|
||||
|
||||
case kTagSetVolume:
|
||||
case kTagSetMainVolume:
|
||||
ctrl.uiSendValue(EditId::Volume, value);
|
||||
updateVolumeLabel(value);
|
||||
break;
|
||||
|
||||
case kTagSetCCVolume:
|
||||
performCCValueChange(7, value);
|
||||
updateCCValue(7, value);
|
||||
break;
|
||||
|
||||
case kTagSetCCPan:
|
||||
performCCValueChange(10, value);
|
||||
updateCCValue(10, value);
|
||||
break;
|
||||
|
||||
case kTagSetNumVoices:
|
||||
ctrl.uiSendValue(EditId::Polyphony, value);
|
||||
updateNumVoicesLabel(static_cast<int>(value));
|
||||
|
|
@ -1717,13 +1764,15 @@ void Editor::Impl::enterOrLeaveEdit(CControl* ctl, bool enter)
|
|||
EditId id;
|
||||
|
||||
switch (tag) {
|
||||
case kTagSetVolume: id = EditId::Volume; break;
|
||||
case kTagSetMainVolume: id = EditId::Volume; break;
|
||||
case kTagSetNumVoices: id = EditId::Polyphony; break;
|
||||
case kTagSetOversampling: id = EditId::Oversampling; break;
|
||||
case kTagSetPreloadSize: id = EditId::PreloadSize; break;
|
||||
case kTagSetScalaRootKey: id = EditId::ScalaRootKey; break;
|
||||
case kTagSetTuningFrequency: id = EditId::TuningFrequency; break;
|
||||
case kTagSetStretchedTuning: id = EditId::StretchTuning; break;
|
||||
case kTagSetCCVolume: id = editIdForCC(7); break;
|
||||
case kTagSetCCPan: id = editIdForCC(10); break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -743,8 +743,11 @@ void SControlsPanel::setControlValue(uint32_t index, float value)
|
|||
{
|
||||
ControlSlot* slot = getOrCreateSlot(index);
|
||||
SKnobCCBox* box = slot->box;
|
||||
box->getControl()->setValue(value);
|
||||
box->invalid();
|
||||
auto* control = box->getControl();
|
||||
float oldValue = control->getValue();
|
||||
control->setValue(value);
|
||||
if (control->getValue() != oldValue)
|
||||
box->invalid();
|
||||
}
|
||||
|
||||
void SControlsPanel::setControlDefaultValue(uint32_t index, float value)
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ view__26->setVisible(false);
|
|||
auto* const view__27 = createValueLabel(CRect(40, 65, 100, 70), -1, "Center", kCenterText, 12);
|
||||
view__25->addView(view__27);
|
||||
view__27->setVisible(false);
|
||||
auto* const view__28 = createStyledKnob(CRect(110, 15, 158, 63), kTagSetVolume, "", kCenterText, 14);
|
||||
volumeSlider_ = view__28;
|
||||
auto* const view__28 = createVMeter(CRect(175, 15, 210, 70), -1, "", kCenterText, 14);
|
||||
view__25->addView(view__28);
|
||||
auto* const view__29 = createValueLabel(CRect(105, 65, 165, 87), -1, "0.0 dB", kCenterText, 12);
|
||||
volumeLabel_ = view__29;
|
||||
auto* const view__29 = createKnobCCBox(CRect(10, 5, 80, 95), kTagSetCCVolume, "Volume", kCenterText, 12);
|
||||
volumeCCKnob_ = view__29;
|
||||
view__25->addView(view__29);
|
||||
auto* const view__30 = createVMeter(CRect(175, 15, 210, 70), -1, "", kCenterText, 14);
|
||||
auto* const view__30 = createKnobCCBox(CRect(85, 5, 155, 95), kTagSetCCPan, "Pan", kCenterText, 12);
|
||||
panCCKnob_ = view__30;
|
||||
view__25->addView(view__30);
|
||||
enterTheme(defaultTheme);
|
||||
auto* const view__31 = createLogicalGroup(CRect(5, 110, 796, 395), -1, "", kCenterText, 14);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue