Skip to content

Instantly share code, notes, and snippets.

@emanchado
Created October 8, 2012 18:54
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/3854210 to your computer and use it in GitHub Desktop.
Save emanchado/3854210 to your computer and use it in GitHub Desktop.
Silly alphaTab patch (improves support for GuitarPro mobile-generated .gpx files)
--- lib/alphaTab/alphaTab.js 2011-01-07 23:13:06.000000000 +0100
+++ /var/www/alphatab/lib/alphaTab/alphaTab.js 2012-10-08 20:52:35.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,7 +6479,13 @@
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;
+ try {
+ rhythm = this._document.getRhythm(gpxBeat.rhythmId);
+ } catch(e) {
+ b++;
+ continue;
+ }
var beat = this.getBeat(measure,start);
var voice = beat.voices[v % beat.voices.length];
voice.isEmpty = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment