Procedural Sound experiencing sound bleed.

I’m in the process of building a waveform oscillator; which while not perfect is developing well.

This particular oscillator is supposed to be able to change waveforms (sin,square,saw,triangle) on the fly, but for whatever reason the previous waveform is bleeding into the new sound.

I can manually clear it by setting the oscillator to 0Hz freq, changing waveform, and then raising the frequency back up.

My code doesn’t hang onto the sound data longer than to fill the OnSoundWaveProceduralUnderflow.BindLambda method and the data on my end of the code is cleared immediately thereafter. My best guess is that either SoundWaveProcedural or UAudioComponent is retaining data unintentionally (not my intention anyway).

Is there a method in SoundWaveProcedural or UAudioComponent to flush out old data without having to stop the audioComponent from playing?

Stop using private variables in virtual functions please! - Feedback for Unreal Engine team - Unreal Engine Forums!

Found this method this morning and implemented it, but the results are the same; somehow when I change waveshapes, the previous waveshape persists bleeding into the new sound. And with this methodology, there is no point in my code that ‘hangs on’ to the old data. How do I clear out this ‘echo’ I’m getting in my sound without having to stop the sound as it eventually drowns out any waveshape I try to change to?

I’m not 100% sure this is the solution but I realized that UAudioComponent added some unwanted Spatialization and/or Attenuation. Setting those flags (bAllowSpatialization/bOverrideAttenuation) to false seemed to get rid of the phantom echo, except when I first changed the waveshape. As soon as I changed the frequency now the echo seems to disappear.

If someone could explain why that’s a thing; I’d appreciate it.