Skip to content

Commit

Permalink
Fix ogg/vorbis stuttering on Android
Browse files Browse the repository at this point in the history
The existing 20Hz buffering for ogg/vorbis playback isn't sufficient on android.  It results in stuttering when using digital music on both an emulated android device on a laptop and on two native android devices.  Increasing to 1Hz buffering,  Note: I haven't extensively tested to find the minimum needed for these Android devices, so this could be tuned down to a smaller value if there are memory concerns.
  • Loading branch information
ceckak committed Jul 26, 2021
1 parent 8a16683 commit c2ed852
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions audio/AudioMixer.cc
Expand Up @@ -85,9 +85,9 @@ id_counter(0), device(nullptr)
desired.callback = sdlAudioCallback;
desired.userdata = this;

// Set update rate to 20 Hz, or there abouts. This should be more then adequate for everyone
// Set update rate to 1 Hz, or there abouts. This should be more than adequate for everyone
desired.samples=1;
while(desired.samples<=desired.freq/30) desired.samples<<=1;
while(desired.samples<=desired.freq) desired.samples<<=1;

// Open SDL Audio (even though we may not need it)
SDL_InitSubSystem(SDL_INIT_AUDIO);
Expand Down

3 comments on commit c2ed852

@DominusExult
Copy link

Choose a reason for hiding this comment

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

This is very strange but this commit breaks Exult on macOS. It stalls on creating the AudioMixer. And I didn't even have the digitial music enabled. Will need to investigate even more.

@DominusExult
Copy link

Choose a reason for hiding this comment

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

anything >= /2 works

@ceckak
Copy link
Owner Author

@ceckak ceckak commented on c2ed852 Jul 27, 2021

Choose a reason for hiding this comment

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

Strange. I'll reduce it to /2 in the patch and add a comment about it for future reference/investigation.

Please sign in to comment.