void GraphicalStepSequencer::showRealtimeFeedback() {
  if (step_generator_output_ == nullptr) {
    SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
    if (parent)
      step_generator_output_ = parent->getModSource(getName().toStdString());
  }
}
Пример #2
0
void SynthSection::buttonClicked(juce::Button *clicked_button) {
  std::string name = clicked_button->getName().toStdString();
  SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
  parent->valueChangedInternal(name, clicked_button->getToggleState() ? 1.0 : 0.0);

  if (clicked_button == activator_)
    setActive(activator_->getToggleStateValue().getValue());
}
Пример #3
0
void WaveViewer::showRealtimeFeedback() {
  if (wave_state_ == nullptr) {
    SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
    if (parent) {
      wave_state_ = parent->getModSource(getName().toStdString());
      startTimerHz(FRAMES_PER_SECOND);
    }
  }
}
Пример #4
0
void SynthSlider::mouseUp(const MouseEvent& e) {
  Slider::mouseUp(e);

  SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
  if (parent)
    parent->endChangeGesture(getName().toStdString());

  if (isRotary() && !e.mods.isPopupMenu()) {
    setMouseCursor(MouseCursor::ParentCursor);
    Desktop::getInstance().getMainMouseSource().setScreenPosition(click_position_);
  }
}
Пример #5
0
void SynthSlider::mouseDown(const MouseEvent& e) {
  SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();

  if (e.mods.isPopupMenu()) {
    PopupMenu m;

    if (isDoubleClickReturnEnabled())
      m.addItem(kDefaultValue, "Set to Default Value");

    std::vector<mopo::ModulationConnection*> connections;
    if (parent) {
      m.addItem(kArmMidiLearn, "Learn MIDI Assignment");
      if (parent->isMidiMapped(getName().toStdString()))
        m.addItem(kClearMidiLearn, "Clear MIDI Assignment");

      connections = parent->getDestinationConnections(getName().toStdString());

      String disconnect("Disconnect from ");
      for (int i = 0; i < connections.size(); ++i)
        m.addItem(kModulationList + i, disconnect + connections[i]->source);

      if (connections.size() > 1)
        m.addItem(kClearModulations, "Disconnect all modulations");
    }

    int result = m.show();
    if (result == kArmMidiLearn) {
      parent->armMidiLearn(getName().toStdString(), getMinimum(), getMaximum());
    }
    else if (result == kClearMidiLearn) {
      parent->clearMidiLearn(getName().toStdString());
    }
    else if (result == kDefaultValue) {
      setValue(getDoubleClickReturnValue());
    }
    else if (result == kClearModulations) {
      for (mopo::ModulationConnection* connection : connections) {
        std::string source = connection->source;
        parent->disconnectModulation(connection);
      }
    }
    else if (result >= kModulationList) {
      int connection_index = result - kModulationList;
      std::string source = connections[connection_index]->source;
      parent->disconnectModulation(connections[connection_index]);
    }
  }
  else {
    Slider::mouseDown(e);

    if (parent)
      parent->beginChangeGesture(getName().toStdString());
    if (isRotary()) {
      click_position_ = e.getScreenPosition().toFloat();
      setMouseCursor(MouseCursor::NoCursor);
    }
  }
}
Пример #6
0
void GraphicalStepSequencer::showRealtimeFeedback(bool show_feedback) {
  if (show_feedback) {
    if (step_generator_output_ == nullptr) {
      SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
      startTimerHz(FRAMES_PER_SECOND);
      if (parent)
        step_generator_output_ = parent->getModSource(getName().toStdString());
    }
  }
  else {
    stopTimer();
    step_generator_output_ = nullptr;
    last_step_ = -1;
    repaint();
  }
}
Пример #7
0
void WaveViewer::showRealtimeFeedback(bool show_feedback) {
  if (show_feedback) {
    if (wave_phase_ == nullptr) {
      SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
      if (parent) {
        wave_amp_ = parent->getModSource(getName().toStdString());
        wave_phase_ = parent->getModSource(getName().toStdString() + "_phase");
        startTimerHz(FRAMES_PER_SECOND);
      }
    }
  }
  else {
    wave_phase_ = nullptr;
    stopTimer();
    repaint();
  }
}
Пример #8
0
void AboutSection::setVisible(bool should_be_visible) {
  if (should_be_visible && device_selector_.get() == nullptr) {
    SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
    AudioDeviceManager* device_manager = parent->getAudioDeviceManager();
    if (device_manager) {
      device_selector_ = new AudioDeviceSelectorComponent(*device_manager, 0, 0,
                                                          mopo::NUM_CHANNELS, mopo::NUM_CHANNELS,
                                                          true, false, false, false);
      device_selector_->setLookAndFeel(TextLookAndFeel::instance());
      addAndMakeVisible(device_selector_);
      Rectangle<int> info_rect = getInfoRect();
      int y = info_rect.getY() + LOGO_WIDTH + 2 * PADDING_Y;
      device_selector_->setBounds(info_rect.getX(), y,
                                  info_rect.getWidth(), info_rect.getBottom() - y);
      resized();
    }
  }

  Component::setVisible(should_be_visible);
}
Пример #9
0
void SaveSection::save() {
  SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
  SparseSet<int> selected_rows = folders_view_->getSelectedRows();
  if (selected_rows.size() == 0)
    return;

  File folder = folders_model_->getFileAtRow(selected_rows[0]);
  String patch_name = patch_name_->getText();
  if (patch_name.length() == 0)
    return;

  File save_file = folder.getChildFile(patch_name);
  if (save_file.getFileExtension() != mopo::PATCH_EXTENSION)
    save_file = save_file.withFileExtension(String(mopo::PATCH_EXTENSION));
  save_file.replaceWithText(JSON::toString(parent->getSynth()->saveToVar(author_->getText())));

  patch_name_->clear();
  setVisible(false);
  if (listener_)
    listener_->fileSaved(save_file);
}
Пример #10
0
void SynthSection::sliderValueChanged(Slider* moved_slider) {
  std::string name = moved_slider->getName().toStdString();
  SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();
  parent->valueChangedInternal(name, moved_slider->getValue());
}