Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading midi files from URL's #2

Closed
Adam-Lipshay opened this issue May 27, 2012 · 1 comment
Closed

Loading midi files from URL's #2

Adam-Lipshay opened this issue May 27, 2012 · 1 comment

Comments

@Adam-Lipshay
Copy link

Seems when you load a midi file from a URL it fails due to DOM Exception 5 - this is down to the attempt to convert from ASCII to binary.

Not sure you need to? Commenting out the line got the midi files playing?

fetch.onreadystatechange = function () {
    if (this.readyState === 4 && this.status === 200) {
        var t = this.responseText || "";
        var ff = [];
        var mx = t.length;
        var scc = String.fromCharCode;
        for (var z = 0; z < mx; z++) {
            ff[z] = scc(t.charCodeAt(z) & 255);
        }
        console.log(ff.join(""));

        var data = ff.join("");

        //var data = window.atob(ff.join(""));
        root.currentData = data;
        root.loadMidiFile();
        if (callback) callback(data);
    }
};
fetch.send();
@mudcube
Copy link
Owner

mudcube commented Jun 3, 2012

Thanks for the heads up! Sloppy coding on my part, must of gotten messed up while switching everything to base64 encoding. I'm pushing this update to the main repo.

@mudcube mudcube closed this as completed Jun 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants