New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playbackDevice.writeSamples eating CPU #2252

Closed
tnelsond opened this Issue Aug 21, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@tnelsond
Copy link

tnelsond commented Aug 21, 2014

On my system which is a 64-bit Linux box using Alsa for sound, the call to writeSamples on a AudioDevice maxes out a CPU core if the samplerate is 30khz (30000) or higher; however hardly any at all ( < 10% CPU) is used when the samplerate is 20khz (20000) or lower. 44.1khz and 48khz also maxes out a CPU.

Android seems to have no problem whatsoever.

@badlogic

This comment has been minimized.

Copy link
Member

badlogic commented Aug 31, 2014

That's an issue in the audio driver for which we have no solution. We could look into the OpenAL sources, but that really just calls into the platform dependend audio API. I'm afraid there's not much we can do.

@badlogic badlogic closed this Aug 31, 2014

mgsx-dev added a commit to mgsx-dev/libgdx that referenced this issue Nov 26, 2016

fixes libgdx#2252
With sample rate of 44100 Hz or above, Thread doesn't sleep and eat CPU.
Thread should sleep one buffer duration.
@mgsx-dev

This comment has been minimized.

Copy link
Contributor

mgsx-dev commented Dec 30, 2016

Issue is not related to audio driver but to java code (see my PR that fix it)

badlogic added a commit that referenced this issue Jan 4, 2017

Merge pull request #4442 from mgsx-dev/fix/lwjgl-audio
fixes #2252 reduce CPU usage in OpenALAudioDevice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment