2014-04-05 00:24:19 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2014-04-16 00:05:11 +00:00
|
|
|
<title>USING WITH REQUIRE</title>
|
2014-04-05 00:24:19 +00:00
|
|
|
|
|
|
|
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
|
2014-04-06 17:32:14 +00:00
|
|
|
<script type="text/javascript" src="../deps/require.js"></script>
|
2014-04-16 00:05:11 +00:00
|
|
|
|
2014-04-05 00:24:19 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2014-04-16 23:56:18 +00:00
|
|
|
<div id='meter'></div>
|
2014-04-05 00:24:19 +00:00
|
|
|
<script type="text/javascript">
|
2014-04-16 00:05:11 +00:00
|
|
|
//minimal example using requirejs
|
2014-04-06 20:51:30 +00:00
|
|
|
require.config({
|
|
|
|
baseUrl : "../"
|
|
|
|
});
|
2014-04-16 23:56:18 +00:00
|
|
|
require(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale", "Tone/component/Meter"],
|
|
|
|
function(Tone, Signal, Scale, Meter){
|
|
|
|
|
|
|
|
var meter = new Meter();
|
2014-04-16 00:05:11 +00:00
|
|
|
|
2014-04-16 23:56:18 +00:00
|
|
|
var sig1 = new Signal(.5);
|
|
|
|
var scale = new Scale(0, 1, 10, 100);
|
|
|
|
|
|
|
|
sig1.connect(scale)
|
|
|
|
scale.connect(meter);
|
|
|
|
|
|
|
|
var meterEl = document.querySelector("#meter");
|
|
|
|
|
|
|
|
setInterval(function(){
|
|
|
|
meterEl.textContent = meter.getValue();
|
|
|
|
}, 100);
|
|
|
|
window.scale = scale;
|
2014-04-16 04:23:58 +00:00
|
|
|
});
|
2014-04-11 23:17:01 +00:00
|
|
|
|
2014-04-05 00:24:19 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|