import AVFoundation
let eq = AVAudioUnitEQ(numberOfBands: 1)
eq.bands[0].bandwidth /
eq.bands[0].bypass /
eq.bands[0].frequency /
eq.bands[0].gain /
let fullState = eq.auAudioUnit.fullState
eq.bands[0].bandwidth = 1
eq.bands[0].bypass = false
eq.bands[0].frequency = 20
eq.bands[0].gain = 1
eq.bands[0].bandwidth // 1
eq.bands[0].bypass // false
eq.bands[0].frequency // 20
eq.bands[0].gain // 1
eq.auAudioUnit.fullState = fullState
eq.bands[0].bandwidth //Should be 0.5 but is 1
eq.bands[0].bypass // Should be false but is true
eq.bands[0].frequency // Should be 40 but is 20
eq.bands[0].gain // Should be 0 but is 1
The above code can be put in a playground for quick verification. The thing is that the `fullState` does get applied, because the sound is effected when running this test in a working AudioEngine. What seems to be broken is that the band parameters are not updated.
I think GarageBand is broken due to this same issue. To reproduce:
Note that this is on iOS GB, MacOS GB does not seem to have this issue.
- Create a new song.
- Add a track
- Add one of the "Apple" "Audio Unit Extensions" such as "AUDelay" to the track
- Change the settings on the effect, like max out all the faders
- Now go back to "My Songs" (This will save the song. Which should save the effect settings)
- Upon opening the song and effect again you will see the settings did not save --- yet they did
If you listen to the effect it seems to accually apply the save, but the parameters look all wrong. This seems to be the same that is happening with me in the code above.
- If you download a AudioUnit extension app and plug it in the same way in GB it will work as expected.
I think GB is just saving `AUAudioUnit.fullState` in its "Songs".
Apple's own AUAudioUnits seem to not be updating their parameters.
I guess I am going to file a bug, but I just like to discuss on a forum to confirm things. I would love to get anyones thoughts.