Skip to content

Commit

Permalink
more nitpicking
Browse files Browse the repository at this point in the history
Inconsistent code spacing, as well as other things that make my code linter itch have been fixed.
  • Loading branch information
rocketinventor committed Mar 8, 2016
1 parent e11eb7b commit 8175668
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions In Javascript/airgap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@
//Tested to be working on Chrome at 1560khz

function now() {
return performance.now()*1000000;
return window.performance.now() * 1000000;
}

var NSEC_PER_SEC = 1000000000;
var register = 3.1415;

function square_am_signal(time,freq) {
document.getElementById('logs').value += "Playing / "+time+" seconds / "+freq+"Hz\n";
var period = NSEC_PER_SEC/freq;
function square_am_signal(time, freq) {
document.getElementById('logs').value += "Playing / " + time + " seconds / " + freq + "Hz\n";
var period = NSEC_PER_SEC / freq;
var start = now();
var end = now()+time*NSEC_PER_SEC;
var end = now() + time * NSEC_PER_SEC;
while (now() < end) {
var mid = start+period/2;
var reset = start+period;
while (now()<mid) {
var mid = start + period / 2;
var reset = start + period;
while (now() < mid) {
for (var i = 0; i < 100; i++) {
register = 1 - Math.log(register) / 1.7193;
}
}
while(now() < reset){
}
while (now() < reset) {}
start = reset;
}
}

function start() {
var song = document.getElementById("tones").value.split(":");
var length = song.length;
var i = 1, line, time, freq;
var i = 1,
line, time, freq;
while (1 <= length) {
line = song[i].split(" ");
if (line[0] == "beep") {
freq = +line[0].split("=")[1];
time = +line[2].split("=")[1].slice(0,-1);
time = +line[2].split("=")[1].slice(0, -1);
square_am_signal(time, freq);
}
if (line[0] == "delay") {
Expand Down

0 comments on commit 8175668

Please sign in to comment.