Skip to content

Commit da2e9eb

Browse files
committed
Prepare 6.2.1 release
1 parent 49cabd1 commit da2e9eb

7 files changed

+84
-26
lines changed

RELEASE.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# Version 6.2.1
2+
3+
## Bugs
4+
5+
* don't crash if "capo" is passed in to tablature as a string
6+
7+
* fix possible crash if setTiming is called before engraving
8+
9+
* Fix bug in Firefox 112 that causes lines to be missing.
10+
11+
* Add more debug messages when creating synth
12+
13+
* Fix type of prime return
14+
15+
* Protect against crash when selecting an element if the element selected is somehow outside of the music svg.
16+
117
# Version 6.2.0
218

319
## Features

dist/abcjs-basic-min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/abcjs-basic-min.js.LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
2+
Copyright (c) 2009-2023 Paul Rosen and Gregory Dyke
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal

dist/abcjs-basic.js

+61-19
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ return /******/ (function() { // webpackBootstrap
1818
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1919

2020
/**!
21-
Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
21+
Copyright (c) 2009-2023 Paul Rosen and Gregory Dyke
2222

2323
Permission is hereby granted, free of charge, to any person obtaining a copy
2424
of this software and associated documentation files (the "Software"), to deal
@@ -352,7 +352,7 @@ var TimingCallbacks = function TimingCallbacks(target, params) {
352352
self.joggerTimer = null;
353353
self.replaceTarget = function (newTarget) {
354354
self.noteTimings = newTarget.setTiming(self.qpm, self.extraMeasuresAtBeginning);
355-
if (newTarget.noteTimings.length === 0) newTarget.setTiming(0, 0);
355+
if (newTarget.noteTimings.length === 0) self.noteTimings = newTarget.setTiming(0, 0);
356356
if (self.lineEndCallback) {
357357
self.lineEndTimings = getLineEndTimings(newTarget.noteTimings, self.lineEndAnticipation);
358358
}
@@ -1797,7 +1797,7 @@ var Tune = function Tune() {
17971797
if (!this.engraver || !this.engraver.staffgroups) {
17981798
console.log("setTiming cannot be called before the tune is drawn.");
17991799
this.noteTimings = [];
1800-
return;
1800+
return this.noteTimings;
18011801
}
18021802
var tempo = this.metaText ? this.metaText.tempo : null;
18031803
var naturalBpm = this.getBpm(tempo);
@@ -13881,6 +13881,8 @@ function CreateSynth() {
1388113881
});
1388213882
});
1388313883
});
13884+
if (self.debugCallback) self.debugCallback("notes " + JSON.stringify(notes));
13885+
1388413886
// If there are lots of notes, load them in batches
1388513887
var batches = [];
1388613888
var CHUNK = 256;
@@ -13895,8 +13897,10 @@ function CreateSynth() {
1389513897
};
1389613898
var index = 0;
1389713899
var next = function next() {
13900+
if (self.debugCallback) self.debugCallback("loadBatch idx=" + index + " len=" + batches.length);
1389813901
if (index < batches.length) {
1389913902
self._loadBatch(batches[index], self.soundFontUrl, startTime).then(function (data) {
13903+
if (self.debugCallback) self.debugCallback("loadBatch then");
1390013904
startTime = activeAudioContext().currentTime;
1390113905
if (data) {
1390213906
if (data.error) results.error = results.error.concat(data.error);
@@ -13906,6 +13910,7 @@ function CreateSynth() {
1390613910
next();
1390713911
}, reject);
1390813912
} else {
13913+
if (self.debugCallback) self.debugCallback("resolve init");
1390913914
resolve(results);
1391013915
}
1391113916
};
@@ -13916,6 +13921,7 @@ function CreateSynth() {
1391613921
// This is called recursively to see if the sounds have loaded. The "delay" parameter is how long it has been since the original call.
1391713922
var promises = [];
1391813923
batch.forEach(function (item) {
13924+
if (self.debugCallback) self.debugCallback("getNote " + item.instrument + ':' + item.note);
1391913925
promises.push(getNote(soundFontUrl, item.instrument, item.note, activeAudioContext()));
1392013926
});
1392113927
return Promise.all(promises).then(function (response) {
@@ -13930,6 +13936,7 @@ function CreateSynth() {
1393013936
if (oneResponse.status === "loaded") loaded.push(which);else if (oneResponse.status === "pending") pending.push(which);else if (oneResponse.status === "cached") cached.push(which);else error.push(which + ' ' + oneResponse.message);
1393113937
}
1393213938
if (pending.length > 0) {
13939+
if (self.debugCallback) self.debugCallback("pending " + JSON.stringify(pending));
1393313940
// There was probably a second call for notes before the first one finished, so just retry a few times to see if they stop being pending.
1393413941
// Retry quickly at first so that there isn't an unnecessary delay, but increase the delay each time.
1393513942
if (!delay) delay = 50;else delay = delay * 2;
@@ -13944,6 +13951,7 @@ function CreateSynth() {
1394413951
note: which[1]
1394513952
});
1394613953
}
13954+
if (self.debugCallback) self.debugCallback("retry " + JSON.stringify(newBatch));
1394713955
self._loadBatch(newBatch, soundFontUrl, startTime, delay).then(function (response) {
1394813956
resolve(response);
1394913957
})["catch"](function (error) {
@@ -13956,14 +13964,20 @@ function CreateSynth() {
1395613964
for (var j = 0; j < batch.length; j++) {
1395713965
list.push(batch[j].instrument + '/' + batch[j].note);
1395813966
}
13967+
if (self.debugCallback) self.debugCallback("loadBatch timeout");
1395913968
return Promise.reject(new Error("timeout attempting to load: " + list.join(", ")));
1396013969
}
13961-
} else return Promise.resolve({
13962-
loaded: loaded,
13963-
cached: cached,
13964-
error: error
13965-
});
13966-
})["catch"](function (error) {});
13970+
} else {
13971+
if (self.debugCallback) self.debugCallback("loadBatch resolve");
13972+
return Promise.resolve({
13973+
loaded: loaded,
13974+
cached: cached,
13975+
error: error
13976+
});
13977+
}
13978+
})["catch"](function (error) {
13979+
if (self.debugCallback) self.debugCallback("loadBatch catch " + error.message);
13980+
});
1396713981
};
1396813982
self.prime = function () {
1396913983
// At this point all of the notes are loaded. This function writes them into the output buffer.
@@ -14002,6 +14016,7 @@ function CreateSynth() {
1400214016
var panDistance = panDistances && panDistances.length > trackNumber ? panDistances[trackNumber] : 0;
1400314017
noteMap.forEach(function (note) {
1400414018
var key = note.instrument + ':' + note.pitch + ':' + note.volume + ':' + Math.round((note.end - note.start) * 1000) / 1000 + ':' + panDistance + ':' + tempoMultiplier + ':' + (note.cents ? note.cents : 0);
14019+
if (self.debugCallback) self.debugCallback("noteMapTrack " + key);
1400514020
if (!uniqueSounds[key]) uniqueSounds[key] = [];
1400614021
uniqueSounds[key].push(note.start);
1400714022
});
@@ -14023,7 +14038,7 @@ function CreateSynth() {
1402314038
tempoMultiplier: parseFloat(parts[5]),
1402414039
cents: cents
1402514040
};
14026-
allPromises.push(placeNote(audioBuffer, activeAudioContext().sampleRate, parts, uniqueSounds[k], self.soundFontVolumeMultiplier, self.programOffsets[parts.instrument], fadeTimeSec, self.noteEnd / 1000));
14041+
allPromises.push(placeNote(audioBuffer, activeAudioContext().sampleRate, parts, uniqueSounds[k], self.soundFontVolumeMultiplier, self.programOffsets[parts.instrument], fadeTimeSec, self.noteEnd / 1000, self.debugCallback));
1402714042
}
1402814043
self.audioBuffers = [audioBuffer];
1402914044
if (self.debugCallback) {
@@ -14462,7 +14477,7 @@ var getNote = function getNote(url, instrument, name, audioContext) {
1446214477
xhr.responseType = "arraybuffer";
1446314478
xhr.onload = function () {
1446414479
if (xhr.status !== 200) {
14465-
reject(Error("Can't load sound at " + noteUrl));
14480+
reject(Error("Can't load sound at " + noteUrl + ' status=' + xhr.status));
1446614481
return;
1446714482
}
1446814483
var noteDecoded = function noteDecoded(audioBuffer) {
@@ -14756,7 +14771,7 @@ module.exports = pitchesToPerc;
1475614771
var soundsCache = __webpack_require__(/*! ./sounds-cache */ "./src/synth/sounds-cache.js");
1475714772
var pitchToNoteName = __webpack_require__(/*! ./pitch-to-note-name */ "./src/synth/pitch-to-note-name.js");
1475814773
var centsToFactor = __webpack_require__(/*! ./cents-to-factor */ "./src/synth/cents-to-factor.js");
14759-
function placeNote(outputAudioBuffer, sampleRate, sound, startArray, volumeMultiplier, ofsMs, fadeTimeSec, noteEndSec) {
14774+
function placeNote(outputAudioBuffer, sampleRate, sound, startArray, volumeMultiplier, ofsMs, fadeTimeSec, noteEndSec, debugCallback) {
1476014775
// sound contains { instrument, pitch, volume, len, pan, tempoMultiplier
1476114776
// len is in whole notes. Multiply by tempoMultiplier to get seconds.
1476214777
// ofsMs is an offset to subtract from the note to line up programs that have different length onsets.
@@ -14770,6 +14785,7 @@ function placeNote(outputAudioBuffer, sampleRate, sound, startArray, volumeMulti
1477014785
var noteBufferPromise = soundsCache[sound.instrument][noteName];
1477114786
if (!noteBufferPromise) {
1477214787
// if the note isn't present then just skip it - it will leave a blank spot in the audio.
14788+
if (debugCallback) debugCallback('placeNote skipped: ' + sound.instrument + ':' + noteName);
1477314789
return Promise.resolve();
1477414790
}
1477514791
return noteBufferPromise.then(function (response) {
@@ -14825,13 +14841,17 @@ function placeNote(outputAudioBuffer, sampleRate, sound, startArray, volumeMulti
1482514841
copyToChannel(outputAudioBuffer, e.renderedBuffer, start);
1482614842
}
1482714843
}
14844+
if (debugCallback) debugCallback('placeNote: ' + sound.instrument + ':' + noteName);
1482814845
fnResolve();
1482914846
};
1483014847
offlineCtx.startRendering();
1483114848
return new Promise(function (resolve) {
1483214849
fnResolve = resolve;
1483314850
});
14834-
})["catch"](function () {});
14851+
})["catch"](function (error) {
14852+
if (debugCallback) debugCallback('placeNote catch: ' + error.message);
14853+
return Promise.resolve();
14854+
});
1483514855
}
1483614856
var copyToChannel = function copyToChannel(toBuffer, fromBuffer, start) {
1483714857
for (var ch = 0; ch < 2; ch++) {
@@ -15618,7 +15638,7 @@ function StringPatterns(plugin) {
1561815638
this.measureAccidentals = {};
1561915639
this.capo = 0;
1562015640
if (capo) {
15621-
this.capo = capo;
15641+
this.capo = parseInt(capo, 10);
1562215642
}
1562315643
this.transpose = plugin.transpose ? plugin.transpose : 0;
1562415644
this.tuning = tuning;
@@ -21545,6 +21565,15 @@ function printLine(renderer, x1, x2, y, klass, name, dy) {
2154521565
x2 = roundNumber(x2);
2154621566
var y1 = roundNumber(y - dy);
2154721567
var y2 = roundNumber(y + dy);
21568+
// TODO-PER: This fixes a firefox bug where a path needs to go over the 0.5 mark or it isn't displayed
21569+
if (renderer.firefox112 && dy < 1) {
21570+
var _int = Math.floor(y2);
21571+
var distToHalf = 0.52 - (y2 - _int);
21572+
if (distToHalf > 0) {
21573+
y1 += distToHalf;
21574+
y2 += distToHalf;
21575+
}
21576+
}
2154821577
var pathString = sprintf("M %f %f L %f %f L %f %f L %f %f z", x1, y1, x2, y1, x2, y2, x1, y2);
2154921578
var options = {
2155021579
path: pathString,
@@ -21594,6 +21623,16 @@ function printStem(renderer, x, dx, y1, y2, klass, name) {
2159421623
}
2159521624
x = roundNumber(x);
2159621625
var x2 = roundNumber(x + dx);
21626+
// TODO-PER: This fixes a firefox bug where a path needs to go over the 0.5 mark or it isn't displayed
21627+
if (renderer.firefox112 && Math.abs(dx) < 1) {
21628+
var higher = Math.max(x, x2);
21629+
var _int = Math.floor(higher);
21630+
var distToHalf = 0.52 - (higher - _int);
21631+
if (distToHalf > 0) {
21632+
x += distToHalf;
21633+
x2 += distToHalf;
21634+
}
21635+
}
2159721636
var pathArray = [["M", x, y1], ["L", x, y2], ["L", x2, y2], ["L", x2, y1], ["z"]];
2159821637
var attr = {
2159921638
path: ""
@@ -23806,10 +23845,12 @@ function notifySelect(target, dragStep, dragMax, dragIndex, ev) {
2380623845
while (parent && parent.dataset && !parent.dataset.index && parent.tagName.toLowerCase() !== 'svg') {
2380723846
parent = parent.parentNode;
2380823847
}
23809-
analysis.name = parent.dataset.name;
23810-
analysis.clickedName = closest.dataset.name;
23811-
analysis.parentClasses = parent.classList;
23812-
analysis.clickedClasses = closest.classList;
23848+
if (parent && parent.dataset) {
23849+
analysis.name = parent.dataset.name;
23850+
analysis.clickedName = closest.dataset.name;
23851+
analysis.parentClasses = parent.classList;
23852+
}
23853+
if (closest && closest.classList) analysis.clickedClasses = closest.classList;
2381323854
analysis.selectableElement = target.svgEl;
2381423855
for (var i = 0; i < this.listeners.length; i++) {
2381523856
this.listeners[i](target.absEl.abcelem, target.absEl.tuneNumber, classes.join(' '), analysis, {
@@ -24992,6 +25033,7 @@ var Renderer = function Renderer(paper) {
2499225033
this.space = 3 * spacing.SPACE;
2499325034
this.padding = {}; // renderer's padding is managed by the controller
2499425035
this.reset();
25036+
this.firefox112 = navigator.userAgent.indexOf('Firefox/112.0') >= 0;
2499525037
};
2499625038
Renderer.prototype.reset = function () {
2499725039
this.paper.clear();
@@ -25479,7 +25521,7 @@ module.exports = Svg;
2547925521
\********************/
2548025522
/***/ (function(module) {
2548125523

25482-
var version = '6.2.0';
25524+
var version = '6.2.1';
2548325525
module.exports = version;
2548425526

2548525527
/***/ })

dist/abcjs-basic.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/abcjs-plugin-min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/abcjs-plugin-min.js.LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
2+
Copyright (c) 2009-2023 Paul Rosen and Gregory Dyke
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)