add USE_JAZZMIDI variable to enable experimental Web MIDI API, add utf8 meta tags to demos

This commit is contained in:
Michael Deal 2013-01-28 12:27:53 -08:00
parent a7d5b8a06e
commit 072eadb4af
7 changed files with 9 additions and 4 deletions

View file

@ -18,6 +18,7 @@ if (typeof (MIDI.Soundfont) === "undefined") MIDI.Soundfont = {};
// Turn on to get "onprogress" event. XHR will not work from file://
var USE_XHR = false;
var USE_JAZZMIDI = false;
MIDI.loadPlugin = function(conf) {
if (typeof(conf) === "function") conf = {
@ -40,7 +41,7 @@ MIDI.loadPlugin = function(conf) {
api = conf.api;
} else if (apis[window.location.hash.substr(1)]) {
api = window.location.hash.substr(1);
} else if (navigator.requestMIDIAccess) {
} else if (USE_JAZZMIDI && navigator.requestMIDIAccess) {
api = "webmidi";
} else if (window.webkitAudioContext) { // Chrome
api = "webaudio";

View file

@ -258,7 +258,7 @@ if (window.Audio) (function () {
api: "audiotag"
};
var note2id = {};
var volume = 1; // floating point
var volume = 127; // floating point
var channel_nid = -1; // current channel
var channels = []; // the audio channels
var notes = {}; // the piano keys
@ -276,7 +276,7 @@ if (window.Audio) (function () {
var time = (new Date()).getTime();
var audio = channels[nid];
audio.src = MIDI.Soundfont[id][note.id];
audio.volume = volume;
audio.volume = volume / 127;
audio.play();
channel_nid = nid;
};