-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored the BeatTimer out to its own file, changed some class names.
- Loading branch information
Remy Porter
committed
Jun 10, 2015
1 parent
66d3421
commit a3c87a2
Showing
4 changed files
with
34 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
public class BeatTimer { | ||
time events[]; | ||
int n; | ||
int currentEvent; | ||
fun void windowSize(int count) { | ||
new time[count] @=> events; | ||
for (0 => int i; i < count; i++) { | ||
now => events[i]; | ||
} | ||
count => n; | ||
0 => currentEvent; | ||
} | ||
fun void event() { | ||
now => events[currentEvent % n]; | ||
currentEvent++; | ||
} | ||
fun dur interval() { | ||
dur diffs; | ||
for (currentEvent => int i; i < currentEvent + n - 1; i++) { | ||
i % n => int e0; | ||
(i + 1) % n => int e1; | ||
events[e1] - events[e0] +=> diffs; | ||
} | ||
return diffs / n; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Machine.add(me.dir() + "/beatTimer.ck"); | ||
Machine.add(me.dir() + "/beatTap.ck"); | ||
Machine.add(me.dir() + "/tapTester.ck"); |