Skip to content

Instantly share code, notes, and snippets.

@emanchado
Created October 27, 2012 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emanchado/3963781 to your computer and use it in GitHub Desktop.
Save emanchado/3963781 to your computer and use it in GitHub Desktop.
Sort of rough alphaTab patch (improves support for GuitarPro mobile-generated .gpx files)
--- lib/alphaTab/alphaTab.js.orig 2011-01-07 23:13:06.000000000 +0100
+++ lib/alphaTab/alphaTab.js 2012-10-27 11:40:15.000000000 +0200
@@ -2173,8 +2173,12 @@
beat.id = Std.parseInt(beatNode.att.resolve("id"));
beat.dyn = beatNode.node.resolve("Dynamic").getInnerData();
beat.rhythmId = Std.parseInt(beatNode.node.resolve("Rhythm").att.resolve("ref"));
+ try {
beat.noteIds = this.toIntArray(beatNode.node.resolve("Notes").getInnerData());
this.gpxDocument.beats.push(beat);
+ } catch(e) {
+ // We don't really care
+ }
}
}}
}
@@ -6475,12 +6479,12 @@
var b = 0;
while(b < gpxVoice.beatIds.length) {
var gpxBeat = this._document.getBeat(gpxVoice.beatIds[b]);
- var rhythm = this._document.getRhythm(gpxBeat.rhythmId);
+ var rhythm = this._document.getRhythm(gpxBeat ? gpxBeat.rhythmId : gpxVoice.beatIds[b]);
var beat = this.getBeat(measure,start);
var voice = beat.voices[v % beat.voices.length];
voice.isEmpty = false;
this.parseRhythm(rhythm,voice.duration);
- if(gpxBeat.noteIds != null) {
+ if(gpxBeat && gpxBeat.noteIds != null) {
var velocity = this.parseDynamic(gpxBeat);
var n = 0;
while(n < gpxBeat.noteIds.length) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment