lessons learned from a-fluidsynth
authorRobin Gareus <robin@gareus.org>
Wed, 24 Aug 2016 19:32:45 +0000 (21:32 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 24 Aug 2016 20:37:20 +0000 (22:37 +0200)
libs/ardour/fluid_synth.cc

index 2978e48181e32b56700cf5de97190f615c20ab11..30d70bb876c5653f2443effc18d891fe8806689a 100644 (file)
@@ -88,6 +88,15 @@ FluidSynth::load_sf2 (const std::string& fn)
                 return false;
         }
 
+        /* boostrap synth engine. The first call re-initializes the choruscw
+               * (fluid_rvoice_mixer_set_samplerate) which is not rt-safe.
+               */
+        float l[1024];
+        float r[1024];
+        fluid_synth_all_notes_off (self->synth, -1);
+        fluid_synth_all_sounds_off (self->synth, -1);
+        fluid_synth_write_float (self->synth, 1024, l, 0, 1, r, 0, 1);
+
         return true;
 }