Skip to content

Commit

Permalink
Fix regressions introduced by new version of musicxml-midi
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed Jul 18, 2023
1 parent df8f152 commit 5cb9854
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 76 deletions.
35 changes: 20 additions & 15 deletions dist/musicxml-player.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* musicxml-player v0.12.2
* musicxml-player v0.12.3
* (c) Karim Ratib <[email protected]> (https://github.com/infojunkie)
* Released under the GPL-3.0-only License.
*/
Expand Down Expand Up @@ -13809,7 +13809,7 @@ class WebAudioFontOutput {
}

var name = "musicxml-player";
var version = "0.12.2";
var version = "0.12.3";
var description = "A simple JavaScript component that loads and plays MusicXML files in the browser using Web Audio and Web MIDI.";
var main = "dist/musicxml-player.esm.js";
var type = "module";
Expand Down Expand Up @@ -13911,16 +13911,15 @@ var pkg = {
dependencies: dependencies
};

const XSL_UNROLL = 'https://raw.githubusercontent.com/infojunkie/musicxml-mma/main/musicxml-unroll.sef.json';
const XSL_UNROLL = 'https://raw.githubusercontent.com/infojunkie/musicxml-midi/main/build/unroll.sef.json';
const RESIZE_THROTTLE = 100;
class Player {
constructor(_output, _renderer, _converter, _container, _musicXml, _timingsrc, _title) {
constructor(_output, _renderer, _converter, _container, _musicXml, timingsrc, _title) {
this._output = _output;
this._renderer = _renderer;
this._converter = _converter;
this._container = _container;
this._musicXml = _musicXml;
this._timingsrc = _timingsrc;
this._title = _title;
// Create the MIDI player.
this._midiPlayer = create({
Expand Down Expand Up @@ -13960,8 +13959,9 @@ class Player {
});
this._observer.observe(this._container);
// Set up TimingObject listeners.
this._changeEventListener = (event) => this._handleTimingsrcChange(event);
this.timingsrc = this._timingsrc;
this._timingsrc = null;
this._timingsrcListener = (event) => this._handleTimingsrcChange(event);
this.timingsrc = timingsrc;
}
static load(options) {
var _a, _b, _c, _d;
Expand Down Expand Up @@ -14064,9 +14064,9 @@ class Player {
set timingsrc(timingsrc) {
var _a, _b, _c;
(_a = this._timingsrc) === null || _a === void 0 ? void 0 : _a.update({ position: 0, velocity: 0 });
(_b = this._timingsrc) === null || _b === void 0 ? void 0 : _b.removeEventListener('change', this._changeEventListener);
(_b = this._timingsrc) === null || _b === void 0 ? void 0 : _b.removeEventListener('change', this._timingsrcListener);
this._timingsrc = timingsrc;
(_c = this._timingsrc) === null || _c === void 0 ? void 0 : _c.addEventListener('change', this._changeEventListener);
(_c = this._timingsrc) === null || _c === void 0 ? void 0 : _c.addEventListener('change', this._timingsrcListener);
}
// We implement IMidiOutput here to capture any interesting events
// such as MARKER events with Groove information.
Expand Down Expand Up @@ -14156,7 +14156,9 @@ class Player {
stylesheetLocation: XSL_UNROLL,
sourceText: musicXml,
destination: 'serialized',
stylesheetParams: { renumberMeasures: true },
stylesheetParams: {
renumberMeasures: true
},
}, 'async');
return unroll.principalResult;
}
Expand Down Expand Up @@ -16997,13 +16999,13 @@ const midiJsonParser = load(url);
const parseArrayBuffer = midiJsonParser.parseArrayBuffer;
URL.revokeObjectURL(url);

const XSL_TIMEMAP = 'https://raw.githubusercontent.com/infojunkie/musicxml-mma/main/musicxml-timemap.sef.json';
const XSL_TIMEMAP = 'https://raw.githubusercontent.com/infojunkie/musicxml-midi/main/build/timemap.sef.json';
/**
* Implementation of IMidiConverter that simply fetches given MIDI file and timemap JSON file URIs.
*
* The timemap JSON file can be generated using the script midi-timemap which is distributed with musicxml-mma
* @see https://github.com/infojunkie/musicxml-mma/blob/main/scripts/midi-timemap.js
* It assumes that the MIDI file is itself generated using musicxml-mma.
* The timemap JSON file can be generated using the script midi-timemap which is distributed with musicxml-midi
* @see https://github.com/infojunkie/musicxml-midi/blob/main/src/js/midi-timemap.js
* It assumes that the MIDI file is itself generated using musicxml-midi.
*
* The timemap JSON structure is simple enough to be generated by other tools as well.
*/
Expand Down Expand Up @@ -17049,6 +17051,9 @@ class FetchConverter {
stylesheetLocation: XSL_TIMEMAP,
sourceText: musicXml,
destination: 'serialized',
stylesheetParams: {
useSef: true
}
}, 'async');
return JSON.parse(unroll.principalResult);
}
Expand All @@ -17061,7 +17066,7 @@ class FetchConverter {
}

/**
* Implementation of IMidiConverter that queries the musicxml-mma API (@see https://github.com/infojunkie/musicxml-mma)
* Implementation of IMidiConverter that queries the musicxml-midi API (@see https://github.com/infojunkie/musicxml-midi)
* to convert a MusicXML to a MIDI file. It extracts the timemap contained within the MIDI file, expressed as MIDI marker events.
*/
class MmaConverter {
Expand Down
2 changes: 1 addition & 1 deletion dist/musicxml-player.esm.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/types/FetchConverter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { IMidiConverter, MeasureTimemap } from './IMidiConverter';
/**
* Implementation of IMidiConverter that simply fetches given MIDI file and timemap JSON file URIs.
*
* The timemap JSON file can be generated using the script midi-timemap which is distributed with musicxml-mma
* @see https://github.com/infojunkie/musicxml-mma/blob/main/scripts/midi-timemap.js
* It assumes that the MIDI file is itself generated using musicxml-mma.
* The timemap JSON file can be generated using the script midi-timemap which is distributed with musicxml-midi
* @see https://github.com/infojunkie/musicxml-midi/blob/main/src/js/midi-timemap.js
* It assumes that the MIDI file is itself generated using musicxml-midi.
*
* The timemap JSON structure is simple enough to be generated by other tools as well.
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/types/FetchConverter.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/types/MmaConverter.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IMidiFile } from 'midi-json-parser-worker';
import type { IMidiConverter, MeasureTimemap } from './IMidiConverter';
/**
* Implementation of IMidiConverter that queries the musicxml-mma API (@see https://github.com/infojunkie/musicxml-mma)
* Implementation of IMidiConverter that queries the musicxml-midi API (@see https://github.com/infojunkie/musicxml-midi)
* to convert a MusicXML to a MIDI file. It extracts the timemap contained within the MIDI file, expressed as MIDI marker events.
*/
export declare class MmaConverter implements IMidiConverter {
Expand Down
4 changes: 2 additions & 2 deletions dist/types/Player.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export declare class Player implements IMidiOutput {
private _converter;
private _container;
private _musicXml;
private _timingsrc;
private _title;
static load(options: PlayerOptions): Promise<Player>;
private _midiPlayer;
Expand All @@ -61,7 +60,8 @@ export declare class Player implements IMidiOutput {
private _measureOffset;
private _timemap;
private _observer;
private _changeEventListener;
private _timingsrc;
private _timingsrcListener;
/**
* A dynamic flag to mute the player's MIDI output.
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/types/Player.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 36 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "musicxml-player",
"version": "0.12.2",
"version": "0.12.3",
"description": "A simple JavaScript component that loads and plays MusicXML files in the browser using Web Audio and Web MIDI.",
"main": "dist/musicxml-player.esm.js",
"type": "module",
Expand Down
Loading

0 comments on commit 5cb9854

Please sign in to comment.