Compare commits

...

2 commits

2 changed files with 7 additions and 3 deletions

View file

@ -20,7 +20,7 @@
</button>
<progress min="0" max="100" value="0" ref="progress"></progress>
<input type="range" min="0" max="1" v-model="player.context.gain.value" step="0.1" ref="volume" title="volume"/>
<a class="download" title="download" :href="module.url">
<a class="download" title="download" :href="module.url" target="_blank">
<i class="fas fa-download"></i>
</a>
</div>
@ -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);