Skip to content

Commit

Permalink
Cleanup and attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
lberezy committed Mar 1, 2016
1 parent cdad8e3 commit f30f3df
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <math.h>
#include <string.h>


#define am_delay(x) (square_am_signal(x, 0))
__m128i reg;
__m128i reg_zero;
__m128i reg_one;
Expand All @@ -36,11 +34,6 @@ static inline void square_am_signal(float time, float frequency) {
}
}

int prefix(const char *pre, const char *str)
{
return strncmp(pre, str, strlen(pre)) == 0;
}

int main(int argc, char* argv[])
{
mach_timebase_info_data_t theTimeBaseInfo;
Expand Down Expand Up @@ -68,40 +61,21 @@ int main(int argc, char* argv[])
/* skip blank lines */
continue;
}

if (prefix(":beep", buffer)) {
if (!strncmp(":beep", buffer, strlen(":beep"))) {
int t;
int f;
if(sscanf(buffer, ":beep frequency=%d length=%dms", &f, &t) == 0) {
continue;
}
printf("F: %d, T: %d\n", f, t);
square_am_signal(t / 1000.0, f);
} else if (prefix(":delay", buffer)) {
} else if (!strncmp(":delay", buffer, strlen(":delay"))) {
int d;
if (sscanf(buffer, ":delay %dms", &d) == 0) {
continue;
}
printf("D: %d\n", d);
square_am_signal(d / 1000.0, 0);
}
/* Super Mario Bros. Theme
square_am_signal(0.100, 660);
am_delay(0.150);
square_am_signal(0.100, 660);
am_delay(0.300);
square_am_signal(0.100, 660);
am_delay(0.300);
square_am_signal(0.100, 510);
am_delay(0.100);
square_am_signal(0.100, 660);
am_delay(0.300);
square_am_signal(0.100, 770);
am_delay(0.550);
square_am_signal(0.100, 380);
am_delay(0.575);*/



}
}

0 comments on commit f30f3df

Please sign in to comment.