-
Notifications
You must be signed in to change notification settings - Fork 260
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 player termination after stopping and restarting #1273
Conversation
If using the sample timer, reset cur_msec=0 in fluid_player_play() since the sample timer is also reset. This way fluid_player_callback() will not misinterpret the player's cur_msec < msec as being due to a fluid_synth_get_ticks overflow.
Kudos, SonarCloud Quality Gate passed! |
#1236 added a check that fluid_synth_get_ticks() has not overflowed by comparing the sample timer's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thanks for looking into this. However, I don't think this is correct. cur_msec
is needed to process tempo change events correctly. We can't just reset it because the user has called e.g. fluid_player_stop(); fluid_player_play();
. Yes, the fluid_player_callback
restores cur_msec
, but still I believe this could easily break something else that we currently don't see (we don't know because there is not a single test for the player).
I prefer a more conservative change here, which is to simply memorize the msec
send by the synth in fluid_player_callback
and compare against that accordingly.
#1270 doesn't use the player, so this is unrelated.
Sorry it's been a while for me to come back to this. I still think If we are as of #1236 also going to use |
Well, if you're sure that directly manipulating I'm thinking of use-cases like seeking in the file with and without stopping / starting the player; manipulating the tempo via an external timesource and switching back to internal, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed my opinion. I once again looked through the code, checked any side-effects but couldn't find one. It should work, just as you said. I'll take this now hoping to release 2.3.4 later today.
Excuse the confusion and thanks again!
Thanks! I was confident it would work, but I was trying to find time to write a player test to prove it. I will hopefully do this for an upcoming commit. |
* commit '683270db64302e59d26b9610514af1cfe0a80493': Bump to 2.3.5 Fix libinstpatch and sndfile not being discovered on Windows (FluidSynth#1299) Update FreeBSD CI: Drop 12.4 and add 14.0 Fix some rounding issues due to double promotion (FluidSynth#1286) Bump to 2.3.4 Fix player termination after stopping and restarting (FluidSynth#1273) fix for issue FluidSynth#1268: Pipewire's Jack implementation not found (FluidSynth#1269) Fix issue with CMake Xcode generator (FluidSynth#1266) Refurbish CI (FluidSynth#1267) Fallback to IPv4 when creating socket if IPv6 is not available (FluidSynth#1208) (FluidSynth#1265) Turn off pending notes and issue a warning (FluidSynth#1264) Fix incorrect way of turning CMAKE_INSTALL_LIBDIR absolute (FluidSynth#1261)
If using the sample timer, reset cur_msec=0 in fluid_player_play() since the sample timer is also reset. This way fluid_player_callback() will not misinterpret the player's cur_msec < msec as being due to a fluid_synth_get_ticks overflow.