Skip to content

Commit

Permalink
delay and metro start button
Browse files Browse the repository at this point in the history
  • Loading branch information
Forrest Oliphant committed Feb 5, 2012
1 parent 268cb32 commit bcee907
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
77 changes: 77 additions & 0 deletions delay.html
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>delay</title>
<meta name="author" content="forresto">
<meta name="description" content="holds some data then releases it" />

<script src="http://meemoo.org/meemoo/v1/meemoo-min.js"></script>

<style type="text/css">
html, body {
margin: 0;
padding:0;
font-family: verdana;
font-size: 10px;
}
</style>
</head>
<body>

<div id="info"></div>

<script type="text/javascript">

var stack = [];
var delay = 1;
document.getElementById("info").innerHTML = window.encodeURI( stack.length+"/"+delay );

function hold (data) {
stack.push(data)
while (stack.length > delay) {
Meemoo.send("out",stack.shift());
}
if (stack.length < delay) {
document.getElementById("info").innerHTML = window.encodeURI( stack.length+"/"+delay );
}
}

function setDelay (_delay) {
delay = _delay;
if (stack.length > delay) {
stack = stack.slice(0-delay, stack.length);
}
document.getElementById("info").innerHTML = window.encodeURI( stack.length+"/"+delay );
}

Meemoo
.setInfo({
title: "delay",
author: "forresto",
description: "holds some data then releases it"
})
.addInputs({
in: {
action: hold,
type: "",
description: "data to delay"
},
delay: {
action: setDelay,
type: "int",
min: 0,
max: 5000,
description: "number of items to hold",
default: delay
}
})
.addOutputs({
out: {
type: ""
}
});
</script>

</body>
</html>
6 changes: 6 additions & 0 deletions metronome.html
Expand Up @@ -26,6 +26,9 @@
.on {
background-color: #FF9292;
}
#info {
margin-bottom: 10px;
}
</style>

</head>
Expand All @@ -35,6 +38,9 @@
<div id="rightlight" class="light"></div>

<div id="info"></div>

<button id="start" type="button" onclick="Meemoo.inputs.start()">start</button>
<button id="stop" type="button" onclick="Meemoo.inputs.stop()">stop</button>

<script type="text/javascript">

Expand Down

0 comments on commit bcee907

Please sign in to comment.