unloadSoundfont method
Unload the current soundfont and free resources
Implementation
@override
Future<bool> unloadSoundfont() async {
_loaded = false;
final starting = _starting;
_starting = null;
_synth = null;
_removeGestureListener();
final context = _context;
_context = null;
try {
final synth = await starting;
synth?.stopAll(true);
synth?.destroy();
} catch (_) {
// Start-up failed, so there is nothing to destroy.
}
try {
await context?.close().toDart;
} catch (_) {}
return true;
}