Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Sources/SoundpipeAudioKit/Generators/PhaseLockedVocoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ public class PhaseLockedVocoder: Node {
self.amplitude = amplitude
self.pitchRatio = pitchRatio
}


Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


/// 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])
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

internal func loadFile(_ avAudioFile: AVAudioFile) {
Exit: do {
var err: OSStatus = noErr
Expand Down Expand Up @@ -160,10 +166,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
}
}
}
Expand Down
Loading