diff --git a/Sources/SoundpipeAudioKit/Effects/ZitaReverb.swift b/Sources/SoundpipeAudioKit/Effects/ZitaReverb.swift index 735dded..9a99b57 100644 --- a/Sources/SoundpipeAudioKit/Effects/ZitaReverb.swift +++ b/Sources/SoundpipeAudioKit/Effects/ZitaReverb.swift @@ -114,7 +114,7 @@ public class ZitaReverb: Node { identifier: "EQ Frequency 2", name: "EQ Frequency 2", address: akGetParameterAddress("ZitaReverbParameterEqualizerFrequency2"), - defaultValue: 1500.0, + defaultValue: 1000.0, range: 160.0 ... 1000.0, unit: .hertz ) diff --git a/Sources/SoundpipeAudioKit/Generators/PhaseLockedVocoder.swift b/Sources/SoundpipeAudioKit/Generators/PhaseLockedVocoder.swift index 81b4d64..2ce556f 100644 --- a/Sources/SoundpipeAudioKit/Generators/PhaseLockedVocoder.swift +++ b/Sources/SoundpipeAudioKit/Generators/PhaseLockedVocoder.swift @@ -79,7 +79,12 @@ public class PhaseLockedVocoder: Node { self.amplitude = amplitude self.pitchRatio = pitchRatio } - + + /// Call this function after you are done with the node, to reset the au wavetable to prevent memory leaks + public func dispose() { + au.setWaveTable([0.0]) + } + internal func loadFile(_ avAudioFile: AVAudioFile) { Exit: do { var err: OSStatus = noErr @@ -160,10 +165,11 @@ public class PhaseLockedVocoder: Node { au.setWavetable(data: data, size: Int(ioNumberFrames)) } else { // failure - theData?.deallocate() - theData = nil // make sure to return NULL Log("Error = \(err)"); break Exit } + // Fixing a previous memory leak + theData?.deallocate() + theData = nil } } }