src/audio/SDL_mixer.c
changeset 1402 d910939febfa
parent 1358 c71e05b4dc2e
child 1442 e3242177fe4a
equal deleted inserted replaced
1401:1819fd069e89 1402:d910939febfa
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    18 
    19     Sam Lantinga
    19     Sam Lantinga
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
       
    22 #include "SDL_config.h"
    22 
    23 
    23 /* This provides the default mixing callback for the SDL audio routines */
    24 /* This provides the default mixing callback for the SDL audio routines */
    24 
    25 
    25 #include "SDL_cpuinfo.h"
    26 #include "SDL_cpuinfo.h"
    26 #include "SDL_timer.h"
    27 #include "SDL_timer.h"
   108 		format = AUDIO_S16;
   109 		format = AUDIO_S16;
   109 	}
   110 	}
   110 	switch (format) {
   111 	switch (format) {
   111 
   112 
   112 		case AUDIO_U8: {
   113 		case AUDIO_U8: {
   113 #if defined(__M68000__) && defined(__GNUC__)
   114 #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   114 			SDL_MixAudio_m68k_U8((char*)dst,(char*)src,(unsigned long)len,(long)volume,(char *)mix8);
   115 			SDL_MixAudio_m68k_U8((char*)dst,(char*)src,(unsigned long)len,(long)volume,(char *)mix8);
   115 #else
   116 #else
   116 			Uint8 src_sample;
   117 			Uint8 src_sample;
   117 
   118 
   118 			while ( len-- ) {
   119 			while ( len-- ) {
   125 #endif
   126 #endif
   126 		}
   127 		}
   127 		break;
   128 		break;
   128 
   129 
   129 		case AUDIO_S8: {
   130 		case AUDIO_S8: {
   130 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
   131 #if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
   131 			if (SDL_HasMMX())
   132 			if (SDL_HasMMX())
   132 			{
   133 			{
   133 				SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   134 				SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   134 			}
   135 			}
   135 			else
   136 			else
   136 #endif
   137 #endif
   137 #if defined(USE_ASM_MIXER_VC)
   138 #if defined(_MSC_VER) && defined(M_I86) && defined(SDL_ASSEMBLY_ROUTINES)
   138 			if (SDL_HasMMX())
   139 			if (SDL_HasMMX())
   139 			{
   140 			{
   140 				SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   141 				SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   141 			}
   142 			}
   142 			else
   143 			else
   143 #endif
   144 #endif
   144 #if defined(__M68000__) && defined(__GNUC__)
   145 #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   145 			SDL_MixAudio_m68k_S8((char*)dst,(char*)src,(unsigned long)len,(long)volume);
   146 			SDL_MixAudio_m68k_S8((char*)dst,(char*)src,(unsigned long)len,(long)volume);
   146 #else
   147 #else
   147 			{
   148 			{
   148 			Sint8 *dst8, *src8;
   149 			Sint8 *dst8, *src8;
   149 			Sint8 src_sample;
   150 			Sint8 src_sample;
   172 #endif
   173 #endif
   173 		}
   174 		}
   174 		break;
   175 		break;
   175 
   176 
   176 		case AUDIO_S16LSB: {
   177 		case AUDIO_S16LSB: {
   177 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
   178 #if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
   178 			if (SDL_HasMMX())
   179 			if (SDL_HasMMX())
   179 			{
   180 			{
   180 				SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   181 				SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   181 			}
   182 			}
   182 			else
   183 			else
   185 			{
   186 			{
   186 				SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   187 				SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
   187 			}
   188 			}
   188 			else
   189 			else
   189 #endif
   190 #endif
   190 #if defined(__M68000__) && defined(__GNUC__)
   191 #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   191 			SDL_MixAudio_m68k_S16LSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
   192 			SDL_MixAudio_m68k_S16LSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
   192 #else
   193 #else
   193 			{
   194 			{
   194 			Sint16 src1, src2;
   195 			Sint16 src1, src2;
   195 			int dst_sample;
   196 			int dst_sample;
   218 #endif
   219 #endif
   219 		}
   220 		}
   220 		break;
   221 		break;
   221 
   222 
   222 		case AUDIO_S16MSB: {
   223 		case AUDIO_S16MSB: {
   223 #if defined(__M68000__) && defined(__GNUC__)
   224 #if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
   224 			SDL_MixAudio_m68k_S16MSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
   225 			SDL_MixAudio_m68k_S16MSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
   225 #else
   226 #else
   226 			Sint16 src1, src2;
   227 			Sint16 src1, src2;
   227 			int dst_sample;
   228 			int dst_sample;
   228 			const int max_audioval = ((1<<(16-1))-1);
   229 			const int max_audioval = ((1<<(16-1))-1);