From 6e75bcc7f8df65d4901b2918aafb501c6baefabe Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Feb 2019 16:49:10 +0000 Subject: windows supportish --- Makefile | 12 ++++++++++-- project.h | 7 +++++++ signal.c | 10 +++++----- sync.c | 10 ++++++++++ 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 #include #include @@ -9,6 +11,11 @@ #include #include +#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; -- cgit v1.2.3