In FluidSynth 2.2.0 an extra state was added to denote stopping. To transition from this state to a stopped state the rendering needs to be running. Since04ce1f07locking was added that skipped the rendering when something else held a lock, so the state would never get to stopped and join would never return. (cherry picked from commit6bd7f8816d)
This commit is contained in:
		
				
					committed by
					
						
						Jonathan G Rennison
					
				
			
			
				
	
			
			
			
						parent
						
							0d1c848f78
						
					
				
				
					commit
					e71798381b
				
			@@ -163,14 +163,21 @@ void MusicDriver_FluidSynth::PlaySong(const MusicSongInfo &song)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void MusicDriver_FluidSynth::StopSong()
 | 
					void MusicDriver_FluidSynth::StopSong()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		std::lock_guard<std::mutex> lock{ _midi.synth_mutex };
 | 
							std::lock_guard<std::mutex> lock{ _midi.synth_mutex };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!_midi.player) return;
 | 
							if (!_midi.player) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fluid_player_stop(_midi.player);
 | 
							fluid_player_stop(_midi.player);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* The join must be run without lock as the Music rendering needs to be
 | 
				
			||||||
 | 
						 * running so FluidSynth's internals can actually stop the playing. */
 | 
				
			||||||
	if (fluid_player_join(_midi.player) != FLUID_OK) {
 | 
						if (fluid_player_join(_midi.player) != FLUID_OK) {
 | 
				
			||||||
		DEBUG(driver, 0, "Could not join player");
 | 
							DEBUG(driver, 0, "Could not join player");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						std::lock_guard<std::mutex> lock{ _midi.synth_mutex };
 | 
				
			||||||
	delete_fluid_player(_midi.player);
 | 
						delete_fluid_player(_midi.player);
 | 
				
			||||||
	fluid_synth_system_reset(_midi.synth);
 | 
						fluid_synth_system_reset(_midi.synth);
 | 
				
			||||||
	fluid_synth_all_sounds_off(_midi.synth, -1);
 | 
						fluid_synth_all_sounds_off(_midi.synth, -1);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user