mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-11 21:31:18 +00:00
Parallelize SF2 loading (#812)
The loading of SF2 samples can be parallelized as well, at least for bigger soundfonts like the Stgiga 4GB monster. The following test is performed with hot-caches: `time src/fluidsynth -i -a alsa Stgiga\'s\ HiDef\ Soundfont\ \(2019-05-25\).sf2` Serial version: ``` real 0m15,460s user 0m14,163s sys 0m1,192s ``` Parallelized version proposed by this PR: ``` real 0m5,851s user 0m14,089s sys 0m1,194s ```
This commit is contained in:
parent
ea5ebe4813
commit
c32faa7b17
2 changed files with 9 additions and 6 deletions
|
@ -421,6 +421,8 @@ int fluid_defsfont_load_all_sampledata(fluid_defsfont_t *defsfont, SFData *sfdat
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma omp task firstprivate(sample, defsfont) default(none)
|
||||
{
|
||||
/* Data pointers of SF2 samples point to large sample data block loaded above */
|
||||
sample->data = defsfont->sampledata;
|
||||
|
@ -429,6 +431,7 @@ int fluid_defsfont_load_all_sampledata(fluid_defsfont_t *defsfont, SFData *sfdat
|
|||
fluid_voice_optimize_sample(sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sample_parsing_result;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ struct _fluid_sample_t
|
|||
{
|
||||
char name[21]; /**< Sample name */
|
||||
|
||||
/* The following for sample pointers store the original pointers from the Soundfont
|
||||
/* The following four sample pointers store the original pointers from the Soundfont
|
||||
* file. They are never changed after loading and are used to re-create the
|
||||
* actual sample pointers after a sample has been unloaded and loaded again. The
|
||||
* actual sample pointers get modified during loading for SF3 (compressed) samples
|
||||
|
|
Loading…
Reference in a new issue