Skip to content
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

Fix #7885: [Fluidsynth] Use recommended method of setting sample rate #7983

Merged
merged 1 commit into from Feb 7, 2020

Conversation

nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Feb 7, 2020

This is a large changeset for a small change.

As the only way to get the sample rate for the synth is to install the music render routine, it has to be installed before the synth is ready for use. This means the render routine could risk being called while the synth is not fully set up.
For this reason, set up full mutex protection of the synth objects.

@nielsmh nielsmh changed the title Fix #7884: [Fluidsynth] Use recommended method of setting sample rate Fix #7885: [Fluidsynth] Use recommended method of setting sample rate Feb 7, 2020
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

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

LGTM

@nielsmh
Copy link
Contributor Author

nielsmh commented Feb 7, 2020

There's some tiny risk of popping if the mutex happens to be locked exactly when the render routine is called. The only potentially common situation would be if the user is adjusting volume, or playback state is being queried, so the risk should be quite small. Probably fine.

@nielsmh nielsmh merged commit 04ce1f0 into OpenTTD:master Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants