Mercurial > sdl-ios-xcode
comparison src/audio/SDL_mixer.c @ 633:873c2598f969
Add m68k assembly mixing routines
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Tue, 03 Jun 2003 19:35:10 +0000 |
parents | 64fe373be3dc |
children | 22dbf364c017 |
comparison
equal
deleted
inserted
replaced
632:85e104fe14c2 | 633:873c2598f969 |
---|---|
35 #include "SDL_mutex.h" | 35 #include "SDL_mutex.h" |
36 #include "SDL_timer.h" | 36 #include "SDL_timer.h" |
37 #include "SDL_sysaudio.h" | 37 #include "SDL_sysaudio.h" |
38 #include "SDL_mixer_MMX.h" | 38 #include "SDL_mixer_MMX.h" |
39 #include "SDL_mixer_MMX_VC.h" | 39 #include "SDL_mixer_MMX_VC.h" |
40 #include "SDL_mixer_m68k.h" | |
40 | 41 |
41 /* Function to check the CPU flags */ | 42 /* Function to check the CPU flags */ |
42 #define MMX_CPU 0x800000 | 43 #define MMX_CPU 0x800000 |
43 #ifdef USE_ASMBLIT | 44 #ifdef USE_ASMBLIT |
44 #define CPU_Flags() Hermes_X86_CPU() | 45 #define CPU_Flags() Hermes_X86_CPU() |
133 format = AUDIO_S16; | 134 format = AUDIO_S16; |
134 } | 135 } |
135 switch (format) { | 136 switch (format) { |
136 | 137 |
137 case AUDIO_U8: { | 138 case AUDIO_U8: { |
139 #if defined(__M68000__) && defined(__GNUC__) | |
140 SDL_MixAudio_m68k_U8((char*)dst,(char*)src,(unsigned long)len,(long)volume,(char *)mix8); | |
141 #else | |
138 Uint8 src_sample; | 142 Uint8 src_sample; |
139 | 143 |
140 while ( len-- ) { | 144 while ( len-- ) { |
141 src_sample = *src; | 145 src_sample = *src; |
142 ADJUST_VOLUME_U8(src_sample, volume); | 146 ADJUST_VOLUME_U8(src_sample, volume); |
143 *dst = mix8[*dst+src_sample]; | 147 *dst = mix8[*dst+src_sample]; |
144 ++dst; | 148 ++dst; |
145 ++src; | 149 ++src; |
146 } | 150 } |
151 #endif | |
147 } | 152 } |
148 break; | 153 break; |
149 | 154 |
150 case AUDIO_S8: { | 155 case AUDIO_S8: { |
151 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) | 156 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) |
160 { | 165 { |
161 SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); | 166 SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); |
162 } | 167 } |
163 else | 168 else |
164 #endif | 169 #endif |
170 #if defined(__M68000__) && defined(__GNUC__) | |
171 SDL_MixAudio_m68k_S8((char*)dst,(char*)src,(unsigned long)len,(long)volume); | |
172 #else | |
165 { | 173 { |
166 Sint8 *dst8, *src8; | 174 Sint8 *dst8, *src8; |
167 Sint8 src_sample; | 175 Sint8 src_sample; |
168 int dst_sample; | 176 int dst_sample; |
169 const int max_audioval = ((1<<(8-1))-1); | 177 const int max_audioval = ((1<<(8-1))-1); |
185 } | 193 } |
186 ++dst8; | 194 ++dst8; |
187 ++src8; | 195 ++src8; |
188 } | 196 } |
189 } | 197 } |
198 #endif | |
190 } | 199 } |
191 break; | 200 break; |
192 | 201 |
193 case AUDIO_S16LSB: { | 202 case AUDIO_S16LSB: { |
194 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) | 203 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) |
202 { | 211 { |
203 SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); | 212 SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); |
204 } | 213 } |
205 else | 214 else |
206 #endif | 215 #endif |
216 #if defined(__M68000__) && defined(__GNUC__) | |
217 SDL_MixAudio_m68k_S16LSB((short*)dst,(short*)src,(unsigned long)len,(long)volume); | |
218 #else | |
207 { | 219 { |
208 Sint16 src1, src2; | 220 Sint16 src1, src2; |
209 int dst_sample; | 221 int dst_sample; |
210 const int max_audioval = ((1<<(16-1))-1); | 222 const int max_audioval = ((1<<(16-1))-1); |
211 const int min_audioval = -(1<<(16-1)); | 223 const int min_audioval = -(1<<(16-1)); |
227 dst_sample >>= 8; | 239 dst_sample >>= 8; |
228 dst[1] = dst_sample&0xFF; | 240 dst[1] = dst_sample&0xFF; |
229 dst += 2; | 241 dst += 2; |
230 } | 242 } |
231 } | 243 } |
244 #endif | |
232 } | 245 } |
233 break; | 246 break; |
234 | 247 |
235 case AUDIO_S16MSB: { | 248 case AUDIO_S16MSB: { |
249 #if defined(__M68000__) && defined(__GNUC__) | |
250 SDL_MixAudio_m68k_S16MSB((short*)dst,(short*)src,(unsigned long)len,(long)volume); | |
251 #else | |
236 Sint16 src1, src2; | 252 Sint16 src1, src2; |
237 int dst_sample; | 253 int dst_sample; |
238 const int max_audioval = ((1<<(16-1))-1); | 254 const int max_audioval = ((1<<(16-1))-1); |
239 const int min_audioval = -(1<<(16-1)); | 255 const int min_audioval = -(1<<(16-1)); |
240 | 256 |
254 dst[1] = dst_sample&0xFF; | 270 dst[1] = dst_sample&0xFF; |
255 dst_sample >>= 8; | 271 dst_sample >>= 8; |
256 dst[0] = dst_sample&0xFF; | 272 dst[0] = dst_sample&0xFF; |
257 dst += 2; | 273 dst += 2; |
258 } | 274 } |
275 #endif | |
259 } | 276 } |
260 break; | 277 break; |
261 | 278 |
262 default: /* If this happens... FIXME! */ | 279 default: /* If this happens... FIXME! */ |
263 SDL_SetError("SDL_MixAudio(): unknown audio format"); | 280 SDL_SetError("SDL_MixAudio(): unknown audio format"); |