# Noise Gate - AUv3 Validation Error

**URL:** <https://forum.juce.com/t/noise-gate-auv3-validation-error/33317>\
**Category:** Audio Plugins\
**Created:** [May 9, 2019, 8:07pm UTC](https://forum.juce.com/t/noise-gate-auv3-validation-error/33317 "2019-05-09T20:07:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aashnap](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@aashnap](https://forum.juce.com/u/aashnap)\
**Post date:** [May 9, 2019, 8:07pm UTC](https://forum.juce.com/t/noise-gate-auv3-validation-error/33317/1 "2019-05-09T20:07:52Z")

</div>

I’m trying to build the NoiseGate example plugin that you have for AUv3.  
The plugin builds but crashes when validating with auval.

The error that shows is:  
In the format test : ERROR: Initialised Unit incorrectly set to InputChans:3 OutputChans:1

Any help on how to solve this?

 ![05%20PM](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/a/ac2234c8c68d38ca3eb746c6d353a7711a5980ff.png)

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [January 29, 2024, 4:57am UTC](https://forum.juce.com/t/noise-gate-auv3-validation-error/33317/2 "2024-01-29T04:57:11Z")

</div>

Hi,  
Did anyone of the JUCE team looked at this at some point?

It seems that symmetrical I/O greater than stereo fails with JUCE built and AUv3.

I was able to reproduce the above issue with latest `develop` and AudioPluginDemo by commenting out the following:

```auto
        // only allow stereo and mono
        if (mainOutput.size() > 2)
            return false;

```

This results:

```auto
Reported Channel Capabilities (explicit):
      [-1, -1]  

Input/Output Channel Handling:
1-1 1-2 1-4 1-5 1-6 1-7 1-8 2-2 2-4 2-5 2-6 2-7 2-8 4-4 4-5 5-5 6-6 7-7 8-8
X X X X X X X     
ERROR: Initialised Unit incorrectly set to InputChans:3 OutputChans:1

WARNING: Source AU supports multi-channel output but does not provide a channel layout

* * FAIL
--------------------------------------------------
AU VALIDATION FAILED: CORRECT THE ERRORS ABOVE.
--------------------------------------------------

```

(I was able to reproduce this with several projects, even if I explicitly set number of channels so it don’t spit the warning just the error).

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [January 29, 2024, 8:10am UTC](https://forum.juce.com/t/noise-gate-auv3-validation-error/33317/3 "2024-01-29T08:10:43Z")

</div>

In general, it feels AUv3 has many issues within the JUCE wrapper.  
(I’ll try to look deeper but this I think there are many issues within the JUCE wrapper itself and multi-channel / layouts).

> [@SurroundPluginDemo AUv3 incorrect channel mapping in Logic Pro 10.7.6](https://forum.juce.com/t/surroundplugindemo-auv3-incorrect-channel-mapping-in-logic-pro-10-7-6/54580):
>
> This is about SurroundPluginDemo in JUCE 7.0.4 when building in AUv3 format. First of all it doesn’t pass AU validation (AuVal tool) and crashes Logic — You need comment creating AUX input and output audio busses: AudioProcessor (BusesProperties().withInput ("Input", AudioChannelSet::stereo()) //.withInput ("Aux", AudioChannelSet::stereo(), false) .withOutput ("Output", AudioChannelSet::stereo())) …

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [February 1, 2024, 10:08am UTC](https://forum.juce.com/t/noise-gate-auv3-validation-error/33317/4 "2024-02-01T10:08:08Z")

</div>

It seems the problem with AUv3 is in  
`bool shouldChangeToFormat (AVAudioFormat* format, AUAudioUnitBus* auBus)`

> **[shouldChangeToFormat:forBus: | Apple Developer Documentation](https://developer.apple.com/documentation/audiotoolbox/auaudiounit/1439999-shouldchangetoformat)**
>
> This is called when you set the format on a bus.

It correctly checks and change the bus layout. (eg we’re allowed to have 3 inputs).  
But it invalidates the entire layout (where now, the condition of equality between Inputs and Outputs is broken).

So ideally, you’d like to check for the entire target layout within the call.

Eg (demo code);

```auto
                auto currentBusLayout = processor.getBusesLayout();
                auto& curBus = currentBusLayout.getBuses(isInput).getReference(busIdx);
                curBus = newLayout;
                if (!processor.checkBusesLayoutSupported (currentBusLayout))
                    return false;

```

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [July 11, 2024, 8:50pm UTC](https://forum.juce.com/t/noise-gate-auv3-validation-error/33317/5 "2024-07-11T20:50:24Z")

</div>

Thanks for your patience. I think this issue must have got lost around all of the JUCE 8 work.

I think that the ERROR and WARNING lines in the auval output refer to two separate issues.

The ERROR seems to be triggered when the plugin accepts a new bus layout while the audio unit is in an initialised state. I’ve pushed a change here that fixes the error:

> <https://github.com/juce-framework/JUCE/commit/b3fdcdc928ca3cab10b091985fbbc43a665b92db>

The WARNING is a bit trickier. It sounds like the plugin needs to advertise its channel layouts somewhere, but I’m not entirely sure where this needs to happen. If I update the AUAudioUnitBuses to provide the list of supported channel layout tags, then this causes new errors elsewhere during the validation. At the moment I haven’t made much progress here.
