Updated options panel and random things in the UI

This commit is contained in:
Paul Fd 2021-11-12 00:03:30 +01:00
parent 862d057bdb
commit 3a882b98d7
3 changed files with 329 additions and 218 deletions

View file

@ -3,11 +3,11 @@ version 1.0304
header_name {.h} header_name {.h}
code_name {.cxx} code_name {.cxx}
widget_class mainView {open widget_class mainView {open
xywh {108 91 800 475} type Double xywh {607 439 800 475} type Double
class LogicalGroup visible class LogicalGroup visible
} { } {
Fl_Box imageContainer_ { Fl_Box imageContainer_ {
image {../resources/background.png} xywh {5 110 790 285} image {../resources/background.png} xywh {90 110 790 285}
class Background class Background
} }
Fl_Group {} { Fl_Group {} {
@ -15,7 +15,7 @@ widget_class mainView {open
xywh {0 0 814 110} xywh {0 0 814 110}
class LogicalGroup class LogicalGroup
} { } {
Fl_Group {} {open Fl_Group {} {
xywh {5 4 175 101} box ROUNDED_BOX align 0 xywh {5 4 175 101} box ROUNDED_BOX align 0
class RoundedGroup class RoundedGroup
} { } {
@ -45,7 +45,7 @@ widget_class mainView {open
class HomeButton class HomeButton
} }
} }
Fl_Group {} {open Fl_Group {} {
xywh {185 5 390 100} box ROUNDED_BOX xywh {185 5 390 100} box ROUNDED_BOX
class RoundedGroup class RoundedGroup
} { } {
@ -126,7 +126,7 @@ widget_class mainView {open
class ChevronValueDropDown class ChevronValueDropDown
} }
} }
Fl_Group {} {open Fl_Group {} {
xywh {580 5 215 100} box ROUNDED_BOX xywh {580 5 215 100} box ROUNDED_BOX
class RoundedGroup class RoundedGroup
} { } {
@ -155,17 +155,17 @@ widget_class mainView {open
xywh {739 10 23 90} box BORDER_BOX xywh {739 10 23 90} box BORDER_BOX
class VMeter class VMeter
} }
Fl_Box {meters_[1]} {selected Fl_Box {meters_[1]} {
xywh {763 10 23 90} box BORDER_BOX xywh {763 10 23 90} box BORDER_BOX
class VMeter class VMeter
} }
} }
} }
Fl_Group {subPanels_[kPanelInfo]} { Fl_Group {subPanels_[kPanelInfo]} {open
xywh {5 110 790 285} hide xywh {5 110 790 285} hide
class LogicalGroup class LogicalGroup
} { } {
Fl_Group {} {open Fl_Group {} {
xywh {5 110 790 285} box ROUNDED_BOX xywh {5 110 790 285} box ROUNDED_BOX
class RoundedGroup class RoundedGroup
} { } {
@ -225,7 +225,7 @@ widget_class mainView {open
xywh {5 110 790 285} hide xywh {5 110 790 285} hide
class LogicalGroup class LogicalGroup
} { } {
Fl_Group {} {open Fl_Group {} {
xywh {5 110 790 285} box ROUNDED_BOX xywh {5 110 790 285} box ROUNDED_BOX
class RoundedGroup class RoundedGroup
} { } {
@ -235,150 +235,205 @@ widget_class mainView {open
} {} } {}
} }
} }
Fl_Group {subPanels_[kPanelSettings]} { Fl_Group {subPanels_[kPanelSettings]} {open
xywh {5 110 790 285} xywh {0 110 825 360}
class LogicalGroup class LogicalGroup
} { } {
Fl_Group {} { Fl_Group {} {open
label Engine open xywh {5 110 790 285} box ROUNDED_BOX
xywh {305 135 195 100} box ROUNDED_BOX labelsize 12 align 17 class RoundedGroup
class TitleGroup
} { } {
Fl_Spinner oversamplingSlider_ { Fl_Spinner oversamplingSlider_ {
comment {tag=kTagSetOversampling} comment {tag=kTagSetOversampling}
xywh {330 195 60 25} labelsize 12 textsize 12 xywh {175 185 70 25} labelsize 12 textsize 12
class ValueMenu class ValueMenu
} }
Fl_Box {} { Fl_Box {} {
label Oversampling label Oversampling
xywh {320 155 80 25} labelsize 12 xywh {20 185 85 25} labelsize 12 align 20
class ValueLabel class Label
} }
Fl_Box {} { Fl_Box {} {
label {Preload size} label {Preload size}
xywh {405 155 80 25} labelsize 12 xywh {20 160 75 25} labelsize 12 align 20
class ValueLabel class Label
} }
Fl_Spinner preloadSizeSlider_ { Fl_Spinner preloadSizeSlider_ {
comment {tag=kTagSetPreloadSize} comment {tag=kTagSetPreloadSize}
xywh {415 195 60 25} labelsize 12 textsize 12 xywh {175 160 70 25} labelsize 12 textsize 12
class ValueMenu class ValueMenu
} }
}
Fl_Group {} {
label Tuning open
xywh {175 270 415 100} box ROUNDED_BOX labelsize 12 align 17
class TitleGroup
} {
Fl_Box {} {
label {Root key}
xywh {330 290 80 25} labelsize 12
class ValueLabel
}
Fl_Spinner tuningFrequencySlider_ {
comment {tag=kTagSetTuningFrequency}
xywh {425 330 60 25} labelsize 12 textsize 12
class ValueMenu
}
Fl_Box {} {
label Frequency
xywh {415 290 80 25} labelsize 12
class ValueLabel
}
Fl_Dial stretchedTuningSlider_ {
comment {tag=kTagSetStretchedTuning}
xywh {515 315 48 48} value 0.5
class StyledKnob
}
Fl_Box {} {
label Stretch
xywh {500 290 80 25} labelsize 12
class ValueLabel
}
Fl_Box {} {
label {Scala file}
xywh {195 290 100 25} labelsize 12
class ValueLabel
}
Fl_Button scalaFileButton_ {
label DefaultScale
comment {tag=kTagLoadScalaFile}
xywh {195 330 100 25} labelsize 12
class ValueButton
}
Fl_Spinner scalaRootKeySlider_ {
comment {tag=kTagSetScalaRootKey}
xywh {340 330 35 25} labelsize 12 textsize 12
class ValueMenu
}
Fl_Spinner scalaRootOctaveSlider_ {
comment {tag=kTagSetScalaRootKey}
xywh {375 330 30 25} labelsize 12 textsize 12
class ValueMenu
}
Fl_Button scalaResetButton_ {
comment {tag=kTagResetScalaFile}
xywh {295 330 25 25} labelsize 12
class ResetSomethingButton
}
}
Fl_Group userFilesGroup_ {
label Files open
xywh {620 270 139 100} box ROUNDED_BOX labelsize 12 align 17
class TitleGroup
} {
Fl_Box {} {
label {User SFZ folder}
xywh {640 290 100 25} labelsize 12
class ValueLabel
}
Fl_Button userFilesDirButton_ {
label DefaultPath
comment {tag=kTagChooseUserFilesDir}
xywh {640 330 100 25} labelsize 12
class ValueButton
}
}
Fl_Group {} {
label Quality open
xywh {530 135 195 100} box ROUNDED_BOX labelsize 12 align 17
class TitleGroup
} {
Fl_Spinner sampleQualitySlider_ { Fl_Spinner sampleQualitySlider_ {
comment {tag=kTagSetSampleQuality} comment {tag=kTagSetSampleQuality}
xywh {545 195 80 25} labelsize 12 textsize 12 xywh {435 145 80 25} labelsize 12 textsize 12
class ValueMenu class ValueMenu
} }
Fl_Box {} { Fl_Box {} {
label Sample label Sample
xywh {545 155 80 25} labelsize 12 xywh {290 145 50 25} labelsize 12 align 20
class ValueLabel class Label
} }
Fl_Box {} { Fl_Box {} {
label Oscillator label Oscillator
xywh {630 155 80 25} labelsize 12 xywh {290 170 60 25} labelsize 12 align 20
class ValueLabel class Label
} }
Fl_Spinner oscillatorQualitySlider_ { Fl_Spinner oscillatorQualitySlider_ {
comment {tag=kTagSetOscillatorQuality} comment {tag=kTagSetOscillatorQuality}
xywh {630 195 80 25} labelsize 12 textsize 12 xywh {435 170 80 25} labelsize 12 textsize 12
class ValueMenu class ValueMenu
} }
}
Fl_Group {} {
label Appearance open
xywh {40 270 105 100} box ROUNDED_BOX labelsize 12 align 17
class TitleGroup
} {
Fl_Spinner themeMenu_ { Fl_Spinner themeMenu_ {
comment {tag=kTagThemeMenu} comment {tag=kTagThemeMenu}
xywh {60 330 65 25} labelsize 12 textsize 12 xywh {680 145 100 25} labelsize 12 textsize 12
class OptionMenu class OptionMenu
} }
Fl_Box {} { Fl_Box {} {
label Theme label Theme
xywh {50 295 80 25} labelsize 12 xywh {555 145 45 25} labelsize 12 align 20
class ValueLabel class Label
}
Fl_Box {} {
label {User SFZ folder}
xywh {555 170 95 25} labelsize 12 align 20
class Label
}
Fl_Button userFilesDirButton_ {
label DefaultPath
comment {tag=kTagChooseUserFilesDir}
xywh {680 170 100 25} labelsize 12
class ValueButton
}
Fl_Box {} {
label {Root key}
xywh {290 285 60 25} labelsize 12 align 20
class Label
}
Fl_Box {} {
label Frequency
xywh {290 310 70 25} labelsize 12 align 20
class Label
}
Fl_Dial stretchedTuningSlider_ {
comment {tag=kTagSetStretchedTuning}
xywh {455 337 48 48} value 0.5
class StyledKnob
}
Fl_Box {} {
label Stretch
xywh {290 345 50 25} labelsize 12 align 20
class Label
}
Fl_Box {} {
label {Scala file}
xywh {290 260 60 25} labelsize 12 align 20
class Label
}
Fl_Button scalaFileButton_ {
label DefaultScale
comment {tag=kTagLoadScalaFile}
xywh {390 260 100 25} labelsize 12
class ValueButton
}
Fl_Spinner scalaRootKeySlider_ {
comment {tag=kTagSetScalaRootKey}
xywh {450 285 35 25} labelsize 12 textsize 12
class ValueMenu
}
Fl_Spinner scalaRootOctaveSlider_ {
comment {tag=kTagSetScalaRootKey}
xywh {485 285 30 25} labelsize 12 textsize 12
class ValueMenu
}
Fl_Button scalaResetButton_ {
comment {tag=kTagResetScalaFile}
xywh {490 260 25 25} labelsize 12
class ResetSomethingButton
}
Fl_Box {} {
label Freewheeling
xywh {290 195 85 25} labelsize 12 align 20
class Label
}
Fl_Spinner freewheelingQualitySlider_ {
comment {tag=kTagSetOscillatorQuality}
xywh {435 195 80 25} labelsize 12 textsize 12
class ValueMenu
}
Fl_Box {} {
label {Release cancels sustain}
xywh {20 210 145 25} labelsize 12 align 20
class Label
}
Fl_Check_Button {} {
xywh {205 210 25 25} down_box DOWN_BOX
class Checkbox
}
Fl_Box sfizzVersionLabel_ {
label SFIZZ_VERSION
xywh {20 140 225 20} labelsize 10
class Label
}
Fl_Box {} {
label {Rendering quality}
xywh {290 115 110 25} labelsize 12 align 20
class Label
}
Fl_Box {} {
label {Separator 2}
xywh {20 135 225 5} box BORDER_BOX labeltype NO_LABEL
class HLine
}
Fl_Box {} {
label {Engine options}
xywh {20 115 95 25} labelsize 12 align 20
class Label
}
Fl_Box {} {
label {Separator 2}
xywh {580 135 185 5} box BORDER_BOX labeltype NO_LABEL
class HLine
}
Fl_Box {} {
label Other
xywh {555 115 40 25} labelsize 12 align 20
class Label
}
Fl_Box {} {
label Tuning
xywh {290 230 225 25} labelsize 12 align 20
class Label
}
Fl_Box {} {
label {Separator 2}
xywh {290 135 225 5} box BORDER_BOX labeltype NO_LABEL
class HLine
}
Fl_Box {} {
label {Separator 2}
xywh {555 135 225 5} box BORDER_BOX labeltype NO_LABEL
class HLine
}
Fl_Box {} {
label {Separator 2}
xywh {290 250 225 5} box BORDER_BOX labeltype NO_LABEL
class HLine
}
Fl_Button tuningFrequencyDropdown_ {
comment {tag=kTagSetTuningFrequency}
xywh {490 310 25 25} labelsize 24
class ChevronValueDropDown
}
Fl_Text_Editor tuningFrequencyEdit_ {
comment {tag=kTagSetTuningFrequency}
xywh {430 310 60 25} labelsize 12
class TextEdit
}
Fl_Button settingsAboutButton_ {
label {About sfizz}
comment {tag=kTagAbout} selected
xywh {610 205 115 25} labelsize 12
class ValueButton
} }
} }
} }

View file

@ -10,6 +10,7 @@
#include "GUIComponents.h" #include "GUIComponents.h"
#include "GUIHelpers.h" #include "GUIHelpers.h"
#include "GUIPiano.h" #include "GUIPiano.h"
#include "GitBuildId.h"
#include "DlgAbout.h" #include "DlgAbout.h"
#include "ImageHelpers.h" #include "ImageHelpers.h"
#include "NativeHelpers.h" #include "NativeHelpers.h"
@ -20,6 +21,7 @@
#include <absl/strings/string_view.h> #include <absl/strings/string_view.h>
#include <absl/strings/match.h> #include <absl/strings/match.h>
#include <absl/strings/ascii.h> #include <absl/strings/ascii.h>
#include <absl/strings/str_cat.h>
#include <absl/strings/numbers.h> #include <absl/strings/numbers.h>
#include <ghc/fs_std.hpp> #include <ghc/fs_std.hpp>
#include <array> #include <array>
@ -96,6 +98,8 @@ struct Editor::Impl : EditorController::Receiver,
kTagSetStretchedTuning, kTagSetStretchedTuning,
kTagSetSampleQuality, kTagSetSampleQuality,
kTagSetOscillatorQuality, kTagSetOscillatorQuality,
kTagSetFreewheelingQuality,
kTagSetReleaseCancelsSustain,
kTagSetCCVolume, kTagSetCCVolume,
kTagSetCCPan, kTagSetCCPan,
kTagChooseUserFilesDir, kTagChooseUserFilesDir,
@ -120,12 +124,15 @@ struct Editor::Impl : EditorController::Receiver,
SValueMenu *scalaRootKeySlider_ = nullptr; SValueMenu *scalaRootKeySlider_ = nullptr;
SValueMenu *scalaRootOctaveSlider_ = nullptr; SValueMenu *scalaRootOctaveSlider_ = nullptr;
CTextLabel* scalaRootKeyLabel_ = nullptr; CTextLabel* scalaRootKeyLabel_ = nullptr;
SValueMenu *tuningFrequencySlider_ = nullptr; SValueMenu* tuningFrequencyDropdown_ = nullptr;
CTextEdit* tuningFrequencyEdit_ = nullptr;
STextButton *settingsAboutButton_ = nullptr;
CTextLabel* tuningFrequencyLabel_ = nullptr; CTextLabel* tuningFrequencyLabel_ = nullptr;
CControl *stretchedTuningSlider_ = nullptr; CControl *stretchedTuningSlider_ = nullptr;
CTextLabel* stretchedTuningLabel_ = nullptr; CTextLabel* stretchedTuningLabel_ = nullptr;
SValueMenu *sampleQualitySlider_ = nullptr; SValueMenu *sampleQualitySlider_ = nullptr;
SValueMenu *oscillatorQualitySlider_ = nullptr; SValueMenu *oscillatorQualitySlider_ = nullptr;
SValueMenu *freewheelingQualitySlider_ = nullptr;
CTextLabel* keyswitchLabel_ = nullptr; CTextLabel* keyswitchLabel_ = nullptr;
CTextLabel* keyswitchInactiveLabel_ = nullptr; CTextLabel* keyswitchInactiveLabel_ = nullptr;
CTextLabel* keyswitchBadge_ = nullptr; CTextLabel* keyswitchBadge_ = nullptr;
@ -161,6 +168,8 @@ struct Editor::Impl : EditorController::Receiver,
SharedPointer<CBitmap> backgroundBitmap_; SharedPointer<CBitmap> backgroundBitmap_;
SharedPointer<CBitmap> defaultBackgroundBitmap_; SharedPointer<CBitmap> defaultBackgroundBitmap_;
CTextLabel* sfizzVersionLabel_ = nullptr;
SKnobCCBox* getSecondaryCCKnob(unsigned cc) SKnobCCBox* getSecondaryCCKnob(unsigned cc)
{ {
switch (cc) { switch (cc) {
@ -219,7 +228,6 @@ struct Editor::Impl : EditorController::Receiver,
void updateOversamplingLabel(int oversamplingLog2); void updateOversamplingLabel(int oversamplingLog2);
void updatePreloadSizeLabel(int preloadSize); void updatePreloadSizeLabel(int preloadSize);
void updateScalaRootKeyLabel(int rootKey); void updateScalaRootKeyLabel(int rootKey);
void updateTuningFrequencyLabel(float tuningFrequency);
void updateStretchedTuningLabel(float stretchedTuning); void updateStretchedTuningLabel(float stretchedTuning);
absl::string_view getCurrentKeyswitchName() const; absl::string_view getCurrentKeyswitchName() const;
@ -410,9 +418,8 @@ void Editor::Impl::uiReceiveValue(EditId id, const EditValue& v)
case EditId::TuningFrequency: case EditId::TuningFrequency:
{ {
const float value = v.to_float(); const float value = v.to_float();
if (tuningFrequencySlider_) if (tuningFrequencyEdit_)
tuningFrequencySlider_->setValue(value); tuningFrequencyEdit_->setValue(value);
updateTuningFrequencyLabel(value);
} }
break; break;
case EditId::StretchTuning: case EditId::StretchTuning:
@ -695,6 +702,7 @@ void Editor::Impl::createFrameContents()
}); });
return box; return box;
}; };
#if 0
auto createTitleGroup = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign, int fontsize) { auto createTitleGroup = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign, int fontsize) {
auto* box = new STitleContainer(bounds, label); auto* box = new STitleContainer(bounds, label);
box->setCornerRadius(10.0); box->setCornerRadius(10.0);
@ -707,6 +715,7 @@ void Editor::Impl::createFrameContents()
box->setTitleFont(font); box->setTitleFont(font);
return box; return box;
}; };
#endif
auto createAboutButton = [this, &iconShaded](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) { auto createAboutButton = [this, &iconShaded](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
return new CKickButton(bounds, this, tag, 0.0f, iconShaded); return new CKickButton(bounds, this, tag, 0.0f, iconShaded);
}; };
@ -734,11 +743,13 @@ void Editor::Impl::createFrameContents()
lbl->setFont(font); lbl->setFont(font);
return lbl; return lbl;
}; };
auto createHLine = [](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { auto createHLine = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
int y = static_cast<int>(0.5 * (bounds.top + bounds.bottom)); int y = static_cast<int>(0.5 * (bounds.top + bounds.bottom));
CRect lineBounds(bounds.left, y, bounds.right, y + 1); CRect lineBounds(bounds.left, y, bounds.right, y + 1);
CViewContainer* hline = new CViewContainer(lineBounds); CViewContainer* hline = new CViewContainer(lineBounds);
hline->setBackgroundColor(CColor(0xff, 0xff, 0xff, 0xff)); OnThemeChanged.push_back([hline, palette]() {
hline->setBackgroundColor(palette->text);
});
return hline; return hline;
}; };
auto createValueLabel = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { auto createValueLabel = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
@ -767,15 +778,7 @@ void Editor::Impl::createFrameContents()
lbl->setFont(font); lbl->setFont(font);
return lbl; return lbl;
}; };
#if 0
auto createButton = [this](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) {
CTextButton* button = new CTextButton(bounds, this, tag, label);
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
button->setFont(font);
button->setTextAlignment(align);
return button;
};
#endif
auto createClickableLabel = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) { auto createClickableLabel = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) {
STextButton* button = new STextButton(bounds, this, tag, label); STextButton* button = new STextButton(bounds, this, tag, label);
auto font = makeOwned<CFontDesc>("Roboto", fontsize); auto font = makeOwned<CFontDesc>("Roboto", fontsize);
@ -982,6 +985,26 @@ void Editor::Impl::createFrameContents()
return panel; return panel;
}; };
auto createCheckbox = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int) {
auto* checkbox = new CCheckBox(bounds, this, tag, label);
return checkbox;
};
auto createTextEdit = [this, &palette] (const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) {
auto* edit = new CTextEdit(bounds, this, tag, label, nullptr);
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
edit->setFont(font);
edit->setHoriAlign(align);
edit->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
edit->setStyle(CParamDisplay::kRoundRectStyle);
edit->setRoundRectRadius(5.0);
OnThemeChanged.push_back([edit, palette]() {
edit->setFontColor(palette->valueText);
edit->setBackColor(palette->valueBackground);
});
return edit;
};
#include "layout/main.hpp" #include "layout/main.hpp"
OnThemeChanged.push_back([mainView, theme]() { OnThemeChanged.push_back([mainView, theme]() {
@ -1025,6 +1048,11 @@ void Editor::Impl::createFrameContents()
mainView_ = owned(mainView); mainView_ = owned(mainView);
} }
if (CTextLabel* label = sfizzVersionLabel_) {
std::string version = GitBuildId[0] ? absl::StrCat(SFIZZ_VERSION ".", GitBuildId) : SFIZZ_VERSION;
label->setText(absl::StrCat(u8"sfizz ", version));
}
/// ///
currentThemeName_ = theme->loadCurrentName(); currentThemeName_ = theme->loadCurrentName();
theme->load(currentThemeName_); theme->load(currentThemeName_);
@ -1061,8 +1089,9 @@ void Editor::Impl::createFrameContents()
scalaRootOctaveSlider_->setDefaultValue( scalaRootOctaveSlider_->setDefaultValue(
static_cast<int>(EditRange::get(EditId::ScalaRootKey).def) / 12); static_cast<int>(EditRange::get(EditId::ScalaRootKey).def) / 12);
} }
adjustMinMaxToEditRange(tuningFrequencySlider_, EditId::TuningFrequency); adjustMinMaxToEditRange(tuningFrequencyDropdown_, EditId::TuningFrequency);
tuningFrequencySlider_->setWheelInc(0.1f / EditRange::get(EditId::TuningFrequency).extent()); adjustMinMaxToEditRange(tuningFrequencyEdit_, EditId::TuningFrequency);
tuningFrequencyEdit_->setWheelInc(0.1f / EditRange::get(EditId::TuningFrequency).extent());
adjustMinMaxToEditRange(stretchedTuningSlider_, EditId::StretchTuning); adjustMinMaxToEditRange(stretchedTuningSlider_, EditId::StretchTuning);
adjustMinMaxToEditRange(sampleQualitySlider_, EditId::SampleQuality); adjustMinMaxToEditRange(sampleQualitySlider_, EditId::SampleQuality);
adjustMinMaxToEditRange(oscillatorQualitySlider_, EditId::OscillatorQuality); adjustMinMaxToEditRange(oscillatorQualitySlider_, EditId::OscillatorQuality);
@ -1110,14 +1139,25 @@ void Editor::Impl::createFrameContents()
}; };
for (std::pair<float, const char*> value : tuningFrequencies) for (std::pair<float, const char*> value : tuningFrequencies)
tuningFrequencySlider_->addEntry(value.second, value.first); tuningFrequencyDropdown_->addEntry(value.second, value.first);
tuningFrequencySlider_->setValueToStringFunction(
tuningFrequencyEdit_->setValueToStringFunction(
[](float value, char result[256], CParamDisplay*) -> bool [](float value, char result[256], CParamDisplay*) -> bool
{ {
sprintf(result, "%.1f Hz", value); sprintf(result, "%.1f Hz", value);
return true; return true;
}); });
tuningFrequencyEdit_->setStringToValueFunction([](UTF8StringPtr txt, float& result, CTextEdit*) -> bool {
float value;
if (absl::SimpleAtof(txt, &value)) {
result = value;
return true;
}
return false;
});
static const char* notesInOctave[12] = { static const char* notesInOctave[12] = {
"C", "C#", "D", "D#", "E", "C", "C#", "D", "D#", "E",
"F", "F#", "G", "G#", "A", "A#", "B", "F", "F#", "G", "G#", "A", "A#", "B",
@ -1616,18 +1656,6 @@ void Editor::Impl::updateScalaRootKeyLabel(int rootKey)
label->setText(noteName(rootKey)); label->setText(noteName(rootKey));
} }
void Editor::Impl::updateTuningFrequencyLabel(float tuningFrequency)
{
CTextLabel* label = tuningFrequencyLabel_;
if (!label)
return;
char text[64];
sprintf(text, "%.1f", tuningFrequency);
text[sizeof(text) - 1] = '\0';
label->setText(text);
}
void Editor::Impl::updateStretchedTuningLabel(float stretchedTuning) void Editor::Impl::updateStretchedTuningLabel(float stretchedTuning)
{ {
CTextLabel* label = stretchedTuningLabel_; CTextLabel* label = stretchedTuningLabel_;
@ -1962,7 +1990,8 @@ void Editor::Impl::valueChanged(CControl* ctl)
case kTagSetTuningFrequency: case kTagSetTuningFrequency:
ctrl.uiSendValue(EditId::TuningFrequency, value); ctrl.uiSendValue(EditId::TuningFrequency, value);
updateTuningFrequencyLabel(value); if (tuningFrequencyEdit_)
tuningFrequencyEdit_->setValue(value);
break; break;
case kTagSetSampleQuality: case kTagSetSampleQuality:

View file

@ -1,7 +1,7 @@
/* This file is generated by the layout maker tool. */ /* This file is generated by the layout maker tool. */
auto* const view__0 = createLogicalGroup(CRect(0, 0, 800, 475), -1, "", kCenterText, 14); auto* const view__0 = createLogicalGroup(CRect(0, 0, 800, 475), -1, "", kCenterText, 14);
mainView = view__0; mainView = view__0;
auto* const view__1 = createBackground(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); auto* const view__1 = createBackground(CRect(90, 110, 880, 395), -1, "", kCenterText, 14);
imageContainer_ = view__1; imageContainer_ = view__1;
view__0->addView(view__1); view__0->addView(view__1);
enterPalette(invertedPalette); enterPalette(invertedPalette);
@ -128,80 +128,107 @@ view__45->addView(view__46);
auto* const view__47 = createControlsPanel(CRect(0, 0, 790, 285), -1, "", kCenterText, 12); auto* const view__47 = createControlsPanel(CRect(0, 0, 790, 285), -1, "", kCenterText, 12);
controlsPanel_ = view__47; controlsPanel_ = view__47;
view__46->addView(view__47); view__46->addView(view__47);
auto* const view__48 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); auto* const view__48 = createLogicalGroup(CRect(0, 110, 825, 470), -1, "", kCenterText, 14);
subPanels_[kPanelSettings] = view__48; subPanels_[kPanelSettings] = view__48;
view__0->addView(view__48); view__0->addView(view__48);
auto* const view__49 = createTitleGroup(CRect(300, 25, 495, 125), -1, "Engine", kCenterText, 12); auto* const view__49 = createRoundedGroup(CRect(5, 0, 795, 285), -1, "", kCenterText, 14);
view__48->addView(view__49); view__48->addView(view__49);
auto* const view__50 = createValueMenu(CRect(25, 60, 85, 85), kTagSetOversampling, "", kCenterText, 12); auto* const view__50 = createValueMenu(CRect(170, 75, 240, 100), kTagSetOversampling, "", kCenterText, 12);
oversamplingSlider_ = view__50; oversamplingSlider_ = view__50;
view__49->addView(view__50); view__49->addView(view__50);
auto* const view__51 = createValueLabel(CRect(15, 20, 95, 45), -1, "Oversampling", kCenterText, 12); auto* const view__51 = createLabel(CRect(15, 75, 100, 100), -1, "Oversampling", kLeftText, 12);
view__49->addView(view__51); view__49->addView(view__51);
auto* const view__52 = createValueLabel(CRect(100, 20, 180, 45), -1, "Preload size", kCenterText, 12); auto* const view__52 = createLabel(CRect(15, 50, 90, 75), -1, "Preload size", kLeftText, 12);
view__49->addView(view__52); view__49->addView(view__52);
auto* const view__53 = createValueMenu(CRect(110, 60, 170, 85), kTagSetPreloadSize, "", kCenterText, 12); auto* const view__53 = createValueMenu(CRect(170, 50, 240, 75), kTagSetPreloadSize, "", kCenterText, 12);
preloadSizeSlider_ = view__53; preloadSizeSlider_ = view__53;
view__49->addView(view__53); view__49->addView(view__53);
auto* const view__54 = createTitleGroup(CRect(170, 160, 585, 260), -1, "Tuning", kCenterText, 12); auto* const view__54 = createValueMenu(CRect(430, 35, 510, 60), kTagSetSampleQuality, "", kCenterText, 12);
view__48->addView(view__54); sampleQualitySlider_ = view__54;
auto* const view__55 = createValueLabel(CRect(155, 20, 235, 45), -1, "Root key", kCenterText, 12); view__49->addView(view__54);
view__54->addView(view__55); auto* const view__55 = createLabel(CRect(285, 35, 335, 60), -1, "Sample", kLeftText, 12);
auto* const view__56 = createValueMenu(CRect(250, 60, 310, 85), kTagSetTuningFrequency, "", kCenterText, 12); view__49->addView(view__55);
tuningFrequencySlider_ = view__56; auto* const view__56 = createLabel(CRect(285, 60, 345, 85), -1, "Oscillator", kLeftText, 12);
view__54->addView(view__56); view__49->addView(view__56);
auto* const view__57 = createValueLabel(CRect(240, 20, 320, 45), -1, "Frequency", kCenterText, 12); auto* const view__57 = createValueMenu(CRect(430, 60, 510, 85), kTagSetOscillatorQuality, "", kCenterText, 12);
view__54->addView(view__57); oscillatorQualitySlider_ = view__57;
auto* const view__58 = createStyledKnob(CRect(340, 45, 388, 93), kTagSetStretchedTuning, "", kCenterText, 14); view__49->addView(view__57);
stretchedTuningSlider_ = view__58; auto* const view__58 = createOptionMenu(CRect(675, 35, 775, 60), kTagThemeMenu, "", kCenterText, 12);
view__54->addView(view__58); themeMenu_ = view__58;
auto* const view__59 = createValueLabel(CRect(325, 20, 405, 45), -1, "Stretch", kCenterText, 12); view__49->addView(view__58);
view__54->addView(view__59); auto* const view__59 = createLabel(CRect(550, 35, 595, 60), -1, "Theme", kLeftText, 12);
auto* const view__60 = createValueLabel(CRect(20, 20, 120, 45), -1, "Scala file", kCenterText, 12); view__49->addView(view__59);
view__54->addView(view__60); auto* const view__60 = createLabel(CRect(550, 60, 645, 85), -1, "User SFZ folder", kLeftText, 12);
auto* const view__61 = createValueButton(CRect(20, 60, 120, 85), kTagLoadScalaFile, "DefaultScale", kCenterText, 12); view__49->addView(view__60);
scalaFileButton_ = view__61; auto* const view__61 = createValueButton(CRect(675, 60, 775, 85), kTagChooseUserFilesDir, "DefaultPath", kCenterText, 12);
view__54->addView(view__61); userFilesDirButton_ = view__61;
auto* const view__62 = createValueMenu(CRect(165, 60, 200, 85), kTagSetScalaRootKey, "", kCenterText, 12); view__49->addView(view__61);
scalaRootKeySlider_ = view__62; auto* const view__62 = createLabel(CRect(285, 175, 345, 200), -1, "Root key", kLeftText, 12);
view__54->addView(view__62); view__49->addView(view__62);
auto* const view__63 = createValueMenu(CRect(200, 60, 230, 85), kTagSetScalaRootKey, "", kCenterText, 12); auto* const view__63 = createLabel(CRect(285, 200, 355, 225), -1, "Frequency", kLeftText, 12);
scalaRootOctaveSlider_ = view__63; view__49->addView(view__63);
view__54->addView(view__63); auto* const view__64 = createStyledKnob(CRect(450, 227, 498, 275), kTagSetStretchedTuning, "", kCenterText, 14);
auto* const view__64 = createResetSomethingButton(CRect(120, 60, 145, 85), kTagResetScalaFile, "", kCenterText, 12); stretchedTuningSlider_ = view__64;
scalaResetButton_ = view__64; view__49->addView(view__64);
view__54->addView(view__64); auto* const view__65 = createLabel(CRect(285, 235, 335, 260), -1, "Stretch", kLeftText, 12);
auto* const view__65 = createTitleGroup(CRect(615, 160, 754, 260), -1, "Files", kCenterText, 12); view__49->addView(view__65);
userFilesGroup_ = view__65; auto* const view__66 = createLabel(CRect(285, 150, 345, 175), -1, "Scala file", kLeftText, 12);
view__48->addView(view__65); view__49->addView(view__66);
auto* const view__66 = createValueLabel(CRect(20, 20, 120, 45), -1, "User SFZ folder", kCenterText, 12); auto* const view__67 = createValueButton(CRect(385, 150, 485, 175), kTagLoadScalaFile, "DefaultScale", kCenterText, 12);
view__65->addView(view__66); scalaFileButton_ = view__67;
auto* const view__67 = createValueButton(CRect(20, 60, 120, 85), kTagChooseUserFilesDir, "DefaultPath", kCenterText, 12); view__49->addView(view__67);
userFilesDirButton_ = view__67; auto* const view__68 = createValueMenu(CRect(445, 175, 480, 200), kTagSetScalaRootKey, "", kCenterText, 12);
view__65->addView(view__67); scalaRootKeySlider_ = view__68;
auto* const view__68 = createTitleGroup(CRect(525, 25, 720, 125), -1, "Quality", kCenterText, 12); view__49->addView(view__68);
view__48->addView(view__68); auto* const view__69 = createValueMenu(CRect(480, 175, 510, 200), kTagSetScalaRootKey, "", kCenterText, 12);
auto* const view__69 = createValueMenu(CRect(15, 60, 95, 85), kTagSetSampleQuality, "", kCenterText, 12); scalaRootOctaveSlider_ = view__69;
sampleQualitySlider_ = view__69; view__49->addView(view__69);
view__68->addView(view__69); auto* const view__70 = createResetSomethingButton(CRect(485, 150, 510, 175), kTagResetScalaFile, "", kCenterText, 12);
auto* const view__70 = createValueLabel(CRect(15, 20, 95, 45), -1, "Sample", kCenterText, 12); scalaResetButton_ = view__70;
view__68->addView(view__70); view__49->addView(view__70);
auto* const view__71 = createValueLabel(CRect(100, 20, 180, 45), -1, "Oscillator", kCenterText, 12); auto* const view__71 = createLabel(CRect(285, 85, 370, 110), -1, "Freewheeling", kLeftText, 12);
view__68->addView(view__71); view__49->addView(view__71);
auto* const view__72 = createValueMenu(CRect(100, 60, 180, 85), kTagSetOscillatorQuality, "", kCenterText, 12); auto* const view__72 = createValueMenu(CRect(430, 85, 510, 110), kTagSetOscillatorQuality, "", kCenterText, 12);
oscillatorQualitySlider_ = view__72; freewheelingQualitySlider_ = view__72;
view__68->addView(view__72); view__49->addView(view__72);
auto* const view__73 = createTitleGroup(CRect(35, 160, 140, 260), -1, "Appearance", kCenterText, 12); auto* const view__73 = createLabel(CRect(15, 100, 160, 125), -1, "Release cancels sustain", kLeftText, 12);
view__48->addView(view__73); view__49->addView(view__73);
auto* const view__74 = createOptionMenu(CRect(20, 60, 85, 85), kTagThemeMenu, "", kCenterText, 12); auto* const view__74 = createCheckbox(CRect(200, 100, 225, 125), -1, "", kCenterText, 14);
themeMenu_ = view__74; view__49->addView(view__74);
view__73->addView(view__74); auto* const view__75 = createLabel(CRect(15, 30, 240, 50), -1, "SFIZZ_VERSION", kCenterText, 10);
auto* const view__75 = createValueLabel(CRect(10, 25, 90, 50), -1, "Theme", kCenterText, 12); sfizzVersionLabel_ = view__75;
view__73->addView(view__75); view__49->addView(view__75);
auto* const view__76 = createPiano(CRect(5, 400, 795, 470), -1, "", kCenterText, 12); auto* const view__76 = createLabel(CRect(285, 5, 395, 30), -1, "Rendering quality", kLeftText, 12);
piano_ = view__76; view__49->addView(view__76);
view__0->addView(view__76); auto* const view__77 = createHLine(CRect(15, 25, 240, 30), -1, "", kCenterText, 14);
auto* const view__77 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); view__49->addView(view__77);
subPanels_[kPanelGeneral] = view__77; auto* const view__78 = createLabel(CRect(15, 5, 110, 30), -1, "Engine options", kLeftText, 12);
view__0->addView(view__77); view__49->addView(view__78);
view__77->setVisible(false); auto* const view__79 = createHLine(CRect(575, 25, 760, 30), -1, "", kCenterText, 14);
view__49->addView(view__79);
auto* const view__80 = createLabel(CRect(550, 5, 590, 30), -1, "Other", kLeftText, 12);
view__49->addView(view__80);
auto* const view__81 = createLabel(CRect(285, 120, 510, 145), -1, "Tuning", kLeftText, 12);
view__49->addView(view__81);
auto* const view__82 = createHLine(CRect(285, 25, 510, 30), -1, "", kCenterText, 14);
view__49->addView(view__82);
auto* const view__83 = createHLine(CRect(550, 25, 775, 30), -1, "", kCenterText, 14);
view__49->addView(view__83);
auto* const view__84 = createHLine(CRect(285, 140, 510, 145), -1, "", kCenterText, 14);
view__49->addView(view__84);
auto* const view__85 = createChevronValueDropDown(CRect(485, 200, 510, 225), kTagSetTuningFrequency, "", kCenterText, 24);
tuningFrequencyDropdown_ = view__85;
view__49->addView(view__85);
auto* const view__86 = createTextEdit(CRect(425, 200, 485, 225), kTagSetTuningFrequency, "", kCenterText, 12);
tuningFrequencyEdit_ = view__86;
view__49->addView(view__86);
auto* const view__87 = createValueButton(CRect(605, 95, 720, 120), kTagAbout, "About sfizz", kCenterText, 12);
settingsAboutButton_ = view__87;
view__49->addView(view__87);
auto* const view__88 = createPiano(CRect(5, 400, 795, 470), -1, "", kCenterText, 12);
piano_ = view__88;
view__0->addView(view__88);
auto* const view__89 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14);
subPanels_[kPanelGeneral] = view__89;
view__0->addView(view__89);
view__89->setVisible(false);