Skip to main content

resetSoundFonts

since 0.9.4

Description​

This function resets the player internally to not have any SoundFont loaded anymore. This allows you to reduce the memory usage of the page if multiple partial SoundFonts are loaded via loadSoundFont(..., true). Depending on the workflow you might also just want to use loadSoundFont(..., false) once instead of unloading the previous SoundFonts.

Signatures​

TypeValues
function resetSoundFonts()JavaScriptUnloads all presets from the previous loaded SoundFonts.
void ResetSoundFonts().netUnloads all presets from the previous loaded SoundFonts.

Parameters​

None

Examples​

var api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
api.loadSoundFont('/assets/guitars.sf2', true);
api.loadSoundFont('/assets/pianos.sf2', true);
// ..
api.resetSoundFonts();
api.loadSoundFont('/assets/synths.sf2', true);
$('#alphaTab').alphaTab('loadSoundFont', '/assets/guitars.sf2', true);
$('#alphaTab').alphaTab('loadSoundFont', '/assets/pianos.sf2', true);
...
$('#alphaTab').alphaTab('resetSoundFonts');
$('#alphaTab').alphaTab('loadSoundFont', '/assets/synths.sf2', true);
var api = new AlphaTabApi<MyControl>(...);
api.LoadSoundFont(System.IO.File.OpenRead("guitars.sf2"), true);
api.LoadSoundFont(System.IO.File.OpenRead("pianos.sf2"), true);
...
api.ResetSoundFonts();
api.LoadSoundFont(System.IO.File.OpenRead("synths.sf2"), true);