i don't know if it's me or if i found some kind of issue with AKWaveTable.
Basically when i load an audiofile (a short one, about 7 seconds) and assign it to AKWaveTable for sampling and then later i try to replace it with another one, the new file is loaded, but the allocated memory keeps on growing.
Here's the pseudo code:
class Element {
var player:AKWaveTable?
//other stuff
init(_ path:String){
let temp_file = try AKAudioFile(readFileName: path)
self.player = AKWaveTable(audioFile: temp_file)
}
}
At some point in my code:
//declare array of class Element
var sample:[Element] = []
//and put something into it's elements
sample[n] = Element("path/to/file.wav")
//do some stuff
//then replace that sample with another file
sample[n] = Element("path/to/another/file.wav")
This same process, done with AKPlayer works fine, but i really need AKWaveTable for better performance.
After some consecutive replacing of audio samples the memory allocated grows quite fast to up 900MB!
What am i doing wrong? Any help would be appreciated, Thank you!
The app is for MacOS.
Swift 4.2
AudioKit 4.5.2
Xcode 10.0
MacOS High Sierra 10.13.6
One other thing to point out, probably not a good idea to continue to create new AKWavetables. You can't do that anyway with the audio engine running, for instance.
If you can, set the max size to your longest sample, and then just use load(file: AKAudioFile) to load a new file when you need it.
The leak has been fixed and will be out w next version of AK.
Thank yall