Browse Source

Patch code to remove login, download, auth, etc

Signed-off-by: falkTX <falktx@falktx.com>
tags/2021-03-15
falkTX 3 years ago
parent
commit
0453fa0ae4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
19 changed files with 25 additions and 551 deletions
  1. +0
    -45
      ports/vitalium/source/common/load_save.cpp
  2. +0
    -4
      ports/vitalium/source/common/load_save.h
  3. +0
    -28
      ports/vitalium/source/interface/editor_components/synth_preset_selector.cpp
  4. +0
    -5
      ports/vitalium/source/interface/editor_components/synth_preset_selector.h
  5. +0
    -14
      ports/vitalium/source/interface/editor_components/wavetable_3d.cpp
  6. +0
    -3
      ports/vitalium/source/interface/editor_components/wavetable_3d.h
  7. +12
    -26
      ports/vitalium/source/interface/editor_sections/about_section.cpp
  8. +1
    -3
      ports/vitalium/source/interface/editor_sections/about_section.h
  9. +3
    -89
      ports/vitalium/source/interface/editor_sections/full_interface.cpp
  10. +1
    -22
      ports/vitalium/source/interface/editor_sections/full_interface.h
  11. +2
    -257
      ports/vitalium/source/interface/editor_sections/oscillator_section.cpp
  12. +2
    -22
      ports/vitalium/source/interface/editor_sections/oscillator_section.h
  13. +1
    -16
      ports/vitalium/source/interface/editor_sections/popup_browser.cpp
  14. +0
    -1
      ports/vitalium/source/interface/editor_sections/popup_browser.h
  15. +2
    -3
      ports/vitalium/source/interface/editor_sections/synthesis_interface.cpp
  16. +1
    -2
      ports/vitalium/source/interface/editor_sections/synthesis_interface.h
  17. +0
    -8
      ports/vitalium/source/interface/look_and_feel/paths.h
  18. +0
    -2
      ports/vitalium/source/unity_build/interface_editor_sections.cpp
  19. +0
    -1
      ports/vitalium/source/unity_build/interface_editor_sections2.cpp

+ 0
- 45
ports/vitalium/source/common/load_save.cpp View File

@@ -1301,18 +1301,6 @@ void LoadSave::saveContentVersion(std::string version) {
saveJsonToConfig(data);
}

void LoadSave::saveUpdateCheckConfig(bool check_for_updates) {
json data = getConfigJson();
data["check_for_updates"] = check_for_updates;
saveJsonToConfig(data);
}

void LoadSave::saveWorkOffline(bool work_offline) {
json data = getConfigJson();
data["work_offline"] = work_offline;
saveJsonToConfig(data);
}

