text
stringlengths
0
2.2M
if (btn == &enabledToggle && enabledToggle.isEnabled())
{
if (auto* p = owner.getAudioProcessor())
{
if (auto* bus = p->getBus (isInput, currentBus))
{
if (bus->isEnabled() != enabledToggle.getToggleState())
{
bool success = enabledToggle.getToggleState() ? bus->enable()
: bus->setCurrentLayout (AudioChannelSet::disabled());
if (success)
{
updateBusLayout();
if (auto* config = owner.getConfig (! isInput))
config->updateBusLayout();
owner.update();
}
else
{
enabledToggle.setToggleState (! enabledToggle.getToggleState(),
NotificationType::dontSendNotification);
}
}
}
}
}
}
//==============================================================================
void addColumn() override
{
if (auto* p = owner.getAudioProcessor())
{
if (p->canAddBus (isInput))
{
if (p->addBus (isInput))
{
updateBusButtons();
updateBusLayout();
if (auto* config = owner.getConfig (! isInput))
{
config->updateBusButtons();
config->updateBusLayout();
}
}
owner.update();
}
}
}
void removeColumn() override
{
if (auto* p = owner.getAudioProcessor())
{
if (p->getBusCount (isInput) > 1 && p->canRemoveBus (isInput))
{
if (p->removeBus (isInput))
{
currentBus = jmin (p->getBusCount (isInput) - 1, currentBus);
updateBusButtons();
updateBusLayout();
if (auto* config = owner.getConfig (! isInput))
{
config->updateBusButtons();
config->updateBusLayout();
}
owner.update();
}
}
}
}
void columnSelected (int columnId) override
{
const int newBus = columnId - 1;
if (currentBus != newBus)
{
currentBus = newBus;
ioBuses.setSelected (currentBus + 1);
updateBusLayout();
}
}
//==============================================================================
IOConfigurationWindow& owner;
Label ioTitle, name;
Label nameLabel { "nameLabel", "Bus Name:" };
Label layoutLabel { "layoutLabel", "Channel Layout:" };
ToggleButton enabledToggle { "Enabled" };
ComboBox layouts;
NumberedBoxes ioBuses;