bool AudioProcessor::Bus::isLayoutSupported (const AudioChannelSet& set) const { bool isInputBus; int busIdx; busDirAndIndex (isInputBus, busIdx); BusesLayout layouts = getBusesLayoutForLayoutChangeOfBus (set); return (layouts.getChannelSet (isInputBus, busIdx) == set); }
bool IAAEffectProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const { if (layouts.getMainInputChannelSet() != AudioChannelSet::stereo()) return false; if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet()) return false; return true; }
bool AudioProcessor::containsLayout (const BusesLayout& layouts, const Array<InOutChannelPair>& channelLayouts) { if (layouts.inputBuses.size() > 1 || layouts.outputBuses.size() > 1) return false; const InOutChannelPair mainLayout (static_cast<int16> (layouts.getNumChannels (true, 0)), static_cast<int16> (layouts.getNumChannels (false, 0))); return channelLayouts.contains (mainLayout); }
bool AudioProcessor::setChannelLayoutOfBus (bool isInputBus, int busIdx, const AudioChannelSet& layout) { if (Bus* bus = getBus (isInputBus, busIdx)) { BusesLayout layouts = bus->getBusesLayoutForLayoutChangeOfBus (layout); if (layouts.getChannelSet (isInputBus, busIdx) == layout) return applyBusLayouts (layouts); return false; } // busIdx parameter is invalid jassertfalse; return false; }
bool ATKJUCEAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const { #if JucePlugin_IsMidiEffect ignoreUnused (layouts); return true; #else // This is the place where you check if the layout is supported. if (layouts.getMainOutputChannelSet() != AudioChannelSet::stereo()) return false; // This checks if the input layout matches the output layout #if ! JucePlugin_IsSynth if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet()) return false; #endif return true; #endif }
bool AudioProcessor::applyBusLayouts (const BusesLayout& layouts) { if (layouts == getBusesLayout()) return true; const int numInputBuses = getBusCount (true); const int numOutputBuses = getBusCount (false); const int oldNumberOfIns = getTotalNumInputChannels(); const int oldNumberOfOuts = getTotalNumOutputChannels(); if (layouts.inputBuses. size() != numInputBuses || layouts.outputBuses.size() != numOutputBuses) return false; for (int busIdx = 0; busIdx < numInputBuses; ++busIdx) { Bus& bus = *getBus (true, busIdx); const AudioChannelSet& set = layouts.getChannelSet (true, busIdx); bus.layout = set; if (! set.isDisabled()) bus.lastLayout = set; } for (int busIdx = 0; busIdx < numOutputBuses; ++busIdx) { Bus& bus = *getBus (false, busIdx); const AudioChannelSet& set = layouts.getChannelSet (false, busIdx); bus.layout = set; if (! set.isDisabled()) bus.lastLayout = set; } const bool channelNumChanged = (oldNumberOfIns != getTotalNumInputChannels() || oldNumberOfOuts != getTotalNumOutputChannels()); audioIOChanged (false, channelNumChanged); return true; }
bool AudioProcessor::setBusesLayoutWithoutEnabling (const BusesLayout& arr) { const int numIns = getBusCount (true); const int numOuts = getBusCount (false); jassert (arr.inputBuses. size() == numIns && arr.outputBuses.size() == numOuts); BusesLayout request = arr; const BusesLayout current = getBusesLayout(); for (int i = 0; i < numIns; ++i) if (request.getNumChannels (true, i) == 0) request.getChannelSet (true, i) = current.getChannelSet (true, i); for (int i = 0; i < numOuts; ++i) if (request.getNumChannels (false, i) == 0) request.getChannelSet (false, i) = current.getChannelSet (false, i); if (! checkBusesLayoutSupported(request)) return false; for (int dir = 0; dir < 2; ++dir) { const bool isInput = (dir != 0); for (int i = 0; i < (isInput ? numIns : numOuts); ++i) { Bus& bus = *getBus (isInput, i); AudioChannelSet& set = request.getChannelSet (isInput, i); if (! bus.isEnabled()) { if (! set.isDisabled()) bus.lastLayout = set; set = AudioChannelSet::disabled(); } } } return setBusesLayout (request); }
//============================================================================== bool isBusesLayoutSupported (const BusesLayout& layouts) const override { // the sidechain can take any layout, the main bus needs to be the same on the input and output return (layouts.getMainInputChannelSet() == layouts.getMainOutputChannelSet() && (! layouts.getMainInputChannelSet().isDisabled())); }
//============================================================================== bool isBusesLayoutSupported (const BusesLayout& layouts) const override { return (layouts.getMainInputChannels() == 2); }