Skip to content

Commit

Permalink
Added song repeat and :end token to song, added usage info also.
Browse files Browse the repository at this point in the history
  • Loading branch information
lberezy committed Mar 1, 2016
1 parent f30f3df commit b4a1097
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
// https://github.com/fulldecent/system-bus-radio
// Copyright 2016 William Entriken


/* Note: Included Super Mario Bros. theme song was found online at:
http://wiki.mikrotik.com/wiki/Super_Mario_Theme
annotated by user "IanH"
*/

#include <stdio.h>
#include <emmintrin.h>
#include <mach/mach_traps.h>
Expand Down Expand Up @@ -51,7 +57,7 @@ int main(int argc, char* argv[])
if (argc == 2) {
fp = fopen(argv[1], "r");
} else {
puts("Supply file to read song from.");
printf("No song file given!\nUsage: %s file.song\n", argv[0]);
exit(1);
}
char buffer[256];
Expand All @@ -76,6 +82,9 @@ int main(int argc, char* argv[])
}
printf("D: %d\n", d);
square_am_signal(d / 1000.0, 0);
} else if (!strncmp(":end", buffer, strlen(":end"))) {
puts("End of song, repeating.");
rewind(fp);
}
}
}
1 change: 1 addition & 0 deletions smb.song
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,4 @@
:delay 550ms;
:beep frequency=380 length=100ms;
:delay 575ms;
:end

0 comments on commit b4a1097

Please sign in to comment.