comparison src/audio/SDL_mixer.c @ 739:22dbf364c017

Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
author Sam Lantinga <slouken@libsdl.org>
date Tue, 18 Nov 2003 01:27:06 +0000
parents 873c2598f969
children 72ef7ce609ef
comparison
equal deleted inserted replaced
738:82b85b731fe3 739:22dbf364c017
32 #include <string.h> 32 #include <string.h>
33 33
34 #include "SDL_audio.h" 34 #include "SDL_audio.h"
35 #include "SDL_mutex.h" 35 #include "SDL_mutex.h"
36 #include "SDL_timer.h" 36 #include "SDL_timer.h"
37 #include "SDL_cpuinfo.h"
37 #include "SDL_sysaudio.h" 38 #include "SDL_sysaudio.h"
39 #include "SDL_cpuinfo.h"
38 #include "SDL_mixer_MMX.h" 40 #include "SDL_mixer_MMX.h"
39 #include "SDL_mixer_MMX_VC.h" 41 #include "SDL_mixer_MMX_VC.h"
40 #include "SDL_mixer_m68k.h" 42 #include "SDL_mixer_m68k.h"
41
42 /* Function to check the CPU flags */
43 #define MMX_CPU 0x800000
44 #ifdef USE_ASMBLIT
45 #define CPU_Flags() Hermes_X86_CPU()
46 #else
47 #define CPU_Flags() 0L
48 #endif
49
50 #ifdef USE_ASMBLIT
51 #define X86_ASSEMBLER
52 #define HermesConverterInterface void
53 #define HermesClearInterface void
54 #define STACKCALL
55
56 #include "HeadX86.h"
57 #endif
58 43
59 /* This table is used to add two sound values together and pin 44 /* This table is used to add two sound values together and pin
60 * the value to avoid overflow. (used with permission from ARDI) 45 * the value to avoid overflow. (used with permission from ARDI)
61 * Changed to use 0xFE instead of 0xFF for better sound quality. 46 * Changed to use 0xFE instead of 0xFF for better sound quality.
62 */ 47 */
152 } 137 }
153 break; 138 break;
154 139
155 case AUDIO_S8: { 140 case AUDIO_S8: {
156 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) 141 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
157 if (CPU_Flags() & MMX_CPU) 142 if (SDL_HasMMX())
158 { 143 {
159 SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume); 144 SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
160 } 145 }
161 else 146 else
162 #endif 147 #endif
199 } 184 }
200 break; 185 break;
201 186
202 case AUDIO_S16LSB: { 187 case AUDIO_S16LSB: {
203 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) 188 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
204 if (CPU_Flags() & MMX_CPU) 189 if (SDL_HasMMX())
205 { 190 {
206 SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume); 191 SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
207 } 192 }
208 else 193 else
209 #elif defined(USE_ASM_MIXER_VC) 194 #elif defined(USE_ASM_MIXER_VC)