loadSoundfontBytes method

  1. @override
Future<bool> loadSoundfontBytes(
  1. Uint8List bytes
)
override

Load a soundfont from its raw bytes. Used on the web, where there is no file system to write the file to.

Implementation

@override
Future<bool> loadSoundfontBytes(Uint8List bytes) async {
  try {
    // Copy: SpessaSynth takes ownership of (detaches) the buffer it gets.
    return await _loadBuffer(Uint8List.fromList(bytes).buffer.toJS);
  } catch (e) {
    debugPrint('Error loading soundfont: $e');
    return false;
  }
}