Open kkaczmarczyk opened 1 year ago
That's a good point. Maybe the extension is playing sounds for every caret in the editor? I'm sorry to say that I don't have the time to fix it, but I'll gladly review PRs with improvements like this.
It happens even without multiple cursors - often just fast typing. Could you suggest place where I can fix it? I can probably make the PR. I enjoy these Fallout keyboard sounds and now I can't use this extension :(
The extension already creates only one sound player in memory when loading, so that's already optimized. For this same reason, sound files are already in WAV format, which is less resource consuming that MP3 files.
I guess that you could find a lighter player, or lower the quality of the wav files, but I suspect this depends highly on the processing power of the computer using the extension. I haven't had this happen to me, even in my old MacBook.
Also, I have not tested this extension very much in Windows or Linux, so it might be that the player we're using for those OSs is not as lightweight as it should.
Can I try to install a different, more lightweight player for the MacOS though and force extension to use it?
FWIW the memory is alright, only the CPU spikes go above 100%. Unsure why, but maybe some other software interacts with coreaudiod
- although the issue is only with the extensions such as this.
Sure! We're using the play-sound library for this extension, and as you can see in that link, it allows you to select different players.
You could fork this repo, clone it, test on your local, and if you find a player that works better, you could make a PR with the fixes to this repo, so I could publish the new version of the extension with the fix :)
Whenever I would type fast there are very high CPU spikes and if I am listening to the music in the background, the music is breaking apart. Happens especially whenever I am using multiple cursors and editing text. High CPU spikes seems to be related with
coreaudiod
process.