diff options
author | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-26 07:46:21 +0000 |
---|---|---|
committer | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-26 07:46:21 +0000 |
commit | 441c7633e0aa67faa91dc5896ee83e6c29de0ba6 (patch) | |
tree | ed6f97f0be5940123e9e3f244ae91a475787ff64 /code/client | |
parent | b0c6a473e2a34000db73c75bc0ff43bba45fddb2 (diff) | |
download | ioquake3-aero-441c7633e0aa67faa91dc5896ee83e6c29de0ba6.tar.gz ioquake3-aero-441c7633e0aa67faa91dc5896ee83e6c29de0ba6.zip |
Mac OS X work...lots of little changes that touch a lot of random places.
Still work to be done, but this at least matches the PowerPC Linux status
now.
MacOS-specific directory (and XCode project) is gone...this now uses SDL,
OpenAL, and the Unix Makefiles.
--ryan.
git-svn-id: svn://svn.icculus.org/quake3/trunk@373 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client')
-rw-r--r-- | code/client/qal.c | 13 | ||||
-rw-r--r-- | code/client/qal.h | 4 | ||||
-rw-r--r-- | code/client/snd_codec_wav.c | 2 | ||||
-rw-r--r-- | code/client/snd_mix.c | 88 |
4 files changed, 91 insertions, 16 deletions
diff --git a/code/client/qal.c b/code/client/qal.c index 7594185..e7513dc 100644 --- a/code/client/qal.c +++ b/code/client/qal.c @@ -28,14 +28,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "qal.h" #if USE_OPENAL_DLOPEN -#if defined _WIN32 + +#if USE_SDL_VIDEO +#include "SDL.h" +#include "SDL_loadso.h" +#define OBJTYPE void * +#define OBJLOAD(x) SDL_LoadObject(x) +#define SYMLOAD(x,y) SDL_LoadFunction(x,y) +#define OBJFREE(x) SDL_UnloadObject(x) + +#elif defined _WIN32 #include <windows.h> #define OBJTYPE HMODULE #define OBJLOAD(x) LoadLibrary(x) #define SYMLOAD(x,y) GetProcAddress(x,y) #define OBJFREE(x) FreeLibrary(x) -#elif defined __linux__ || defined __FreeBSD__ +#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X #include <unistd.h> #include <sys/types.h> #include <dlfcn.h> diff --git a/code/client/qal.h b/code/client/qal.h index 1d71179..a84639a 100644 --- a/code/client/qal.h +++ b/code/client/qal.h @@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define AL_NO_PROTOTYPES #define ALC_NO_PROTOTYPES #endif -#include <AL/al.h> -#include <AL/alc.h> +#include "../AL/al.h" +#include "../AL/alc.h" #if USE_OPENAL_DLOPEN extern LPALENABLE qalEnable; diff --git a/code/client/snd_codec_wav.c b/code/client/snd_codec_wav.c index 5a808d8..e790cea 100644 --- a/code/client/snd_codec_wav.c +++ b/code/client/snd_codec_wav.c @@ -42,7 +42,7 @@ static int FGetLittleLong( fileHandle_t f ) { FGetLittleShort ================= */ -static int FGetLittleShort( fileHandle_t f ) { +static short FGetLittleShort( fileHandle_t f ) { short v; FS_Read( &v, sizeof(v), f ); diff --git a/code/client/snd_mix.c b/code/client/snd_mix.c index 21adf90..0538973 100644 --- a/code/client/snd_mix.c +++ b/code/client/snd_mix.c @@ -224,7 +224,8 @@ CHANNEL MIXING =============================================================================== */ -static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { +#if idppc_altivec +static void S_PaintChannelFrom16_altivec( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data, aoff, boff; int leftvol, rightvol; int i, j; @@ -249,15 +250,12 @@ static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int } if (!ch->doppler || ch->dopplerScale==1.0f) { -#if idppc_altivec vector signed short volume_vec; vector unsigned int volume_shift; int vectorCount, samplesLeft, chunkSamplesLeft; -#endif leftvol = ch->leftvol*snd_vol; rightvol = ch->rightvol*snd_vol; samples = chunk->sndChunk; -#if idppc_altivec ((short *)&volume_vec)[0] = leftvol; ((short *)&volume_vec)[1] = leftvol; ((short *)&volume_vec)[4] = leftvol; @@ -297,14 +295,12 @@ static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int { vector unsigned char tmp; vector short s0, s1, sampleData0, sampleData1; - vector short samples0, samples1; - vector signed int left0, right0; vector signed int merge0, merge1; vector signed int d0, d1, d2, d3; - vector unsigned char samplePermute0 = - (vector unsigned char){0, 1, 4, 5, 0, 1, 4, 5, 2, 3, 6, 7, 2, 3, 6, 7}; + vector unsigned char samplePermute0 = + VECCONST_UINT8(0, 1, 4, 5, 0, 1, 4, 5, 2, 3, 6, 7, 2, 3, 6, 7); vector unsigned char samplePermute1 = - (vector unsigned char){8, 9, 12, 13, 8, 9, 12, 13, 10, 11, 14, 15, 10, 11, 14, 15}; + VECCONST_UINT8(8, 9, 12, 13, 8, 9, 12, 13, 10, 11, 14, 15, 10, 11, 14, 15); vector unsigned char loadPermute0, loadPermute1; // Rather than permute the vectors after we load them to do the sample @@ -365,7 +361,66 @@ static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int } } } -#else + } else { + fleftvol = ch->leftvol*snd_vol; + frightvol = ch->rightvol*snd_vol; + + ooff = sampleOffset; + samples = chunk->sndChunk; + + for ( i=0 ; i<count ; i++ ) { + + aoff = ooff; + ooff = ooff + ch->dopplerScale; + boff = ooff; + fdata = 0; + for (j=aoff; j<boff; j++) { + if (j == SND_CHUNK_SIZE) { + chunk = chunk->next; + if (!chunk) { + chunk = sc->soundData; + } + samples = chunk->sndChunk; + ooff -= SND_CHUNK_SIZE; + } + fdata += samples[j&(SND_CHUNK_SIZE-1)]; + } + fdiv = 256 * (boff-aoff); + samp[i].left += (fdata * fleftvol)/fdiv; + samp[i].right += (fdata * frightvol)/fdiv; + } + } +} +#endif + +static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { + int data, aoff, boff; + int leftvol, rightvol; + int i, j; + portable_samplepair_t *samp; + sndBuffer *chunk; + short *samples; + float ooff, fdata, fdiv, fleftvol, frightvol; + + samp = &paintbuffer[ bufferOffset ]; + + if (ch->doppler) { + sampleOffset = sampleOffset*ch->oldDopplerScale; + } + + chunk = sc->soundData; + while (sampleOffset>=SND_CHUNK_SIZE) { + chunk = chunk->next; + sampleOffset -= SND_CHUNK_SIZE; + if (!chunk) { + chunk = sc->soundData; + } + } + + if (!ch->doppler || ch->dopplerScale==1.0f) { + leftvol = ch->leftvol*snd_vol; + rightvol = ch->rightvol*snd_vol; + samples = chunk->sndChunk; for ( i=0 ; i<count ; i++ ) { data = samples[sampleOffset++]; samp[i].left += (data * leftvol)>>8; @@ -377,7 +432,6 @@ static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int sampleOffset = 0; } } -#endif } else { fleftvol = ch->leftvol*snd_vol; frightvol = ch->rightvol*snd_vol; @@ -412,6 +466,18 @@ static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int } } +static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { + #if idppc_altivec + extern cvar_t *com_altivec; + if (com_altivec->integer) { + // must be in a seperate function or G3 systems will crash. + S_PaintChannelFrom16_altivec( ch, sc, count, sampleOffset, bufferOffset ); + return; + } + #endif + S_PaintChannelFrom16_scalar( ch, sc, count, sampleOffset, bufferOffset ); +} + void S_PaintChannelFromWavelet( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) { int data; int leftvol, rightvol; |