mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Patch adding Wii support by tueidj, part 10: sound and endianness changes
This part is a mixture of the original patch and my changes. It seems like tueidj had some trouble 1) getting OGG to work, which is why it's conditionally compiled out 2) struggling with endianness with the mixing routines? This may be also due to him missing to define two others BIGENDIAN macros (our code is in need of cleanup there). Note the change in jaudiolib/src/mix.c! Because I added my share to this part, I might have actually broken sound mixing on big-endian platforms. git-svn-id: https://svn.eduke32.com/eduke32@2630 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
410ffae3ab
commit
68e6141c32
7 changed files with 34 additions and 21 deletions
|
@ -146,6 +146,11 @@ static inline float nearbyintf(float x)
|
|||
# endif
|
||||
# define B_ENDIAN_C_INLINE 1
|
||||
|
||||
#elif defined(GEKKO)
|
||||
# define B_LITTLE_ENDIAN 0
|
||||
# define B_BIG_ENDIAN 1
|
||||
# define B_ENDIAN_C_INLINE 1
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
|
|
|
@ -38,7 +38,7 @@ credits.
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__POWERPC__)
|
||||
#if defined(__POWERPC__) || defined(GEKKO)
|
||||
#define BIGENDIAN 1
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//--------------------------------------------------------------------------------------------------
|
||||
#include "compat.h"
|
||||
#if defined(__POWERPC__)
|
||||
#if defined(__POWERPC__) || defined(GEKKO)
|
||||
static uint32_t LSWAPIB(uint32_t a) { return(((a>>8)&0xff00)+((a&0xff00)<<8)+(a<<24)+(a>>24)); }
|
||||
static uint16_t SSWAPIB(uint16_t a) { return((a>>8)+(a<<8)); }
|
||||
#else
|
||||
|
|
|
@ -310,7 +310,7 @@ extern const int16_t *MV_RightVolume;
|
|||
extern int32_t MV_SampleSize;
|
||||
extern int32_t MV_RightChannelOffset;
|
||||
|
||||
#ifdef __POWERPC__
|
||||
#if defined __POWERPC__ || defined GEKKO
|
||||
# define BIGENDIAN
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "multivoc.h"
|
||||
#include "fx_man.h"
|
||||
|
||||
#ifdef __POWERPC__
|
||||
#if defined __POWERPC__ || defined GEKKO
|
||||
#define LITTLE16(s) (((uint16_t)(s) >> 8) | ((uint16_t)(s) << 8))
|
||||
#define LITTLE32(s) ((uint32_t)(s) >> 24) | ((uint32_t)(s) << 24) | (((uint32_t)(s)&0xff00) << 8) | (((uint32_t)(s) & 0xff0000) >> 8)
|
||||
#else
|
||||
|
@ -930,7 +930,7 @@ int32_t FX_PlayAuto(char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol
|
|||
{
|
||||
int32_t handle = -1;
|
||||
|
||||
switch (*(int32_t *)ptr)
|
||||
switch (LITTLE32(*(int32_t *)ptr))
|
||||
{
|
||||
case 'C'+('r'<<8)+('e'<<16)+('a'<<24):
|
||||
handle = MV_PlayVOC(ptr, length, pitchoffset, vol, left, right, priority, callbackval);
|
||||
|
@ -939,10 +939,12 @@ int32_t FX_PlayAuto(char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol
|
|||
handle = MV_PlayWAV(ptr, length, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
case 'O'+('g'<<8)+('g'<<16)+('S'<<24):
|
||||
#ifndef GEKKO
|
||||
handle = MV_PlayVorbis(ptr, length, pitchoffset, vol, left, right, priority, callbackval);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
switch (*(int32_t *)(ptr + 8))
|
||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
||||
{
|
||||
case 'W'+('A'<<8)+('V'<<16)+('E'<<24):
|
||||
handle = MV_PlayWAV(ptr, length, pitchoffset, vol, left, right, priority, callbackval);
|
||||
|
@ -985,21 +987,23 @@ int32_t FX_PlayLoopedAuto(char *ptr, uint32_t length, int32_t loopstart, int32_t
|
|||
printf("FX_PlayLoopedAuto %s\n",(char *)fmtstr);
|
||||
}
|
||||
#endif
|
||||
switch (*(int32_t *)ptr)
|
||||
switch (LITTLE32(*(int32_t *)ptr))
|
||||
{
|
||||
case LITTLE32('C'+('r'<<8)+('e'<<16)+('a'<<24)):
|
||||
case 'C'+('r'<<8)+('e'<<16)+('a'<<24):
|
||||
handle = MV_PlayLoopedVOC(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
case LITTLE32('R'+('I'<<8)+('F'<<16)+('F'<<24)):
|
||||
case 'R'+('I'<<8)+('F'<<16)+('F'<<24):
|
||||
handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
case LITTLE32('O'+('g'<<8)+('g'<<16)+('S'<<24)):
|
||||
case 'O'+('g'<<8)+('g'<<16)+('S'<<24):
|
||||
#ifndef GEKKO
|
||||
handle = MV_PlayLoopedVorbis(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
switch (*(int32_t *)(ptr + 8))
|
||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
||||
{
|
||||
case LITTLE32('W'+('A'<<8)+('V'<<16)+('E'<<24)):
|
||||
case 'W'+('A'<<8)+('V'<<16)+('E'<<24):
|
||||
handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
||||
break;
|
||||
}
|
||||
|
@ -1026,21 +1030,23 @@ int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t pitchoffset, int32_t a
|
|||
{
|
||||
int32_t handle = -1;
|
||||
|
||||
switch (*(int32_t *)ptr)
|
||||
switch (LITTLE32(*(int32_t *)ptr))
|
||||
{
|
||||
case LITTLE32('C'+('r'<<8)+('e'<<16)+('a'<<24)): // Crea
|
||||
case 'C'+('r'<<8)+('e'<<16)+('a'<<24): // Crea
|
||||
handle = MV_PlayVOC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
|
||||
break;
|
||||
case LITTLE32('R'+('I'<<8)+('F'<<16)+('F'<<24)): // RIFF
|
||||
case 'R'+('I'<<8)+('F'<<16)+('F'<<24): // RIFF
|
||||
handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
|
||||
break;
|
||||
case LITTLE32('O'+('g'<<8)+('g'<<16)+('S'<<24)): // OggS
|
||||
case 'O'+('g'<<8)+('g'<<16)+('S'<<24): // OggS
|
||||
#ifndef GEKKO
|
||||
handle = MV_PlayVorbis3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
switch (*(int32_t *)(ptr + 8))
|
||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
||||
{
|
||||
case LITTLE32('W'+('A'<<8)+('V'<<16)+('E'<<24)): // WAVE
|
||||
case 'W'+('A'<<8)+('V'<<16)+('E'<<24): // WAVE
|
||||
handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ void MV_16BitReverb( char *src, char *dest, VOLUME16 *volume, int32_t count )
|
|||
|
||||
do {
|
||||
sample0 = *input;
|
||||
#ifdef BIGENDIAN
|
||||
#if 0 //def BIGENDIAN
|
||||
sample0l = sample0 >> 8;
|
||||
sample0h = (sample0 & 255) ^ 128;
|
||||
#else
|
||||
|
|
|
@ -334,8 +334,10 @@ static void MV_StopVoice(VoiceNode *voice)
|
|||
|
||||
RestoreInterrupts();
|
||||
|
||||
#ifndef GEKKO
|
||||
if (voice->wavetype == Vorbis)
|
||||
MV_ReleaseVorbisVoice(voice);
|
||||
#endif
|
||||
|
||||
voice->handle = 0;
|
||||
}
|
||||
|
@ -456,10 +458,10 @@ static void MV_ServiceVoc(void)
|
|||
//MV_StopVoice( voice );
|
||||
LL_Remove(voice, next, prev);
|
||||
LL_Add((VoiceNode*) &VoicePool, voice, next, prev);
|
||||
|
||||
#ifndef GEKKO
|
||||
if (voice->wavetype == Vorbis)
|
||||
MV_ReleaseVorbisVoice(voice);
|
||||
|
||||
#endif
|
||||
voice->handle = 0;
|
||||
|
||||
if (MV_CallBackFunc)
|
||||
|
|
Loading…
Reference in a new issue