]> hackdaworld.org Git - sound-tools/hdrec.git/commitdiff
lol, some bullshit
authorhackbard <hackbard>
Sat, 27 Mar 2004 15:48:34 +0000 (15:48 +0000)
committerhackbard <hackbard>
Sat, 27 Mar 2004 15:48:34 +0000 (15:48 +0000)
resample.c [new file with mode: 0644]

diff --git a/resample.c b/resample.c
new file mode 100644 (file)
index 0000000..75b5590
--- /dev/null
@@ -0,0 +1,47 @@
+/* resample.c -- resample audio file (just raw) */
+
+/* hackbard@hackdaworld.dyndns.org */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int usage() {
+       puts("usage: resample <src> <dst>");
+       return 1;
+}
+
+int main(int argc,char **argv) {
+       int src_fd,dst_fd;
+       int i;
+       unsigned char buf[2];
+       
+
+       if(argc!=3) {
+               usage();
+               return -1;
+       }
+
+       src_fd=open(argv[1],O_RDONLY);
+       if(src_fd<0) {
+               printf("can't open %s\n",argv[1]);
+               return -1;
+       }
+
+       dst_fd=open(argv[2],O_WRONLY|O_CREAT);
+       if(dst_fd<0) {
+               printf("can't open %s\n",argv[2]);
+               return -1;
+       }
+
+       i=1;
+       while(i) {
+               i=read(src_fd,buf,2);
+               write(dst_fd,buf,2);
+               write(dst_fd,buf,2);
+       }
+
+       return 1;
+}