Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
small UI fixes
scroll optimisation (chromium)
  • Loading branch information
Valent-in committed Feb 4, 2024
1 parent 3a56365 commit 5418f58
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 44 deletions.
7 changes: 7 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ button.button--play.button--play-loop {

#arrange-main {
overflow: auto;
contain: content;
/*for chromium-based browsers only*/
-webkit-transform: translateZ(0);
}

#arrange-container {
Expand Down Expand Up @@ -281,6 +284,8 @@ button.button--play.button--play-loop {
#pattern-main {
overflow-y: scroll;
overflow-x: auto;
contain: content;
-webkit-transform: translateZ(0);
}

#pattern-footer > button,
Expand Down Expand Up @@ -308,6 +313,8 @@ button.button--play.button--play-loop {
overflow-y: auto;
margin-bottom: calc(1rem + 16px + 60px);
padding: 4px 0;
contain: content;
-webkit-transform: translateZ(0);
}

#synth-main > div {
Expand Down
23 changes: 16 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@
</div>
</div>

<div id="loading-modal" class="modal-container nodisplay">
<div class="modal-box">
<div class="modal-box-block">
Loading...
</div>
</div>
</div>

<div id="settings-modal-menu" class="modal-container nodisplay">
<div class="modal-box">
<div class="modal-box-block notranslate" translate="no">
Expand Down Expand Up @@ -630,12 +638,10 @@
<div id="midi-modal-menu" class="modal-container nodisplay">
<div class="modal-box">
<div class="modal-box-block">
<div>
<a id="link-midi-download" href="">Download MIDI</a>
</div>
<span>Export MIDI</span>
</div>
<div class="modal-box-block">
<span>Velocity curve</span>
<span class="dim-text">Velocity curve</span>
<select id="select-velocity-scale" autocomplete="off">
<option>Exponential</option>
<option>Linear</option>
Expand All @@ -644,12 +650,15 @@
</div>
<div class="modal-box-block">
<input type="checkbox" id="input-export-glide" autocomplete="off" checked>
<label for="input-export-glide">Note overlap for glide&sol;legato</label>
<label for="input-export-glide" class="dim-text">Note overlap for glide&sol;legato</label>
</div>
<div class="modal-box-block">
<input type="checkbox" id="input-export-expand" autocomplete="off">
<label for="input-export-expand" class="dim-text">Expand short notes to 16th</label>
</div>
<div class="modal-box-block">
<div>
<input type="checkbox" id="input-export-expand" autocomplete="off">
<label for="input-export-expand">Expand short notes to 16th</label>
<a id="link-midi-download" href="">Download MIDI</a>
</div>
</div>
<div class="modal-box-block modal-box-footer" id="export-menu-close-container">
Expand Down
2 changes: 1 addition & 1 deletion js/arrange-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function ArrangeUi(songObj, onPatternSelectCallback, defaults) {
showPrompt("Enter pattern name", (result) => {

if (!result) {
console.log("Pattern NOT created");
showToast("Pattern NOT created");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion js/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const DEFAULT_PARAMS = {};

DEFAULT_PARAMS.programVersion = "1.0";
DEFAULT_PARAMS.programVersion = "1.0.1";
DEFAULT_PARAMS.fileFormatVersion = "1.6";

DEFAULT_PARAMS.maxPatternSteps = 64;
Expand Down
4 changes: 2 additions & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ console.log("%c\u25A0 %c\u25B6 %c\u25A0 %c PulseQueue v" + DEFAULT_PARAMS.progra
arrangeUi.build();

const scheduler = new Scheduler(songObject, arrangeUi.setMarker, patternUi.setMarker);
const schedulerUi = new SchedulerUi(scheduler, arrangeUi.setLoopMarkers);

schedulerUi(scheduler, arrangeUi.setLoopMarkers);
menuInit(songObject, onSongChange, synthHelper.loadSynth, scheduler.renderSong, scheduler.exportMidiSequence);

document.getElementById("startup-loading-title").style.display = "none";
Expand All @@ -105,7 +105,7 @@ console.log("%c\u25A0 %c\u25B6 %c\u25A0 %c PulseQueue v" + DEFAULT_PARAMS.progra

switch (stopCommand) {
case "stop":
schedulerUi.stop();
scheduler.stop();
break;
case "release":
scheduler.release();
Expand Down
34 changes: 20 additions & 14 deletions js/menu-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ function menuInit(songObj, onSongChangeCallback, loadSynthCallback, renderCallba
let file = e.target.files[0];
if (!file)
return;
showModal("loading-modal");

let reader = new FileReader();
reader.onload = function (ev) {
let songStr = ev.target.result;

if (importSong(songStr))
hideModal("startup-modal-menu");

hideModal("loading-modal");

};
reader.readAsText(file);
}
Expand Down Expand Up @@ -83,18 +88,20 @@ function menuInit(songObj, onSongChangeCallback, loadSynthCallback, renderCallba
if (!event.target.classList.contains("js-demo-entry"))
return;

let container = document.getElementById("demo-list-container");
container.innerHTML = "Loading...";
hideModal("demo-modal-menu");
showModal("loading-modal");

let filename = event.target.dataset.file;
fetch("data/tracks/" + filename).then(response => response.json()).then(data => {
importSong(JSON.stringify(data));

hideModal("demo-modal-menu");
hideModal("startup-modal-menu");
if (importSong(JSON.stringify(data)))
hideModal("startup-modal-menu");

hideModal("loading-modal");

}).catch(() => {
container.innerHTML = "Data loading error!";
hideModal("loading-modal");
showAlert("Data loading error!");
});
};

Expand Down Expand Up @@ -431,8 +438,7 @@ function menuInit(songObj, onSongChangeCallback, loadSynthCallback, renderCallba

let synthName = songObj.getCurrentLayerSynthName();
let synthSelect = document.getElementById("button-synth-select");
synthSelect.innerHTML = "";
synthSelect.appendChild(document.createTextNode(synthName || "[none]"));
synthSelect.textContent = synthName || "[none]";

document.getElementById("button-color-select").style.backgroundColor =
DEFAULT_PARAMS.colorSet[songObj.currentPattern.colorIndex];
Expand All @@ -455,9 +461,11 @@ function menuInit(songObj, onSongChangeCallback, loadSynthCallback, renderCallba
songObj.currentPattern.name = value;

let patternName = document.getElementById("pattern-name-area");
patternName.innerHTML = "";
patternName.appendChild(document.createTextNode(value));
patternName.textContent = value;
onSongChangeCallback(false);
} else {
event.target.value = songObj.currentPattern.name;
showToast("Pattern NOT renamed");
}
};

Expand Down Expand Up @@ -735,8 +743,7 @@ function menuInit(songObj, onSongChangeCallback, loadSynthCallback, renderCallba

let synthName = songObj.getCurrentLayerSynthName() || "[none]";
let synthSelect = document.getElementById("button-synth-select");
synthSelect.innerHTML = "";
synthSelect.appendChild(document.createTextNode(synthName));
synthSelect.textContent = synthName;

if (isCreateNewLayer || isEmpty)
onSongChangeCallback(false);
Expand Down Expand Up @@ -788,8 +795,7 @@ function menuInit(songObj, onSongChangeCallback, loadSynthCallback, renderCallba
*/
function showSongTitle() {
let songTitle = document.getElementById("song-title-area");
songTitle.innerHTML = "";
songTitle.appendChild(document.createTextNode(songObj.title || "[untitled]"));
songTitle.textContent = songObj.title || "[untitled]";
}

function fillAdditionalValues() {
Expand Down
8 changes: 1 addition & 7 deletions js/scheduler-ui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

function SchedulerUi(scheduler, setLoopMarkersCallback) {
function schedulerUi(scheduler, setLoopMarkersCallback) {
let songPlayBtn = document.getElementById("button-arrange-play");
let patternPlayBtn = document.getElementById("button-pattern-play");
let barsInput = document.getElementById("input-loop-bars");
Expand Down Expand Up @@ -53,12 +53,6 @@ function SchedulerUi(scheduler, setLoopMarkersCallback) {
}
});

this.stop = function () {
scheduler.stop();
updateButtons(false, false);
removePlayMarkers();
};

function onForceStop() {
updateButtons(false, false);
removePlayMarkers();
Expand Down
19 changes: 12 additions & 7 deletions js/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ function Scheduler(songObj, barCallback, stepCallback) {

this.stop = () => {
stop();

if (onInnerStopCallback) {
onInnerStopCallback();
onInnerStopCallback = null;
}
}

this.playSong = () => {
Expand Down Expand Up @@ -57,31 +62,29 @@ function Scheduler(songObj, barCallback, stepCallback) {
}

this.playStopSong = (callback) => {
onInnerStopCallback = callback;

if (isPlaying) {
stop();
return false;
} else {
onInnerStopCallback = callback;
this.playSong();
return true;
}
}

this.playStopPattern = (callback) => {
onInnerStopCallback = callback;

if (isPlaying || !songObj.currentPattern) {
stop();
return false;
} else {
onInnerStopCallback = callback;
this.playPattern();
return true;
}
}

this.renderSong = (renderLength) => {
stop();
this.stop();

let schedulerData = {
stepIndex: 0,
Expand Down Expand Up @@ -280,8 +283,10 @@ function Scheduler(songObj, barCallback, stepCallback) {
if (realtimeBarCallback) {
console.log("Song END");
stop();
if (onInnerStopCallback)
if (onInnerStopCallback) {
onInnerStopCallback();
onInnerStopCallback = null;
}
}

return;
Expand Down Expand Up @@ -348,4 +353,4 @@ function Scheduler(songObj, barCallback, stepCallback) {
}
}
}
};
}
3 changes: 1 addition & 2 deletions js/synth-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ function SynthHelper(songObj, synthUi, rebuildPatternSynthListCallback) {

if (selectedSynthIndex == songObj.currentSynthIndex) {
let synthName = document.getElementById("synth-name-area");
synthName.innerHTML = "";
synthName.appendChild(document.createTextNode(value));
synthName.textContent = value;
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions js/synth.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Synth(outputNode, transportBPM) {

this.envelope.chain(this.ampAM);
this.ampAM.chain(this.ampout);
this.ampout.connect(outputNode);
this.ampout.chain(outputNode);

let freqSignal = new Tone.Signal({ units: "frequency" });
let lastVolumeMod = 0;
Expand Down Expand Up @@ -512,7 +512,7 @@ function Synth(outputNode, transportBPM) {
this.pan.disconnect();
this.pan.dispose();
this.pan = null;
this.ampAM.connect(this.ampout);
this.ampAM.chain(this.ampout);
console.log("remove pan");
}
}
Expand Down Expand Up @@ -697,4 +697,4 @@ function Synth(outputNode, transportBPM) {
freqSignal.dispose();
freqSignal = null;
}
}
}

0 comments on commit 5418f58

Please sign in to comment.