diff --git a/src/Makefile b/src/Makefile index f8bc96970..369c3b488 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,12 +36,8 @@ # Pure Mingw only, compile OpenGL HW render DLL # ds3d_dll # Pure Mingw only, compile DirectX DirectSound HW sound DLL -# fmod_dll -# Pure Mingw only, compile FMOD HW sound DLL # openal_dll # Pure Mingw only, compile OpenAL HW sound DLL -# fmod_so -# Non-Mingw, compile FMOD HW sound SO # openal_so # Non-Mingw, compile OpenAL HW sound SO # @@ -75,7 +71,6 @@ # Compile without IPX/SPX, add 'NOIPX=1' # Compile Mingw/SDL with S_DS3S, add 'DS3D=1' # Compile without libopenmpt, add 'NOOPENMPT=1' -# Compile with S_FMOD3D, add 'FMOD=1' (WIP) # Compile with S_OPENAL, add 'OPENAL=1' (WIP) # To link with the whole SDL_Image lib to load Icons, add 'SDL_IMAGE=1' but it isn't not realy needed # To link with SDLMain to hide console or make on a console-less binary, add 'SDLMAIN=1' @@ -586,7 +581,7 @@ else dll : opengl_dll endif ifdef MINGW -all_dll: opengl_dll ds3d_dll fmod_dll openal_dll +all_dll: opengl_dll ds3d_dll openal_dll opengl_dll: $(BIN)/r_opengl.dll $(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o @@ -602,25 +597,13 @@ $(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o @echo Linking S_DS3d.dll... $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -ldsound -luuid -fmod_dll: $(BIN)/s_fmod.dll -$(BIN)/s_fmod.dll: $(OBJDIR)/s_fmod.o - -$(MKDIR) $(BIN) - @echo Linking S_FMOD.dll... - $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lfmod - openal_dll: $(BIN)/s_openal.dll $(BIN)/s_openal.dll: $(OBJDIR)/s_openal.o -$(MKDIR) $(BIN) @echo Linking S_OpenAL.dll... $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lopenal32 else -all_dll: fmod_so openal_so - -fmod_so: $(BIN)/s_fmod.so -$(BIN)/s_fmod.so: $(OBJDIR)/s_fmod.o - -$(MKDIR) $(BIN) - @echo Linking S_FMOD.so... - $(CC) --shared $^ -o $@ -g --nostartfiles -lm -lfmod +all_dll: openal_so openal_so: $(BIN)/s_openal.so $(BIN)/s_openal.so: $(OBJDIR)/s_openal.o @@ -745,10 +728,6 @@ $(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \ hardware/hw_dll.h $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_ds3d.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_ds3d/s_ds3d.c -$(OBJDIR)/s_fmod.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ - hardware/hw_dll.h - $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_fmod/s_fmod.c - $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ hardware/hw_dll.h $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_openal/s_openal.c @@ -768,10 +747,6 @@ $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ hardware/hw_dll.h $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ -$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \ - hardware/hw_dll.h - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ - ifdef MINGW $(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \ hardware/hw_dll.h @@ -779,10 +754,6 @@ $(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \ endif else -$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \ - hardware/hw_dll.h - $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_fmod/s_fmod.c - $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ hardware/hw_dll.h $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c diff --git a/src/doomdef.h b/src/doomdef.h index 0a98c874a..7bab60442 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -21,7 +21,6 @@ #define SOUND_DUMMY 0 #define SOUND_SDL 1 #define SOUND_MIXER 2 -#define SOUND_FMOD 3 #ifndef SOUND #ifdef HAVE_SDL @@ -41,15 +40,6 @@ #endif #else // No SDL. - -// Use FMOD? -#ifdef HAVE_FMOD - #define SOUND SOUND_FMOD - #define NOHS // No HW3SOUND - #ifdef HW3SOUND - #undef HW3SOUND - #endif -#else // No more interfaces. :( #define SOUND SOUND_DUMMY #endif diff --git a/src/hardware/hw3sound.h b/src/hardware/hw3sound.h index a8a475b69..c534d7a1d 100644 --- a/src/hardware/hw3sound.h +++ b/src/hardware/hw3sound.h @@ -31,7 +31,6 @@ enum HWS_DEFAULT_MODE = 0, HWS_DS3D, HWS_OTHER, - HWS_FMOD3D, HWS_OPENAL, }; diff --git a/src/hardware/s_fmod/s_fmod.c b/src/hardware/s_fmod/s_fmod.c deleted file mode 100644 index 120d63540..000000000 --- a/src/hardware/s_fmod/s_fmod.c +++ /dev/null @@ -1,1210 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 2001 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -//----------------------------------------------------------------------------- -/// \file -/// \brief General driver for 3D sound system -/// -/// Implementend via FMOD_SOUND API - -#ifdef _WINDOWS -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#else -#include -#include -#include -#include -#include -#endif - -#include -FILE *logstream = NULL; - -#ifdef __MINGW32__ -#include -#else -#include -#endif - -#ifdef FSOUND_INIT_DONTLATENCYADJUST //Alam: why didn't I think about this before? :) -#define FSOUND_Sample_Load(index,data,mode,length) FSOUND_Sample_Load(index,data,mode,0,length) -#else -#define OLDFMOD //Alam: Yea! -#endif - -#ifdef __MINGW32__ -#include -#else -#include /* optional */ -#endif - -#define MAXCHANNEL 1024 - -#undef DEBUG_TO_FILE -#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES ) -#define DEBUG_TO_FILE -#endif - -#ifndef MORESTUFF -//#define MORESTUFF -#define REL2D -#endif - -#define _CREATE_DLL_ -#include "../../doomdef.h" -#include "../hw3dsdrv.h" -#define INT2CHAR(p) (char *)p + 8 - -//Doom sound sample format -#define FSOUND_UNORMAL (FSOUND_8BITS | FSOUND_MONO | FSOUND_UNSIGNED) -//Load Raw -#define FSOUND_RAWLOAD (FSOUND_LOADRAW | FSOUND_LOADMEMORY) -//Load Sample Raw from pointer -#define FSOUND_DOOMLOAD (FSOUND_UNORMAL | FSOUND_RAWLOAD) -//length of SFX -#define SFXLENGTH (sfx->length-8) - -//SRB2 treats +X as east, +Y as north, +Z as up. -//FSOUND treats +X as right, +Y as up, and +Z as forwards. -//So SRB2's XZY is FSOUND's XYZ -//And FSOUND's XZY is SRB2's XYZ - -static I_Error_t I_ErrorFMOD = NULL; - -static FSOUND_SAMPLE *blankfmsample = NULL; - -// Calculate sound pitching -static float recalc_pitch(INT32 doom_pitch) -{ -#ifdef MORESTUFF - return (float)1; -#else - return doom_pitch < NORMAL_PITCH ? - (float)(doom_pitch + NORMAL_PITCH) / (NORMAL_PITCH * 2) - :(float)doom_pitch / (float)NORMAL_PITCH; -#endif -} - -/*************************************************************** - * - * DBG_Printf - * Output error messages to debug log if DEBUG_TO_FILE is defined, - * else do nothing - * - ************************************************************** - */ -// -----------------+ -// DBG_Printf : Output error messages to debug log if DEBUG_TO_FILE is defined, -// : else do nothing -// Returns : -// -----------------+ -FUNCPRINTF void DBG_Printf(const char *lpFmt, ...) -{ -#ifdef DEBUG_TO_FILE - char str[4096] = ""; - va_list arglist; - - va_start(arglist, lpFmt); - vsnprintf(str, 4096, lpFmt, arglist); - va_end(arglist); - - if (logstream) - fwrite(str, strlen(str), 1, logstream); -#endif -} - -// Start of head_relative system for FMOD3D - -typedef struct rellistener_s -{ - float pos[3]; - INT32 active; - float vel[3]; - -} rellistener_s_t; //Easy - -static rellistener_s_t rellistener[2]; //The 2 listeners - -typedef struct relarray_s -{ - INT32 handle; // handle number - INT32 chan; // real channel - INT32 listener; // for which listener - rellistener_s_t pos; // source position in 3D -} relarray_s_t; - -static relarray_s_t relarray[STATIC_SOURCES_NUM+1]; // array of chans - - -//set listener -static void relset(INT32 which) -{ - INT32 i; - - if (which == -2 || which == -1) - { - which = -which; - - memset(&rellistener[which-1], 0, sizeof (rellistener_s_t)); //Delete me - for (i = 0; i <= STATIC_SOURCES_NUM; i++) - { - if (relarray[i].pos.active && relarray[i].listener == which) - { - FSOUND_SetPaused(relarray[i].chan,true); - relarray[i].pos.active = false; - } - } - return; - } - else if (which == 1 || which ==2) - { - float pos[3], vel[3]; // Temp bin - which -= 1; //Hello! - - //Get update - FSOUND_3D_Listener_GetAttributes(&pos[0],&vel[0],NULL,NULL,NULL,NULL,NULL,NULL); - memcpy(&rellistener[which].pos[0],&pos[0],sizeof (pos)); - memcpy(&rellistener[which].vel[0],&vel[0],sizeof (vel)); - - if (!rellistener[which].active) - for (i = 0; i <= STATIC_SOURCES_NUM; i++) - { - if (!relarray[i].pos.active && relarray[i].listener == which) - { - FSOUND_SetPaused(relarray[i].chan,false); - relarray[i].pos.active = true; - } - } - - rellistener[which].active = which; - } - else - { - memset(&rellistener[0], 0, sizeof (rellistener_s_t)); - memset(&rellistener[1], 0, sizeof (rellistener_s_t)); - } -} - -//setup system -static void relsetup() -{ - INT32 i; - - // Setup the rel array for use - for (i = 0; i <= STATIC_SOURCES_NUM; i++) - { - relarray[i].handle = FSOUND_FREE; - relarray[i].chan = FSOUND_FREE; - relarray[i].listener = (i == 1 || i == 3)?2:1; - memset(&relarray[i].pos, 0, sizeof (rellistener_s_t)); - } - - // Set up the Listener array - relset(0); -} - - -//checkup for stack -static INT32 relstack(INT32 chan) -{ - INT32 i; - - for (i = 0; i <= STATIC_SOURCES_NUM; i++) - { - if (relarray[i].pos.active && relarray[i].handle == chan) - return i; - } - return -1; -} - -//checkup for fake rel chan -static INT32 relcheckup(INT32 chan) -{ - INT32 i = relstack(chan); - - if (i == -1) - return chan; - else - return relarray[i].chan; -} - - //Update place rel chan's vol -static void relvol(INT32 chan) -{ - INT32 vol = FSOUND_GetVolume(chan); - INT32 error = FSOUND_GetError(); - - if (chan == relcheckup(chan)) - return; - - if (!vol && error) - DBG_Printf("FMOD(relvol, FSOUND_GetVolume, Channel # %i): %s\n",chan,FMOD_ErrorString(error)); - else if (!FSOUND_SetVolume(relcheckup(chan), vol)) - DBG_Printf("FMOD(relvol, FSOUND_SetVolume, Channel # %i): %s\n",chan,FMOD_ErrorString(FSOUND_GetError())); -} - -//Copy rel chan -static INT32 relcopy(INT32 handle) -{ - FSOUND_SAMPLE *fmsample = NULL; - INT32 chan = -1; - float pos[3]; - float vel[3]; - - if (!FSOUND_3D_GetAttributes(handle,&pos[0],&vel[0])) - if (FSOUND_GetError() != FMOD_ERR_NONE) DBG_Printf("FMOD(relcopy, FSOUND_3D_GetAttributes, Channel # %i): %s\n",handle,FMOD_ErrorString(FSOUND_GetError())); - - fmsample = FSOUND_GetCurrentSample(handle); - - if (fmsample) - { -#ifdef REL2D - if (!FSOUND_Sample_SetMode(fmsample, FSOUND_2D)) - DBG_Printf("FMOD(relcopy, FSOUND_Sample_SetMode, handle# %i): %s\n",handle,FMOD_ErrorString(FSOUND_GetError())); -#endif - chan = FSOUND_PlaySoundEx(FSOUND_FREE,fmsample,NULL,true); - - if (chan == -1) - { - if (FSOUND_GetError() != FMOD_ERR_NONE) DBG_Printf("FMOD(relcopy, FSOUND_PlaySoundEx, handle# %i): %s\n",handle,FMOD_ErrorString(FSOUND_GetError())); - return FSOUND_FREE; - } -#ifdef MORESTUFF - else - DBG_Printf("FMOD(relcopy, Main): Copy Handle#%i to channel#%i\n",handle,chan); -#endif - } - else - { - if (FSOUND_GetError() != FMOD_ERR_NONE) - DBG_Printf("FMOD(relcopy, FSOUND_GetCurrentSample, handle# %i): %s\n",handle,FMOD_ErrorString(FSOUND_GetError())); - chan = FSOUND_PlaySoundEx(FSOUND_FREE,blankfmsample,NULL,true); - //return FSOUND_FREE; - } - - if (FSOUND_GetCurrentSample(chan)) - { - - if (!FSOUND_SetCurrentPosition(chan, 0)) - DBG_Printf("FMOD(relcopy, FSOUND_SetCurrentPosition, handle#%i, channel# %i): %s\n",handle,chan,FMOD_ErrorString(FSOUND_GetError())); -#ifndef REL2D - if (!FSOUND_3D_SetAttributes(chan,pos,vel)) - DBG_Printf("FMOD(relcopy, FSOUND_3D_SetAttributes, handle#%i, channel#%i): %s\n",handle,chan,FMOD_ErrorString(FSOUND_GetError())); -#endif -/* - if (!FSOUND_SetReserved(chan, TURE)) - DBG_Printf("FMOD(relcopy, FSOUND_SetReserved, handle#%i, channel# %i): %s\n",handle,chan,FMOD_ErrorString(FSOUND_GetError())); -*/ - return chan; - } - - return FSOUND_FREE; -} - -//update the rel chans -static void relupdate(INT32 handle) -{ - if (handle == FSOUND_FREE) - { - INT32 stack; - - for (stack = 0; stack <= STATIC_SOURCES_NUM;stack++) - { - //if (FSOUND_GetCurrentSample(relarray[stack].handle)) - // relarray[stack].chan = relcopy(relarray[stack].handle); - - if (relarray[stack].chan != FSOUND_FREE) - { - relarray[stack].pos.active = false; - relupdate(relarray[stack].chan); - } - else - relarray[stack].pos.active = false; - } - } - else if (handle == relcheckup(handle)) - return; -#ifndef REL2D - else - { - float pos[3], vel[3]; - INT32 stack = relstack(handle); - INT32 chan = relcheckup(handle); - INT32 which = relarray[stack].listener; - - pos[0] = relarray[stack].pos.pos[0] + rellistener[which].pos[0]; - pos[1] = relarray[stack].pos.pos[1] + rellistener[which].pos[1]; - pos[2] = relarray[stack].pos.pos[2] + rellistener[which].pos[2]; - vel[0] = relarray[stack].pos.vel[0] + rellistener[which].vel[0]; - vel[1] = relarray[stack].pos.vel[1] + rellistener[which].vel[1]; - vel[2] = relarray[stack].pos.vel[2] + rellistener[which].vel[2]; - - if (!FSOUND_3D_SetAttributes(chan,pos,vel)) - DBG_Printf("FMOD(relupdate, FSOUND_3D_SetAttributes, Handle #%i,Channel #%i): %s\n",handle, chan,FMOD_ErrorString(FSOUND_GetError())); - } -#endif -} - - //Update place rel chan's pos -static void relplace(INT32 chan) -{ - float pos[3], vel[3]; // Temp bin - - if (chan == relcheckup(chan)) - return; - - if (!FSOUND_3D_GetAttributes(chan,&pos[0],&vel[0])) - { - if (FSOUND_GetError() != FMOD_ERR_NONE) DBG_Printf("FMOD(relplace, FSOUND_3D_GetAttributes, Channel # %i): %s\n",chan,FMOD_ErrorString(FSOUND_GetError())); - } - else - { - INT32 stack = relstack(chan); - - if (stack == -1) - return; - - memcpy(&relarray[stack].pos.pos,&pos,sizeof (pos)); - memcpy(&relarray[stack].pos.vel,&vel,sizeof (vel)); - relupdate(chan); - } -} - -//New rel chan -static void reladd(INT32 chan) -{ - if (chan != relcheckup(chan)) - return; - else - { - INT32 stack = STATIC_SOURCES_NUM; - { - if (relarray[0].handle == FSOUND_FREE) - stack = 0; - else if (relarray[1].handle == FSOUND_FREE) - stack = 1; - else if (relarray[2].handle == FSOUND_FREE) - stack = 2; - else if (relarray[3].handle == FSOUND_FREE) - stack = 3; - else if (relarray[4].handle == FSOUND_FREE) - stack = 4; - else if (relarray[5].handle == FSOUND_FREE) - stack = 5; - else - DBG_Printf("No more room in relarray\n"); - } - - relarray[stack].handle = chan; - relarray[stack].chan = relcopy(chan); - - if (relarray[stack].chan != FSOUND_FREE) - { - relarray[stack].pos.active = true; - relupdate(chan); - } - else - relarray[stack].pos.active = false; - } -} - -// End of head_relative system for FMOD3D - - -/****************************************************************************** - * - * Initialise driver and listener - * - *****************************************************************************/ -EXPORT INT32 HWRAPI(Startup) (I_Error_t FatalErrorFunction, snddev_t *snd_dev) -{ - boolean inited = false; - INT32 i = 0; - - I_ErrorFMOD = FatalErrorFunction; - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - DBG_Printf("Error : You are using the wrong DLL version!\nYou should be using FMOD %.02f\n", FMOD_VERSION); - return inited; - } - else - DBG_Printf("S_FMOD Init(): FMOD_SOUND driver for SRB2 %s\n",VERSIONSTRING); - - if (!FSOUND_SetMinHardwareChannels(STATIC_SOURCES_NUM*4)) - DBG_Printf("FMOD(Startup,FSOUND_SetMinHardwareChannels,# of Channels Min: %i): %s\n",STATIC_SOURCES_NUM*4, FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_SetMaxHardwareChannels(0)) - DBG_Printf("FMOD(Startup,FSOUND_SetMaxHardwareChannels,# of Channels Min: %i): %s\n",0, FMOD_ErrorString(FSOUND_GetError())); - - for (i = 0; i < FSOUND_GetNumDrivers(); i++) - { - UINT32 caps = 0; - DBG_Printf("Driver Caps, if any\n"); - - if (FSOUND_GetDriverCaps(i, &caps)) - { - DBG_Printf("FMOD: Driver# %d - %s\n", i+1, FSOUND_GetDriverName(i)); // print driver names - if (caps & FSOUND_CAPS_HARDWARE) - DBG_Printf("This sound hardware supports hardware accelerated 3d sound.\n"); - - if (caps & FSOUND_CAPS_EAX2) - DBG_Printf("This sound hardware supports hardware accelerated 3d sound with EAX 2 reverb.\n"); - - if (caps & FSOUND_CAPS_EAX3) - DBG_Printf("This sound hardware supports hardware accelerated 3d sound with EAX 3 reverb.\n"); - } - else - DBG_Printf("FMOD(Startup,FSOUND_GetDriverCaps,%s): %s\n",FSOUND_GetDriverName(i), FMOD_ErrorString(FSOUND_GetError())); - } -#if defined (_WIN32) || defined (_WIN64) - if (!FSOUND_SetHWND(snd_dev->hWnd)) - { - DBG_Printf("FMOD(Startup,FSOUND_SetHWND): %s\n", FMOD_ErrorString(FSOUND_GetError())); - return inited; - } - else -#endif - { - DBG_Printf("Initialising FMOD %.02f\n",FMOD_VERSION); - inited = FSOUND_Init(snd_dev->sample_rate,MAXCHANNEL,0); - } - - if (!inited) - { - DBG_Printf("FMOD(Startup,Main): %s\n", FMOD_ErrorString(FSOUND_GetError())); - } - else - { -#ifdef OLDFMOD - DBG_Printf(" Maximum hardware mixing buffers %d\n", FSOUND_GetNumHardwareChannels()); -#else - INT32 num2DC, num3DC, numDC; - - if (FSOUND_GetNumHWChannels(&num2DC,&num3DC,&numDC)) - { - DBG_Printf(" Maximum hardware 2D buffers %d\n", num2DC); - DBG_Printf(" Maximum hardware 3D buffers %d\n", num3DC); - DBG_Printf(" Maximum hardware mixing buffers %d\n", numDC); - } - else - DBG_Printf("FMOD(Startup,FSOUND_GetNumHWChannels): %s\n", FMOD_ErrorString(FSOUND_GetError())); -#endif - - DBG_Printf("FMOD is up and running at %i KHZ\n",FSOUND_GetOutputRate()); - DBG_Printf("Sound hardware capabilities:\n"); - - if (FSOUND_GetDriverName(FSOUND_GetDriver())) - DBG_Printf(" Driver is %s\n",FSOUND_GetDriverName(FSOUND_GetDriver())); - else - DBG_Printf("FMOD(Startup,FSOUND_GetDriverName): %s\n", FMOD_ErrorString(FSOUND_GetError())); - - FSOUND_3D_SetDistanceFactor(1.0f/72.0f); - FSOUND_3D_SetRolloffFactor(0); - FSOUND_3D_SetRolloffFactor(1.6f); -#ifdef MORESTUFF - FSOUND_3D_SetDopplerFactor(0); -#endif - - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: - DBG_Printf("FMOD driver: NoSound driver, all calls to this succeed but do nothing.\n"); - break; - case FSOUND_OUTPUT_WINMM: - DBG_Printf("FMOD driver: Windows Multimedia driver.\n"); - break; - case FSOUND_OUTPUT_DSOUND: - DBG_Printf("FMOD driver: DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support.\n"); - break; - case FSOUND_OUTPUT_A3D: - DBG_Printf("FMOD driver: A3D driver.\n"); - break; - case FSOUND_OUTPUT_XBOX: - DBG_Printf("FMOD driver: Xbox driver\n"); - break; - case FSOUND_OUTPUT_OSS: - DBG_Printf("FMOD driver: Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers.\n"); - break; - case FSOUND_OUTPUT_ESD: - DBG_Printf("FMOD driver: Linux/Unix ESD (Enlightment Sound Daemon) driver.\n"); - break; - case FSOUND_OUTPUT_ALSA: - DBG_Printf("FMOD driver: Linux Alsa driver.\n"); - break; - case FSOUND_OUTPUT_MAC: - DBG_Printf("FMOD driver: Mac SoundManager driver\n"); - break; - case FSOUND_OUTPUT_PS2: - DBG_Printf("FMOD driver: PlayStation 2 driver\n"); - break; - case FSOUND_OUTPUT_GC: - DBG_Printf("FMOD driver: Gamecube driver\n"); - break; - case FSOUND_OUTPUT_NOSOUND_NONREALTIME: - DBG_Printf("FMOD driver: This is the same as nosound, but the sound generation is driven by FSOUND_Update\n"); - break; - case FSOUND_OUTPUT_ASIO: - DBG_Printf("FMOD driver: Low latency ASIO driver\n"); - break; - default: - DBG_Printf("FMOD driver: Unknown Sound Driver\n"); - break; - } - - relsetup(); - - blankfmsample = FSOUND_Sample_Alloc(FSOUND_UNMANAGED,1,FSOUND_UNORMAL,11025,127,FSOUND_STEREOPAN,127); - - if (!blankfmsample) - DBG_Printf("FMOD(Startup,FSOUND_Sample_Alloc): %s\n", FMOD_ErrorString(FSOUND_GetError())); - else if (!FSOUND_Sample_SetMaxPlaybacks(blankfmsample,STATIC_SOURCES_NUM*2)) - DBG_Printf("FMOD(Startup,FSOUND_Sample_SetMaxPlaybacks): %s\n", FMOD_ErrorString(FSOUND_GetError())); - } - return inited; -} - -EXPORT void HWRAPI(Shutdown) (void) -{ - DBG_Printf("Shuting down FMOD\n"); - FSOUND_Sample_Free(blankfmsample); - DBG_Printf("Shutdown of FMOD done\n"); - FSOUND_Close(); -} - -/****************************************************************************** - * - * Creates 3D source - * - ******************************************************************************/ - -EXPORT INT32 HWRAPI (Add3DSource) (source3D_data_t *src, sfx_data_t *sfx) -{ - FSOUND_SAMPLE *fmsample = NULL; - INT32 chan = -1; - float pos[3]; - float vel[3]; -#ifdef MORESTUFF - src->min_distance = MIN_DISTANCE; - src->max_distance = MAX_DISTANCE; -#endif - - pos[0] = src->pos.x; - pos[1] = src->pos.z; - pos[2] = src->pos.y; - vel[0] = src->pos.momx; - vel[1] = src->pos.momz; - vel[2] = src->pos.momy; - if (sfx) - fmsample = FSOUND_Sample_Load(FSOUND_FREE, INT2CHAR(sfx->data), FSOUND_DOOMLOAD, SFXLENGTH); - else - fmsample = blankfmsample; - - if (fmsample) - { - if (sfx && !FSOUND_Sample_SetDefaults(fmsample, - (INT32)((*((UINT16 *)sfx->data+1))*recalc_pitch(sfx->pitch)), - (sfx->volume == -1 ? 255 : sfx->volume), - (sfx->sep == NORMAL_SEP ? FSOUND_STEREOPAN : sfx->sep), - (sfx->priority) - ) - ) - DBG_Printf("FMOD(Add3DSource, FSOUND_Sample_SetDefaults, SFX's ID# %i): %s\n", sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); -#if 0 - if (!FSOUND_Sample_SetMinMaxDistance(fmsample, src->min_distance, src->max_distance)) - DBG_Printf("FMOD(Add3DSource, FSOUND_Sample_SetMinMaxDistance, SFX's ID# %i): %s\n", sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); -#endif - chan = FSOUND_PlaySoundEx(FSOUND_FREE,fmsample,NULL,true); - - if (chan == -1) - { - DBG_Printf("FMOD(Add3DSource, FSOUND_PlaySoundEx, SFX's ID# %i): %s\n",sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); - return chan; - } - else - { - if (!sfx) - DBG_Printf("FMOD(Add3DSource, Main): Added blank-sound added to channel %i\n",chan); -#ifdef MORESTUFF - else DBG_Printf("FMOD(Add3DSource, Main): Added sfxid# %i added to channel %i\n",sfx->id,chan); -#endif - } - } - else - { - if (sfx) - DBG_Printf("FMOD(Add3DSource, FSOUND_Sample_Load, sfxid# %i): %s\n",sfx->id,FMOD_ErrorString(FSOUND_GetError())); - else - DBG_Printf("FMOD(Add3DSource, FSOUND_Sample_Alloc): %s\n", FMOD_ErrorString(FSOUND_GetError())); - - return chan; - } - - if (FSOUND_GetCurrentSample(chan)) - { - if (!FSOUND_SetCurrentPosition(chan, 0)) - DBG_Printf("FMOD(Add3DSource, FSOUND_SetCurrentPosition, channel %i, sfxid# %i): %s\n", chan,sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_3D_SetAttributes(chan,pos,vel)) - DBG_Printf("FMOD(Add3DSource, FSOUND_3D_SetAttributes, channel %i, sfxid# %i): %s\n", chan,sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_SetReserved(chan, (signed char)src->permanent)) - DBG_Printf("FMOD(Add3DSource, FSOUND_SetReserved, channel %i, sfxid# %i): %s\n", chan,sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); - - if (src->head_relative) reladd(chan); - } - - return chan; -} - -/****************************************************************************** - * - * Creates 2D (stereo) source - * - ******************************************************************************/ -EXPORT INT32 HWRAPI (Add2DSource) (sfx_data_t *sfx) -{ - FSOUND_SAMPLE *fmsample = NULL; - INT32 chan = -1; - - if (!sfx) - return chan; - - fmsample = FSOUND_Sample_Load(FSOUND_FREE, INT2CHAR(sfx->data), FSOUND_DOOMLOAD, SFXLENGTH); - - if (fmsample) - { - if (!FSOUND_Sample_SetDefaults(fmsample, - (INT32)((float)(*((UINT16 *)sfx->data+1)) * recalc_pitch(sfx->pitch)), - sfx->volume == -1 ? 255 : sfx->volume, - sfx->sep == NORMAL_SEP ? FSOUND_STEREOPAN : sfx->sep, - sfx->priority)) - DBG_Printf("FMOD(Add2DSource, FSOUND_Sample_SetDefaults, sfxid# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_Sample_SetMode(fmsample,FSOUND_2D)) - DBG_Printf("FMOD(Add2DSource, FSOUND_Sample_SetMode, sfxid# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - - chan = FSOUND_PlaySoundEx(FSOUND_FREE,fmsample,NULL,true); - - if (chan == -1) - { - DBG_Printf("FMOD(Add2DSource, FSOUND_PlaySoundEx, sfxid# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - return chan; - } -#ifdef MORESTUFF - else DBG_Printf("FMOD(Add2DSource, FSOUND_PlaySoundEx): sfxid# %i is playing on channel %i\n", sfx->id,chan); -#endif - } - else - { - DBG_Printf("FMOD(Add2DSource,FSOUND_Sample_Load, sfxid# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - return chan; - } - - if (FSOUND_GetCurrentSample(chan)) - { - if (!FSOUND_SetCurrentPosition(chan, 0)) - DBG_Printf("FMOD(Add2DSource, FSOUND_SetCurrentPosition, channel %i, sfxid# %i): %s\n", chan,sfx->id,FMOD_ErrorString(FSOUND_GetError())); - } - - return chan; -} - -EXPORT INT32 HWRAPI (StartSource) (INT32 chan) -{ - FSOUND_SAMPLE *fmsample; - if (chan < 0) - return -1; - - fmsample = FSOUND_GetCurrentSample(chan); - - if (!fmsample) - return -1; - -#ifdef MORESTUFF - if (FSOUND_Sample_GetMode(fmsample) & FSOUND_2D) - { - DBG_Printf("FMOD(StartSource,Main): Starting 2D channel %i?\n",chan); - //return -1; - } - else - { - DBG_Printf("FMOD(StartSource,Main): Starting 3D Channel %i?\n",chan); - //return -1; - } -#endif - - if (FSOUND_GetPaused(relcheckup(chan))) - { - if (!FSOUND_SetPaused(relcheckup(chan), false)) - DBG_Printf("FMOD(StartSource,FSOUND_SetPaused, channel %i): %s\n", chan,FMOD_ErrorString(FSOUND_GetError())); - else if (relstack(chan) != -1) - relarray[relstack(chan)].pos.active = false; - } - else - DBG_Printf("FMOD(StartSource,FSOUND_GetPaused): Channel %i is playing already",chan); - - return chan; -} - -EXPORT void HWRAPI (StopSource) (INT32 chan) -{ - FSOUND_SAMPLE *fmsample; - - if (chan < 0) - return; - - fmsample = FSOUND_GetCurrentSample(chan); - - if (!fmsample) - return; - - if (!FSOUND_GetPaused(relcheckup(chan))) - { - if (!FSOUND_SetPaused(relcheckup(chan),true)) - { - DBG_Printf("FMOD(StopSource,FSOUND_SetPaused, channel %i): %s\n", chan,FMOD_ErrorString(FSOUND_GetError())); - } - else if (relstack(chan) != -1) - { - relarray[relstack(chan)].pos.active = false; - } - } -#ifdef MORESTUFF - else - DBG_Printf("FMOD(StopSource,FSOUND_GetPaused): Channel %i is stopped already\n",chan); -#endif -} - -EXPORT INT32 HWRAPI (GetHW3DSVersion) (void) -{ - return VERSION; -} - -EXPORT void HWRAPI (BeginFrameUpdate) (void) -{ - FSOUND_Update(); -} - -EXPORT void HWRAPI (EndFrameUpdate) (void) -{ - relupdate(FSOUND_FREE); -} - -EXPORT INT32 HWRAPI (IsPlaying) (INT32 chan) -{ - if (chan < 0) - return false; - - if (!FSOUND_GetCurrentSample(chan)) - return false; - - return FSOUND_IsPlaying(relcheckup(chan)); -} - -/****************************************************************************** - * UpdateListener - * - * Set up main listener properties: - * - position - * - orientation - * - velocity - *****************************************************************************/ -EXPORT void HWRAPI (UpdateListener) (listener_data_t *data) -{ - if (data) - { - float pos[3]; - float vel[3]; - double f_angle = 0; - if (data->f_angle) f_angle = (data->f_angle) / 180 * M_PI; - pos[0] = (float)data->x; - pos[1] = (float)data->z; - pos[2] = (float)data->y; - vel[0] = (float)data->momx; - vel[1] = (float)data->momz; - vel[2] = (float)data->momy; - - FSOUND_3D_Listener_SetAttributes(pos,vel,(float)cos(f_angle),0.0f,(float)sin(f_angle), 0.0f , 1.0f, 0.0f); - relset(1); - } - else - { - relset(-1); - DBG_Printf("Error: 1st listener data is missing\n"); - } -} - -EXPORT void HWRAPI (UpdateListener2) (listener_data_t *data) -{ - if (data) - { - float pos[3]; - float vel[3]; - double f_angle = 0; - if (data->f_angle) f_angle = (data->f_angle) / 180 * M_PI; - pos[0] = (float)data->x; - pos[1] = (float)data->z; - pos[2] = (float)data->y; - vel[0] = (float)data->momx; - vel[1] = (float)data->momz; - vel[2] = (float)data->momy; - - FSOUND_3D_Listener_SetCurrent(1,2); - FSOUND_3D_Listener_SetAttributes(pos,vel,(float)cos(f_angle),0.0f,(float)sin(f_angle), 0.0f , 1.0f, 0.0f); - relset(2); - FSOUND_3D_Listener_SetCurrent(0,2); - } - else - { - relset(-2); - FSOUND_3D_Listener_SetCurrent(0,1); - } -} - -EXPORT void HWRAPI (UpdateSourceVolume) (INT32 chan, INT32 vol) -{ - if (chan < 0) - return; - - if (!FSOUND_GetCurrentSample(chan)) - return; - - if (!FSOUND_SetVolume(chan,vol)) - DBG_Printf("FMOD(UpdateSourceVolume, FSOUND_SetVolume, channel %i to volume %i): %s\n", chan,vol,FMOD_ErrorString(FSOUND_GetError())); - else - { -#ifdef MORESTUFF - DBG_Printf("FMOD(UpdateSourceVolume, Main): channel %i is set to the volume of %i", chan,vol); -#endif - relvol(chan); - } -} - -/****************************************************************************** - * - * Update volume and separation (panning) of 2D source - * - *****************************************************************************/ -EXPORT void HWRAPI (Update2DSoundParms) (INT32 chan, INT32 vol, INT32 sep) -{ - FSOUND_SAMPLE *fmsample; - - if (chan < 0) - return; - - fmsample = FSOUND_GetCurrentSample(chan); - - if (fmsample) - { - if (!FSOUND_Sample_GetMode(fmsample) & FSOUND_2D) - { - DBG_Printf("FMOD(Update2DSoundParms,Main): 2D Vol/Pan on 3D channel %i?\n",chan); - //return; - } - } - else - return; - - if (!FSOUND_SetPaused(chan, true)) - DBG_Printf("FMOD(Update2DSoundParms, FSOUND_SetPaused, Pause, channel %i): %s\n", chan,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_SetVolume(chan,vol)) - DBG_Printf("FMOD(Update2DSoundParms, , channel %i to volume %i): %s\n", chan,vol,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_SetPan(chan, sep == NORMAL_SEP ? FSOUND_STEREOPAN : sep)) - DBG_Printf("FMOD(Update2DSoundParms, FSOUND_SetPan, channel %i to sep %i): %s\n", chan,sep,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_SetPaused(chan, false)) - DBG_Printf("FMOD(Update2DSoundParms, FSOUND_SetPaused, Resume, channel %i): %s\n", chan,FMOD_ErrorString(FSOUND_GetError())); -} - -// -------------------------------------------------------------------------- -// Set the global volume for sound effects -// -------------------------------------------------------------------------- -EXPORT void HWRAPI (SetGlobalSfxVolume) (INT32 vol) -{ - INT32 realvol = (vol<<3)+(vol>>2); - - FSOUND_SetSFXMasterVolume(realvol); -#ifdef MORESTUFF - DBG_Printf("FMOD(SetGlobalSfxVolume, Main, the volume is set to %i): %s\n", realvol,FMOD_ErrorString(FSOUND_GetError())); -#endif -} - -//Alam_GBC: Not Used? -EXPORT INT32 HWRAPI (SetCone) (INT32 chan, cone_def_t *cone_def) -{ - FSOUND_SAMPLE *fmsample; - - if (chan < 0) - return -1; - - fmsample = FSOUND_GetCurrentSample(chan); - - if (fmsample) - { - if (FSOUND_Sample_GetMode(fmsample) & FSOUND_2D) - { - DBG_Printf("FMOD(Update3DSource,Main): 3D Cone on 2D Channel %i?\n",chan); - return -1; - } - } - - if (cone_def) - { - return -1; - } - else - { - return 1; - } - -} - -EXPORT void HWRAPI (Update3DSource) (INT32 chan, source3D_pos_t *sfx) -{ - float pos[3]; - float vel[3]; - FSOUND_SAMPLE *fmsample; - - pos[0] = sfx->x; - pos[1] = sfx->z; - pos[2] = sfx->y; - vel[0] = sfx->momx; - vel[1] = sfx->momz; - vel[2] = sfx->momy; - if (chan < 0) - return; - - fmsample = FSOUND_GetCurrentSample(chan); - - if (!fmsample) - return; - - if (fmsample) - { - if (FSOUND_Sample_GetMode(fmsample) & FSOUND_2D) - { - //DBG_Printf("FMOD(Update3DSource,Main): 3D Pos/Vel on 2D Channel %i?\n",chan); - //return; - } - } - else - { - return; - } - - if (!FSOUND_3D_SetAttributes(chan,pos,vel)) - DBG_Printf("FMOD(Update3DSource,FSOUND_3D_SetAttributes, onto channel %i): %s\n", chan,FMOD_ErrorString(FSOUND_GetError())); - else - relplace(chan); -} - -//------------------------------------------------------------- -// Load new sound data into source -//------------------------------------------------------------- -EXPORT INT32 HWRAPI (Reload3DSource) (INT32 handle, sfx_data_t *sfx) -{ - source3D_data_t src; - float pos[3], vel[3]; - INT32 chan = relcheckup(handle); - FSOUND_SAMPLE *fmsample; - - if (handle < 0 || !sfx) - return -1; - - fmsample = FSOUND_GetCurrentSample(chan); - - if (!fmsample) - return -1; - - if (FSOUND_Sample_GetMode(fmsample) & FSOUND_2D) - { - DBG_Printf("FMOD(Reload3DSource,Main): New 3D Sound on 2D Channel %i?\n",handle); - return -1; - } -#ifdef MORESTUFF - else - DBG_Printf("FMOD(Reload3DSource, Main, sending new sfx# %i to chan %i)\n",sfx->id,handle); -#endif - -#ifdef OLDFMOD - src.min_distance = MIN_DISTANCE; - src.max_distance = MAX_DISTANCE; -#else - if (!FSOUND_3D_GetMinMaxDistance(handle,&src.min_distance,&src.min_distance)) - DBG_Printf("FMOD(Reload3DSource, FSOUND_3D_GetMinMaxDistance, channel %i, for sfxid# %i): %s\n",handle, sfx->id,FMOD_ErrorString(FSOUND_GetError())); -#endif - src.head_relative = (handle != chan); - src.permanent = FSOUND_GetReserved(handle); - if (!FSOUND_3D_GetAttributes(handle,&pos[0],&vel[0])) - DBG_Printf("FMOD(Reload3DSource, FSOUND_3D_GetAttributes, channel %i, for sfxid# %i): %s\n",handle,sfx->id,FMOD_ErrorString(FSOUND_GetError())); - - //if (handle == chan) - { - if (fmsample != blankfmsample) FSOUND_Sample_Free(fmsample); - } - //else - { - // fmsample = FSOUND_GetCurrentSample(handle); - } - - fmsample = FSOUND_Sample_Load(FSOUND_FREE, INT2CHAR(sfx->data), FSOUND_DOOMLOAD, SFXLENGTH); - - if (!FSOUND_StopSound(chan)) - DBG_Printf("FMOD(Reload3DSource,FSOUND_StopSound, of channel %i for sfxid# %i): %s\n", handle,sfx->id,FMOD_ErrorString(FSOUND_GetError())); - - if (fmsample) - { - if (!FSOUND_Sample_SetDefaults(fmsample, - (INT32)((float)(*((UINT16 *)sfx->data+1)) * recalc_pitch(sfx->pitch)), - sfx->volume == -1 ? 255 : sfx->volume, - sfx->sep == NORMAL_SEP ? FSOUND_STEREOPAN : sfx->sep, - sfx->priority)) - DBG_Printf("FMOD(Reload3DSource, FSOUND_Sample_SetDefaults, for sfxid# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_Sample_SetMinMaxDistance(fmsample, src.min_distance, src.max_distance)) - DBG_Printf("FMOD(Reload3DSource, FSOUND_Sample_SetMinMaxDistance, SFX's ID# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - - chan = FSOUND_PlaySoundEx(chan,fmsample,NULL,true); - - if (chan == -1) - { - DBG_Printf("FMOD(Reload3DSource, FSOUND_PlaySoundEx, for sfxid# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - return chan; - } - - if (FSOUND_GetCurrentSample(chan)) - { - if (!FSOUND_SetCurrentPosition(chan, 0)) - DBG_Printf("FMOD(Reload3DSource, FSOUND_SetCurrentPosition, channel %i, sfxid# %i): %s\n", chan,sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_3D_SetAttributes(chan,pos,vel)) - DBG_Printf("FMOD(Reload3DSource, FSOUND_3D_SetAttributes, channel %i, sfxid# %i): %s\n", chan,sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); - - if (!FSOUND_SetReserved(chan, (signed char)src.permanent)) - DBG_Printf("FMOD(Reload3DSource, FSOUND_SetReserved, channel %i, sfxid# %i): %s\n", chan,sfx?sfx->id:0,FMOD_ErrorString(FSOUND_GetError())); - - if (src.head_relative) relupdate(handle); - } - } - else - DBG_Printf("FMOD(Reload3DSource,FSOUND_Sample_Load, for sfxid# %i): %s\n", sfx->id,FMOD_ErrorString(FSOUND_GetError())); - - return chan; -} - -/****************************************************************************** - * - * Destroy source and remove it from stack if it is a 2D source. - * Otherwise put source into cache - * - *****************************************************************************/ -EXPORT void HWRAPI (KillSource) (INT32 chan) -{ - FSOUND_SAMPLE *fmsample; - INT32 relchan; - - if (chan < 0) - return; - - relchan = relcheckup(chan); - - fmsample = FSOUND_GetCurrentSample(chan); - - if (!fmsample) - return; - -#ifdef MORESTUFF - if (FSOUND_IsPlaying(relchan)) - if (!FSOUND_SetLoopMode(relchan, FSOUND_LOOP_OFF)) - DBG_Printf("FMOD(KillSource,FSOUND_SetLoopMode, for channel %i): %s\n", chan,FMOD_ErrorString(FSOUND_GetError())); //Alam_GBC: looping off - else -#endif - if (!FSOUND_StopSound(relchan)) - { - DBG_Printf("FMOD(KillSource,FSOUND_StopSound, for channel %i): %s\n", chan,FMOD_ErrorString(FSOUND_GetError())); - } -#ifdef MORESTUFF - else DBG_Printf("FMOD(KillSource, Main, for channel %i)\n", chan); -#endif - if (fmsample != blankfmsample) FSOUND_Sample_Free(fmsample); -} - -#ifdef _WINDOWS -BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module - DWORD fdwReason, // reason for calling function - LPVOID lpvReserved) // reserved -{ - // Perform actions based on the reason for calling. - UNREFERENCED_PARAMETER(lpvReserved); - switch (fdwReason) - { - case DLL_PROCESS_ATTACH: - // Initialize once for each new process. - // Return FALSE to fail DLL load. -#ifdef DEBUG_TO_FILE - logstream = fopen("s_fmod.log", "wt"); - if (logstream == NULL) - return FALSE; -#endif - DisableThreadLibraryCalls(hinstDLL); - break; - - case DLL_THREAD_ATTACH: - // Do thread-specific initialization. - break; - - case DLL_THREAD_DETACH: - // Do thread-specific cleanup. - break; - - case DLL_PROCESS_DETACH: - // Perform any necessary cleanup. -#ifdef DEBUG_TO_FILE - if (logstream) - { - fclose(logstream); - logstream = NULL; - } -#endif - break; - } - return TRUE; // Successful DLL_PROCESS_ATTACH. -} -#elif !defined (HAVE_SDL) - -// ************************************************************************** -// FUNCTIONS -// ************************************************************************** - -EXPORT void _init() -{ -#ifdef DEBUG_TO_FILE - logstream = fopen("s_fmod.log","wt"); -#endif -} - -EXPORT void _fini() -{ -#ifdef DEBUG_TO_FILE - if (logstream) - fclose(logstream); -#endif -} -#endif diff --git a/src/hardware/s_fmod/s_fmod.dev b/src/hardware/s_fmod/s_fmod.dev deleted file mode 100644 index 01e21e2b7..000000000 --- a/src/hardware/s_fmod/s_fmod.dev +++ /dev/null @@ -1,59 +0,0 @@ -[Project] -FileName=s_fmod.dev -Name=s_fmod -Ver=1 -IsCpp=1 -Type=3 -Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-Os_@@_-fomit-frame-pointer_@@_ -CppCompiler= -Includes=..\..\win32\FMOD -Linker=--def ../s_mingw.def_@@_-lfmod_@@_ -Libs=..\..\win32\FMOD -UnitCount=1 -Folders= -ObjFiles= -PrivateResource= -ResourceIncludes= -MakeIncludes= -Icon= -ExeOutput=C:\srb2demo2 -ObjectOutput=..\..\..\objs\Mingw\s_fmod -OverrideOutput=1 -OverrideOutputName=s_fmod.dll -HostApplication= -CommandLine= -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=00000000000000000111d0 -UseCustomMakefile=0 -CustomMakefile= - -[Unit1] -FileName=s_fmod.c -Folder= -Compile=1 -CompileCpp=0 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=1 -Minor=0 -Release=8 -Build=42 -LanguageID=1033 -CharsetID=1252 -CompanyName=Alam Arias -FileVersion=1.42 -FileDescription=SRB2 Sound API DLL for FMOD -InternalName=Super FMOD! -LegalCopyright= -LegalTrademarks= -OriginalFilename=s_fmod.dll -ProductName=s_fmod -ProductVersion=0.1 -AutoIncBuildNr=0 - diff --git a/src/hardware/s_fmod/s_fmod.dsp b/src/hardware/s_fmod/s_fmod.dsp deleted file mode 100644 index c9a1fb743..000000000 --- a/src/hardware/s_fmod/s_fmod.dsp +++ /dev/null @@ -1,97 +0,0 @@ -# Microsoft Developer Studio Project File - Name="s_fmod" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=s_fmod - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "s_fmod.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "s_fmod.mak" CFG="s_fmod - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "s_fmod - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "s_fmod - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "s_fmod - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\bin\VC\Release\s_fmod" -# PROP Intermediate_Dir "..\..\..\objs\VC\Release\s_fmod" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_FMOD_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 fmodvc.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\s_fmod.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\s_fmod.dll" - -!ELSEIF "$(CFG)" == "s_fmod - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\bin\VC\Debug\s_fmod" -# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\s_fmod" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_FMOD_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 fmodvc.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\s_fmod.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\s_fmod.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "s_fmod - Win32 Release" -# Name "s_fmod - Win32 Debug" -# Begin Source File - -SOURCE=.\s_fmod.c -# End Source File -# End Target -# End Project diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg index 05b60f7a3..92070a9df 100644 --- a/src/sdl/Makefile.cfg +++ b/src/sdl/Makefile.cfg @@ -59,11 +59,6 @@ ifdef OPENAL OPTS+=-DSTATIC3DS STATICHS=1 else -ifdef FMOD - OBJS+=$(OBJDIR)/s_fmod.o - OPTS+=-DSTATIC3DS - STATICHS=1 -else ifdef MINGW ifdef DS3D OBJS+=$(OBJDIR)/s_ds3d.o @@ -73,7 +68,6 @@ endif endif endif endif -endif ifdef NOMIXER i_sound_o=$(OBJDIR)/sdl_sound.o diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index b8991293c..37c502e3f 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1238,23 +1238,13 @@ void I_StartupSound(void) hws_mode = HWS_DS3D; sdrv_name = "s_ds3d.dll"; } - else if (M_CheckParm("-fmod3d")) - { - hws_mode = HWS_FMOD3D; - sdrv_name = "s_fmod.dll"; - } else if (M_CheckParm("-openal")) { hws_mode = HWS_OPENAL; sdrv_name = "s_openal.dll"; } #else - if (M_CheckParm("-fmod3d")) - { - hws_mode = HWS_FMOD3D; - sdrv_name = "./s_fmod.so"; - } - else if (M_CheckParm("-openal")) + if (M_CheckParm("-openal")) { hws_mode = HWS_OPENAL; sdrv_name = "./s_openal.so"; diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj index 387d65da9..043ae57c9 100644 --- a/src/win32/Srb2win-vc10.vcxproj +++ b/src/win32/Srb2win-vc10.vcxproj @@ -88,7 +88,6 @@ -