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

master
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

@ -159,6 +159,7 @@ h1 {
-webkit-transition-property: background, color;
-webkit-transition-duration: .25s;
padding: 1px 0 1px 5px; font-family: arial; font-size: 9px; line-height: 9px; color: #aaa; width: 30px; height: 9px;
background: #000;
background-image: -webkit-gradient(linear,left top,left bottom,from(rgba(66,66,66,0.75)),to(rgba(0,0,0,1)));
border-bottom: 1px solid rgba(5,5,5,0.7);
}

View File

@ -1,6 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- midi.js package -->
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
<script src="./js/MIDI/LoadPlugin.js" type="text/javascript"></script>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>MIDI.js - Sequencing in Javascript.</title>
<!-- midi.js css -->
<link href="./css/MIDIPlayer.css" rel="stylesheet" type="text/css" />

View File

@ -1,6 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- midi.js package -->
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
<script src="./js/MIDI/LoadPlugin.js" type="text/javascript"></script>

View File

@ -2,6 +2,7 @@
<html lang="en">
<head>
<title>Whitney Music Box in HTML5</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- midi.js package -->
<script src="./js/Color/SpaceW3.js" type="text/javascript"></script>
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>

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;
};