File tree Expand file tree Collapse file tree
oxisynth/src/core/soundfont Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,20 @@ pub struct SoundFont {
2222 presets : Vec < Arc < Preset > > ,
2323}
2424
25+ // SondFont::load() might be slow due to IO or SF3 vorbis decompression,
26+ // so we want to allow the font to be loaded on a different thread.
27+ //
28+ // Technically we could also do `load_asnyc()` variant, but IMO that's redundant.
29+ const _: fn ( ) = {
30+ fn assert_send_sync < T : Send + Sync > ( ) { }
31+ assert_send_sync :: < SoundFont >
32+ } ;
33+
2534impl SoundFont {
35+ /// Load SoundFont™ file, once loaded it can be added to the synth with [crate::Synth::add_font()].
36+ ///
37+ /// This operation might be quite slow due to blocking IO operations and potential SF3 vorbis decompression,
38+ /// so you might consider loading on a secondary thread. [SoundFont] is both [Send] and [Sync].
2639 pub fn load < F : Read + Seek > ( file : & mut F ) -> Result < Self , LoadError > {
2740 let sf2 = soundfont:: SoundFont2 :: load ( file) ?;
2841
You can’t perform that action at this time.
0 commit comments