Skip to content

Commit

Permalink
Update PluginAutomationModel
Browse files Browse the repository at this point in the history
  • Loading branch information
FangCunWuChang committed Jan 26, 2024
1 parent d0f0f14 commit a340c3c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/ui/component/PluginPropComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ void PluginPropComponent::update() {

this->automaticModel->update();
this->automaticList->updateContent();
this->automaticList->repaint();
}
}

Expand Down
27 changes: 25 additions & 2 deletions src/ui/dataModel/PluginAutomationModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,34 @@ void PluginAutomationModel::update() {
}

void PluginAutomationModel::addItem() {
/** TODO */
if (!this->plugin) { return; }

switch (this->type) {
case PluginType::Instr: {
CoreActions::addInstrParamCCLinkGUI(this->plugin);
break;
}
case PluginType::Effect: {
CoreActions::addEffectParamCCLinkGUI(this->plugin);
break;
}
}
}

void PluginAutomationModel::editItem(int itemIndex) {
/** TODO */
if (!this->plugin) { return; }
auto& [param, paramName, cc, ccName] = this->listTemp.getReference(itemIndex);

switch (this->type) {
case PluginType::Instr: {
CoreActions::editInstrParamCCLinkGUI(this->plugin, param, cc);
break;
}
case PluginType::Effect: {
CoreActions::editEffectParamCCLinkGUI(this->plugin, param, cc);
break;
}
}
}

void PluginAutomationModel::removeItem(int itemIndex) {
Expand Down
16 changes: 12 additions & 4 deletions src/ui/misc/CoreActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,20 +574,24 @@ void CoreActions::insertInstrGUI() {

void CoreActions::editInstrParamCCLinkGUI(quickAPI::PluginHolder instr,
int paramIndex, int defaultCC) {
/** TODO */
auto callback = [instr, paramIndex](int cc) { CoreActions::setInstrParamCCLink(instr, paramIndex, cc); };
CoreActions::askForPluginMIDICCGUIAsync(callback, instr, PluginType::Instr, defaultCC);
}

void CoreActions::addInstrParamCCLinkGUI(quickAPI::PluginHolder instr) {
/** TODO */
auto callback = [instr](int param) { CoreActions::editInstrParamCCLinkGUI(instr, param); };
CoreActions::askForPluginParamGUIAsync(callback, instr, PluginType::Instr);
}

void CoreActions::editEffectParamCCLinkGUI(quickAPI::PluginHolder effect,
int paramIndex, int defaultCC) {
/** TODO */
auto callback = [effect, paramIndex](int cc) { CoreActions::setEffectParamCCLink(effect, paramIndex, cc); };
CoreActions::askForPluginMIDICCGUIAsync(callback, effect, PluginType::Effect, defaultCC);
}

void CoreActions::addEffectParamCCLinkGUI(quickAPI::PluginHolder effect) {
/** TODO */
auto callback = [effect](int param) { CoreActions::editEffectParamCCLinkGUI(effect, param); };
CoreActions::askForPluginParamGUIAsync(callback, effect, PluginType::Effect);
}

bool CoreActions::askForSaveGUI() {
Expand Down Expand Up @@ -983,6 +987,7 @@ void CoreActions::askForPluginMIDICCGUIAsync(
if (name.isNotEmpty()) {
item += (" (" + name + ")");
}
ccItemList.add(item);
}

/** Create Selector */
Expand All @@ -999,6 +1004,9 @@ void CoreActions::askForPluginMIDICCGUIAsync(
if (defaultCCChannel > -1) {
combo->setSelectedItemIndex(defaultCCChannel);
}
auto chooserSize = selectorWindow->getLocalBounds();
combo->setBounds(0, 0,
chooserSize.getWidth() / 6 * 5, chooserSize.getHeight() / 5);
selectorWindow->addCustomComponent(combo.get());

/** Show Selector Async */
Expand Down

0 comments on commit a340c3c

Please sign in to comment.