[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Fluidsynth questions: 2.0.5 release / threading

From: Tom M.
Subject: Re: [fluid-dev] Fluidsynth questions: 2.0.5 release / threading
Date: Fri, 19 Apr 2019 09:27:35 +0200

Hi Stefan,

pls. also send a copy to our mailing list the next time.

> I've seen that my fixes should be in 2.0.5. Do you have an approximate idea 
> when this fluidsynth release will be available?


> Another question I have is related to threading. I'd like to use two 
> fluid_synth_t* instances in two different threads with two different 
> soundfonts to render two different midi tracks. I'm assuming that I can call 
> fluid_synth_process() independently on these two instances from two threads 
> and they will not interfere in any way, right?

Yes. Each synth has it's own mutex, which is used if the setting 
"synth.threadsafe-api" is true (the default). Apart from that all synths share 
a sample cache as global ressource, which is always mutex protected.

> And if I do so, the processing speed would effectively be doubled if I have 2 
> cores, because the rendering would be fully parallel?

It should, I haven't tested it. However I cannot recommend to create multiple 
synths just to increase rendering speed. You should instead create only one 
synth. Before creation, set the setting "synth.cpu-cores" to the number of 
cores you want to use for rendering [1]. Load all soundfonts you want to use 
into the synth. Make sure every MIDI track you want to render is playing on its 
own MIDI channel. Then you can use fluid_synth_sfont_select() to select the 
soundfont for each MIDI channel [2]. And by using multichannel rendering, you 
will also be able to render each MIDI channel to its own audio channel, if 
required, see [3].

[1] http://www.fluidsynth.org/api/fluidsettings.xml#synth.cpu-cores
[3] http://www.fluidsynth.org/api/fluidsynth_process_8c-example.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]