src/audio/SDL_mixer.c
changeset 539 a9e38f3b8e4d
parent 297 f6ffac90895c
child 574 64fe373be3dc
     1.1 --- a/src/audio/SDL_mixer.c	Sat Nov 09 05:52:49 2002 +0000
     1.2 +++ b/src/audio/SDL_mixer.c	Sat Nov 09 06:13:28 2002 +0000
     1.3 @@ -35,7 +35,24 @@
     1.4  #include "SDL_mutex.h"
     1.5  #include "SDL_timer.h"
     1.6  #include "SDL_sysaudio.h"
     1.7 +#include "SDL_mixer_MMX.h"
     1.8  
     1.9 +/* Function to check the CPU flags */
    1.10 +#define MMX_CPU		0x800000
    1.11 +#ifdef USE_ASMBLIT
    1.12 +#define CPU_Flags()	Hermes_X86_CPU()
    1.13 +#else
    1.14 +#define CPU_Flags()	0L
    1.15 +#endif
    1.16 +
    1.17 +#ifdef USE_ASMBLIT
    1.18 +#define X86_ASSEMBLER
    1.19 +#define HermesConverterInterface	void
    1.20 +#define HermesClearInterface		void
    1.21 +#define STACKCALL
    1.22 +
    1.23 +#include "HeadX86.h"
    1.24 +#endif
    1.25  
    1.26  /* This table is used to add two sound values together and pin
    1.27   * the value to avoid overflow.  (used with permission from ARDI)
    1.28 @@ -130,6 +147,15 @@
    1.29  		break;
    1.30  
    1.31  		case AUDIO_S8: {
    1.32 +
    1.33 +#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
    1.34 +			if (CPU_Flags() & MMX_CPU)
    1.35 +			{
    1.36 +				SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
    1.37 +			}
    1.38 +			else
    1.39 +#endif
    1.40 +			{
    1.41  			Sint8 *dst8, *src8;
    1.42  			Sint8 src_sample;
    1.43  			int dst_sample;
    1.44 @@ -153,10 +179,19 @@
    1.45  				++dst8;
    1.46  				++src8;
    1.47  			}
    1.48 +			}
    1.49  		}
    1.50  		break;
    1.51  
    1.52  		case AUDIO_S16LSB: {
    1.53 +#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
    1.54 +			if (CPU_Flags() & MMX_CPU)
    1.55 +			{
    1.56 +				SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
    1.57 +			}
    1.58 +			else
    1.59 +#endif
    1.60 +			{
    1.61  			Sint16 src1, src2;
    1.62  			int dst_sample;
    1.63  			const int max_audioval = ((1<<(16-1))-1);
    1.64 @@ -180,6 +215,7 @@
    1.65  				dst[1] = dst_sample&0xFF;
    1.66  				dst += 2;
    1.67  			}
    1.68 +			}
    1.69  		}
    1.70  		break;
    1.71