sound with MSVC works again

git-svn-id: https://svn.eduke32.com/eduke32@1478 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-07-29 20:26:03 +00:00
parent 2ffda08128
commit b04b42be23
4 changed files with 63 additions and 4 deletions

View file

@ -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 \ LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \
/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.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 ASFLAGS=/nologo /coff /c
EXESUFFIX=.exe EXESUFFIX=.exe

View file

@ -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)

View file

@ -80,8 +80,12 @@ static inline uint32_t SWAP32(uint32_t s)
return (s >> 24) | (s << 24) | ((s&0xff00) << 8) | ((s & 0xff0000) >> 8); return (s >> 24) | (s << 24) | ((s&0xff00) << 8) | ((s & 0xff0000) >> 8);
} }
#ifndef min
#define min(x,y) ((x) < (y) ? (x) : (y)) #define min(x,y) ((x) < (y) ? (x) : (y))
#endif
#ifndef max
#define max(x,y) ((x) > (y) ? (x) : (y)) #define max(x,y) ((x) > (y) ? (x) : (y))
#endif
#define RoundFixed( fixedval, bits ) \ #define RoundFixed( fixedval, bits ) \
( \ ( \
@ -1028,6 +1032,7 @@ int32_t MV_KillAllVoices
{ {
VoiceNode * voice, * next; VoiceNode * voice, * next;
int32_t flags;
if (!MV_Installed) if (!MV_Installed)
{ {
@ -1035,6 +1040,8 @@ int32_t MV_KillAllVoices
return(MV_Error); return(MV_Error);
} }
flags = DisableInterrupts();
// Remove all the voices from the list // Remove all the voices from the list
for (voice = VoiceList.next; voice != &VoiceList; voice = next) for (voice = VoiceList.next; voice != &VoiceList; voice = next)
{ {
@ -1045,6 +1052,8 @@ int32_t MV_KillAllVoices
} }
} }
RestoreInterrupts(flags);
return(MV_Ok); return(MV_Ok);
} }

View file

@ -56,7 +56,7 @@ typedef struct {
int32_t lastbitstream; int32_t lastbitstream;
} vorbis_data; } 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; vorbis_data * vorb = (vorbis_data *) datasource;
size_t nread = 0; 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; bytes = size;
} }
memcpy(ptr, (char *)vorb->ptr + vorb->pos, bytes); memcpy(ptr, (uint8_t *)vorb->ptr + vorb->pos, bytes);
vorb->pos += bytes; vorb->pos += bytes;
ptr += bytes; ptr = (uint8_t *)ptr + bytes;
if (vorb->length == vorb->pos) { if (vorb->length == vorb->pos) {
nread++; nread++;