Tone.js/examples/player.html
2014-04-04 20:24:19 -04:00

62 lines
No EOL
1.2 KiB
HTML

<html>
<head>
<title>Basic Player</title>
<link rel="stylesheet" type="text/css" href="../style/GUI.css">
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../src/core/Tone.js"></script>
<script type="text/javascript" src="../src/component/Player.js"></script>
</head>
<body>
<style type="text/css">
#Trigger {
margin-left: -50px;
margin-top: -50px;
width: 100px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
background-color: blue;
}
#Trigger:after {
font-family: monospace;
position: absolute;
width: 100%;
content: "loop";
color: white;
text-align: center;
line-height: 100px;
}
#Trigger:active {
background-color: white;
color: black;
}
#Trigger:active:after {
content: "stop";
color: black;
}
</style>
<div id='Trigger'></div>
<script type="text/javascript">
var player = new Tone.Player("../audio/casio/A1.mp3");
player.toMaster();
//once it's loaded, add the event triggers
player.load(function(){
$("#Trigger").mousedown(function(e){
player.loop(0, 0, .5);
});
$("#Trigger").mouseup(function(e){
player.stop();
});
});
</script>
</body>
</html>