Skip to content

loadSoundFont doesn't work #293

@cheap-glitch

Description

@cheap-glitch

Your environment

  • Version used: 0.9.5-243
  • Platform used: JavaScript
  • Rendering engine used: SVG
  • Browser Name and Version: Firefox
  • Operating System and version (desktop or mobile): Arch Linux desktop

Expected Results

The function loadSoundFont should load the specified soundfont.

Observed Results

If a soundfont is specified when creating a new instance of alphatab, it will be loaded properly. But when an instance is created without a soundfont and one is loaded later with loadSoundFont, nothing happens. Setting the player setting to true and calling updateSettings doesn't change anything either.

Steps to Reproduce (for bugs)

Create a page with the following code:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>alphaTab test app</title>
	</head>
	<body>
		<div id="alphatab"></div>
		<script src="alphatab-0.9.5-243.js"></script>
		<script src="script.js"></script>
	</body>
</html>
(function()
{
	const settings = {
		// player: 'default.sf2',
		layout: 'horizontal',
		cursor: true,

		logging: 'warning',
	};

	let alphatab = new alphaTab.platform.javaScript.AlphaTabApi(document.getElementById('alphatab'), settings);

	alphatab.addSoundFontLoad(function(e)
	{
		console.log(`Loading soundfont... (${(e.loaded / e.total) * 100}%)`);
	});
	alphatab.addReadyForPlayback(function()
	{
		console.log('Player ready for playback');
		alphatab.play();
	});

	alphatab.tex('1.1 1.2 1.3 1.4');
	alphatab.settings.player = true;
	alphatab.updateSettings();
	alphatab.loadSoundFont('default.sf2');
})();

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions