summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@no.no.james.local>2019-02-26 16:49:10 +0000
committerroot <root@no.no.james.local>2019-02-26 16:49:10 +0000
commit6e75bcc7f8df65d4901b2918aafb501c6baefabe (patch)
tree6f50017e1e70c6c87ba0b7714ce930204d9d45a2
parent24fd0e3b0d4eb97fbd730fc33c1c1d770bbe1247 (diff)
downloadgen_msf-6e75bcc7f8df65d4901b2918aafb501c6baefabe.tar.gz
gen_msf-6e75bcc7f8df65d4901b2918aafb501c6baefabe.tar.bz2
gen_msf-6e75bcc7f8df65d4901b2918aafb501c6baefabe.zip
windows supportishHEADmaster
-rw-r--r--Makefile12
-rw-r--r--project.h7
-rw-r--r--signal.c10
-rw-r--r--sync.c10
4 files changed, 32 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index edd9837..a8c74c6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,19 @@
CSRCS=time_fn.c msf.c util.c main.c signal.c sync.c audio.c
HSRCS=time_fn.h project.h
PROG=msf
+LIBS=-lm
+CPPFLAGS=
+
AO_CFLAGS=$(shell pkg-config --cflags ao)
AO_LIBS=$(shell pkg-config --libs ao)
-LIBS=-lm $(AO_LIBS)
-CPPFLAGS=$(AO_CFLAGS)
+AO_CFLAGS=-Iprefix/include
+AO_LIBS=prefix/lib/libao.a
+
+LIBS+=$(AO_LIBS)
+CPPFLAGS+=$(AO_CFLAGS)
+
+CC=x86_64-w64-mingw32-gcc
#####################
diff --git a/project.h b/project.h
index f6ad552..3517afb 100644
--- a/project.h
+++ b/project.h
@@ -1,3 +1,5 @@
+#define MINGW
+
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
@@ -9,6 +11,11 @@
#include <unistd.h>
#include <math.h>
+#ifdef __WINNT__
+#define bzero(a,b) memset(a,0,b)
+#endif
+
+
#define KHZ(a) ((a)*1000)
#define SAMPLE_RATE KHZ(48)
#define CARRIER KHZ(20)
diff --git a/signal.c b/signal.c
index 943b81c..77e7270 100644
--- a/signal.c
+++ b/signal.c
@@ -22,11 +22,11 @@ void signal_init (void)
#if 0
zero[i] = 32000 * sin (t);
#else
- if (sin(t)<0) {
- zero[i] = -32000;
- } else {
- zero[i] = 32000;
- }
+
+ if (sin (t) < 0)
+ zero[i] = -32000;
+ else
+ zero[i] = 32000;
#endif
}
diff --git a/sync.c b/sync.c
index 1b6b6bc..2a0c140 100644
--- a/sync.c
+++ b/sync.c
@@ -21,10 +21,16 @@ void sync_to_second (struct timeval *ret)
return;
}
+#ifdef __WINNT__
+ usleep (tv2.tv_usec / 2);
+#else
+
if (tv2.tv_usec > SLEEP_MIN)
select (0, NULL, NULL, NULL, &tv2);
else
usleep (tv2.tv_usec / 2);
+
+#endif
}
}
@@ -45,7 +51,11 @@ void sync_to_minute (struct timeval *ret)
if (tv2.tv_sec > 1) {
tv2.tv_sec /= 2;
+#ifdef __WINNT__
+ sleep (tv2.tv_sec);
+#else
select (0, NULL, NULL, NULL, &tv2);
+#endif
} else {
sync_to_second (ret);
return;