audio engine: bypass v2 param setter to silence per-note AudioKit warnings
Created by: jedmund
Summary
-
PianoVoice's per-note writes toosc.frequency/osc.amplitude/ etc. went through AudioKit's@Parametersetter, which calls the legacy CAudioUnitSetParameter. For Soundpipe nodes that call fails and spamskAudioUnitErr_InvalidParameterinto the console viaCheckErroron every keypress and every envelope tick. - Route those writes through
AUParameterTree'ssetValue(_:originator:)via a smallsetSafelyhelper. The DSP reads from the parameter tree, so audio is unchanged; the spurious error log goes away for every write we control. - Scope: only
synthesize/Services/AudioEngine.swift.
What this does and doesn't fix
- Silences warnings from our own writes in
PianoVoice.init,start, and the decay envelope task (previously ~150+ warnings per sustained note). - Does not silence warnings emitted from inside SoundpipeAudioKit's own node constructors (
DynamicOscillator()writing its own defaultfrequency/amplitude, etc.). Those still fire ~27 per newPianoVoiceand ~338 at app launch fromSynthPlayground's preallocated graph. Addressing those requires either a global log suppression or the architectural voice-pool refactor queued up for a follow-up branch.
Test plan
-
Build + run on iPad simulator. -
Play several notes from PlayableKeyboard; confirm piano timbre, attack, and release are unchanged. -
Trigger scale playback in Circle of Fifths Explorer and ScaleExplorer; confirm console no longer floods with kAudioUnitErr_InvalidParameterwhile notes are sustaining and decaying. -
IntervalTrainer / IntervalComparison play-root-then-target sequences still sound correct.