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: Total reset of DMusic driver once every hour #7639

Closed
wants to merge 1 commit into from

Conversation

nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jul 5, 2019

Supposedly there are issues with the MS softsynth if it plays continuously for a long time, attempt to work around this by resetting it.

See this comment by @James103 describing the problem.

Supposedly there are issues with the MS softsynth if it plays continuously for a long time, attempt to work around this by resetting it.
@James103
Copy link
Contributor

James103 commented Jul 5, 2019

Are you gonna provide a way to manually reset the DMusic driver if, for example, the automatic reset didn't work or for debugging?

@nielsmh
Copy link
Contributor Author

nielsmh commented Jul 5, 2019

I can make the reset interval configurable, and make a console command to force a reset on next song change.

@LordAro
Copy link
Member

LordAro commented Jul 5, 2019

I don't like this solution, it's far too much of a hack to fix something that isn't properly understood. It could even be a dmusic bug, rather than anything in OTTD

Giving the ability to manually reset it might be an option, or perhaps just reset it in the general case when switching music sets?

@Eddi-z
Copy link
Contributor

Eddi-z commented Jul 5, 2019

if we're seriously discussing hacks to work around problems elsewhere, maybe we could even send a reset after every song, which could work around #7637?

maybe guard that with an advanced/hidden setting?

@nielsmh
Copy link
Contributor Author

nielsmh commented Jul 5, 2019

@LordAro I agree this is hacky, but based on the problem description I can't think of a better fix. The only things that stay around between songs in the DMusic driver in OTTD are the DirectMusic objects and some integer timekeeping. The song data itself is re-read into a fresh structure every time a song is started, there isn't any way for them to suddenly partially lose data that couldn't just as well occur from the beginning.

Resetting after N song changes, or after a music set change, likely do not make sense. As far as the DirectMusic library is concerned there isn't any distinction between songs, it's just a stream of note data. The music driver also doesn't care about switching music sets, it just gets instructed to play a file with no knowledge of how that file was chosen. And if the user switches songs multiple times quickly it doesn't seem to cause the issue, so it has to be based on time.
Providing a manual reset command might be enough, but it'd still require keeping most of these changes :)

@Eddi-z The problem discussed in #7637 is specific to the extmidi driver on Linux, when used with aplaymidi (rather than the default of timidity) to send the MIDI to a hardware synth, it doesn't relate to the DMusic driver at all.

@James103 Have you been able to test whether my previous music fixes (proper GM reset before each song) have improved the situation?

@James103
Copy link
Contributor

James103 commented Jul 6, 2019

@nielsmh
Due to OpenTTD/website#91 and since I don't have a compiler, I can't test any of your midi fixes nor can I test the multi-tile dock feature merged in #7380.

@TrueBrain
Copy link
Member

@James103 that sounds really odd, given OpenTTD/website#91 is a closed ticket. Are you sure this is blocking you?

@James103
Copy link
Contributor

James103 commented Jul 6, 2019

@nielsmh Fixed! First time I loaded website, cache gave me "20190606" (6th June 2019) for the nightly. Reloading the website (clear cache) reset the latest nightly version to "20190704" (4th July 2019).

@nielsmh
Copy link
Contributor Author

nielsmh commented Jul 6, 2019

@James103 You mean #7620 does fix the "broken notes" issue after a long time of music, without needing the total teardown in this PR?

@James103
Copy link
Contributor

James103 commented Jul 6, 2019

No, I meant that the OpenTTD website now gives the correct nightly version. The fix still needs testing.

@nielsmh
Copy link
Contributor Author

nielsmh commented Sep 27, 2019

I'm attempting to test whether this is still required now by leaving 1.9.3 playing music through the DMusic driver overnight, if it's still working fine in the morning I'll close this as not needed.

@nielsmh
Copy link
Contributor Author

nielsmh commented Sep 28, 2019

After having 1.9.3 play through the DMusic driver with MS softsynth for 10 hours, there are no problems with music rendition. This patch is not necessary.

@nielsmh nielsmh closed this Sep 28, 2019
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

5 participants