making the files write straight to /dev/audio

This commit is contained in:
Vincent Batts 2012-09-17 09:19:05 -04:00
parent 0a84896c2a
commit 62a82f13c2
9 changed files with 55 additions and 13 deletions

View File

@ -1,11 +1,14 @@
FILES := $(basename $(wildcard *.c))
MUSIC_FILES := $(basename $(wildcard f*.c))
TMP_FILES := $(wildcard *~) $(wildcard *.o)
all: $(FILES)
all: $(MUSIC_FILES)
%: %.c
$(CC) -o $@ $<
audio.o: audio.c audio.h
%: %.c audio.o
$(CC) -static -s -o $@ $^
clean:
rm -rf $(FILES) *.o *~
rm -rf $(MUSIC_FILES) $(TMP_FILES)

14
audio.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdio.h>
const char* audio_dev = "/dev/audio";
FILE* audio;
void init() {
audio = fopen(audio_dev, "w");
}
void p(int i) {
fputc(i, audio);
}

4
audio.h Normal file
View File

@ -0,0 +1,4 @@
void init();
void p(int i);

5
f1.c
View File

@ -1,7 +1,10 @@
#include "audio.h"
int main() {
init();
int t;
for (t = 0;;t++) {
putchar((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7));
p((t >> 6 | t | t >> (t >> 16)) * 10 + ((t >> 11) & 7));
}
}

8
f2.c
View File

@ -1 +1,7 @@
main(t){for(t=0;;t++)putchar(t*(((t>>12)|(t>>8))&(63&(t>>4))));}
#include "audio.h"
int main(t){
init();
for(t=0;;t++) {
p(t*(((t>>12)|(t>>8))&(63&(t>>4))));
}
}

8
f3.c
View File

@ -1,4 +1,8 @@
#include "audio.h"
main(int t) {
for(;;t++)
putchar(t*9&t>>4|t*5&t>>7|t*3&t/1024)-1;
init();
for(;;t++) {
p(t*9&t>>4|t*5&t>>7|t*3&t/1024);
}
}

4
f4.c
View File

@ -1,10 +1,12 @@
#include "audio.h"
int main(int t) {
init();
for (t = 0;;t++) {
int i;
i = (t>>7-(t>>15)&-t>>7-(t>>15));
if (i==0)
continue;
putchar(t>>4|t&(t>>5)/i);
p(t>>4|t&(t>>5)/i);
}
}

7
f5.c
View File

@ -1,4 +1,7 @@
#include "audio.h"
main(t){
for(t=0;;t++)
putchar(((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127));
init();
for(t=0;;t++) {
p(((t*("36364689"[t>>13&7]&15))/12&128)+(((((t>>12)^(t>>12)-2)%11*t)/4|t>>13)&127));
}
}

5
f6.c
View File

@ -1,5 +1,8 @@
#include "audio.h"
main(t){
int y,x;
init();
for(t=0;;t++)
{
x=t*"6689"[t>>16&3]/24&127;
@ -7,6 +10,6 @@ main(t){
if (y==0 || x==0)
continue;
putchar((30000000000/(y)&1)*35+(x)*y/400000000+((t>>8^t>>10|1>>14|x)&63));
p((30000000000/(y)&1)*35+(x)*y/400000000+((t>>8^t>>10|1>>14|x)&63));
}
}