Skip to content

Track volume is reset when playback is paused or has reached the end of the score #320

@cheap-glitch

Description

@cheap-glitch

Your environment

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

Expected Results

When the volume of the track is changed using changeTrackVolume, it should persist even when pausing or restarting the playback.

Observed Results

The track volume is reset to the default value when the playback is paused. It also happens when the end of the score is reached. This doesn't seem to occur when the playback is stopped though.

Steps to Reproduce (for bugs)

Here is a minimal demo to reproduce the behavior:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>alphaTab test app</title>
	</head>
	<body>
		<button id="button-play" >Play         </button>
		<button id="button-pause">Pause        </button>
		<button id="button-stop" >Stop         </button>
		<button id="button-vol"  >Change volume</button>

		<div id="alphatab"></div>

		<script src="alphatab-0.9.6.266.js"></script>
		<script>
			(function()
			{
				const alphatab = new alphaTab.platform.javaScript.AlphaTabApi(
					document.getElementById('alphatab'),
					{
						core: {
							logLevel:          'warning',
							enableLazyLoading: true,
						},
						player: {
							enablePlayer:      true,
							enableCursor:      true,
							soundFont:         '/default.sf2',
						},
					}
				);

				alphatab.tex('\\tempo 60 . 1.2.4*4');

				alphatab.addReadyForPlayback(() => {
					document.getElementById('button-play' ).addEventListener('click', () => alphatab.play());
					document.getElementById('button-pause').addEventListener('click', () => alphatab.pause());
					document.getElementById('button-stop' ).addEventListener('click', () => alphatab.stop());
					document.getElementById('button-vol'  ).addEventListener('click', () =>
						alphatab.changeTrackVolume([alphatab.score.tracks[0]], 0.2)
					);
				});
			})();
		</script>
	</body>
</html>

Metadata

Metadata

Assignees

Labels

area-playerRelated to the audio playback engine.state-acceptedThis is a valid topic to work on.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions