From 2818bd736a8ec6e7d5a609e5694cc5dc2c8686fd Mon Sep 17 00:00:00 2001 From: "Raine M. Ekman" Date: Mon, 5 Jan 2015 17:40:14 +0200 Subject: [PATCH] Looks like locking the mutex in SF2 player is needed around a few more operations than before, at least while importing MIDI. Should fix #1544 --- plugins/sf2_player/sf2_player.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 91d9d6e8f..f2acd2f07 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -649,14 +649,19 @@ void sf2Instrument::play( sampleFrame * _working_buffer ) if( m_lastMidiPitch != currentMidiPitch ) { m_lastMidiPitch = currentMidiPitch; + m_synthMutex.lock(); fluid_synth_pitch_bend( m_synth, m_channel, m_lastMidiPitch ); + m_synthMutex.unlock(); + } const int currentMidiPitchRange = instrumentTrack()->midiPitchRange(); if( m_lastMidiPitchRange != currentMidiPitchRange ) { m_lastMidiPitchRange = currentMidiPitchRange; + m_synthMutex.lock(); fluid_synth_pitch_wheel_sens( m_synth, m_channel, m_lastMidiPitchRange ); + m_synthMutex.unlock(); } // if we have no new noteons/noteoffs, just render a period and call it a day if( m_playingNotes.isEmpty() )