<!DOCTYPE html>
<html>
<head>
<title>サンプル2(音色が選べる)</title>
<meta http-equiv="X-UA-Compatible" content="requiresActiveX=true"/>
<meta charset="utf-8">
<style type="text/css">
.pink{background-color:pink;width:1000px;}
.hidden {
visibility:hidden;
width:0px;height:0px;
margin:0px;padding:0px;
border-style:none;border-width:0px;
max-width:0px;max-height:0px;
}
</style>
</head>
<body>
<h1>サンプル2(音色が選べる)</h1>
<object id="Jazz1" classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90" class="hidden">
<object id="Jazz2" type="audio/x-jazz" class="hidden">
<p style="visibility:visible;">This page requires <a href=http://jazz-soft.net>Jazz-Plugin</a> ...</p>
</object>
</object>
<br>
<button onmousedown='play();' onmouseup='stop();'> Press to play... </button>
<br><br>
Sound: <select id=midiSnd onchange='changeSnd();'></select>
<script><!--
var Jazz = document.getElementById("Jazz1");
if(!Jazz || !Jazz.isJazz) Jazz = document.getElementById("Jazz2");
var gmidi=['Acoustic Grand Piano','Bright Acoustic Piano',...(中略)...'Applause','Gunshot'];
var current_snd=0;
var selSnd=document.getElementById("midiSnd");
for(var i in gmidi){
selSnd[i]=new Option(gmidi[i],i,!i,!i);
}
function play(){
if(Jazz.isJazz){
Jazz.MidiOut(0x90,60,100);
Jazz.MidiOut(0x90,64,100);
Jazz.MidiOut(0x90,67,100);
}
}
function stop(){
if(Jazz.isJazz){
Jazz.MidiOut(0x80,60,0);
Jazz.MidiOut(0x80,64,0);
Jazz.MidiOut(0x80,67,0);
}
}
function changeSnd(){
current_snd=selSnd.options[selSnd.selectedIndex].value;
Jazz.MidiOut(0xc0,current_snd,0);
}
--></script>
</body>
</html>