Closed banjerluke closed 2 years ago
Welp, I fixed it:
- try self.player.load(url: sample.url, buffered: true)
+ try self.player.load(url: sample.url)
This eliminates ALL of those console messages, and drops CPU use down to the same (kinda high) levels as when using stereo files.
I noticed that if I put mono MP3 files in the audio-package, the CPU bogs down (to the point of unresponsiveness) with lots of the following error in the console:
This happens every time a file is
loadedscheduled for playback, even if it's already loaded and buffered!AudioPlayer+Scheduling.swift:16
callsAudioPlayer.updateBuffer()
, I guess to reload the file from disk in case it's changed? I checked, and indeed the buffer is available just before the call toAudioPlayer.play()
...This is a bummer because my samples are mono, and switching to stereo MP3 files means a big increase in file sizes – not quite 2x but still painful. Can you think of any way around this?