diff options
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | project.h | 7 | ||||
-rw-r--r-- | signal.c | 10 | ||||
-rw-r--r-- | sync.c | 10 |
4 files changed, 32 insertions, 7 deletions
@@ -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 ##################### @@ -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) @@ -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 } @@ -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; |