repeat only once and proper handling of track ending
Some checks failed
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-sw Pipeline failed
ci/woodpecker/pr/test Pipeline failed

This commit is contained in:
Puniko 2022-12-27 15:23:25 +01:00
parent fdaa9614c9
commit f383aec1cd
2 changed files with 6 additions and 2 deletions

View file

@ -75,7 +75,7 @@ let hide = ref((defaultStore.state.nsfw === 'force') ? true : props.module.isSen
let playing = ref(false);
let displayCanvas = ref<HTMLCanvasElement>(null);
let progress = ref<HTMLProgressElement>(null);
const player = ref(new ChiptuneJsPlayer(new ChiptuneJsConfig(1)));
const player = ref(new ChiptuneJsPlayer(new ChiptuneJsConfig()));
const rowBuffer = 24;
let buffer = null;
@ -99,6 +99,10 @@ function playPause() {
display();
});
player.value.addHandler('onEnded', () => {
stop();
});
if (player.value.currentPlayingNode === null) {
player.value.play(buffer);
playing.value = true;

View file

@ -115,7 +115,7 @@ ChiptuneJsPlayer.prototype.play = function (buffer: ArrayBuffer) {
if (processNode === null) {
return;
}
libopenmpt._openmpt_module_set_repeat_count(processNode.modulePtr, this.config.repeatCount || 1);
libopenmpt._openmpt_module_set_repeat_count(processNode.modulePtr, this.config.repeatCount || 0);
this.currentPlayingNode = processNode;
processNode.connect(this.context);
this.context.connect(this.audioContext.destination);