Skip to content

Commit

Permalink
better estimated time display
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Jun 19, 2024
1 parent fda3fc8 commit dbdd3be
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,7 @@ export function resetAllControllers()
**/
const ch = this.workletProcessorChannels[channelNumber];

// call all the event listeners
this.callEvent("programchange", {
channel: channelNumber,
program: ch.preset.program,
bank: ch.preset.bank,
userCalled: false
});


// if preset is unlocked, switch to non drums
// if preset is unlocked, switch to non drums and call event
if(!ch.lockPreset)
{
ch.midiControllers[midiControllers.bankSelect] = 0;
Expand All @@ -201,6 +192,14 @@ export function resetAllControllers()
}
}

// call program change
this.callEvent("programchange", {
channel: channelNumber,
program: ch.preset.program,
bank: ch.preset.bank,
userCalled: false
});

let restoreControllerValueEvent = ccNum =>
{
if(this.workletProcessorChannels[channelNumber].lockedControllers[ccNum])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { modulatorSources } from '../../../soundfont/chunk/modulators.js'
* @property {number} NRPFine - the current fine value of the Non-Registered Parameter
* @property {number} RPValue - the current value of the Registered Parameter
*
* @property {number} program - the channel's program number
* @property {Preset} preset - the channel's preset
* @property {boolean} lockPreset - indicates whether the program on the channel is locked
*
Expand Down Expand Up @@ -58,7 +57,6 @@ export function createWorkletChannel(sendEvent = false)
isMuted: false,
drumChannel: false,
lockPreset: false,
program: 0,

}
for (let i = 0; i < 128; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/website/demo_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Manager } from './manager.js'
import { MIDI } from '../spessasynth_lib/midi_parser/midi_loader.js'

import { formatTitle } from '../spessasynth_lib/utils/other.js'
import { formatTime, formatTitle } from '../spessasynth_lib/utils/other.js'
import { SpessaSynthInfo, SpessaSynthWarn } from '../spessasynth_lib/utils/loggin.js'
import { audioBufferToWav } from '../spessasynth_lib/utils/buffer_to_wav.js'

Expand Down Expand Up @@ -240,7 +240,7 @@ async function startMidi(midiFiles)
const duration = window.manager.seq.midiData.duration;
const buffer = await window.manager.renderAudio((progress, speed) => {
const estimated = (1 - progress) / speed * duration;
titleMessage.innerText = `${message} ${Math.round(progress * 100)}%\n ${estimatedMessage} ${Math.round(estimated)}s`
titleMessage.innerText = `${message} ${Math.round(progress * 100)}%\n ${estimatedMessage} ${formatTime(estimated).time}s`
});

titleMessage.textContent = title;
Expand Down
4 changes: 2 additions & 2 deletions src/website/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {Manager} from "./manager.js";
import {MIDI} from "../spessasynth_lib/midi_parser/midi_loader.js";

import { formatTitle } from '../spessasynth_lib/utils/other.js'
import { formatTime, formatTitle } from '../spessasynth_lib/utils/other.js'
import { audioBufferToWav } from '../spessasynth_lib/utils/buffer_to_wav.js'

/**
Expand Down Expand Up @@ -178,7 +178,7 @@ async function startMidi(midiFiles)
const duration = window.manager.seq.midiData.duration;
const buffer = await window.manager.renderAudio((progress, speed) => {
const estimated = (1 - progress) / speed * duration;
titleMessage.innerText = `${message} ${Math.round(progress * 100)}%\n ${estimatedMessage} ${Math.round(estimated)}s`
titleMessage.innerText = `${message} ${Math.round(progress * 100)}%\n ${estimatedMessage} ${formatTime(estimated).time}`
});

titleMessage.textContent = title;
Expand Down
7 changes: 6 additions & 1 deletion src/website/ui/synthesizer_ui/synthui_selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,19 @@ export class Selector
this.value = value;
if(this.isShown)
{
if(!this.isReloaded)
{
this.reload();
}
this.mainDiv.value = value;
}
}

show()
{
this.isShown = true;
if(!this.isReloaded) {
if(!this.isReloaded)
{
this.reload();
}
this.mainDiv.value = this.value;
Expand Down

0 comments on commit dbdd3be

Please sign in to comment.