aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2012-02-10 14:26:03 +0100
committerReiner Herrmann <reiner@reiner-h.de>2012-02-10 14:26:03 +0100
commit65dd941a1ed670f0e7908a6e3bc28593caef2908 (patch)
treea5bdfda0d5b2fc744aa13b3ea2ffe239774532f4
parenta5d7e68af96d9b62821d8fd47f5039c5bae5d421 (diff)
added wave_out for linux
-rw-r--r--Makefile20
-rw-r--r--README2
-rw-r--r--wave_linux.c26
3 files changed, 48 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0c2c47a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+STRIP = strip
+CC = gcc
+CFLAGS = -D__USE_INLINE__ -O3 -ffast-math -finline-functions -funroll-loops -fstrict-aliasing -Wall -I$(SRC)c64
+LDFLAGS = -lsndfile
+TARGET = sam_player
+
+OBJS = sam.o sam_player.o wave_linux.o c64/c64.o c64/cia.o c64/cpu.o c64/kbd.o c64/mem.o c64/prg_file.o c64/sid.o c64/tape.o
+
+%.o: %.c
+ $(CC) $(CFLAGS) -o $@ -c $*.c
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(CC) $(OBJS) -o $@ $(LDFLAGS)
+ $(STRIP) --strip-all $@
+
+
+clean:
+ rm -f *.o $(TARGET) c64/*.o
diff --git a/README b/README
new file mode 100644
index 0000000..40ef03c
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+Based on sam_player by Markku Alén
+http://aminet.net/package/misc/emu/sam_player
diff --git a/wave_linux.c b/wave_linux.c
new file mode 100644
index 0000000..6d04fb7
--- /dev/null
+++ b/wave_linux.c
@@ -0,0 +1,26 @@
+
+#include "wave.h"
+#include <stdio.h>
+#include <sndfile.h>
+
+int wave_out(wave_t *wave)
+{
+ SNDFILE* out;
+ SF_INFO info;
+
+ info.samplerate = wave->samples_per_sec;
+ info.channels = wave->channels;
+ info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_U8;
+
+ out = sf_open("out.wav", SFM_WRITE, &info);
+ sf_write_raw(out, wave->frame_data, wave->frame_size);
+ sf_close(out);
+
+ printf("channels: %d, samples_per_sec: %d, bits_per_sample: %d, frame_size: %d, frame_count: %d\n", wave->channels, wave->samples_per_sec, wave->bits_per_sample, wave->frame_size, wave->frame_count);
+ return 0;
+}
+
+const char *wave_err_to_str(int err)
+{
+ return "unknown error";
+}