Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-german committed May 4, 2024
1 parent cff1beb commit ce9ad81
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 21 deletions.
10 changes: 4 additions & 6 deletions Source/blocks_plugin_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,11 @@ void PluginProcessor::editorAdjustedBlock(Index index, int parameter, float valu
}

void PluginProcessor::editorChangedModulationMagnitude(int index, float magnitude) {
synth_->getModuleManager().getConnection(index)->amount_parameter_->set(magnitude);
// synth_->getModuleManager().getConnection(index)->amount_parameter_->set(magnitude);
}

void PluginProcessor::editorChangedModulationPolarity(int index, bool bipolar) {
// synth_->getModuleManager().getConnection(index)->bipolar_parameter_->set(bipolar);
synth_->getModuleManager().getConnection(index)->getParameter("bipolar")->set(bipolar);
// moduleManager.getConnection(index)->setPolarity(bipolar);
}

void PluginProcessor::editorAdjustedTab(int column, int parameter, float value) {
Expand Down Expand Up @@ -427,7 +425,7 @@ void PluginProcessor::editorConnectedModulation(int modulatorIndex, std::string
synth_->connectModulation(modulatorIndex, target_name, parameter);
}

void PluginProcessor::editorDisconnectedModulation(int modulator_index, std::string target_name, std::string parameter) {
void PluginProcessor::editorDisconnectedModulation(int modulator_index, std::string target_name, std::string parameter) { // remove modulator index and add source id
auto connection = synth_->getModuleManager().getConnection(modulator_index, target_name, parameter);
disconnect(connection);
}
Expand Down Expand Up @@ -788,8 +786,8 @@ std::vector<std::shared_ptr<model::Block>> PluginProcessor::editorPastedIndices(
auto modulator = synth_->getModuleManager().getModule(connection->source->name);
auto target = synth_->getModuleManager().getModule(new_block->name);
auto model = synth_->getModuleManager().addConnection(modulator, target, connection->parameter_name_);
model->amount_parameter_->value = connection->amount_parameter_->value;
model->bipolar_parameter_->value = connection->bipolar_parameter_->value;
model->parameter_map_["amount"]->value_processor->set(connection->parameter_map_["amount"]->value);
model->parameter_map_["bipolar"]->value_processor->set(connection->parameter_map_["bipolar"]->value);
connectModulationFromModel(model);
}
}
Expand Down
2 changes: 0 additions & 2 deletions Source/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ struct Connection: Module {
Connection(Module* target, Module* modulator, int parameterIndex, float magnitude, int number, bool bipolar = false);
Connection(int number);
~Connection();
std::shared_ptr<vital::ValueDetails> amount_parameter_;
std::shared_ptr<vital::ValueDetails> bipolar_parameter_;
vital::ModulationConnection* vital_connection_;

std::shared_ptr<Module> source;
Expand Down
2 changes: 1 addition & 1 deletion Source/gui/modulation_state_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void ModulationStateManager::handleModulationHoverEnd(const ModulatorComponent*

void ModulationStateManager::handleModulationHover(const ModulatorComponent* modulator_component) {
auto slider = dynamic_cast<BlocksSlider*>(last_hovered_slider_->getParentComponent()->getParentComponent());
for (auto& modulation : current_connections_) {
for (auto modulation : current_connections_) {
bool same_source = modulation->source->id == modulator_component->model_id_;
bool same_target = modulation->target->id == slider->module_id_;
bool same_parameter = modulation->parameter_name_ == slider->parameter_name_;
Expand Down
8 changes: 6 additions & 2 deletions Source/gui/slider_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ void SliderContainer::spawnSlider(vital::ValueDetails parameter, std::shared_ptr

labeled_slider->box_slider_.juce_slider_.setRange(parameter.min, parameter.max, interval);

if (parameter.min < 0) {
labeled_slider->box_slider_.juce_slider_.getProperties().set("isCenter", true);
bool centered = false;
if (parameter.name == "tempo") {
centered = false;
} else if (parameter.min < 0) {
centered = true;
}
labeled_slider->box_slider_.juce_slider_.getProperties().set("isCenter", centered);

if (parameter.string_lookup) {
labeled_slider->box_slider_.juce_slider_.textFromValueFunction = [parameter](double value) { return juce::String(parameter.string_lookup[(int)value]); };
Expand Down
2 changes: 0 additions & 2 deletions Source/model/PresetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ Preset Preset::create(std::string name,
modulationInfo.target = connection->target->name;
modulationInfo.number = connection->id.number;
modulationInfo.bipolar = static_cast<bool>(connection->getParameter("bipolar")->value_processor->value());
// modulationInfo.bipolar = static_cast<bool>(connection->bipolar_parameter_->value_processor->value());
// modulationInfo.amount = connection->amount_parameter_->value_processor->value();
modulationInfo.amount = connection->getParameter("amount")->value_processor->value();

info.connections_.push_back(modulationInfo);
Expand Down
1 change: 1 addition & 0 deletions Source/model/column_control_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace model {
class ColumnControl: public Module {
public:
ColumnControl(int number): Module("column control", number) {
display_name = "lane " + std::to_string(number);
add({ .name = "level", .default_value = 1.0 });
add({ .name = "pan", .min = -1.0 });
}
Expand Down
8 changes: 1 addition & 7 deletions Source/vital/common/synth_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ vital::modulation_change SynthBase::createModulationChange(vital::ModulationConn
auto target_processor = getVoiceHandler()->active_processor_map_[connection->destination_name];

change.source = source->output();

if (connection->parameter_name.find("amount") != std::string::npos) { // this hack allows for the modulation of the amount of a modulation
connection->parameter_name = connection->destination_name + " amount";
target_processor = getVoiceHandler();
Expand Down Expand Up @@ -853,12 +853,6 @@ void SynthBase::connectModulation(int modulator_index, std::string target_name,
auto destination_scale = parameter->max - parameter->min;

bool is_env_to_osc_level = connection_model->source->id.type == "envelope" && connection_model->target->id.type == "osc" && connection_model->parameter_name_ == "level";

if (is_env_to_osc_level) {
parameter_name = "amp env destination";
} else if (connection_model->target->id.type == "modulation") {
// parameter_name = "modulation destination";
}
parameter_name = is_env_to_osc_level ? "amp env destination" : parameter_name;

if (is_env_to_osc_level) {
Expand Down
1 change: 1 addition & 0 deletions Source/vital/common/synth_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct ValueDetails {
int decimal_places = 2;
bool hidden = false;
bool modulatable = true;
bool is_centered = false;
void set(mono_float value) {
this->value = value;
this->value_processor->set(value);
Expand Down
2 changes: 1 addition & 1 deletion Source/vital/synthesis/modules/blocks_voice_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void BlocksVoiceHandler::removeBlock(Index index, std::shared_ptr<model::Block>

processor_pool_[block->id.type].push_back(processor);
processor_matrix_[index.column][index.row] = nullptr;
active_processor_map_[block->name] = nullptr;
// active_processor_map_[block->name] = nullptr;
}

void BlocksVoiceHandler::addBlock(std::shared_ptr<model::Block> block) {
Expand Down

0 comments on commit ce9ad81

Please sign in to comment.