Skip to content

Commit

Permalink
Title hotfix for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Sep 19, 2023
1 parent 1304e5b commit 0afe2aa
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ <h1 id="title">SpessaSynth: Online Demo</h1>
*/
async function startMidi(midiFiles)
{
titleMessage.innerText = `Parsing ${midiFiles[0].name}`;
let fName;
if(midiFiles[0].name.length > 20)
{
Expand All @@ -174,28 +173,39 @@ <h1 id="title">SpessaSynth: Online Demo</h1>
* @type {MIDI[]}
*/
const parsed = [];

/**
* @type {string[]}
*/
const titles = [];
for (let i = 0; i < midiFiles.length; i++) {
titleMessage.innerText = `Parsing ${midiFiles[i].name}`;
parsed.push(await parseMidi(midiFiles[i]));

let title;
if(parsed[i].midiName.trim().length > 0)
{
title = parsed[i].midiName.trim();
}
else
{
title = midiFiles[i].name;
}
titles.push(title);
}
titleMessage.style.fontStyle = "italic";
if(parsed[0].midiName.trim().length > 0)
{
titleMessage.innerText = parsed[0].midiName.trim();
}
else
{
titleMessage.innerText = midiFiles[0].name;
}
document.title = titles[0];
titleMessage.innerText = titles[0]

if(manager.seq)
{
manager.seq.loadNewSongList(parsed);
manager.seq.currentTime = 0;

}
else {
manager.play(parsed);
}
manager.seqUI.setSongTitles(titles);
}

/**
Expand Down

0 comments on commit 0afe2aa

Please sign in to comment.