13#include "sound_engine.h" 
   32                                                         last_render_scale_(0.0f), display_scale_(1.0f),
 
   33                                                         pixel_multiple_(1), setting_all_values_(false),
 
   34                                                         unsupported_(false), animate_(true),
 
   35                                                         enable_redo_background_(true), needs_download_(false),
 
   36                                                         open_gl_(open_gl_context_) {
 
   37  full_screen_section_ = 
nullptr;
 
   44    synthesis_interface_ = std::make_unique<SynthesisInterface>(&auth_,
 
   49      wavetable_edits_[i] = std::make_unique<WavetableEditSection>(i, synth_data->
wavetable_creators[i]);
 
   51      wavetable_edits_[i]->setVisible(
false);
 
   52      wavetable_edits_[i]->setWaveFrameSlider(synthesis_interface_->getWaveFrameSlider(i));
 
   58  effects_interface_ = std::make_unique<EffectsInterface>(synth_data->
mono_modulations);
 
   60  effects_interface_->setVisible(
false);
 
   61  effects_interface_->addListener(
this);
 
   63  master_controls_interface_ = std::make_unique<MasterControlsInterface>(synth_data->
mono_modulations,
 
   67  master_controls_interface_->setVisible(
false);
 
   69  if (synthesis_interface_) {
 
   71      master_controls_interface_->passOscillatorSection(i, synthesis_interface_->getOscillatorSection(i));
 
   74  header_ = std::make_unique<HeaderSection>();
 
   76  header_->addListener(
this);
 
   78  modulation_interface_ = std::make_unique<ModulationInterface>(synth_data);
 
   81  extra_mod_section_ = std::make_unique<ExtraModSection>(
"extra_mod_section", synth_data);
 
   87  bend_section_ = std::make_unique<BendSection>(
"BEND");
 
   90  portamento_section_ = std::make_unique<PortamentoSection>(
"PORTAMENTO");
 
   93  voice_section_ = std::make_unique<VoiceSection>(
"VOICE");
 
   98  modulation_matrix_->setVisible(
false);
 
   99  modulation_matrix_->addListener(
this);
 
  102  preset_browser_ = std::make_unique<PresetBrowser>();
 
  104  preset_browser_->setVisible(
false);
 
  106  popup_browser_ = std::make_unique<PopupBrowser>();
 
  108  popup_browser_->setVisible(
false);
 
  110  popup_selector_ = std::make_unique<SinglePopupSelector>();
 
  112  popup_selector_->setVisible(
false);
 
  113  popup_selector_->setAlwaysOnTop(
true);
 
  114  popup_selector_->setWantsKeyboardFocus(
true);
 
  116  dual_popup_selector_ = std::make_unique<DualPopupSelector>();
 
  118  dual_popup_selector_->setVisible(
false);
 
  119  dual_popup_selector_->setAlwaysOnTop(
true);
 
  120  dual_popup_selector_->setWantsKeyboardFocus(
true);
 
  122  popup_display_1_ = std::make_unique<PopupDisplay>();
 
  124  popup_display_1_->setVisible(
false);
 
  125  popup_display_1_->setAlwaysOnTop(
true);
 
  126  popup_display_1_->setWantsKeyboardFocus(
false);
 
  128  popup_display_2_ = std::make_unique<PopupDisplay>();
 
  130  popup_display_2_->setVisible(
false);
 
  131  popup_display_2_->setAlwaysOnTop(
true);
 
  132  popup_display_2_->setWantsKeyboardFocus(
false);
 
  134  bank_exporter_ = std::make_unique<BankExporter>();
 
  136  bank_exporter_->setVisible(
false);
 
  137  header_->setBankExporter(bank_exporter_.get());
 
  139  save_section_ = std::make_unique<SaveSection>(
"save_section");
 
  141  addChildComponent(save_section_.get());
 
  142  preset_browser_->setSaveSection(save_section_.get());
 
  143  header_->setSaveSection(save_section_.get());
 
  144  header_->setBrowser(preset_browser_.get());
 
  146  delete_section_ = std::make_unique<DeleteSection>(
"delete_section");
 
  148  addChildComponent(delete_section_.get());
 
  149  preset_browser_->setDeleteSection(delete_section_.get());
 
  151  download_section_ = std::make_unique<DownloadSection>(
"download_section", &auth_);
 
  153  addChildComponent(download_section_.get());
 
  154  download_section_->setAlwaysOnTop(
true);
 
  155  download_section_->addListener(
this);
 
  157  about_section_ = std::make_unique<AboutSection>(
"about");
 
  159  addChildComponent(about_section_.get());
 
  161  if (synthesis_interface_)
 
  162    synthesis_interface_->toFront(
true);
 
  164  master_controls_interface_->toFront(
true);
 
  165  effects_interface_->toFront(
true);
 
  166  modulation_interface_->toFront(
true);
 
  167  extra_mod_section_->toFront(
true);
 
  168  keyboard_interface_->toFront(
true);
 
  169  bend_section_->toFront(
true);
 
  170  portamento_section_->toFront(
true);
 
  171  voice_section_->toFront(
true);
 
  172  modulation_manager_->toFront(
false);
 
  173  preset_browser_->toFront(
false);
 
  174  bank_exporter_->toFront(
false);
 
  175  about_section_->toFront(
true);
 
  176  save_section_->toFront(
true);
 
  177  delete_section_->toFront(
true);
 
  178  popup_browser_->toFront(
true);
 
  179  popup_selector_->toFront(
true);
 
  180  dual_popup_selector_->toFront(
true);
 
  181  popup_display_1_->toFront(
true);
 
  182  popup_display_2_->toFront(
true);
 
  183  download_section_->toFront(
true);
 
  185  update_check_section_ = std::make_unique<UpdateCheckSection>(
"update_check");
 
  187  addChildComponent(update_check_section_.get());
 
  188  update_check_section_->setAlwaysOnTop(
true);
 
  189  update_check_section_->addListener(
this);
 
  192    expired_section_ = std::make_unique<ExpiredSection>(
"expired");
 
  194    expired_section_->setAlwaysOnTop(
true);
 
  197#if NDEBUG && !NO_AUTH 
  200  authentication_ = std::make_unique<AuthenticationSection>(&auth_);
 
  201  authentication_->addListener(
this);
 
  203  addChildComponent(authentication_.get());
 
  204  authentication_->setVisible(!authenticated && !work_offline);
 
  205  authentication_->init();
 
  207    authentication_->create();
 
  214  needs_download_ = UpdateMemory::getInstance()->incrementChecker();
 
  216  open_gl_context_.setContinuousRepainting(
true);
 
  217  open_gl_context_.setOpenGLVersionRequired(OpenGLContext::openGL3_2);
 
  218  open_gl_context_.setSwapInterval(0);
 
  219  open_gl_context_.setRenderer(
this);
 
  220  open_gl_context_.setComponentPaintingEnabled(
false);
 
  221  open_gl_context_.attachTo(*
this);
 
 
  228  open_gl_context_.setContinuousRepainting(
true);
 
  229  open_gl_context_.setOpenGLVersionRequired(OpenGLContext::openGL3_2);
 
  230  open_gl_context_.setSwapInterval(0);
 
  231  open_gl_context_.setRenderer(
this);
 
  232  open_gl_context_.setComponentPaintingEnabled(
false);
 
  233  open_gl_context_.attachTo(*
this);
 
 
  240  UpdateMemory::getInstance()->decrementChecker();
 
  242  open_gl_context_.detach();
 
  243  open_gl_context_.setRenderer(
nullptr);
 
 
  250  if (effects_interface_ == 
nullptr)
 
  254  int bar_width = 6 * padding;
 
  255  g.setColour(header_->findColour(
Skin::kBody, 
true));
 
  256  int y = header_->getBottom();
 
  257  int height = keyboard_interface_->getY() - y;
 
  258  int x1 = extra_mod_section_->getRight() + padding;
 
  259  g.fillRect(x1, y, bar_width, height);
 
  261  if (synthesis_interface_) {
 
  262    int x2 = synthesis_interface_->getRight() + padding;
 
  263    g.fillRect(x2, y, bar_width, height);
 
 
  271  ScopedLock open_gl_lock(open_gl_critical_section_);
 
 
  278  Rectangle<int> bounds = getBounds();
 
  279  setBounds(0, 0, bounds.getWidth() / 4, bounds.getHeight() / 4);
 
 
  284  preset_browser_->loadPresets();
 
 
  288  update_check_section_->startCheck();
 
 
  292  if (!download_section_->isVisible() && !update_check_section_->isVisible())
 
  293    update_check_section_->setVisible(
true);
 
 
  297#if !defined(NO_TEXT_ENTRY) 
  299    download_section_->triggerDownload();
 
 
  304  if (!background_image_.isValid() || setting_all_values_)
 
  307  if (child->getParentComponent() == synthesis_interface_.get()) {
 
  312  if (effects_interface_ != 
nullptr && effects_interface_->isParentOf(child))
 
  313    child = effects_interface_.get();
 
  316  Graphics g(background_image_);
 
 
  323  if (synthesis_interface_ == 
nullptr || !synthesis_interface_->isVisible() || !background_image_.isValid())
 
  327  Graphics g(background_image_);
 
  330  g.fillRect(synthesis_interface_->getBounds().expanded(padding));
 
 
  339  if (!background_image_.isValid())
 
  343  Graphics g(background_image_);
 
 
  350  int width = std::ceil(display_scale_ * getWidth());
 
  351  int height = std::ceil(display_scale_ * getHeight());
 
  355  ScopedLock open_gl_lock(open_gl_critical_section_);
 
  358  background_image_ = Image(Image::RGB, width, height, 
true);
 
  359  Graphics g(background_image_);
 
 
  366  float old_scale = display_scale_;
 
  367  int old_pixel_multiple = pixel_multiple_;
 
  369  pixel_multiple_ = std::max<int>(1, display_scale_);
 
  371  if (resize && (old_scale != display_scale_ || old_pixel_multiple != pixel_multiple_))
 
 
  381  if (!enable_redo_background_)
 
  384  resized_width_ = width_;
 
  386  ScopedLock lock(open_gl_critical_section_);
 
  387  static constexpr int kTopHeight = 48;
 
  389  if (effects_interface_ == 
nullptr)
 
  394  int width = std::ceil(getWidth() * display_scale_);
 
  395  int height = std::ceil(getHeight() * display_scale_);
 
  396  Rectangle<int> bounds(0, 0, width, height);
 
  399  float ratio = width_ratio * display_scale_;
 
  402    ratio = height_ratio;
 
  404    left = (getWidth() - width) / 2;
 
  409    top = (getHeight() - height) / 2;
 
  414  if (expired_section_)
 
  415    expired_section_->setBounds(bounds);
 
  418    authentication_->setBounds(bounds);
 
  420  popup_browser_->setBounds(bounds);
 
  425  int main_x = left + extra_mod_width + 2 * voice_padding;
 
  426  int top_height = kTopHeight * ratio;
 
  429  int keyboard_section_height = knob_section_height * 0.7f;
 
  430  int voice_height = height - top_height - keyboard_section_height;
 
  432  int section_one_width = 350 * ratio;
 
  433  int section_two_width = section_one_width;
 
  434  int audio_width = section_one_width + section_two_width + padding;
 
  435  int modulation_width = width - audio_width - extra_mod_width - 4 * voice_padding;
 
  437  header_->setTabOffset(extra_mod_width + 2 * voice_padding);
 
  438  header_->setBounds(left, top, width, top_height);
 
  439  Rectangle<int> main_bounds(main_x, top + top_height, audio_width, voice_height);
 
  441  if (synthesis_interface_)
 
  442    synthesis_interface_->setBounds(main_bounds);
 
  443  effects_interface_->setBounds(main_bounds.withRight(main_bounds.getRight() + voice_padding));
 
  444  modulation_matrix_->setBounds(main_bounds);
 
  445  int modulation_height = voice_height - knob_section_height - padding;
 
  446  modulation_interface_->setBounds(main_bounds.getRight() + voice_padding,
 
  447                                   main_bounds.getY(), modulation_width, modulation_height);
 
  449  int voice_y = top + height - knob_section_height - keyboard_section_height;
 
  452  int portamento_x = modulation_interface_->getRight() - portamento_width;
 
  453  portamento_section_->setBounds(portamento_x, voice_y, portamento_width, knob_section_height);
 
  455  int voice_width = modulation_interface_->getWidth() - portamento_width - padding;
 
  456  voice_section_->setBounds(modulation_interface_->getX(), voice_y, voice_width, knob_section_height);
 
  458  bend_section_->setBounds(left + voice_padding, top + height - knob_section_height - padding,
 
  459                           extra_mod_width, knob_section_height);
 
  461  int extra_mod_height = height - top_height - knob_section_height - padding - 1;
 
  462  extra_mod_section_->setBounds(left + voice_padding, top + top_height, extra_mod_width, extra_mod_height);
 
  464  int keyboard_height = keyboard_section_height - voice_padding - padding;
 
  465  int keyboard_x = extra_mod_section_->getRight() + voice_padding;
 
  466  int keyboard_width = modulation_interface_->getRight() - keyboard_x;
 
  467  keyboard_interface_->setBounds(keyboard_x, top + height - keyboard_height - padding, keyboard_width, keyboard_height);
 
  469  about_section_->setBounds(bounds);
 
  470  update_check_section_->setBounds(bounds);
 
  471  save_section_->setBounds(bounds);
 
  472  delete_section_->setBounds(bounds);
 
  473  download_section_->setBounds(bounds);
 
  475  Rectangle<int> browse_bounds(main_bounds.getX(), main_bounds.getY(),
 
  476                               width - main_bounds.getX(), main_bounds.getHeight());
 
  477  preset_browser_->setBounds(browse_bounds);
 
  478  bank_exporter_->setBounds(browse_bounds);
 
  481  modulation_manager_->setBounds(bounds);
 
  484    if (wavetable_edits_[i])
 
  485      wavetable_edits_[i]->setBounds(left, 0, width, height);
 
  488  if (synthesis_interface_) {
 
  490      master_controls_interface_->setOscillatorBounds(i, synthesis_interface_->getOscillatorBounds(i));
 
  492  master_controls_interface_->setBounds(main_bounds);
 
  494  if (full_screen_section_) {
 
  495    Rectangle<float> relative = synthesis_interface_->getOscillatorSection(0)->getWavetableRelativeBounds();
 
  496    int total_width = getWidth() / relative.getWidth();
 
  497    full_screen_section_->setBounds(-total_width * relative.getX(), 0, total_width, getHeight());
 
  500  if (getWidth() && getHeight())
 
 
  506    header_->setOscilloscopeMemory(memory);
 
  507  if (master_controls_interface_)
 
  508    master_controls_interface_->setOscilloscopeMemory(memory);
 
 
  513    header_->setAudioMemory(memory);
 
  514  if (master_controls_interface_)
 
  515    master_controls_interface_->setAudioMemory(memory);
 
 
  520  std::map<std::string, SynthSlider*> all_sliders = 
getAllSliders();
 
  521  std::map<std::string, SynthSlider*> modulatable_sliders;
 
  523  for (
auto& destination : mono_modulations) {
 
  524    if (all_sliders.count(destination.first))
 
  525      modulatable_sliders[destination.first] = all_sliders[destination.first];
 
  529                                                            modulatable_sliders, mono_modulations, poly_modulations);
 
  530  modulation_manager_->setOpaque(
false);
 
 
  536    open_gl_context_.setContinuousRepainting(
animate);
 
 
  543  ScopedLock lock(open_gl_critical_section_);
 
  545  if (modulation_interface_)
 
  546    modulation_interface_->reset();
 
  548  setting_all_values_ = 
true;
 
  551  if (effects_interface_ && effects_interface_->isVisible())
 
  552    effects_interface_->redoBackgroundImage();
 
  555  setting_all_values_ = 
false;
 
 
  560  ScopedLock lock(open_gl_critical_section_);
 
  561  setting_all_values_ = 
true;
 
  563  setting_all_values_ = 
false;
 
 
  568    if (wavetable_edits_[i])
 
  569      synthesis_interface_->setWavetableName(i, wavetable_edits_[i]->getName());
 
 
  574  if (auth_.
loggedIn() || authentication_ == 
nullptr)
 
  575    download_section_->triggerDownload();
 
  577    authentication_->setVisible(
true);
 
 
  581  double version_supported = OpenGLShaderProgram::getLanguageVersion();
 
  584    NativeMessageBox::showMessageBoxAsync(AlertWindow::WarningIcon, 
"Unsupported OpenGl Version",
 
  586                                          String(
"\nSupported version: ") + String(version_supported));
 
  590  shaders_ = std::make_unique<Shaders>(open_gl_context_);
 
  591  open_gl_.
shaders = shaders_.get();
 
  593  last_render_scale_ = display_scale_;
 
  595  background_.
init(open_gl_);
 
 
  603  float render_scale = open_gl_.
context.getRenderingScale();
 
  604  if (render_scale != last_render_scale_) {
 
  605    last_render_scale_ = render_scale;
 
  609  ScopedLock lock(open_gl_critical_section_);
 
  611  background_.
render(open_gl_);
 
  612  modulation_manager_->renderMeters(open_gl_, animate_);
 
 
  627  ScopedLock lock(open_gl_critical_section_);
 
  628  about_section_->setVisible(
true);
 
 
  632  delete_section_->setFileToDelete(preset);
 
  633  delete_section_->setVisible(
true);
 
 
  637  ScopedLock lock(open_gl_critical_section_);
 
  638  bool make_visible = !preset_browser_->isVisible() && !bank_exporter_->isVisible();
 
  640  if (synthesis_interface_)
 
  641    synthesis_interface_->setVisible(index == 0 && make_visible);
 
  643  effects_interface_->setVisible(index == 1 && make_visible);
 
  644  modulation_matrix_->setVisible(index == 2 && make_visible);
 
  645  master_controls_interface_->setVisible(index == 3 && make_visible);
 
  646  modulation_manager_->setModulationAmounts();
 
  647  modulation_manager_->resized();
 
  648  modulation_manager_->setVisibleMeterBounds();
 
  649  modulation_manager_->hideUnusedHoverModulations();
 
 
  654  ScopedLock lock(open_gl_critical_section_);
 
  655  preset_browser_->setVisible(
false);
 
  656  bank_exporter_->setVisible(
false);
 
  657  modulation_interface_->setVisible(
true);
 
  658  portamento_section_->setVisible(
true);
 
  659  voice_section_->setVisible(
true);
 
 
  664  ScopedLock lock(open_gl_critical_section_);
 
  665  preset_browser_->setVisible(visible);
 
  666  modulation_interface_->setVisible(!visible);
 
  667  portamento_section_->setVisible(!visible);
 
  668  voice_section_->setVisible(!visible);
 
  669  synthesis_interface_->setVisible(!visible);
 
  673    bank_exporter_->setVisible(
false);
 
  674    preset_browser_->repaintBackground();
 
  675    preset_browser_->grabKeyboardFocus();
 
  676    header_->setTemporaryTab(
"PRESET BROWSER");
 
  680    header_->setTemporaryTab(
"");
 
 
  685  ScopedLock lock(open_gl_critical_section_);
 
  686  bank_exporter_->setVisible(visible);
 
  687  modulation_interface_->setVisible(!visible);
 
  688  portamento_section_->setVisible(!visible);
 
  689  voice_section_->setVisible(!visible);
 
  690  synthesis_interface_->setVisible(!visible);
 
  694    preset_browser_->setVisible(
false);
 
  695    bank_exporter_->repaintBackground();
 
  696    header_->setTemporaryTab(
"EXPORT BANK");
 
  700    header_->setTemporaryTab(
"");
 
 
  705  preset_browser_->loadPresets();
 
 
  709  modulation_manager_->setVisibleMeterBounds();
 
 
  713  modulation_manager_->setVisibleMeterBounds();
 
 
  717  if (authentication_ && authentication_->isShowing())
 
  718    authentication_->setFocus();
 
  719  else if (synthesis_interface_ && synthesis_interface_->isShowing())
 
  720    synthesis_interface_->setFocus();
 
 
  725    header_->notifyChange();
 
 
  730    header_->notifyFresh();
 
 
  735    preset_browser_->externalPresetLoaded(preset);
 
 
  739  ScopedLock lock(open_gl_critical_section_);
 
  740  full_screen_section_ = full_screen;
 
  742  if (full_screen_section_) {
 
  744    full_screen_section_->setBounds(getLocalBounds());
 
  748    wavetable_edits_[i]->setVisible(
false);
 
  750  bool show_rest = full_screen == 
nullptr;
 
  751  header_->setVisible(show_rest);
 
  752  synthesis_interface_->setVisible(show_rest);
 
  753  modulation_interface_->setVisible(show_rest);
 
  754  keyboard_interface_->setVisible(show_rest);
 
  755  extra_mod_section_->setVisible(show_rest);
 
  756  modulation_manager_->setVisible(show_rest);
 
  757  voice_section_->setVisible(show_rest);
 
  758  bend_section_->setVisible(show_rest);
 
  759  portamento_section_->setVisible(show_rest);
 
 
  764  if (!wavetableEditorsInitialized())
 
  767  ScopedLock lock(open_gl_critical_section_);
 
  769    wavetable_edits_[i]->setVisible(i == index);
 
  771  bool show_rest = index < 0;
 
  772  header_->setVisible(show_rest);
 
  773  synthesis_interface_->setVisible(show_rest);
 
  774  modulation_interface_->setVisible(show_rest);
 
  775  keyboard_interface_->setVisible(show_rest);
 
  776  extra_mod_section_->setVisible(show_rest);
 
  777  modulation_manager_->setVisible(show_rest);
 
  778  voice_section_->setVisible(show_rest);
 
  779  bend_section_->setVisible(show_rest);
 
  780  portamento_section_->setVisible(show_rest);
 
 
  785  return wavetable_edits_[index]->getLastBrowsedWavetable();
 
 
  789  return wavetable_edits_[index]->getName();
 
 
  793  if (authentication_ == 
nullptr || !auth_.
loggedIn())
 
  796  return authentication_->getSignedInName();
 
 
  801    authentication_->signOut();
 
 
  805  if (authentication_) {
 
  806    authentication_->create();
 
  807    authentication_->setVisible(
true);
 
 
  816  if (wavetable_edits_[index])
 
  817    wavetable_edits_[index]->loadFile(wavetable);
 
 
  821  if (wavetable_edits_[index])
 
  822    wavetable_edits_[index]->loadWavetable(wavetable_data);
 
 
  826  if (wavetable_edits_[index])
 
  827    wavetable_edits_[index]->loadDefaultWavetable();
 
 
  831  if (wavetable_edits_[index])
 
  832    wavetable_edits_[index]->resynthesizeToWavetable();
 
 
  836  save_section_->setIsPreset(
false);
 
  837  save_section_->setSaveBounds();
 
  839  save_section_->setFileType(
"Wavetable");
 
  841  if (!destination.exists())
 
  842    destination.createDirectory();
 
  843  save_section_->setDirectory(destination);
 
  845  save_section_->setVisible(
true);
 
 
  849  save_section_->setIsPreset(
false);
 
  851  save_section_->setFileType(
"LFO");
 
  853  save_section_->setFileData(data);
 
  854  save_section_->setVisible(
true);
 
 
  858  if (wavetable_edits_[index])
 
  859    return wavetable_edits_[index]->getWavetableJson();
 
 
  865  if (wavetable_edits_[index])
 
  866    return wavetable_edits_[index]->loadAudioAsWavetable(name, audio_stream, style);
 
 
  873                                 String extensions, std::string passthrough_name,
 
  874                                 std::string additional_folders_name) {
 
  875  popup_browser_->setIgnoreBounds(getLocalArea(owner, owner->getLocalBounds()));
 
  876  popup_browser_->setBrowserBounds(getLocalArea(owner, bounds));
 
  877  popup_browser_->setVisible(
true);
 
  878  popup_browser_->grabKeyboardFocus();
 
  879  popup_browser_->setOwner(owner);
 
  880  popup_browser_->loadPresets(directories, extensions, passthrough_name, additional_folders_name);
 
 
  885    popup_browser_->setOwner(owner);
 
 
  889                                  std::function<
void(
int)> callback, std::function<
void()> cancel) {
 
  890  popup_selector_->setCallback(callback);
 
  891  popup_selector_->setCancelCallback(cancel);
 
  892  popup_selector_->showSelections(options);
 
  893  Rectangle<int> bounds(0, 0, std::ceil(display_scale_ * getWidth()), std::ceil(display_scale_ * getHeight()));
 
  894  popup_selector_->setPosition(getLocalPoint(source, position), bounds);
 
  895  popup_selector_->setVisible(
true);
 
 
  899                                      const PopupItems& options, std::function<
void(
int)> callback) {
 
  900  dual_popup_selector_->setCallback(callback);
 
  901  dual_popup_selector_->showSelections(options);
 
  902  Rectangle<int> bounds(0, 0, std::ceil(display_scale_ * getWidth()), std::ceil(display_scale_ * getHeight()));
 
  903  dual_popup_selector_->setPosition(getLocalPoint(source, position), width, bounds);
 
  904  dual_popup_selector_->setVisible(
true);
 
 
  908                                 BubbleComponent::BubblePlacement placement, 
bool primary) {
 
  909  PopupDisplay* display = primary ? popup_display_1_.get() : popup_display_2_.get();
 
  910  display->
setContent(text, getLocalArea(source, source->getLocalBounds()), placement);
 
  911  display->setVisible(
true);
 
 
  915  PopupDisplay* display = primary ? popup_display_1_.get() : popup_display_2_.get();
 
  917    display->setVisible(
false);
 
 
  921  if (modulation_matrix_)
 
  922    modulation_matrix_->updateModulations();
 
  923  if (modulation_interface_)
 
  924    modulation_interface_->checkNumShown();
 
  925  if (modulation_manager_)
 
  926    modulation_manager_->reset();
 
 
  930  if (modulation_matrix_)
 
  931    modulation_matrix_->updateModulationValue(index);
 
  932  if (modulation_manager_)
 
  933    modulation_manager_->setModulationAmounts();
 
 
  937  if (full_screen_section_)
 
 
  944  if (full_screen_section_)
 
 
  951  if (full_screen_section_)
 
 
Declares the AboutSection class, which displays information about the application and allows configur...
 
Declares the ContentList and BankExporter classes for exporting banks of presets, wavetables,...
 
Declares classes for pitch and modulation wheels, and the BendSection container.
 
bool loggedIn()
Always returns false, indicating no user is logged in.
Definition authentication.h:180
 
static DefaultLookAndFeel * instance()
Singleton instance accessor.
Definition default_look_and_feel.h:157
 
void hideDisplay(bool primary)
Hides a previously shown popup display.
Definition full_interface.cpp:914
 
void createModulationSliders(const vital::output_map &mono_modulations, const vital::output_map &poly_modulations)
Creates modulation sliders for both mono and poly modulations.
Definition full_interface.cpp:518
 
std::string getWavetableName(int index)
Gets the current wavetable name for a given oscillator.
Definition full_interface.cpp:788
 
void repaintOpenGlBackground(OpenGlComponent *component)
Repaints the background that shows behind OpenGL components.
Definition full_interface.cpp:338
 
void setWavetableNames()
Updates displayed wavetable names from the current wavetable data.
Definition full_interface.cpp:566
 
void modulationValueChanged(int index)
Called when a particular modulation value changes.
Definition full_interface.cpp:929
 
void renderOpenGL() override
Renders the GUI using OpenGL.
Definition full_interface.cpp:599
 
void effectsMoved() override
Called when the effects interface is moved, to update meter positions.
Definition full_interface.cpp:708
 
void newOpenGLContextCreated() override
Called when a new OpenGL context is created.
Definition full_interface.cpp:580
 
std::string getSignedInName()
Gets the name of the currently signed-in user, if any.
Definition full_interface.cpp:792
 
void animate(bool animate) override
Enables or disables animations (like continuous OpenGL repainting).
Definition full_interface.cpp:534
 
void setAudioMemory(const vital::StereoMemory *memory)
Assigns stereo audio memory for visualization.
Definition full_interface.cpp:511
 
void saveLfo(const json &data)
Opens a save dialog to save a given LFO shape.
Definition full_interface.cpp:848
 
void toggleFilter1Zoom()
Definition full_interface.cpp:943
 
bool loadAudioAsWavetable(int index, const String &name, InputStream *audio_stream, WavetableCreator::AudioFileLoadStyle style)
Loads an audio file as a wavetable into the given oscillator editor.
Definition full_interface.cpp:863
 
void copySkinValues(const Skin &skin)
Copies skin values from a Skin instance into the interface and look-and-feel.
Definition full_interface.cpp:270
 
void showFullScreenSection(SynthSection *full_screen)
Displays a full-screen section overlay, hiding other sections.
Definition full_interface.cpp:738
 
void tabSelected(int index) override
Handles user selecting a main tab (e.g., Synthesis, Effects, etc.)
Definition full_interface.cpp:636
 
void repaintSynthesisSection()
Repaints only the synthesis (oscillator/filter) section background.
Definition full_interface.cpp:322
 
void hideWavetableEditSection()
Hides any open wavetable editing section, returning to the normal view.
Definition full_interface.cpp:811
 
void notifyChange()
Notifies that a parameter or state has changed.
Definition full_interface.cpp:723
 
void toggleOscillatorZoom(int index)
Definition full_interface.cpp:936
 
void reset() override
Resets the entire interface to a default state.
Definition full_interface.cpp:542
 
virtual ~FullInterface()
Destructor.
Definition full_interface.cpp:239
 
void showAboutSection() override
Shows the "About" section overlay.
Definition full_interface.cpp:626
 
void dualPopupSelector(Component *source, Point< int > position, int width, const PopupItems &options, std::function< void(int)> callback)
Opens a dual popup selector for choosing from a hierarchical list of items.
Definition full_interface.cpp:898
 
virtual void resized() override
Adjusts layout and sizes of child components after the interface is resized.
Definition full_interface.cpp:375
 
void noDownloadNeeded() override
Indicates that no download is needed after checking updates.
Definition full_interface.cpp:287
 
void repaintChildBackground(SynthSection *child)
Repaints the background of a child section.
Definition full_interface.cpp:303
 
void notifyFresh()
Notifies that the interface is in a fresh state (no unsaved changes).
Definition full_interface.cpp:728
 
void resynthesizeToWavetable(int index)
Performs resynthesis of the current wavetable for the given oscillator.
Definition full_interface.cpp:830
 
void toggleFilter2Zoom()
Definition full_interface.cpp:950
 
void loadDefaultWavetable(int index)
Loads a default wavetable into the given oscillator editor.
Definition full_interface.cpp:825
 
void reloadSkin(const Skin &skin)
Reloads and applies a new skin, then adjusts layout accordingly.
Definition full_interface.cpp:276
 
void clearTemporaryTab(int current_tab) override
Clears temporary overlay tabs such as the preset browser.
Definition full_interface.cpp:653
 
void redoBackground()
Redraws the entire background image for the interface.
Definition full_interface.cpp:349
 
void saveWavetable(int index)
Opens a save dialog to save the current wavetable of an oscillator.
Definition full_interface.cpp:835
 
json getWavetableJson(int index)
Retrieves the JSON data representing the current wavetable for an oscillator.
Definition full_interface.cpp:857
 
void showWavetableEditSection(int index)
Shows the wavetable edit section for a given oscillator index.
Definition full_interface.cpp:763
 
void signIn()
Opens the sign-in interface, if available.
Definition full_interface.cpp:804
 
void loadWavetableFile(int index, const File &wavetable)
Loads a wavetable from a file into the given oscillator editor.
Definition full_interface.cpp:815
 
void setOscilloscopeMemory(const vital::poly_float *memory)
Assigns memory for oscilloscope visualization.
Definition full_interface.cpp:504
 
void startDownload()
Starts a download of additional content if needed.
Definition full_interface.cpp:573
 
void setAllValues(vital::control_map &controls) override
Sets all parameter values on the interface.
Definition full_interface.cpp:559
 
void deleteRequested(File preset) override
Handles a request to delete a preset file.
Definition full_interface.cpp:631
 
static constexpr double kMinOpenGlVersion
Minimum required OpenGL version for the interface to function properly.
Definition full_interface.h:66
 
void externalPresetLoaded(const File &preset)
Handles loading an external preset file into the interface.
Definition full_interface.cpp:733
 
void setPresetBrowserVisibility(bool visible, int current_tab) override
Toggles the visibility of the preset browser.
Definition full_interface.cpp:663
 
void dataDirectoryChanged() override
Called when the data directory changes.
Definition full_interface.cpp:283
 
void signOut()
Signs out the current user, if signed in.
Definition full_interface.cpp:799
 
void setBankExporterVisibility(bool visible, int current_tab) override
Toggles the visibility of the bank exporter.
Definition full_interface.cpp:684
 
void popupBrowser(SynthSection *owner, Rectangle< int > bounds, std::vector< File > directories, String extensions, std::string passthrough_name, std::string additional_folders_name)
Opens a popup browser for file browsing.
Definition full_interface.cpp:872
 
void popupDisplay(Component *source, const std::string &text, BubbleComponent::BubblePlacement placement, bool primary)
Shows a popup display (a tooltip-like bubble) with provided text.
Definition full_interface.cpp:907
 
void modulationsScrolled() override
Called when modulations are scrolled, to update meter positions.
Definition full_interface.cpp:712
 
void bankImported() override
Called when a new bank of presets has been imported, to refresh lists.
Definition full_interface.cpp:704
 
void checkShouldReposition(bool resize=true)
Checks if the interface should be repositioned or resized based on scaling or display changes.
Definition full_interface.cpp:365
 
void setFocus()
Sets keyboard focus to a relevant component (e.g., authentication).
Definition full_interface.cpp:716
 
std::string getLastBrowsedWavetable(int index)
Gets the last browsed wavetable file path for a given oscillator.
Definition full_interface.cpp:784
 
void loggedIn() override
Called when the user has successfully logged in.
Definition full_interface.cpp:296
 
virtual void paintBackground(Graphics &g) override
Paints the background of the entire interface.
Definition full_interface.cpp:246
 
void popupSelector(Component *source, Point< int > position, const PopupItems &options, std::function< void(int)> callback, std::function< void()> cancel)
Opens a popup selector for choosing from a list of items.
Definition full_interface.cpp:888
 
void openGLContextClosing() override
Called when the OpenGL context is closing, allowing cleanup of resources.
Definition full_interface.cpp:616
 
void needsUpdate() override
Indicates that a software update is available and needs action.
Definition full_interface.cpp:291
 
void modulationChanged()
Called when modulations have changed, updating the modulation matrix and related components.
Definition full_interface.cpp:920
 
void popupBrowserUpdate(SynthSection *owner)
Updates the popup browser's ownership, useful if the owner changed.
Definition full_interface.cpp:883
 
FullInterface()
Constructs a minimal, empty full interface.
Definition full_interface.cpp:224
 
void loadWavetable(int index, json &wavetable_data)
Loads a wavetable from a JSON object into the given oscillator editor.
Definition full_interface.cpp:820
 
static bool shouldWorkOffline()
Checks if Vital should operate in offline mode.
Definition load_save.cpp:1563
 
static File getUserWavetableDirectory()
Retrieves the user's wavetable directory.
Definition load_save.cpp:1798
 
static bool authenticated()
Checks if the user is authenticated.
Definition load_save.cpp:1599
 
static bool isExpired()
Checks if this build of Vital has expired.
Definition load_save.cpp:1529
 
static File getUserLfoDirectory()
Retrieves the user's LFO directory.
Definition load_save.cpp:1819
 
void unlock()
Unlocks the mutex previously locked by lock().
Definition open_gl_background.h:67
 
void updateBackgroundImage(Image background)
Updates the background image to a new one.
Definition open_gl_background.cpp:135
 
virtual void destroy(OpenGlWrapper &open_gl)
Cleans up OpenGL resources when the background is no longer needed.
Definition open_gl_background.cpp:52
 
virtual void init(OpenGlWrapper &open_gl)
Initializes OpenGL buffers and shader resources.
Definition open_gl_background.cpp:15
 
void lock()
Locks the mutex for thread-safe operations.
Definition open_gl_background.h:62
 
virtual void render(OpenGlWrapper &open_gl)
Renders the background image.
Definition open_gl_background.cpp:93
 
A base component class that integrates JUCE's Component with OpenGL rendering.
Definition open_gl_component.h:20
 
Manages the overall color and value theme (or "skin") of the user interface.
Definition skin.h:24
 
@ kModulationButtonWidth
Definition skin.h:101
 
@ kPadding
Definition skin.h:81
 
@ kLargePadding
Definition skin.h:82
 
@ kBackground
Definition skin.h:128
 
@ kBody
Definition skin.h:129
 
void copyValuesToLookAndFeel(LookAndFeel *look_and_feel) const
Copies global skin values into a LookAndFeel instance.
Definition skin.cpp:258
 
MidiKeyboardState * getKeyboardState()
Retrieves the keyboard state (for processing MIDI note events from a virtual keyboard).
Definition synth_base.h:491
 
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
 
virtual void renderOpenGlComponents(OpenGlWrapper &open_gl, bool animate)
Renders all OpenGL components in this section and sub-sections.
Definition synth_section.cpp:357
 
float getPadding()
Definition synth_section.cpp:660
 
virtual void animate(bool animate)
Triggers animation state change in sub-sections if needed.
Definition synth_section.cpp:822
 
void addSubSection(SynthSection *section, bool show=true)
Adds a subsection (another SynthSection) as a child.
Definition synth_section.cpp:457
 
virtual void setSkinValues(const Skin &skin, bool top_level)
Sets skin values (colors, sizes) and applies them to sub-sections.
Definition synth_section.cpp:86
 
virtual void resized() override
Called when the component is resized. Arranges layout of child components.
Definition synth_section.cpp:35
 
std::map< std::string, ModulationButton * > getAllModulationButtons()
Gets all modulation buttons registered in this section.
Definition synth_section.h:669
 
void paintChildBackground(Graphics &g, SynthSection *child)
Paints a child's background specifically.
Definition synth_section.cpp:292
 
void paintChildrenBackgrounds(Graphics &g)
Paints the backgrounds for all child sections.
Definition synth_section.cpp:274
 
virtual void paintChildrenShadows(Graphics &g)
Paints shadows for child sections.
Definition synth_section.cpp:260
 
void paintKnobShadows(Graphics &g)
Paints knob shadows for all sliders.
Definition synth_section.cpp:253
 
virtual void destroyOpenGlComponents(OpenGlWrapper &open_gl)
Destroys all OpenGL components in this section and sub-sections.
Definition synth_section.cpp:383
 
virtual void setSizeRatio(float ratio)
Sets the size ratio for scaling UI elements.
Definition synth_section.cpp:246
 
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
 
float getKnobSectionHeight()
Definition synth_section.cpp:633
 
void paintChildShadow(Graphics &g, SynthSection *child)
Paints a child's shadow specifically.
Definition synth_section.cpp:301
 
std::map< std::string, SynthSlider * > getAllSliders()
Gets all sliders registered in this section.
Definition synth_section.h:657
 
virtual void setAllValues(vital::control_map &controls)
Sets values for all known parameters from a control map.
Definition synth_section.cpp:827
 
virtual void reset()
Resets the section and all sub-sections.
Definition synth_section.cpp:30
 
virtual void initOpenGlComponents(OpenGlWrapper &open_gl)
Initializes all OpenGL components in this section and sub-sections.
Definition synth_section.cpp:349
 
float getDisplayScale() const
Definition synth_section.cpp:719
 
void paintOpenGlBackground(Graphics &g, OpenGlComponent *child)
Paints the background of an OpenGlComponent child.
Definition synth_section.cpp:310
 
AudioFileLoadStyle
Defines how audio files are interpreted when loading into a wavetable.
Definition wavetable_creator.h:33
 
A specialized MemoryTemplate for two-channel (stereo) audio.
Definition memory.h:216
 
Declares the DeleteSection class, which provides a confirmation overlay for deleting a preset file.
 
Declares the DownloadSection class, providing a UI for downloading and installing preset packs.
 
Declares the EffectsInterface class and related components for managing and displaying multiple effec...
 
nlohmann::json json
Definition line_generator.h:7
 
constexpr int kNumOscillators
Number of oscillators available in Vital.
Definition synth_constants.h:16
 
constexpr int kDefaultWindowHeight
Default height of the Vital window (in pixels).
Definition synth_constants.h:64
 
constexpr int kMinWindowWidth
Minimum allowable window width.
Definition synth_constants.h:67
 
constexpr int kDefaultWindowWidth
Default width of the Vital window (in pixels).
Definition synth_constants.h:61
 
std::map< std::string, Output * > output_map
Maps parameter names to Output pointers, representing output signals from various modules.
Definition synth_types.h:229
 
const std::string kWavetableExtension
File extension for Vital wavetable files.
Definition synth_constants.h:88
 
constexpr int kMinWindowHeight
Minimum allowable window height.
Definition synth_constants.h:70
 
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
 
const std::string kLfoExtension
File extension for Vital LFO shape files.
Definition synth_constants.h:100
 
OpenGLContext & context
The OpenGLContext for current rendering.
Definition shaders.h:181
 
float display_scale
Display scaling factor for high-DPI rendering.
Definition shaders.h:183
 
Shaders * shaders
Pointer to the Shaders instance providing compiled shaders.
Definition shaders.h:182
 
A struct holding references and data used by the GUI to interact with the SynthBase.
Definition synth_gui_interface.h:27
 
vital::output_map poly_modulations
Polyphonic modulation values.
Definition synth_gui_interface.h:37
 
vital::control_map controls
Current set of parameter controls from the synth.
Definition synth_gui_interface.h:35
 
vital::output_map modulation_sources
All available modulation sources.
Definition synth_gui_interface.h:38
 
vital::output_map mono_modulations
Mono (global) modulation values.
Definition synth_gui_interface.h:36
 
SynthBase * synth
Pointer back to the associated SynthBase.
Definition synth_gui_interface.h:40
 
WavetableCreator * wavetable_creators[vital::kNumOscillators]
Array of pointers to wavetable creators for each oscillator.
Definition synth_gui_interface.h:39
 
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600