From f30f3dfc4fecd79584218d7440b4f57d2bf4f6cd Mon Sep 17 00:00:00 2001 From: Lucas Berezy Date: Wed, 2 Mar 2016 00:37:10 +1100 Subject: [PATCH] Cleanup and attribution --- main.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/main.c b/main.c index 0814af9..3c2e9b2 100644 --- a/main.c +++ b/main.c @@ -9,8 +9,6 @@ #include #include - -#define am_delay(x) (square_am_signal(x, 0)) __m128i reg; __m128i reg_zero; __m128i reg_one; @@ -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; @@ -68,8 +61,7 @@ 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) { @@ -77,7 +69,7 @@ int main(int argc, char* argv[]) } 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; @@ -85,23 +77,5 @@ int main(int argc, char* argv[]) 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);*/ - - - } }