void LoadSave::saveLoadedSkin(const std::string& name) {
json data = getConfigJson();
data["loaded_skin"] = name;
@@ -1331,12 +1319,6 @@ void LoadSave::saveDisplayHzFrequency(bool hz_frequency) {
saveJsonToConfig(data);
}

void LoadSave::saveAuthenticated(bool authenticated) {
json data = getConfigJson();
data["authenticated"] = authenticated;
saveJsonToConfig(data);
}

void LoadSave::saveWindowSize(float window_size) {
json data = getConfigJson();
data["window_size"] = window_size;
@@ -1567,24 +1549,6 @@ int LoadSave::getDaysToExpire() {
#endif
}

bool LoadSave::shouldCheckForUpdates() {
json data = getConfigJson();

if (!data.count("check_for_updates"))
return true;

return data["check_for_updates"];
}

bool LoadSave::shouldWorkOffline() {
json data = getConfigJson();

if (!data.count("work_offline"))
return false;

return data["work_offline"];
}

std::string LoadSave::getLoadedSkin() {
json data = getConfigJson();

@@ -1612,15 +1576,6 @@ bool LoadSave::displayHzFrequency() {
return data["hz_frequency"];
}

bool LoadSave::authenticated() {
json data = getConfigJson();

if (!data.count("authenticated"))
return false;

return data["authenticated"];
}

int LoadSave::getOversamplingAmount() {
json data = getConfigJson();



+ 0
- 4
ports/vitalium/source/common/load_save.h View File

@@ -113,8 +113,6 @@ class LoadSave {
static bool isExpired();
static bool doesExpire();
static int getDaysToExpire();
static bool shouldCheckForUpdates();
static bool shouldWorkOffline();
static std::string getLoadedSkin();
static bool shouldAnimateWidgets();
static bool displayHzFrequency();
@@ -130,12 +128,10 @@ class LoadSave {
static void saveLayoutConfig(vital::StringLayout* layout);
static void saveVersionConfig();
static void saveContentVersion(std::string version);
static void saveUpdateCheckConfig(bool check_for_updates);
static void saveWorkOffline(bool work_offline);
static void saveLoadedSkin(const std::string& name);
static void saveAnimateWidgets(bool animate_widgets);
static void saveDisplayHzFrequency(bool display_hz);
static void saveAuthenticated(bool authenticated);
static void saveWindowSize(float window_size);
static void saveMidiMapConfig(MidiManager* midi_manager);
static void loadConfig(MidiManager* midi_manager, vital::StringLayout* layout = nullptr);


+ 0
- 28
ports/vitalium/source/interface/editor_components/synth_preset_selector.cpp View File

@@ -54,10 +54,6 @@ namespace {
preset_selector->loadSkin();
else if (result == SynthPresetSelector::kClearSkin)
preset_selector->clearSkin();
else if (result == SynthPresetSelector::kLogOut)
preset_selector->signOut();
else if (result == SynthPresetSelector::kLogIn)
preset_selector->signIn();
}

String redactEmail(const String& email) {
@@ -205,13 +201,6 @@ void SynthPresetSelector::showPopupMenu(Component* anchor) {
options.addItem(kLoadTuning, "Load Tuning File");
if (!hasDefaultTuning())
options.addItem(kClearTuning, "Clear Tuning: " + getTuningName());
options.addItem(-1, "");
std::string logged_in_as = loggedInName();
if (logged_in_as.empty())
options.addItem(kLogIn, "Log in");
else
options.addItem(kLogOut, "Log out - " + redactEmail(logged_in_as).toStdString());

if (LoadSave::getDefaultSkin().exists()) {
options.addItem(-1, "");
@@ -367,23 +356,6 @@ bool SynthPresetSelector::hasDefaultTuning() {
return parent->getSynth()->getTuning()->isDefault();
}

std::string SynthPresetSelector::loggedInName() {
FullInterface* full_interface = findParentComponentOfClass<FullInterface>();
if (full_interface)
return full_interface->getSignedInName();
return "";
}

void SynthPresetSelector::signOut() {
FullInterface* full_interface = findParentComponentOfClass<FullInterface>();
return full_interface->signOut();
}

void SynthPresetSelector::signIn() {
FullInterface* full_interface = findParentComponentOfClass<FullInterface>();
return full_interface->signIn();
}

void SynthPresetSelector::openSkinDesigner() {
skin_designer_.deleteAndZero();
SkinDesigner* skin_designer = new SkinDesigner(full_skin_.get(), findParentComponentOfClass<FullInterface>());


+ 0
- 5
ports/vitalium/source/interface/editor_components/synth_preset_selector.h View File

@@ -50,8 +50,6 @@ class SynthPresetSelector : public SynthSection,
kOpenSkinDesigner,
kLoadSkin,
kClearSkin,
kLogOut,
kLogIn,
kNumMenuItems
};

@@ -102,9 +100,6 @@ class SynthPresetSelector : public SynthSection,
void clearTuning();
std::string getTuningName();
bool hasDefaultTuning();
std::string loggedInName();
void signOut();
void signIn();
void openSkinDesigner();
void loadSkin();
void clearSkin();


+ 0
- 14
ports/vitalium/source/interface/editor_components/wavetable_3d.cpp View File

@@ -269,12 +269,6 @@ void Wavetable3d::mouseDown(const MouseEvent& e) {
options.addItem(-1, "");
options.addItem(kInit, "Initialize");

FullInterface* full_interface = findParentComponentOfClass<FullInterface>();
if (full_interface && !full_interface->getSignedInName().empty())
options.addItem(kTextToWavetable, "Text to Wavetable");
else
options.addItem(kLogIn, "Text to Wavetable - Log in");

options.addItem(kResynthesizePreset, "Resynthesize Preset to Wavetable");

SynthSection* parent = findParentComponentOfClass<SynthSection>();
@@ -645,20 +639,12 @@ void Wavetable3d::respondToMenuCallback(int option) {
for (Listener* listener : listeners_)
listener->saveWavetable();
}
else if (option == kTextToWavetable) {
for (Listener* listener : listeners_)
listener->textToWavetable();
}
else if (option == kResynthesizePreset) {
for (Listener* listener : listeners_)
listener->resynthesizeToWavetable();
repaintBackground();
setDirty();
}
else if (option == kLogIn) {
FullInterface* full_interface = findParentComponentOfClass<FullInterface>();
return full_interface->signIn();
}
else if (option == kCopy) {
FullInterface* parent = findParentComponentOfClass<FullInterface>();
if (parent == nullptr)


+ 0
- 3
ports/vitalium/source/interface/editor_components/wavetable_3d.h View File

@@ -66,9 +66,7 @@ class Wavetable3d : public OpenGlComponent, public AudioFileDropSource {
kPaste,
kInit,
kSave,
kTextToWavetable,
kResynthesizePreset,
kLogIn,
kNumMenuOptions
};

@@ -87,7 +85,6 @@ class Wavetable3d : public OpenGlComponent, public AudioFileDropSource {
virtual void loadWavetable(json& wavetable_data) = 0;
virtual void loadDefaultWavetable() = 0;
virtual void resynthesizeToWavetable() = 0;
virtual void textToWavetable() = 0;
virtual void saveWavetable() = 0;
};



+ 12
- 26
ports/vitalium/source/interface/editor_sections/about_section.cpp View File

@@ -36,7 +36,7 @@ AboutSection::AboutSection(const String& name) : Overlay(name), body_(Shaders::k
logo_ = std::make_unique<AppLogo>("logo");
addOpenGlComponent(logo_.get());

name_text_ = std::make_unique<PlainTextComponent>("plugin name", "VIAL");
name_text_ = std::make_unique<PlainTextComponent>("plugin name", "VITALIUM");
addOpenGlComponent(name_text_.get());
name_text_->setFontType(PlainTextComponent::kRegular);
name_text_->setTextSize(40.0f);
@@ -46,17 +46,11 @@ AboutSection::AboutSection(const String& name) : Overlay(name), body_(Shaders::k
version_text_->setFontType(PlainTextComponent::kLight);
version_text_->setTextSize(12.0f);

check_for_updates_text_ = std::make_unique<PlainTextComponent>("Check for updates", String("Check for updates"));
addOpenGlComponent(check_for_updates_text_.get());
check_for_updates_text_->setFontType(PlainTextComponent::kLight);
check_for_updates_text_->setTextSize(14.0f);
check_for_updates_text_->setJustification(Justification::centredLeft);

check_for_updates_ = std::make_unique<OpenGlToggleButton>("");
check_for_updates_->setToggleState(LoadSave::shouldCheckForUpdates(), NotificationType::dontSendNotification);
check_for_updates_->addListener(this);
addAndMakeVisible(check_for_updates_.get());
addOpenGlComponent(check_for_updates_->getGlComponent());
fork_text_ = std::make_unique<PlainTextComponent>("About fork", String("Vital fork by falkTX"));
addOpenGlComponent(fork_text_.get());
fork_text_->setFontType(PlainTextComponent::kLight);
fork_text_->setTextSize(14.0f);
fork_text_->setJustification(Justification::centredLeft);

size_button_extra_small_ = std::make_unique<OpenGlToggleButton>(String(100 * kMultExtraSmall) + "%");
size_button_extra_small_->setUiButton(false);
@@ -128,8 +122,8 @@ void AboutSection::resized() {
body_.setColor(findColour(Skin::kBody, true));
Colour body_text = findColour(Skin::kBodyText, true);
name_text_->setColor(body_text);
check_for_updates_text_->setColor(body_text);
version_text_->setColor(body_text);
fork_text_->setColor(body_text);
int padding_x = size_ratio_ * kPaddingX;
int padding_y = size_ratio_ * kPaddingY;
int button_height = size_ratio_ * kButtonHeight;
@@ -143,6 +137,8 @@ void AboutSection::resized() {

version_text_->setBounds(info_rect.getX() + name_x, info_rect.getY() + padding_y + 76 * size_ratio_,
info_rect.getWidth() - name_x - kNameRightBuffer * size_ratio_, 32 * size_ratio_);
fork_text_->setBounds(info_rect.getX() + name_x, info_rect.getY() + padding_y + 110 * size_ratio_,
info_rect.getWidth() + name_x, 40 * size_ratio_);

int size_padding = 5 * size_ratio_;
int size_start_x = info_rect.getX() + padding_x;
@@ -159,15 +155,7 @@ void AboutSection::resized() {

float size_width = (size_end_x - size_start_x) * 1.0f / size_buttons.size() - size_padding;

int check_updates_height = button_height * 0.6f;
check_for_updates_->setBounds(info_rect.getX() + padding_x,
info_rect.getY() + padding_y + 145.0f * size_ratio_,
check_updates_height, check_updates_height);
int check_for_updates_width = 3 * size_width + 2 * size_padding;
check_for_updates_text_->setBounds(check_for_updates_->getRight() + size_padding, check_for_updates_->getY(),
check_for_updates_width, check_updates_height);

int size_y = check_for_updates_->getBottom() + padding_y;
int size_y = padding_y;

int index = 0;
for (OpenGlToggleButton* size_button : size_buttons) {
@@ -200,7 +188,7 @@ void AboutSection::resized() {

name_text_->setTextSize(40.0f * size_ratio_);
version_text_->setTextSize(12.0f * size_ratio_);
check_for_updates_text_->setTextSize(14.0f * size_ratio_);
fork_text_->setTextSize(14.0f * size_ratio_);

Overlay::resized();
}
@@ -222,9 +210,7 @@ void AboutSection::setVisible(bool should_be_visible) {
}

void AboutSection::buttonClicked(Button* clicked_button) {
if (clicked_button == check_for_updates_.get())
LoadSave::saveUpdateCheckConfig(check_for_updates_->getToggleState());
else if (clicked_button == size_button_extra_small_.get())
if (clicked_button == size_button_extra_small_.get())
setGuiSize(kMultExtraSmall);
else if (clicked_button == size_button_small_.get())
setGuiSize(kMultSmall);


+ 1
- 3
ports/vitalium/source/interface/editor_sections/about_section.h View File

@@ -88,8 +88,6 @@ class AboutSection : public Overlay {
void fullScreen();

std::unique_ptr<OpenGlDeviceSelector> device_selector_;
std::unique_ptr<OpenGlToggleButton> check_for_updates_;
std::unique_ptr<PlainTextComponent> check_for_updates_text_;

std::unique_ptr<OpenGlToggleButton> size_button_extra_small_;
std::unique_ptr<OpenGlToggleButton> size_button_small_;
@@ -103,7 +101,7 @@ class AboutSection : public Overlay {
std::unique_ptr<AppLogo> logo_;
std::unique_ptr<PlainTextComponent> name_text_;
std::unique_ptr<PlainTextComponent> version_text_;
std::unique_ptr<PlainTextComponent> check_updates_text_;
std::unique_ptr<PlainTextComponent> fork_text_;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AboutSection)
};


+ 3
- 89
ports/vitalium/source/interface/editor_sections/full_interface.cpp View File

@@ -20,7 +20,6 @@
#include "bank_exporter.h"
#include "bend_section.h"
#include "delete_section.h"
#include "download_section.h"
#include "expired_section.h"
#include "extra_mod_section.h"
#include "skin.h"
@@ -41,14 +40,13 @@
#include "synthesis_interface.h"
#include "synth_gui_interface.h"
#include "text_look_and_feel.h"
#include "update_check_section.h"
#include "voice_section.h"

FullInterface::FullInterface(SynthGuiData* synth_data) : SynthSection("full_interface"), width_(0), resized_width_(0),
last_render_scale_(0.0f), display_scale_(1.0f),
pixel_multiple_(1), setting_all_values_(false),
unsupported_(false), animate_(true),
enable_redo_background_(true), needs_download_(false),
enable_redo_background_(true),
open_gl_(open_gl_context_) {
full_screen_section_ = nullptr;
Skin default_skin;
@@ -57,8 +55,7 @@ FullInterface::FullInterface(SynthGuiData* synth_data) : SynthSection("full_inte

bool synth = synth_data->wavetable_creators[0];
if (synth) {
synthesis_interface_ = std::make_unique<SynthesisInterface>(&auth_,
synth_data->mono_modulations,
synthesis_interface_ = std::make_unique<SynthesisInterface>(synth_data->mono_modulations,
synth_data->poly_modulations);

for (int i = 0; i < vital::kNumOscillators; ++i) {
@@ -164,12 +161,6 @@ FullInterface::FullInterface(SynthGuiData* synth_data) : SynthSection("full_inte
addChildComponent(delete_section_.get());
preset_browser_->setDeleteSection(delete_section_.get());

download_section_ = std::make_unique<DownloadSection>("download_section", &auth_);
addSubSection(download_section_.get(), false);
addChildComponent(download_section_.get());
download_section_->setAlwaysOnTop(true);
download_section_->addListener(this);

about_section_ = std::make_unique<AboutSection>("about");
addSubSection(about_section_.get(), false);
addChildComponent(about_section_.get());
@@ -196,13 +187,6 @@ FullInterface::FullInterface(SynthGuiData* synth_data) : SynthSection("full_inte
dual_popup_selector_->toFront(true);
popup_display_1_->toFront(true);
popup_display_2_->toFront(true);
download_section_->toFront(true);

update_check_section_ = std::make_unique<UpdateCheckSection>("update_check");
addSubSection(update_check_section_.get(), false);
addChildComponent(update_check_section_.get());
update_check_section_->setAlwaysOnTop(true);
update_check_section_->addListener(this);

if (LoadSave::isExpired()) {
expired_section_ = std::make_unique<ExpiredSection>("expired");
@@ -210,25 +194,10 @@ FullInterface::FullInterface(SynthGuiData* synth_data) : SynthSection("full_inte
expired_section_->setAlwaysOnTop(true);
}

#if NDEBUG && !NO_AUTH
bool authenticated = LoadSave::authenticated();
bool work_offline = LoadSave::shouldWorkOffline();
authentication_ = std::make_unique<AuthenticationSection>(&auth_);
authentication_->addListener(this);
addSubSection(authentication_.get(), false);
addChildComponent(authentication_.get());
authentication_->setVisible(!authenticated && !work_offline);
authentication_->init();
if (!work_offline)
authentication_->create();
#endif

setAllValues(synth_data->controls);
setOpaque(true);
setSkinValues(default_skin, true);

needs_download_ = UpdateMemory::getInstance()->incrementChecker();

open_gl_context_.setContinuousRepainting(true);
open_gl_context_.setOpenGLVersionRequired(OpenGLContext::openGL3_2);
open_gl_context_.setSwapInterval(0);
@@ -253,8 +222,6 @@ FullInterface::FullInterface() : SynthSection("EMPTY"), open_gl_(open_gl_context
}

FullInterface::~FullInterface() {
UpdateMemory::getInstance()->decrementChecker();

open_gl_context_.detach();
open_gl_context_.setRenderer(nullptr);
}
@@ -296,26 +263,6 @@ void FullInterface::reloadSkin(const Skin& skin) {
setBounds(bounds);
}

void FullInterface::dataDirectoryChanged() {
preset_browser_->loadPresets();
}

void FullInterface::noDownloadNeeded() {
update_check_section_->startCheck();
}

void FullInterface::needsUpdate() {
if (!download_section_->isVisible() && !update_check_section_->isVisible())
update_check_section_->setVisible(true);
}

void FullInterface::loggedIn() {
#if !defined(NO_TEXT_ENTRY)
if (needs_download_)
download_section_->triggerDownload();
#endif
}

void FullInterface::repaintChildBackground(SynthSection* child) {
if (!background_image_.isValid() || setting_all_values_)
return;
@@ -428,9 +375,6 @@ void FullInterface::resized() {
if (expired_section_)
expired_section_->setBounds(bounds);

if (authentication_)
authentication_->setBounds(bounds);

popup_browser_->setBounds(bounds);

int padding = getPadding();
@@ -481,10 +425,8 @@ void FullInterface::resized() {
keyboard_interface_->setBounds(keyboard_x, top + height - keyboard_height - padding, keyboard_width, keyboard_height);

about_section_->setBounds(bounds);
update_check_section_->setBounds(bounds);
save_section_->setBounds(bounds);
delete_section_->setBounds(bounds);
download_section_->setBounds(bounds);

Rectangle<int> browse_bounds(main_bounds.getX(), main_bounds.getY(),
width - main_bounds.getX(), main_bounds.getHeight());
@@ -584,13 +526,6 @@ void FullInterface::setWavetableNames() {
}
}

void FullInterface::startDownload() {
if (auth_.loggedIn() || authentication_ == nullptr)
download_section_->triggerDownload();
else
authentication_->setVisible(true);
}

void FullInterface::newOpenGLContextCreated() {
double version_supported = OpenGLShaderProgram::getLanguageVersion();
unsupported_ = version_supported < kMinOpenGlVersion;
@@ -728,9 +663,7 @@ void FullInterface::modulationsScrolled() {
}

void FullInterface::setFocus() {
if (authentication_ && authentication_->isShowing())
authentication_->setFocus();
else if (synthesis_interface_ && synthesis_interface_->isShowing())
if (synthesis_interface_ && synthesis_interface_->isShowing())
synthesis_interface_->setFocus();
}

@@ -803,25 +736,6 @@ std::string FullInterface::getWavetableName(int index) {
return wavetable_edits_[index]->getName();
}

std::string FullInterface::getSignedInName() {
if (authentication_ == nullptr || !auth_.loggedIn())
return "";
return authentication_->getSignedInName();
}

void FullInterface::signOut() {
if (authentication_)
authentication_->signOut();
}

void FullInterface::signIn() {
if (authentication_) {
authentication_->create();
authentication_->setVisible(true);
}
}

void FullInterface::hideWavetableEditSection() {
showWavetableEditSection(-1);
}


+ 1
- 22
ports/vitalium/source/interface/editor_sections/full_interface.h View File

@@ -18,9 +18,6 @@

#include "JuceHeader.h"

#include "authentication.h"
#include "authentication_section.h"
#include "download_section.h"
#include "header_section.h"
#include "effects_interface.h"
#include "memory.h"
@@ -28,7 +25,6 @@
#include "open_gl_background.h"
#include "shaders.h"
#include "synth_section.h"
#include "update_check_section.h"
#include "wavetable_creator.h"

class AboutSection;
@@ -51,8 +47,7 @@ class SynthSlider;
class WavetableEditSection;
class VoiceSection;

class FullInterface : public SynthSection, public AuthenticationSection::Listener, public HeaderSection::Listener,
public DownloadSection::Listener, public UpdateCheckSection::Listener,
class FullInterface : public SynthSection, public HeaderSection::Listener,
public EffectsInterface::Listener, public ModulationMatrix::Listener,
public OpenGLRenderer, DragAndDropContainer {
public:
@@ -87,15 +82,7 @@ class FullInterface : public SynthSection, public AuthenticationSection::Listene
void reset() override;
void setAllValues(vital::control_map& controls) override;

void dataDirectoryChanged() override;
void noDownloadNeeded() override;

void needsUpdate() override;

void loggedIn() override;

void setWavetableNames();
void startDownload();

void newOpenGLContextCreated() override;
void renderOpenGL() override;
@@ -120,9 +107,6 @@ class FullInterface : public SynthSection, public AuthenticationSection::Listene
void showWavetableEditSection(int index);
std::string getLastBrowsedWavetable(int index);
std::string getWavetableName(int index);
std::string getSignedInName();
void signOut();
void signIn();
void hideWavetableEditSection();
void loadWavetableFile(int index, const File& wavetable);
void loadWavetable(int index, json& wavetable_data);
@@ -168,15 +152,12 @@ class FullInterface : public SynthSection, public AuthenticationSection::Listene
return true;
}

Authentication auth_;
std::map<std::string, SynthSlider*> slider_lookup_;
std::map<std::string, Button*> button_lookup_;
std::unique_ptr<ModulationManager> modulation_manager_;
std::unique_ptr<ModulationMatrix> modulation_matrix_;

std::unique_ptr<AboutSection> about_section_;
std::unique_ptr<AuthenticationSection> authentication_;
std::unique_ptr<UpdateCheckSection> update_check_section_;
std::unique_ptr<Component> standalone_settings_section_;

std::unique_ptr<HeaderSection> header_;
@@ -199,7 +180,6 @@ class FullInterface : public SynthSection, public AuthenticationSection::Listene
std::unique_ptr<BankExporter> bank_exporter_;
std::unique_ptr<SaveSection> save_section_;
std::unique_ptr<DeleteSection> delete_section_;
std::unique_ptr<DownloadSection> download_section_;
std::unique_ptr<ExpiredSection> expired_section_;
SynthSection* full_screen_section_;

@@ -212,7 +192,6 @@ class FullInterface : public SynthSection, public AuthenticationSection::Listene
bool unsupported_;
bool animate_;
bool enable_redo_background_;
bool needs_download_;
CriticalSection open_gl_critical_section_;
OpenGLContext open_gl_context_;
std::unique_ptr<Shaders> shaders_;


+ 2
- 257
ports/vitalium/source/interface/editor_sections/oscillator_section.cpp View File

@@ -66,82 +66,6 @@ namespace {
"RM <- SAMPLE"
};

const std::string kLanguageNames[] = {
"Arabic",
"Czech",
"Danish",
"Dutch",
"English (Aus)",
"English (UK)",
"English (US)",
"Filipino",
"Finnish",
"French (Can)",
"French (Fr)",
"German",
"Greek",
"Hindi",
"Hungarian",
"Indonesian",
"Italian",
"Japanese",
"Korean",
"Mandarin Chinese",
"Norwegian",
"Polish",
"Portuguese (Br)",
"Portuguese (Po)",
"Russian",
"Slovak",
"Spanish",
"Swedish",
"Turkish",
"Ukrainian",
"Vietnamese"
};

const std::string kLanguageCodes[] = {
"ar-XA",
"cs-CZ",
"da-DK",
"nl-NL",
"en-AU",
"en-GB",
"en-US",
"fil-PH",
"fi-FI",
"fr-CA",
"fr-FR",
"de-DE",
"el-GR",
"hi-IN",
"hu-HU",
"id-ID",
"it-IT",
"ja-JP",
"ko-KR",
"cmn-CN",
"nb-NO",
"pl-PL",
"pt-BR",
"pt-PT",
"ru-RU",
"sk-SK",
"es-ES",
"sv-SE",
"tr-TR",
"uk-UA",
"vi-VN"
};

const std::string kUrlPrefix = "";
const std::string kLanguageUrlQuery = "&language=";
const std::string kTokenUrlQuery = "&idToken=";
constexpr int kTtwtId = INT_MAX;
constexpr int kAddCustomFolderId = INT_MAX - 1;
constexpr int kMaxTTWTLength = 100;
constexpr int kShowErrorMs = 2000;

String getDistortionSuffix(int type, int index) {
if (type == vital::SynthOscillator::kFmOscillatorA || type == vital::SynthOscillator::kRmOscillatorA)
return " " + String(1 + vital::ProducersModule::getFirstModulationIndex(index));
@@ -167,17 +91,6 @@ namespace {
return String(kDistortionTypes[type]) + getDistortionSuffix(type, index);
}

int getLanguageIndex(const std::string& language) {
constexpr int kDefaultIndex = 4;

for (int i = 0; i < sizeof(kLanguageNames) / sizeof(std::string); ++i) {
if (kLanguageCodes[i] == language)
return i;
}

return kDefaultIndex;
}

bool isBipolarDistortionType(int distortion_type) {
return distortion_type == vital::SynthOscillator::kNone ||
distortion_type == vital::SynthOscillator::kSqueeze ||
@@ -276,12 +189,10 @@ class InvisibleSlider : public SynthSlider {
void drawShadow(Graphics& g) override { }
};

OscillatorSection::OscillatorSection(Authentication* auth,
int index,
OscillatorSection::OscillatorSection(int index,
const vital::output_map& mono_modulations,
const vital::output_map& poly_modulations) :
SynthSection(String("OSC ") + String(index + 1)), auth_(auth), index_(index),
show_ttwt_error_(false), ttwt_overlay_(Shaders::kRoundedRectangleFragment) {
SynthSection(String("OSC ") + String(index + 1)), index_(index) {
std::string number = std::to_string(index + 1);
wavetable_ = std::make_unique<Wavetable3d>(index, mono_modulations, poly_modulations);
addOpenGlComponent(wavetable_.get());
@@ -462,35 +373,6 @@ OscillatorSection::OscillatorSection(Authentication* auth,
addSlider(dimension_value_.get());
dimension_value_->setVisible(false);

ttwt_overlay_.setQuad(0, -1.0f, -1.0f, 2.0f, 2.0f);
addOpenGlComponent(&ttwt_overlay_);
ttwt_overlay_.setVisible(false);

#if !defined(NO_TEXT_ENTRY)
ttwt_ = std::make_unique<OpenGlTextEditor>("ttwt");
ttwt_->addListener(this);
ttwt_->setFont(Fonts::instance()->proportional_light().withPointHeight(16.0f));
ttwt_->setMultiLine(false, false);
ttwt_->setJustification(Justification::centred);
addChildComponent(ttwt_.get());
addOpenGlComponent(ttwt_->getImageComponent());
#endif

showing_language_menu_ = false;
ttwt_language_ = getLanguageIndex(LoadSave::getPreferredTTWTLanguage());
ttwt_settings_ = std::make_unique<SynthButton>("Menu");
ttwt_settings_->setNoBackground();
addChildComponent(ttwt_settings_.get());
addOpenGlComponent(ttwt_settings_->getGlComponent());
ttwt_settings_->addListener(this);
ttwt_settings_->setTriggeredOnMouseDown(true);
ttwt_settings_->setText(kLanguageCodes[ttwt_language_]);

std::string ttwt_error = "Error rendering speech. Check internet connection";
ttwt_error_text_ = std::make_unique<PlainTextComponent>("ttwt error", ttwt_error);
addOpenGlComponent(ttwt_error_text_.get());
ttwt_error_text_->setVisible(false);

oscillator_on_ = std::make_unique<SynthButton>("osc_" + number + "_on");
addButton(oscillator_on_.get());
setActivator(oscillator_on_.get());
@@ -550,16 +432,6 @@ void OscillatorSection::paintBackground(Graphics& g) {
if (getWidth() == 0)
return;

if (ttwt_) {
ttwt_->setColour(CaretComponent::caretColourId, findColour(Skin::kTextEditorCaret, true));
ttwt_->setColour(TextEditor::textColourId, findColour(Skin::kBodyText, true));
ttwt_->setColour(TextEditor::highlightedTextColourId, findColour(Skin::kBodyText, true));
ttwt_->setColour(TextEditor::highlightColourId, findColour(Skin::kTextEditorSelection, true));
Colour empty_color = findColour(Skin::kBodyText, true);
empty_color = empty_color.withAlpha(0.5f * empty_color.getFloatAlpha());
ttwt_->setTextToShowWhenEmpty(TRANS("Text to wavetable"), empty_color);
}

paintContainer(g);
paintHeadingText(g);

@@ -719,25 +591,6 @@ void OscillatorSection::resized() {
prev_destination_->setBounds(destination_x, destination_y, browse_width, browse_width);
next_destination_->setBounds(destination_x + top_row_width - browse_width, destination_y,
browse_width, browse_width);

ttwt_overlay_.setRounding(findValue(Skin::kWidgetRoundedCorner));
ttwt_overlay_.setBounds(wavetable_->getBounds());
ttwt_overlay_.setColor(findColour(Skin::kOverlayScreen, true));

if (ttwt_) {
float ttwt_height = title_width;
int settings_width = ttwt_height * 2.0f;
int ttwt_y = (wavetable_->getHeight() - ttwt_height) / 2;
int ttwt_x = wavetable_->getX() + widget_margin;
int ttwt_width = wavetable_->getWidth() - 2 * widget_margin;
ttwt_->setBounds(ttwt_x, ttwt_y, ttwt_width, ttwt_height);
ttwt_->setFont(Fonts::instance()->proportional_light().withPointHeight(ttwt_height * 0.6f));
ttwt_settings_->setBounds(ttwt_->getRight() - settings_width, ttwt_->getBottom(), settings_width, ttwt_height / 2);

ttwt_error_text_->setTextSize(label_text_height);
ttwt_error_text_->setBounds(ttwt_->getBounds());
ttwt_error_text_->setColor(body_text);
}
}

void OscillatorSection::buttonClicked(Button* clicked_button) {
@@ -782,8 +635,6 @@ void OscillatorSection::buttonClicked(Button* clicked_button) {
Point<int> position(destination_selector_->getX(), destination_selector_->getBottom());
showPopupSelector(this, position, options, [=](int selection) { setDestinationSelected(selection); });
}
else if (clicked_button == ttwt_settings_.get())
showTtwtSettings();
else if (clicked_button == dimension_button_.get()) {
int render_type = (wavetable_->getRenderType() + Wavetable3d::kNumRenderTypes - 1) % Wavetable3d::kNumRenderTypes;
dimension_button_->setText(strings::kWavetableDimensionNames[render_type]);
@@ -838,43 +689,6 @@ void OscillatorSection::setAllValues(vital::control_map& controls) {
wavetable_->setRenderType(static_cast<Wavetable3d::RenderType>(render_type));
}

void OscillatorSection::textEditorReturnKeyPressed(TextEditor& text_editor) {
String text = text_editor.getText();
text = text.trim();
show_ttwt_error_ = false;
if (!text.isEmpty()) {
std::string error = loadWavetableFromText(text);
show_ttwt_error_ = !error.empty();
if (show_ttwt_error_) {
ttwt_error_text_->setText(error);
ttwt_error_text_->redrawImage(true);
ttwt_error_text_->setVisible(true);
startTimer(kShowErrorMs);
}
}

ttwt_->clear();
ttwt_overlay_.setVisible(show_ttwt_error_);
ttwt_->setVisible(false);
ttwt_settings_->setVisible(false);
}

void OscillatorSection::textEditorFocusLost(TextEditor& text_editor) {
if (showing_language_menu_)
return;

ttwt_overlay_.setVisible(show_ttwt_error_);
ttwt_->setVisible(false);
ttwt_settings_->setVisible(false);
}

void OscillatorSection::timerCallback() {
show_ttwt_error_ = false;
ttwt_error_text_->setVisible(false);
ttwt_overlay_.setVisible(false);
stopTimer();
}

void OscillatorSection::setActive(bool active) {
wavetable_->setActive(active);
SynthSection::setActive(active);
@@ -886,46 +700,6 @@ void OscillatorSection::setName(String name) {
preset_selector_->setText(name);
}

void OscillatorSection::showTtwtSettings() {
showing_language_menu_ = true;
PopupItems options;

for (int i = 0; i < sizeof(kLanguageNames) / sizeof(std::string); ++i)
options.addItem(i, kLanguageNames[i]);

Point<int> position(ttwt_settings_->getX(), ttwt_settings_->getBottom());
showPopupSelector(this, position, options, [=](int selection) { setLanguage(selection); });
}

std::string OscillatorSection::loadWavetableFromText(const String& text) {
String clamped_text = text.substring(0, kMaxTTWTLength);
String language_query = String(kLanguageUrlQuery) + URL::addEscapeChars(kLanguageCodes[ttwt_language_], true);
std::string token = auth_->token();
String token_query = String(kTokenUrlQuery) + URL::addEscapeChars(token, true);
URL ttwt_url(String(kUrlPrefix) + URL::addEscapeChars(clamped_text, true) + language_query + token_query);

try {
String result = ttwt_url.readEntireTextStream(false);
json data = json::parse(result.toStdString());

if (data.count("error"))
return data["error"];

std::string hex_encoded_buffer = data["buffer"];
MemoryBlock audio_memory;
audio_memory.loadFromHexString(hex_encoded_buffer);
MemoryInputStream* audio_stream = new MemoryInputStream(audio_memory, false);

bool succeeded = loadAudioAsWavetable("TTWT", audio_stream, WavetableCreator::kTtwt);
if (succeeded)
return "";
return "Error converting speech to wavetable.";
}
catch (const std::exception& e) {
return "Error rendering speech. Check internet connection";
}
}

Slider* OscillatorSection::getWaveFrameSlider() {
return wave_frame_.get();
}
@@ -970,23 +744,6 @@ void OscillatorSection::setIndexSelected() {
return;
}

void OscillatorSection::setLanguage(int index) {
ttwt_language_ = index;
LoadSave::savePreferredTTWTLanguage(kLanguageCodes[ttwt_language_]);
showing_language_menu_ = false;
if (ttwt_)
ttwt_->grabKeyboardFocus();
ttwt_settings_->setToggleState(false, dontSendNotification);
ttwt_settings_->setText(kLanguageCodes[ttwt_language_]);
}

void OscillatorSection::languageSelectCancelled() {
showing_language_menu_ = false;
if (ttwt_)
ttwt_->grabKeyboardFocus();
ttwt_settings_->setToggleState(false, dontSendNotification);
}

void OscillatorSection::prevClicked() {
File wavetable_file = LoadSave::getShiftedFile(LoadSave::kWavetableFolderName, vital::kWavetableExtensionsList,
LoadSave::kAdditionalWavetableFoldersName, current_file_, -1);
@@ -1077,18 +834,6 @@ void OscillatorSection::resynthesizeToWavetable() {
wavetable_->setLoadingWavetable(false);
}

void OscillatorSection::textToWavetable() {
if (auth_)
auth_->refreshToken();

ttwt_settings_->setColour(Skin::kIconButtonOff, findColour(Skin::kWidgetPrimary1, true));
ttwt_overlay_.setVisible(true);
ttwt_->setVisible(true);
ttwt_settings_->setVisible(true);
ttwt_->resized();
ttwt_->grabKeyboardFocus();
}

void OscillatorSection::saveWavetable() {
FullInterface* parent = findParentComponentOfClass<FullInterface>();
if (parent)


+ 2
- 22
ports/vitalium/source/interface/editor_sections/oscillator_section.h View File

@@ -32,7 +32,7 @@ class UnisonViewer;
class WavetableCreator;

class OscillatorSection : public SynthSection, public PresetSelector::Listener,
TextEditor::Listener, Wavetable3d::Listener, TransposeQuantizeButton::Listener, Timer {
TextEditor::Listener, Wavetable3d::Listener, TransposeQuantizeButton::Listener {
public:
static constexpr float kSectionWidthRatio = 0.19f;

@@ -43,8 +43,7 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,
virtual void oscillatorDestinationChanged(OscillatorSection* section, int destination) = 0;
};

OscillatorSection(Authentication* auth,
int index, const vital::output_map& mono_modulations, const vital::output_map& poly_modulations);
OscillatorSection(int index, const vital::output_map& mono_modulations, const vital::output_map& poly_modulations);
virtual ~OscillatorSection();

void setSkinValues(const Skin& skin, bool top_level) override;
@@ -58,18 +57,12 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,
void buttonClicked(Button* clicked_button) override;
void setAllValues(vital::control_map& controls) override;

void textEditorReturnKeyPressed(TextEditor& text_editor) override;
void textEditorFocusLost(TextEditor& text_editor) override;

void timerCallback() override;

void setActive(bool active) override;
void setName(String name);

void resetOscillatorModulationDistortionType();
void addListener(Listener* listener) { listeners_.push_back(listener); }

std::string loadWavetableFromText(const String& text);
Slider* getWaveFrameSlider();
void setDistortionSelected(int selection);
int getDistortion() const { return current_distortion_type_; }
@@ -79,8 +72,6 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,

void loadBrowserState();
void setIndexSelected();
void setLanguage(int index);
void languageSelectCancelled();
void prevClicked() override;
void nextClicked() override;
void textMouseDown(const MouseEvent& e) override;
@@ -91,7 +82,6 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,
void loadWavetable(json& wavetable_data) override;
void loadDefaultWavetable() override;
void resynthesizeToWavetable() override;
void textToWavetable() override;
void saveWavetable() override;
void loadFile(const File& wavetable_file) override;
File getCurrentFile() override { return current_file_; }
@@ -107,7 +97,6 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,
Rectangle<float> getWavetableRelativeBounds();

private:
void showTtwtSettings();
void setupSpectralMorph();
void setupDistortion();
void setupDestination();
@@ -116,7 +105,6 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,
void notifyDistortionTypeChange();
void notifyDestinationChange();

Authentication* auth_;
std::vector<Listener*> listeners_;
int index_;
File current_file_;
@@ -128,9 +116,6 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,
int current_distortion_type_;
int current_spectral_morph_type_;
int current_destination_;
bool show_ttwt_error_;
bool showing_language_menu_;
int ttwt_language_;

std::unique_ptr<SynthButton> oscillator_on_;
std::unique_ptr<SynthButton> dimension_button_;
@@ -166,11 +151,6 @@ class OscillatorSection : public SynthSection, public PresetSelector::Listener,
std::unique_ptr<SynthSlider> unison_detune_power_;
std::unique_ptr<OpenGlShapeButton> edit_button_;

OpenGlQuad ttwt_overlay_;
std::unique_ptr<OpenGlTextEditor> ttwt_;
std::unique_ptr<SynthButton> ttwt_settings_;
std::unique_ptr<PlainTextComponent> ttwt_error_text_;

std::unique_ptr<OpenGlShapeButton> prev_destination_;
std::unique_ptr<OpenGlShapeButton> next_destination_;
std::unique_ptr<OpenGlShapeButton> prev_spectral_;


+ 1
- 16
ports/vitalium/source/interface/editor_sections/popup_browser.cpp View File

@@ -1107,12 +1107,6 @@ PopupBrowser::PopupBrowser() : SynthSection("Popup Browser"),
addButton(store_button_.get());
store_button_->setVisible(false);

download_button_ = std::make_unique<OpenGlToggleButton>("Login");
download_button_->setUiButton(true);
download_button_->setText("Download content");
addButton(download_button_.get());
download_button_->setVisible(false);

#if !defined(NO_TEXT_ENTRY)
search_box_ = std::make_unique<OpenGlTextEditor>("Search");
search_box_->addListener(this);
@@ -1181,9 +1175,8 @@ void PopupBrowser::resized() {

int padding = getPadding();
int text_height = top_height - 2 * padding;
download_button_->setBounds(x + padding, y + padding, selection_list_width - 2 * padding, text_height);
if (search_box_) {
search_box_->setBounds(download_button_->getBounds());
search_box_->setBounds(x + padding, y + padding, selection_list_width - 2 * padding, text_height);
search_box_->resized();
}

@@ -1293,7 +1286,6 @@ void PopupBrowser::checkNoContent() {
bool has_content = LoadSave::hasDataDirectory();
if (search_box_)
search_box_->setVisible(has_content);
download_button_->setVisible(!has_content);
}

void PopupBrowser::checkStoreButton() {
@@ -1384,13 +1376,6 @@ void PopupBrowser::textEditorEscapeKeyPressed(TextEditor& editor) {
void PopupBrowser::buttonClicked(Button* clicked_button) {
if (clicked_button == exit_button_.get())
setVisible(false);
else if (clicked_button == download_button_.get()) {
FullInterface* parent = findParentComponentOfClass<FullInterface>();
if (parent) {
setVisible(false);
parent->startDownload();
}
}
else if (clicked_button == store_button_.get() && owner_) {
String encoded_author = URL::addEscapeChars(owner_->getFileAuthor(), true);
encoded_author = encoded_author.replace("+", "%2B");


+ 0
- 1
ports/vitalium/source/interface/editor_sections/popup_browser.h View File

@@ -417,7 +417,6 @@ class PopupBrowser : public SynthSection,
std::unique_ptr<OpenGlTextEditor> search_box_;
std::unique_ptr<OpenGlShapeButton> exit_button_;
std::unique_ptr<OpenGlToggleButton> store_button_;
std::unique_ptr<OpenGlToggleButton> download_button_;
Rectangle<int> passthrough_bounds_;
Rectangle<int> browser_bounds_;
PopupClosingArea closing_areas_[4];


+ 2
- 3
ports/vitalium/source/interface/editor_sections/synthesis_interface.cpp View File

@@ -22,8 +22,7 @@
#include "synth_oscillator.h"
#include "sample_section.h"

SynthesisInterface::SynthesisInterface(Authentication* auth,
const vital::output_map& mono_modulations,
SynthesisInterface::SynthesisInterface(const vital::output_map& mono_modulations,
const vital::output_map& poly_modulations) : SynthSection("synthesis") {
filter_section_2_ = std::make_unique<FilterSection>(2, mono_modulations, poly_modulations);
addSubSection(filter_section_2_.get());
@@ -34,7 +33,7 @@ SynthesisInterface::SynthesisInterface(Authentication* auth,
filter_section_1_->addListener(this);

for (int i = 0; i < vital::kNumOscillators; ++i) {
oscillators_[i] = std::make_unique<OscillatorSection>(auth, i, mono_modulations, poly_modulations);
oscillators_[i] = std::make_unique<OscillatorSection>(i, mono_modulations, poly_modulations);
addSubSection(oscillators_[i].get());
oscillators_[i]->addListener(this);
}


+ 1
- 2
ports/vitalium/source/interface/editor_sections/synthesis_interface.h View File

@@ -26,8 +26,7 @@
class SynthesisInterface : public SynthSection, public OscillatorSection::Listener,
public SampleSection::Listener, public FilterSection::Listener {
public:
SynthesisInterface(Authentication* auth,
const vital::output_map& mono_modulations,
SynthesisInterface(const vital::output_map& mono_modulations,
const vital::output_map& poly_modulations);
virtual ~SynthesisInterface();



+ 0
- 8
ports/vitalium/source/interface/look_and_feel/paths.h View File

@@ -44,14 +44,6 @@ class Paths {
return path;
}

static Path vitalWord() {
return fromSvgData((const void*)BinaryData::vital_word_svg, BinaryData::vital_word_svgSize);
}

static Path vitalWordRing() {
return fromSvgData((const void*)BinaryData::vital_word_ring_svg, BinaryData::vital_word_ring_svgSize);
}

static Path chorus() {
return fromSvgData((const void*)BinaryData::chorus_svg, BinaryData::chorus_svgSize);
}


+ 0
- 2
ports/vitalium/source/unity_build/interface_editor_sections.cpp View File

@@ -17,10 +17,8 @@
#include "voice_section.cpp"
#include "oscillator_advanced_section.cpp"
#include "about_section.cpp"
#include "authentication_section.cpp"
#include "delay_section.cpp"
#include "extra_mod_section.cpp"
#include "update_check_section.cpp"
#include "synth_section.cpp"
#include "envelope_section.cpp"
#include "bend_section.cpp"


+ 0
- 1
ports/vitalium/source/unity_build/interface_editor_sections2.cpp View File

@@ -33,7 +33,6 @@
#include "header_section.cpp"
#include "full_interface.cpp"
#include "delete_section.cpp"
#include "download_section.cpp"
#include "expired_section.cpp"
#include "lfo_section.cpp"
#include "random_section.cpp"


Loading…
Cancel
Save