diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 14dc8b5f9..073f0950a 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -43,7 +43,7 @@ CFLAGS= /MT /J /nologo $(flags_cl) \ LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \ /NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib -LIBS=vorbisfile_static.lib vorbis_static.lib ogg_static.lib $(LIBS) +LIBS=vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib $(LIBS) ASFLAGS=/nologo /coff /c EXESUFFIX=.exe diff --git a/polymer/eduke32/source/jaudiolib/Makefile.msvc b/polymer/eduke32/source/jaudiolib/Makefile.msvc new file mode 100644 index 000000000..3903dd850 --- /dev/null +++ b/polymer/eduke32/source/jaudiolib/Makefile.msvc @@ -0,0 +1,50 @@ +OBJ=obj.msc +INC=include +SRC=src +JFAUDIOLIB=libjfaudiolib.lib + +!ifdef DEBUG +# debugging options +flags_cl=/Od /Zi +flags_link=/DEBUG +flags_lib= +!else +# release options +flags_cl=/Ox /GL /arch:SSE +flags_link=/RELEASE /LTCG +flags_lib=/LTCG +!endif + +CC=cl +LINK=link /opt:ref /nologo + +DXROOT=U:\SDKs\Microsoft DirectX SDK (April 2007) +VORBISSDK=U:\SDKs\oggvorbis-win32sdk-1.0.1 + +CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(SRC) /I"$(VORBISSDK)\include" /I"$(DXROOT)\include" +!ifdef DEBUG +CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS +!endif + +CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /D "_CRT_SECURE_NO_DEPRECATE" /W2 /DHAVE_VORBIS /Iinclude/msvc /DWIN32 + +OBJECTS=$(OBJ)\drivers.o \ + $(OBJ)\fx_man.o \ + $(OBJ)\multivoc.o \ + $(OBJ)\mix.o \ + $(OBJ)\mixst.o \ + $(OBJ)\pitch.o \ + $(OBJ)\vorbis.o \ + $(OBJ)\driver_nosound.o \ + $(OBJ)\driver_directsound.o + +{$(SRC)}.c{$(OBJ)}.o: + $(CC) /c $(CFLAGS) /Fo$@ $< + +jfaudiolib: $(JFAUDIOLIB) +$(JFAUDIOLIB): $(OBJECTS) + lib $(flags_lib) /out:$@ /nologo $** + +clean: + -del /Q $(OBJECTS) $(JFAUDIOLIB) + diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.c b/polymer/eduke32/source/jaudiolib/src/multivoc.c index 0d7e6f7dc..9b0a7540d 100644 --- a/polymer/eduke32/source/jaudiolib/src/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/src/multivoc.c @@ -80,8 +80,12 @@ static inline uint32_t SWAP32(uint32_t s) return (s >> 24) | (s << 24) | ((s&0xff00) << 8) | ((s & 0xff0000) >> 8); } +#ifndef min #define min(x,y) ((x) < (y) ? (x) : (y)) +#endif +#ifndef max #define max(x,y) ((x) > (y) ? (x) : (y)) +#endif #define RoundFixed( fixedval, bits ) \ ( \ @@ -1028,6 +1032,7 @@ int32_t MV_KillAllVoices { VoiceNode * voice, * next; + int32_t flags; if (!MV_Installed) { @@ -1035,6 +1040,8 @@ int32_t MV_KillAllVoices return(MV_Error); } + flags = DisableInterrupts(); + // Remove all the voices from the list for (voice = VoiceList.next; voice != &VoiceList; voice = next) { @@ -1045,6 +1052,8 @@ int32_t MV_KillAllVoices } } + RestoreInterrupts(flags); + return(MV_Ok); } diff --git a/polymer/eduke32/source/jaudiolib/src/vorbis.c b/polymer/eduke32/source/jaudiolib/src/vorbis.c index 171fc0208..e1ca3f191 100644 --- a/polymer/eduke32/source/jaudiolib/src/vorbis.c +++ b/polymer/eduke32/source/jaudiolib/src/vorbis.c @@ -56,7 +56,7 @@ typedef struct { int32_t lastbitstream; } vorbis_data; -static size_t read_vorbis(char * ptr, size_t size, size_t nmemb, void * datasource) +static size_t read_vorbis(void * ptr, size_t size, size_t nmemb, void * datasource) { vorbis_data * vorb = (vorbis_data *) datasource; size_t nread = 0; @@ -74,9 +74,9 @@ static size_t read_vorbis(char * ptr, size_t size, size_t nmemb, void * datasour bytes = size; } - memcpy(ptr, (char *)vorb->ptr + vorb->pos, bytes); + memcpy(ptr, (uint8_t *)vorb->ptr + vorb->pos, bytes); vorb->pos += bytes; - ptr += bytes; + ptr = (uint8_t *)ptr + bytes; if (vorb->length == vorb->pos) { nread++;