From d8efb80536c77ef0d4598b5c036e5e7a5f9ceea2 Mon Sep 17 00:00:00 2001
From: pelya
Date: Thu, 20 May 2010 14:39:14 +0300
Subject: [PATCH] Moved to SDL 1.3, it compiles but DOES NOT WORK, audio is
disabled
---
.../project/jni/application/src/settings.cpp | 4 +-
alienblaster/project/jni/sdl/Android.mk | 24 +-
alienblaster/project/jni/sdl/Borland.html | 139 -
alienblaster/project/jni/sdl/CREDITS | 73 +-
alienblaster/project/jni/sdl/INSTALL | 4 +
alienblaster/project/jni/sdl/Makefile.dc | 111 -
alienblaster/project/jni/sdl/Makefile.in | 183 -
alienblaster/project/jni/sdl/Makefile.minimal | 42 -
alienblaster/project/jni/sdl/NOTES | 172 +
alienblaster/project/jni/sdl/README | 9 +-
alienblaster/project/jni/sdl/README.AmigaOS | 12 -
alienblaster/project/jni/sdl/README.BeOS | 13 -
alienblaster/project/jni/sdl/README.CVS | 4 -
alienblaster/project/jni/sdl/README.DC | 32 -
alienblaster/project/jni/sdl/README.HG | 23 +
alienblaster/project/jni/sdl/README.MacOS | 63 -
alienblaster/project/jni/sdl/README.MacOSX | 186 -
alienblaster/project/jni/sdl/README.MiNT | 250 -
alienblaster/project/jni/sdl/README.NDS | 22 -
alienblaster/project/jni/sdl/README.NanoX | 97 -
alienblaster/project/jni/sdl/README.OS2 | 281 -
alienblaster/project/jni/sdl/README.PS3 | 29 -
alienblaster/project/jni/sdl/README.PicoGUI | 50 -
alienblaster/project/jni/sdl/README.Porting | 1 +
alienblaster/project/jni/sdl/README.QNX | 155 -
alienblaster/project/jni/sdl/README.Qtopia | 84 -
alienblaster/project/jni/sdl/README.RISCOS | 130 -
alienblaster/project/jni/sdl/README.SVN | 23 -
alienblaster/project/jni/sdl/README.Symbian | 23 -
alienblaster/project/jni/sdl/README.Watcom | 133 -
alienblaster/project/jni/sdl/README.WinCE | 55 -
alienblaster/project/jni/sdl/README.wscons | 107 -
alienblaster/project/jni/sdl/SDL.qpg.in | 140 -
alienblaster/project/jni/sdl/SDL.spec | 113 -
alienblaster/project/jni/sdl/SDL.spec.in | 113 -
alienblaster/project/jni/sdl/TODO | 38 +-
.../project/jni/sdl/UNDER_CONSTRUCTION.txt | 1 +
alienblaster/project/jni/sdl/VisualC.html | 171 -
alienblaster/project/jni/sdl/WhatsNew | 28 +-
alienblaster/project/jni/sdl/autogen.sh | 19 -
alienblaster/project/jni/sdl/docs.html | 629 -
alienblaster/project/jni/sdl/include/SDL.h | 115 +-
.../project/jni/sdl/include/SDL_active.h | 63 -
.../project/jni/sdl/include/SDL_assert.h | 241 +
.../project/jni/sdl/include/SDL_atomic.h | 216 +
.../project/jni/sdl/include/SDL_audio.h | 544 +-
.../project/jni/sdl/include/SDL_cdrom.h | 202 -
.../project/jni/sdl/include/SDL_compat.h | 342 +
.../project/jni/sdl/include/SDL_config.h | 20 +-
.../jni/sdl/include/SDL_config.h.default | 20 +-
.../project/jni/sdl/include/SDL_config.h.in | 146 +-
.../jni/sdl/include/SDL_config_android.h | 56 +-
.../jni/sdl/include/SDL_config_iphoneos.h | 158 +
.../jni/sdl/include/SDL_config_macos.h | 112 -
.../jni/sdl/include/SDL_config_macosx.h | 55 +-
.../jni/sdl/include/SDL_config_minimal.h | 33 +-
...ig_dreamcast.h => SDL_config_nintendods.h} | 49 +-
...{SDL_config_nds.h => SDL_config_pandora.h} | 68 +-
.../jni/sdl/include/SDL_config_symbian.h | 146 -
.../jni/sdl/include/SDL_config_win32.h | 80 +-
.../{SDL_config_os2.h => SDL_config_wiz.h} | 111 +-
.../project/jni/sdl/include/SDL_copying.h | 3 +-
.../project/jni/sdl/include/SDL_cpuinfo.h | 50 +-
.../project/jni/sdl/include/SDL_endian.h | 198 +-
.../project/jni/sdl/include/SDL_error.h | 44 +-
.../project/jni/sdl/include/SDL_events.h | 666 +-
.../project/jni/sdl/include/SDL_haptic.h | 1123 ++
.../project/jni/sdl/include/SDL_input.h | 88 +
.../project/jni/sdl/include/SDL_joystick.h | 164 +-
.../project/jni/sdl/include/SDL_keyboard.h | 177 +-
.../project/jni/sdl/include/SDL_keysym.h | 586 +-
.../project/jni/sdl/include/SDL_loadso.h | 60 +-
.../project/jni/sdl/include/SDL_main.h | 80 +-
.../project/jni/sdl/include/SDL_mouse.h | 180 +-
.../project/jni/sdl/include/SDL_mutex.h | 212 +-
.../project/jni/sdl/include/SDL_opengl.h | 3090 ++-
.../project/jni/sdl/include/SDL_opengles.h | 1039 +
.../project/jni/sdl/include/SDL_pixels.h | 399 +
.../project/jni/sdl/include/SDL_platform.h | 66 +-
.../project/jni/sdl/include/SDL_power.h | 80 +
.../project/jni/sdl/include/SDL_quit.h | 24 +-
.../project/jni/sdl/include/SDL_rect.h | 137 +
.../project/jni/sdl/include/SDL_revision.h | 1 +
.../project/jni/sdl/include/SDL_rwops.h | 213 +-
.../project/jni/sdl/include/SDL_scancode.h | 399 +
.../project/jni/sdl/include/SDL_stdinc.h | 343 +-
.../project/jni/sdl/include/SDL_surface.h | 700 +
.../project/jni/sdl/include/SDL_syswm.h | 275 +-
.../project/jni/sdl/include/SDL_thread.h | 133 +-
.../project/jni/sdl/include/SDL_timer.h | 148 +-
.../project/jni/sdl/include/SDL_types.h | 8 +-
.../project/jni/sdl/include/SDL_version.h | 127 +-
.../project/jni/sdl/include/SDL_video.h | 2013 +-
.../project/jni/sdl/include/begin_code.h | 119 +-
.../project/jni/sdl/include/close_code.h | 28 +-
alienblaster/project/jni/sdl/include/doxyfile | 1241 +-
alienblaster/project/jni/sdl/sdl-config.in | 60 -
alienblaster/project/jni/sdl/sdl.m4 | 183 -
alienblaster/project/jni/sdl/sdl.pc.in | 15 -
alienblaster/project/jni/sdl/src/SDL.c | 480 +-
alienblaster/project/jni/sdl/src/SDL_assert.c | 475 +
alienblaster/project/jni/sdl/src/SDL_compat.c | 1775 ++
alienblaster/project/jni/sdl/src/SDL_error.c | 337 +-
.../project/jni/sdl/src/SDL_error_c.h | 43 +-
alienblaster/project/jni/sdl/src/SDL_fatal.c | 122 +-
alienblaster/project/jni/sdl/src/SDL_fatal.h | 4 +-
.../jni/sdl/src/atomic/dummy/SDL_atomic.c | 469 +
.../jni/sdl/src/atomic/linux/SDL_atomic.c | 510 +
.../jni/sdl/src/atomic/macosx/SDL_atomic.c | 469 +
.../jni/sdl/src/atomic/qnx/SDL_atomic.c | 505 +
.../jni/sdl/src/atomic/win32/SDL_atomic.c | 512 +
.../project/jni/sdl/src/audio/SDL_audio.c | 1592 +-
.../project/jni/sdl/src/audio/SDL_audio_c.h | 30 +-
.../project/jni/sdl/src/audio/SDL_audiocvt.c | 2302 +--
.../project/jni/sdl/src/audio/SDL_audiodev.c | 205 +-
.../jni/sdl/src/audio/SDL_audiodev_c.h | 8 +-
.../project/jni/sdl/src/audio/SDL_audiomem.h | 3 +-
.../jni/sdl/src/audio/SDL_audiotypecvt.c | 16216 ++++++++++++++++
.../project/jni/sdl/src/audio/SDL_mixer.c | 483 +-
.../project/jni/sdl/src/audio/SDL_mixer_MMX.c | 231 +-
.../project/jni/sdl/src/audio/SDL_mixer_MMX.h | 8 +-
.../jni/sdl/src/audio/SDL_mixer_MMX_VC.c | 15 +-
.../jni/sdl/src/audio/SDL_mixer_MMX_VC.h | 11 +-
.../jni/sdl/src/audio/SDL_mixer_m68k.c | 283 +-
.../jni/sdl/src/audio/SDL_mixer_m68k.h | 24 +-
.../project/jni/sdl/src/audio/SDL_sysaudio.h | 224 +-
.../project/jni/sdl/src/audio/SDL_wave.c | 1042 +-
.../project/jni/sdl/src/audio/SDL_wave.h | 41 +-
.../jni/sdl/src/audio/alsa/SDL_alsa_audio.c | 1007 +-
.../jni/sdl/src/audio/alsa/SDL_alsa_audio.h | 36 +-
.../sdl/src/audio/android/SDL_androidaudio.c | 3 +
.../jni/sdl/src/audio/arts/SDL_artsaudio.c | 513 +-
.../jni/sdl/src/audio/arts/SDL_artsaudio.h | 39 +-
.../jni/sdl/src/audio/baudio/SDL_beaudio.cc | 299 +-
.../jni/sdl/src/audio/baudio/SDL_beaudio.h | 18 +-
.../jni/sdl/src/audio/bsd/SDL_bsdaudio.c | 600 +-
.../jni/sdl/src/audio/bsd/SDL_bsdaudio.h | 32 +-
.../project/jni/sdl/src/audio/dart/SDL_dart.c | 441 -
.../project/jni/sdl/src/audio/dart/SDL_dart.h | 63 -
.../jni/sdl/src/audio/dc/SDL_dcaudio.c | 246 -
.../project/jni/sdl/src/audio/dc/aica.c | 271 -
.../jni/sdl/src/audio/disk/SDL_diskaudio.c | 222 +-
.../jni/sdl/src/audio/disk/SDL_diskaudio.h | 18 +-
.../jni/sdl/src/audio/dma/SDL_dmaaudio.c | 842 +-
.../jni/sdl/src/audio/dma/SDL_dmaaudio.h | 40 +-
.../jni/sdl/src/audio/dmedia/SDL_irixaudio.c | 324 +-
.../jni/sdl/src/audio/dmedia/SDL_irixaudio.h | 21 +-
.../jni/sdl/src/audio/dsp/SDL_dspaudio.c | 521 +-
.../jni/sdl/src/audio/dsp/SDL_dspaudio.h | 31 +-
.../jni/sdl/src/audio/dummy/SDL_dummyaudio.c | 129 +-
.../jni/sdl/src/audio/dummy/SDL_dummyaudio.h | 18 +-
.../jni/sdl/src/audio/esd/SDL_esdaudio.c | 463 +-
.../jni/sdl/src/audio/esd/SDL_esdaudio.h | 38 +-
.../sdl/src/audio/fusionsound/SDL_fsaudio.c | 351 +
.../sdl/src/audio/fusionsound/SDL_fsaudio.h | 50 +
.../src/audio/iphoneos/SDL_coreaudio_iphone.c | 340 +
.../SDL_coreaudio_iphone.h} | 26 +-
.../jni/sdl/src/audio/macosx/SDL_coreaudio.c | 639 +-
.../jni/sdl/src/audio/macosx/SDL_coreaudio.h | 24 +-
.../jni/sdl/src/audio/macrom/SDL_romaudio.c | 496 -
.../jni/sdl/src/audio/macrom/SDL_romaudio.h | 50 -
.../jni/sdl/src/audio/mint/SDL_mintaudio.c | 215 -
.../jni/sdl/src/audio/mint/SDL_mintaudio.h | 157 -
.../sdl/src/audio/mint/SDL_mintaudio_dma8.c | 361 -
.../sdl/src/audio/mint/SDL_mintaudio_dma8.h | 85 -
.../sdl/src/audio/mint/SDL_mintaudio_gsxb.c | 436 -
.../sdl/src/audio/mint/SDL_mintaudio_gsxb.h | 108 -
.../jni/sdl/src/audio/mint/SDL_mintaudio_it.S | 281 -
.../sdl/src/audio/mint/SDL_mintaudio_mcsn.c | 404 -
.../sdl/src/audio/mint/SDL_mintaudio_mcsn.h | 59 -
.../sdl/src/audio/mint/SDL_mintaudio_stfa.c | 323 -
.../sdl/src/audio/mint/SDL_mintaudio_stfa.h | 100 -
.../sdl/src/audio/mint/SDL_mintaudio_xbios.c | 495 -
.../jni/sdl/src/audio/mme/SDL_mmeaudio.c | 346 +-
.../jni/sdl/src/audio/mme/SDL_mmeaudio.h | 36 +-
.../jni/sdl/src/audio/nas/SDL_nasaudio.c | 451 +-
.../jni/sdl/src/audio/nas/SDL_nasaudio.h | 33 +-
.../jni/sdl/src/audio/nds/SDL_ndsaudio.c | 357 +-
.../jni/sdl/src/audio/nds/SDL_ndsaudio.h | 26 +-
.../project/jni/sdl/src/audio/nds/sound9.c | 61 -
.../jni/sdl/src/audio/nds/soundcommon.h | 80 -
.../jni/sdl/src/audio/nto/SDL_nto_audio.c | 507 -
.../jni/sdl/src/audio/nto/SDL_nto_audio.h | 68 -
.../jni/sdl/src/audio/paudio/SDL_paudio.c | 853 +-
.../jni/sdl/src/audio/paudio/SDL_paudio.h | 37 +-
.../jni/sdl/src/audio/pulse/SDL_pulseaudio.c | 534 -
.../jni/sdl/src/audio/pulse/SDL_pulseaudio.h | 71 -
.../sdl/src/audio/pulseaudio/SDL_pulseaudio.c | 540 +
.../pulseaudio/SDL_pulseaudio.h} | 45 +-
.../jni/sdl/src/audio/qsa/SDL_qsa_audio.c | 893 +
.../qsa/SDL_qsa_audio.h} | 47 +-
.../jni/sdl/src/audio/sdlgenaudiocvt.pl | 758 +
.../jni/sdl/src/audio/sun/SDL_sunaudio.c | 566 +-
.../jni/sdl/src/audio/sun/SDL_sunaudio.h | 33 +-
.../sdl/src/audio/symbian/SDL_epocaudio.cpp | 614 -
.../jni/sdl/src/audio/symbian/SDL_epocaudio.h | 37 -
.../sdl/src/audio/symbian/streamplayer.cpp | 279 -
.../jni/sdl/src/audio/symbian/streamplayer.h | 89 -
.../jni/sdl/src/audio/ums/SDL_umsaudio.c | 460 +-
.../jni/sdl/src/audio/ums/SDL_umsaudio.h | 8 +-
.../jni/sdl/src/audio/windib/SDL_dibaudio.c | 453 +-
.../jni/sdl/src/audio/windib/SDL_dibaudio.h | 32 +-
.../jni/sdl/src/audio/windx5/SDL_dx5audio.c | 1015 +-
.../jni/sdl/src/audio/windx5/SDL_dx5audio.h | 36 +-
.../jni/sdl/src/audio/windx5/directx.h | 8 +-
.../project/jni/sdl/src/cdrom/SDL_cdrom.c | 341 -
.../project/jni/sdl/src/cdrom/SDL_syscdrom.h | 76 -
.../jni/sdl/src/cdrom/aix/SDL_syscdrom.c | 660 -
.../jni/sdl/src/cdrom/beos/SDL_syscdrom.cc | 412 -
.../jni/sdl/src/cdrom/bsdi/SDL_syscdrom.c | 542 -
.../jni/sdl/src/cdrom/dc/SDL_syscdrom.c | 167 -
.../jni/sdl/src/cdrom/freebsd/SDL_syscdrom.c | 406 -
.../jni/sdl/src/cdrom/linux/SDL_syscdrom.c | 564 -
.../jni/sdl/src/cdrom/macos/SDL_syscdrom.c | 525 -
.../jni/sdl/src/cdrom/macos/SDL_syscdrom_c.h | 140 -
.../sdl/src/cdrom/macosx/AudioFilePlayer.c | 360 -
.../sdl/src/cdrom/macosx/AudioFilePlayer.h | 178 -
.../src/cdrom/macosx/AudioFileReaderThread.c | 610 -
.../jni/sdl/src/cdrom/macosx/CDPlayer.c | 637 -
.../jni/sdl/src/cdrom/macosx/CDPlayer.h | 69 -
.../jni/sdl/src/cdrom/macosx/SDLOSXCAGuard.c | 199 -
.../jni/sdl/src/cdrom/macosx/SDLOSXCAGuard.h | 116 -
.../jni/sdl/src/cdrom/macosx/SDL_syscdrom.c | 514 -
.../jni/sdl/src/cdrom/macosx/SDL_syscdrom_c.h | 136 -
.../jni/sdl/src/cdrom/mint/SDL_syscdrom.c | 317 -
.../jni/sdl/src/cdrom/openbsd/SDL_syscdrom.c | 416 -
.../jni/sdl/src/cdrom/os2/SDL_syscdrom.c | 393 -
.../jni/sdl/src/cdrom/osf/SDL_syscdrom.c | 444 -
.../jni/sdl/src/cdrom/qnx/SDL_syscdrom.c | 551 -
.../jni/sdl/src/cdrom/win32/SDL_syscdrom.c | 386 -
.../project/jni/sdl/src/cpuinfo/SDL_cpuinfo.c | 666 +-
.../project/jni/sdl/src/events/SDL_active.c | 95 -
.../project/jni/sdl/src/events/SDL_events.c | 829 +-
.../project/jni/sdl/src/events/SDL_events_c.h | 55 +-
.../project/jni/sdl/src/events/SDL_expose.c | 51 -
.../project/jni/sdl/src/events/SDL_keyboard.c | 1363 +-
.../jni/sdl/src/events/SDL_keyboard_c.h | 65 +
.../project/jni/sdl/src/events/SDL_mouse.c | 664 +-
.../SDL_sysmouse.cc => events/SDL_mouse_c.h} | 56 +-
.../project/jni/sdl/src/events/SDL_quit.c | 78 +-
.../project/jni/sdl/src/events/SDL_resize.c | 76 -
.../jni/sdl/src/events/SDL_sysevents.h | 18 +-
.../jni/sdl/src/events/SDL_windowevents.c | 165 +
.../SDL_windowevents_c.h} | 15 +-
.../sdl/src/{video => events}/blank_cursor.h | 7 +-
.../jni/sdl/src/events/default_cursor.h | 115 +
.../jni/sdl/src/events/scancodes_darwin.h | 160 +
.../jni/sdl/src/events/scancodes_linux.h | 264 +
.../jni/sdl/src/events/scancodes_win32.h | 287 +
.../jni/sdl/src/events/scancodes_xfree86.h | 330 +
.../project/jni/sdl/src/file/SDL_rwops.c | 964 +-
.../src/file/cocoa/SDL_rwopsbundlesupport.h | 9 +
.../src/file/cocoa/SDL_rwopsbundlesupport.m | 43 +
.../project/jni/sdl/src/haptic/SDL_haptic.c | 707 +
.../jni/sdl/src/haptic/SDL_syshaptic.h | 201 +
.../jni/sdl/src/haptic/darwin/SDL_syshaptic.c | 1321 ++
.../jni/sdl/src/haptic/dummy/SDL_syshaptic.c | 195 +
.../jni/sdl/src/haptic/linux/SDL_syshaptic.c | 993 +
.../jni/sdl/src/haptic/nds/SDL_syshaptic.c | 330 +
.../jni/sdl/src/haptic/win32/SDL_syshaptic.c | 1379 ++
.../project/jni/sdl/src/hermes/COPYING.LIB | 438 -
.../project/jni/sdl/src/hermes/HeadMMX.h | 100 -
.../project/jni/sdl/src/hermes/HeadX86.h | 186 -
.../project/jni/sdl/src/hermes/README | 13 -
.../project/jni/sdl/src/hermes/common.inc | 9 -
.../project/jni/sdl/src/hermes/mmx_main.asm | 74 -
.../project/jni/sdl/src/hermes/mmxp2_32.asm | 405 -
.../project/jni/sdl/src/hermes/x86_main.asm | 75 -
.../project/jni/sdl/src/hermes/x86p_16.asm | 490 -
.../project/jni/sdl/src/hermes/x86p_32.asm | 1045 -
.../jni/sdl/src/joystick/SDL_joystick.c | 773 +-
.../jni/sdl/src/joystick/SDL_joystick_c.h | 17 +-
.../jni/sdl/src/joystick/SDL_sysjoystick.h | 49 +-
.../sdl/src/joystick/beos/SDL_bejoystick.cc | 313 +-
.../sdl/src/joystick/bsd/SDL_sysjoystick.c | 777 +-
.../sdl/src/joystick/darwin/SDL_sysjoystick.c | 1239 +-
.../src/joystick/darwin/SDL_sysjoystick_c.h | 88 +
.../jni/sdl/src/joystick/dc/SDL_sysjoystick.c | 193 -
.../sdl/src/joystick/dummy/SDL_sysjoystick.c | 40 +-
.../iphoneos/SDLUIAccelerationDelegate.h | 45 +
.../iphoneos/SDLUIAccelerationDelegate.m | 142 +
.../src/joystick/iphoneos/SDL_sysjoystick.m | 125 +
.../sdl/src/joystick/linux/SDL_sysjoystick.c | 1707 +-
.../linux/SDL_sysjoystick_c.h} | 41 +-
.../sdl/src/joystick/macos/SDL_sysjoystick.c | 320 -
.../sdl/src/joystick/mint/SDL_sysjoystick.c | 826 -
.../sdl/src/joystick/nds/SDL_sysjoystick.c | 188 +-
.../sdl/src/joystick/os2/SDL_sysjoystick.c | 668 -
.../project/jni/sdl/src/joystick/os2/joyos2.h | 177 -
.../sdl/src/joystick/riscos/SDL_sysjoystick.c | 164 +-
.../sdl/src/joystick/win32/SDL_dxjoystick.c | 802 +
.../sdl/src/joystick/win32/SDL_dxjoystick_c.h | 73 +
.../sdl/src/joystick/win32/SDL_mmjoystick.c | 575 +-
alienblaster/project/jni/sdl/src/libm/e_log.c | 167 +
alienblaster/project/jni/sdl/src/libm/e_pow.c | 342 +
.../project/jni/sdl/src/libm/e_rem_pio2.c | 201 +
.../sdl/src/{video/e_sqrt.h => libm/e_sqrt.c} | 229 +-
alienblaster/project/jni/sdl/src/libm/k_cos.c | 100 +
.../project/jni/sdl/src/libm/k_rem_pio2.c | 358 +
alienblaster/project/jni/sdl/src/libm/k_sin.c | 87 +
alienblaster/project/jni/sdl/src/libm/math.h | 75 +
.../sdl/src/{video => libm}/math_private.h | 97 +-
.../project/jni/sdl/src/libm/s_copysign.c | 42 +
alienblaster/project/jni/sdl/src/libm/s_cos.c | 91 +
.../project/jni/sdl/src/libm/s_fabs.c | 39 +
.../project/jni/sdl/src/libm/s_floor.c | 96 +
.../project/jni/sdl/src/libm/s_scalbn.c | 79 +
alienblaster/project/jni/sdl/src/libm/s_sin.c | 91 +
.../jni/sdl/src/loadso/beos/SDL_sysloadso.c | 6 +-
.../jni/sdl/src/loadso/dlopen/SDL_sysloadso.c | 60 +-
.../jni/sdl/src/loadso/dummy/SDL_sysloadso.c | 25 +-
.../jni/sdl/src/loadso/macos/SDL_sysloadso.c | 106 -
.../jni/sdl/src/loadso/macosx/SDL_dlcompat.c | 1860 +-
.../jni/sdl/src/loadso/mint/SDL_sysloadso.c | 62 -
.../jni/sdl/src/loadso/os2/SDL_sysloadso.c | 71 -
.../jni/sdl/src/loadso/win32/SDL_sysloadso.c | 158 +-
.../jni/sdl/src/main/beos/SDL_BeApp.cc | 113 +-
.../project/jni/sdl/src/main/beos/SDL_BeApp.h | 3 +-
.../jni/sdl/src/main/dummy/SDL_dummy_main.c | 12 +-
.../project/jni/sdl/src/main/macos/SDL.r | 1 -
.../jni/sdl/src/main/macos/SDL.shlib.r | 1 -
.../project/jni/sdl/src/main/macos/SDL_main.c | 610 -
.../project/jni/sdl/src/main/macos/SIZE.r | 1 -
.../jni/sdl/src/main/macos/exports/Makefile | 39 -
.../jni/sdl/src/main/macos/exports/SDL.x | 1 -
.../jni/sdl/src/main/macos/exports/gendef.pl | 43 -
.../jni/sdl/src/main/macosx/Info.plist.in | 24 -
.../project/jni/sdl/src/main/macosx/SDLMain.h | 16 -
.../project/jni/sdl/src/main/macosx/SDLMain.m | 381 -
.../src/main/macosx/SDLMain.nib/classes.nib | 12 -
.../sdl/src/main/macosx/SDLMain.nib/info.nib | 12 -
.../src/main/macosx/SDLMain.nib/objects.nib | Bin 1701 -> 0 bytes
.../project/jni/sdl/src/main/macosx/info.nib | 1 -
.../sdl/src/main/qtopia/SDL_qtopia_main.cc | 47 -
.../sdl/src/main/symbian/EKA1/SDL_main.cpp | 152 -
.../sdl/src/main/symbian/EKA2/SDL_main.cpp | 1035 -
.../jni/sdl/src/main/symbian/EKA2/sdlexe.cpp | 809 -
.../jni/sdl/src/main/symbian/EKA2/sdllib.cpp | 12 -
.../src/main/symbian/EKA2/vectorbuffer.cpp | 62 -
.../sdl/src/main/symbian/EKA2/vectorbuffer.h | 240 -
.../jni/sdl/src/main/win32/SDL_win32_main.c | 456 +-
.../project/jni/sdl/src/main/win32/version.rc | 8 +-
.../project/jni/sdl/src/power/SDL_power.c | 112 +
.../jni/sdl/src/power/beos/SDL_syspower.c | 125 +
.../jni/sdl/src/power/linux/SDL_syspower.c | 438 +
.../jni/sdl/src/power/macosx/SDL_syspower.c | 193 +
.../jni/sdl/src/power/nds/SDL_syspower.c | 45 +
.../jni/sdl/src/power/uikit/SDL_syspower.m | 100 +
.../jni/sdl/src/power/windows/SDL_syspower.c | 77 +
.../project/jni/sdl/src/stdlib/SDL_getenv.c | 380 +-
.../project/jni/sdl/src/stdlib/SDL_iconv.c | 1560 +-
.../project/jni/sdl/src/stdlib/SDL_malloc.c | 4164 ++--
.../project/jni/sdl/src/stdlib/SDL_qsort.c | 276 +-
.../project/jni/sdl/src/stdlib/SDL_stdlib.c | 1098 +-
.../project/jni/sdl/src/stdlib/SDL_string.c | 1062 +-
.../jni/sdl/src/thread/SDL_systhread.h | 15 +-
.../project/jni/sdl/src/thread/SDL_thread.c | 388 +-
.../project/jni/sdl/src/thread/SDL_thread_c.h | 28 +-
.../jni/sdl/src/thread/beos/SDL_syssem.c | 170 +-
.../jni/sdl/src/thread/beos/SDL_systhread.c | 81 +-
.../jni/sdl/src/thread/beos/SDL_systhread_c.h | 8 +-
.../jni/sdl/src/thread/dc/SDL_syscond.c | 215 -
.../jni/sdl/src/thread/dc/SDL_sysmutex.c | 122 -
.../jni/sdl/src/thread/dc/SDL_syssem.c | 173 -
.../jni/sdl/src/thread/dc/SDL_systhread_c.h | 24 -
.../jni/sdl/src/thread/generic/SDL_syscond.c | 258 +-
.../jni/sdl/src/thread/generic/SDL_sysmutex.c | 151 +-
.../sdl/src/thread/generic/SDL_sysmutex_c.h | 4 +-
.../jni/sdl/src/thread/generic/SDL_syssem.c | 247 +-
.../sdl/src/thread/generic/SDL_systhread.c | 30 +-
.../sdl/src/thread/generic/SDL_systhread_c.h | 16 +-
.../jni/sdl/src/thread/irix/SDL_syssem.c | 254 +-
.../jni/sdl/src/thread/irix/SDL_systhread.c | 65 +-
.../jni/sdl/src/thread/irix/SDL_systhread_c.h | 15 +-
.../jni/sdl/src/thread/nds/SDL_syscond.c | 229 +
.../src/thread/{dc => nds}/SDL_syscond_c.h | 7 +-
.../jni/sdl/src/thread/nds/SDL_sysmutex.c | 142 +
.../src/thread/{dc => nds}/SDL_sysmutex_c.h | 7 +-
.../jni/sdl/src/thread/nds/SDL_syssem.c | 228 +
.../sdl/src/thread/{dc => nds}/SDL_syssem_c.h | 7 +-
.../src/thread/{dc => nds}/SDL_systhread.c | 45 +-
.../thread/nds/SDL_systhread_c.h} | 12 +-
.../jni/sdl/src/thread/os2/SDL_syscond.c | 215 -
.../jni/sdl/src/thread/os2/SDL_syscond_c.h | 23 -
.../jni/sdl/src/thread/os2/SDL_sysmutex.c | 108 -
.../jni/sdl/src/thread/os2/SDL_syssem.c | 192 -
.../jni/sdl/src/thread/os2/SDL_systhread.c | 108 -
.../jni/sdl/src/thread/os2/SDL_systhread_c.h | 28 -
.../jni/sdl/src/thread/pth/SDL_syscond.c | 164 -
.../jni/sdl/src/thread/pth/SDL_sysmutex.c | 87 -
.../jni/sdl/src/thread/pth/SDL_systhread.c | 103 -
.../jni/sdl/src/thread/pth/SDL_systhread_c.h | 31 -
.../jni/sdl/src/thread/pthread/SDL_syscond.c | 178 +-
.../jni/sdl/src/thread/pthread/SDL_sysmutex.c | 182 +-
.../sdl/src/thread/pthread/SDL_sysmutex_c.h | 8 +-
.../jni/sdl/src/thread/pthread/SDL_syssem.c | 184 +-
.../sdl/src/thread/pthread/SDL_systhread.c | 110 +-
.../sdl/src/thread/pthread/SDL_systhread_c.h | 16 +-
.../jni/sdl/src/thread/riscos/SDL_syscond.c | 177 +-
.../jni/sdl/src/thread/riscos/SDL_sysmutex.c | 178 +-
.../sdl/src/thread/riscos/SDL_sysmutex_c.h | 8 +-
.../jni/sdl/src/thread/riscos/SDL_syssem.c | 235 +-
.../jni/sdl/src/thread/riscos/SDL_systhread.c | 135 +-
.../sdl/src/thread/riscos/SDL_systhread_c.h | 16 +-
.../sdl/src/thread/symbian/SDL_sysmutex.cpp | 130 -
.../jni/sdl/src/thread/symbian/SDL_syssem.cpp | 214 -
.../sdl/src/thread/symbian/SDL_systhread.cpp | 146 -
.../sdl/src/thread/symbian/SDL_systhread_c.h | 30 -
.../jni/sdl/src/thread/win32/SDL_sysmutex.c | 101 +-
.../jni/sdl/src/thread/win32/SDL_syssem.c | 184 +-
.../jni/sdl/src/thread/win32/SDL_systhread.c | 163 +-
.../sdl/src/thread/win32/SDL_systhread_c.h | 15 +-
.../sdl/src/thread/win32/win_ce_semaphore.c | 262 +-
.../sdl/src/thread/win32/win_ce_semaphore.h | 27 +-
.../project/jni/sdl/src/timer/SDL_systimer.h | 3 +-
.../project/jni/sdl/src/timer/SDL_timer.c | 399 +-
.../project/jni/sdl/src/timer/SDL_timer_c.h | 3 +-
.../jni/sdl/src/timer/beos/SDL_systimer.c | 75 +-
.../jni/sdl/src/timer/dc/SDL_systimer.c | 100 -
.../jni/sdl/src/timer/dummy/SDL_systimer.c | 73 +-
.../jni/sdl/src/timer/macos/FastTimes.c | 352 -
.../jni/sdl/src/timer/macos/FastTimes.h | 27 -
.../jni/sdl/src/timer/macos/SDL_MPWtimer.c | 152 -
.../jni/sdl/src/timer/macos/SDL_systimer.c | 186 -
.../jni/sdl/src/timer/mint/SDL_systimer.c | 147 -
.../jni/sdl/src/timer/mint/SDL_vbltimer.S | 159 -
.../jni/sdl/src/timer/mint/SDL_vbltimer_s.h | 35 -
.../jni/sdl/src/timer/nds/SDL_systimer.c | 95 +-
.../jni/sdl/src/timer/os2/SDL_systimer.c | 227 -
.../jni/sdl/src/timer/riscos/SDL_systimer.c | 207 +-
.../sdl/src/timer/symbian/SDL_systimer.cpp | 114 -
.../jni/sdl/src/timer/unix/SDL_systimer.c | 225 +-
.../jni/sdl/src/timer/win32/SDL_systimer.c | 143 +-
.../jni/sdl/src/timer/wince/SDL_systimer.c | 195 +-
.../project/jni/sdl/src/video/SDL_RLEaccel.c | 1645 +-
.../jni/sdl/src/video/SDL_RLEaccel_c.h | 15 +-
.../project/jni/sdl/src/video/SDL_alphamult.c | 60 +
.../project/jni/sdl/src/video/SDL_alphamult.h | 38 +
.../jni/sdl/src/video/SDL_blendfillrect.c | 347 +
.../project/jni/sdl/src/video/SDL_blendline.c | 780 +
.../jni/sdl/src/video/SDL_blendpoint.c | 344 +
.../project/jni/sdl/src/video/SDL_blendrect.c | 75 +
.../project/jni/sdl/src/video/SDL_blit.c | 536 +-
.../project/jni/sdl/src/video/SDL_blit.h | 347 +-
.../project/jni/sdl/src/video/SDL_blit_0.c | 807 +-
.../project/jni/sdl/src/video/SDL_blit_1.c | 643 +-
.../project/jni/sdl/src/video/SDL_blit_A.c | 2523 +--
.../project/jni/sdl/src/video/SDL_blit_N.c | 3245 ++--
.../project/jni/sdl/src/video/SDL_blit_auto.c | 8014 ++++++++
.../project/jni/sdl/src/video/SDL_blit_auto.h | 31 +
.../project/jni/sdl/src/video/SDL_blit_copy.c | 169 +
.../video/SDL_blit_copy.h} | 11 +-
.../project/jni/sdl/src/video/SDL_blit_slow.c | 170 +
.../{dga/SDL_dgamouse_c.h => SDL_blit_slow.h} | 6 +-
.../project/jni/sdl/src/video/SDL_bmp.c | 929 +-
.../project/jni/sdl/src/video/SDL_cursor.c | 758 -
.../project/jni/sdl/src/video/SDL_cursor_c.h | 73 -
.../project/jni/sdl/src/video/SDL_draw.h | 576 +
.../project/jni/sdl/src/video/SDL_drawline.c | 208 +
.../project/jni/sdl/src/video/SDL_drawpoint.c | 116 +
.../project/jni/sdl/src/video/SDL_drawrect.c | 74 +
.../project/jni/sdl/src/video/SDL_fillrect.c | 432 +
.../project/jni/sdl/src/video/SDL_gamma.c | 369 +-
.../project/jni/sdl/src/video/SDL_glesfuncs.h | 229 +
.../project/jni/sdl/src/video/SDL_glfuncs.h | 786 +-
.../project/jni/sdl/src/video/SDL_leaks.h | 3 +-
.../project/jni/sdl/src/video/SDL_pixels.c | 1307 +-
.../project/jni/sdl/src/video/SDL_pixels_c.h | 30 +-
.../project/jni/sdl/src/video/SDL_rect.c | 405 +
.../project/jni/sdl/src/video/SDL_rect_c.h | 40 +
.../jni/sdl/src/video/SDL_renderer_gl.c | 1559 ++
.../jni/sdl/src/video/SDL_renderer_gl.h | 28 +
.../jni/sdl/src/video/SDL_renderer_gles.c | 977 +
.../SDL_romvideo.h => SDL_renderer_gles.h} | 9 +-
.../jni/sdl/src/video/SDL_renderer_sw.c | 958 +
.../jni/sdl/src/video/SDL_renderer_sw.h | 31 +
.../project/jni/sdl/src/video/SDL_stretch.c | 452 +-
.../project/jni/sdl/src/video/SDL_stretch_c.h | 29 -
.../project/jni/sdl/src/video/SDL_surface.c | 1693 +-
.../project/jni/sdl/src/video/SDL_sysvideo.h | 720 +-
.../project/jni/sdl/src/video/SDL_video.c | 5065 +++--
.../project/jni/sdl/src/video/SDL_yuv.c | 150 -
.../project/jni/sdl/src/video/SDL_yuv_mmx.c | 606 +-
.../project/jni/sdl/src/video/SDL_yuv_sw.c | 1569 +-
.../project/jni/sdl/src/video/SDL_yuv_sw_c.h | 47 +-
.../project/jni/sdl/src/video/SDL_yuvfuncs.h | 37 -
.../project/jni/sdl/src/video/Xext/XME/xme.c | 530 +-
.../sdl/src/video/Xext/Xinerama/Xinerama.c | 313 +-
.../sdl/src/video/Xext/XmuStdCmap/AllCmap.c | 159 +
.../sdl/src/video/Xext/XmuStdCmap/CmapAlloc.c | 337 +
.../sdl/src/video/Xext/XmuStdCmap/CrCmap.c | 531 +
.../sdl/src/video/Xext/XmuStdCmap/DelCmap.c | 71 +
.../sdl/src/video/Xext/XmuStdCmap/Distinct.c | 90 +
.../src/video/Xext/XmuStdCmap/LookupCmap.c | 323 +
.../sdl/src/video/Xext/XmuStdCmap/StdCmap.c | 236 +
.../sdl/src/video/Xext/XmuStdCmap/VisCmap.c | 184 +
.../project/jni/sdl/src/video/Xext/Xv/Xv.c | 1774 +-
.../jni/sdl/src/video/Xext/Xv/Xvlibint.h | 3 +-
.../jni/sdl/src/video/Xext/Xxf86dga/XF86DGA.c | 721 -
.../sdl/src/video/Xext/Xxf86dga/XF86DGA2.c | 993 -
.../sdl/src/video/Xext/Xxf86vm/XF86VMode.c | 1367 +-
.../sdl/src/video/Xext/extensions/StdCmap.h | 80 +
.../jni/sdl/src/video/Xext/extensions/Xext.h | 20 +-
.../sdl/src/video/Xext/extensions/Xinerama.h | 37 +-
.../jni/sdl/src/video/Xext/extensions/Xv.h | 2 +-
.../jni/sdl/src/video/Xext/extensions/Xvlib.h | 572 +-
.../sdl/src/video/Xext/extensions/Xvproto.h | 814 +-
.../sdl/src/video/Xext/extensions/extutil.h | 174 +-
.../src/video/Xext/extensions/panoramiXext.h | 28 +-
.../video/Xext/extensions/panoramiXproto.h | 232 +-
.../sdl/src/video/Xext/extensions/xf86dga.h | 284 +-
.../sdl/src/video/Xext/extensions/xf86dga1.h | 158 +-
.../src/video/Xext/extensions/xf86dga1str.h | 274 +-
.../src/video/Xext/extensions/xf86dgastr.h | 510 +-
.../sdl/src/video/Xext/extensions/xf86vmode.h | 336 +-
.../sdl/src/video/Xext/extensions/xf86vmstr.h | 815 +-
.../jni/sdl/src/video/Xext/extensions/xme.h | 45 -
.../jni/sdl/src/video/aalib/SDL_aaevents.c | 202 -
.../jni/sdl/src/video/aalib/SDL_aaevents_c.h | 35 -
.../jni/sdl/src/video/aalib/SDL_aavideo.c | 388 -
.../jni/sdl/src/video/aalib/SDL_aavideo.h | 66 -
.../sdl/src/video/android/SDL_androidinput.c | 261 +-
.../sdl/src/video/android/SDL_androidvideo.c | 548 +-
.../sdl/src/video/android/SDL_androidvideo.h | 5 +-
.../sdl/src/video/ataricommon/SDL_ataric2p.S | 447 -
.../src/video/ataricommon/SDL_ataric2p_s.h | 75 -
.../src/video/ataricommon/SDL_ataridevmouse.c | 159 -
.../sdl/src/video/ataricommon/SDL_atarieddi.S | 42 -
.../src/video/ataricommon/SDL_atarieddi_s.h | 54 -
.../src/video/ataricommon/SDL_atarievents.c | 239 -
.../src/video/ataricommon/SDL_atarievents_c.h | 65 -
.../sdl/src/video/ataricommon/SDL_atarigl.c | 1088 --
.../sdl/src/video/ataricommon/SDL_atarigl_c.h | 109 -
.../sdl/src/video/ataricommon/SDL_atarikeys.h | 140 -
.../src/video/ataricommon/SDL_biosevents.c | 131 -
.../src/video/ataricommon/SDL_biosevents_c.h | 42 -
.../src/video/ataricommon/SDL_gemdosevents.c | 139 -
.../video/ataricommon/SDL_gemdosevents_c.h | 42 -
.../src/video/ataricommon/SDL_ikbdevents.c | 126 -
.../src/video/ataricommon/SDL_ikbdevents_c.h | 42 -
.../src/video/ataricommon/SDL_ikbdinterrupt.S | 260 -
.../video/ataricommon/SDL_ikbdinterrupt_s.h | 61 -
.../src/video/ataricommon/SDL_xbiosevents.c | 154 -
.../src/video/ataricommon/SDL_xbiosevents_c.h | 48 -
.../video/ataricommon/SDL_xbiosinterrupt.S | 172 -
.../video/ataricommon/SDL_xbiosinterrupt_s.h | 52 -
.../jni/sdl/src/video/bwindow/SDL_BView.h | 167 +-
.../jni/sdl/src/video/bwindow/SDL_BWin.h | 733 +-
.../jni/sdl/src/video/bwindow/SDL_lowvideo.h | 26 +-
.../sdl/src/video/bwindow/SDL_sysevents.cc | 369 +-
.../sdl/src/video/bwindow/SDL_sysevents_c.h | 3 +-
.../jni/sdl/src/video/bwindow/SDL_sysmouse.cc | 208 +-
.../sdl/src/video/bwindow/SDL_sysmouse_c.h | 12 +-
.../jni/sdl/src/video/bwindow/SDL_sysvideo.cc | 1425 +-
.../jni/sdl/src/video/bwindow/SDL_syswm.cc | 85 +-
.../jni/sdl/src/video/bwindow/SDL_syswm_c.h | 6 +-
.../jni/sdl/src/video/bwindow/SDL_sysyuv.cc | 520 +-
.../jni/sdl/src/video/bwindow/SDL_sysyuv.h | 37 +-
.../jni/sdl/src/video/caca/SDL_cacaevents.c | 101 -
.../jni/sdl/src/video/caca/SDL_cacaevents_c.h | 35 -
.../jni/sdl/src/video/caca/SDL_cacavideo.c | 304 -
.../jni/sdl/src/video/caca/SDL_cacavideo.h | 76 -
.../SDL_cocoaevents.h} | 15 +-
.../jni/sdl/src/video/cocoa/SDL_cocoaevents.m | 228 +
.../cocoa/SDL_cocoakeyboard.h} | 25 +-
.../sdl/src/video/cocoa/SDL_cocoakeyboard.m | 731 +
.../SDL_vglmouse.c => cocoa/SDL_cocoamodes.h} | 43 +-
.../jni/sdl/src/video/cocoa/SDL_cocoamodes.m | 333 +
.../SDL_dgamouse.c => cocoa/SDL_cocoamouse.h} | 18 +-
.../jni/sdl/src/video/cocoa/SDL_cocoamouse.m | 112 +
.../SDL_macgl_c.h => cocoa/SDL_cocoaopengl.h} | 47 +-
.../jni/sdl/src/video/cocoa/SDL_cocoaopengl.m | 307 +
.../jni/sdl/src/video/cocoa/SDL_cocoavideo.h | 67 +
.../jni/sdl/src/video/cocoa/SDL_cocoavideo.m | 178 +
.../jni/sdl/src/video/cocoa/SDL_cocoawindow.h | 99 +
.../jni/sdl/src/video/cocoa/SDL_cocoawindow.m | 616 +
.../jni/sdl/src/video/dc/SDL_dcevents.c | 152 -
.../jni/sdl/src/video/dc/SDL_dcvideo.c | 445 -
.../jni/sdl/src/video/default_cursor.h | 116 -
.../jni/sdl/src/video/dga/SDL_dgaevents.c | 163 -
.../jni/sdl/src/video/dga/SDL_dgavideo.c | 1101 --
.../jni/sdl/src/video/dga/SDL_dgavideo.h | 124 -
.../sdl/src/video/directfb/SDL_DirectFB_WM.c | 360 +
.../sdl/src/video/directfb/SDL_DirectFB_WM.h | 58 +
.../sdl/src/video/directfb/SDL_DirectFB_dyn.c | 112 +
.../sdl/src/video/directfb/SDL_DirectFB_dyn.h | 41 +
.../src/video/directfb/SDL_DirectFB_events.c | 867 +-
.../src/video/directfb/SDL_DirectFB_events.h | 9 +-
.../src/video/directfb/SDL_DirectFB_keys.h | 135 -
.../src/video/directfb/SDL_DirectFB_modes.c | 503 +
.../src/video/directfb/SDL_DirectFB_modes.h | 57 +
.../src/video/directfb/SDL_DirectFB_mouse.c | 242 +
.../src/video/directfb/SDL_DirectFB_mouse.h | 43 +
.../src/video/directfb/SDL_DirectFB_opengl.c | 296 +
.../src/video/directfb/SDL_DirectFB_opengl.h | 55 +
.../src/video/directfb/SDL_DirectFB_render.c | 1102 ++
.../src/video/directfb/SDL_DirectFB_render.h | 30 +
.../src/video/directfb/SDL_DirectFB_video.c | 1297 +-
.../src/video/directfb/SDL_DirectFB_video.h | 150 +-
.../src/video/directfb/SDL_DirectFB_window.c | 453 +
.../src/video/directfb/SDL_DirectFB_window.h | 76 +
.../sdl/src/video/directfb/SDL_DirectFB_yuv.c | 290 -
.../jni/sdl/src/video/dummy/SDL_nullevents.c | 16 +-
.../sdl/src/video/dummy/SDL_nullevents_c.h | 9 +-
.../jni/sdl/src/video/dummy/SDL_nullrender.c | 344 +
.../SDL_nullrender_c.h} | 9 +-
.../jni/sdl/src/video/dummy/SDL_nullvideo.c | 216 +-
.../jni/sdl/src/video/dummy/SDL_nullvideo.h | 15 +-
.../project/jni/sdl/src/video/e_log.h | 140 -
.../project/jni/sdl/src/video/e_pow.h | 302 -
.../jni/sdl/src/video/fbcon/3dfx_mmio.h | 4 +-
.../jni/sdl/src/video/fbcon/3dfx_regs.h | 4 +-
.../jni/sdl/src/video/fbcon/SDL_fb3dfx.c | 306 +-
.../jni/sdl/src/video/fbcon/SDL_fb3dfx.h | 3 +-
.../jni/sdl/src/video/fbcon/SDL_fbelo.c | 524 +-
.../jni/sdl/src/video/fbcon/SDL_fbelo.h | 13 +-
.../jni/sdl/src/video/fbcon/SDL_fbevents.c | 2166 ++-
.../jni/sdl/src/video/fbcon/SDL_fbevents_c.h | 3 +-
.../jni/sdl/src/video/fbcon/SDL_fbkeys.h | 14 +-
.../jni/sdl/src/video/fbcon/SDL_fbmatrox.c | 399 +-
.../jni/sdl/src/video/fbcon/SDL_fbmatrox.h | 3 +-
.../jni/sdl/src/video/fbcon/SDL_fbmouse.c | 8 +-
.../jni/sdl/src/video/fbcon/SDL_fbmouse_c.h | 3 +-
.../jni/sdl/src/video/fbcon/SDL_fbriva.c | 293 +-
.../jni/sdl/src/video/fbcon/SDL_fbriva.h | 3 +-
.../jni/sdl/src/video/fbcon/SDL_fbvideo.c | 3016 ++-
.../jni/sdl/src/video/fbcon/SDL_fbvideo.h | 155 +-
.../jni/sdl/src/video/fbcon/matrox_mmio.h | 4 +-
.../jni/sdl/src/video/fbcon/matrox_regs.h | 10 +-
.../jni/sdl/src/video/fbcon/riva_mmio.h | 98 +-
.../jni/sdl/src/video/fbcon/riva_regs.h | 4 +-
.../jni/sdl/src/video/gapi/SDL_gapivideo.c | 1287 --
.../jni/sdl/src/video/gapi/SDL_gapivideo.h | 160 -
.../jni/sdl/src/video/gem/SDL_gemevents.c | 370 -
.../jni/sdl/src/video/gem/SDL_gemevents_c.h | 33 -
.../jni/sdl/src/video/gem/SDL_gemmouse.c | 204 -
.../jni/sdl/src/video/gem/SDL_gemmouse_c.h | 34 -
.../jni/sdl/src/video/gem/SDL_gemvideo.c | 1340 --
.../jni/sdl/src/video/gem/SDL_gemvideo.h | 191 -
.../project/jni/sdl/src/video/gem/SDL_gemwm.c | 116 -
.../jni/sdl/src/video/gem/SDL_gemwm_c.h | 37 -
.../jni/sdl/src/video/ggi/SDL_ggievents.c | 264 -
.../jni/sdl/src/video/ggi/SDL_ggikeys.h | 135 -
.../jni/sdl/src/video/ggi/SDL_ggimouse.c | 32 -
.../jni/sdl/src/video/ggi/SDL_ggimouse_c.h | 26 -
.../jni/sdl/src/video/ggi/SDL_ggivideo.c | 378 -
.../jni/sdl/src/video/ipod/SDL_ipodvideo.c | 733 -
.../sdl/src/video/maccommon/SDL_lowvideo.h | 102 -
.../sdl/src/video/maccommon/SDL_macevents.c | 746 -
.../sdl/src/video/maccommon/SDL_macevents_c.h | 32 -
.../jni/sdl/src/video/maccommon/SDL_macgl.c | 197 -
.../jni/sdl/src/video/maccommon/SDL_mackeys.h | 140 -
.../sdl/src/video/maccommon/SDL_macmouse.c | 129 -
.../sdl/src/video/maccommon/SDL_macmouse_c.h | 34 -
.../jni/sdl/src/video/maccommon/SDL_macwm.c | 442 -
.../jni/sdl/src/video/maccommon/SDL_macwm_c.h | 41 -
.../jni/sdl/src/video/macdsp/SDL_dspvideo.c | 1422 --
.../jni/sdl/src/video/macdsp/SDL_dspvideo.h | 54 -
.../jni/sdl/src/video/macrom/SDL_romvideo.c | 745 -
alienblaster/project/jni/sdl/src/video/mmx.h | 266 +-
.../jni/sdl/src/video/nanox/SDL_nxevents.c | 382 -
.../jni/sdl/src/video/nanox/SDL_nxevents_c.h | 32 -
.../jni/sdl/src/video/nanox/SDL_nximage.c | 230 -
.../jni/sdl/src/video/nanox/SDL_nximage_c.h | 35 -
.../jni/sdl/src/video/nanox/SDL_nxmodes.c | 84 -
.../jni/sdl/src/video/nanox/SDL_nxmodes_c.h | 34 -
.../jni/sdl/src/video/nanox/SDL_nxmouse.c | 79 -
.../jni/sdl/src/video/nanox/SDL_nxmouse_c.h | 29 -
.../jni/sdl/src/video/nanox/SDL_nxvideo.c | 544 -
.../jni/sdl/src/video/nanox/SDL_nxvideo.h | 96 -
.../jni/sdl/src/video/nanox/SDL_nxwm.c | 61 -
.../jni/sdl/src/video/nanox/SDL_nxwm_c.h | 32 -
.../jni/sdl/src/video/nds/SDL_ndsevents.c | 73 +-
.../jni/sdl/src/video/nds/SDL_ndsevents_c.h | 27 +-
.../jni/sdl/src/video/nds/SDL_ndsmouse.c | 34 -
.../jni/sdl/src/video/nds/SDL_ndsmouse_c.h | 26 -
.../jni/sdl/src/video/nds/SDL_ndsrender.c | 598 +
.../jni/sdl/src/video/nds/SDL_ndsrender_c.h | 28 +
.../jni/sdl/src/video/nds/SDL_ndsvideo.c | 534 +-
.../jni/sdl/src/video/nds/SDL_ndsvideo.h | 36 +-
.../jni/sdl/src/video/os2fslib/SDL_os2fslib.c | 3018 ---
.../jni/sdl/src/video/os2fslib/SDL_os2fslib.h | 71 -
.../jni/sdl/src/video/os2fslib/SDL_vkeys.h | 74 -
.../jni/sdl/src/video/pandora/SDL_pandora.c | 871 +
.../jni/sdl/src/video/pandora/SDL_pandora.h | 110 +
.../SDL_pandora_events.c} | 19 +-
.../SDL_pandora_events.h} | 6 +-
.../jni/sdl/src/video/photon/SDL_ph_events.c | 624 -
.../jni/sdl/src/video/photon/SDL_ph_gl.c | 406 -
.../jni/sdl/src/video/photon/SDL_ph_gl.h | 41 -
.../jni/sdl/src/video/photon/SDL_ph_image.c | 1059 -
.../jni/sdl/src/video/photon/SDL_ph_image_c.h | 59 -
.../jni/sdl/src/video/photon/SDL_ph_modes.c | 390 -
.../jni/sdl/src/video/photon/SDL_ph_modes_c.h | 43 -
.../jni/sdl/src/video/photon/SDL_ph_mouse.c | 220 -
.../jni/sdl/src/video/photon/SDL_ph_mouse_c.h | 39 -
.../jni/sdl/src/video/photon/SDL_ph_video.c | 648 -
.../jni/sdl/src/video/photon/SDL_ph_video.h | 157 -
.../jni/sdl/src/video/photon/SDL_ph_wm.c | 118 -
.../jni/sdl/src/video/photon/SDL_ph_wm_c.h | 37 -
.../jni/sdl/src/video/photon/SDL_photon.c | 2852 +++
.../jni/sdl/src/video/photon/SDL_photon.h | 180 +
.../sdl/src/video/photon/SDL_photon_input.c | 726 +
.../SDL_photon_input.h} | 42 +-
.../src/video/photon/SDL_photon_keycodes.h | 125 +
.../src/video/photon/SDL_photon_pixelfmt.c | 218 +
.../SDL_photon_pixelfmt.h} | 36 +-
.../sdl/src/video/photon/SDL_photon_render.c | 1691 ++
.../sdl/src/video/photon/SDL_photon_render.h | 76 +
.../jni/sdl/src/video/photon/SDL_phyuv.c | 504 -
.../jni/sdl/src/video/photon/SDL_phyuv_c.h | 62 -
.../jni/sdl/src/video/picogui/SDL_pgevents.c | 117 -
.../sdl/src/video/picogui/SDL_pgevents_c.h | 37 -
.../jni/sdl/src/video/picogui/SDL_pgvideo.c | 364 -
.../jni/sdl/src/video/ps2gs/SDL_gsevents.c | 977 -
.../jni/sdl/src/video/ps2gs/SDL_gsevents_c.h | 38 -
.../jni/sdl/src/video/ps2gs/SDL_gskeys.h | 139 -
.../jni/sdl/src/video/ps2gs/SDL_gsmouse.c | 146 -
.../jni/sdl/src/video/ps2gs/SDL_gsvideo.c | 689 -
.../jni/sdl/src/video/ps2gs/SDL_gsvideo.h | 95 -
.../jni/sdl/src/video/ps2gs/SDL_gsyuv.c | 461 -
.../jni/sdl/src/video/ps2gs/SDL_gsyuv_c.h | 37 -
.../jni/sdl/src/video/ps3/SDL_ps3events.c | 56 +-
.../jni/sdl/src/video/ps3/SDL_ps3events_c.h | 53 +-
.../jni/sdl/src/video/ps3/SDL_ps3modes.c | 143 +
.../jni/sdl/src/video/ps3/SDL_ps3modes_c.h | 34 +
.../jni/sdl/src/video/ps3/SDL_ps3render.c | 747 +
.../jni/sdl/src/video/ps3/SDL_ps3render_c.h | 29 +
.../jni/sdl/src/video/ps3/SDL_ps3spe.c | 166 +
.../jni/sdl/src/video/ps3/SDL_ps3spe_c.h | 87 +
.../jni/sdl/src/video/ps3/SDL_ps3video.c | 773 +-
.../jni/sdl/src/video/ps3/SDL_ps3video.h | 170 +-
.../jni/sdl/src/video/ps3/SDL_ps3yuv.c | 340 -
.../jni/sdl/src/video/ps3/SDL_ps3yuv_c.h | 44 -
.../jni/sdl/src/video/ps3/spulibs/Makefile | 96 +-
.../{yuv2rgb_converter.c => yuv2rgb.c} | 61 +-
.../jni/sdl/src/video/qnxgf/SDL_gf_input.c | 1144 ++
.../jni/sdl/src/video/qnxgf/SDL_gf_input.h | 165 +
.../jni/sdl/src/video/qnxgf/SDL_gf_opengles.c | 54 +
.../jni/sdl/src/video/qnxgf/SDL_gf_opengles.h | 39 +
.../jni/sdl/src/video/qnxgf/SDL_gf_pixelfmt.c | 187 +
.../SDL_dcvideo.h => qnxgf/SDL_gf_pixelfmt.h} | 27 +-
.../jni/sdl/src/video/qnxgf/SDL_gf_render.c | 425 +
.../jni/sdl/src/video/qnxgf/SDL_gf_render.h | 57 +
.../sdl/src/video/qnxgf/SDL_hiddi_joystick.h | 32 +
.../sdl/src/video/qnxgf/SDL_hiddi_keyboard.h | 159 +
.../jni/sdl/src/video/qnxgf/SDL_hiddi_mouse.h | 69 +
.../jni/sdl/src/video/qnxgf/SDL_qnxgf.c | 1934 ++
.../jni/sdl/src/video/qnxgf/SDL_qnxgf.h | 163 +
.../jni/sdl/src/video/qtopia/SDL_QPEApp.cc | 63 -
.../jni/sdl/src/video/qtopia/SDL_QPEApp.h | 33 -
.../jni/sdl/src/video/qtopia/SDL_QWin.cc | 527 -
.../jni/sdl/src/video/qtopia/SDL_QWin.h | 110 -
.../jni/sdl/src/video/qtopia/SDL_lowvideo.h | 65 -
.../jni/sdl/src/video/qtopia/SDL_sysevents.cc | 269 -
.../sdl/src/video/qtopia/SDL_sysevents_c.h | 31 -
.../jni/sdl/src/video/qtopia/SDL_sysvideo.cc | 403 -
.../project/jni/sdl/src/video/quartz/CGS.h | 84 -
.../sdl/src/video/quartz/SDL_QuartzEvents.m | 996 -
.../jni/sdl/src/video/quartz/SDL_QuartzGL.m | 292 -
.../jni/sdl/src/video/quartz/SDL_QuartzKeys.h | 146 -
.../sdl/src/video/quartz/SDL_QuartzVideo.h | 228 -
.../sdl/src/video/quartz/SDL_QuartzVideo.m | 1368 --
.../jni/sdl/src/video/quartz/SDL_QuartzWM.h | 27 -
.../jni/sdl/src/video/quartz/SDL_QuartzWM.m | 440 -
.../sdl/src/video/quartz/SDL_QuartzWindow.h | 51 -
.../sdl/src/video/quartz/SDL_QuartzWindow.m | 231 -
.../video/riscos/SDL_riscosFullScreenVideo.c | 1063 +-
.../sdl/src/video/riscos/SDL_riscosevents.c | 811 +-
.../sdl/src/video/riscos/SDL_riscosevents_c.h | 4 +-
.../sdl/src/video/riscos/SDL_riscosmouse.c | 451 +-
.../sdl/src/video/riscos/SDL_riscosmouse_c.h | 26 +-
.../sdl/src/video/riscos/SDL_riscossprite.c | 344 +-
.../jni/sdl/src/video/riscos/SDL_riscostask.c | 313 +-
.../jni/sdl/src/video/riscos/SDL_riscostask.h | 16 +-
.../sdl/src/video/riscos/SDL_riscosvideo.c | 355 +-
.../sdl/src/video/riscos/SDL_riscosvideo.h | 24 +-
.../jni/sdl/src/video/riscos/SDL_wimppoll.c | 422 +-
.../jni/sdl/src/video/riscos/SDL_wimpvideo.c | 678 +-
.../project/jni/sdl/src/video/sdlgenblit.pl | 480 +
.../jni/sdl/src/video/svga/SDL_svgaevents.c | 632 +-
.../jni/sdl/src/video/svga/SDL_svgaevents_c.h | 5 +-
.../jni/sdl/src/video/svga/SDL_svgamouse.c | 8 +-
.../jni/sdl/src/video/svga/SDL_svgamouse_c.h | 3 +-
.../jni/sdl/src/video/svga/SDL_svgavideo.c | 878 +-
.../jni/sdl/src/video/svga/SDL_svgavideo.h | 27 +-
.../src/video/symbian/EKA1/SDL_epocevents.cpp | 626 -
.../src/video/symbian/EKA1/SDL_epocvideo.cpp | 1356 --
.../src/video/symbian/EKA1/SDL_epocvideo.h | 34 -
.../src/video/symbian/EKA2/SDL_epocevents.cpp | 521 -
.../src/video/symbian/EKA2/SDL_epocvideo.cpp | 594 -
.../src/video/symbian/EKA2/SDL_epocvideo.h | 51 -
.../jni/sdl/src/video/symbian/EKA2/dsa.cpp | 1505 --
.../sdl/src/video/symbian/EKA2/dsa_new.cpp | 1443 --
.../sdl/src/video/symbian/EKA2/dsa_old.cpp | 1075 -
.../sdl/src/video/symbian/SDL_epocevents_c.h | 60 -
.../src/video/uikit/SDL_uikitappdelegate.h | 33 +
.../src/video/uikit/SDL_uikitappdelegate.m | 144 +
.../SDL_uikitevents.h} | 8 +-
.../jni/sdl/src/video/uikit/SDL_uikitevents.m | 57 +
.../SDL_uikitkeyboard.h} | 22 +-
.../sdl/src/video/uikit/SDL_uikitopengles.h | 38 +
.../sdl/src/video/uikit/SDL_uikitopengles.m | 142 +
.../sdl/src/video/uikit/SDL_uikitopenglview.h | 65 +
.../sdl/src/video/uikit/SDL_uikitopenglview.m | 164 +
.../SDL_aamouse.c => uikit/SDL_uikitvideo.h} | 18 +-
.../jni/sdl/src/video/uikit/SDL_uikitvideo.m | 252 +
.../jni/sdl/src/video/uikit/SDL_uikitview.h | 64 +
.../jni/sdl/src/video/uikit/SDL_uikitview.m | 403 +
.../SDL_uikitwindow.h} | 34 +-
.../jni/sdl/src/video/uikit/SDL_uikitwindow.m | 166 +
.../jni/sdl/src/video/uikit/jumphack.c | 19 +
.../jni/sdl/src/video/uikit/jumphack.h | 16 +
.../jni/sdl/src/video/uikit/keyinfotable.h | 175 +
.../jni/sdl/src/video/vgl/SDL_vglevents.c | 299 -
.../jni/sdl/src/video/vgl/SDL_vglevents_c.h | 155 -
.../jni/sdl/src/video/vgl/SDL_vglmouse_c.h | 32 -
.../jni/sdl/src/video/vgl/SDL_vglvideo.c | 640 -
.../jni/sdl/src/video/vgl/SDL_vglvideo.h | 65 -
.../sdl/src/video/win32/SDL_ceddrawrender.c | 833 +
.../SDL_ceddrawrender.h} | 13 +-
.../jni/sdl/src/video/win32/SDL_d3drender.c | 1531 ++
.../SDL_aamouse_c.h => win32/SDL_d3drender.h} | 8 +-
.../jni/sdl/src/video/win32/SDL_gapirender.c | 670 +
.../SDL_gapirender.h} | 23 +-
.../sdl/src/video/win32/SDL_gapirender_c.h | 121 +
.../jni/sdl/src/video/win32/SDL_gdirender.c | 1096 ++
.../SDL_syswm_c.h => win32/SDL_gdirender.h} | 10 +-
.../src/video/{windib => win32}/SDL_vkeys.h | 4 +-
.../jni/sdl/src/video/win32/SDL_win32events.c | 603 +
.../jni/sdl/src/video/win32/SDL_win32events.h | 38 +
.../jni/sdl/src/video/win32/SDL_win32gamma.c | 71 +
.../jni/sdl/src/video/win32/SDL_win32gamma.h | 32 +
.../sdl/src/video/win32/SDL_win32keyboard.c | 125 +
.../win32/SDL_win32keyboard.h} | 25 +-
.../jni/sdl/src/video/win32/SDL_win32modes.c | 279 +
.../SDL_win32modes.h} | 29 +-
.../jni/sdl/src/video/win32/SDL_win32mouse.c | 44 +
.../SDL_syswm.cc => win32/SDL_win32mouse.h} | 17 +-
.../jni/sdl/src/video/win32/SDL_win32opengl.c | 612 +
.../SDL_wingl_c.h => win32/SDL_win32opengl.h} | 85 +-
.../jni/sdl/src/video/win32/SDL_win32video.c | 210 +
.../jni/sdl/src/video/win32/SDL_win32video.h | 82 +
.../jni/sdl/src/video/win32/SDL_win32window.c | 681 +
.../jni/sdl/src/video/win32/SDL_win32window.h | 57 +
.../project/jni/sdl/src/video/win32/wmmsg.h | 1032 +
.../sdl/src/video/wincommon/SDL_lowvideo.h | 148 -
.../sdl/src/video/wincommon/SDL_sysevents.c | 865 -
.../sdl/src/video/wincommon/SDL_sysmouse.c | 259 -
.../sdl/src/video/wincommon/SDL_sysmouse_c.h | 33 -
.../jni/sdl/src/video/wincommon/SDL_syswm.c | 297 -
.../jni/sdl/src/video/wincommon/SDL_syswm_c.h | 35 -
.../jni/sdl/src/video/wincommon/SDL_wingl.c | 647 -
.../jni/sdl/src/video/wincommon/wmmsg.h | 1030 -
.../jni/sdl/src/video/windib/SDL_dibevents.c | 705 -
.../sdl/src/video/windib/SDL_dibevents_c.h | 35 -
.../jni/sdl/src/video/windib/SDL_dibvideo.c | 1321 --
.../jni/sdl/src/video/windib/SDL_dibvideo.h | 59 -
.../sdl/src/video/windib/SDL_gapidibvideo.h | 56 -
.../jni/sdl/src/video/windx5/SDL_dx5events.c | 1008 -
.../sdl/src/video/windx5/SDL_dx5events_c.h | 37 -
.../jni/sdl/src/video/windx5/SDL_dx5video.c | 2536 ---
.../jni/sdl/src/video/windx5/SDL_dx5video.h | 61 -
.../jni/sdl/src/video/windx5/SDL_dx5yuv.c | 296 -
.../jni/sdl/src/video/windx5/SDL_dx5yuv_c.h | 38 -
.../jni/sdl/src/video/windx5/directx.h | 100 -
.../sdl/src/video/wscons/SDL_wsconsevents.c | 233 -
.../sdl/src/video/wscons/SDL_wsconsevents_c.h | 36 -
.../sdl/src/video/wscons/SDL_wsconsmouse.c | 33 -
.../sdl/src/video/wscons/SDL_wsconsmouse_c.h | 26 -
.../sdl/src/video/wscons/SDL_wsconsvideo.c | 609 -
.../sdl/src/video/wscons/SDL_wsconsvideo.h | 76 -
.../jni/sdl/src/video/x11/SDL_x11dga.c | 90 -
.../jni/sdl/src/video/x11/SDL_x11dga_c.h | 33 -
.../jni/sdl/src/video/x11/SDL_x11dyn.c | 207 +-
.../jni/sdl/src/video/x11/SDL_x11dyn.h | 44 +-
.../jni/sdl/src/video/x11/SDL_x11events.c | 1668 +-
.../{SDL_x11events_c.h => SDL_x11events.h} | 13 +-
.../jni/sdl/src/video/x11/SDL_x11gamma.c | 300 +-
.../x11/{SDL_x11gamma_c.h => SDL_x11gamma.h} | 14 +-
.../project/jni/sdl/src/video/x11/SDL_x11gl.c | 570 -
.../jni/sdl/src/video/x11/SDL_x11gl_c.h | 98 -
.../jni/sdl/src/video/x11/SDL_x11image.c | 318 -
.../jni/sdl/src/video/x11/SDL_x11image_c.h | 38 -
.../jni/sdl/src/video/x11/SDL_x11keyboard.c | 288 +
.../jni/sdl/src/video/x11/SDL_x11keyboard.h | 33 +
.../jni/sdl/src/video/x11/SDL_x11modes.c | 1491 +-
.../jni/sdl/src/video/x11/SDL_x11modes.h | 64 +
.../jni/sdl/src/video/x11/SDL_x11modes_c.h | 43 -
.../jni/sdl/src/video/x11/SDL_x11mouse.c | 265 +-
.../SDL_x11mouse.h} | 40 +-
.../jni/sdl/src/video/x11/SDL_x11mouse_c.h | 33 -
.../jni/sdl/src/video/x11/SDL_x11opengl.c | 577 +
.../jni/sdl/src/video/x11/SDL_x11opengl.h | 74 +
.../jni/sdl/src/video/x11/SDL_x11opengles.c | 370 +
.../jni/sdl/src/video/x11/SDL_x11opengles.h | 91 +
.../jni/sdl/src/video/x11/SDL_x11render.c | 1147 ++
.../x11/SDL_x11render.h} | 13 +-
.../jni/sdl/src/video/x11/SDL_x11sym.h | 82 +-
.../jni/sdl/src/video/x11/SDL_x11video.c | 1728 +-
.../jni/sdl/src/video/x11/SDL_x11video.h | 198 +-
.../jni/sdl/src/video/x11/SDL_x11window.c | 1027 +
.../jni/sdl/src/video/x11/SDL_x11window.h | 55 +
.../project/jni/sdl/src/video/x11/SDL_x11wm.c | 434 -
.../jni/sdl/src/video/x11/SDL_x11wm_c.h | 34 -
.../jni/sdl/src/video/x11/SDL_x11yuv.c | 538 -
.../jni/sdl/src/video/x11/SDL_x11yuv_c.h | 41 -
.../project/jni/sdl/src/video/x11/imKStoUCS.c | 345 +
.../project/jni/sdl/src/video/x11/imKStoUCS.h | 31 +
.../jni/sdl/src/video/xbios/SDL_xbios.c | 1117 --
.../jni/sdl/src/video/xbios/SDL_xbios.h | 121 -
.../sdl/src/video/xbios/SDL_xbios_blowup.c | 77 -
.../sdl/src/video/xbios/SDL_xbios_blowup.h | 86 -
.../src/video/xbios/SDL_xbios_centscreen.c | 104 -
.../src/video/xbios/SDL_xbios_centscreen.h | 118 -
.../jni/sdl/src/video/xbios/SDL_xbios_milan.c | 111 -
.../jni/sdl/src/video/xbios/SDL_xbios_milan.h | 138 -
.../jni/sdl/src/video/xbios/SDL_xbios_sb3.c | 83 -
.../jni/sdl/src/video/xbios/SDL_xbios_sb3.h | 82 -
.../sdl/src/video/xbios/SDL_xbios_tveille.c | 52 -
.../sdl/src/video/xbios/SDL_xbios_tveille.h | 70 -
921 files changed, 152559 insertions(+), 151926 deletions(-)
delete mode 100644 alienblaster/project/jni/sdl/Borland.html
delete mode 100644 alienblaster/project/jni/sdl/Makefile.dc
delete mode 100644 alienblaster/project/jni/sdl/Makefile.in
delete mode 100644 alienblaster/project/jni/sdl/Makefile.minimal
create mode 100644 alienblaster/project/jni/sdl/NOTES
delete mode 100644 alienblaster/project/jni/sdl/README.AmigaOS
delete mode 100644 alienblaster/project/jni/sdl/README.BeOS
delete mode 100644 alienblaster/project/jni/sdl/README.CVS
delete mode 100644 alienblaster/project/jni/sdl/README.DC
create mode 100644 alienblaster/project/jni/sdl/README.HG
delete mode 100644 alienblaster/project/jni/sdl/README.MacOS
delete mode 100644 alienblaster/project/jni/sdl/README.MacOSX
delete mode 100644 alienblaster/project/jni/sdl/README.MiNT
delete mode 100644 alienblaster/project/jni/sdl/README.NDS
delete mode 100644 alienblaster/project/jni/sdl/README.NanoX
delete mode 100644 alienblaster/project/jni/sdl/README.OS2
delete mode 100644 alienblaster/project/jni/sdl/README.PS3
delete mode 100644 alienblaster/project/jni/sdl/README.PicoGUI
delete mode 100644 alienblaster/project/jni/sdl/README.QNX
delete mode 100644 alienblaster/project/jni/sdl/README.Qtopia
delete mode 100644 alienblaster/project/jni/sdl/README.RISCOS
delete mode 100644 alienblaster/project/jni/sdl/README.SVN
delete mode 100644 alienblaster/project/jni/sdl/README.Symbian
delete mode 100644 alienblaster/project/jni/sdl/README.Watcom
delete mode 100644 alienblaster/project/jni/sdl/README.WinCE
delete mode 100644 alienblaster/project/jni/sdl/README.wscons
delete mode 100644 alienblaster/project/jni/sdl/SDL.qpg.in
delete mode 100644 alienblaster/project/jni/sdl/SDL.spec
delete mode 100644 alienblaster/project/jni/sdl/SDL.spec.in
create mode 100644 alienblaster/project/jni/sdl/UNDER_CONSTRUCTION.txt
delete mode 100644 alienblaster/project/jni/sdl/VisualC.html
delete mode 100755 alienblaster/project/jni/sdl/autogen.sh
delete mode 100644 alienblaster/project/jni/sdl/docs.html
delete mode 100644 alienblaster/project/jni/sdl/include/SDL_active.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_assert.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_atomic.h
delete mode 100644 alienblaster/project/jni/sdl/include/SDL_cdrom.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_compat.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_config_iphoneos.h
delete mode 100644 alienblaster/project/jni/sdl/include/SDL_config_macos.h
rename alienblaster/project/jni/sdl/include/{SDL_config_dreamcast.h => SDL_config_nintendods.h} (68%)
rename alienblaster/project/jni/sdl/include/{SDL_config_nds.h => SDL_config_pandora.h} (68%)
delete mode 100644 alienblaster/project/jni/sdl/include/SDL_config_symbian.h
rename alienblaster/project/jni/sdl/include/{SDL_config_os2.h => SDL_config_wiz.h} (53%)
create mode 100644 alienblaster/project/jni/sdl/include/SDL_haptic.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_input.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_opengles.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_pixels.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_power.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_rect.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_revision.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_scancode.h
create mode 100644 alienblaster/project/jni/sdl/include/SDL_surface.h
delete mode 100644 alienblaster/project/jni/sdl/sdl-config.in
delete mode 100644 alienblaster/project/jni/sdl/sdl.m4
delete mode 100644 alienblaster/project/jni/sdl/sdl.pc.in
create mode 100644 alienblaster/project/jni/sdl/src/SDL_assert.c
create mode 100644 alienblaster/project/jni/sdl/src/SDL_compat.c
create mode 100644 alienblaster/project/jni/sdl/src/atomic/dummy/SDL_atomic.c
create mode 100644 alienblaster/project/jni/sdl/src/atomic/linux/SDL_atomic.c
create mode 100644 alienblaster/project/jni/sdl/src/atomic/macosx/SDL_atomic.c
create mode 100644 alienblaster/project/jni/sdl/src/atomic/qnx/SDL_atomic.c
create mode 100644 alienblaster/project/jni/sdl/src/atomic/win32/SDL_atomic.c
create mode 100644 alienblaster/project/jni/sdl/src/audio/SDL_audiotypecvt.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/dc/SDL_dcaudio.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/dc/aica.c
create mode 100644 alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.c
create mode 100644 alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.h
create mode 100644 alienblaster/project/jni/sdl/src/audio/iphoneos/SDL_coreaudio_iphone.c
rename alienblaster/project/jni/sdl/src/audio/{dc/SDL_dcaudio.h => iphoneos/SDL_coreaudio_iphone.h} (70%)
delete mode 100644 alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_it.S
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_xbios.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/nds/sound9.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/nds/soundcommon.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.c
delete mode 100644 alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.h
create mode 100644 alienblaster/project/jni/sdl/src/audio/pulseaudio/SDL_pulseaudio.c
rename alienblaster/project/jni/sdl/src/{video/ataricommon/SDL_atarimxalloc.c => audio/pulseaudio/SDL_pulseaudio.h} (61%)
create mode 100644 alienblaster/project/jni/sdl/src/audio/qsa/SDL_qsa_audio.c
rename alienblaster/project/jni/sdl/src/{video/ps2gs/SDL_gsmouse_c.h => audio/qsa/SDL_qsa_audio.h} (56%)
create mode 100755 alienblaster/project/jni/sdl/src/audio/sdlgenaudiocvt.pl
delete mode 100644 alienblaster/project/jni/sdl/src/audio/symbian/SDL_epocaudio.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/audio/symbian/SDL_epocaudio.h
delete mode 100644 alienblaster/project/jni/sdl/src/audio/symbian/streamplayer.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/audio/symbian/streamplayer.h
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/SDL_cdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/SDL_syscdrom.h
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/aix/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/beos/SDL_syscdrom.cc
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/bsdi/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/dc/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/freebsd/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/linux/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macos/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macos/SDL_syscdrom_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/AudioFilePlayer.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/AudioFilePlayer.h
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/AudioFileReaderThread.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/CDPlayer.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/CDPlayer.h
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/SDLOSXCAGuard.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/SDLOSXCAGuard.h
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/macosx/SDL_syscdrom_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/mint/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/openbsd/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/os2/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/osf/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/qnx/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/cdrom/win32/SDL_syscdrom.c
delete mode 100644 alienblaster/project/jni/sdl/src/events/SDL_active.c
delete mode 100644 alienblaster/project/jni/sdl/src/events/SDL_expose.c
create mode 100644 alienblaster/project/jni/sdl/src/events/SDL_keyboard_c.h
rename alienblaster/project/jni/sdl/src/{video/qtopia/SDL_sysmouse.cc => events/SDL_mouse_c.h} (53%)
delete mode 100644 alienblaster/project/jni/sdl/src/events/SDL_resize.c
create mode 100644 alienblaster/project/jni/sdl/src/events/SDL_windowevents.c
rename alienblaster/project/jni/sdl/src/{video/dc/SDL_dcevents_c.h => events/SDL_windowevents_c.h} (74%)
rename alienblaster/project/jni/sdl/src/{video => events}/blank_cursor.h (83%)
create mode 100644 alienblaster/project/jni/sdl/src/events/default_cursor.h
create mode 100644 alienblaster/project/jni/sdl/src/events/scancodes_darwin.h
create mode 100644 alienblaster/project/jni/sdl/src/events/scancodes_linux.h
create mode 100644 alienblaster/project/jni/sdl/src/events/scancodes_win32.h
create mode 100644 alienblaster/project/jni/sdl/src/events/scancodes_xfree86.h
create mode 100644 alienblaster/project/jni/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h
create mode 100644 alienblaster/project/jni/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m
create mode 100644 alienblaster/project/jni/sdl/src/haptic/SDL_haptic.c
create mode 100644 alienblaster/project/jni/sdl/src/haptic/SDL_syshaptic.h
create mode 100644 alienblaster/project/jni/sdl/src/haptic/darwin/SDL_syshaptic.c
create mode 100644 alienblaster/project/jni/sdl/src/haptic/dummy/SDL_syshaptic.c
create mode 100644 alienblaster/project/jni/sdl/src/haptic/linux/SDL_syshaptic.c
create mode 100644 alienblaster/project/jni/sdl/src/haptic/nds/SDL_syshaptic.c
create mode 100644 alienblaster/project/jni/sdl/src/haptic/win32/SDL_syshaptic.c
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/COPYING.LIB
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/HeadMMX.h
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/HeadX86.h
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/README
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/common.inc
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/mmx_main.asm
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/mmxp2_32.asm
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/x86_main.asm
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/x86p_16.asm
delete mode 100644 alienblaster/project/jni/sdl/src/hermes/x86p_32.asm
create mode 100644 alienblaster/project/jni/sdl/src/joystick/darwin/SDL_sysjoystick_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/joystick/dc/SDL_sysjoystick.c
create mode 100644 alienblaster/project/jni/sdl/src/joystick/iphoneos/SDLUIAccelerationDelegate.h
create mode 100644 alienblaster/project/jni/sdl/src/joystick/iphoneos/SDLUIAccelerationDelegate.m
create mode 100644 alienblaster/project/jni/sdl/src/joystick/iphoneos/SDL_sysjoystick.m
rename alienblaster/project/jni/sdl/src/{video/qtopia/SDL_sysmouse_c.h => joystick/linux/SDL_sysjoystick_c.h} (53%)
delete mode 100644 alienblaster/project/jni/sdl/src/joystick/macos/SDL_sysjoystick.c
delete mode 100644 alienblaster/project/jni/sdl/src/joystick/mint/SDL_sysjoystick.c
delete mode 100644 alienblaster/project/jni/sdl/src/joystick/os2/SDL_sysjoystick.c
delete mode 100644 alienblaster/project/jni/sdl/src/joystick/os2/joyos2.h
create mode 100644 alienblaster/project/jni/sdl/src/joystick/win32/SDL_dxjoystick.c
create mode 100644 alienblaster/project/jni/sdl/src/joystick/win32/SDL_dxjoystick_c.h
create mode 100644 alienblaster/project/jni/sdl/src/libm/e_log.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/e_pow.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/e_rem_pio2.c
rename alienblaster/project/jni/sdl/src/{video/e_sqrt.h => libm/e_sqrt.c} (78%)
create mode 100644 alienblaster/project/jni/sdl/src/libm/k_cos.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/k_rem_pio2.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/k_sin.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/math.h
rename alienblaster/project/jni/sdl/src/{video => libm}/math_private.h (54%)
create mode 100644 alienblaster/project/jni/sdl/src/libm/s_copysign.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/s_cos.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/s_fabs.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/s_floor.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/s_scalbn.c
create mode 100644 alienblaster/project/jni/sdl/src/libm/s_sin.c
delete mode 100644 alienblaster/project/jni/sdl/src/loadso/macos/SDL_sysloadso.c
delete mode 100644 alienblaster/project/jni/sdl/src/loadso/mint/SDL_sysloadso.c
delete mode 100644 alienblaster/project/jni/sdl/src/loadso/os2/SDL_sysloadso.c
delete mode 100644 alienblaster/project/jni/sdl/src/main/macos/SDL.r
delete mode 100644 alienblaster/project/jni/sdl/src/main/macos/SDL.shlib.r
delete mode 100644 alienblaster/project/jni/sdl/src/main/macos/SDL_main.c
delete mode 100644 alienblaster/project/jni/sdl/src/main/macos/SIZE.r
delete mode 100644 alienblaster/project/jni/sdl/src/main/macos/exports/Makefile
delete mode 100644 alienblaster/project/jni/sdl/src/main/macos/exports/SDL.x
delete mode 100644 alienblaster/project/jni/sdl/src/main/macos/exports/gendef.pl
delete mode 100644 alienblaster/project/jni/sdl/src/main/macosx/Info.plist.in
delete mode 100644 alienblaster/project/jni/sdl/src/main/macosx/SDLMain.h
delete mode 100644 alienblaster/project/jni/sdl/src/main/macosx/SDLMain.m
delete mode 100644 alienblaster/project/jni/sdl/src/main/macosx/SDLMain.nib/classes.nib
delete mode 100644 alienblaster/project/jni/sdl/src/main/macosx/SDLMain.nib/info.nib
delete mode 100644 alienblaster/project/jni/sdl/src/main/macosx/SDLMain.nib/objects.nib
delete mode 100644 alienblaster/project/jni/sdl/src/main/macosx/info.nib
delete mode 100644 alienblaster/project/jni/sdl/src/main/qtopia/SDL_qtopia_main.cc
delete mode 100644 alienblaster/project/jni/sdl/src/main/symbian/EKA1/SDL_main.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/main/symbian/EKA2/SDL_main.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/main/symbian/EKA2/sdlexe.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/main/symbian/EKA2/sdllib.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/main/symbian/EKA2/vectorbuffer.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/main/symbian/EKA2/vectorbuffer.h
create mode 100644 alienblaster/project/jni/sdl/src/power/SDL_power.c
create mode 100644 alienblaster/project/jni/sdl/src/power/beos/SDL_syspower.c
create mode 100644 alienblaster/project/jni/sdl/src/power/linux/SDL_syspower.c
create mode 100644 alienblaster/project/jni/sdl/src/power/macosx/SDL_syspower.c
create mode 100644 alienblaster/project/jni/sdl/src/power/nds/SDL_syspower.c
create mode 100644 alienblaster/project/jni/sdl/src/power/uikit/SDL_syspower.m
create mode 100644 alienblaster/project/jni/sdl/src/power/windows/SDL_syspower.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/dc/SDL_syscond.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/dc/SDL_sysmutex.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/dc/SDL_syssem.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/dc/SDL_systhread_c.h
create mode 100644 alienblaster/project/jni/sdl/src/thread/nds/SDL_syscond.c
rename alienblaster/project/jni/sdl/src/thread/{dc => nds}/SDL_syscond_c.h (83%)
create mode 100644 alienblaster/project/jni/sdl/src/thread/nds/SDL_sysmutex.c
rename alienblaster/project/jni/sdl/src/thread/{dc => nds}/SDL_sysmutex_c.h (83%)
create mode 100644 alienblaster/project/jni/sdl/src/thread/nds/SDL_syssem.c
rename alienblaster/project/jni/sdl/src/thread/{dc => nds}/SDL_syssem_c.h (83%)
rename alienblaster/project/jni/sdl/src/thread/{dc => nds}/SDL_systhread.c (59%)
rename alienblaster/project/jni/sdl/{include/SDL_getenv.h => src/thread/nds/SDL_systhread_c.h} (82%)
delete mode 100644 alienblaster/project/jni/sdl/src/thread/os2/SDL_syscond.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/os2/SDL_syscond_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/thread/os2/SDL_sysmutex.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/os2/SDL_syssem.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/os2/SDL_systhread.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/os2/SDL_systhread_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/thread/pth/SDL_syscond.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/pth/SDL_sysmutex.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/pth/SDL_systhread.c
delete mode 100644 alienblaster/project/jni/sdl/src/thread/pth/SDL_systhread_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/thread/symbian/SDL_sysmutex.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/thread/symbian/SDL_syssem.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/thread/symbian/SDL_systhread.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/thread/symbian/SDL_systhread_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/timer/dc/SDL_systimer.c
delete mode 100644 alienblaster/project/jni/sdl/src/timer/macos/FastTimes.c
delete mode 100644 alienblaster/project/jni/sdl/src/timer/macos/FastTimes.h
delete mode 100644 alienblaster/project/jni/sdl/src/timer/macos/SDL_MPWtimer.c
delete mode 100644 alienblaster/project/jni/sdl/src/timer/macos/SDL_systimer.c
delete mode 100644 alienblaster/project/jni/sdl/src/timer/mint/SDL_systimer.c
delete mode 100644 alienblaster/project/jni/sdl/src/timer/mint/SDL_vbltimer.S
delete mode 100644 alienblaster/project/jni/sdl/src/timer/mint/SDL_vbltimer_s.h
delete mode 100644 alienblaster/project/jni/sdl/src/timer/os2/SDL_systimer.c
delete mode 100644 alienblaster/project/jni/sdl/src/timer/symbian/SDL_systimer.cpp
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_alphamult.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_alphamult.h
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blendfillrect.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blendline.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blendpoint.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blendrect.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blit_auto.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blit_auto.h
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blit_copy.c
rename alienblaster/project/jni/sdl/{include/SDL_byteorder.h => src/video/SDL_blit_copy.h} (83%)
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_blit_slow.c
rename alienblaster/project/jni/sdl/src/video/{dga/SDL_dgamouse_c.h => SDL_blit_slow.h} (87%)
delete mode 100644 alienblaster/project/jni/sdl/src/video/SDL_cursor.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/SDL_cursor_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_draw.h
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_drawline.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_drawpoint.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_drawrect.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_fillrect.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_glesfuncs.h
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_rect.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_rect_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_renderer_gl.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_renderer_gl.h
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_renderer_gles.c
rename alienblaster/project/jni/sdl/src/video/{macrom/SDL_romvideo.h => SDL_renderer_gles.h} (84%)
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_renderer_sw.c
create mode 100644 alienblaster/project/jni/sdl/src/video/SDL_renderer_sw.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/SDL_stretch_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/SDL_yuv.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/SDL_yuvfuncs.h
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/AllCmap.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/CmapAlloc.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/CrCmap.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/DelCmap.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/Distinct.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/LookupCmap.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/StdCmap.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/XmuStdCmap/VisCmap.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/Xext/Xxf86dga/XF86DGA.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/Xext/Xxf86dga/XF86DGA2.c
create mode 100644 alienblaster/project/jni/sdl/src/video/Xext/extensions/StdCmap.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/Xext/extensions/xme.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/aalib/SDL_aaevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/aalib/SDL_aaevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/aalib/SDL_aavideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/aalib/SDL_aavideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_ataric2p.S
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_ataric2p_s.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_ataridevmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarieddi.S
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarieddi_s.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarievents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarievents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarigl.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarigl_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarikeys.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_biosevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_biosevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_gemdosevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_gemdosevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_ikbdevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_ikbdevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_ikbdinterrupt.S
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_ikbdinterrupt_s.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_xbiosevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_xbiosevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_xbiosinterrupt.S
delete mode 100644 alienblaster/project/jni/sdl/src/video/ataricommon/SDL_xbiosinterrupt_s.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/caca/SDL_cacaevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/caca/SDL_cacaevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/caca/SDL_cacavideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/caca/SDL_cacavideo.h
rename alienblaster/project/jni/sdl/src/video/{dummy/SDL_nullmouse.c => cocoa/SDL_cocoaevents.h} (78%)
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoaevents.m
rename alienblaster/project/jni/sdl/src/{audio/dc/aica.h => video/cocoa/SDL_cocoakeyboard.h} (65%)
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoakeyboard.m
rename alienblaster/project/jni/sdl/src/video/{vgl/SDL_vglmouse.c => cocoa/SDL_cocoamodes.h} (58%)
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoamodes.m
rename alienblaster/project/jni/sdl/src/video/{dga/SDL_dgamouse.c => cocoa/SDL_cocoamouse.h} (74%)
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoamouse.m
rename alienblaster/project/jni/sdl/src/video/{maccommon/SDL_macgl_c.h => cocoa/SDL_cocoaopengl.h} (50%)
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoaopengl.m
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoavideo.h
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoavideo.m
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoawindow.h
create mode 100644 alienblaster/project/jni/sdl/src/video/cocoa/SDL_cocoawindow.m
delete mode 100644 alienblaster/project/jni/sdl/src/video/dc/SDL_dcevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/dc/SDL_dcvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/default_cursor.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/dga/SDL_dgaevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/dga/SDL_dgavideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/dga/SDL_dgavideo.h
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_WM.c
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_WM.h
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_dyn.c
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_dyn.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_keys.h
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_modes.c
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_modes.h
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_mouse.c
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_mouse.h
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_opengl.c
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_opengl.h
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_render.c
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_render.h
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_window.c
create mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_window.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/directfb/SDL_DirectFB_yuv.c
create mode 100644 alienblaster/project/jni/sdl/src/video/dummy/SDL_nullrender.c
rename alienblaster/project/jni/sdl/src/video/{ggi/SDL_ggievents_c.h => dummy/SDL_nullrender_c.h} (83%)
mode change 100755 => 100644
delete mode 100644 alienblaster/project/jni/sdl/src/video/e_log.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/e_pow.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/gapi/SDL_gapivideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/gapi/SDL_gapivideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemmouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemwm.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/gem/SDL_gemwm_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ggi/SDL_ggievents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ggi/SDL_ggikeys.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ggi/SDL_ggimouse.c
delete mode 100755 alienblaster/project/jni/sdl/src/video/ggi/SDL_ggimouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ggi/SDL_ggivideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ipod/SDL_ipodvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_lowvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_macevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_macevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_macgl.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_mackeys.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_macmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_macmouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_macwm.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/maccommon/SDL_macwm_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/macdsp/SDL_dspvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/macdsp/SDL_dspvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/macrom/SDL_romvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nximage.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nximage_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxmodes.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxmodes_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxmouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxwm.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nanox/SDL_nxwm_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/nds/SDL_ndsmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/nds/SDL_ndsmouse_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/nds/SDL_ndsrender.c
create mode 100644 alienblaster/project/jni/sdl/src/video/nds/SDL_ndsrender_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/os2fslib/SDL_os2fslib.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/os2fslib/SDL_os2fslib.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/os2fslib/SDL_vkeys.h
create mode 100644 alienblaster/project/jni/sdl/src/video/pandora/SDL_pandora.c
create mode 100644 alienblaster/project/jni/sdl/src/video/pandora/SDL_pandora.h
rename alienblaster/project/jni/sdl/src/video/{dc/SDL_dcmouse.c => pandora/SDL_pandora_events.c} (76%)
rename alienblaster/project/jni/sdl/src/video/{dc/SDL_dcmouse_c.h => pandora/SDL_pandora_events.h} (88%)
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_events.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_gl.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_gl.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_image.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_image_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_modes.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_modes_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_mouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_mouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_video.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_video.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_wm.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_ph_wm_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_photon.c
create mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_photon.h
create mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_photon_input.c
rename alienblaster/project/jni/sdl/src/video/{picogui/SDL_pgvideo.h => photon/SDL_photon_input.h} (58%)
create mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_photon_keycodes.h
create mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_photon_pixelfmt.c
rename alienblaster/project/jni/sdl/src/video/{ggi/SDL_ggivideo.h => photon/SDL_photon_pixelfmt.h} (61%)
create mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_photon_render.c
create mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_photon_render.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_phyuv.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/photon/SDL_phyuv_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/picogui/SDL_pgevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/picogui/SDL_pgevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/picogui/SDL_pgvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gskeys.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsyuv.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsyuv_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3modes.c
create mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3modes_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3render.c
create mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3render_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3spe.c
create mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3spe_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3yuv.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/ps3/SDL_ps3yuv_c.h
rename alienblaster/project/jni/sdl/src/video/ps3/spulibs/{yuv2rgb_converter.c => yuv2rgb.c} (94%)
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_gf_input.c
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_gf_input.h
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_gf_opengles.c
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_gf_opengles.h
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_gf_pixelfmt.c
rename alienblaster/project/jni/sdl/src/video/{dc/SDL_dcvideo.h => qnxgf/SDL_gf_pixelfmt.h} (67%)
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_gf_render.c
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_gf_render.h
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_hiddi_joystick.h
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_hiddi_keyboard.h
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_hiddi_mouse.h
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_qnxgf.c
create mode 100644 alienblaster/project/jni/sdl/src/video/qnxgf/SDL_qnxgf.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_QPEApp.cc
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_QPEApp.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_QWin.cc
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_QWin.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_lowvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_sysevents.cc
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_sysevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/qtopia/SDL_sysvideo.cc
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/CGS.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzEvents.m
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzGL.m
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzKeys.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzVideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzVideo.m
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzWM.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzWM.m
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzWindow.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/quartz/SDL_QuartzWindow.m
create mode 100755 alienblaster/project/jni/sdl/src/video/sdlgenblit.pl
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA1/SDL_epocevents.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA1/SDL_epocvideo.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA1/SDL_epocvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA2/SDL_epocevents.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA2/SDL_epocvideo.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA2/SDL_epocvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA2/dsa.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA2/dsa_new.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/EKA2/dsa_old.cpp
delete mode 100644 alienblaster/project/jni/sdl/src/video/symbian/SDL_epocevents_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitappdelegate.h
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitappdelegate.m
rename alienblaster/project/jni/sdl/src/video/{dummy/SDL_nullmouse_c.h => uikit/SDL_uikitevents.h} (85%)
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitevents.m
rename alienblaster/project/jni/sdl/src/video/{photon/SDL_ph_events_c.h => uikit/SDL_uikitkeyboard.h} (68%)
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitopengles.h
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitopengles.m
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitopenglview.h
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitopenglview.m
rename alienblaster/project/jni/sdl/src/video/{aalib/SDL_aamouse.c => uikit/SDL_uikitvideo.h} (76%)
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitvideo.m
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitview.h
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitview.m
rename alienblaster/project/jni/sdl/src/video/{ataricommon/SDL_ataridevmouse_c.h => uikit/SDL_uikitwindow.h} (65%)
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/SDL_uikitwindow.m
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/jumphack.c
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/jumphack.h
create mode 100644 alienblaster/project/jni/sdl/src/video/uikit/keyinfotable.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/vgl/SDL_vglevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/vgl/SDL_vglevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/vgl/SDL_vglmouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/vgl/SDL_vglvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/vgl/SDL_vglvideo.h
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_ceddrawrender.c
rename alienblaster/project/jni/sdl/src/video/{dga/SDL_dgaevents_c.h => win32/SDL_ceddrawrender.h} (81%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_d3drender.c
rename alienblaster/project/jni/sdl/src/video/{aalib/SDL_aamouse_c.h => win32/SDL_d3drender.h} (85%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_gapirender.c
rename alienblaster/project/jni/sdl/src/video/{ipod/SDL_ipodvideo.h => win32/SDL_gapirender.h} (78%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_gapirender_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_gdirender.c
rename alienblaster/project/jni/sdl/src/video/{qtopia/SDL_syswm_c.h => win32/SDL_gdirender.h} (81%)
rename alienblaster/project/jni/sdl/src/video/{windib => win32}/SDL_vkeys.h (96%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32events.c
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32events.h
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32gamma.c
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32gamma.h
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32keyboard.c
rename alienblaster/project/jni/sdl/src/{cdrom/dummy/SDL_syscdrom.c => video/win32/SDL_win32keyboard.h} (71%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32modes.c
rename alienblaster/project/jni/sdl/src/video/{directfb/SDL_DirectFB_yuv.h => win32/SDL_win32modes.h} (59%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32mouse.c
rename alienblaster/project/jni/sdl/src/video/{qtopia/SDL_syswm.cc => win32/SDL_win32mouse.h} (79%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32opengl.c
rename alienblaster/project/jni/sdl/src/video/{wincommon/SDL_wingl_c.h => win32/SDL_win32opengl.h} (63%)
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32video.c
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32video.h
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32window.c
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/SDL_win32window.h
create mode 100644 alienblaster/project/jni/sdl/src/video/win32/wmmsg.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/SDL_lowvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/SDL_sysevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/SDL_sysmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/SDL_sysmouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/SDL_syswm.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/SDL_syswm_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/SDL_wingl.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/wincommon/wmmsg.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/windib/SDL_dibevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/windib/SDL_dibevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/windib/SDL_dibvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/windib/SDL_dibvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/windib/SDL_gapidibvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/windx5/SDL_dx5events.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/windx5/SDL_dx5events_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/windx5/SDL_dx5video.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/windx5/SDL_dx5video.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/windx5/SDL_dx5yuv.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/windx5/SDL_dx5yuv_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/windx5/directx.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/wscons/SDL_wsconsevents.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/wscons/SDL_wsconsevents_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/wscons/SDL_wsconsmouse.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/wscons/SDL_wsconsmouse_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/wscons/SDL_wsconsvideo.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/wscons/SDL_wsconsvideo.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11dga.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11dga_c.h
rename alienblaster/project/jni/sdl/src/video/x11/{SDL_x11events_c.h => SDL_x11events.h} (81%)
rename alienblaster/project/jni/sdl/src/video/x11/{SDL_x11gamma_c.h => SDL_x11gamma.h} (64%)
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11gl.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11gl_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11image.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11image_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11keyboard.c
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11keyboard.h
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11modes.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11modes_c.h
rename alienblaster/project/jni/sdl/src/video/{ataricommon/SDL_atarimxalloc_c.h => x11/SDL_x11mouse.h} (63%)
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11mouse_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11opengl.c
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11opengl.h
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11opengles.c
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11opengles.h
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11render.c
rename alienblaster/project/jni/sdl/src/{thread/pth/SDL_sysmutex_c.h => video/x11/SDL_x11render.h} (81%)
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11window.c
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11window.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11wm.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11wm_c.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11yuv.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/x11/SDL_x11yuv_c.h
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/imKStoUCS.c
create mode 100644 alienblaster/project/jni/sdl/src/video/x11/imKStoUCS.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_blowup.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_blowup.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_centscreen.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_centscreen.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_milan.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_milan.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_sb3.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_sb3.h
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_tveille.c
delete mode 100644 alienblaster/project/jni/sdl/src/video/xbios/SDL_xbios_tveille.h
diff --git a/alienblaster/project/jni/application/src/settings.cpp b/alienblaster/project/jni/application/src/settings.cpp
index c582adb6a..fd9883082 100644
--- a/alienblaster/project/jni/application/src/settings.cpp
+++ b/alienblaster/project/jni/application/src/settings.cpp
@@ -409,8 +409,8 @@ void Settings::getNewKeyFromUser() {
const PlayerKeys Settings::getPlayerKeys(unsigned int player) const {
assert( player < playerKeys.size() );
PlayerKeys pk;
- for(int i=SDLK_FIRST; i <= SDLK_LAST; ++i) {
- pk[ (SDLKey)i ] = PE_UNKNOWN;
+ for( std::map< SDLKey, std::string > :: const_iterator i = keyName.begin(); i != keyName.end(); ++i ) {
+ pk[ i->first ] = PE_UNKNOWN;
}
std::map< PlayerEvent, SDLKey >::const_iterator pkiter;
for(pkiter = playerKeys[player].begin(); pkiter != playerKeys[player].end(); ++pkiter) {
diff --git a/alienblaster/project/jni/sdl/Android.mk b/alienblaster/project/jni/sdl/Android.mk
index dea3fbe56..de477f6d5 100644
--- a/alienblaster/project/jni/sdl/Android.mk
+++ b/alienblaster/project/jni/sdl/Android.mk
@@ -17,22 +17,34 @@ LOCAL_CFLAGS := -I$(LOCAL_PATH)/include \
SDL_SRCS := \
src/*.c \
src/audio/*.c \
- src/cdrom/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
+ src/haptic/*.c \
src/joystick/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/timer/*.c \
src/video/*.c \
- src/audio/android/*.c \
- src/video/android/*.c \
- src/joystick/dummy/*.c \
- src/cdrom/dummy/*.c \
+ src/main/*.c \
+ src/power/*.c \
src/thread/pthread/*.c \
src/timer/unix/*.c \
- src/loadso/dummy/*.c \
+ src/audio/android/*.c \
+ src/audio/dummy/*.c \
+ src/video/android/*.c \
+ src/joystick/dummy/*.c \
+ src/haptic/dummy/*.c \
+ src/loadso/dlopen/*.c \
+ src/atomic/dummy/*.c \
+
+# TODO: use libcutils for atomic operations, but it's not included in NDK
+
+# src/atomic/linux/*.c \
+# src/power/linux/*.c \
+# src/joystick/android/*.c \
+# src/haptic/android/*.c \
+# src/libm/*.c \
LOCAL_CPP_EXTENSION := .cpp
diff --git a/alienblaster/project/jni/sdl/Borland.html b/alienblaster/project/jni/sdl/Borland.html
deleted file mode 100644
index eaf82099d..000000000
--- a/alienblaster/project/jni/sdl/Borland.html
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
- Building SDL with Borland's C++ compilers
-
-
-
-
-
-Building SDL with Borland's C++ compilers.
- by David Snopek
- and updated by Dominique
- Louis ( Last updated : 30th June 2003 ).
-
- These instructions cover how to compile SDL and its included test
-programs using either Borland C++ Builder 5, 6 for Windows,
- C++ Builder for Linux ( AKA Kylix 3 ) or the free Borland C++ command-line compiler.
-
- Extract the files
-
- Unzip the Borland.zip archive into this directory. Do not unzip
- it into any other directory because the makefiles ( *.mak ) and project
- files ( *.bpr ) use relative paths to refer to the SDL sources. This should
- create a directory named "Borland" inside of the top level SDL source directory.
-
-
- Using Borland C++ Builder 5, 6 for Windows
-
-
- Inside of the "Borland" directory there is a "bcb6" directory that contains
- a number of Builder project files. Double-click on the "libSDL.bpg" file
- icon. Once Builder has started click on the "Projects" menu on
-the menu-bar and go down to "Build All Projects" option.
- This will proceed to build SDL ( with Borland's calling convention ),
-SDLmain, and all the test programs. Currently, all
-the test programs are dynamically linked to Sam Lantinga's
-SDL.dll.
-
-NOTE : Borland's "lib" format and Microsoft's "lib" format are incompatible.
-
- If you wish to dynamically link to the SDL library supplied by Sam Lantinga
- in each release, I have created the correct *.libs for SDL 1.2.4 and they
- exist in the "/lib" directory.
- If you would like to create the *.lib files yourself, you will need to
-make use of Borland's "implib.exe" utility.
-
-
-IMPLIB works like this:
-
- IMPLIB (destination lib name) (source dll)
-
- For example,
-
- IMPLIB SDL.lib SDL.dll
-
-This assumes that SDL.dll was compiled with Visual C++ or similar.
-
-
-To learn more about the difference between Borland's and Microsoft's *.lib
- format please read the article here.
-
-
-
- NOTE : The C++ Builder for Windows project format, is not compatible
- with the Kylix 3 project format, hence the reason why they are in separate
- directories.
-
- Using the free Borland C++ command-line compiler
-
-
- The free Borland compiler can be downloaded at no charge from the Borland website
- . Make sure that it is installed and properly configured.
-
- Open an MS-DOS Prompt. Change to the "Borland\freebcc" directory under
- the SDL source directory. Type "make -f SDL.mak" to build SDL and "make
- -f SDLmain.mak". There are also makefiles for all of the test programs, if you wish to build them. All .exes and
-DLLs are created in the "test" SDL directory. Ify ou would like to create
-the DLL and all the test applications, I have thrown together a basic batchfile
-called "makeall.bat" which should create everything in the right order.
-
- Output files
- No matter which compiler you used, three important files should have
- been produced:
-
- - SDL.dll ( Borland format )
- - SDL.lib ( Borland format )
- - SDLmain.lib ( Borland format )
-
-
- Both of the *.lib files will need to be added to all the projects
-that use SDL and SDL.dll must be placed some where the Windows dynamic
-linker can find it (either in your project directory or on the system
-path, C:\WINDOWS\SYSTEM).
- Using Borland C++ Builder for Linux ( AKA Kylix
- 3 )
-
- Inside of the "Borland" directory there is a "k3" directory that contains
- a number of Builder project files. Double-click on the "libSDL.bpg" file
- icon. Once Builder has started click on the "Projects" menu on
-the menu-bar and go down to "Build All Projects" option. This will
-proceed to build all the test programs.
- Linux users do not need *.lib files as the Shared Object is linked right
- into the project ( very neat actually, Windows should do this sort of thing
- as it is a lot easier for the developer ).
- NOTE : The C++ Builder for Windows project format, is not
- compatible with the Kylix 3 project format, hence the reason why they are
- in separate directories.
-
- On Mandrake 8.1 the shared objects for SDL are located in the /usr/lib
- directory as libSDL_*.so and the Mesa OpenGL shared objects are located
-in /usr/X11R6/lib as libGL*.so
-
- So if your setup is different you may need to change the project file
- so that they re-link to the ones on your system.
-
- On Mandrake 8.1 the headers files are located at /usr/include/SDL/.
- So if you you have not installed the development RPMs ( usually named libSDL-devel*
- ) for SDL ( not included ) you may have to change the include directory
- within some of the projects.
-
-
- Known Problems
- The only known problem is that I ( Dominique Louis ), was unable to
-create the projects that rebuilt the SDL shared objects under Linux, due
-to time constraints and my lack of intimate knowledge of Linux.
-
- Some of the test programs require included media files ( *.wav; *.bmp
-etc ). All the test programs are now created in the "test" directory, where
-the media files are ( usually ) so they should be ready to go.
-
-
-
-
-
diff --git a/alienblaster/project/jni/sdl/CREDITS b/alienblaster/project/jni/sdl/CREDITS
index efdcfa4d7..29dd032c9 100644
--- a/alienblaster/project/jni/sdl/CREDITS
+++ b/alienblaster/project/jni/sdl/CREDITS
@@ -5,72 +5,51 @@ Thanks to everyone who made this possible, including:
* Cliff Matthews, for giving me a reason to start this project. :)
-- Executor rocks! *grin*
-* Scott Call, for making a home for SDL on the 'Net... Thanks! :)
-
* The Linux Fund, C Magazine, Educational Technology Resources Inc.,
Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson,
Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker,
and Phoenix Kokido for financial contributions
+* Edgar "bobbens" Simo for his force feedback API development during the
+ Google Summer of Code 2008
+
+* Aaron Wishnick for his work on audio resampling and pitch shifting during
+ the Google Summer of Code 2008
+
+* Holmes Futrell for port of SDL to the iPhone and iPod Touch during the
+ Google Summer of Code 2008
+
+* Darren Alton for port of SDL to the Nintendo DS during the Google Summer
+ of Code 2008
+
+* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
+ during the Google Summer of Code 2008
+
+* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni,
+ Dmytro Bogovych, and Couriersud for helping find SDL 1.3 bugs in the great
+ SDL Bug Hunt of January 2009!
+
+* Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of
+ January 2009!
+
+* Luke Benstead for OpenGL 3.0 support
+
* Gaëtan de Menten for writing the PHP and SQL behind the SDL website
* Tim Jones for the new look of the SDL website
-* Marco Kraus for setting up SDL merchandise
-
-* Martin Donlon for his work on the SDL Documentation Project
-
* Ryan Gordon for helping everybody out and keeping the dream alive. :)
-* IBM R&D Lab for their PS3 SPE video acceleration code
-
* Mattias Engdegård, for help with the Solaris port and lots of other help
-* Max Watson, Matt Slot, and Kyle for help with the MacOS Classic port
-
-* Stan Shebs, for the initial Mac OS X port
-
* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port
-* Patrick Trainor, Jim Boucher, and Mike Gorchak for the QNX Neutrino port
+* David Carré, for the Pandora port
-* Carsten Griwodz for the AIX port
-
-* Gabriele Greco, for the Amiga port
-
-* Patrice Mandin, for the Atari port
-
-* Hannu Viitala for the EPOC port
-
-* Marcus Mertama for the S60 port.
-
-* Peter Valchev for nagging me about the OpenBSD port until I got it right. :)
-
-* Kent B Mein, for a place to do the IRIX port
-
-* Ash, for a place to do the OSF/1 Alpha port
-
-* David Sowsy, for help with the BeOS port
-
-* Eugenia Loli, for endless work on porting SDL games to BeOS
-
-* Jon Taylor for the GGI front-end
-
-* Paulus Esterhazy, for the Visual C++ testing and libraries
-
-* Brenda Tantzen, for Metrowerks CodeWarrior on MacOS
-
-* Chris Nentwich, for the Hermes assembly blitters
-
-* Michael Vance and Jim Kutter for the X11 OpenGL support
-
-* Stephane Peter, for the AAlib front-end and multi-threaded timer idea.
+* Couriersud for the DirectFB driver
* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
-* Peter Wiklund, for the 1998 winning SDL logo,
- and Arto Hamara, Steven Wong, and Kent Mein for other logo entries.
-
* Arne Claus, for the 2004 winning SDL logo,
and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann,
Daniel Liljeberg, Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella,
diff --git a/alienblaster/project/jni/sdl/INSTALL b/alienblaster/project/jni/sdl/INSTALL
index 1a30fba00..2f40e0c41 100644
--- a/alienblaster/project/jni/sdl/INSTALL
+++ b/alienblaster/project/jni/sdl/INSTALL
@@ -1,6 +1,10 @@
To compile and install SDL:
+ 0. If you have downloaded this from the website, skip to the next step.
+ If you have checked this out from subversion, you'll need to run
+ ./autogen.sh to build the configure script.
+
1. Run './configure; make; make install'
If you are compiling for Windows using gcc, read the FAQ at:
diff --git a/alienblaster/project/jni/sdl/Makefile.dc b/alienblaster/project/jni/sdl/Makefile.dc
deleted file mode 100644
index 58d6e712d..000000000
--- a/alienblaster/project/jni/sdl/Makefile.dc
+++ /dev/null
@@ -1,111 +0,0 @@
-#GL=1
-
-CC = sh-elf-gcc
-AR = sh-elf-ar
-
-ifdef GL
-DEFS += -DSDL_VIDEO_OPENGL=1
-TARGET = libSDL_gl.a
-else
-TARGET = libSDL.a
-endif
-
-CFLAGS=$(KOS_CFLAGS) $(DEFS) -Iinclude
-
-SRCS = \
- src/audio/dc/SDL_dcaudio.c \
- src/audio/dc/aica.c \
- src/audio/dummy/SDL_dummyaudio.c \
- src/audio/SDL_audio.c \
- src/audio/SDL_audiocvt.c \
- src/audio/SDL_audiodev.c \
- src/audio/SDL_mixer.c \
- src/audio/SDL_wave.c \
- src/cdrom/dc/SDL_syscdrom.c \
- src/cdrom/SDL_cdrom.c \
- src/events/SDL_active.c \
- src/events/SDL_events.c \
- src/events/SDL_expose.c \
- src/events/SDL_keyboard.c \
- src/events/SDL_mouse.c \
- src/events/SDL_quit.c \
- src/events/SDL_resize.c \
- src/file/SDL_rwops.c \
- src/joystick/dc/SDL_sysjoystick.c \
- src/joystick/SDL_joystick.c \
- src/loadso/dummy/SDL_sysloadso.c \
- src/SDL.c \
- src/SDL_error.c \
- src/SDL_fatal.c \
- src/stdlib/SDL_getenv.c \
- src/stdlib/SDL_iconv.c \
- src/stdlib/SDL_malloc.c \
- src/stdlib/SDL_qsort.c \
- src/stdlib/SDL_stdlib.c \
- src/stdlib/SDL_string.c \
- src/thread/dc/SDL_syscond.c \
- src/thread/dc/SDL_sysmutex.c \
- src/thread/dc/SDL_syssem.c \
- src/thread/dc/SDL_systhread.c \
- src/thread/SDL_thread.c \
- src/timer/dc/SDL_systimer.c \
- src/timer/SDL_timer.c \
- src/video/dc/SDL_dcevents.c \
- src/video/dc/SDL_dcvideo.c \
- src/video/dummy/SDL_nullevents.c \
- src/video/dummy/SDL_nullmouse.c \
- src/video/dummy/SDL_nullvideo.c \
- src/video/SDL_blit.c \
- src/video/SDL_blit_0.c \
- src/video/SDL_blit_1.c \
- src/video/SDL_blit_A.c \
- src/video/SDL_blit_N.c \
- src/video/SDL_bmp.c \
- src/video/SDL_cursor.c \
- src/video/SDL_gamma.c \
- src/video/SDL_pixels.c \
- src/video/SDL_RLEaccel.c \
- src/video/SDL_stretch.c \
- src/video/SDL_surface.c \
- src/video/SDL_video.c \
- src/video/SDL_yuv.c \
- src/video/SDL_yuv_sw.c \
-
-OBJS = $(SRCS:.c=.o)
-
-TEST = \
- test/checkkeys.c \
- test/graywin.c \
- test/loopwave.c \
- test/testalpha.c \
- test/testbitmap.c \
- test/testcdrom.c \
- test/testerror.c \
- test/testgamma.c \
- test/testgl.c \
- test/testhread.c \
- test/testjoystick.c \
- test/testkeys.c \
- test/testlock.c \
- test/testoverlay.c \
- test/testpalette.c \
- test/testsem.c \
- test/testsprite.c \
- test/testtimer.c \
- test/testtypes.c \
- test/testver.c \
- test/testvidinfo.c \
- test/testwin.c \
- test/testwm.c \
- test/threadwin.c \
- test/torturethread.c \
-
-$(TARGET): copy_config \
- $(OBJS)
- $(AR) rcs $(TARGET) $(OBJS)
-
-copy_config:
- @cp include/SDL_config.h.default include/SDL_config.h
-
-clean:
- rm -f include/SDL_config.h $(OBJS)
diff --git a/alienblaster/project/jni/sdl/Makefile.in b/alienblaster/project/jni/sdl/Makefile.in
deleted file mode 100644
index e29dc6db4..000000000
--- a/alienblaster/project/jni/sdl/Makefile.in
+++ /dev/null
@@ -1,183 +0,0 @@
-# Makefile to build and install the SDL library
-
-top_builddir = .
-srcdir = @srcdir@
-objects = build
-depend = build-deps
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-includedir = @includedir@
-datarootdir = @datarootdir@
-datadir = @datadir@
-mandir = @mandir@
-auxdir = @ac_aux_dir@
-distpath = $(srcdir)/..
-distdir = SDL-@SDL_VERSION@
-distfile = $(distdir).tar.gz
-
-@SET_MAKE@
-SHELL = @SHELL@
-CC = @CC@
-INCLUDE = @INCLUDE@
-CFLAGS = @BUILD_CFLAGS@
-EXTRA_CFLAGS = @EXTRA_CFLAGS@
-LDFLAGS = @BUILD_LDFLAGS@
-EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
-LIBTOOL = @LIBTOOL@
-INSTALL = @INSTALL@
-NASM = @NASM@ @NASMFLAGS@
-AR = @AR@
-RANLIB = @RANLIB@
-WINDRES = @WINDRES@
-
-TARGET = libSDL.la
-SOURCES = @SOURCES@
-OBJECTS = @OBJECTS@
-
-SDLMAIN_TARGET = libSDLmain.a
-SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
-SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
-
-DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in MPWmake.sea.bin README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip symbian.zip WhatsNew Xcode.tar.gz
-
-HDRS = SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
-
-LT_AGE = @LT_AGE@
-LT_CURRENT = @LT_CURRENT@
-LT_RELEASE = @LT_RELEASE@
-LT_REVISION = @LT_REVISION@
-LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-
-all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
-
-$(srcdir)/configure: $(srcdir)/configure.in
- @echo "Warning, configure.in is out of date"
- #(cd $(srcdir) && sh autogen.sh && sh configure)
- @sleep 3
-
-Makefile: $(srcdir)/Makefile.in
- $(SHELL) config.status $@
-
-$(objects):
- $(SHELL) $(auxdir)/mkinstalldirs $@
-
-.PHONY: all depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist
-depend:
- @SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
- $(SHELL) $(auxdir)/makedep.sh
- @for src in $(SDLMAIN_SOURCES); do \
- obj=`echo $$src | sed -e 's|.*/||' -e 's|\.[^\.]*$$|.o|'`; \
- echo "\$$(objects)/$$obj: $$src" >>$(depend); \
- echo " \$$(CC) \$$(CFLAGS) \$$(EXTRA_CFLAGS) -c $$src -o \$$@" >>$(depend); \
- done
-
-include $(depend)
-
-$(objects)/$(TARGET): $(OBJECTS)
- $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
-
-$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
- $(AR) cru $@ $(SDLMAIN_OBJECTS)
- $(RANLIB) $@
-
-install: all install-bin install-hdrs install-lib install-data install-man
-install-bin:
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
- $(INSTALL) -m 755 sdl-config $(DESTDIR)$(bindir)/sdl-config
-install-hdrs:
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL
- for file in $(HDRS); do \
- $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
- done
- $(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
-install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
- $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
- $(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
- $(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
-install-data:
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
- $(INSTALL) -m 644 $(srcdir)/sdl.m4 $(DESTDIR)$(datadir)/aclocal/sdl.m4
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
- $(INSTALL) -m 644 sdl.pc $(DESTDIR)$(libdir)/pkgconfig
-install-man:
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(mandir)/man3
- for src in $(srcdir)/docs/man3/*.3; do \
- file=`echo $$src | sed -e 's|^.*/||'`; \
- $(INSTALL) -m 644 $$src $(DESTDIR)$(mandir)/man3/$$file; \
- done
-
-uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man
-uninstall-bin:
- rm -f $(DESTDIR)$(bindir)/sdl-config
-uninstall-hdrs:
- for file in $(HDRS); do \
- rm -f $(DESTDIR)$(includedir)/SDL/$$file; \
- done
- rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h
- -rmdir $(DESTDIR)$(includedir)/SDL
-uninstall-lib:
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
- rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
-uninstall-data:
- rm -f $(DESTDIR)$(datadir)/aclocal/sdl.m4
- rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl.pc
-uninstall-man:
- for src in $(srcdir)/docs/man3/*.3; do \
- file=`echo $$src | sed -e 's|^.*/||'`; \
- rm -f $(DESTDIR)$(mandir)/man3/$$file; \
- done
-
-clean:
- rm -rf $(objects)
- if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
-
-distclean: clean
- rm -f Makefile include/SDL_config.h sdl-config
- rm -f SDL.qpg
- rm -f config.status config.cache config.log libtool $(depend)
- rm -rf $(srcdir)/autom4te*
- rm -rf $(srcdir)/test/autom4te*
- find $(srcdir) \( \
- -name '*~' -o \
- -name '*.bak' -o \
- -name '*.old' -o \
- -name '*.rej' -o \
- -name '*.orig' -o \
- -name '.#*' \) \
- -exec rm -f {} \;
- cp $(srcdir)/include/SDL_config.h.default $(srcdir)/include/SDL_config.h
- if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
-
-dist $(distfile):
- $(SHELL) $(auxdir)/mkinstalldirs $(distdir)
- tar cf - $(DIST) | (cd $(distdir); tar xf -)
- cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
- rm -rf `find $(distdir) -name .svn`
- rm -rf $(distdir)/test/autom4te*
- find $(distdir) \( \
- -name '*~' -o \
- -name '*.bak' -o \
- -name '*.old' -o \
- -name '*.rej' -o \
- -name '*.orig' -o \
- -name '.#*' \) \
- -exec rm -f {} \;
- if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
- tar cvf - $(distdir) | gzip --best >$(distfile)
- rm -rf $(distdir)
-
-rpm: $(distfile)
- rpmbuild -ta $?
-
-# Create a SVN snapshot that people can run update on
-snapshot:
- svn co http://svn.libsdl.org/branches/SDL-1.2
- (cd SDL-1.2 && ./autogen.sh && rm -rf autom4te.cache)
- cp SDL-1.2/include/SDL_config.h.default SDL-1.2/include/SDL_config.h
- tar zcf $(HOME)/SDL-1.2.tar.gz SDL-1.2
- rm -f $(HOME)/SDL-1.2.zip
- zip -r $(HOME)/SDL-1.2.zip SDL-1.2
- rm -rf SDL-1.2
diff --git a/alienblaster/project/jni/sdl/Makefile.minimal b/alienblaster/project/jni/sdl/Makefile.minimal
deleted file mode 100644
index 4fe03e9ef..000000000
--- a/alienblaster/project/jni/sdl/Makefile.minimal
+++ /dev/null
@@ -1,42 +0,0 @@
-# Makefile to build the SDL library
-
-INCLUDE = -I./include
-CFLAGS = -g -O2 $(INCLUDE)
-AR = ar
-RANLIB = ranlib
-
-CONFIG_H = include/SDL_config.h
-TARGET = libSDL.a
-SOURCES = \
- src/*.c \
- src/audio/*.c \
- src/cdrom/*.c \
- src/cpuinfo/*.c \
- src/events/*.c \
- src/file/*.c \
- src/joystick/*.c \
- src/stdlib/*.c \
- src/thread/*.c \
- src/timer/*.c \
- src/video/*.c \
- src/audio/oss/*.c \
- src/video/fbcon/*.c \
- src/joystick/dummy/*.c \
- src/cdrom/dummy/*.c \
- src/thread/pthread/*.c \
- src/timer/unix/*.c \
- src/loadso/dummy/*.c \
-
-OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
-
-all: $(TARGET)
-
-$(TARGET): $(CONFIG_H) $(OBJECTS)
- $(AR) crv $@ $^
- $(RANLIB) $@
-
-$(CONFIG_H):
- cp $(CONFIG_H).default $(CONFIG_H)
-
-clean:
- rm -f $(TARGET) $(OBJECTS)
diff --git a/alienblaster/project/jni/sdl/NOTES b/alienblaster/project/jni/sdl/NOTES
new file mode 100644
index 000000000..49dd2d058
--- /dev/null
+++ b/alienblaster/project/jni/sdl/NOTES
@@ -0,0 +1,172 @@
+
+Sam - Mon Aug 6 23:02:37 PDT 2007
+------
+Add color modulation to blitting
+Blit convert format X -> format Y (needed for texture upload)
+Blit copy / blend / modulate format X -> format X (needed for software renderer)
+
+Create full software renderer for framebuffer interfaces.
+
+Create texture for surface, keep surface around as pixel source, allow
+copying / blending / modulating from surface to display (automatically
+generate texture?)
+
+At that point, should anyone be using anything besides textures for display?
+
+IRC - Mon Aug 6 23:50:44 PDT 2007
+-----
+[11:07pm] icculus: so we're clear, "textures" replace "surfaces" from 1.2 when you want to get stuff to the screen? So you have a definitely point where it stops being pixels in memory and starts being an object on the graphics card?
+[11:07pm] icculus: Upload once, blit many
+[11:07pm] icculus: something like that?
+[11:07pm] slouken: That's the idea, yes
+[11:07pm] icculus: ok, just making sure
+[11:08pm] slouken: Many drivers retain the "texture" as a surface and blit to opaque bits which then get copied into a framebuffer.
+[11:08pm] slouken: retain -> would retain
+[11:08pm] icculus: yeah, I figured
+[11:08pm] slouken: That's why the features for surface blitting need to match the features for texture display.
+[11:08pm] icculus: But it gives an abstraction where the app has to make a conscious action: the upload is slow, but then the blit is fast.
+[11:09pm] icculus: This couldn't just map to LockSurface, though?
+[11:09pm] slouken: Yes, exactly. I wasn't sure whether to make that clear, e.g. can you display any surface, and automatically generate a texture (if necessary)?
+[11:09pm] slouken: If not, it simplifies the framebuffer case.
+[11:10pm] slouken: But even the framebuffer case will probably still want to convert the bits to the optimal format.
+[11:10pm] slouken: And at that point, the non-optimal bits can be thrown away.
+[11:11pm] slouken: e.g. SDL_DisplayFormat()
+[11:10pm] icculus: oh, that's a good point.
+[11:10pm] icculus: hmm
+[11:11pm] icculus: yeah, okay
+[11:11pm] icculus: I was thinking about if the separation is really necessary, or if LockSurface would imply a texture creation (and you just have much more strict locking requirements than most 1.2 targets had)
+[11:11pm] slouken: That's also why I separated the conversion blits from the copy / blend / modulate blits.
+[11:12pm] icculus: But I like that the app has to be conscious of when that's happening
+[11:12pm] slouken: Yeah, I was really leaning towards making it implicit, but the memory savings is pretty significant for artwork.
+[11:12pm] icculus: SDL_compat can wrap the difference for people that can't get their head around it.
+[11:13pm] icculus: At the performance cost, that can be a totally external layer that manages it like 1.2's locking.
+[11:13pm] slouken: Well, SDL_compat is entirely software on top of a single texture that represents the screen.
+[11:14pm] slouken: Yeah, that's the way it's implemented right now.
+[11:14pm] slouken: a HWSURFACE is one that is backed by a texture, and lock/unlock is used to synchronize the bits.
+[11:14pm] slouken: I'm not sure if that's worth keeping though, if SDL_compat is software only.
+[11:15pm] slouken: It would minimize code migration though.
+[11:15pm] icculus: yeah
+[11:15pm] icculus: I expect SDL_compat to be a complete cesspool
+[11:15pm] icculus: just a black box that no one touches or looks at more than necessary
+[11:15pm] slouken: more or less, but it's actually pretty clean right now... I think as a side effect of the new API being pretty clean.
+[11:15pm] slouken: I'm just unsure how much to use texture vs HWSURFACE
+[11:16pm] icculus: Besides, you'd be surprised how quickly you can get people to move if you flag functions as deprecated so that GCC bitches when you use them.
+[11:16pm] slouken:
+[11:16pm] icculus: how much to use texture vs HWSURFACE in 1.3, or in SDL_compat?
+[11:16pm] slouken: in 1.3
+[11:17pm] icculus: Pick one or the other, I would say.
+[11:17pm] icculus: I don't think it's good to confuse people with both terms
+[11:17pm] slouken: yeah
+[11:17pm] icculus: Everything is software until it's a texture.
+[11:17pm] slouken: I'm just not sure which
+[11:17pm] slouken: that's certainly cleanest.
+[11:18pm] slouken: and what's currently implemented
+[11:18pm] slouken: Let's think through the migration process...
+[11:18pm] icculus: Plus dropping the term HWSURFACE gets the point across that a) this isn't 1.2 and b) this is probably going to a 3D api that you should be using anyhow.
+[11:18pm] • slouken nods
+[11:18pm] icculus: I mean, "texture" is what every API calls these things
+[11:18pm] slouken: Yep
+[11:19pm] slouken: So let's work through a migration case...
+[11:19pm] icculus: ok
+[11:19pm] slouken: FooBall loads a big background and a bunch of sprites. They are png, loaded into SDL_Surface with SDL_image, then converted with SDL_DisplayFormat()
+[11:20pm] slouken: Then the background is blitted every frame and the sprites are blended on top.
+[11:20pm] slouken: In the compat case:
+[11:21pm] slouken: SDL_SetVideoMode() creates a single lockable texture for the display. DisplayFormat() converts the bits into the optimal format, all blitting is done in software, and SDL_UpdateRects() pushes the bits into the texture and the texture is rendered.
+[11:21pm] slouken: In the 1.3 case:
+[11:22pm] slouken: The background and sprites are converted to textures using SDL_CreateTextureFromSurface(), and the appropriate blending flags are set. Each frame copies the textures into place and then the display is presented.
+[11:23pm] slouken: compat is software only, 1.3 can be 3D accelerated.
+[11:23pm] icculus: wait, why does all blitting have to be done in software in the SDL_compat case?
+[11:23pm] icculus: I don't understand why SDL_compat can't move things between surfaces and textures at Lock/Unlock time
+[11:24pm] slouken: Because by default the screen isn't created with HWSURFACE, since apps expect to be able to munge the bits. Therefore, the blits to it have to be done locally.
+[11:24pm] icculus: And all the surfaces are flagged HWSURFACE, so ->pixels is NULL until locked.
+[11:24pm] icculus: oh
+[11:24pm] icculus: It wasn't possible to have a HWSURFACE screen?
+[11:25pm] slouken: Yes, it was, just nobody did it because alpha blending needs to read from video memory, and poking pixels across the bus is slow.
+[11:25pm] slouken: Even in 1.3, the Xlib case needs to be software renderer if you want to do any alpha blending.
+[11:26pm] icculus: But arguably there's no reason that can't all be HWSURFACE (that is, they need to get moved to a texture, even if that's still a software renderer on the backend)
+[11:26pm] icculus: That sounds like it's only a problem when an app touches SDL_GetVideoSurface()->pixels without checking if they should lock it.
+[11:26pm] icculus: Which might be quite common
+[11:27pm] slouken: Yep, in 1.2 the app was able to specify it, and most explicitly don't because it's either not available or bad for alpha blending and direct pixel poking.
+[11:27pm] icculus: hmm.
+[11:28pm] slouken: You see why I've been going round and round for months on this?
+[11:28pm] icculus: Well, we're talking about a compatibility layer; if it's going to crash without LockSurface() on the screen, make them lock it. If that makes it slow, so be it.
+[11:29pm] icculus: The options are make small changes and take a performance hit, or make bigger changes and get a big performance win.
+[11:29pm] icculus: (if touching the framebuffer directly, that is)
+[11:29pm] slouken: Well, at that point it's a compatibility layer, why not just leave it software? (devil's advocate here)
+[11:29pm] icculus: That's a good point.
+[11:30pm] slouken: Unless we leave everything surfaces to get the best of both worlds...
+[11:30pm] • slouken gets dizzy
+[11:30pm] icculus: From a technical elegance viewpoint, I can see a good mapping between HWSURFACE and textures, but realistically, you want to motivate people to move away from old APIs.
+[11:31pm] slouken: Yeah probably. There's a certain attraction to retaining the SDL_Surface usage even for hardware surfaces, simply because of code reuse. You don't have to have separate code for your software composition and your rendering. You also get to keep your old image loading code, etc.
+[11:31pm] icculus: man, this really is a pain in the ass, I see what you mean.
+[11:32pm] slouken: Yeah.
+[11:32pm] icculus: hmm, let me think on this awhile.
+[11:32pm] slouken: On the other hand, separating the Texture API for rendering is clearer and allows extension in the future.
+[11:32pm] slouken: We could potentially allow you to create a software renderer pointed at an SDL surface....
+[11:32pm] slouken: Hmmm
+[11:33pm] icculus: well, that's what you have now for something like Doom
+[11:33pm] icculus: you render to a shadow surface, and throw a hail-mary with SDL_Flip()
+[11:34pm] slouken: Yep. I mean a 1.3 "renderer" with an SDL_Surface or another texture as the target.
+[11:34pm] icculus: More or less, that doesn't change. The only important thing there is not generating a new texture every time, but being able to discard what's currently in it for a fresh upload.
+[11:34pm] slouken: Yep
+[11:34pm] icculus: oh, I see
+[11:35pm] icculus: render-to-surface
+[11:35pm] slouken: lol
+[11:35pm] slouken: yeah
+[11:36pm] slouken: So... where to draw the line with surface vs texture...
+[11:37pm] icculus: I don't know, I would think that basically you want to get out of surfaces as fast as possible
+[11:37pm] icculus: (disregarding SDL_compat for the moment)
+[11:37pm] slouken: Yeah, I think so.
+[11:37pm] slouken: Load the bits up, throw them into a texture, and go
+[11:37pm] icculus: And basically all you really need for that is an "upload" function.
+[11:38pm] slouken: Yep
+[11:38pm] icculus: I'd even be inclined to not allow "Locking," so there's no readback.
+[11:38pm] icculus: well, I'm sure that would cause a fight
+[11:38pm] • slouken thinks
+[11:40pm] slouken: Let me see where I use SDL_LockTexture() right now.
+[11:42pm] slouken: The only time that's useful is to avoid a buffer copy when you're already writing the bits in the correct format.
+[11:42pm] slouken: e.g. lock -> software render into bits -> unlock (upload)
+[11:43pm] slouken: that may already be taken care of by the upload though.
+[11:43pm] slouken: e.g. software render into bits -> upload
+[11:44pm] slouken: Oh yeah, there's probably a memory copy of the bits though, so it's: upload = copy into cached bits, copy cached bits to video memory as needed. In that case if you lock to get access to the cached bits directly that's a win.
+[11:44pm] icculus: ah, okay
+[11:47pm] icculus: I don't know, my head hurts.
+[11:47pm] slouken: Yeah, mine too.
+[11:47pm] slouken: I was pretty happy with the current setup until I noticed that it's really hard to write a framebuffer driver right now.
+[11:49pm] slouken: I think maybe if I clean that up and separate conversion blit and copy / blend / modulate blit, then it may work pretty cleanly.
+[11:49pm] icculus: yeah
+
+[11:54pm] slouken: So recapping... SDL_Surface is only used for loading and app composition.
+[11:55pm] slouken: SDL surface blitting is enhanced to maintain parity with the renderer features, since it's used as the core of the software renderer.
+[11:56pm] slouken: The software renderer is adapted to be a standalone module targeting either an SDL_Surface or an SDL_Texture.
+[11:56pm] slouken: SDL_HWSURFACE goes away
+[11:57pm] slouken: Anything I'm missing?
+[11:58pm] icculus: no, sounds good
+[11:58pm] slouken: This means we have the new 1.3 texture API pretty much as it stands.
+[11:59pm] slouken: Right?
+[11:59pm] icculus: yeah, I think so
+
+[12:00am] slouken: I was trying to see if it was possible to make a pluggable blit API, but I was going insane with trying to figure out how to make it fast.
+[12:01am] slouken: If it were software only I could just say, write your own and register it here, but you'd have to maintain parity with the OpenGL and Direct3D renderers as well.
+[12:01am] slouken: At that point you might as well be working in surfaces and uploading to texture.
+[12:02am] icculus: yeah
+
+TODO
+----
+Change textures to static/streaming. Static textures are not lockable,
+streaming textures are lockable and may have system memory pixels available.
+SDL_compat will use a streaming video texture, and will never be HWSURFACE,
+but may be PREALLOC, if system memory pixels are available.
+*** DONE Thu Aug 16 14:18:42 PDT 2007
+
+The software renderer will be abstracted so the surface management can be
+used by any renderer that provides functions to copy surfaces to the window.
+
+Blitters...
+----
+Copy blit and fill rect are optimized with MMX and SSE now.
+
+Here are the pieces we still need:
+- Merging SDL texture capabilities into the SDL surface system
+- Generic fallback blitter architecture
+- Custom fast path blitters
diff --git a/alienblaster/project/jni/sdl/README b/alienblaster/project/jni/sdl/README
index 7c0dd5890..f2667e95c 100644
--- a/alienblaster/project/jni/sdl/README
+++ b/alienblaster/project/jni/sdl/README
@@ -12,11 +12,10 @@ This is the Simple DirectMedia Layer, a general API that provides low
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
and 2D framebuffer across multiple platforms.
-The current version supports Linux, Windows CE/95/98/ME/XP/Vista, BeOS,
-MacOS Classic, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX,
-and QNX. The code contains support for Dreamcast, Atari, AIX, OSF/Tru64,
-RISC OS, SymbianOS, Nintendo DS, and OS/2, but these are not officially
-supported.
+The current version supports Linux, Windows, Windows CE, BeOS, MacOS,
+Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.
+The code contains support for AIX, OSF/Tru64, RISC OS, and SymbianOS,
+but these are not officially supported.
SDL is written in C, but works with C++ natively, and has bindings to
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
diff --git a/alienblaster/project/jni/sdl/README.AmigaOS b/alienblaster/project/jni/sdl/README.AmigaOS
deleted file mode 100644
index e0d890640..000000000
--- a/alienblaster/project/jni/sdl/README.AmigaOS
+++ /dev/null
@@ -1,12 +0,0 @@
-The AmigaOS code has been removed from SDL, since it had been broken for a
- long time and had a few bits of fairly invasive code #ifdef'd into the
- SDL core.
-
-However, there is an OS4 version of SDL here:
- http://www.rcdrummond.net/amiga/index.html
-
-And a MorphOS version here:
- http://www.lehtoranta.net/powersdl/
-
---ryan.
-
diff --git a/alienblaster/project/jni/sdl/README.BeOS b/alienblaster/project/jni/sdl/README.BeOS
deleted file mode 100644
index ccdccf598..000000000
--- a/alienblaster/project/jni/sdl/README.BeOS
+++ /dev/null
@@ -1,13 +0,0 @@
-
-SDL on BeOS R5
-==============
-
-You can build SDL on BeOS like any other GNU style package.
-e.g. ./configure && make && make install
-By default it is installed in /boot/develop/tools/gnupro/{bin,lib,etc.}
-
-Once you install SDL, you need to copy libSDL.so to /boot/home/config/lib,
-so it can be found by the dynamic linker.
-
-Enjoy!
- Sam Lantinga (slouken@libsdl.org)
diff --git a/alienblaster/project/jni/sdl/README.CVS b/alienblaster/project/jni/sdl/README.CVS
deleted file mode 100644
index 7664e9181..000000000
--- a/alienblaster/project/jni/sdl/README.CVS
+++ /dev/null
@@ -1,4 +0,0 @@
-
-SDL is no longer hosted in a CVS repository. Please see README.SVN for
-information on accessing our Subversion repository.
-
diff --git a/alienblaster/project/jni/sdl/README.DC b/alienblaster/project/jni/sdl/README.DC
deleted file mode 100644
index e2fb1d651..000000000
--- a/alienblaster/project/jni/sdl/README.DC
+++ /dev/null
@@ -1,32 +0,0 @@
-SDL for Dreamcast (beta2)
-
- BERO
- berobero@users.sourceforge.net
-
- http://www.geocities.co.jp/Playtown/2004/
-
-this work with kos-newlib
-http://sourceforge.net/projects/dcquake/
-
-compile
-- source environ.sh (from the KOS distribution)
-- make -f Makefile.dc
-
-compile with gl support
-- install latest libgl from http://sourceforge.net/projects/dcquake/
-- uncomment GL=1 in Makefile.dc
-- make -f Makefile.dc clean
-- make -f Makefile.dc
-
-install
-- copy include/*.h and libSDL.a or libSDL_gl.a for your enviroment
-
-changelog:
-
-beta2
-- OpenGL support
-- Hardware page flip support
-
-beta
-- thread, timer don't tested so much.
-- not support OpenGL
diff --git a/alienblaster/project/jni/sdl/README.HG b/alienblaster/project/jni/sdl/README.HG
new file mode 100644
index 000000000..a69f5e39e
--- /dev/null
+++ b/alienblaster/project/jni/sdl/README.HG
@@ -0,0 +1,23 @@
+
+The latest development version of SDL is available via Mercurial.
+Mercurial allows you to get up-to-the-minute fixes and enhancements;
+as a developer works on a source tree, you can use "hg" to mirror that
+source tree instead of waiting for an official release. Please look
+at the Mercurial website ( http://mercurial.selenic.com/ ) for more
+information on using hg, where you can also download software for
+Mac OS X, Windows, and Unix systems.
+
+ hg clone http://hg.libsdl.org/SDL
+
+If you are building SDL with an IDE, you will need to copy the file
+include/SDL_config.h.default to include/SDL_config.h before building.
+
+If you are building SDL via configure, you will need to run autogen.sh
+before running configure.
+
+There is a web interface to the subversion repository at:
+ http://hg.libsdl.org/SDL/
+
+There is an RSS feed available at that URL, for those that want to
+track commits in real time.
+
diff --git a/alienblaster/project/jni/sdl/README.MacOS b/alienblaster/project/jni/sdl/README.MacOS
deleted file mode 100644
index acfd93578..000000000
--- a/alienblaster/project/jni/sdl/README.MacOS
+++ /dev/null
@@ -1,63 +0,0 @@
-
-==============================================================================
-Using the Simple DirectMedia Layer with MacOS 7,8,9 on PPC
-==============================================================================
-
-These instructions are for people using the Apple MPW environment:
-http://developer.apple.com/tools/mpw-tools/
-
-CodeWarrior projects are available in the CWprojects directory.
-
-==============================================================================
-I. Building the Simple DirectMedia Layer libraries:
- (This step isn't necessary if you have the SDL binary distribution)
-
- First, unpack the MPWmake.sea.hqx archive and move SDL.make into the
- SDL directory.
-
- Start MPW
-
- Set the current directory within MPW to the SDL toplevel directory.
-
- Build "SDL" (Type Command-B and enter "SDL" in the dialog)
-
- If everything compiles successfully, you now have the PPC libraries
- "SDL" and "SDLmain.o" in the 'lib' subdirectory.
-
-==============================================================================
-II. Building the Simple DirectMedia Layer test programs:
-
- First, unpack the MPWmake.sea.hqx archive, move the new rsrc directory to
- the main SDL directory, and move the makefiles in the new test subdirectory
- to the SDL 'test' subdirectory.
-
- Start MPW
-
- Set the current directory within MPW to the SDL 'test' subdirectory.
-
- Build the programs that have an associated MPW makefile (file ending
- with .make), including "testwin", "testalpha", and "graywin".
-
- Copy the SDL library file into the test directory, and run!
-
-==============================================================================
-III. Building the Simple DirectMedia Layer demo programs:
-
- Copy one of the test program Makefiles to the demo directory
- and modify it to match the sources in the demo.
-
-==============================================================================
-IV. Enjoy! :)
-
- If you have a project you'd like me to know about, or want to ask questions,
- go ahead and join the SDL developer's mailing list by sending e-mail to:
-
- sdl-request@libsdl.org
-
- and put "subscribe" into the subject of the message. Or alternatively you
- can use the web interface:
-
- http://www.libsdl.org/mailman/listinfo/sdl
-
-==============================================================================
-
diff --git a/alienblaster/project/jni/sdl/README.MacOSX b/alienblaster/project/jni/sdl/README.MacOSX
deleted file mode 100644
index 3bc421371..000000000
--- a/alienblaster/project/jni/sdl/README.MacOSX
+++ /dev/null
@@ -1,186 +0,0 @@
-==============================================================================
-Using the Simple DirectMedia Layer with Mac OS X
-==============================================================================
-
-These instructions are for people using Apple's Mac OS X (pronounced
-"ten").
-
-From the developer's point of view, OS X is a sort of hybrid Mac and
-Unix system, and you have the option of using either traditional
-command line tools or Apple's IDE Xcode.
-
-To build SDL using the command line, use the standard configure and make
-process:
-
- ./configure
- make
- sudo make install
-
-You can also build SDL as a Universal library (a single binary for both
-PowerPC and Intel architectures), on Mac OS X 10.4 and newer, by using
-the fatbuild.sh script in build-scripts:
- sh build-scripts/fatbuild.sh
- sudo build-scripts/fatbuild.sh install
-This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4
-ABI compatibility on Intel architectures. For best compatibility you
-should compile your application the same way. A script which wraps
-gcc to make this easy is provided in test/gcc-fat.sh
-
-To use the library once it's built, you essential have two possibilities:
-use the traditional autoconf/automake/make method, or use Xcode.
-
-==============================================================================
-Using the Simple DirectMedia Layer with a traditional Makefile
-==============================================================================
-
-An existing autoconf/automake build system for your SDL app has good chances
-to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary
-that you can distribute to users, you need to put the generated binary into a
-so called "bundle", which basically is a fancy folder with a name like
-"MyCoolGame.app".
-
-To get this build automatically, add something like the following rule to
-your Makefile.am:
-
-bundle_contents = APP_NAME.app/Contents
-APP_NAME_bundle: EXE_NAME
- mkdir -p $(bundle_contents)/MacOS
- mkdir -p $(bundle_contents)/Resources
- echo "APPL????" > $(bundle_contents)/PkgInfo
- $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
-
-You should replace EXE_NAME with the name of the executable. APP_NAME is what
-will be visible to the user in the Finder. Usually it will be the same
-as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME
-usually is "TestGame". You might also want to use @PACKAGE@ to use the package
-name as specified in your configure.in file.
-
-If your project builds more than one application, you will have to do a bit
-more. For each of your target applications, you need a seperate rule.
-
-If you want the created bundles to be installed, you may want to add this
-rule to your Makefile.am:
-
-install-exec-hook: APP_NAME_bundle
- rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
- mkdir -p $(DESTDIR)$(prefix)/Applications/
- cp -r $< /$(DESTDIR)$(prefix)Applications/
-
-This rule takes the Bundle created by the rule from step 3 and installs them
-into $(DESTDIR)$(prefix)/Applications/.
-
-Again, if you want to install multiple applications, you will have to augment
-the make rule accordingly.
-
-
-But beware! That is only part of the story! With the above, you end up with
-a bare bone .app bundle, which is double clickable from the Finder. But
-there are some more things you should do before shipping yor product...
-
-1) The bundle right now probably is dynamically linked against SDL. That
- means that when you copy it to another computer, *it will not run*,
- unless you also install SDL on that other computer. A good solution
- for this dilemma is to static link against SDL. On OS X, you can
- achieve that by linkinag against the libraries listed by
- sdl-config --static-libs
- instead of those listed by
- sdl-config --libs
- Depending on how exactly SDL is integrated into your build systems, the
- way to achieve that varies, so I won't describe it here in detail
-2) Add an 'Info.plist' to your application. That is a special XML file which
- contains some meta-information about your application (like some copyright
- information, the version of your app, the name of an optional icon file,
- and other things). Part of that information is displayed by the Finder
- when you click on the .app, or if you look at the "Get Info" window.
- More information about Info.plist files can be found on Apple's homepage.
-
-
-As a final remark, let me add that I use some of the techniques (and some
-variations of them) in Exult and ScummVM; both are available in source on
-the net, so feel free to take a peek at them for inspiration!
-
-
-==============================================================================
-Using the Simple DirectMedia Layer with Xcode
-==============================================================================
-
-These instructions are for using Apple's Xcode IDE to build SDL applications.
-
-- First steps
-
-The first thing to do is to unpack the Xcode.tar.gz archive in the
-top level SDL directory (where the Xcode.tar.gz archive resides).
-Because Stuffit Expander will unpack the archive into a subdirectory,
-you should unpack the archive manually from the command line:
- cd [path_to_SDL_source]
- tar zxf Xcode.tar.gz
-This will create a new folder called Xcode, which you can browse
-normally from the Finder.
-
-- Building the Framework
-
-The SDL Library is packaged as a framework bundle, an organized
-relocatable folder heirarchy of executible code, interface headers,
-and additional resources. For practical purposes, you can think of a
-framework as a more user and system-friendly shared library, whose library
-file behaves more or less like a standard UNIX shared library.
-
-To build the framework, simply open the framework project and build it.
-By default, the framework bundle "SDL.framework" is installed in
-/Library/Frameworks. Therefore, the testers and project stationary expect
-it to be located there. However, it will function the same in any of the
-following locations:
-
- ~/Library/Frameworks
- /Local/Library/Frameworks
- /System/Library/Frameworks
-
-- Build Options
- There are two "Build Styles" (See the "Targets" tab) for SDL.
- "Deployment" should be used if you aren't tweaking the SDL library.
- "Development" should be used to debug SDL apps or the library itself.
-
-- Building the Testers
- Open the SDLTest project and build away!
-
-- Using the Project Stationary
- Copy the stationary to the indicated folders to access it from
- the "New Project" and "Add target" menus. What could be easier?
-
-- Setting up a new project by hand
- Some of you won't want to use the Stationary so I'll give some tips:
- * Create a new "Cocoa Application"
- * Add src/main/macosx/SDLMain.m , .h and .nib to your project
- * Remove "main.c" from your project
- * Remove "MainMenu.nib" from your project
- * Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
- * Add "$(HOME)/Library/Frameworks" to the frameworks search path
- * Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
- * Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
- * Add your files
- * Clean and build
-
-- Building from command line
- Use pbxbuild in the same directory as your .pbproj file
-
-- Running your app
- You can send command line args to your app by either invoking it from
- the command line (in *.app/Contents/MacOS) or by entering them in the
- "Executibles" panel of the target settings.
-
-- Implementation Notes
- Some things that may be of interest about how it all works...
- * Working directory
- As defined in the SDL_main.m file, the working directory of your SDL app
- is by default set to its parent. You may wish to change this to better
- suit your needs.
- * You have a Cocoa App!
- Your SDL app is essentially a Cocoa application. When your app
- starts up and the libraries finish loading, a Cocoa procedure is called,
- which sets up the working directory and calls your main() method.
- You are free to modify your Cocoa app with generally no consequence
- to SDL. You cannot, however, easily change the SDL window itself.
- Functionality may be added in the future to help this.
-
-
-Known bugs are listed in the file "BUGS"
diff --git a/alienblaster/project/jni/sdl/README.MiNT b/alienblaster/project/jni/sdl/README.MiNT
deleted file mode 100644
index eabe3eb1b..000000000
--- a/alienblaster/project/jni/sdl/README.MiNT
+++ /dev/null
@@ -1,250 +0,0 @@
-==============================================================================
-Using the Simple DirectMedia Layer on Atari
-==============================================================================
-
-
- If you want to build SDL from sources to create SDL programs on Atari:
- see sections I - II.
-
- If you want to create SDL programs on Atari using SDL binary build,
- download it from my web site (URL at end of this file).
-
- If you want to configure a program using SDL on Atari,
- see sections IV - VI.
-
-
-==============================================================================
-I. Building the Simple DirectMedia Layer libraries:
- (This step isn't necessary if you have the SDL binary distribution)
-
- Do the classic configure, with --disable-shared --enable-static and:
-
- Tos version (should run everywhere):
- --disable-threads
- Tos does not support threads.
-
- MiNT version (maybe Magic, only for multitasking OS):
- --disable-pthreads --enable-pth
- Mint and Magic may supports threads, so audio can be used with current
- devices, like Sun audio, or disk-writing support. Like Tos, interrupt
- audio without threads is more suited for Atari machines.
-
- Then you can make ; make install it.
-
-==============================================================================
-II. Building the Simple DirectMedia Layer test programs:
-
- Do the classic configure, then make.
-
- Run them !
-
-==============================================================================
-III. Enjoy! :)
-
- If you have a project you'd like me to know about, or want to ask questions,
- go ahead and join the SDL developer's mailing list by sending e-mail to:
-
- sdl-request@libsdl.org
-
- and put "subscribe" into the subject of the message. Or alternatively you
- can use the web interface:
-
- http://www.libsdl.org/mailman/listinfo/sdl
-
-==============================================================================
-IV. What is supported:
-
-Keyboard (GEMDOS, BIOS, GEM, Ikbd)
-Mouse (XBIOS, GEM, Ikbd, /dev/mouse (non working atm, disabled))
-Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
-Timer (VBL vector, GNU pth library)
-Joysticks and joypads (Ikbd, Hardware)
-Audio (Hardware, XBIOS, GSXB, MCSN, STFA, /dev/audio if threads enabled)
-Threads (Multitasking OS only via GNU pth library)
-Shared object loader (using LDG library from http://ldg.atari.org/)
-Audio CD (MetaDOS)
-OpenGL (using Mesa offscreen rendering driver)
-
-- Dependent driver combinations:
-Video Kbd Mouse Timer Joysticks
-xbios ikbd ikbd vbl(2) ikbd
-xbios gemdos xbios vbl(2) xbios
-xbios bios xbios vbl(2) xbios
-gem gem gem(1) vbl(2) xbios
-
-Audio O/S Misc
-dma8 All Uses MFP Timer A interrupt
-xbios TOS Uses MFP Timer A interrupt
-xbios MiNT Uses MFP Timer A interrupt
-xbios Magic Uses MFP Timer A interrupt
-stfa All Uses MFP interrupt
-mcsn TOS Uses MFP Timer A interrupt
-mcsn MiNT Uses MiNT thread
-mcsn Magic Disabled
-gsxb All Uses GSXB callback
-
-Joypad driver always uses hardware access.
-OpenGL driver always uses OSMesa.
-
-(1) GEM does not report relative mouse motion, so xbios mouse driver is used
-to report this type event.
-A preliminary driver for /dev/mouse device driver is present, but is disabled
-till it can be used with other applications simultaneously.
-
-(2) If you build SDL with threads using the GNU pth library, timers are
-supported via the pth library.
-
-==============================================================================
-V. Environment variables:
-
-SDL_VIDEODRIVER:
- Set to 'xbios' to force xbios video driver
- Set to 'gem' to force gem video driver
-
-SDL_VIDEO_GL_DRIVER:
- Set to filename to load as OpenGL library, if you use SDL_GL_LoadLibrary()
-
-SDL_AUDIODRIVER:
- Set to 'mint_gsxb' to force Atari GSXB audio driver
- Set to 'mint_mcsn' to force Atari MCSN audio driver
- Set to 'mint_stfa' to force Atari STFA audio driver
- Set to 'mint_xbios' to force Atari Xbios audio driver
- Set to 'mint_dma8' to force Atari 8 bits DMA audio driver
- Set to 'audio' to force Sun /dev/audio audio driver
- Set to 'disk' to force disk-writing audio driver
-
-SDL_ATARI_EVENTSDRIVER
- Set to 'ikbd' to force IKBD 6301 keyboard driver
- Set to 'gemdos' to force gemdos keyboard driver
- Set to 'bios' to force bios keyboard driver
-
-SDL_JOYSTICK_ATARI:
- Use any of these strings in the environment variable to enable or
- disable a joystick:
-
- 'ikbd-joy1-[on|off]' for IKBD joystick on port 1 (hardware access)
- 'xbios-joy1-[on|off]' for IKBD joystick on port 1 (xbios access)
- 'porta-pad-[on|off]' for joypad and/or teamtap on port A
- 'porta-joy0-[on|off]' for joystick 0 on port A
- 'porta-joy1-[on|off]' for joystick 1 on port A
- 'porta-lp-[on|off]' for lightpen on port A
- 'porta-anpad-[on|off]' for analog paddle on port A
- 'portb-pad-[on|off]' for joypad and/or teamtap on port B
- 'portb-joy0-[on|off]' for joystick 0 on port B
- 'portb-joy1-[on|off]' for joystick 1 on port B
- 'portb-anpad-[on|off]' for analog paddle on port B
-
- Default configuration is:
- 'ikbd-joy1-on' (if IKBD events driver enabled)
- 'xbios-joy1-on' (if gemdos/bios/gem events driver enabled)
- 'porta-pad-on portb-pad-on' (if available on the machine)
-
- port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives.
- On such a port, you can only use a joypad OR 1 or 2 joysticks OR
- a lightpen OR an analog paddle. You must disable joypad before
- setting another controller.
-
- The second joystick port on IKBD is used by the mouse, so not usable.
- Another problem with the IKBD: mouse buttons and joystick fire buttons
- are wired together at the hardware level, it means:
- port 0 port 0 port 1
- mouse left button = joystick fire 0 = joystick fire 1
- mouse right button = joystick fire 1 = joystick fire 0
-
- Descriptions of joysticks/joypads:
- - Joypads: 1 hat, 17 buttons (Atari Jaguar console-like).
- - Joysticks: 1 hat, 1 button.
- - Lightpen, analog paddles: 2 axis, 2 buttons. The 2 buttons are those
- affected to 1 button joysticks on the same port.
-
-==============================================================================
-VI. More informations about drivers:
-
-OpenGL:
- The default is to use the Mesa offscreen driver (osmesa.ldg). If you want
- to use an older OpenGL implementation, like mesa_gl.ldg or tiny_gl.ldg,
- your program must use SDL_GL_LoadLibrary() to do so, and retrieve the
- needed function pointers with SDL_LoadFunction(). In all cases, the OpenGL
- context is taken care of by SDL itself, you just have to use gl* functions.
-
- However, there is one OpenGL call that has a different prototype in the old
- implementations: glOrtho(). In the old implementations, it has 6 float as
- parameters, in the standard one, it has 6 double parameters. If you want
- to compile testdyngl, or any other SDL program that loads its OpenGL
- library, you must change the glOrtho() prototype used in this program. In
- osmesa.ldg, you can retrieve a glOrtho() with double parameters, by
- searching for the function "glOrtho6d".
-
-Xbios video:
- Video chip is detected using the _VDO cookie.
- Screen enhancers are not supported, but could be if you know how to
- use them.
-
- ST, STE, Mega ST, Mega STE:
- 320x200x4 bits, shades of grey, available only for the purpose
- of testing SDL.
- TT:
- 320x480x8 and 320x240x8 (software double-lined mode).
- Falcon:
- All modes supported by the current monitor (RVB or VGA).
- BlowUp and Centscreen extended modes, ScreenBlaster 3 current mode.
- Milan:
- Experimental support
- Clones and any machine with monochrome monitor:
- Not supported.
-
-Gem video:
- Automatically used if xbios not available.
-
- All machines:
- Only the current resolution, if 8 bits or higher depth.
-
-IKBD keyboard, mouse and joystick driver:
- Available if _MCH cookie is ST, Mega ST, STE, Mega STE, TT or Falcon.
-
- Hades has an IKBD, but xbios is not available for video, so IKBD
- driver is disabled.
-
-Gemdos and bios keyboard driver:
- Available on all machines.
-
-Mouse and joystick xbios driver:
- Available on all machines (I think).
-
-Joypad driver:
- Available if _MCH cookie is STE or Falcon. Supports teamtap.
-
-PTH timer driver:
- Available with multitasking OS.
-
-VBL timer driver:
- Available on all machines (I think).
-
-Audio drivers:
- Cookies _SND, MCSN, STFA and GSXB used to detect supported audio
- capabilities.
-
- STE, Mega STE, TT:
- 8 bits DMA (hardware access)
- STFA, MCSN or GSXB driver if installed
- Falcon:
- 8 bits DMA (hardware access)
- Xbios functions
- STFA, MCSN or GSXB driver if installed
- Other machines:
- STFA, MCSN or GSXB driver if installed
-
- STFA driver:
- http://removers.free.fr/softs/stfa.html
- GSXB driver:
- http://assemsoft.atari.org/gsxb/
- MacSound driver:
- http://jf.omnis.ch/software/tos/
- MagicSound driver (MCSN,GSXB compatible):
- http://perso.wanadoo.fr/didierm/
- X-Sound driver (GSXB compatible):
- http://www.uni-ulm.de/~s_thuth/atari/xsound_e.html
-
---
-Patrice Mandin
-http://pmandin.atari.org/
diff --git a/alienblaster/project/jni/sdl/README.NDS b/alienblaster/project/jni/sdl/README.NDS
deleted file mode 100644
index e96a9eeec..000000000
--- a/alienblaster/project/jni/sdl/README.NDS
+++ /dev/null
@@ -1,22 +0,0 @@
-The SDL port to the Nintendo DS
-
-This port uses the devKitPro toolchain, available from:
-http://www.devkitpro.org
-
-Precompiled tools for cross-compiling on Linux are available from:
-http://www.libsdl.org/extras/nds/devkitPro-20070503-linux.tar.gz
-
-todo:
-add ds console specific features/optimizations
-mouse/keyboard support
-dual screen support
-
-build with:
-cp include/SDL_config_nds.h include/SDL_config.h
-make -f Makefile.ds
-
-included is an arm9/arm7 template to allow for sound streaming support.
-
-Enjoy, fix the source and share :)
-Troy Davis(GPF)
-http://gpf.dcemu.co.uk/
diff --git a/alienblaster/project/jni/sdl/README.NanoX b/alienblaster/project/jni/sdl/README.NanoX
deleted file mode 100644
index 8418ff332..000000000
--- a/alienblaster/project/jni/sdl/README.NanoX
+++ /dev/null
@@ -1,97 +0,0 @@
- =================================================================
- Patch version 0.9 of SDL(Simple DirectMedia Layer) for Nano-X API
- =================================================================
-
- Authors: Hsieh-Fu Tsai, clare@setabox.com
- Greg Haerr, greg@censoft.com
-
- This patch is against SDL version 1.2.4.
- It enhances previous patch 0.8 by providing direct framebuffer
- access as well as dynamic hardware pixel type support, not
- requiring a compile-time option setting for different framebuffer
- modes.
- Tested against Microwindows version 0.89pre9.
-
- Older Microwindows versions
- ===========================
- If running on a version older than Microwindows 0.89pre9,
- the following items might need to be patched in Microwindows.
-
- 1. Patch src/nanox/client.c::GrClose()
- It fixes the client side GrClose(). In the original version,
- GrOpen() can only be called once. When the GrOpen() is called at
- the second time, the program will terminate. In order to prevent
- this situation, we need to insert "nxSocket = -1" after
- "close(nxSocket)" in GrClose(). If you do not have this problem,
- you may skip this step.
-
- 2. Patch src/nanox/clientfb.c to return absolute x,y coordinates
- when using GrGetWindowFBInfo(). Copy the version 0.89pre9
- of src/nanox/clientfb.c to your system, or configure
- using --disable-nanox-direct-fb.
-
- =============
- Quick Install
- =============
-
- 1. ./configure --disable-video-x11 --disable-video-fbcon \
- --enable-video-nanox \
- --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]
- 2. make clean
- 3. make
- 4. make install (as root)
-
- ============
- Nitty-gritty
- ============
-
- --enable-nanox-direct-fb Use direct framebuffer access
- --enable-nanox-debug Show debug messages
- --enable-nanox-share-memory Use shared-memory to speed up
-
- When running multi-threaded applications using SDL, such
- as SMPEG, set THREADSAFE=Y in Microwindows' config file,
- to enable GrXXX() system call critical section support.
-
- =============================================
- Some programs can be used to test this patch.
- =============================================
-
- 1. http://www.cs.berkeley.edu/~weimer/atris (a tetris-like game)
- 2. http://www.libsdl.org/projects/newvox/
- 3. http://www.libsdl.org/projects/xflame/
- 4. http://www.libsdl.org/projects/optimum/
- 5. http://www.gnugeneration.com/software/loop/
- 6: http://www.lokigames.com/development/smpeg.php3 (SMPEG version 0.4.4)
-
- =========
- Todo List
- =========
-
- 1. Create hardware surface
- 2. Create YUVOverlay on hardware
- 3. Use OpenGL
- 4. Gamma correction
- 5. Hide/Change mouse pointer
- 6. Better window movement control with direct fb access
- 7. Palette handling in 8bpp could be improved
-
- =====================
- Supporting Institutes
- =====================
-
- Many thanks to go to Setabox Co., Ltd. and CML (Communication and
- Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the
- Department of Computer Science and Information Engineering of
- National Taiwan University for supporting this porting project.
-
- Century Embedded Technologies (http://embedded.censoft.com)
- for this patch.
-
- ===================
- Contact Information
- ===================
-
- Welcome to give me any suggestion and to report bugs.
- My e-mail address : clare@setabox.com or niky@cmlab.csie.ntu.edu.tw
- or greg@censoft.com
diff --git a/alienblaster/project/jni/sdl/README.OS2 b/alienblaster/project/jni/sdl/README.OS2
deleted file mode 100644
index 424b3739c..000000000
--- a/alienblaster/project/jni/sdl/README.OS2
+++ /dev/null
@@ -1,281 +0,0 @@
-
-===========
-SDL on OS/2
-===========
-
-Last updated on May. 17, 2006.
-
-
-1. How to compile?
-------------------
-
-To compile this, you'll need the followings installed:
-- The OS/2 Developer's Toolkit
-- The OpenWatcom compiler
- (http://www.openwatcom.org)
-
-First of all, you have to unzip the Watcom-OS2.zip file. This will result in a
-file called "makefile" and a file called "setvars.cmd" in this folder (and some
-more files...).
-
-Please edit the second, fourth and fifth lines of setvars.cmd file
-to set the folders where the toolkit, the OW compiler and the FSLib are.
-You won't need NASM yet (The Netwide Assembler), you can leave that line.
-Run setvars.cmd, and you should get a shell in which you can
-compile SDL.
-
-Check the "makefile" file. There is a line in there which determines if the
-resulting SDL.DLL will be a 'debug' or a 'release' build. The 'debug' version
-is full of printf()'s, so if something goes wrong, its output can help a lot
-for debugging.
-
-Then run "wmake".
-This should create the SDL12.DLL and the corresponding SDL12.LIB file here.
-
-To test applications, it's a good idea to use the 'debug' build of SDL, and
-redirect the standard output and standard error output to files, to see what
-happens internally in SDL.
-(like: testsprite >stdout.txt 2>stderr.txt)
-
-To rebuild SDL, use the following commands in this folder:
-wmake clean
-wmake
-
-
-
-2. How to compile the testapps?
--------------------------------
-
-Once you have SDL12.DLL compiled, navigate into the 'test' folder, copy in
-there the newly built SDL12.DLL, and copy in there FSLib.DLL.
-
-Then run "wmake" in there to compile some of the testapps.
-
-
-
-3. What is missing?
--------------------
-
-The following things are missing from this SDL implementation:
-- MMX, SSE and 3DNOW! optimized video blitters?
-- HW Video surfaces
-- OpenGL support
-
-
-
-4. Special Keys / Full-Screen support
--------------------------------------
-
-There are two special hot-keys implemented:
-- Alt+Home switches between fullscreen and windowed mode
-- Alt+End simulates closing the window (can be used as a Panic key)
-Only the LEFT Alt key will work.
-
-
-
-5. Joysticks on SDL/2
----------------------
-
-The Joystick detection only works for standard joysticks (2 buttons, 2 axes
-and the like). Therefore, if you use a non-standard joystick, you should
-specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
-file or CONFIG.SYS, so SDL applications can provide full capability to your
-device. The syntax is:
-
-SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
-
-So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
-the line should be:
-
-SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
-
-If you want to add spaces in your joystick name, just surround it with
-quotes or double-quotes:
-
-SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
-
-or
-
-SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
-
- Notive However that Balls and Hats are not supported under OS/2, and the
-value will be ignored... but it is wise to define these correctly because
-in the future those can be supported.
- Also the number of buttons is limited to 2 when using two joysticks,
-4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
-and 8 when using a joystick with 2 axes. Notice however these are limitations
-of the Joystick Port hardware, not OS/2.
-
-
-
-6. Proportional windows
------------------------
-
-For some SDL applications it can be handy to have proportional windows, so
-the windows will keep their aspect ratio when resized.
-This can be achieved in two ways:
-
-- Before starting the given SDL application, set the
- SDL_USE_PROPORTIONAL_WINDOW environment variable to something, e.g.:
-
- SET SDL_USE_PROPORTIONAL_WINDOW=1
- dosbox.exe
-
-- If you have a HOME environment variable set, then SDL will look for a file
- in there called ".sdl.proportionals". If that file contains the name of the
- currently running SDL executable, then that process will have proportional
- windows automatically.
-
- Please note that this file is created automatically with default values
- at the first run.
-
-
-
-7. Audio in SDL applications
-----------------------------
-
-Audio effects are one of the most important features in games. Creating audio
-effects in sync with the game and without hickups and pauses in the audio are
-very important things.
-
-However there are multithreaded SDL applications that have tight loops as their
-main logic loop. This kills performance in OS/2, and takes too much CPU from
-other threads in the same process, for example from the thread to create the
-sound effects.
-
-For this reason, the OS/2 port of SDL can be instructed to run the audio thread
-in high priority, which makes sure that there will be enough time for the
-processing of the audio data.
-
-At default, SDL/2 runs the audio thread at ForegroundServer+0 priority. Well
-written and well behaving SDL applications should work well in this mode.
-For other applications, you can tell SDL/2 to run the audio thread at
-TimeCritical priority by setting an env.variable before starting the SDL app:
-
- SET SDL_USE_TIMECRITICAL_AUDIO=1
-
-Please note that this is a bit risky, because if the SDL application runs a
-tight infinite loop in this thread, this will make the whole system
-unresponsive, so use it with care, and only for applications that need it!
-
-
-
-8. Next steps...
-----------------
-
-Things to do:
-- Implement missing stuffs (look for 'TODO' string in source code!)
-- Finish video driver (the 'wincommon' can be a good example for missing
- things like application icon and so on...)
-- Enable MMX/SSE/SSE2 acceleration functions
-- Rewrite CDROM support using DOS Ioctl for better support.
-
-
-
-9. Contacts
------------
-
- You can contact the developers for bugs:
-
- Area Developer email
- General (Audio/Video/System) Doodle doodle@scenergy.dfmk.hu
- CDROM and Joystick Caetano daniel@caetano.eng.br
-
- Notice however that SDL/2 is 'in development' stage so ... if you want to help,
-please, be our guest and contact us!
-
-
-
-10. Changelog of the OS/2 port
-------------------------------
-
-Version 1.2.10 - 2006-05-17 - Doodle
- - Small modifications for v1.2.10 release
- - Changed DLL name to include version info (currently SDL12.dll)
-
-Version 1.2 - 2006-05-01 - Doodle
- - Modified makefile system to have only one makefile
- - Included FSLib headers, DLL and LIB file
-
-Version 1.2 - 2006-02-26 - Doodle
- - Updated the official SDL version with the OS/2 specific changes.
- - Added support for real unicode keycode conversion.
-
-Version 1.2.7 - 2006-01-20 - Doodle
- - Added support for selectively using timecritical priority for
- audio threads by SDL_USE_TIMECRITICAL_AUDIO environment variable.
- (e.g.:
- SET SDL_USE_TIMECRITICAL_AUDIO=1
- dosbox.exe
- )
-
-Version 1.2.7 - 2005-12-22 - Doodle
- - Added support for proportional SDL windows.
- There are two ways to have proportional (aspect-keeping) windows for
- a given SDL application: Either set the SDL_USE_PROPORTIONAL_WINDOW
- environment variable to something before starting the application
- (e.g.:
- SET SDL_USE_PROPORTIONAL_WINDOW=1
- dosbox.exe
- )
- or, if you have the HOME environment variable set, then SDL12.DLL will
- create a file in that directory called .sdl.proportionals, and you can
- put there the name of executable files that will be automatically made
- proportional.
-
-Version 1.2.7 - 2005-10-14 - Doodle
- - Enabled Exception handler code in FSLib to be able to restore original
- desktop video mode in case the application crashes.
- - Added the missing FSLib_Uninitialize() call into SDL.
- (The lack of it did not cause problems, but it's cleaner this way.)
- - Fixed a mouse problem in Fullscreen mode where any mouse click
- re-centered the mouse.
-
-Version 1.2.7 - 2005-10-09 - Doodle
- - Implemented window icon support
-
-Version 1.2.7 - 2005-10-03 - Doodle
- - Reworked semaphore support again
- - Tuned thread priorities
-
-Version 1.2.7 - 2005-10-02 - Doodle
- - Added support for custom mouse pointers
- - Fixed WM_CLOSE processing: give a chance to SDL app to ask user...
- - Added support for MMX-accelerated audio mixers
- - Other small fixes
-
-Version 1.2.7 - 2005-09-12 - Doodle
- - Small fixes for DosBox incorporated into public release
- - Fixed semaphore support (SDL_syssem.c)
- - Fixed FSLib to have good clipping in scaled window mode,
- and to prevent occasional desktop freezes.
-
-Version 1.2.7 - 2004-09-08a - Caetano
- - Improved joystick support (general verifications about hardware).
- - Added support up to 8 buttons in 2 axes joysticks and 6 buttons in 3 axes joysticks.
- - Added support to environment variable SDL_OS2_JOYSTICK to specify a joystick.
- - Improved Joystick test to handle every type of joystick and display only relevant information.
- - Merged with Doodle 2004-09-08
- - Little tid up in README.OS2
- - Added explanation about SDL_OS2_JOYSTICK environment variable on README.OS2
-
-Version 1.2.7 - 2004-09-07 - Caetano
- - Merged with changes in headers for GCC compiling.
- - Added Joystick support using basic IBM GAME$ support, allowing it to work with all joystick drivers since OS/2 2.1.
- - Improved joystick detection (hacked!). OS/2 do not allow real joystick detection, so...
- - Modified makefile in test to compile "testjoystick". Anyway, it's useless, since it seems to cause a lot of trouble in OS/2 (because os video routines, not Joystick support).
- - Created separated Joystick test program to test only joystick functions.
- - Improved joystick auto-centering.
- - Improved the coordinate correction routine to use two scale factors for each axis.
-
-Version 1.2.7 - 2004-07-05 - Caetano
- - Corrected the time returned by status in CDROM support (it was incorrect)
- - Added the testcdrom.c and corrected the linking directive (it was causing an error)
-
-Version 1.2.7 - 2004-07-02a - Caetano
- - Corrected a little problem in a comment at SDL-1.2.7\test\torturethread.c, line 18 (missing */, nested comment)
- - Added CDROM support to tree (SDL-1.2.7\src\cdrom\os2\SDL_syscdrom.c)
- - Modified makefile (SDL-1.2.7\src\makefiles.wat and SDL-1.2.7\watcom.mif) to build with CDROM support
- - Added the "extra" SDL_types.h forgotten in 2004-07-02 version.
-
-
diff --git a/alienblaster/project/jni/sdl/README.PS3 b/alienblaster/project/jni/sdl/README.PS3
deleted file mode 100644
index c66467d39..000000000
--- a/alienblaster/project/jni/sdl/README.PS3
+++ /dev/null
@@ -1,29 +0,0 @@
-
-SDL on Sony Playstation3
-------------------------
-
-Installation:
- First, you have to install the Cell SDK
- - Download the Cell SDK installer RPM and ISO images to
- a temporary directory such as /tmp/cellsdk.
- - Mount the image: mount -o loop CellSDK-Devel-Fedora_3.1.0.0.0.iso /tmp/cellsdk
- - Install the SDK installer: rpm -ivh cell-install-3.1.0-0.0.noarch.rpm
- - Install the SDK: cd /opt/cell && ./cellsdk --iso /tmp/cellsdkiso install
-
- You need to install the SPU-libs before installing SDL
- - Go to SDL-1.2/src/video/ps3/spulibs/
- - Run make && make install
-
- Finally, install SDL
- - Go to SDL-1.2/ and build SDL like any other GNU style package.
- e.g.
- - Build the configure-script with ./autogen.sh
- - Configure SDL for your needs: ./configure --enable-video-ps3 ...
- - Build and install it: make && make install
-
-
-Todo:
- - mouse/keyboard/controller support
-
-Have fun!
- Dirk Herrendoerfer
diff --git a/alienblaster/project/jni/sdl/README.PicoGUI b/alienblaster/project/jni/sdl/README.PicoGUI
deleted file mode 100644
index cdb6bedae..000000000
--- a/alienblaster/project/jni/sdl/README.PicoGUI
+++ /dev/null
@@ -1,50 +0,0 @@
- ========================
- Using SDL with PicoGUI
- ========================
-
-- Originally contributed by Micah Dowty
-
-PicoGUI is a scalable GUI system with a unique architecture, primarily focused
-on scalability to various embedded systems. You can find more information
-including a FAQ at http://picogui.org
-
-To use the patch:
-
- 1. When compiling, add the "--enable-video-picogui" switch to ./configure
-
- 2. When running your program, ensure that the picogui driver for SDL
- is in use by setting the SDL_VIDEODRIVER environment variable
- to "picogui".
-
- 3. The program must also be linked to the C client library for PicoGUI
- (libpgui.so). If the program is being compiled with a patched SDL
- installed this should be done automatically. If you want to use an
- existing binary with PicoGUI, you can set the LD_PRELOAD environment
- variable to the path of your libpgui.so file.
-
-Capabilities:
-
- So far only basic functionality is provided on true color (linear16/24/32)
- devices. Accessing a memory mapped bitmap, updating the display, and handling
- mouse/keyboard input. This functionality has been tested with several
- applications, including mplayer, Xine, sldroids, and Abuse.
-
-TODO list:
-
- - YUV overlays will be helpful for watching video on set top boxes or other
- embedded devices that have some graphics acceleration hardware
-
- - Account for rotated bitmap storage in pgserver
-
- - Support for hiding or changing the cursor
-
- - The display should be centered when the SDL application is smaller
- than the PicoGUI panel
-
- - Fullscreen or any other special modes
-
- - Support for indexed and grayscale modes
-
- - Probably much more...
-
---- The End ---
diff --git a/alienblaster/project/jni/sdl/README.Porting b/alienblaster/project/jni/sdl/README.Porting
index df619934f..9bb4613e0 100644
--- a/alienblaster/project/jni/sdl/README.Porting
+++ b/alienblaster/project/jni/sdl/README.Porting
@@ -37,6 +37,7 @@ There are two basic ways of building SDL at the moment:
src/timer/*.c
src/video/*.c
src/audio/disk/*.c
+ src/audio/dummy/*.c
src/video/dummy/*.c
src/joystick/dummy/*.c
src/cdrom/dummy/*.c
diff --git a/alienblaster/project/jni/sdl/README.QNX b/alienblaster/project/jni/sdl/README.QNX
deleted file mode 100644
index 995afbec0..000000000
--- a/alienblaster/project/jni/sdl/README.QNX
+++ /dev/null
@@ -1,155 +0,0 @@
-README.QNX by Mike Gorchak ,
-Last changed at 24 Apr 2004.
-
-======================================================================
-Table of Contents:
-
-1. OpenGL.
-2. Wheel and multi-button mouses.
-3. CDROM handling issues.
-4. Hardware video overlays.
-5. Shared library building.
-6. Some building issues.
-7. Environment variables.
-
-======================================================================
-1. OpenGL:
-
- OpenGL works well and is stable, but fullscreen mode has not been
-heavily tested yet.
- If you have QNX RtP version 6.1.0 or above you must download the
-Photon3D runtime from http://developers.qnx.com or install it from the
-public repository or from the public CD, available with QNX. OS versi-
-ons below 6.1.0 are not supported.
- When creating an OpenGL context, software renderer mode is artifi-
-cially selected (QSSL made acceleration only for Voodoo boards in
-fullscreen mode, sorry but I don't have this board to test OpenGL -
-maybe it works or maybe not :)). If you want acceleration - you can
-remove one line in the source code: find the file SDL_ph_image.c and
-remove the following
-
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
-
-line in the ph_SetupOpenGLContext() function or change the argument to
-PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW.
-
-======================================================================
-2. Wheel and multi-button mouses:
-
- Photon emits keyboard events (key up and down) when the mouse
-wheel is moved. The key_scan field appears valid, and it contains zero.
-That is a basic method of detecting mouse wheel events under Photon.
-It looks like a hack, but it works for me :) on various PC configura-
-tions.
-
-I've tested it on:
-
-1. Genius Optical NetScroll/+ PS/2 (1 wheel)
-2. A4Tech Optical GreatEye WheelMouse PS/2, model: WOP-35. (2 wheels
- + 2 additional buttons). The wheel for vertical scrolling works as
- usual, but the second wheel for horizontal scrolling emits two se-
- quential events up or down, so it can provide faster scrolling than
- the first wheel. Additional buttons don't emit any events, but it
- looks like they're handled by photon in an unusual way - like click
- to front, but works not with any window, looks like a fun bug-o-fe-
- ature :).
-
-======================================================================
-3. CDROM handling issues:
-
- Access to CDROM can only be provided with 'root' privileges. I
-can't do anything about that, /dev/cd0 has brw------- permissions and
-root:root rights.
-
-======================================================================
-4. Hardware video overlays:
-
- Overlays can flicker during window movement, resizing, etc. It
-happens because the photon driver updates the real window contents be-
-hind the overlay, then draws the temporary chroma key color over the
-window contents. It can be done without using the chroma key but that
-causes the overlay to always be on top. So flickering during window
-movement is preferred instead.
- Double buffering code is temporarily disabled in the photon driver
-code, because on my GF2-MX it can accidentally cause a buffer switch,
-which causes the old frame to show. S3 Savage4 has the same problem,
-but ATI Rage 128 doesn't. I think it can be fixed later. Current code
-works very well, so maybe double buffering is not needed right now.
- Something strange happens when you try to move the window with the
-overlay beyond the left border of the screen. The overlay tries to
-stay at position x=0, but when attempting to move it a bit more it
-jumps to position x=-60 (on GF2-MX, on ATI Rage128 this value a bit
-smaller). It's really strange, looks like the overlay doesn't like
-negative coordinates.
-
-=======================================================================
-5. Shared library building:
-
- A shared library can be built, but before running the autogen.sh
-script you must manually delete the libtool.m4 stuff from the acinclu-
-de.m4 file (it comes after the ESD detection code up to the end of the
-file), because the libtool stuff in the acinclude.m4 file was very old
-in SDL distribution before the version 1.2.7 and doesn't knew anything
-about QNX. SDL 1.2.7 distribution contains the new libtool.m4 script,
-but anyway it is broken :), Just remove it, then run "libtoolize
---force --copy", delete the file aclocal.m4 if it is exists and after
-that run the autogen.sh script. SDL 1.2.8 contains fixed libtool.m4,
-ltmain.sh and config.sub files, so you can just run the autogen.sh
-script.
-
-======================================================================
-6. Some building issues:
-
- Feel free to not use the --disable-shared configure option if you'
-ve read the above comment about 'Shared library building'. Otherwise
-this option is strongly recommended, as without it the sdl-config
-script will be broken.
-
- Run the configure script without x11 support, e.g.:
-
- a) for OpenGL support:
- ./configure --prefix=/usr \
- --disable-video-x11 \
- --disable-shared
-
- b) without OpenGL support:
- ./configure --prefix=/usr \
- --disable-video-x11 \
- --disable-shared \
- --disable-video-opengl
-
- And of course dont forget to specify --disable-debug, which is on
-by default, to disable debug and enable the expensive optimizations.
-
- In the test directory also run the ./configure script without
-x11 support, e.g.:
-
- ./configure --with-sdl-prefix=/usr \
- --with-sdl-exec-prefix=/usr \
- --prefix=/usr --without-x
-
-======================================================================
-7. Environment variables:
-
- Please note that the photon driver is sensible to the following
-environmental variables:
-
- * SDL_PHOTON_FULLSCREEN_REFRESH - this environment variable controls
-the refresh rate in all fullscreen modes. Be carefull !!! Photon
-drivers usually do not checking the maximum refresh rate, which video
-adapter or monitor supports.
-
- * SDL_VIDEO_WINDOW_POS - can be set in the "X,Y" format. If X and Y
-coordinates are bigger than the current desktop resolution, then win-
-dow positioning across virtual consoles is activated. If X and Y are
-smaller than the desktop resolution then window positioning in the
-current console is activated. The word "center" can be used instead of
-coordinates, it produces the same behavior as SDL_VIDEO_CENTERED
-environmental variable.
-
- * SDL_VIDEO_CENTERED - if this environmental variable exists then the
-window centering is perfomed in the current virtual console.
-
-Notes: The SDL_VIDEO_CENTERED enviromental variable has greater pri-
-ority than the SDL_VIDEO_WINDOW_POS in case if both variables are sup-
-plied to the application.
diff --git a/alienblaster/project/jni/sdl/README.Qtopia b/alienblaster/project/jni/sdl/README.Qtopia
deleted file mode 100644
index 01627d1fb..000000000
--- a/alienblaster/project/jni/sdl/README.Qtopia
+++ /dev/null
@@ -1,84 +0,0 @@
-
-==============================================================================
-Using the Simple DirectMedia Layer with Qtopia/OPIE
-==============================================================================
-
-==============================================================================
-I. Setting up the Qtopia development environment.
-
- This document will not explain how to setup the Qtopia development
- environment. That is outside the scope of the document. You can read
- more on this subject in this excellent howto:
-
- http://www.zauruszone.com/howtos/linux_compiler_setup_howto.html
-
-==============================================================================
-II. Building the Simple DirectMedia Layer libraries using the arm
- cross-compiler
-
- This is somewhat tricky since the name of the compiler binaries
- differ from the standard. Also you should disable features not
- needed. The command below works for me. Note that it's all one
- line. You can also set the NM, LD etc environment variables
- separately.
-
- NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --enable-video-qtopia --disable-video-dummy --disable-video-fbcon --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-cdrom --disable-video-x11 --disable-nasm --prefix=/opt/Qtopia/sharp/ arm-unknown-linux-gnu
-
- One thing to note is that the above configure will include joystick
- support, even though you can't have joysticks on the Zaurus. The
- reason for this is to avoid link / compile / runtime errors with
- applications that have joystick support.
-
-==============================================================================
-III. Building the Simple DirectMedia Layer test programs:
-
- After installing, making sure the correct sdl-config is in your
- path, run configure like this:
-
- NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar ./configure arm-unknown-linux-gnu
-
-==============================================================================
-IV. Application porting notes
-
- One thing I have noticed is that applications sometimes don't exit
- correctly. Their icon remains in the taskbar and they tend to
- relaunch themselves automatically. I believe this problem doesn't
- occur if you exit your application using the exit() method. However,
- if you end main() with 'return 0;' or so, this seems to happen.
-
- Also note that when running in landscape mode - i.e requesting a
- window that is HEIGHT pixels wide and WIDTH pixels high, where WIDTH
- and HEIGHT normally is 240 and 320 - the image is blitted so that
- the hardware buttons are on the left side of the display. This might
- not always be desirable but such is the code today.
-
-
-==============================================================================
-V. Enjoy! :)
-
- If you have a project you'd like me to know about, or want to ask questions,
- go ahead and join the SDL developer's mailing list by sending e-mail to:
-
- sdl-request@libsdl.org
-
- and put "subscribe" into the subject of the message. Or alternatively you
- can use the web interface:
-
- http://www.libsdl.org/mailman/listinfo/sdl
-
-==============================================================================
-VI. What is supported:
-
-Keyboard (Sharp Zaurus)
-Hardware buttons
-Stylus input (mouse)
-Video. Allows fullscreen both in portrait mode (up to WIDTHxHEIGHT
-size window) and in landscape mode (up to HEIGHTxWIDTH).
-
-All other SDL functionality works like a normal Linux system (threads,
-audio etc).
-
---
-David Hedbor
-http://david.hedbor.org/ http://eongames.com/
-
diff --git a/alienblaster/project/jni/sdl/README.RISCOS b/alienblaster/project/jni/sdl/README.RISCOS
deleted file mode 100644
index 1ab85984a..000000000
--- a/alienblaster/project/jni/sdl/README.RISCOS
+++ /dev/null
@@ -1,130 +0,0 @@
-Readme for RISC OS port of SDL
-==============================
-
-This document last updated on 2nd Februrary 2006
-
-This is a RISC OS port of the Simple Direct Media Layer (SDL) by Alan Buckley with contributions from Peter Naulls.
-
-Details of the SDL can be found at http://www.libsdl.org.
-
-The source code including the RISC OS version can be obtained from:
-
-http://www.libsdl.org.
-
-Pre built libraries and many games and applications compiled for RISC OS using this library can be downloaded from The Unix Porting Project at http://www.riscos.info/unix/.
-
-This is released under the LGPL see the file COPYING for details.
-
-
-Compiling applications under RISC OS
-====================================
-
-Add -ISDL: for the C compiler flags if you include the files in the SDL directory. e.g. #include "SDL/SDL.h"
-Add -ISDL:SDL for the C compiler flags if you include the files directly. e.g. #include "SDL/SDL.h"
-
-Add -LSDL: -lSDL to the link stage of compilation.
-
-For example, to compile the testbitmap.c sample you could use:
-
-gcc -ISDL:SDL -LSDL: -lSDL testbitmap.c -otestbitmap
-
-
-RISC OS port of SDL runtime information
-=======================================
-
-Runtime requirements
---------------------
-
-This library currently needs a minimum of RISC OS 3.6. The source code for the library (and a lot of the programs built with it) also need long file names.
-
-To use the audio you also need 16 bit sound and to have installed the DigitalRender module by Andreas Dehmel version 0.51 available from his
-web site: http://home.t-online.de/~zarquon
-This is loaded when needed by UnixLib.
-
-Note: As most programs ported from other OSes use high resolution graphics and a memory back buffer a machine with a StrongARM processor and 1 or 2MB of VRAM (or a better machine) is recomended.
-
-
-RISC OS runtime parameters
---------------------------
-
-Several environmental variables have been defined to make porting programs easier (i.e. By setting these variable you do not need to have source code differences between OSes).
-
-They are all defined on an application basis.
-
-The used below is found as follows:
-1. Use the name of the program unless it is !RunImage
-2. Check the folder specification for the folder !RunImage is run from. If it is a folder name use that name, otherwise if it is an environmental variable of the form use the value of XXX.
-
-The variables are:
-
-SDL$$TaskName
-
-The name of the task for RISC OS. If omitted then is used for the task name,
-
-SDL$$BackBuffer
-
-Set to 1 to use a system memory back buffer for the screen in full screen mode. Some programs on other systems assume their is always a back buffer even though the SDL specification specifies this is not the case. The current RISC OS implementation uses direct writes to the screen if a hardware fullscreen is requested.
-
-Set to 2 to use an ARM code full word copy. This is faster than the standard back buffer, but uses aligned words only so it is possible (but unlikely) for it to corrupt the screen for 8bpp and 16bpp modes.
-
-Set to 3 to use a RISC OS sprite as the back buffer. This is usually the slowest for most SDL applications, however it may be useful in the future as Sprite acceleration is added to various hardware that runs RISC OS.
-
-SDL$$CloseAction - set the action for the close icon. Again as programs don't match the specification you can set this to 0 to remove the close icon from the main window for applications where this does not affect the program.
-
-
-RISC OS SDL port API notes
-==========================
-
-Current level of implementation
--------------------------------
-
-The following list is an overview of how much of the SDL is implemented. The areas match the main areas of the SDL.
-
-video - Mostly done. Doesn't cover gamma, YUV-overlay or OpenGL.
-Window Manager - Mostly done. SetIcon/IconifyWindow not implemented.
-Events - Mostly done. Resize and some joystick events missing.
-Joystick - Currently assumes a single joystick with 4 buttons.
-Audio - Done
-CDROM - Not implemented.
-Threads - Done
-Timers - Done
-
-Thread support can be removed by defining DISABLE_THREADS and recompiling the library.
-
-SDL API notes
--------------
-
-This section contains additional notes on some specific commands.
-
-SDL_SetVideoMode
- On RISC OS a fullscreen mode directly accesses the screen. This can be modified by the environmental variable (SDL$$BackBuffer) or by using the SDL_SWSURFACE flag to write to an offscreen buffer that is updated using SDL_UpdateRects.
- Open GL is not supported so SDL_OPENGL and SDL_OPENGLBLIT flags fail.
- SDL_RESIZEABLE and SDL_NOFRAME flags are not supported.
-
-SDL_SetColors
- In a wimp mode the screen colours are not changed for a hardware palette instead the RISC OS sprite colour mapping is used to get the best matching colours.
-
-SDL_CreateCursor
- Inverted colour is not supported.
-
-SDL_WM_ToggleFullScreen
- Currently this won't work if the application starts up in Fullscreen mode.
- Toggling to fullscreen will only work if the monitor is set up to support the exact screen size requested.
-
-SDL_EnableUNICODE
- Unicode translation used here is only really accurate for 7 bit characters.
-
-SDL_NumJoysticks/JoystickName etc.
- Hardcoded to expect only 1 joystick with 4 buttons if the Joystick module is loaded.
-
-SDL_GetTicks
- Timer used has only a centisecond accuracy. This applies to other time related functions.
-
-SDL_Delay
- Modified to poll keyboard/mouse during the delay on the event thread.
-
-
-Notes on current implementation
--------------------------------
-
-Keyboard and mouse are polled so if too long a time is spent between a call to SDL_PumpEvents, functions that use it, or SDL_Delay events can be missed.
diff --git a/alienblaster/project/jni/sdl/README.SVN b/alienblaster/project/jni/sdl/README.SVN
deleted file mode 100644
index 65c5c427e..000000000
--- a/alienblaster/project/jni/sdl/README.SVN
+++ /dev/null
@@ -1,23 +0,0 @@
-
-The latest development version of SDL is available via Subversion.
-Subversion allows you to get up-to-the-minute fixes and enhancements;
-as a developer works on a source tree, you can use svn to mirror that
-source tree instead of waiting for an official release. Please look
-at the Subversion website ( http://subversion.tigris.org/ ) for more
-information on using svn, where you can also download software for
-MacOS, Windows, and Unix systems.
-
- svn checkout http://svn.libsdl.org/branches/SDL-1.2
-
-If you are building SDL with an IDE, you will need to copy the file
-include/SDL_config.h.default to include/SDL_config.h before building.
-
-If you are building SDL via configure, you will need to run autogen.sh
-before running configure.
-
-There is a web interface to the subversion repository at:
- http://www.libsdl.org/cgi/viewvc.cgi
-
-There is an RSS feed available at that URL, for those that want to
-track commits in real time.
-
diff --git a/alienblaster/project/jni/sdl/README.Symbian b/alienblaster/project/jni/sdl/README.Symbian
deleted file mode 100644
index 32d925a00..000000000
--- a/alienblaster/project/jni/sdl/README.Symbian
+++ /dev/null
@@ -1,23 +0,0 @@
-==============================================================================
-Using the Simple DirectMedia Layer with S60 3.x / Symbian 9.x
-==============================================================================
-
-These instuctions are for people developing for S60 3.x. S60 3.x
-uses Symbian OS so you need S60 SDK.
-
-extract "symbian.zip" into this folder.
-
-go to symbian folder
-
-bldmake bldfiles
-abld build
-
-That produces WINSCW and ARMV5 versions of sdl.dll runtime library
-and sdl.lib for development.
-The sdlexe.dll/sdlexe.lib and sdlmain.lib are for easy SDL S60
-integration, please see http://www.mbnet.fi/~mertama/sdl.html
-for further info.
-
-
-
-
diff --git a/alienblaster/project/jni/sdl/README.Watcom b/alienblaster/project/jni/sdl/README.Watcom
deleted file mode 100644
index 2849a11c0..000000000
--- a/alienblaster/project/jni/sdl/README.Watcom
+++ /dev/null
@@ -1,133 +0,0 @@
-
-Using SDL under Windows with the OpenWatcom compiler
-====================================================
-
-Prerequisites
--------------
-
-I have done the port under Windows XP Home with SP2 installed. Windows
-2000 should also be working. I'm not so sure about ancient Windows NT,
-since only DirectX 3 is available there. Building should be possible,
-but running the compiled applications will probalbly fail with
-SDL_VIDEODRIVER=directx. The windib driver should work, though.
-
-To compile and use the SDL with Open Watcom you will need the following:
-- Open Watcom compiler. I used version 1.5. The environment variables
- PATH, WATCOM and INCLUDE need to be set appropriately - please consult
- the OpenWatcom documentation and instructions given during the
- installation of the compiler.
- My setup looks like this in owvars.bat:
- set WATCOM=C:\watcom
- set INCLUDE=%WATCOM%\h;%WATCOM%\h\nt
- set PATH=%PATH%;%WATCOM%\binnt;%WATCOM%\binw
-- A fairly recent DirectX SDK. The original unmodified DX8 SDK works, as
- well as the minimal DirectX 7 SDK from the Allegro download site
- ().
-- The SDL sources from Subversion
-- The file Watcom-Win32.zip (now available in Subversion)
-
-
-Building the Library
---------------------
-
-1) In the SDL base directory extract the archive Watcom-Win32.zip. This
- creates a subdirectory named 'watcom'.
-2) The makefile expects the environment variable DXDIR to be set to the
- base directory of a DirectX SDK. I have tried a stock DX8 SDK from
- Microsoft as well as the minimal DirectX 7 SDK from the Allegro
- download site.
- You can also edit the makefile directly and hard code your path to
- the SDK on your system.
- I have this in my setup:
- set DXDIR=D:\devel\DX8_SDK
-3) Enter the watcom directory and run
- wmake sdl
-4) All tests from the test directory are working and can be built by
- running
- wmake tests
-
-Notes:
-
- The makefile offers some options to tweak the way the library is built.
- You have at your disposal the option to build a static (default)
- library, or a DLL (with tgt=dll). You can also choose whether to build
- a Release (default) or a Debug version (with build=debug) of the tests
- and library. Please consult the usage comment at the top of the
- makefile for usage instructions.
-
- If you specify a test target (i.e. 'wmake tests' for all tests, or
- selected targets like 'wmake testgl testvidinfo testoverlay2'), the
- tests are always freshly compiled and linked. This is done to
- minimise hassle when switching between library versions (static vs.
- DLL), because they require subtly different options.
- Also, the test executables are put directly into the test directory,
- so they can find their data files. The clean target of the makefile
- removes the test executables and the SDL.dll file from the test
- directory.
-
- To use the library in your own projects with Open Watcom, you can use
- the way the tests are built as base of your own build environment.
-
- The library can also be built with the stack calling convention of the
- compiler (-6s instead of -6r).
-
-
-Test applications
------------------
-
-I've tried to make all tests work. The following table gives an overview
-of the current status.
-
- Testname Status
-~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-checkkeys +
-graywin +
-loopwave +
-testalpha +
-testbitmap +
-testdyngl +
-testerror +
-testfile +
-testgamma +
-testgl +
-testhread +
-testiconv - (all failed)
-testkeys +
-testlock +
-testoverlay + (needs 'set SDL_VIDEODRIVER=directx')
-testoverlay2 + (needs 'set SDL_VIDEODRIVER=directx')
-testpalette +
-testplatform +
-testsem +
-testsprite +
-testtimer +
-testver +
-testvidinfo +
-testwin ? (fading doesn't seem right)
-testwm +
-torturethread +
-testcdrom +
-testjoystick not tested
-threadwin +
-testcursor +
-
-
-TODO
-----
-
-There is room for further improvement:
-- Test joystick functionality.
-- Investigate fading issue in 'testwin' test.
-- Fix the UTF-8 support.
-- Adapt the makefile/object file list to support more target systems
-- Use "#pragma aux" syntax for the CPU info functions.
-
-
-Questions and Comments
-----------------------
-
-Please direct any questions or comments to me:
-
- Happy Coding!
-
- Marc Peter
diff --git a/alienblaster/project/jni/sdl/README.WinCE b/alienblaster/project/jni/sdl/README.WinCE
deleted file mode 100644
index 6f8799ef8..000000000
--- a/alienblaster/project/jni/sdl/README.WinCE
+++ /dev/null
@@ -1,55 +0,0 @@
-
-Project files for embedded Visual C++ 3.0, 4.0 and
-Visual Studio 2005 can be found in VisualCE.zip
-
-SDL supports GAPI and WinDib output for Windows CE.
-
-GAPI driver supports:
-
-- all possible WinCE devices (Pocket PC, Smartphones, HPC)
- with different orientations of video memory and resolutions.
-- 4, 8 and 16 bpp devices
-- special handling of 8bpp on 8bpp devices
-- VGA mode, you can even switch between VGA and GAPI in runtime
- (between 240x320 and 480x640 for example). On VGA devices you can
- use either GAPI or VGA.
-- Landscape mode and automatic rotation of buttons and stylus coordinates.
- To enable landscape mode make width of video screen bigger than height.
- For example:
- SDL_SetVideoMode(320,240,16,SDL_FULLSCREEN)
-- WM2005
-- SDL_ListModes
-
-NOTE:
-There are several SDL features not available in the WinCE port of SDL.
-
-- DirectX is not yet available
-- Semaphores are not available
-- Joystick support is not available
-- CD-ROM control is not available
-
-In addition, there are several features that run in "degraded" mode:
-
-Preprocessor Symbol Effect
-=================== =================================
-
-SDL_systimer.c:
-USE_GETTICKCOUNT Less accurate values for SDL time functions
-USE_SETTIMER Use only a single marginally accurate timer
-
-SDL_syswm.c:
-DISABLE_ICON_SUPPORT Can't set the runtime window icon
-
-SDL_sysmouse.c:
-USE_STATIC_CURSOR Only the arrow cursor is available
-
-SDL_sysevents.c:
-NO_GETKEYBOARDSTATE Can't get modifier state on keyboard focus
-
-SDL_dibevents.c:
-NO_GETKEYBOARDSTATE Very limited keycode translation
-
-SDL_dibvideo.c:
-NO_GETDIBITS Can't distinguish between 15 bpp and 16 bpp
-NO_CHANGEDISPLAYSETTINGS No fullscreen support
-NO_GAMMA_SUPPORT Gamma correction not available
diff --git a/alienblaster/project/jni/sdl/README.wscons b/alienblaster/project/jni/sdl/README.wscons
deleted file mode 100644
index 349c89c99..000000000
--- a/alienblaster/project/jni/sdl/README.wscons
+++ /dev/null
@@ -1,107 +0,0 @@
-==============================================================================
-Using the Simple DirectMedia Layer with OpenBSD/wscons
-==============================================================================
-
-The wscons SDL driver can be used to run SDL programs on OpenBSD
-without running X. So far, the driver only runs on the Sharp Zaurus,
-but the driver is written to be easily extended for other machines.
-The main missing pieces are blitting routines for anything but 16 bit
-displays, and keycode maps for other keyboards. Also, there is no
-support for hardware palettes.
-
-There is currently no mouse support.
-
-To compile SDL with support for wscons, use the
-"--enable-video-wscons" option when running configure. I used the
-following command line:
-
-./configure --disable-oss --disable-ltdl --enable-pthread-sem \
- --disable-esd --disable-arts --disable-video-aalib \
- --enable-openbsdaudio --enable-video-wscons \
- --prefix=/usr/local --sysconfdir=/etc
-
-
-Setting the console device to use
-=================================
-
-When starting an SDL program on a wscons console, the driver uses the
-current virtual terminal (usually /dev/ttyC0). To force the driver to
-use a specific terminal device, set the environment variable
-SDL_WSCONSDEV:
-
-bash$ SDL_WSCONSDEV=/dev/ttyC1 ./some-sdl-program
-
-This is especially useful when starting an SDL program from a remote
-login prompt (which is great for development). If you do this, and
-want to use keyboard input, you should avoid having some other program
-reading from the used virtual console (i.e., do not have a getty
-running).
-
-
-Rotating the display
-====================
-
-The display can be rotated by the wscons SDL driver. This is useful
-for the Sharp Zaurus, since the display hardware is wired so that it
-is correctly rotated only when the display is folded into "PDA mode."
-When using the Zaurus in "normal," or "keyboard" mode, the hardware
-screen is rotated 90 degrees anti-clockwise.
-
-To let the wscons SDL driver rotate the screen, set the environment
-variable SDL_VIDEO_WSCONS_ROTATION to "CW", "CCW", or "UD", for
-clockwise, counter clockwise, and upside-down rotation respectively.
-"CW" makes the screen appear correct on a Sharp Zaurus SL-C3100.
-
-When using rotation in the driver, a "shadow" frame buffer is used to
-hold the intermediary display, before blitting it to the actual
-hardware frame buffer. This slows down performance a bit.
-
-For completeness, the rotation "NONE" can be specified to use a shadow
-frame buffer without actually rotating. Unsetting
-SDL_VIDEO_WSCONS_ROTATION, or setting it to '' turns off the shadow
-frame buffer for maximum performance.
-
-
-Running MAME
-============
-
-Since my main motivation for writing the driver was playing MAME on
-the Zaurus, I'll give a few hints:
-
-XMame compiles just fine under OpenBSD.
-
-I'm not sure this is strictly necessary, but set
-
-MY_CPU = arm
-
-in makefile.unix, and
-
-CFLAGS.arm = -DLSB_FIRST -DALIGN_INTS -DALIGN_SHORTS
-
-in src/unix/unix.max
-
-to be sure.
-
-The latest XMame (0.101 at this writing) is a very large program.
-Either tinker with the make files to compile a version without support
-for all drivers, or, get an older version of XMame. My recommendation
-would be 0.37b16.
-
-When running MAME, DO NOT SET SDL_VIDEO_WSCONS_ROTATION! Performace
-is MUCH better without this, and it is COMPLETELY UNNECESSARY, since
-MAME can rotate the picture itself while drawing, and does so MUCH
-FASTER.
-
-Use the Xmame command line option "-ror" to rotate the picture to the
-right.
-
-
-Acknowledgments
-===============
-
-I studied the wsfb driver for XFree86/Xorg quite a bit before writing
-this, so there ought to be some similarities.
-
-
---
-Staffan Ulfberg
diff --git a/alienblaster/project/jni/sdl/SDL.qpg.in b/alienblaster/project/jni/sdl/SDL.qpg.in
deleted file mode 100644
index 8e1ff8da8..000000000
--- a/alienblaster/project/jni/sdl/SDL.qpg.in
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- QNX.ORG.RU Community
-
-
- QNX.ORG.RU Team
- Mike Gorchak
- mike@malva.ua
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Library
- SDL
- 1
- http://qnx.org.ru/repository
- 2.6
-
-
-
- Simple DirectMedia Layer (SDL)
- SDL
- slouken@libsdl.org
- Public
- public
- http://www.libsdl.org
-
- slouken@libsdl.org
- Sam Lantinga
- http://www.libsdl.org
-
- slouken@libsdl.org
-
-
- This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.
- This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. This is the libraries, include files and other resources you can use to develop and run SDL applications.
- http://www.libsdl.org
-
-
-
-
- @VERSION@
- Medium
- Stable
-
-
- 1
-
- GNU Lesser General Public License
-
-
-
- Software Development/Libraries and Extensions/C Libraries
- SDL,audio,graphics,demos,games,emulators,direct,media,layer
- qnx6
- none
- Photon
- Console
- Developer
- User
-
- repdata://LicenseUrl/COPYING
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/alienblaster/project/jni/sdl/SDL.spec b/alienblaster/project/jni/sdl/SDL.spec
deleted file mode 100644
index fb505310b..000000000
--- a/alienblaster/project/jni/sdl/SDL.spec
+++ /dev/null
@@ -1,113 +0,0 @@
-Summary: Simple DirectMedia Layer
-Name: SDL
-Version: 1.2.14
-Release: 1
-Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
-URL: http://www.libsdl.org/
-License: LGPL
-Group: System Environment/Libraries
-BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
-Prefix: %{_prefix}
-%ifos linux
-Provides: libSDL-1.2.so.0
-%endif
-
-%define __defattr %defattr(-,root,root)
-%define __soext so
-
-%description
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-%package devel
-Summary: Libraries, includes and more to develop SDL applications.
-Group: Development/Libraries
-Requires: %{name} = %{version}
-
-%description devel
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-This is the libraries, include files and other resources you can use
-to develop SDL applications.
-
-
-%prep
-%setup -q
-
-%build
-%ifos linux
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
-%else
-%configure
-%endif
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-%ifos linux
-make install prefix=$RPM_BUILD_ROOT%{prefix} \
- bindir=$RPM_BUILD_ROOT%{_bindir} \
- libdir=$RPM_BUILD_ROOT%{_libdir} \
- includedir=$RPM_BUILD_ROOT%{_includedir} \
- datadir=$RPM_BUILD_ROOT%{_datadir} \
- mandir=$RPM_BUILD_ROOT%{_mandir}
-ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0
-%else
-%makeinstall
-%endif
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%{__defattr}
-%doc README-SDL.txt COPYING CREDITS BUGS
-%{_libdir}/lib*.%{__soext}.*
-
-%files devel
-%{__defattr}
-%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html
-%doc docs/index.html docs/html
-%{_bindir}/*-config
-%{_libdir}/lib*.a
-%{_libdir}/lib*.la
-%{_libdir}/lib*.%{__soext}
-%dir %{_includedir}/SDL
-%{_includedir}/SDL/*.h
-%{_libdir}/pkgconfig/sdl.pc
-%{_datadir}/aclocal/*
-%{_mandir}/man3/*
-
-%changelog
-* Tue May 16 2006 Sam Lantinga
-- Removed support for Darwin, due to build problems on ps2linux
-
-* Mon Jan 03 2004 Anders Bjorklund
-- Added support for Darwin, updated spec file
-
-* Wed Jan 19 2000 Sam Lantinga
-- Re-integrated spec file into SDL distribution
-- 'name' and 'version' come from configure
-- Some of the documentation is devel specific
-- Removed SMP support from %build - it doesn't work with libtool anyway
-
-* Tue Jan 18 2000 Hakan Tandogan
-- Hacked Mandrake sdl spec to build 1.1
-
-* Sun Dec 19 1999 John Buswell
-- Build Release
-
-* Sat Dec 18 1999 John Buswell
-- Add symlink for libSDL-1.0.so.0 required by sdlbomber
-- Added docs
-
-* Thu Dec 09 1999 Lenny Cartier
-- v 1.0.0
-
-* Mon Nov 1 1999 Chmouel Boudjnah
-- First spec file for Mandrake distribution.
-
-# end of file
diff --git a/alienblaster/project/jni/sdl/SDL.spec.in b/alienblaster/project/jni/sdl/SDL.spec.in
deleted file mode 100644
index dbda11210..000000000
--- a/alienblaster/project/jni/sdl/SDL.spec.in
+++ /dev/null
@@ -1,113 +0,0 @@
-Summary: Simple DirectMedia Layer
-Name: SDL
-Version: @SDL_VERSION@
-Release: 1
-Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
-URL: http://www.libsdl.org/
-License: LGPL
-Group: System Environment/Libraries
-BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
-Prefix: %{_prefix}
-%ifos linux
-Provides: libSDL-1.2.so.0
-%endif
-
-%define __defattr %defattr(-,root,root)
-%define __soext so
-
-%description
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-%package devel
-Summary: Libraries, includes and more to develop SDL applications.
-Group: Development/Libraries
-Requires: %{name} = %{version}
-
-%description devel
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-This is the libraries, include files and other resources you can use
-to develop SDL applications.
-
-
-%prep
-%setup -q
-
-%build
-%ifos linux
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
-%else
-%configure
-%endif
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-%ifos linux
-make install prefix=$RPM_BUILD_ROOT%{prefix} \
- bindir=$RPM_BUILD_ROOT%{_bindir} \
- libdir=$RPM_BUILD_ROOT%{_libdir} \
- includedir=$RPM_BUILD_ROOT%{_includedir} \
- datadir=$RPM_BUILD_ROOT%{_datadir} \
- mandir=$RPM_BUILD_ROOT%{_mandir}
-ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0
-%else
-%makeinstall
-%endif
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%{__defattr}
-%doc README-SDL.txt COPYING CREDITS BUGS
-%{_libdir}/lib*.%{__soext}.*
-
-%files devel
-%{__defattr}
-%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html
-%doc docs/index.html docs/html
-%{_bindir}/*-config
-%{_libdir}/lib*.a
-%{_libdir}/lib*.la
-%{_libdir}/lib*.%{__soext}
-%dir %{_includedir}/SDL
-%{_includedir}/SDL/*.h
-%{_libdir}/pkgconfig/sdl.pc
-%{_datadir}/aclocal/*
-%{_mandir}/man3/*
-
-%changelog
-* Tue May 16 2006 Sam Lantinga
-- Removed support for Darwin, due to build problems on ps2linux
-
-* Mon Jan 03 2004 Anders Bjorklund
-- Added support for Darwin, updated spec file
-
-* Wed Jan 19 2000 Sam Lantinga
-- Re-integrated spec file into SDL distribution
-- 'name' and 'version' come from configure
-- Some of the documentation is devel specific
-- Removed SMP support from %build - it doesn't work with libtool anyway
-
-* Tue Jan 18 2000 Hakan Tandogan
-- Hacked Mandrake sdl spec to build 1.1
-
-* Sun Dec 19 1999 John Buswell
-- Build Release
-
-* Sat Dec 18 1999 John Buswell
-- Add symlink for libSDL-1.0.so.0 required by sdlbomber
-- Added docs
-
-* Thu Dec 09 1999 Lenny Cartier
-- v 1.0.0
-
-* Mon Nov 1 1999 Chmouel Boudjnah
-- First spec file for Mandrake distribution.
-
-# end of file
diff --git a/alienblaster/project/jni/sdl/TODO b/alienblaster/project/jni/sdl/TODO
index 65bb01c17..f310ce227 100644
--- a/alienblaster/project/jni/sdl/TODO
+++ b/alienblaster/project/jni/sdl/TODO
@@ -1,25 +1,19 @@
-Wish list for the 1.3 development branch:
-http://bugzilla.libsdl.org/
+1.3 release checklist:
+ * http://wiki.libsdl.org/moin.cgi/Roadmap
- * Add mousewheel events (new unified event architecture?)
- * DirectInput joystick support needs to be implemented
- * Be able to enumerate and select available audio and video drivers
- * Fullscreen video mode support for Mac OS X
- * Explicit vertical retrace wait (maybe separate from SDL_Flip?)
- * Shaped windows, windows without borders
- * Multiple windows, multiple display support
- * SDL_INIT_EVENTTHREAD on Windows and MacOS?
- * Add a timestamp to events
- * Add audio input API
- * Add hardware accelerated scaled blit
- * Add hardware accelerated alpha blits
- * Redesign blitting architecture to allow blit plugins
+ * See why windows are being rearranged. Is the shield window not up?
+ * Make sure you can create and show a fullscreen window in one step
+ * Figure out how to handle OpenGL context lost on Mac OS X (does it happen?)
+ * Write automated test case for multi-draw APIs
+ * Make sure you can build SDL without the renderer to slim it down a bunch
+ * Implement assertion code on iPhone
+ * Add __WINDOWS__ in addition to __WIN32__
-In the jump from 1.2 to 1.3, we should change the SDL_Rect members to
-int and evaluate all the rest of the datatypes. This is the only place
-we should do it though, since the 1.2 series should not break binary
-compatibility in this way.
-
-Requests:
- * PCM and CDROM volume control (deprecated, but possible)
+ * Check 1.2 revisions:
+ 3554 - Need to resolve semantics for locking keys on different platforms
+ 4874 - Do we want screen rotation? At what level?
+ 4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
+ 4484, 4485 - Verify that SDL's Windows keyboard handling works correctly
+ 4865 - See if this is still needed (mouse coordinate clamping)
+ 4866 - See if this is still needed (blocking window repositioning)
diff --git a/alienblaster/project/jni/sdl/UNDER_CONSTRUCTION.txt b/alienblaster/project/jni/sdl/UNDER_CONSTRUCTION.txt
new file mode 100644
index 000000000..cf92fce06
--- /dev/null
+++ b/alienblaster/project/jni/sdl/UNDER_CONSTRUCTION.txt
@@ -0,0 +1 @@
+WARNING: This code is under construction, may not build, and is unstable!
diff --git a/alienblaster/project/jni/sdl/VisualC.html b/alienblaster/project/jni/sdl/VisualC.html
deleted file mode 100644
index ad2ed97a6..000000000
--- a/alienblaster/project/jni/sdl/VisualC.html
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
- Using SDL with Microsoft Visual C++
-
-
-
- Using SDL with Microsoft Visual C++ 5,6 and 7
-
-
-
- You can either use the precompiled libraries from
- the SDL Download web site , or you can build SDL yourself.
-
-
- Building SDL
-
-
- Unzip the VisualC.zip file into the directory that contains this
- file (VisualC.html).
-
-
- Be certain that you unzip the zip file for your compiler into this
- directory and not any other directory. If you are using WinZip, be careful to
- make sure that it extracts to this folder, because it's
- convenient feature of unzipping to a folder with the name of the file currently
- being unzipped will get you in trouble if you use it right now. And that's all
- I have to say about that.
-
-
- Now that it's unzipped, go into the VisualC
- directory that is created, and double-click on the VC++ file "SDL.dsw"
- ("SDL.sln"). This should open up the IDE.
-
-
- You may be prompted at this point to upgrade the workspace, should you be using
- a more recent version of Visual C++. If so, allow the workspace to be upgraded.
-
-
- Build the .dll and .lib files.
-
-
- This is done by right clicking on each project in turn (Projects are listed in
- the Workspace panel in the FileView tab), and selecting "Build".
-
-
- If you get an error about SDL_config.h being missing, you should
- copy include/SDL_config.h.default to include/SDL_config.h and try again.
-
-
- You may get a few warnings, but you should not get any errors. You do have to
- have at least the DirectX 5 SDK installed, however. The latest
- version of DirectX can be downloaded or purchased on a cheap CD (my
- recommendation) from Microsoft .
-
-
- Later, we will refer to the following .lib and .dll files that have just been
- generated:
-
-
- - SDL.dll
- - SDL.lib
- - SDLmain.lib
-
-
- Search for these using the Windows Find (Windows-F) utility, if you don't
- already know where they should be. For those of you with a clue, look inside
- the Debug or Release directories of the subdirectories of the Project folder.
- (It might be easier to just use Windows Find if this sounds confusing. And
- don't worry about needing a clue; we all need visits from the clue fairy
- frequently.)
-
-
- Creating a Project with SDL
-
-
- Create a project as a Win32 Application.
-
-
- Create a C++ file for your project.
-
-
- Set the C runtime to "Multi-threaded DLL" in the menu: Project|Settings|C/C++
- tab|Code Generation|Runtime Library .
-
-
- Add the SDL include directory to your list of includes in the
- menu: Project|Settings|C/C++ tab|Preprocessor|Additional include directories
- .
-
- VC7 Specific: Instead of doing this I find it easier to
- add the include and library directories to the list that VC7 keeps. Do this by
- selecting Tools|Options|Projects|VC++ Directories and under the "Show
- Directories For:" dropbox select "Include Files", and click the "New Directory
- Icon" and add the [SDLROOT]\include directory (ex. If you installed to
- c:\SDL-1.2.5\ add c:\SDL-1.2.5\include). Proceed to change the
- dropbox selection to "Library Files" and add [SDLROOT]\lib.
-
-
- The "include directory" I am referring to is the include folder
- within the main SDL directory (the one that this HTML file located within).
-
-
- Now we're going to use the files that we had created earlier in the Build SDL
- step.
-
-
- Copy the following files into your Project directory:
-
-
-
- Add the following files to your project (It is not necessary to copy them to
- your project directory):
-
-
- - SDL.lib
- - SDLmain.lib
-
-
- (To add them to your project, right click on your project, and select "Add
- files to project")
-
- Instead of adding the files to your project it is more
- desireable to add them to the linker options: Project|Properties|Linker|Command
- Line and type the names of the libraries to link with in the "Additional
- Options:" box. Note: This must be done for each build
- configuration (eg. Release,Debug).
-
- SDL 101, First Day of Class
-
-
- Now create the basic body of your project. The body of your program should take
- the following form:
-
-#include "SDL.h"
-
-int main( int argc, char* argv[] )
-{
- // Body of the program goes here.
- return 0;
-}
-
-
-
-
- That's it!
-
-
- I hope that this document has helped you get through the most difficult part of
- using the SDL: installing it. Suggestions for improvements to this document
- should be sent to the writers of this document.
-
-
- Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
-
-
- This document was originally called "VisualC.txt", and was written by
- Sam Lantinga.
-
-
- Later, it was converted to HTML and expanded into the document that you see
- today by Lion Kimbro.
-
- Minor Fixes and Visual C++ 7 Information (In Green) was added by James Turk
-
-
-
diff --git a/alienblaster/project/jni/sdl/WhatsNew b/alienblaster/project/jni/sdl/WhatsNew
index 927fdd264..64f669284 100644
--- a/alienblaster/project/jni/sdl/WhatsNew
+++ b/alienblaster/project/jni/sdl/WhatsNew
@@ -1,25 +1,11 @@
This is a list of API changes in SDL's version history.
-Version 1.0:
-
-1.2.14:
- Added cast macros for correct usage with C++:
- SDL_reinterpret_cast(type, expression)
- SDL_static_cast(type, expression)
-
- Added SDL_VIDEO_FULLSCREEN_DISPLAY as a preferred synonym for
- SDL_VIDEO_FULLSCREEN_HEAD on X11.
-
- Added SDL_DISABLE_LOCK_KEYS environment variable to enable normal
- up/down events for Caps-Lock and Num-Lock keys.
-
-1.2.13:
- Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants.
-
-1.2.12:
- Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling
- of the screensaver on Mac OS X and X11.
+1.3.0:
+ Added SDL_GetNumVideoDrivers() and SDL_GetVideoDriver().
+ Replaced SDL_VideoDriverName() with SDL_GetCurrentVideoDriver()
+ Added SDL_GetNumAudioDrivers() and SDL_GetAudioDriver().
+ Replaced SDL_AudioDriverName() with SDL_GetCurrentAudioDriver()
1.2.10:
If SDL_OpenAudio() is passed zero for the desired format
@@ -434,8 +420,6 @@ Version 1.0:
1.0.0:
New public release
-Version 0.11:
-
0.11.5:
A new function SDL_GetVideoSurface() has been added, and returns
a pointer to the current display surface.
@@ -454,8 +438,6 @@ Version 0.11:
installing fatal signal handlers on operating systems that support
them.
-Version 0.9:
-
0.9.15:
SDL_CreateColorCursor() has been removed. Color cursors should
be implemented as sprites, blitted by the application when the
diff --git a/alienblaster/project/jni/sdl/autogen.sh b/alienblaster/project/jni/sdl/autogen.sh
deleted file mode 100755
index 649d7b31e..000000000
--- a/alienblaster/project/jni/sdl/autogen.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-#
-echo "Generating build information using autoconf"
-echo "This may take a while ..."
-
-# Regenerate configuration files
-cat acinclude/* >aclocal.m4
-found=false
-for autoconf in autoconf autoconf259 autoconf-2.59
-do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi
-done
-if test x$found = xfalse; then
- echo "Couldn't find autoconf, aborting"
- exit 1
-fi
-(cd test; sh autogen.sh)
-
-# Run configure for this platform
-echo "Now you are ready to run ./configure"
diff --git a/alienblaster/project/jni/sdl/docs.html b/alienblaster/project/jni/sdl/docs.html
deleted file mode 100644
index 66ca9235a..000000000
--- a/alienblaster/project/jni/sdl/docs.html
+++ /dev/null
@@ -1,629 +0,0 @@
-
-SDL Stable Release
-
-
-
-
-This source is stable, and is fully tested on all supported platforms.
-Please send bug reports or questions to the SDL mailing list:
-http://www.libsdl.org/mailing-list.php
-The latest stable release may be found on the
- SDL website.
-
-
-
-
-
-
- SDL 1.2.14 Release Notes
-
-SDL 1.2.14 is a significant bug fix release and a recommended update.
-
-
- General Notes
-
-
-
- Fixed flicker when resizing the SDL window
-
-
- Fixed crash in SDL_SetGammaRamp()
-
-
- Fixed freeze in SDL_memset() with 0 length when assembly code is disabled.
-
-
- Added SDL_DISABLE_LOCK_KEYS environment variable to enable normal up/down events for Caps-Lock and Num-Lock keys.
-
-
- Fixed audio quality problem when converting between 22050 Hz and 44100 Hz.
-
-
- Fixed a threading crash when a few threads are rapidly created and complete.
-
-
- Increased accuracy of alpha blending routines.
-
-
- Fixed crash loading BMP files saved with the scanlines inverted.
-
-
- Fixed mouse coordinate clamping if SDL_SetVideoMode() isn't called in response to SDL_VIDEORESIZE event.
-
-
- Added doxygen documentation for the SDL API headers.
-
-
-
- Unix Notes
-
-
-
- Fixed potential memory corruption due to assembly bug with SDL_revcpy()
-
-
- Fixed crashes trying to detect SSE features on x86_64 architecture.
-
-
- Fixed assembly for GCC optimized 50% alpha blending blits.
-
-
- Added configure option --enable-screensaver, to allow enabling the screensaver by default.
-
-
- Use XResetScreenSaver() instead of disabling screensaver entirely.
-
-
- Removed the maximum window size limitation on X11.
-
-
- Fixed SDL_GL_SWAP_CONTROL on X11.
-
-
- Fixed setting the X11 window input hint.
-
-
- Fixed distorted X11 window icon for some visuals.
-
-
- Fixed detecting X11 libraries for dynamic loading on 64-bit Linux.
-
-
- SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) returns the correct value with GLX_SGI_swap_control.
-
-
- Added SDL_VIDEO_FULLSCREEN_DISPLAY as a preferred synonym for SDL_VIDEO_FULLSCREEN_HEAD on X11.
-
-
- The SDL_VIDEO_FULLSCREEN_DISPLAY environment variable can be set to 0 to place fullscreen SDL windows on the first Xinerama screen.
-
-
- Added the SDL_VIDEO_FBCON_ROTATION environment variable to control output orientation on the framebuffer console.
-
- Valid values are:
-
- - not set - Not rotating, no shadow.
-
- "NONE" - Not rotating, but still using shadow.
-
- "CW" - Rotating screen clockwise.
-
- "UD" - Rotating screen upside down.
-
- "CCW" - Rotating screen counter clockwise.
-
-
-
- Fixed DirectFB detection on some Linux distributions.
-
-
- Added code to use the PS3 SPE processors for YUV conversion on Linux.
-
-
- Updated ALSA support to the latest stable API
-
-
- ALSA is now preferred over OSS audio. (SDL_AUDIODRIVER=dsp will restore the previous behavior.)
-
-
- Improved support for PulseAudio
-
-
- The Network Audio System support is now dynamically loaded at runtime.
-
-
- Fixed crash with the MP-8866 Dual USB Joypad on newer Linux kernels.
-
-
- Fixed crash in SDL_Quit() when a joystick has been unplugged.
-
-
-
- Windows Notes
-
-
-
- Verified 100% compatibility with Windows 7.
-
-
- Prevent loss of OpenGL context when setting the video mode in response to a window resize event.
-
-
- Fixed video initialization with SDL_WINDOWID on Windows XP.
-
-
- Improved mouse input responsiveness for first-person-shooter games.
-
-
- IME messages are now generated for localized input.
-
-
- SDL_RWFromFile() takes a UTF-8 filename when opening a file.
-
-
- The SDL_STDIO_REDIRECT environment variable can be used to override whether SDL redirects stdio to stdout.txt and stderr.txt.
-
-
- Fixed dynamic object loading on Windows CE.
-
-
-
- Mac OS X Notes
-
-
-
- SDL now builds on Mac OS X 10.6 (Snow Leopard).
-
- Eric Wing posted a good rundown on the numerous changes here: http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html
-
-
- The X11 video driver is built by default.
-
-
- Fixed SDL_VIDEO_WINDOW_POS environment variable for Quartz target.
-
-
- Fixed setting the starting working directory in release builds.
-
-
-
-
-
- SDL 1.2.13 Release Notes
-
-SDL 1.2.13 is a minor bug fix release.
-
-
- General Notes
-
-
-
- Fixed link error when building with Intel Compiler 10.
-
-
- Removed stray C++ comment from public headers.
-
-
-
- Unix Notes
-
-
-
- Fixed crash in SDL_SoftStretch() on secure operating systems.
-
-
- Fixed undefined symbol on X11 implementations without UTF-8 support.
-
-
- Worked around BadAlloc error when using XVideo on the XFree86 Intel Integrated Graphics driver.
-
-
- Scan for all joysticks on Linux instead of stopping at one that was removed.
-
-
- Fixed use of sdl-config arguments in sdl.m4
-
-
-
- Windows Notes
-
-
-
- Fixed crash when a video driver reports higher than 32 bpp video modes.
-
-
- Fixed restoring the desktop after setting a 24-bit OpenGL video mode.
-
-
- Fixed window titles on Windows 95/98/ME.
-
-
- Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants for extended mouse buttons.
-
-
- Added support for quoted command line arguments.
-
-
-
- Mac OS X Notes
-
-
-
- SDL now builds on Mac OS X 10.5 (Leopard).
-
-
- Fixed high frequency crash involving text input.
-
-
- Fixed beeping when the escape key is pressed and UNICODE translation is enabled.
-
-
- Improved trackpad scrolling support.
-
-
- Fixed joystick hat reporting for certain joysticks.
-
-
-
-
-
- SDL 1.2.12 Release Notes
-
-SDL 1.2.12 is a minor bug fix release.
-
-
- General Notes
-
-
-
- Added support for the PulseAudio sound server: http://www.pulseaudio.org/
-
-
- Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling of the screensaver on Mac OS X, Windows, and X11.
-
-
- Fixed buffer overrun crash when resampling audio rates.
-
-
- Fixed audio bug where converting to mono was doubling the volume.
-
-
- Fixed off-by-one error in the C implementation of SDL_revcpy()
-
-
- Fixed compiling with Sun Studio.
-
-
- Support for AmigaOS has been removed from the main SDL code.
-
-
- Support for Nokia 9210 "EPOC" driver has been removed from the main SDL code.
-
-
- Unofficial support for the S60/SymbianOS platform has been added.
-
-
- Unofficial support for the Nintendo DS platform has been added.
-
-
- Reenabled MMX assembly for YUV overlay processing (GNU C Compiler only).
-
-
-
- Unix Notes
-
-
-
- Fixed detection of X11 DGA mouse support.
-
-
- Improved XIM support for asian character sets.
-
-
- The GFX_Display has been added to the X11 window information in SDL_syswm.h.
-
-
- Fixed PAGE_SIZE compile error in the fbcon video driver on newer Linux kernels.
-
-
- Fixed hang or crash at startup if aRts can't access the hardware.
-
-
- Fixed relative mouse mode when the cursor starts outside the X11 window.
-
-
- Fixed accidental free of stack memory in X11 mouse acceleration code.
-
-
- Closed minor memory leak in XME code.
-
-
- Fixed TEXTRELs in the library to resolve some PIC issues.
-
-
-
- Windows Notes
-
-
-
- The GDI video driver makes better use of the palette in 8-bit modes.
-
-
- The windib driver now supports more mouse buttons with WM_XBUTTON events.
-
-
- On Windows, SDL_SetVideoMode() will re-create the window instead of failing if the multisample settings are changed.
-
-
- Added support for UTF-8 window titles on Windows.
-
-
- Fixed joystick detection on Windows.
-
-
- Improved performance with Win32 file I/O.
-
-
- Fixed HBITMAP leak in GAPI driver.
-
-
-
- Mac OS X Notes
-
-
-
- Added support for multi-axis controllers like 3Dconnxion's SpaceNavigator on Mac OS X.
-
-
- Fixed YUV overlay crash inside Quicktime on Intel Mac OS X.
-
-
- Fixed blitting alignment in Altivec alpha blit functions.
-
-
- Keys F13, F14, and F15 are now usable on Apple keyboards under Mac OS X.
-
-
- Fixed joystick calibration code on Mac OS X.
-
-
- Fixed mouse jitter when multiple motion events are queued up in Mac OS X.
-
-
- Fixed changing the cursor in fullscreen mode on Mac OS X.
-
-
-
- Mac OS Classic Notes
-
-
-
- Added support for gamma ramps to both toolbox and DrawSprocket video drivers.
-
-
-
- BeOS Notes
-
-
-
- Implemented mouse grabbing and mouse relative mode on BeOS.
-
-
-
-
-
- SDL 1.2.11 Release Notes
-
-SDL 1.2.11 is a minor bug fix release.
-
-
- Unix Notes
-
-
-
- Dynamic X11 loading is only enabled with gcc 4 supporting -fvisibility=hidden. This fixes crashes related to symbol collisions, and allows building on Solaris and IRIX.
-
-
- Fixed building SDL with Xinerama disabled.
-
-
- Fixed DRI OpenGL library loading, using RTLD_GLOBAL in dlopen().
-
-
- Added pkgconfig configuration support.
-
-
-
- Windows Notes
-
-
-
- Setting SDL_GL_SWAP_CONTROL now works with Windows OpenGL.
-
-
- The Win32 window positioning code works properly for windows with menus.
-
-
- DirectSound audio quality has been improved on certain sound cards.
-
-
- Fixed 5.1 audio channel ordering on Windows and Mac OS X.
-
-
- Plugged a couple of minor memory leaks in the windib video driver.
-
-
- Fixed type collision with stdint.h when building with gcc on Win32.
-
-
- Fixed building with the Digital Mars Compiler on Win32.
-
-
-
- Mac OS X Notes
-
-
-
- The Quartz video driver supports 32x32 cursors on Mac OS X 10.3 and above.
-
-
-
-
-
- SDL 1.2.10 Release Notes
-
-SDL 1.2.10 is a major release, featuring a revamp of the build system and many API improvements and bug fixes.
-
- API enhancements
-
-
- General Notes
-
-
-
- The SDL website now has an RSS feed!
-
- The SDL development source code is now managed with Subversion.
-
- SDL now uses the Bugzilla bug tracking system, hosted by icculus.org.
-
- SDL is licensed under version 2.1 of the GNU Lesser General Public License.
-
- The entire build system has been revamped to make it much more portable, including versions of C library functions to make it possible to run SDL on a minimal embedded environment. See README.Porting in the SDL source distribution for information on how to port SDL to a new platform.
-
- SDL_opengl.h has been updated with the latest glext.h from http://oss.sgi.com/projects/ogl-sample/registry/
-
- Alex Volkov contributed highly optimized RGB <-> RGBA blitters.
-
-
- Unix Notes
-
-
-
- The X11 libraries are dynamically loaded at runtime by default. This allows the distributed version of SDL to run on systems without X11 libraries installed.
-
- The XiG XME extension code is now included in the X11 video driver by default.
-
- XRandR support for video mode switching has been added to the X11 driver, but is disabled because of undesired interactions with window managers. You can enable this by setting the environment variable SDL_VIDEO_X11_XRANDR to 1.
-
- Xinerama multi-head displays are properly handled now, and the SDL_VIDEO_FULLSCREEN_HEAD environment variable can be used to select the screen used for fullscreen video modes. Note that changing the video modes only works on screen 0.
-
- XVidMode video modes are now sorted so they maintain the refresh rates specified in the X11 configuration file.
-
- SDL windows are no longer transparent in X11 compositing systems like XGL.
-
- The mouse is properly released by the X11 video driver if the fullscreen window loses focus.
-
- The X11 input driver now uses XIM to handle international input.
-
- The screensaver and DPMS monitor blanking are disabled while SDL games are running under the X11 and DGA video drivers. This behavior will be formalized and selectable in SDL 1.3.
-
- Fixed a bug preventing stereo OpenGL contexts from being selected on the X11 driver.
-
- The DGA video driver now waits for pending blits involving surfaces before they are freed. This prevents display oddities when using SDL_DisplayFormat() to convert many images.
-
- The framebuffer console video driver now has a parser for /etc/fb.modes for improved video mode handling.
-
- The framebuffer console video driver now allows asynchronous VT switching, and restores the full contents of the screen when switched back.
-
- The framebuffer console now uses CTRL-ALT-FN to switch virtual terminals, to avoid collisions with application key bindings.
-
- The framebuffer console input driver correctly sets IMPS/2 mode for wheel mice. It also properly detects when gpm is in IMPS/2 protocol mode, or passing raw protocol from an IMPS/2 mouse.
-
- The SVGAlib video driver now has support for banked (non-linear) video modes.
-
- A video driver for OpenBSD on the Sharp Zaurus has been contributed by Staffan Ulfberg. See the file README.wscons in the SDL source distribution for details.
-
- Many patches have been incorporated from *BSD ports.
-
-
- Windows Notes
-
-
-
- The "windib" video driver is the default now, to prevent problems with certain laptops, 64-bit Windows, and Windows Vista. The DirectX driver is still available, and can be selected by setting the environment variable SDL_VIDEODRIVER to "directx".
-
- SDL has been ported to 64-bit Windows.
-
- Dmitry Yakimov contributed a GAPI video driver for Windows CE.
-
- The default fullscreen refresh rate has been increased to match the desktop refresh rate, when using equivalent resolutions. A full API for querying and selecting refresh rates is planned for SDL 1.3.
-
- Dialog boxes are now shown when SDL is in windowed OpenGL mode.
-
- The SDL window is recreated when necessary to maintain OpenGL context attributes, when switching between windowed and fullscreen modes.
-
- An SDL_VIDEORESIZE event is properly sent when the SDL window is maximized and restored.
-
- Window positions are retained when switching between fullscreen and windowed modes.
-
- ToUnicode() is used, when available, for improved handling of international keyboard input.
-
- The PrtScrn is now treated normally with both key down and key up events.
-
- Pressing ALT-F4 now delivers an SDL_QUIT event to SDL applications.
-
- Joystick names are now correct for joysticks which have been unplugged and then plugged back in since booting.
-
- An MCI error when playing the last track on a CD-ROM has been fixed.
-
- OpenWatcom projects for building SDL have been provided by Marc Peter.
-
-
- Mac OS X Notes
-
-
-
- SDL now supports building Universal binaries, both through Xcode projects and when using configure/make. See README.MacOSX in the SDL source archive for details.
-
- The X11 video driver with GLX support can be built on Mac OS X, if the X11 development SDK is installed.
-
- Transitions between fullscreen resolutions and windowed mode now use a much faster asynchronous fade to hide desktop flicker.
-
- Icons set with SDL_WM_SetIcon() now have the proper colors on Intel Macs.
-
-
- OS/2 Notes
-
-
-
- Projects for building SDL on OS/2 with OpenWatcom have been contributed by Doodle. See the file README.OS2 in the SDL source distribution for details.
-
-
-
-
-
-
diff --git a/alienblaster/project/jni/sdl/include/SDL.h b/alienblaster/project/jni/sdl/include/SDL.h
index 119ed7ff1..21c0cbe62 100644
--- a/alienblaster/project/jni/sdl/include/SDL.h
+++ b/alienblaster/project/jni/sdl/include/SDL.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,82 +20,145 @@
slouken@libsdl.org
*/
-/** @file SDL.h
+/**
+ * \file SDL.h
+ *
* Main include header for the SDL library
*/
+/**
+ * \mainpage Simple DirectMedia Layer (SDL)
+ *
+ * http://www.libsdl.org/
+ *
+ * \section intro_sec Introduction
+ *
+ * This is the Simple DirectMedia Layer, a general API that provides low
+ * level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
+ * and 2D framebuffer across multiple platforms.
+ *
+ * The current version supports Windows, Windows CE, Mac OS X, Linux,
+ * FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, and QNX. The code contains
+ * support for other operating systems but those are not officially supported.
+ *
+ * SDL is written in C, but works with C++ natively, and has bindings to
+ * several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
+ * Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
+ * Pike, Pliant, Python, Ruby, and Smalltalk.
+ *
+ * This library is distributed under GNU LGPL version 2, which can be
+ * found in the file "COPYING". This license allows you to use SDL
+ * freely in commercial programs as long as you link with the dynamic
+ * library.
+ *
+ * The best way to learn how to use SDL is to check out the header files in
+ * the "include" subdirectory and the programs in the "test" subdirectory.
+ * The header files and test programs are well commented and always up to date.
+ * More documentation is available in HTML format in "docs/index.html", and
+ * a documentation wiki is available online at:
+ * http://www.libsdl.org/cgi/docwiki.cgi
+ *
+ * The test programs in the "test" subdirectory are in the public domain.
+ *
+ * Frequently asked questions are answered online:
+ * http://www.libsdl.org/faq.php
+ *
+ * If you need help with the library, or just want to discuss SDL related
+ * issues, you can join the developers mailing list:
+ * http://www.libsdl.org/mailing-list.php
+ *
+ * Enjoy!
+ * Sam Lantinga (slouken@libsdl.org)
+ */
+
#ifndef _SDL_H
#define _SDL_H
#include "SDL_main.h"
#include "SDL_stdinc.h"
+#include "SDL_atomic.h"
#include "SDL_audio.h"
-#include "SDL_cdrom.h"
#include "SDL_cpuinfo.h"
#include "SDL_endian.h"
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_loadso.h"
#include "SDL_mutex.h"
+#include "SDL_power.h"
#include "SDL_rwops.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
-#include "SDL_video.h"
#include "SDL_version.h"
+#include "SDL_video.h"
+#include "SDL_compat.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** @file SDL.h
- * @note As of version 0.5, SDL is loaded dynamically into the application
- */
+/* As of version 0.5, SDL is loaded dynamically into the application */
-/** @name SDL_INIT Flags
- * These are the flags which may be passed to SDL_Init() -- you should
+/**
+ * \name SDL_INIT_*
+ *
+ * These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application.
*/
/*@{*/
-#define SDL_INIT_TIMER 0x00000001
-#define SDL_INIT_AUDIO 0x00000010
-#define SDL_INIT_VIDEO 0x00000020
-#define SDL_INIT_CDROM 0x00000100
-#define SDL_INIT_JOYSTICK 0x00000200
-#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
-#define SDL_INIT_EVENTTHREAD 0x01000000 /**< Not supported on all OS's */
-#define SDL_INIT_EVERYTHING 0x0000FFFF
+#define SDL_INIT_TIMER 0x00000001
+#define SDL_INIT_AUDIO 0x00000010
+#define SDL_INIT_VIDEO 0x00000020
+#define SDL_INIT_JOYSTICK 0x00000200
+#define SDL_INIT_HAPTIC 0x00001000
+#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
+#define SDL_INIT_EVENTTHREAD 0x01000000 /**< Not supported on all OS's */
+#define SDL_INIT_EVERYTHING 0x0000FFFF
/*@}*/
-/** This function loads the SDL dynamically linked library and initializes
- * the subsystems specified by 'flags' (and those satisfying dependencies)
- * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
- * signal handlers for some commonly ignored fatal signals (like SIGSEGV)
+/**
+ * This function loads the SDL dynamically linked library and initializes
+ * the subsystems specified by \c flags (and those satisfying dependencies).
+ * Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
+ * signal handlers for some commonly ignored fatal signals (like SIGSEGV).
*/
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
-/** This function initializes specific SDL subsystems */
+/**
+ * This function initializes specific SDL subsystems
+ */
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
-/** This function cleans up specific SDL subsystems */
+/**
+ * This function cleans up specific SDL subsystems
+ */
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
-/** This function returns mask of the specified subsystems which have
+/**
+ * This function returns mask of the specified subsystems which have
* been initialized.
- * If 'flags' is 0, it returns a mask of all initialized subsystems.
+ *
+ * If \c flags is 0, it returns a mask of all initialized subsystems.
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
-/** This function cleans up all initialized subsystems and unloads the
+/**
+ * This function cleans up all initialized subsystems and unloads the
* dynamically linked library. You should call it upon all exit conditions.
*/
extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_H */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_active.h b/alienblaster/project/jni/sdl/include/SDL_active.h
deleted file mode 100644
index 0ae92f2d5..000000000
--- a/alienblaster/project/jni/sdl/include/SDL_active.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/**
- * @file SDL_active.h
- * Include file for SDL application focus event handling
- */
-
-#ifndef _SDL_active_h
-#define _SDL_active_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @name The available application states */
-/*@{*/
-#define SDL_APPMOUSEFOCUS 0x01 /**< The app has mouse coverage */
-#define SDL_APPINPUTFOCUS 0x02 /**< The app has input focus */
-#define SDL_APPACTIVE 0x04 /**< The application is active */
-/*@}*/
-
-/* Function prototypes */
-/**
- * This function returns the current state of the application, which is a
- * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
- * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
- * see your application, otherwise it has been iconified or disabled.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_active_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_assert.h b/alienblaster/project/jni/sdl/include/SDL_assert.h
new file mode 100644
index 000000000..6c72fa18e
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_assert.h
@@ -0,0 +1,241 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+#ifndef _SDL_assert_h
+#define _SDL_assert_h
+
+#include "SDL_config.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+#ifndef SDL_ASSERT_LEVEL
+#ifdef SDL_DEFAULT_ASSERT_LEVEL
+#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
+#elif defined(_DEBUG) || defined(DEBUG) || \
+ (defined(__GNUC__) && !defined(__OPTIMIZE__))
+#define SDL_ASSERT_LEVEL 2
+#else
+#define SDL_ASSERT_LEVEL 1
+#endif
+#endif /* SDL_ASSERT_LEVEL */
+
+/*
+These are macros and not first class functions so that the debugger breaks
+on the assertion line and not in some random guts of SDL, and so each
+assert can have unique static variables associated with it.
+*/
+
+#if (defined(_MSC_VER) && ((_M_IX86) || (_M_X64)))
+ #define SDL_TriggerBreakpoint() __asm { int 3 }
+#elif (defined(__GNUC__) && ((__i386__) || (__x86_64__)))
+ #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
+#elif defined(HAVE_SIGNAL_H)
+ #include
+ #define SDL_TriggerBreakpoint() raise(SIGTRAP)
+#else
+ /* How do we trigger breakpoints on this platform? */
+ #define SDL_TriggerBreakpoint()
+#endif
+
+#if (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
+# define SDL_FUNCTION __func__
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
+# define SDL_FUNCTION __FUNCTION__
+#else
+# define SDL_FUNCTION "???"
+#endif
+#define SDL_FILE __FILE__
+#define SDL_LINE __LINE__
+
+/*
+sizeof (x) makes the compiler still parse the expression even without
+assertions enabled, so the code is always checked at compile time, but
+doesn't actually generate code for it, so there are no side effects or
+expensive checks at run time, just the constant size of what x WOULD be,
+which presumably gets optimized out as unused.
+This also solves the problem of...
+
+ int somevalue = blah();
+ SDL_assert(somevalue == 1);
+
+...which would cause compiles to complain that somevalue is unused if we
+disable assertions.
+*/
+
+#define SDL_disabled_assert(condition) \
+ do { (void) sizeof ((condition)); } while (0)
+
+#if (SDL_ASSERT_LEVEL > 0)
+
+typedef enum
+{
+ SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
+ SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
+ SDL_ASSERTION_ABORT, /**< Terminate the program. */
+ SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
+ SDL_ASSERTION_ALWAYS_IGNORE, /**< Ignore the assert from now on. */
+} SDL_assert_state;
+
+typedef struct SDL_assert_data
+{
+ int always_ignore;
+ unsigned int trigger_count;
+ const char *condition;
+ const char *filename;
+ int linenum;
+ const char *function;
+ const struct SDL_assert_data *next;
+} SDL_assert_data;
+
+/* Never call this directly. Use the SDL_assert* macros. */
+extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
+ const char *,
+ const char *, int);
+
+/* the do {} while(0) avoids dangling else problems:
+ if (x) SDL_assert(y); else blah();
+ ... without the do/while, the "else" could attach to this macro's "if".
+ We try to handle just the minimum we need here in a macro...the loop,
+ the static vars, and break points. The heavy lifting is handled in
+ SDL_ReportAssertion(), in SDL_assert.c.
+*/
+#define SDL_enabled_assert(condition) \
+ do { \
+ while ( !(condition) ) { \
+ static struct SDL_assert_data assert_data = { \
+ 0, 0, #condition, 0, 0, 0, 0 \
+ }; \
+ const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \
+ SDL_FUNCTION, \
+ SDL_FILE, \
+ SDL_LINE); \
+ if (state == SDL_ASSERTION_RETRY) { \
+ continue; /* go again. */ \
+ } else if (state == SDL_ASSERTION_BREAK) { \
+ SDL_TriggerBreakpoint(); \
+ } \
+ break; /* not retrying. */ \
+ } \
+ } while (0)
+
+#endif /* enabled assertions support code */
+
+/* Enable various levels of assertions. */
+#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
+# define SDL_assert(condition) SDL_disabled_assert(condition)
+# define SDL_assert_release(condition) SDL_disabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
+# define SDL_assert(condition) SDL_disabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
+# define SDL_assert(condition) SDL_enabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
+#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
+# define SDL_assert(condition) SDL_enabled_assert(condition)
+# define SDL_assert_release(condition) SDL_enabled_assert(condition)
+# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
+#else
+# error Unknown assertion level.
+#endif
+
+
+typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
+ const SDL_assert_data *, void *userdata);
+
+/**
+ * \brief Set an application-defined assertion handler.
+ *
+ * This allows an app to show its own assertion UI and/or force the
+ * response to an assertion failure. If the app doesn't provide this, SDL
+ * will try to do the right thing, popping up a system-specific GUI dialog,
+ * and probably minimizing any fullscreen windows.
+ *
+ * This callback may fire from any thread, but it runs wrapped in a mutex, so
+ * it will only fire from one thread at a time.
+ *
+ * Setting the callback to NULL restores SDL's original internal handler.
+ *
+ * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
+ *
+ * \return SDL_assert_state value of how to handle the assertion failure.
+ *
+ * \param handler Callback function, called when an assertion fails.
+ * \param userdata A pointer passed to the callback as-is.
+ */
+extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
+ SDL_AssertionHandler handler,
+ void *userdata);
+
+/**
+ * \brief Get a list of all assertion failures.
+ *
+ * Get all assertions triggered since last call to SDL_ResetAssertionReport(),
+ * or the start of the program.
+ *
+ * The proper way to examine this data looks something like this:
+ *
+ *
+ * const SDL_assert_data *item = SDL_GetAssertionReport();
+ * while (item->condition) {
+ * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
+ * item->condition, item->function, item->filename,
+ * item->linenum, item->trigger_count,
+ * item->always_ignore ? "yes" : "no");
+ * item = item->next;
+ * }
+ *
+ *
+ * \return List of all assertions. This never returns NULL,
+ * even if there are no items.
+ * \sa SDL_ResetAssertionReport
+ */
+extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void);
+
+/**
+ * \brief Reset the list of all assertion failures.
+ *
+ * Reset list of all assertions triggered.
+ *
+ * \sa SDL_GetAssertionReport
+ */
+extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_assert_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_atomic.h b/alienblaster/project/jni/sdl/include/SDL_atomic.h
new file mode 100644
index 000000000..cd620c314
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_atomic.h
@@ -0,0 +1,216 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+
+ Contributed by Bob Pendleton, bob@pendleton.com
+ */
+
+/**
+ * \file SDL_atomic.h
+ *
+ * Atomic operations.
+ *
+ * These operations may, or may not, actually be implemented using
+ * processor specific atomic operations. When possible they are
+ * implemented as true processor specific atomic operations. When that
+ * is not possible the are implemented using locks that *do* use the
+ * available atomic operations.
+ *
+ * At the very minimum spin locks must be implemented. Without spin
+ * locks it is not possible (AFAICT) to emulate the rest of the atomic
+ * operations.
+ */
+
+#ifndef _SDL_atomic_h_
+#define _SDL_atomic_h_
+
+#include "SDL_stdinc.h"
+#include "SDL_platform.h"
+
+#include "begin_code.h"
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/* Function prototypes */
+
+/**
+ * \name SDL AtomicLock
+ *
+ * The spin lock functions and type are required and can not be
+ * emulated because they are used in the emulation code.
+ */
+/*@{*/
+
+typedef volatile Uint32 SDL_SpinLock;
+
+/**
+ * \brief Lock a spin lock by setting it to a none zero value.
+ *
+ * \param lock Points to the lock.
+ */
+extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
+
+/**
+ * \brief Unlock a spin lock by setting it to 0. Always returns immediately
+ *
+ * \param lock Points to the lock.
+ */
+extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
+
+/*@}*//*SDL AtomicLock*/
+
+/**
+ * \name 32 bit atomic operations
+ */
+/*@{*/
+
+/**
+ * \brief Check to see if \c *ptr == 0 and set it to 1.
+ *
+ * \return SDL_True if the value pointed to by \c ptr was zero and
+ * SDL_False if it was not zero
+ *
+ * \param ptr Points to the value to be tested and set.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(volatile Uint32 * ptr);
+
+/**
+ * \brief Set the value pointed to by \c ptr to be zero.
+ *
+ * \param ptr Address of the value to be set to zero
+ */
+extern DECLSPEC void SDLCALL SDL_AtomicClear32(volatile Uint32 * ptr);
+
+/**
+ * \brief Fetch the current value of \c *ptr and then increment that
+ * value in place.
+ *
+ * \return The value before it was incremented.
+ *
+ * \param ptr Address of the value to fetch and increment
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
+
+/**
+ * \brief Fetch \c *ptr and then decrement the value in place.
+ *
+ * \return The value before it was decremented.
+ *
+ * \param ptr Address of the value to fetch and drement
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
+
+/**
+ * \brief Fetch the current value at \c ptr and then add \c value to \c *ptr.
+ *
+ * \return \c *ptr before the addition took place.
+ *
+ * \param ptr The address of data we are changing.
+ * \param value The value to add to \c *ptr.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
+
+/**
+ * \brief Fetch \c *ptr and then subtract \c value from it.
+ *
+ * \return \c *ptr before the subtraction took place.
+ *
+ * \param ptr The address of the data being changed.
+ * \param value The value to subtract from \c *ptr.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
+
+/**
+ * \brief Add one to the data pointed to by \c ptr and return that value.
+ *
+ * \return The incremented value.
+ *
+ * \param ptr The address of the data to increment.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
+
+/**
+ * \brief Subtract one from data pointed to by \c ptr and return the new value.
+ *
+ * \return The decremented value.
+ *
+ * \param ptr The address of the data to decrement.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
+
+/**
+ * \brief Add \c value to the data pointed to by \c ptr and return result.
+ *
+ * \return The sum of \c *ptr and \c value.
+ *
+ * \param ptr The address of the data to be modified.
+ * \param value The value to be added.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
+
+/**
+ * \brief Subtract \c value from the data pointed to by \c ptr and return the result.
+ *
+ * \return The difference between \c *ptr and \c value.
+ *
+ * \param ptr The address of the data to be modified.
+ * \param value The value to be subtracted.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value);
+
+/*@}*//*32 bit atomic operations*/
+
+/**
+ * \name 64 bit atomic operations
+ */
+/*@{*/
+#ifdef SDL_HAS_64BIT_TYPE
+
+extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet64(volatile Uint64 * ptr);
+extern DECLSPEC void SDLCALL SDL_AtomicClear64(volatile Uint64 * ptr);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value);
+extern DECLSPEC Uint64 SDLCALL SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value);
+#endif /* SDL_HAS_64BIT_TYPE */
+
+/*@}*//*64 bit atomic operations*/
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+
+#include "close_code.h"
+
+#endif /* _SDL_atomic_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_audio.h b/alienblaster/project/jni/sdl/include/SDL_audio.h
index 3a8e7fa8b..fc55c5217 100644
--- a/alienblaster/project/jni/sdl/include/SDL_audio.h
+++ b/alienblaster/project/jni/sdl/include/SDL_audio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,9 @@
*/
/**
- * @file SDL_audio.h
- * Access to the raw audio mixing buffer for the SDL library
+ * \file SDL_audio.h
+ *
+ * Access to the raw audio mixing buffer for the SDL library.
*/
#ifndef _SDL_audio_h
@@ -38,113 +39,192 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
/**
- * When filling in the desired audio spec structure,
- * - 'desired->freq' should be the desired audio frequency in samples-per-second.
- * - 'desired->format' should be the desired audio format.
- * - 'desired->samples' is the desired size of the audio buffer, in samples.
- * This number should be a power of two, and may be adjusted by the audio
- * driver to a value more suitable for the hardware. Good values seem to
- * range between 512 and 8096 inclusive, depending on the application and
- * CPU speed. Smaller values yield faster response time, but can lead
- * to underflow if the application is doing heavy processing and cannot
- * fill the audio buffer in time. A stereo sample consists of both right
- * and left channels in LR ordering.
- * Note that the number of samples is directly related to time by the
- * following formula: ms = (samples*1000)/freq
- * - 'desired->size' is the size in bytes of the audio buffer, and is
- * calculated by SDL_OpenAudio().
- * - 'desired->silence' is the value used to set the buffer to silence,
- * and is calculated by SDL_OpenAudio().
- * - 'desired->callback' should be set to a function that will be called
- * when the audio device is ready for more data. It is passed a pointer
- * to the audio buffer, and the length in bytes of the audio buffer.
- * This function usually runs in a separate thread, and so you should
- * protect data structures that it accesses by calling SDL_LockAudio()
- * and SDL_UnlockAudio() in your code.
- * - 'desired->userdata' is passed as the first parameter to your callback
- * function.
- *
- * @note The calculated values in this structure are calculated by SDL_OpenAudio()
- *
+ * \brief Audio format flags.
+ *
+ * These are what the 16 bits in SDL_AudioFormat currently mean...
+ * (Unspecified bits are always zero).
+ *
+ * \verbatim
+ ++-----------------------sample is signed if set
+ ||
+ || ++-----------sample is bigendian if set
+ || ||
+ || || ++---sample is float if set
+ || || ||
+ || || || +---sample bit size---+
+ || || || | |
+ 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
+ \endverbatim
+ *
+ * There are macros in SDL 1.3 and later to query these bits.
*/
-typedef struct SDL_AudioSpec {
- int freq; /**< DSP frequency -- samples per second */
- Uint16 format; /**< Audio data format */
- Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
- Uint8 silence; /**< Audio buffer silence value (calculated) */
- Uint16 samples; /**< Audio buffer size in samples (power of 2) */
- Uint16 padding; /**< Necessary for some compile environments */
- Uint32 size; /**< Audio buffer size in bytes (calculated) */
- /**
- * This function is called when the audio device needs more data.
- *
- * @param[out] stream A pointer to the audio data buffer
- * @param[in] len The length of the audio buffer in bytes.
- *
- * Once the callback returns, the buffer will no longer be valid.
- * Stereo samples are stored in a LRLRLR ordering.
- */
- void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
- void *userdata;
-} SDL_AudioSpec;
+typedef Uint16 SDL_AudioFormat;
/**
- * @name Audio format flags
- * defaults to LSB byte order
+ * \name Audio flags
*/
/*@{*/
-#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
-#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
-#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
-#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
-#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
-#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
+
+#define SDL_AUDIO_MASK_BITSIZE (0xFF)
+#define SDL_AUDIO_MASK_DATATYPE (1<<8)
+#define SDL_AUDIO_MASK_ENDIAN (1<<12)
+#define SDL_AUDIO_MASK_SIGNED (1<<15)
+#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
+#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
+#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
+#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
+#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
+#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
+#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
+
+/**
+ * \name Audio format flags
+ *
+ * Defaults to LSB byte order.
+ */
+/*@{*/
+#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
+#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
+#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
+#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
+#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
+#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
#define AUDIO_U16 AUDIO_U16LSB
#define AUDIO_S16 AUDIO_S16LSB
+/*@}*/
/**
- * @name Native audio byte ordering
+ * \name int32 support
+ *
+ * New to SDL 1.3.
+ */
+/*@{*/
+#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
+#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
+#define AUDIO_S32 AUDIO_S32LSB
+/*@}*/
+
+/**
+ * \name float32 support
+ *
+ * New to SDL 1.3.
+ */
+/*@{*/
+#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
+#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
+#define AUDIO_F32 AUDIO_F32LSB
+/*@}*/
+
+/**
+ * \name Native audio byte ordering
*/
/*@{*/
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define AUDIO_U16SYS AUDIO_U16LSB
#define AUDIO_S16SYS AUDIO_S16LSB
+#define AUDIO_S32SYS AUDIO_S32LSB
+#define AUDIO_F32SYS AUDIO_F32LSB
#else
#define AUDIO_U16SYS AUDIO_U16MSB
#define AUDIO_S16SYS AUDIO_S16MSB
+#define AUDIO_S32SYS AUDIO_S32MSB
+#define AUDIO_F32SYS AUDIO_F32MSB
#endif
/*@}*/
+/**
+ * \name Allow change flags
+ *
+ * Which audio format changes are allowed when opening a device.
+ */
+/*@{*/
+#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
+#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
+#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
+#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
/*@}*/
+/*@}*//*Audio flags*/
-/** A structure to hold a set of audio conversion filters and buffers */
-typedef struct SDL_AudioCVT {
- int needed; /**< Set to 1 if conversion possible */
- Uint16 src_format; /**< Source audio format */
- Uint16 dst_format; /**< Target audio format */
- double rate_incr; /**< Rate conversion increment */
- Uint8 *buf; /**< Buffer to hold entire audio data */
- int len; /**< Length of original audio buffer */
- int len_cvt; /**< Length of converted audio buffer */
- int len_mult; /**< buffer must be len*len_mult big */
- double len_ratio; /**< Given len, final size is len*len_ratio */
- void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
- int filter_index; /**< Current audio conversion function */
+/**
+ * This function is called when the audio device needs more data.
+ *
+ * \param userdata An application-specific parameter saved in
+ * the SDL_AudioSpec structure
+ * \param stream A pointer to the audio data buffer.
+ * \param len The length of that buffer in bytes.
+ *
+ * Once the callback returns, the buffer will no longer be valid.
+ * Stereo samples are stored in a LRLRLR ordering.
+ */
+typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
+ int len);
+
+/**
+ * The calculated values in this structure are calculated by SDL_OpenAudio().
+ */
+typedef struct SDL_AudioSpec
+{
+ int freq; /**< DSP frequency -- samples per second */
+ SDL_AudioFormat format; /**< Audio data format */
+ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
+ Uint8 silence; /**< Audio buffer silence value (calculated) */
+ Uint16 samples; /**< Audio buffer size in samples (power of 2) */
+ Uint16 padding; /**< Necessary for some compile environments */
+ Uint32 size; /**< Audio buffer size in bytes (calculated) */
+ SDL_AudioCallback callback;
+ void *userdata;
+} SDL_AudioSpec;
+
+
+struct SDL_AudioCVT;
+typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
+ SDL_AudioFormat format);
+
+/**
+ * A structure to hold a set of audio conversion filters and buffers.
+ */
+typedef struct SDL_AudioCVT
+{
+ int needed; /**< Set to 1 if conversion possible */
+ SDL_AudioFormat src_format; /**< Source audio format */
+ SDL_AudioFormat dst_format; /**< Target audio format */
+ double rate_incr; /**< Rate conversion increment */
+ Uint8 *buf; /**< Buffer to hold entire audio data */
+ int len; /**< Length of original audio buffer */
+ int len_cvt; /**< Length of converted audio buffer */
+ int len_mult; /**< buffer must be len*len_mult big */
+ double len_ratio; /**< Given len, final size is len*len_ratio */
+ SDL_AudioFilter filters[10]; /**< Filter list */
+ int filter_index; /**< Current audio conversion function */
} SDL_AudioCVT;
/* Function prototypes */
/**
- * @name Audio Init and Quit
- * These functions are used internally, and should not be used unless you
- * have a specific need to specify the audio driver you want to use.
- * You should normally use SDL_Init() or SDL_InitSubSystem().
+ * \name Driver discovery functions
+ *
+ * These functions return the list of built in audio drivers, in the
+ * order that they are normally initialized by default.
+ */
+/*@{*/
+extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
+extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
+/*@}*/
+
+/**
+ * \name Initialization and cleanup
+ *
+ * \internal These functions are used internally, and should not be used unless
+ * you have a specific need to specify the audio driver you want to
+ * use. You should normally use SDL_Init() or SDL_InitSubSystem().
*/
/*@{*/
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
@@ -152,133 +232,279 @@ extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
/*@}*/
/**
- * This function fills the given character buffer with the name of the
- * current audio driver, and returns a pointer to it if the audio driver has
- * been initialized. It returns NULL if no driver has been initialized.
+ * This function returns the name of the current audio driver, or NULL
+ * if no driver has been initialized.
*/
-extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
+extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
/**
- * This function opens the audio device with the desired parameters, and
- * returns 0 if successful, placing the actual hardware parameters in the
- * structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
- * data passed to the callback function will be guaranteed to be in the
- * requested format, and will be automatically converted to the hardware
- * audio format if necessary. This function returns -1 if it failed
- * to open the audio device, or couldn't set up the audio thread.
- *
- * The audio device starts out playing silence when it's opened, and should
- * be enabled for playing by calling SDL_PauseAudio(0) when you are ready
- * for your audio callback function to be called. Since the audio driver
- * may modify the requested size of the audio buffer, you should allocate
- * any local mixing buffers after you open the audio device.
- *
- * @sa SDL_AudioSpec
+ * This function opens the audio device with the desired parameters, and
+ * returns 0 if successful, placing the actual hardware parameters in the
+ * structure pointed to by \c obtained. If \c obtained is NULL, the audio
+ * data passed to the callback function will be guaranteed to be in the
+ * requested format, and will be automatically converted to the hardware
+ * audio format if necessary. This function returns -1 if it failed
+ * to open the audio device, or couldn't set up the audio thread.
+ *
+ * When filling in the desired audio spec structure,
+ * - \c desired->freq should be the desired audio frequency in samples-per-
+ * second.
+ * - \c desired->format should be the desired audio format.
+ * - \c desired->samples is the desired size of the audio buffer, in
+ * samples. This number should be a power of two, and may be adjusted by
+ * the audio driver to a value more suitable for the hardware. Good values
+ * seem to range between 512 and 8096 inclusive, depending on the
+ * application and CPU speed. Smaller values yield faster response time,
+ * but can lead to underflow if the application is doing heavy processing
+ * and cannot fill the audio buffer in time. A stereo sample consists of
+ * both right and left channels in LR ordering.
+ * Note that the number of samples is directly related to time by the
+ * following formula: \code ms = (samples*1000)/freq \endcode
+ * - \c desired->size is the size in bytes of the audio buffer, and is
+ * calculated by SDL_OpenAudio().
+ * - \c desired->silence is the value used to set the buffer to silence,
+ * and is calculated by SDL_OpenAudio().
+ * - \c desired->callback should be set to a function that will be called
+ * when the audio device is ready for more data. It is passed a pointer
+ * to the audio buffer, and the length in bytes of the audio buffer.
+ * This function usually runs in a separate thread, and so you should
+ * protect data structures that it accesses by calling SDL_LockAudio()
+ * and SDL_UnlockAudio() in your code.
+ * - \c desired->userdata is passed as the first parameter to your callback
+ * function.
+ *
+ * The audio device starts out playing silence when it's opened, and should
+ * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
+ * for your audio callback function to be called. Since the audio driver
+ * may modify the requested size of the audio buffer, you should allocate
+ * any local mixing buffers after you open the audio device.
*/
-extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
-
-typedef enum {
- SDL_AUDIO_STOPPED = 0,
- SDL_AUDIO_PLAYING,
- SDL_AUDIO_PAUSED
-} SDL_audiostatus;
-
-/** Get the current audio state */
-extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
+extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
+ SDL_AudioSpec * obtained);
/**
- * This function pauses and unpauses the audio callback processing.
- * It should be called with a parameter of 0 after opening the audio
- * device to start playing sound. This is so you can safely initialize
- * data for your callback function after opening the audio device.
- * Silence will be written to the audio device during the pause.
+ * SDL Audio Device IDs.
+ *
+ * A successful call to SDL_OpenAudio() is always device id 1, and legacy
+ * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
+ * always returns devices >= 2 on success. The legacy calls are good both
+ * for backwards compatibility and when you don't care about multiple,
+ * specific, or capture devices.
*/
+typedef Uint32 SDL_AudioDeviceID;
+
+/**
+ * Get the number of available devices exposed by the current driver.
+ * Only valid after a successfully initializing the audio subsystem.
+ * Returns -1 if an explicit list of devices can't be determined; this is
+ * not an error. For example, if SDL is set up to talk to a remote audio
+ * server, it can't list every one available on the Internet, but it will
+ * still allow a specific host to be specified to SDL_OpenAudioDevice().
+ *
+ * In many common cases, when this function returns a value <= 0, it can still
+ * successfully open the default device (NULL for first argument of
+ * SDL_OpenAudioDevice()).
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
+
+/**
+ * Get the human-readable name of a specific audio device.
+ * Must be a value between 0 and (number of audio devices-1).
+ * Only valid after a successfully initializing the audio subsystem.
+ * The values returned by this function reflect the latest call to
+ * SDL_GetNumAudioDevices(); recall that function to redetect available
+ * hardware.
+ *
+ * The string returned by this function is UTF-8 encoded, read-only, and
+ * managed internally. You are not to free it. If you need to keep the
+ * string for any length of time, you should make your own copy of it, as it
+ * will be invalid next time any of several other SDL functions is called.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
+ int iscapture);
+
+
+/**
+ * Open a specific audio device. Passing in a device name of NULL requests
+ * the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
+ *
+ * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
+ * some drivers allow arbitrary and driver-specific strings, such as a
+ * hostname/IP address for a remote audio server, or a filename in the
+ * diskaudio driver.
+ *
+ * \return 0 on error, a valid device ID that is >= 2 on success.
+ *
+ * SDL_OpenAudio(), unlike this function, always acts on device ID 1.
+ */
+extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
+ *device,
+ int iscapture,
+ const
+ SDL_AudioSpec *
+ desired,
+ SDL_AudioSpec *
+ obtained,
+ int
+ allowed_changes);
+
+
+
+/**
+ * \name Audio state
+ *
+ * Get the current audio state.
+ */
+/*@{*/
+typedef enum
+{
+ SDL_AUDIO_STOPPED = 0,
+ SDL_AUDIO_PLAYING,
+ SDL_AUDIO_PAUSED
+} SDL_AudioStatus;
+extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
+
+extern DECLSPEC SDL_AudioStatus SDLCALL
+SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
+/*@}*//*Audio State*/
+
+/**
+ * \name Pause audio functions
+ *
+ * These functions pause and unpause the audio callback processing.
+ * They should be called with a parameter of 0 after opening the audio
+ * device to start playing sound. This is so you can safely initialize
+ * data for your callback function after opening the audio device.
+ * Silence will be written to the audio device during the pause.
+ */
+/*@{*/
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
+extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
+ int pause_on);
+/*@}*//*Pause audio functions*/
/**
- * This function loads a WAVE from the data source, automatically freeing
- * that source if 'freesrc' is non-zero. For example, to load a WAVE file,
- * you could do:
- * @code SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); @endcode
+ * This function loads a WAVE from the data source, automatically freeing
+ * that source if \c freesrc is non-zero. For example, to load a WAVE file,
+ * you could do:
+ * \code
+ * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
+ * \endcode
*
- * If this function succeeds, it returns the given SDL_AudioSpec,
- * filled with the audio data format of the wave data, and sets
- * 'audio_buf' to a malloc()'d buffer containing the audio data,
- * and sets 'audio_len' to the length of that audio buffer, in bytes.
- * You need to free the audio buffer with SDL_FreeWAV() when you are
- * done with it.
+ * If this function succeeds, it returns the given SDL_AudioSpec,
+ * filled with the audio data format of the wave data, and sets
+ * \c *audio_buf to a malloc()'d buffer containing the audio data,
+ * and sets \c *audio_len to the length of that audio buffer, in bytes.
+ * You need to free the audio buffer with SDL_FreeWAV() when you are
+ * done with it.
*
- * This function returns NULL and sets the SDL error message if the
- * wave file cannot be opened, uses an unknown data format, or is
- * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
+ * This function returns NULL and sets the SDL error message if the
+ * wave file cannot be opened, uses an unknown data format, or is
+ * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
*/
-extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
+extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
+ int freesrc,
+ SDL_AudioSpec * spec,
+ Uint8 ** audio_buf,
+ Uint32 * audio_len);
-/** Compatibility convenience function -- loads a WAV from a file */
+/**
+ * Loads a WAV from a file.
+ * Compatibility convenience function.
+ */
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
/**
- * This function frees data previously allocated with SDL_LoadWAV_RW()
+ * This function frees data previously allocated with SDL_LoadWAV_RW()
*/
-extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
+extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
/**
- * This function takes a source format and rate and a destination format
- * and rate, and initializes the 'cvt' structure with information needed
- * by SDL_ConvertAudio() to convert a buffer of audio data from one format
- * to the other.
- *
- * @return This function returns 0, or -1 if there was an error.
+ * This function takes a source format and rate and a destination format
+ * and rate, and initializes the \c cvt structure with information needed
+ * by SDL_ConvertAudio() to convert a buffer of audio data from one format
+ * to the other.
+ *
+ * \return -1 if the format conversion is not supported, 0 if there's
+ * no conversion needed, or 1 if the audio filter is set up.
*/
-extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
- Uint16 src_format, Uint8 src_channels, int src_rate,
- Uint16 dst_format, Uint8 dst_channels, int dst_rate);
+extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
+ SDL_AudioFormat src_format,
+ Uint8 src_channels,
+ int src_rate,
+ SDL_AudioFormat dst_format,
+ Uint8 dst_channels,
+ int dst_rate);
/**
- * Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
- * created an audio buffer cvt->buf, and filled it with cvt->len bytes of
- * audio data in the source format, this function will convert it in-place
- * to the desired format.
- * The data conversion may expand the size of the audio data, so the buffer
- * cvt->buf should be allocated after the cvt structure is initialized by
- * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
+ * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
+ * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
+ * audio data in the source format, this function will convert it in-place
+ * to the desired format.
+ *
+ * The data conversion may expand the size of the audio data, so the buffer
+ * \c cvt->buf should be allocated after the \c cvt structure is initialized by
+ * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
*/
-extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
-
+extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
#define SDL_MIX_MAXVOLUME 128
/**
- * This takes two audio buffers of the playing audio format and mixes
- * them, performing addition, volume adjustment, and overflow clipping.
- * The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
- * for full audio volume. Note this does not change hardware volume.
- * This is provided for convenience -- you can mix your own audio data.
+ * This takes two audio buffers of the playing audio format and mixes
+ * them, performing addition, volume adjustment, and overflow clipping.
+ * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
+ * for full audio volume. Note this does not change hardware volume.
+ * This is provided for convenience -- you can mix your own audio data.
*/
-extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
+extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
+ Uint32 len, int volume);
/**
- * @name Audio Locks
- * The lock manipulated by these functions protects the callback function.
- * During a LockAudio/UnlockAudio pair, you can be guaranteed that the
- * callback function is not running. Do not call these from the callback
- * function or you will cause deadlock.
+ * This works like SDL_MixAudio(), but you specify the audio format instead of
+ * using the format of audio device 1. Thus it can be used when no audio
+ * device is open at all.
+ */
+extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
+ const Uint8 * src,
+ SDL_AudioFormat format,
+ Uint32 len, int volume);
+
+/**
+ * \name Audio lock functions
+ *
+ * The lock manipulated by these functions protects the callback function.
+ * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
+ * the callback function is not running. Do not call these from the callback
+ * function or you will cause deadlock.
*/
/*@{*/
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
+extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
-/*@}*/
+extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
+/*@}*//*Audio lock functions*/
/**
- * This function shuts down audio processing and closes the audio device.
+ * This function shuts down audio processing and closes the audio device.
*/
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
+extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
+
+/**
+ * \return 1 if audio device is still functioning, zero if not, -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_AudioDeviceConnected(SDL_AudioDeviceID dev);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_audio_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_cdrom.h b/alienblaster/project/jni/sdl/include/SDL_cdrom.h
deleted file mode 100644
index fff5cfa15..000000000
--- a/alienblaster/project/jni/sdl/include/SDL_cdrom.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/**
- * @file SDL_cdrom.h
- * This is the CD-audio control API for Simple DirectMedia Layer
- */
-
-#ifndef _SDL_cdrom_h
-#define _SDL_cdrom_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file SDL_cdrom.h
- * In order to use these functions, SDL_Init() must have been called
- * with the SDL_INIT_CDROM flag. This causes SDL to scan the system
- * for CD-ROM drives, and load appropriate drivers.
- */
-
-/** The maximum number of CD-ROM tracks on a disk */
-#define SDL_MAX_TRACKS 99
-
-/** @name Track Types
- * The types of CD-ROM track possible
- */
-/*@{*/
-#define SDL_AUDIO_TRACK 0x00
-#define SDL_DATA_TRACK 0x04
-/*@}*/
-
-/** The possible states which a CD-ROM drive can be in. */
-typedef enum {
- CD_TRAYEMPTY,
- CD_STOPPED,
- CD_PLAYING,
- CD_PAUSED,
- CD_ERROR = -1
-} CDstatus;
-
-/** Given a status, returns true if there's a disk in the drive */
-#define CD_INDRIVE(status) ((int)(status) > 0)
-
-typedef struct SDL_CDtrack {
- Uint8 id; /**< Track number */
- Uint8 type; /**< Data or audio track */
- Uint16 unused;
- Uint32 length; /**< Length, in frames, of this track */
- Uint32 offset; /**< Offset, in frames, from start of disk */
-} SDL_CDtrack;
-
-/** This structure is only current as of the last call to SDL_CDStatus() */
-typedef struct SDL_CD {
- int id; /**< Private drive identifier */
- CDstatus status; /**< Current drive status */
-
- /** The rest of this structure is only valid if there's a CD in drive */
- /*@{*/
- int numtracks; /**< Number of tracks on disk */
- int cur_track; /**< Current track position */
- int cur_frame; /**< Current frame offset within current track */
- SDL_CDtrack track[SDL_MAX_TRACKS+1];
- /*@}*/
-} SDL_CD;
-
-/** @name Frames / MSF Conversion Functions
- * Conversion functions from frames to Minute/Second/Frames and vice versa
- */
-/*@{*/
-#define CD_FPS 75
-#define FRAMES_TO_MSF(f, M,S,F) { \
- int value = f; \
- *(F) = value%CD_FPS; \
- value /= CD_FPS; \
- *(S) = value%60; \
- value /= 60; \
- *(M) = value; \
-}
-#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
-/*@}*/
-
-/* CD-audio API functions: */
-
-/**
- * Returns the number of CD-ROM drives on the system, or -1 if
- * SDL_Init() has not been called with the SDL_INIT_CDROM flag.
- */
-extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
-
-/**
- * Returns a human-readable, system-dependent identifier for the CD-ROM.
- * Example:
- * - "/dev/cdrom"
- * - "E:"
- * - "/dev/disk/ide/1/master"
- */
-extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
-
-/**
- * Opens a CD-ROM drive for access. It returns a drive handle on success,
- * or NULL if the drive was invalid or busy. This newly opened CD-ROM
- * becomes the default CD used when other CD functions are passed a NULL
- * CD-ROM handle.
- * Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
- */
-extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
-
-/**
- * This function returns the current status of the given drive.
- * If the drive has a CD in it, the table of contents of the CD and current
- * play position of the CD will be stored in the SDL_CD structure.
- */
-extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
-
-/**
- * Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
- * tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
- * until the end of the CD. This function will skip data tracks.
- * This function should only be called after calling SDL_CDStatus() to
- * get track information about the CD.
- * For example:
- * @code
- * // Play entire CD:
- * if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
- * SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
- * // Play last track:
- * if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
- * SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
- * }
- * // Play first and second track and 10 seconds of third track:
- * if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
- * SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
- * @endcode
- *
- * @return This function returns 0, or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
- int start_track, int start_frame, int ntracks, int nframes);
-
-/**
- * Play the given CD starting at 'start' frame for 'length' frames.
- * @return It returns 0, or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
-
-/** Pause play
- * @return returns 0, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
-
-/** Resume play
- * @return returns 0, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
-
-/** Stop play
- * @return returns 0, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
-
-/** Eject CD-ROM
- * @return returns 0, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
-
-/** Closes the handle for the CD-ROM drive */
-extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_video_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_compat.h b/alienblaster/project/jni/sdl/include/SDL_compat.h
new file mode 100644
index 000000000..3b7a7acf7
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_compat.h
@@ -0,0 +1,342 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+ /**
+ * \defgroup Compatibility SDL 1.2 Compatibility API
+ */
+/*@{*/
+
+/**
+ * \file SDL_compat.h
+ *
+ * This file contains functions for backwards compatibility with SDL 1.2.
+ */
+
+/**
+ * \def SDL_NO_COMPAT
+ *
+ * #define SDL_NO_COMPAT to prevent SDL_compat.h from being included.
+ * SDL_NO_COMPAT is intended to make it easier to covert SDL 1.2 code to
+ * SDL 1.3/2.0.
+ */
+
+ /*@}*/
+
+#ifdef SDL_NO_COMPAT
+#define _SDL_compat_h
+#endif
+
+#ifndef _SDL_compat_h
+#define _SDL_compat_h
+
+#include "SDL_video.h"
+#include "SDL_version.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \addtogroup Compatibility
+ */
+/*@{*/
+
+/**
+ * \name Surface flags
+ */
+/*@{*/
+#define SDL_SWSURFACE 0x00000000 /**< \note Not used */
+#define SDL_SRCALPHA 0x00010000
+#define SDL_SRCCOLORKEY 0x00020000
+#define SDL_ANYFORMAT 0x00100000
+#define SDL_HWPALETTE 0x00200000
+#define SDL_DOUBLEBUF 0x00400000
+#define SDL_FULLSCREEN 0x00800000
+#define SDL_RESIZABLE 0x01000000
+#define SDL_NOFRAME 0x02000000
+#define SDL_OPENGL 0x04000000
+#define SDL_HWSURFACE 0x08000001 /**< \note Not used */
+#define SDL_ASYNCBLIT 0x08000000 /**< \note Not used */
+#define SDL_RLEACCELOK 0x08000000 /**< \note Not used */
+#define SDL_HWACCEL 0x08000000 /**< \note Not used */
+/*@}*//*Surface flags*/
+
+#define SDL_APPMOUSEFOCUS 0x01
+#define SDL_APPINPUTFOCUS 0x02
+#define SDL_APPACTIVE 0x04
+
+#define SDL_LOGPAL 0x01
+#define SDL_PHYSPAL 0x02
+
+#define SDL_ACTIVEEVENT SDL_EVENT_COMPAT1
+#define SDL_VIDEORESIZE SDL_EVENT_COMPAT2
+#define SDL_VIDEOEXPOSE SDL_EVENT_COMPAT3
+#define SDL_ACTIVEEVENTMASK SDL_ACTIVEEVENT, SDL_ACTIVEEVENT
+#define SDL_VIDEORESIZEMASK SDL_VIDEORESIZE, SDL_VIDEORESIZE
+#define SDL_VIDEOEXPOSEMASK SDL_VIDEOEXPOSE, SDL_VIDEOEXPOSE
+#define SDL_WINDOWEVENTMASK SDL_WINDOWEVENT, SDL_WINDOWEVENT
+#define SDL_KEYDOWNMASK SDL_KEYDOWN, SDL_KEYDOWN
+#define SDL_KEYUPMASK SDL_KEYUP, SDL_KEYUP
+#define SDL_KEYEVENTMASK SDL_KEYDOWN, SDL_KEYUP
+#define SDL_TEXTEDITINGMASK SDL_TEXTEDITING, SDL_TEXTEDITING
+#define SDL_TEXTINPUTMASK SDL_TEXTINPUT, SDL_TEXTINPUT
+#define SDL_MOUSEMOTIONMASK SDL_MOUSEMOTION, SDL_MOUSEMOTION
+#define SDL_MOUSEBUTTONDOWNMASK SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONDOWN
+#define SDL_MOUSEBUTTONUPMASK SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONUP
+#define SDL_MOUSEWHEELMASK SDL_MOUSEWHEEL, SDL_MOUSEWHEEL
+#define SDL_MOUSEEVENTMASK SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP
+#define SDL_JOYAXISMOTIONMASK SDL_JOYAXISMOTION, SDL_JOYAXISMOTION
+#define SDL_JOYBALLMOTIONMASK SDL_JOYBALLMOTION, SDL_JOYBALLMOTION
+#define SDL_JOYHATMOTIONMASK SDL_JOYHATMOTION, SDL_JOYHATMOTION
+#define SDL_JOYBUTTONDOWNMASK SDL_JOYBUTTONDOWN, SDL_JOYBUTTONDOWN
+#define SDL_JOYBUTTONUPMASK SDL_JOYBUTTONUP, SDL_JOYBUTTONUP
+#define SDL_JOYEVENTMASK SDL_JOYAXISMOTION, SDL_JOYBUTTONUP
+#define SDL_QUITMASK SDL_QUIT, SDL_QUIT
+#define SDL_SYSWMEVENTMASK SDL_SYSWMEVENT, SDL_SYSWMEVENT
+#define SDL_PROXIMITYINMASK SDL_PROXIMITYIN, SDL_PROXIMITYIN
+#define SDL_PROXIMITYOUTMASK SDL_PROXIMITYOUT, SDL_PROXIMITYOUT
+#define SDL_ALLEVENTS SDL_FIRSTEVENT, SDL_LASTEVENT
+
+#define SDL_BUTTON_WHEELUP 4
+#define SDL_BUTTON_WHEELDOWN 5
+
+#define SDL_DEFAULT_REPEAT_DELAY 500
+#define SDL_DEFAULT_REPEAT_INTERVAL 30
+
+typedef struct SDL_VideoInfo
+{
+ Uint32 hw_available:1;
+ Uint32 wm_available:1;
+ Uint32 UnusedBits1:6;
+ Uint32 UnusedBits2:1;
+ Uint32 blit_hw:1;
+ Uint32 blit_hw_CC:1;
+ Uint32 blit_hw_A:1;
+ Uint32 blit_sw:1;
+ Uint32 blit_sw_CC:1;
+ Uint32 blit_sw_A:1;
+ Uint32 blit_fill:1;
+ Uint32 UnusedBits3:16;
+ Uint32 video_mem;
+
+ SDL_PixelFormat *vfmt;
+
+ int current_w;
+ int current_h;
+} SDL_VideoInfo;
+
+/**
+ * \name Overlay formats
+ *
+ * The most common video overlay formats.
+ *
+ * For an explanation of these pixel formats, see:
+ * http://www.webartz.com/fourcc/indexyuv.htm
+ *
+ * For information on the relationship between color spaces, see:
+ * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
+ */
+/*@{*/
+#define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */
+#define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */
+#define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
+#define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
+#define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
+/*@}*//*Overlay formats*/
+
+/**
+ * The YUV hardware video overlay.
+ */
+typedef struct SDL_Overlay
+{
+ Uint32 format; /**< Read-only */
+ int w, h; /**< Read-only */
+ int planes; /**< Read-only */
+ Uint16 *pitches; /**< Read-only */
+ Uint8 **pixels; /**< Read-write */
+
+ /**
+ * \name Hardware-specific surface info
+ */
+ /*@{*/
+ struct private_yuvhwfuncs *hwfuncs;
+ struct private_yuvhwdata *hwdata;
+ /*@}*//*Hardware-specific surface info*/
+
+ /**
+ * \name Special flags
+ */
+ /*@{*/
+ Uint32 hw_overlay:1; /**< Flag: This overlay hardware accelerated? */
+ Uint32 UnusedBits:31;
+ /*@}*//*Special flags*/
+} SDL_Overlay;
+
+typedef enum
+{
+ SDL_GRAB_QUERY = -1,
+ SDL_GRAB_OFF = 0,
+ SDL_GRAB_ON = 1
+} SDL_GrabMode;
+
+struct SDL_SysWMinfo;
+
+/**
+ * \name Obsolete or renamed key codes
+ */
+/*@{*/
+
+/**
+ * \name Renamed keys
+ *
+ * These key constants were renamed for clarity or consistency.
+ */
+/*@{*/
+#define SDLK_KP0 SDLK_KP_0
+#define SDLK_KP1 SDLK_KP_1
+#define SDLK_KP2 SDLK_KP_2
+#define SDLK_KP3 SDLK_KP_3
+#define SDLK_KP4 SDLK_KP_4
+#define SDLK_KP5 SDLK_KP_5
+#define SDLK_KP6 SDLK_KP_6
+#define SDLK_KP7 SDLK_KP_7
+#define SDLK_KP8 SDLK_KP_8
+#define SDLK_KP9 SDLK_KP_9
+#define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR
+#define SDLK_SCROLLOCK SDLK_SCROLLLOCK
+#define SDLK_PRINT SDLK_PRINTSCREEN
+#define SDLK_LMETA SDLK_LGUI
+#define SDLK_RMETA SDLK_RGUI
+/*@}*//*Renamed keys*/
+
+/**
+ * \name META modifier
+ *
+ * The META modifier is equivalent to the GUI modifier from the USB standard.
+ */
+/*@{*/
+#define KMOD_LMETA KMOD_LGUI
+#define KMOD_RMETA KMOD_RGUI
+#define KMOD_META KMOD_GUI
+/*@}*//*META modifier*/
+
+/**
+ * \name Not in USB
+ *
+ * These keys don't appear in the USB specification (or at least not under
+ * those names). I'm unsure if the following assignments make sense or if these
+ * codes should be defined as actual additional SDLK_ constants.
+ */
+/*@{*/
+#define SDLK_LSUPER SDLK_LMETA
+#define SDLK_RSUPER SDLK_RMETA
+#define SDLK_COMPOSE SDLK_APPLICATION
+#define SDLK_BREAK SDLK_STOP
+#define SDLK_EURO SDLK_2
+/*@}*//*Not in USB*/
+
+/*@}*//*Obsolete or renamed key codes*/
+
+#define SDL_SetModuleHandle(x)
+#define SDL_AllocSurface SDL_CreateRGBSurface
+
+extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
+extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
+extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
+extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
+extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
+ int height,
+ int bpp, Uint32 flags);
+extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat *
+ format, Uint32 flags);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
+ int bpp, Uint32 flags);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
+extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
+ int numrects, SDL_Rect * rects);
+extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen,
+ Sint32 x,
+ Sint32 y, Uint32 w, Uint32 h);
+extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
+extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,
+ Uint32 flag, Uint8 alpha);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
+ surface);
+extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
+ const char *icon);
+extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
+ const char **icon);
+extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
+extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
+extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
+extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
+extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface,
+ int flags,
+ const SDL_Color * colors,
+ int firstcolor, int ncolors);
+extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
+ const SDL_Color * colors,
+ int firstcolor, int ncolors);
+extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
+extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
+extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
+extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
+ int height,
+ Uint32 format,
+ SDL_Surface *
+ display);
+extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
+extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
+extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
+ SDL_Rect * dstrect);
+extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
+extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
+extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
+extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
+extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
+
+#define SDL_TextureID SDL_Texture*
+#define SDL_WindowID SDL_Window*
+#define SDL_RenderPoint SDL_RenderDrawPoint
+#define SDL_RenderLine SDL_RenderDrawLine
+#define SDL_RenderFill(X) (X) ? SDL_RenderFillRect(X) : SDL_RenderClear()
+
+extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
+
+/*@}*//*Compatibility*/
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_compat_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config.h b/alienblaster/project/jni/sdl/include/SDL_config.h
index ce02af211..74ff4f2e3 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config.h
@@ -25,19 +25,21 @@
#include "SDL_platform.h"
-/* Add any platform that doesn't build using the configure system */
-#if defined(__DREAMCAST__)
-#include "SDL_config_dreamcast.h"
-#elif defined(__MACOS__)
-#include "SDL_config_macos.h"
+/**
+ * \file SDL_config.h.default
+ *
+ * SDL_config.h for any platform that doesn't build using the configure system.
+ */
+
+/* Add any platform that doesn't build using the configure system. */
+#if defined(__NINTENDODS__)
+#include "SDL_config_nintendods.h"
+#elif defined(__IPHONEOS__)
+#include "SDL_config_iphoneos.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
-#elif defined(__SYMBIAN32__)
-#include "SDL_config_symbian.h" /* must be before win32! */
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
-#elif defined(__OS2__)
-#include "SDL_config_os2.h"
#elif defined(ANDROID)
#include "SDL_config_android.h"
#else
diff --git a/alienblaster/project/jni/sdl/include/SDL_config.h.default b/alienblaster/project/jni/sdl/include/SDL_config.h.default
index a50810169..87fd742ea 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config.h.default
+++ b/alienblaster/project/jni/sdl/include/SDL_config.h.default
@@ -25,19 +25,21 @@
#include "SDL_platform.h"
-/* Add any platform that doesn't build using the configure system */
-#if defined(__DREAMCAST__)
-#include "SDL_config_dreamcast.h"
-#elif defined(__MACOS__)
-#include "SDL_config_macos.h"
+/**
+ * \file SDL_config.h.default
+ *
+ * SDL_config.h for any platform that doesn't build using the configure system.
+ */
+
+/* Add any platform that doesn't build using the configure system. */
+#if defined(__NINTENDODS__)
+#include "SDL_config_nintendods.h"
+#elif defined(__IPHONEOS__)
+#include "SDL_config_iphoneos.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
-#elif defined(__SYMBIAN32__)
-#include "SDL_config_symbian.h" /* must be before win32! */
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
-#elif defined(__OS2__)
-#include "SDL_config_os2.h"
#else
#include "SDL_config_minimal.h"
#endif /* platform config */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config.h.in b/alienblaster/project/jni/sdl/include/SDL_config.h.in
index 58593ca2a..5c47f11b2 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config.h.in
+++ b/alienblaster/project/jni/sdl/include/SDL_config.h.in
@@ -23,7 +23,11 @@
#ifndef _SDL_config_h
#define _SDL_config_h
-/* This is a set of defines to configure the SDL features */
+/**
+ * \file SDL_config.h.in
+ *
+ * This is a set of defines to configure the SDL features
+ */
/* General platform specific identifiers */
#include "SDL_platform.h"
@@ -39,6 +43,7 @@
#undef volatile
/* C datatypes */
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
#undef size_t
#undef int8_t
#undef uint8_t
@@ -49,10 +54,10 @@
#undef int64_t
#undef uint64_t
#undef uintptr_t
-#undef SDL_HAS_64BIT_TYPE
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
-/* Endianness */
-#undef SDL_BYTEORDER
+#undef SIZEOF_VOIDP
+#undef SDL_HAS_64BIT_TYPE
/* Comment this if you want to build without any C library requirements */
#undef HAVE_LIBC
@@ -85,6 +90,7 @@
#undef HAVE_ALLOCA
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
#undef HAVE_GETENV
+#undef HAVE_SETENV
#undef HAVE_PUTENV
#undef HAVE_UNSETENV
#endif
@@ -129,10 +135,24 @@
#undef HAVE_SSCANF
#undef HAVE_SNPRINTF
#undef HAVE_VSNPRINTF
-#undef HAVE_ICONV
+#undef HAVE_M_PI
+#undef HAVE_CEIL
+#undef HAVE_COPYSIGN
+#undef HAVE_COS
+#undef HAVE_COSF
+#undef HAVE_FABS
+#undef HAVE_FLOOR
+#undef HAVE_LOG
+#undef HAVE_POW
+#undef HAVE_SCALBN
+#undef HAVE_SIN
+#undef HAVE_SINF
+#undef HAVE_SQRT
#undef HAVE_SIGACTION
#undef HAVE_SETJMP
#undef HAVE_NANOSLEEP
+#undef HAVE_SYSCONF
+#undef HAVE_SYSCTLBYNAME
#undef HAVE_CLOCK_GETTIME
#undef HAVE_GETPAGESIZE
#undef HAVE_MPROTECT
@@ -142,80 +162,68 @@
#include
#endif /* HAVE_LIBC */
+/* SDL internal assertion support */
+#undef SDL_DEFAULT_ASSERT_LEVEL
+
/* Allow disabling of core subsystems */
#undef SDL_AUDIO_DISABLED
-#undef SDL_CDROM_DISABLED
#undef SDL_CPUINFO_DISABLED
#undef SDL_EVENTS_DISABLED
#undef SDL_FILE_DISABLED
#undef SDL_JOYSTICK_DISABLED
+#undef SDL_HAPTIC_DISABLED
#undef SDL_LOADSO_DISABLED
#undef SDL_THREADS_DISABLED
#undef SDL_TIMERS_DISABLED
#undef SDL_VIDEO_DISABLED
+#undef SDL_POWER_DISABLED
/* Enable various audio drivers */
#undef SDL_AUDIO_DRIVER_ALSA
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
#undef SDL_AUDIO_DRIVER_ARTS
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_BAUDIO
+#undef SDL_AUDIO_DRIVER_PULSEAUDIO
+#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
+#undef SDL_AUDIO_DRIVER_BEOSAUDIO
#undef SDL_AUDIO_DRIVER_BSD
#undef SDL_AUDIO_DRIVER_COREAUDIO
-#undef SDL_AUDIO_DRIVER_DART
-#undef SDL_AUDIO_DRIVER_DC
#undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_DMEDIA
#undef SDL_AUDIO_DRIVER_DSOUND
-#undef SDL_AUDIO_DRIVER_PULSE
-#undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
#undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
-#undef SDL_AUDIO_DRIVER_MINT
#undef SDL_AUDIO_DRIVER_MMEAUDIO
#undef SDL_AUDIO_DRIVER_NAS
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
+#undef SDL_AUDIO_DRIVER_NDS
#undef SDL_AUDIO_DRIVER_OSS
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
-#undef SDL_AUDIO_DRIVER_PAUD
-#undef SDL_AUDIO_DRIVER_QNXNTO
-#undef SDL_AUDIO_DRIVER_SNDMGR
+#undef SDL_AUDIO_DRIVER_PAUDIO
+#undef SDL_AUDIO_DRIVER_QSA
#undef SDL_AUDIO_DRIVER_SUNAUDIO
-#undef SDL_AUDIO_DRIVER_WAVEOUT
-
-/* Enable various cdrom drivers */
-#undef SDL_CDROM_AIX
-#undef SDL_CDROM_BEOS
-#undef SDL_CDROM_BSDI
-#undef SDL_CDROM_DC
-#undef SDL_CDROM_DUMMY
-#undef SDL_CDROM_FREEBSD
-#undef SDL_CDROM_LINUX
-#undef SDL_CDROM_MACOS
-#undef SDL_CDROM_MACOSX
-#undef SDL_CDROM_MINT
-#undef SDL_CDROM_OPENBSD
-#undef SDL_CDROM_OS2
-#undef SDL_CDROM_OSF
-#undef SDL_CDROM_QNX
-#undef SDL_CDROM_WIN32
+#undef SDL_AUDIO_DRIVER_WINWAVEOUT
+#undef SDL_AUDIO_DRIVER_FUSIONSOUND
+#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
/* Enable various input drivers */
#undef SDL_INPUT_LINUXEV
#undef SDL_INPUT_TSLIB
#undef SDL_JOYSTICK_BEOS
-#undef SDL_JOYSTICK_DC
+#undef SDL_JOYSTICK_DINPUT
#undef SDL_JOYSTICK_DUMMY
#undef SDL_JOYSTICK_IOKIT
#undef SDL_JOYSTICK_LINUX
-#undef SDL_JOYSTICK_MACOS
-#undef SDL_JOYSTICK_MINT
-#undef SDL_JOYSTICK_OS2
+#undef SDL_JOYSTICK_NDS
#undef SDL_JOYSTICK_RISCOS
#undef SDL_JOYSTICK_WINMM
#undef SDL_JOYSTICK_USBHID
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
+#undef SDL_HAPTIC_DUMMY
+#undef SDL_HAPTIC_LINUX
+#undef SDL_HAPTIC_IOKIT
+#undef SDL_HAPTIC_DINPUT
/* Enable various shared object loading systems */
#undef SDL_LOADSO_BEOS
@@ -223,15 +231,11 @@
#undef SDL_LOADSO_DLOPEN
#undef SDL_LOADSO_DUMMY
#undef SDL_LOADSO_LDG
-#undef SDL_LOADSO_MACOS
-#undef SDL_LOADSO_OS2
#undef SDL_LOADSO_WIN32
/* Enable various threading systems */
#undef SDL_THREAD_BEOS
-#undef SDL_THREAD_DC
-#undef SDL_THREAD_OS2
-#undef SDL_THREAD_PTH
+#undef SDL_THREAD_NDS
#undef SDL_THREAD_PTHREAD
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
@@ -240,71 +244,69 @@
/* Enable various timer systems */
#undef SDL_TIMER_BEOS
-#undef SDL_TIMER_DC
#undef SDL_TIMER_DUMMY
-#undef SDL_TIMER_MACOS
-#undef SDL_TIMER_MINT
-#undef SDL_TIMER_OS2
+#undef SDL_TIMER_NDS
#undef SDL_TIMER_RISCOS
#undef SDL_TIMER_UNIX
#undef SDL_TIMER_WIN32
#undef SDL_TIMER_WINCE
/* Enable various video drivers */
-#undef SDL_VIDEO_DRIVER_AALIB
#undef SDL_VIDEO_DRIVER_BWINDOW
-#undef SDL_VIDEO_DRIVER_CACA
-#undef SDL_VIDEO_DRIVER_DC
-#undef SDL_VIDEO_DRIVER_DDRAW
-#undef SDL_VIDEO_DRIVER_DGA
+#undef SDL_VIDEO_DRIVER_COCOA
#undef SDL_VIDEO_DRIVER_DIRECTFB
-#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
+#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
#undef SDL_VIDEO_DRIVER_DUMMY
#undef SDL_VIDEO_DRIVER_FBCON
-#undef SDL_VIDEO_DRIVER_GAPI
-#undef SDL_VIDEO_DRIVER_GEM
-#undef SDL_VIDEO_DRIVER_GGI
-#undef SDL_VIDEO_DRIVER_IPOD
-#undef SDL_VIDEO_DRIVER_NANOX
-#undef SDL_VIDEO_DRIVER_OS2FS
+#undef SDL_VIDEO_DRIVER_NDS
#undef SDL_VIDEO_DRIVER_PHOTON
-#undef SDL_VIDEO_DRIVER_PICOGUI
-#undef SDL_VIDEO_DRIVER_PS2GS
+#undef SDL_VIDEO_DRIVER_QNXGF
#undef SDL_VIDEO_DRIVER_PS3
-#undef SDL_VIDEO_DRIVER_QTOPIA
-#undef SDL_VIDEO_DRIVER_QUARTZ
#undef SDL_VIDEO_DRIVER_RISCOS
#undef SDL_VIDEO_DRIVER_SVGALIB
-#undef SDL_VIDEO_DRIVER_TOOLBOX
-#undef SDL_VIDEO_DRIVER_VGL
-#undef SDL_VIDEO_DRIVER_WINDIB
-#undef SDL_VIDEO_DRIVER_WSCONS
+#undef SDL_VIDEO_DRIVER_WIN32
#undef SDL_VIDEO_DRIVER_X11
-#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
+#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
+#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
-#undef SDL_VIDEO_DRIVER_X11_XME
#undef SDL_VIDEO_DRIVER_X11_XRANDR
+#undef SDL_VIDEO_DRIVER_X11_XINPUT
+#undef SDL_VIDEO_DRIVER_X11_SCRNSAVER
#undef SDL_VIDEO_DRIVER_X11_XV
-#undef SDL_VIDEO_DRIVER_XBIOS
+
+#undef SDL_VIDEO_RENDER_D3D
+#undef SDL_VIDEO_RENDER_GDI
+#undef SDL_VIDEO_RENDER_OGL
+#undef SDL_VIDEO_RENDER_OGL_ES
+#undef SDL_VIDEO_RENDER_X11
+#undef SDL_VIDEO_RENDER_GAPI
+#undef SDL_VIDEO_RENDER_DDRAW
/* Enable OpenGL support */
#undef SDL_VIDEO_OPENGL
+#undef SDL_VIDEO_OPENGL_ES
+#undef SDL_VIDEO_OPENGL_BGL
+#undef SDL_VIDEO_OPENGL_CGL
#undef SDL_VIDEO_OPENGL_GLX
#undef SDL_VIDEO_OPENGL_WGL
#undef SDL_VIDEO_OPENGL_OSMESA
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
-/* Disable screensaver */
-#undef SDL_VIDEO_DISABLE_SCREENSAVER
+/* Enable system power support */
+#undef SDL_POWER_LINUX
+#undef SDL_POWER_WINDOWS
+#undef SDL_POWER_MACOSX
+#undef SDL_POWER_BEOS
+#undef SDL_POWER_NINTENDODS
+#undef SDL_POWER_HARDWIRED
/* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES
-#undef SDL_HERMES_BLITTERS
#undef SDL_ALTIVEC_BLITTERS
#endif /* _SDL_config_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_android.h b/alienblaster/project/jni/sdl/include/SDL_config_android.h
index 2b8a7fa10..eca12ebf6 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config_android.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config_android.h
@@ -20,8 +20,8 @@
slouken@libsdl.org
*/
-#ifndef _SDL_config_minimal_h
-#define _SDL_config_minimal_h
+#ifndef _SDL_config_android_h
+#define _SDL_config_android_h
#include "SDL_platform.h"
@@ -31,22 +31,37 @@
#include
#include
-#define SDL_AUDIO_DRIVER_ANDROID 1
+#define SDL_VIDEO_DRIVER_ANDROID 1
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
-#define SDL_CDROM_DISABLED 1
+// #define SDL_AUDIO_DRIVER_ANDROID 1
+#define SDL_AUDIO_DRIVER_DUMMY 1 // TODO: fix audio and remove that
-#define SDL_JOYSTICK_DISABLED 1
+#define SDL_CDROM_DISABLED 1
-#define SDL_LOADSO_DISABLED 1
+#define SDL_JOYSTICK_DUMMY 1 // TODO: add joystick and remove that
+#define SDL_JOYSTICK_ANDROID 1
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+#define SDL_HAPTIC_DUMMY 1 // TODO: add vibrator and remove that
+#define SDL_HAPTIC_ANDROID 1
-#define SDL_TIMER_UNIX 1
+#define SDL_POWER_DISABLED 1 // TODO: add battery meter and remove that
+#define SDL_POWER_ANDROID 1
+#undef SDL_POWER_LINUX
-#define SDL_VIDEO_DRIVER_ANDROID 1
+#define SDL_LOADSO_DLOPEN 1
-#define HAVE_STDIO_H 1
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+#define SDL_TIMER_UNIX 1
+
+#define HAVE_STDIO_H 1
+
+
+#define SIZEOF_VOIDP 4
+#define SDL_HAS_64BIT_TYPE 1
/* FireSlash found that SDL native memcpy crashes sometimes, these defines fix it (and they are faster) */
#define HAVE_LIBC 1
@@ -126,4 +141,23 @@
#define HAVE_GETPAGESIZE 1
#define HAVE_MPROTECT 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_M_PI 1
+#define HAVE_POW 1
+#define HAVE_SCALBN 1
+#define HAVE_SETENV 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SYSCONF 1
+#undef HAVE_SYSCTLBYNAME
+#undef SDL_ALTIVEC_BLITTERS
+#define SDL_ASSEMBLY_ROUTINES 1 // There is no assembly code for Arm CPU yet
+
#endif /* _SDL_config_minimal_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_iphoneos.h b/alienblaster/project/jni/sdl/include/SDL_config_iphoneos.h
new file mode 100644
index 000000000..f9271766c
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_config_iphoneos.h
@@ -0,0 +1,158 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+#ifndef _SDL_config_iphoneos_h
+#define _SDL_config_iphoneos_h
+
+#include "SDL_platform.h"
+
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+typedef unsigned long uintptr_t;
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
+#ifdef __LP64__
+#define SIZEOF_VOIDP 8
+#else
+#define SIZEOF_VOIDP 4
+#endif
+
+#define SDL_HAS_64BIT_TYPE 1
+
+#define HAVE_ALLOCA_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_STDIO_H 1
+#define STDC_HEADERS 1
+#define HAVE_STRING_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_SETENV 1
+#define HAVE_UNSETENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRDUP 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_POW 1
+#define HAVE_SCALBN 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_SYSCTLBYNAME 1
+
+/* enable iPhone version of Core Audio driver */
+#define SDL_AUDIO_DRIVER_COREAUDIOIPHONE 1
+/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
+#define SDL_AUDIO_DRIVER_DUMMY 1
+
+/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DISABLED 1
+
+/* Enable Unix style SO loading */
+/* Technically this works, but it violates the iPhone developer agreement */
+/* #define SDL_LOADSO_DLOPEN 1 */
+
+/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
+#define SDL_LOADSO_DISABLED 1
+
+/* Enable various threading systems */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+
+/* Enable various timer systems */
+#define SDL_TIMER_UNIX 1
+
+/* Supported video drivers */
+#define SDL_VIDEO_DRIVER_UIKIT 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* enable OpenGL ES */
+#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+
+/* Enable system power support */
+#define SDL_POWER_UIKIT 1
+
+/* enable iPhone keyboard support */
+#define SDL_IPHONE_KEYBOARD 0
+
+/* Enable emulation of multiple mice through multi-touch */
+#define SDL_IPHONE_MULTIPLE_MICE 1
+
+/* Set max recognized G-force from acceleromter
+ See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
+ */
+#define SDL_IPHONE_MAX_GFORCE 5.0
+
+#endif /* _SDL_config_iphoneos_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_macos.h b/alienblaster/project/jni/sdl/include/SDL_config_macos.h
deleted file mode 100644
index 4ba5c22c3..000000000
--- a/alienblaster/project/jni/sdl/include/SDL_config_macos.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_macos_h
-#define _SDL_config_macos_h
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#include
-
-typedef SInt8 int8_t;
-typedef UInt8 uint8_t;
-typedef SInt16 int16_t;
-typedef UInt16 uint16_t;
-typedef SInt32 int32_t;
-typedef UInt32 uint32_t;
-typedef SInt64 int64_t;
-typedef UInt64 uint64_t;
-typedef unsigned long uintptr_t;
-
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Useful headers */
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_SSCANF 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_SNDMGR 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various cdrom drivers */
-#if TARGET_API_MAC_CARBON
-#define SDL_CDROM_DUMMY 1
-#else
-#define SDL_CDROM_MACOS 1
-#endif
-
-/* Enable various input drivers */
-#if TARGET_API_MAC_CARBON
-#define SDL_JOYSTICK_DUMMY 1
-#else
-#define SDL_JOYSTICK_MACOS 1
-#endif
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_MACOS 1
-
-/* Enable various threading systems */
-#define SDL_THREADS_DISABLED 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_MACOS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_DRAWSPROCKET 1
-#define SDL_VIDEO_DRIVER_TOOLBOX 1
-
-/* Enable OpenGL support */
-#define SDL_VIDEO_OPENGL 1
-
-#endif /* _SDL_config_macos_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_macosx.h b/alienblaster/project/jni/sdl/include/SDL_config_macosx.h
index 295b87245..b650068ad 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config_macosx.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config_macosx.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -30,6 +30,12 @@
/* This is a set of defines to configure the SDL features */
+#ifdef __LP64__
+ #define SIZEOF_VOIDP 8
+#else
+ #define SIZEOF_VOIDP 4
+#endif
+
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
@@ -54,6 +60,7 @@
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
+#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
@@ -84,28 +91,35 @@
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_POW 1
+#define HAVE_SCALBN 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
+#define HAVE_SYSCONF 1
+#define HAVE_SYSCTLBYNAME 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
-/* Enable various cdrom drivers */
-#define SDL_CDROM_MACOSX 1
-
/* Enable various input drivers */
#define SDL_JOYSTICK_IOKIT 1
+#define SDL_HAPTIC_IOKIT 1
/* Enable various shared object loading systems */
-#ifdef __ppc__
-/* For Mac OS X 10.2 compatibility */
-#define SDL_LOADSO_DLCOMPAT 1
-#else
#define SDL_LOADSO_DLOPEN 1
-#endif
/* Enable various threading systems */
#define SDL_THREAD_PTHREAD 1
@@ -115,31 +129,32 @@
#define SDL_TIMER_UNIX 1
/* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_COCOA 1
#define SDL_VIDEO_DRIVER_DUMMY 1
-#if ((defined TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON))
-#define SDL_VIDEO_DRIVER_TOOLBOX 1
-#else
-#define SDL_VIDEO_DRIVER_QUARTZ 1
-#endif
-#define SDL_VIDEO_DRIVER_DGA 1
#define SDL_VIDEO_DRIVER_X11 1
-#define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER "/usr/X11R6/lib/libXrender.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT "/usr/X11R6/lib/libXi.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.6.dylib"
#define SDL_VIDEO_DRIVER_X11_VIDMODE 1
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
-#define SDL_VIDEO_DRIVER_X11_XME 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
+#define SDL_VIDEO_DRIVER_X11_XINPUT 1
+#define SDL_VIDEO_DRIVER_X11_SCRNSAVER 1
#define SDL_VIDEO_DRIVER_X11_XV 1
+#define SDL_VIDEO_RENDER_OGL 1
+#define SDL_VIDEO_RENDER_X11 1
+
/* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1
-#define SDL_VIDEO_OPENGL_GLX 1
+#define SDL_VIDEO_OPENGL_CGL 1
+#define SDL_VIDEO_OPENGL_GLX 1
-/* Disable screensaver */
-#define SDL_VIDEO_DISABLE_SCREENSAVER 1
+/* Enable system power support */
+#define SDL_POWER_MACOSX 1
/* Enable assembly routines */
#define SDL_ASSEMBLY_ROUTINES 1
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_minimal.h b/alienblaster/project/jni/sdl/include/SDL_config_minimal.h
index fe57be5f4..c6c6d2666 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config_minimal.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config_minimal.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -25,12 +25,15 @@
#include "SDL_platform.h"
-/* This is the minimal configuration that can be used to build SDL */
+/**
+ * \file SDL_config_minimal.h
+ *
+ * This is the minimal configuration that can be used to build SDL.
+ */
#include
-#include
-/*
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
@@ -39,23 +42,27 @@ typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef unsigned int size_t;
typedef unsigned long uintptr_t;
-*/
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
#define SDL_AUDIO_DRIVER_DUMMY 1
-#define SDL_CDROM_DISABLED 1
-
+/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
#define SDL_JOYSTICK_DISABLED 1
+/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+#define SDL_HAPTIC_DISABLED 1
+
+/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+/* Enable the stub thread support (src/thread/generic/\*.c) */
+#define SDL_THREADS_DISABLED 1
-#define SDL_TIMER_UNIX 1
+/* Enable the stub timer support (src/timer/dummy/\*.c) */
+#define SDL_TIMERS_DISABLED 1
-#define SDL_VIDEO_DRIVER_ANDROID 1
-
-#define HAVE_STDIO_H 1
+/* Enable the dummy video driver (src/video/dummy/\*.c) */
+#define SDL_VIDEO_DRIVER_DUMMY 1
#endif /* _SDL_config_minimal_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_dreamcast.h b/alienblaster/project/jni/sdl/include/SDL_config_nintendods.h
similarity index 68%
rename from alienblaster/project/jni/sdl/include/SDL_config_dreamcast.h
rename to alienblaster/project/jni/sdl/include/SDL_config_nintendods.h
index 07c2f0815..be9a3105e 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config_dreamcast.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config_nintendods.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,13 +20,14 @@
slouken@libsdl.org
*/
-#ifndef _SDL_config_dreamcast_h
-#define _SDL_config_dreamcast_h
+#ifndef _SDL_config_nintendods_h
+#define _SDL_config_nintendods_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
@@ -35,7 +36,16 @@ typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
+
+/* LiF: __PTRDIFF_TYPE__ was causing errors of conflicting typedefs with the
+ shipping with devkitARM. copied a similar ifdef from it. */
+#ifndef __PTRDIFF_TYPE__
typedef unsigned long uintptr_t;
+#else
+typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
+#endif
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
@@ -52,6 +62,7 @@ typedef unsigned long uintptr_t;
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
+#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
@@ -79,28 +90,32 @@ typedef unsigned long uintptr_t;
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_DC 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
+/* DS isn't that sophisticated */
+#define LACKS_SYS_MMAN_H 1
-/* Enable various cdrom drivers */
-#define SDL_CDROM_DC 1
+/* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_NDS 1
+/*#define SDL_AUDIO_DRIVER_DUMMY 1 TODO: uncomment this later*/
/* Enable various input drivers */
-#define SDL_JOYSTICK_DC 1
+#define SDL_JOYSTICK_NDS 1
+/*#define SDL_JOYSTICK_DUMMY 1 TODO: uncomment this later*/
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DUMMY 1
+/* DS has no dynamic linking afaik */
+#define SDL_LOADSO_DISABLED 1
/* Enable various threading systems */
-#define SDL_THREAD_DC 1
+/*#define SDL_THREAD_NDS 1*/
+#define SDL_THREADS_DISABLED 1
/* Enable various timer systems */
-#define SDL_TIMER_DC 1
+#define SDL_TIMER_NDS 1
/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DC 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_NDS 1
+/*#define SDL_VIDEO_DRIVER_DUMMY 1 TODO: uncomment this later*/
-#endif /* _SDL_config_dreamcast_h */
+/* Enable system power support */
+#define SDL_POWER_NINTENDODS 1
+
+#endif /* _SDL_config_nintendods_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_nds.h b/alienblaster/project/jni/sdl/include/SDL_config_pandora.h
similarity index 68%
rename from alienblaster/project/jni/sdl/include/SDL_config_nds.h
rename to alienblaster/project/jni/sdl/include/SDL_config_pandora.h
index 4ac60a504..227831e63 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config_nds.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config_pandora.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,23 +20,17 @@
slouken@libsdl.org
*/
-#ifndef _SDL_config_nds_h
-#define _SDL_config_nds_h
-
-#include "SDL_platform.h"
+#ifndef _SDL_config_h
+#define _SDL_config_h
/* This is a set of defines to configure the SDL features */
/* General platform specific identifiers */
#include "SDL_platform.h"
-/* C datatypes */
#define SDL_HAS_64BIT_TYPE 1
-
-/* Endianness */
#define SDL_BYTEORDER 1234
-/* Useful headers */
#define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
@@ -44,21 +38,22 @@
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
+#define HAVE_MEMORY_H 1
#define HAVE_STRING_H 1
+#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_ICONV_H 1
#define HAVE_SIGNAL_H 1
-
-/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
+#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
@@ -68,8 +63,6 @@
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
@@ -87,29 +80,42 @@
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_SCALBN 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_NDS 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_OSS 1
-/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
-#define SDL_CDROM_DISABLED 1
+#define SDL_INPUT_LINUXEV 1
+#define SDL_INPUT_TSLIB 1
+#define SDL_JOYSTICK_LINUX 1
+#define SDL_HAPTIC_LINUX 1
-/* Enable various input drivers */
-#define SDL_JOYSTICK_NDS 1
+#define SDL_LOADSO_DLOPEN 1
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
-/* Enable the stub thread support (src/thread/generic/\*.c) */
-#define SDL_THREADS_DISABLED 1
+#define SDL_TIMER_UNIX 1
-/* Enable various timer systems */
-#define SDL_TIMER_NDS 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_X11 1
+#define SDL_VIDEO_DRIVER_X11_XINPUT 1
+#define SDL_VIDEO_DRIVER_PANDORA 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_OPENGL_ES 1
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_NDS 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-#endif /* _SDL_config_nds_h */
+#endif /* _SDL_config_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_symbian.h b/alienblaster/project/jni/sdl/include/SDL_config_symbian.h
deleted file mode 100644
index 53527b232..000000000
--- a/alienblaster/project/jni/sdl/include/SDL_config_symbian.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/*
-
-Symbian version Markus Mertama
-
-*/
-
-
-#ifndef _SDL_CONFIG_SYMBIAN_H
-#define _SDL_CONFIG_SYMBIAN_H
-
-#include "SDL_platform.h"
-
-/* This is the minimal configuration that can be used to build SDL */
-
-
-#include
-#include
-
-
-#ifdef __GCCE__
-#define SYMBIAN32_GCCE
-#endif
-
-#ifndef _SIZE_T_DEFINED
-typedef unsigned int size_t;
-#endif
-
-#ifndef _INTPTR_T_DECLARED
-typedef unsigned int uintptr_t;
-#endif
-
-#ifndef _INT8_T_DECLARED
-typedef signed char int8_t;
-#endif
-
-#ifndef _UINT8_T_DECLARED
-typedef unsigned char uint8_t;
-#endif
-
-#ifndef _INT16_T_DECLARED
-typedef signed short int16_t;
-#endif
-
-#ifndef _UINT16_T_DECLARED
-typedef unsigned short uint16_t;
-#endif
-
-#ifndef _INT32_T_DECLARED
-typedef signed int int32_t;
-#endif
-
-#ifndef _UINT32_T_DECLARED
-typedef unsigned int uint32_t;
-#endif
-
-#ifndef _INT64_T_DECLARED
-typedef signed long long int64_t;
-#endif
-
-#ifndef _UINT64_T_DECLARED
-typedef unsigned long long uint64_t;
-#endif
-
-#define SDL_AUDIO_DRIVER_EPOCAUDIO 1
-
-
-/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
-#define SDL_CDROM_DISABLED 1
-
-/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
-#define SDL_JOYSTICK_DISABLED 1
-
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
-
-#define SDL_THREAD_SYMBIAN 1
-
-#define SDL_VIDEO_DRIVER_EPOC 1
-
-#define SDL_VIDEO_OPENGL 0
-
-#define SDL_HAS_64BIT_TYPE 1
-
-#define HAVE_LIBC 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-/*#define HAVE_ALLOCA 1*/
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRUPR 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-/*#define HAVE__STRICMP 1*/
-#define HAVE__STRNICMP 1
-#define HAVE_SSCANF 1
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-
-
-
-#endif /* _SDL_CONFIG_SYMBIAN_H */
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_win32.h b/alienblaster/project/jni/sdl/include/SDL_config_win32.h
index 6d019a8d9..86e317252 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config_win32.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config_win32.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -27,22 +27,23 @@
/* This is a set of defines to configure the SDL features */
-#if defined(__GNUC__) || defined(__DMC__)
+#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
#define HAVE_STDINT_H 1
#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
+typedef unsigned __int64 uintptr_t;
#else
-typedef unsigned int uintptr_t;
+typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
@@ -53,7 +54,7 @@ typedef unsigned int uintptr_t;
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
#define LONG_PTR LONG
#endif
-#else /* !__GNUC__ && !_MSC_VER */
+#else /* !__GNUC__ && !_MSC_VER */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
@@ -68,10 +69,17 @@ typedef unsigned int size_t;
#endif
typedef unsigned int uintptr_t;
#endif /* __GNUC__ || _MSC_VER */
+#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
+
+#ifdef _WIN64
+# define SIZEOF_VOIDP 8
+#else
+# define SIZEOF_VOIDP 4
+#endif
#define SDL_HAS_64BIT_TYPE 1
/* Enabled for SDL 1.2 (binary compatibility) */
-#define HAVE_LIBC 1
+//#define HAVE_LIBC 1
#ifdef HAVE_LIBC
/* Useful headers */
#define HAVE_STDIO_H 1
@@ -116,6 +124,19 @@ typedef unsigned int uintptr_t;
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE_SSCANF 1
+#define HAVE_M_PI 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_POW 1
+#define HAVE_SCALBN 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
@@ -125,22 +146,17 @@ typedef unsigned int uintptr_t;
#ifndef _WIN32_WCE
#define SDL_AUDIO_DRIVER_DSOUND 1
#endif
-#define SDL_AUDIO_DRIVER_WAVEOUT 1
+#define SDL_AUDIO_DRIVER_WINWAVEOUT 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
-/* Enable various cdrom drivers */
-#ifdef _WIN32_WCE
-#define SDL_CDROM_DISABLED 1
-#else
-#define SDL_CDROM_WIN32 1
-#endif
-
/* Enable various input drivers */
#ifdef _WIN32_WCE
-#define SDL_JOYSTICK_DISABLED 1
+#define SDL_JOYSTICK_DISABLED 1
+#define SDL_HAPTIC_DUMMY 1
#else
-#define SDL_JOYSTICK_WINMM 1
+#define SDL_JOYSTICK_DINPUT 1
+#define SDL_HAPTIC_DINPUT 1
#endif
/* Enable various shared object loading systems */
@@ -157,23 +173,21 @@ typedef unsigned int uintptr_t;
#endif
/* Enable various video drivers */
-#ifdef _WIN32_WCE
-#define SDL_VIDEO_DRIVER_GAPI 1
-#endif
-#ifndef _WIN32_WCE
-#define SDL_VIDEO_DRIVER_DDRAW 1
-#endif
#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDIB 1
+#define SDL_VIDEO_DRIVER_WIN32 1
+
+#define SDL_VIDEO_RENDER_D3D 1
+#define SDL_VIDEO_RENDER_GDI 1
/* Enable OpenGL support */
#ifndef _WIN32_WCE
#define SDL_VIDEO_OPENGL 1
#define SDL_VIDEO_OPENGL_WGL 1
+#define SDL_VIDEO_RENDER_OGL 1
#endif
-/* Disable screensaver */
-#define SDL_VIDEO_DISABLE_SCREENSAVER 1
+/* Enable system power support */
+#define SDL_POWER_WINDOWS 1
/* Enable assembly routines (Win64 doesn't have inline asm) */
#ifndef _WIN64
diff --git a/alienblaster/project/jni/sdl/include/SDL_config_os2.h b/alienblaster/project/jni/sdl/include/SDL_config_wiz.h
similarity index 53%
rename from alienblaster/project/jni/sdl/include/SDL_config_os2.h
rename to alienblaster/project/jni/sdl/include/SDL_config_wiz.h
index bb40df001..5cc12e37a 100644
--- a/alienblaster/project/jni/sdl/include/SDL_config_os2.h
+++ b/alienblaster/project/jni/sdl/include/SDL_config_wiz.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,30 +20,23 @@
slouken@libsdl.org
*/
-#ifndef _SDL_config_os2_h
-#define _SDL_config_os2_h
-
-#include "SDL_platform.h"
+#ifndef _SDL_config_h
+#define _SDL_config_h
/* This is a set of defines to configure the SDL features */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef unsigned int size_t;
-typedef unsigned long uintptr_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
+/* General platform specific identifiers */
+#include "SDL_platform.h"
-#define SDL_HAS_64BIT_TYPE 1
+/* Make sure that this isn't included by Visual C++ */
+#ifdef _MSC_VER
+#error You should copy include/SDL_config.h.default to include/SDL_config.h
+#endif
-/* Use Watcom's LIBC */
-#define HAVE_LIBC 1
+#define SDL_HAS_64BIT_TYPE 1
+#define SDL_BYTEORDER 1234
-/* Useful headers */
+#define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
@@ -57,15 +50,15 @@ typedef unsigned long long uint64_t;
#define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
+#define HAVE_ICONV_H 1
#define HAVE_SIGNAL_H 1
-
-/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
+#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
@@ -74,68 +67,60 @@ typedef unsigned long long uint64_t;
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-#define HAVE_INDEX 1
-#define HAVE_RINDEX 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE__LTOA 1
-#define HAVE__UITOA 1
-#define HAVE__ULTOA 1
#define HAVE_STRTOL 1
-#define HAVE__I64TOA 1
-#define HAVE__UI64TOA 1
+#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
-#define HAVE_STRTOD 1
+#define HAVE_STRTOULL 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
-#define HAVE_STRICMP 1
#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_CEIL 1
+#define HAVE_COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_FABS 1
+#define HAVE_FLOOR 1
+#define HAVE_LOG 1
+#define HAVE_SCALBN 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
-#define HAVE_CLOCK_GETTIME 1
+#define HAVE_NANOSLEEP 1
+#define HAVE_POW 1
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_DART 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_CDROM_DISABLED 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_OSS 1
-/* Enable various cdrom drivers */
-#define SDL_CDROM_OS2 1
+#define SDL_INPUT_LINUXEV 1
+#define SDL_INPUT_TSLIB 1
+#define SDL_JOYSTICK_LINUX 1
+#define SDL_HAPTIC_LINUX 1
-/* Enable various input drivers */
-#define SDL_JOYSTICK_OS2 1
+#define SDL_LOADSO_DLOPEN 1
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_OS2 1
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
-/* Enable various threading systems */
-#define SDL_THREAD_OS2 1
+#define SDL_TIMER_UNIX 1
-/* Enable various timer systems */
-#define SDL_TIMER_OS2 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_PANDORA 1
+#define SDL_VIDEO_RENDER_OGL_ES 1
+#define SDL_VIDEO_OPENGL_ES 1
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_OS2FS 1
-
-/* Enable OpenGL support */
-/* Nothing here yet for OS/2... :( */
-
-/* Enable assembly routines where available */
-#define SDL_ASSEMBLY_ROUTINES 1
-
-#endif /* _SDL_config_os2_h */
+#endif /* _SDL_config_h */
diff --git a/alienblaster/project/jni/sdl/include/SDL_copying.h b/alienblaster/project/jni/sdl/include/SDL_copying.h
index 1bd6b84cd..3bd3e8dc9 100644
--- a/alienblaster/project/jni/sdl/include/SDL_copying.h
+++ b/alienblaster/project/jni/sdl/include/SDL_copying.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,4 +19,3 @@
Sam Lantinga
slouken@libsdl.org
*/
-
diff --git a/alienblaster/project/jni/sdl/include/SDL_cpuinfo.h b/alienblaster/project/jni/sdl/include/SDL_cpuinfo.h
index f4be8e032..0cc4998e6 100644
--- a/alienblaster/project/jni/sdl/include/SDL_cpuinfo.h
+++ b/alienblaster/project/jni/sdl/include/SDL_cpuinfo.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,9 @@
*/
/**
- * @file SDL_cpuinfo.h
- * CPU feature detection for SDL
+ * \file SDL_cpuinfo.h
+ *
+ * CPU feature detection for SDL.
*/
#ifndef _SDL_cpuinfo_h
@@ -33,37 +34,64 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** This function returns true if the CPU has the RDTSC instruction */
+/**
+ * This function returns the number of CPU cores available.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
+
+/**
+ * This function returns true if the CPU has the RDTSC instruction.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
-/** This function returns true if the CPU has MMX features */
+/**
+ * This function returns true if the CPU has MMX features.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
-/** This function returns true if the CPU has MMX Ext. features */
+/**
+ * This function returns true if the CPU has MMX Ext.\ features.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
-/** This function returns true if the CPU has 3DNow features */
+/**
+ * This function returns true if the CPU has 3DNow!\ features.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
-/** This function returns true if the CPU has 3DNow! Ext. features */
+/**
+ * This function returns true if the CPU has 3DNow!\ Ext.\ features.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
-/** This function returns true if the CPU has SSE features */
+/**
+ * This function returns true if the CPU has SSE features.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
-/** This function returns true if the CPU has SSE2 features */
+/**
+ * This function returns true if the CPU has SSE2 features.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
-/** This function returns true if the CPU has AltiVec features */
+/**
+ * This function returns true if the CPU has AltiVec features.
+ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_cpuinfo_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_endian.h b/alienblaster/project/jni/sdl/include/SDL_endian.h
index f7a2e2f8c..39540f126 100644
--- a/alienblaster/project/jni/sdl/include/SDL_endian.h
+++ b/alienblaster/project/jni/sdl/include/SDL_endian.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,8 @@
*/
/**
- * @file SDL_endian.h
+ * \file SDL_endian.h
+ *
* Functions for reading and writing endian-specific values
*/
@@ -30,15 +31,15 @@
#include "SDL_stdinc.h"
-/** @name SDL_ENDIANs
- * The two types of endianness
+/**
+ * \name The two types of endianness
*/
/*@{*/
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
/*@}*/
-#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
+#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
@@ -54,156 +55,199 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
/**
- * @name SDL_Swap Functions
- * Use inline functions for compilers that support them, and static
+ * \file SDL_endian.h
+ *
+ * Uses inline functions for compilers that support them, and static
* functions for those that do not. Because these functions become
* static for compilers that do not support inline functions, this
* header should only be included in files that actually use them.
*/
-/*@{*/
#if defined(__GNUC__) && defined(__i386__) && \
- !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
+ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
{
- __asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
- return x;
+ __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
+ return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
{
- __asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
- return x;
+ __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
+ return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
{
- Uint16 result;
+ Uint16 result;
- __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
- return result;
+ __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
+ return result;
}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
+#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
{
- __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
- return x;
+ __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
+ return x;
}
#else
-static __inline__ Uint16 SDL_Swap16(Uint16 x) {
- return((x<<8)|(x>>8));
+static __inline__ Uint16
+SDL_Swap16(Uint16 x)
+{
+ return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
}
#endif
-#if defined(__GNUC__) && defined(__i386__) && \
- !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
+#if defined(__GNUC__) && defined(__i386__)
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
{
- __asm__("bswap %0" : "=r" (x) : "0" (x));
- return x;
+ __asm__("bswap %0": "=r"(x):"0"(x));
+ return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
{
- __asm__("bswapl %0" : "=r" (x) : "0" (x));
- return x;
+ __asm__("bswapl %0": "=r"(x):"0"(x));
+ return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
{
- Uint32 result;
+ Uint32 result;
- __asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
- __asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
- __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
- return result;
+ __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
+ __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
+ __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
+ return result;
}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
+#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
{
- __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
- return x;
+ __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
+ return x;
}
#else
-static __inline__ Uint32 SDL_Swap32(Uint32 x) {
- return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
+static __inline__ Uint32
+SDL_Swap32(Uint32 x)
+{
+ return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
+ ((x >> 8) & 0x0000FF00) | (x >> 24)));
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
-#if defined(__GNUC__) && defined(__i386__) && \
- !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
-static __inline__ Uint64 SDL_Swap64(Uint64 x)
+#if defined(__GNUC__) && defined(__i386__)
+static __inline__ Uint64
+SDL_Swap64(Uint64 x)
{
- union {
- struct { Uint32 a,b; } s;
- Uint64 u;
- } v;
- v.u = x;
- __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
- : "=r" (v.s.a), "=r" (v.s.b)
- : "0" (v.s.a), "1" (v.s.b));
- return v.u;
+ union
+ {
+ struct
+ {
+ Uint32 a, b;
+ } s;
+ Uint64 u;
+ } v;
+ v.u = x;
+ __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
+ "1"(v.s.
+ b));
+ return v.u;
}
#elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint64 SDL_Swap64(Uint64 x)
+static __inline__ Uint64
+SDL_Swap64(Uint64 x)
{
- __asm__("bswapq %0" : "=r" (x) : "0" (x));
- return x;
+ __asm__("bswapq %0": "=r"(x):"0"(x));
+ return x;
}
#else
-static __inline__ Uint64 SDL_Swap64(Uint64 x)
+static __inline__ Uint64
+SDL_Swap64(Uint64 x)
{
- Uint32 hi, lo;
+ Uint32 hi, lo;
- /* Separate into high and low 32-bit values and swap them */
- lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
- x >>= 32;
- hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
- x = SDL_Swap32(lo);
- x <<= 32;
- x |= SDL_Swap32(hi);
- return(x);
+ /* Separate into high and low 32-bit values and swap them */
+ lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+ x >>= 32;
+ hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
+ x = SDL_Swap32(lo);
+ x <<= 32;
+ x |= SDL_Swap32(hi);
+ return (x);
}
#endif
#else
-/* This is mainly to keep compilers from complaining in SDL code.
- * If there is no real 64-bit datatype, then compilers will complain about
- * the fake 64-bit datatype that SDL provides when it compiles user code.
+/**
+ * This is mainly to keep compilers from complaining in SDL code.
+ * If there is no real 64-bit datatype, then compilers will complain about
+ * the fake 64-bit datatype that SDL provides when it compiles user code.
*/
#define SDL_Swap64(X) (X)
#endif /* SDL_HAS_64BIT_TYPE */
-/*@}*/
+
+
+static __inline__ float
+SDL_SwapFloat(float x)
+{
+ union
+ {
+ float f;
+ Uint32 ui32;
+ } swapper;
+ swapper.f = x;
+ swapper.ui32 = SDL_Swap32(swapper.ui32);
+ return swapper.f;
+}
+
/**
- * @name SDL_SwapLE and SDL_SwapBE Functions
- * Byteswap item from the specified endianness to the native endianness
+ * \name Swap to native
+ * Byteswap item from the specified endianness to the native endianness.
*/
/*@{*/
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X) (X)
#define SDL_SwapLE32(X) (X)
#define SDL_SwapLE64(X) (X)
+#define SDL_SwapFloatLE(X) (X)
#define SDL_SwapBE16(X) SDL_Swap16(X)
#define SDL_SwapBE32(X) SDL_Swap32(X)
#define SDL_SwapBE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
#else
#define SDL_SwapLE16(X) SDL_Swap16(X)
#define SDL_SwapLE32(X) SDL_Swap32(X)
#define SDL_SwapLE64(X) SDL_Swap64(X)
+#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
#define SDL_SwapBE16(X) (X)
#define SDL_SwapBE32(X) (X)
#define SDL_SwapBE64(X) (X)
+#define SDL_SwapFloatBE(X) (X)
#endif
-/*@}*/
+/*@}*//*Swap to native*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_endian_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_error.h b/alienblaster/project/jni/sdl/include/SDL_error.h
index b103703a5..a4a90d0e4 100644
--- a/alienblaster/project/jni/sdl/include/SDL_error.h
+++ b/alienblaster/project/jni/sdl/include/SDL_error.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,9 @@
*/
/**
- * @file SDL_error.h
- * Simple error message routines for SDL
+ * \file SDL_error.h
+ *
+ * Simple error message routines for SDL.
*/
#ifndef _SDL_error_h
@@ -33,40 +34,45 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/**
- * @name Public functions
- */
-/*@{*/
+/* Public functions */
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
-extern DECLSPEC char * SDLCALL SDL_GetError(void);
+extern DECLSPEC char *SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void);
-/*@}*/
/**
- * @name Private functions
- * @internal Private error message function - used internally
+ * \name Internal error functions
+ *
+ * \internal
+ * Private error message function - used internally.
*/
/*@{*/
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
-typedef enum {
- SDL_ENOMEM,
- SDL_EFREAD,
- SDL_EFWRITE,
- SDL_EFSEEK,
- SDL_UNSUPPORTED,
- SDL_LASTERROR
+typedef enum
+{
+ SDL_ENOMEM,
+ SDL_EFREAD,
+ SDL_EFWRITE,
+ SDL_EFSEEK,
+ SDL_UNSUPPORTED,
+ SDL_LASTERROR
} SDL_errorcode;
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
-/*@}*/
+/*@}*//*Internal error functions*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_error_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_events.h b/alienblaster/project/jni/sdl/include/SDL_events.h
index c94a30c9c..91bdd8624 100644
--- a/alienblaster/project/jni/sdl/include/SDL_events.h
+++ b/alienblaster/project/jni/sdl/include/SDL_events.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,9 @@
*/
/**
- * @file SDL_events.h
- * Include file for SDL event handling
+ * \file SDL_events.h
+ *
+ * Include file for SDL event handling.
*/
#ifndef _SDL_events_h
@@ -30,7 +31,7 @@
#include "SDL_stdinc.h"
#include "SDL_error.h"
-#include "SDL_active.h"
+#include "SDL_video.h"
#include "SDL_keyboard.h"
#include "SDL_mouse.h"
#include "SDL_joystick.h"
@@ -39,318 +40,493 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** @name General keyboard/mouse state definitions */
-/*@{*/
+/* General keyboard/mouse state definitions */
#define SDL_RELEASED 0
#define SDL_PRESSED 1
-/*@}*/
-/** Event enumerations */
-typedef enum {
- SDL_NOEVENT = 0, /**< Unused (do not remove) */
- SDL_ACTIVEEVENT, /**< Application loses/gains visibility */
- SDL_KEYDOWN, /**< Keys pressed */
- SDL_KEYUP, /**< Keys released */
- SDL_MOUSEMOTION, /**< Mouse moved */
- SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
- SDL_MOUSEBUTTONUP, /**< Mouse button released */
- SDL_JOYAXISMOTION, /**< Joystick axis motion */
- SDL_JOYBALLMOTION, /**< Joystick trackball motion */
- SDL_JOYHATMOTION, /**< Joystick hat position change */
- SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
- SDL_JOYBUTTONUP, /**< Joystick button released */
- SDL_QUIT, /**< User-requested quit */
- SDL_SYSWMEVENT, /**< System specific event */
- SDL_EVENT_RESERVEDA, /**< Reserved for future use.. */
- SDL_EVENT_RESERVEDB, /**< Reserved for future use.. */
- SDL_VIDEORESIZE, /**< User resized video mode */
- SDL_VIDEOEXPOSE, /**< Screen needs to be redrawn */
- SDL_EVENT_RESERVED2, /**< Reserved for future use.. */
- SDL_EVENT_RESERVED3, /**< Reserved for future use.. */
- SDL_EVENT_RESERVED4, /**< Reserved for future use.. */
- SDL_EVENT_RESERVED5, /**< Reserved for future use.. */
- SDL_EVENT_RESERVED6, /**< Reserved for future use.. */
- SDL_EVENT_RESERVED7, /**< Reserved for future use.. */
- /** Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
- SDL_USEREVENT = 24,
- /** This last event is only for bounding internal arrays
- * It is the number of bits in the event mask datatype -- Uint32
- */
- SDL_NUMEVENTS = 32
+/**
+ * \brief The types of events that can be delivered.
+ */
+typedef enum
+{
+ SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
+
+ /* Application events */
+ SDL_QUIT = 0x100, /**< User-requested quit */
+
+ /* Window events */
+ SDL_WINDOWEVENT = 0x200, /**< Window state change */
+ SDL_SYSWMEVENT, /**< System specific event */
+
+ /* Keyboard events */
+ SDL_KEYDOWN = 0x300, /**< Keys pressed */
+ SDL_KEYUP, /**< Keys released */
+ SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
+ SDL_TEXTINPUT, /**< Keyboard text input */
+
+ /* Mouse events */
+ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
+ SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
+ SDL_MOUSEBUTTONUP, /**< Mouse button released */
+ SDL_MOUSEWHEEL, /**< Mouse wheel motion */
+
+ /* Tablet or multiple mice input device events */
+ SDL_INPUTMOTION = 0x500, /**< Input moved */
+ SDL_INPUTBUTTONDOWN, /**< Input button pressed */
+ SDL_INPUTBUTTONUP, /**< Input button released */
+ SDL_INPUTWHEEL, /**< Input wheel motion */
+ SDL_INPUTPROXIMITYIN, /**< Input pen entered proximity */
+ SDL_INPUTPROXIMITYOUT, /**< Input pen left proximity */
+
+ /* Joystick events */
+ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
+ SDL_JOYBALLMOTION, /**< Joystick trackball motion */
+ SDL_JOYHATMOTION, /**< Joystick hat position change */
+ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
+ SDL_JOYBUTTONUP, /**< Joystick button released */
+
+ /* Obsolete events */
+ SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
+ SDL_EVENT_COMPAT2,
+ SDL_EVENT_COMPAT3,
+
+ /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
+ * and should be allocated with SDL_RegisterEvents()
+ */
+ SDL_USEREVENT = 0x8000,
+
+ /**
+ * This last event is only for bounding internal arrays
+ */
+ SDL_LASTEVENT = 0xFFFF
} SDL_EventType;
-/** @name Predefined event masks */
-/*@{*/
-#define SDL_EVENTMASK(X) (1<<(X))
-typedef enum {
- SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
- SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
- SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
- SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
- SDL_EVENTMASK(SDL_KEYUP),
- SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
- SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
- SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
- SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
- SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
- SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
- SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
- SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
- SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
- SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
- SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
- SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
- SDL_EVENTMASK(SDL_JOYBALLMOTION)|
- SDL_EVENTMASK(SDL_JOYHATMOTION)|
- SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
- SDL_EVENTMASK(SDL_JOYBUTTONUP),
- SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
- SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
- SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
- SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
-} SDL_EventMask ;
-#define SDL_ALLEVENTS 0xFFFFFFFF
-/*@}*/
+/**
+ * \brief Window state change event data (event.window.*)
+ */
+typedef struct SDL_WindowEvent
+{
+ Uint32 type; /**< ::SDL_WINDOWEVENT */
+ Uint32 windowID; /**< The associated window */
+ Uint8 event; /**< ::SDL_WindowEventID */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ int data1; /**< event dependent data */
+ int data2; /**< event dependent data */
+} SDL_WindowEvent;
-/** Application visibility event structure */
-typedef struct SDL_ActiveEvent {
- Uint8 type; /**< SDL_ACTIVEEVENT */
- Uint8 gain; /**< Whether given states were gained or lost (1/0) */
- Uint8 state; /**< A mask of the focus states */
-} SDL_ActiveEvent;
-
-/** Keyboard event structure */
-typedef struct SDL_KeyboardEvent {
- Uint8 type; /**< SDL_KEYDOWN or SDL_KEYUP */
- Uint8 which; /**< The keyboard device index */
- Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
- SDL_keysym keysym;
+/**
+ * \brief Keyboard button event structure (event.key.*)
+ */
+typedef struct SDL_KeyboardEvent
+{
+ Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ SDL_keysym keysym; /**< The key that was pressed or released */
} SDL_KeyboardEvent;
-/** Mouse motion event structure */
-typedef struct SDL_MouseMotionEvent {
- Uint8 type; /**< SDL_MOUSEMOTION */
- Uint8 which; /**< The mouse device index */
- Uint8 state; /**< The current button state */
- Uint16 x, y; /**< The X/Y coordinates of the mouse */
- Sint16 xrel; /**< The relative motion in the X direction */
- Sint16 yrel; /**< The relative motion in the Y direction */
+#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
+/**
+ * \brief Keyboard text editing event structure (event.edit.*)
+ */
+typedef struct SDL_TextEditingEvent
+{
+ Uint32 type; /**< ::SDL_TEXTEDITING */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
+ int start; /**< The start cursor of selected editing text */
+ int length; /**< The length of selected editing text */
+} SDL_TextEditingEvent;
+
+
+#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
+/**
+ * \brief Keyboard text input event structure (event.text.*)
+ */
+typedef struct SDL_TextInputEvent
+{
+ Uint32 type; /**< ::SDL_TEXTINPUT */
+ Uint32 windowID; /**< The window with keyboard focus, if any */
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
+} SDL_TextInputEvent;
+
+/**
+ * \brief Mouse motion event structure (event.motion.*)
+ */
+typedef struct SDL_MouseMotionEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEMOTION */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint8 state; /**< The current button state */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ int x; /**< X coordinate, relative to window */
+ int y; /**< Y coordinate, relative to window */
+ int xrel; /**< The relative motion in the X direction */
+ int yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent;
-/** Mouse button event structure */
-typedef struct SDL_MouseButtonEvent {
- Uint8 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
- Uint8 which; /**< The mouse device index */
- Uint8 button; /**< The mouse button index */
- Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
- Uint16 x, y; /**< The X/Y coordinates of the mouse at press time */
+/**
+ * \brief Mouse button event structure (event.button.*)
+ */
+typedef struct SDL_MouseButtonEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint8 button; /**< The mouse button index */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 padding1;
+ Uint8 padding2;
+ int x; /**< X coordinate, relative to window */
+ int y; /**< Y coordinate, relative to window */
} SDL_MouseButtonEvent;
-/** Joystick axis motion event structure */
-typedef struct SDL_JoyAxisEvent {
- Uint8 type; /**< SDL_JOYAXISMOTION */
- Uint8 which; /**< The joystick device index */
- Uint8 axis; /**< The joystick axis index */
- Sint16 value; /**< The axis value (range: -32768 to 32767) */
+/**
+ * \brief Mouse wheel event structure (event.wheel.*)
+ */
+typedef struct SDL_MouseWheelEvent
+{
+ Uint32 type; /**< ::SDL_MOUSEWHEEL */
+ Uint32 windowID; /**< The window with mouse focus, if any */
+ int x; /**< The amount scrolled horizontally */
+ int y; /**< The amount scrolled vertically */
+} SDL_MouseWheelEvent;
+
+/**
+ * \brief Joystick axis motion event structure (event.jaxis.*)
+ */
+typedef struct SDL_JoyAxisEvent
+{
+ Uint32 type; /**< ::SDL_JOYAXISMOTION */
+ Uint8 which; /**< The joystick device index */
+ Uint8 axis; /**< The joystick axis index */
+ Uint8 padding1;
+ Uint8 padding2;
+ int value; /**< The axis value (range: -32768 to 32767) */
} SDL_JoyAxisEvent;
-/** Joystick trackball motion event structure */
-typedef struct SDL_JoyBallEvent {
- Uint8 type; /**< SDL_JOYBALLMOTION */
- Uint8 which; /**< The joystick device index */
- Uint8 ball; /**< The joystick trackball index */
- Sint16 xrel; /**< The relative motion in the X direction */
- Sint16 yrel; /**< The relative motion in the Y direction */
+/**
+ * \brief Joystick trackball motion event structure (event.jball.*)
+ */
+typedef struct SDL_JoyBallEvent
+{
+ Uint32 type; /**< ::SDL_JOYBALLMOTION */
+ Uint8 which; /**< The joystick device index */
+ Uint8 ball; /**< The joystick trackball index */
+ Uint8 padding1;
+ Uint8 padding2;
+ int xrel; /**< The relative motion in the X direction */
+ int yrel; /**< The relative motion in the Y direction */
} SDL_JoyBallEvent;
-/** Joystick hat position change event structure */
-typedef struct SDL_JoyHatEvent {
- Uint8 type; /**< SDL_JOYHATMOTION */
- Uint8 which; /**< The joystick device index */
- Uint8 hat; /**< The joystick hat index */
- Uint8 value; /**< The hat position value:
- * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
- * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
- * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
- * Note that zero means the POV is centered.
- */
+/**
+ * \brief Joystick hat position change event structure (event.jhat.*)
+ */
+typedef struct SDL_JoyHatEvent
+{
+ Uint32 type; /**< ::SDL_JOYHATMOTION */
+ Uint8 which; /**< The joystick device index */
+ Uint8 hat; /**< The joystick hat index */
+ Uint8 value; /**< The hat position value.
+ * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
+ * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
+ * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
+ *
+ * Note that zero means the POV is centered.
+ */
+ Uint8 padding1;
} SDL_JoyHatEvent;
-/** Joystick button event structure */
-typedef struct SDL_JoyButtonEvent {
- Uint8 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
- Uint8 which; /**< The joystick device index */
- Uint8 button; /**< The joystick button index */
- Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
+/**
+ * \brief Joystick button event structure (event.jbutton.*)
+ */
+typedef struct SDL_JoyButtonEvent
+{
+ Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
+ Uint8 which; /**< The joystick device index */
+ Uint8 button; /**< The joystick button index */
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
+ Uint8 padding1;
} SDL_JoyButtonEvent;
-/** The "window resized" event
- * When you get this event, you are responsible for setting a new video
- * mode with the new width and height.
+/**
+ * \brief The "quit requested" event
*/
-typedef struct SDL_ResizeEvent {
- Uint8 type; /**< SDL_VIDEORESIZE */
- int w; /**< New width */
- int h; /**< New height */
-} SDL_ResizeEvent;
-
-/** The "screen redraw" event */
-typedef struct SDL_ExposeEvent {
- Uint8 type; /**< SDL_VIDEOEXPOSE */
-} SDL_ExposeEvent;
-
-/** The "quit requested" event */
-typedef struct SDL_QuitEvent {
- Uint8 type; /**< SDL_QUIT */
+typedef struct SDL_QuitEvent
+{
+ Uint32 type; /**< ::SDL_QUIT */
} SDL_QuitEvent;
-/** A user-defined event type */
-typedef struct SDL_UserEvent {
- Uint8 type; /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */
- int code; /**< User defined event code */
- void *data1; /**< User defined data pointer */
- void *data2; /**< User defined data pointer */
+/**
+ * \brief A user-defined event type (event.user.*)
+ */
+typedef struct SDL_UserEvent
+{
+ Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
+ Uint32 windowID; /**< The associated window if any */
+ int code; /**< User defined event code */
+ void *data1; /**< User defined data pointer */
+ void *data2; /**< User defined data pointer */
} SDL_UserEvent;
-/** If you want to use this event, you should include SDL_syswm.h */
struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
-typedef struct SDL_SysWMEvent {
- Uint8 type;
- SDL_SysWMmsg *msg;
+
+/**
+ * \brief A video driver dependent system event (event.syswm.*)
+ *
+ * \note If you want to use this event, you should include SDL_syswm.h.
+ */
+typedef struct SDL_SysWMEvent
+{
+ Uint32 type; /**< ::SDL_SYSWMEVENT */
+ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
-/** General event structure */
-typedef union SDL_Event {
- Uint8 type;
- SDL_ActiveEvent active;
- SDL_KeyboardEvent key;
- SDL_MouseMotionEvent motion;
- SDL_MouseButtonEvent button;
- SDL_JoyAxisEvent jaxis;
- SDL_JoyBallEvent jball;
- SDL_JoyHatEvent jhat;
- SDL_JoyButtonEvent jbutton;
- SDL_ResizeEvent resize;
- SDL_ExposeEvent expose;
- SDL_QuitEvent quit;
- SDL_UserEvent user;
- SDL_SysWMEvent syswm;
+#ifndef SDL_NO_COMPAT
+/**
+ * \addtogroup Compatibility
+ */
+/*@{*/
+
+/**
+ * \name Typedefs for backwards compatibility
+ */
+/*@{*/
+typedef struct SDL_ActiveEvent
+{
+ Uint32 type;
+ Uint8 gain;
+ Uint8 state;
+} SDL_ActiveEvent;
+
+typedef struct SDL_ResizeEvent
+{
+ Uint32 type;
+ int w;
+ int h;
+} SDL_ResizeEvent;
+/*@}*/
+
+/*@}*//*Compatibility*/
+#endif
+
+/**
+ * \brief General event structure
+ */
+typedef union SDL_Event
+{
+ Uint32 type; /**< Event type, shared with all events */
+ SDL_WindowEvent window; /**< Window event data */
+ SDL_KeyboardEvent key; /**< Keyboard event data */
+ SDL_TextEditingEvent edit; /**< Text editing event data */
+ SDL_TextInputEvent text; /**< Text input event data */
+ SDL_MouseMotionEvent motion; /**< Mouse motion event data */
+ SDL_MouseButtonEvent button; /**< Mouse button event data */
+ SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
+ SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
+ SDL_JoyBallEvent jball; /**< Joystick ball event data */
+ SDL_JoyHatEvent jhat; /**< Joystick hat event data */
+ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
+ SDL_QuitEvent quit; /**< Quit request event data */
+ SDL_UserEvent user; /**< Custom event data */
+ SDL_SysWMEvent syswm; /**< System dependent window event data */
+
+ /** Temporarily here for backwards compatibility */
+ /*@{*/
+#ifndef SDL_NO_COMPAT
+ SDL_ActiveEvent active;
+ SDL_ResizeEvent resize;
+#endif
+ /*@}*/
} SDL_Event;
/* Function prototypes */
-/** Pumps the event loop, gathering events from the input devices.
+/**
+ * Pumps the event loop, gathering events from the input devices.
+ *
* This function updates the event queue and internal input device state.
+ *
* This should only be run in the thread that sets the video mode.
*/
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
-typedef enum {
- SDL_ADDEVENT,
- SDL_PEEKEVENT,
- SDL_GETEVENT
+/*@{*/
+typedef enum
+{
+ SDL_ADDEVENT,
+ SDL_PEEKEVENT,
+ SDL_GETEVENT
} SDL_eventaction;
/**
* Checks the event queue for messages and optionally returns them.
- *
- * If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
+ *
+ * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
* the back of the event queue.
- * If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
- * of the event queue, matching 'mask', will be returned and will not
+ *
+ * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
+ * of the event queue, matching \c mask, will be returned and will not
* be removed from the queue.
- * If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
- * of the event queue, matching 'mask', will be returned and will be
+ *
+ * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
+ * of the event queue, matching \c mask, will be returned and will be
* removed from the queue.
- *
- * @return
- * This function returns the number of events actually stored, or -1
- * if there was an error.
- *
+ *
+ * \return The number of events actually stored, or -1 if there was an error.
+ *
* This function is thread-safe.
*/
-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
- SDL_eventaction action, Uint32 mask);
+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
+ SDL_eventaction action,
+ Uint32 minType, Uint32 maxType);
+/*@}*/
-/** Polls for currently pending events, and returns 1 if there are any pending
- * events, or 0 if there are none available. If 'event' is not NULL, the next
- * event is removed from the queue and stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
-
-/** Waits indefinitely for the next available event, returning 1, or 0 if there
- * was an error while waiting for events. If 'event' is not NULL, the next
- * event is removed from the queue and stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
-
-/** Add an event to the event queue.
- * This function returns 0 on success, or -1 if the event queue was full
- * or there was some other error.
- */
-extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
-
-/** @name Event Filtering */
-/*@{*/
-typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
/**
- * This function sets up a filter to process all events before they
- * change internal state and are posted to the internal event queue.
- *
- * The filter is protypted as:
- * @code typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); @endcode
- *
- * If the filter returns 1, then the event will be added to the internal queue.
- * If it returns 0, then the event will be dropped from the queue, but the
- * internal state will still be updated. This allows selective filtering of
- * dynamically arriving events.
- *
- * @warning Be very careful of what you do in the event filter function, as
- * it may run in a different thread!
- *
- * There is one caveat when dealing with the SDL_QUITEVENT event type. The
- * event filter is only called when the window manager desires to close the
- * application window. If the event filter returns 1, then the window will
- * be closed, otherwise the window will remain open if possible.
- * If the quit event is generated by an interrupt signal, it will bypass the
- * internal queue and be delivered to the application at the next event poll.
+ * Checks to see if certain event types are in the event queue.
*/
-extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
+extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ * This function clears events from the event queue
+ */
+extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
+extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
+
+/**
+ * \brief Polls for currently pending events.
+ *
+ * \return 1 if there are any pending events, or 0 if there are none available.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
+
+/**
+ * \brief Waits indefinitely for the next available event.
+ *
+ * \return 1, or 0 if there was an error while waiting for events.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
+
+/**
+ * \brief Waits until the specified timeout (in milliseconds) for the next
+ * available event.
+ *
+ * \return 1, or 0 if there was an error while waiting for events.
+ *
+ * \param event If not NULL, the next event is removed from the queue and
+ * stored in that area.
+ */
+extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
+ int timeout);
+
+/**
+ * \brief Add an event to the event queue.
+ *
+ * \return 1 on success, 0 if the event was filtered, or -1 if the event queue
+ * was full or there was some other error.
+ */
+extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
+
+typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
+
+/**
+ * Sets up a filter to process all events before they change internal state and
+ * are posted to the internal event queue.
+ *
+ * The filter is protypted as:
+ * \code
+ * int SDL_EventFilter(void *userdata, SDL_Event * event);
+ * \endcode
+ *
+ * If the filter returns 1, then the event will be added to the internal queue.
+ * If it returns 0, then the event will be dropped from the queue, but the
+ * internal state will still be updated. This allows selective filtering of
+ * dynamically arriving events.
+ *
+ * \warning Be very careful of what you do in the event filter function, as
+ * it may run in a different thread!
+ *
+ * There is one caveat when dealing with the ::SDL_QUITEVENT event type. The
+ * event filter is only called when the window manager desires to close the
+ * application window. If the event filter returns 1, then the window will
+ * be closed, otherwise the window will remain open if possible.
+ *
+ * If the quit event is generated by an interrupt signal, it will bypass the
+ * internal queue and be delivered to the application at the next event poll.
+ */
+extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
+ void *userdata);
/**
* Return the current event filter - can be used to "chain" filters.
- * If there is no event filter set, this function returns NULL.
+ * If there is no event filter set, this function returns SDL_FALSE.
*/
-extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
-/*@}*/
+extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
+ void **userdata);
+
+/**
+ * Run the filter function on the current event queue, removing any
+ * events for which the filter returns 0.
+ */
+extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
+ void *userdata);
-/** @name Event State */
/*@{*/
#define SDL_QUERY -1
#define SDL_IGNORE 0
#define SDL_DISABLE 0
#define SDL_ENABLE 1
-/*@}*/
/**
-* This function allows you to set the state of processing certain events.
-* If 'state' is set to SDL_IGNORE, that event will be automatically dropped
-* from the event queue and will not event be filtered.
-* If 'state' is set to SDL_ENABLE, that event will be processed normally.
-* If 'state' is set to SDL_QUERY, SDL_EventState() will return the
-* current processing state of the specified event.
-*/
-extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
+ * This function allows you to set the state of processing certain events.
+ * - If \c state is set to ::SDL_IGNORE, that event will be automatically
+ * dropped from the event queue and will not event be filtered.
+ * - If \c state is set to ::SDL_ENABLE, that event will be processed
+ * normally.
+ * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
+ * current processing state of the specified event.
+ */
+extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
+/*@}*/
+#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
+
+/**
+ * This function allocates a set of user-defined events, and returns
+ * the beginning event number for that set of events.
+ *
+ * If there aren't enough user-defined events left, this function
+ * returns (Uint32)-1
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_events_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_haptic.h b/alienblaster/project/jni/sdl/include/SDL_haptic.h
new file mode 100644
index 000000000..52f33f152
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_haptic.h
@@ -0,0 +1,1123 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 2008 Edgar Simo
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/**
+ * \file SDL_haptic.h
+ *
+ * \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
+ * devices.
+ *
+ * The basic usage is as follows:
+ * - Initialize the Subsystem (::SDL_INIT_HAPTIC).
+ * - Open a Haptic Device.
+ * - SDL_HapticOpen() to open from index.
+ * - SDL_HapticOpenFromJoystick() to open from an existing joystick.
+ * - Create an effect (::SDL_HapticEffect).
+ * - Upload the effect with SDL_HapticNewEffect().
+ * - Run the effect with SDL_HapticRunEffect().
+ * - (optional) Free the effect with SDL_HapticDestroyEffect().
+ * - Close the haptic device with SDL_HapticClose().
+ *
+ * \par Example:
+ * \code
+ * int test_haptic( SDL_Joystick * joystick ) {
+ * SDL_Haptic *haptic;
+ * SDL_HapticEffect effect;
+ * int effect_id;
+ *
+ * // Open the device
+ * haptic = SDL_HapticOpenFromJoystick( joystick );
+ * if (haptic == NULL) return -1; // Most likely joystick isn't haptic
+ *
+ * // See if it can do sine waves
+ * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
+ * SDL_HapticClose(haptic); // No sine effect
+ * return -1;
+ * }
+ *
+ * // Create the effect
+ * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
+ * effect.type = SDL_HAPTIC_SINE;
+ * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
+ * effect.periodic.direction.dir[0] = 18000; // Force comes from south
+ * effect.periodic.period = 1000; // 1000 ms
+ * effect.periodic.magnitude = 20000; // 20000/32767 strength
+ * effect.periodic.length = 5000; // 5 seconds long
+ * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
+ * effect.periodic.fade_length = 1000; // Takes 1 second to fade away
+ *
+ * // Upload the effect
+ * effect_id = SDL_HapticNewEffect( haptic, &effect );
+ *
+ * // Test the effect
+ * SDL_HapticRunEffect( haptic, effect_id, 1 );
+ * SDL_Delay( 5000); // Wait for the effect to finish
+ *
+ * // We destroy the effect, although closing the device also does this
+ * SDL_HapticDestroyEffect( haptic, effect_id );
+ *
+ * // Close the device
+ * SDL_HapticClose(haptic);
+ *
+ * return 0; // Success
+ * }
+ * \endcode
+ * \author Edgar Simo Serra
+ */
+
+#ifndef _SDL_haptic_h
+#define _SDL_haptic_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_joystick.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+ /* *INDENT-ON* */
+#endif /* __cplusplus */
+
+/**
+ * \typedef SDL_Haptic
+ *
+ * \brief The haptic structure used to identify an SDL haptic.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticOpenFromJoystick
+ * \sa SDL_HapticClose
+ */
+struct _SDL_Haptic;
+typedef struct _SDL_Haptic SDL_Haptic;
+
+
+/**
+ * \name Haptic features
+ *
+ * Different haptic features a device can have.
+ */
+/*@{*/
+
+/**
+ * \name Haptic effects
+ */
+/*@{*/
+
+/**
+ * \brief Constant effect supported.
+ *
+ * Constant haptic effect.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_CONSTANT (1<<0)
+
+/**
+ * \brief Sine wave effect supported.
+ *
+ * Periodic haptic effect that simulates sine waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SINE (1<<1)
+
+/**
+ * \brief Square wave effect supported.
+ *
+ * Periodic haptic effect that simulates square waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SQUARE (1<<2)
+
+/**
+ * \brief Triangle wave effect supported.
+ *
+ * Periodic haptic effect that simulates triangular waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_TRIANGLE (1<<3)
+
+/**
+ * \brief Sawtoothup wave effect supported.
+ *
+ * Periodic haptic effect that simulates saw tooth up waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SAWTOOTHUP (1<<4)
+
+/**
+ * \brief Sawtoothdown wave effect supported.
+ *
+ * Periodic haptic effect that simulates saw tooth down waves.
+ *
+ * \sa SDL_HapticPeriodic
+ */
+#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
+
+/**
+ * \brief Ramp effect supported.
+ *
+ * Ramp haptic effect.
+ *
+ * \sa SDL_HapticRamp
+ */
+#define SDL_HAPTIC_RAMP (1<<6)
+
+/**
+ * \brief Spring effect supported - uses axes position.
+ *
+ * Condition haptic effect that simulates a spring. Effect is based on the
+ * axes position.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_SPRING (1<<7)
+
+/**
+ * \brief Damper effect supported - uses axes velocity.
+ *
+ * Condition haptic effect that simulates dampening. Effect is based on the
+ * axes velocity.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_DAMPER (1<<8)
+
+/**
+ * \brief Inertia effect supported - uses axes acceleration.
+ *
+ * Condition haptic effect that simulates inertia. Effect is based on the axes
+ * acceleration.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_INERTIA (1<<9)
+
+/**
+ * \brief Friction effect supported - uses axes movement.
+ *
+ * Condition haptic effect that simulates friction. Effect is based on the
+ * axes movement.
+ *
+ * \sa SDL_HapticCondition
+ */
+#define SDL_HAPTIC_FRICTION (1<<10)
+
+/**
+ * \brief Custom effect is supported.
+ *
+ * User defined custom haptic effect.
+ */
+#define SDL_HAPTIC_CUSTOM (1<<11)
+
+/*@}*//*Haptic effects*/
+
+/* These last few are features the device has, not effects */
+
+/**
+ * \brief Device can set global gain.
+ *
+ * Device supports setting the global gain.
+ *
+ * \sa SDL_HapticSetGain
+ */
+#define SDL_HAPTIC_GAIN (1<<12)
+
+/**
+ * \brief Device can set autocenter.
+ *
+ * Device supports setting autocenter.
+ *
+ * \sa SDL_HapticSetAutocenter
+ */
+#define SDL_HAPTIC_AUTOCENTER (1<<13)
+
+/**
+ * \brief Device can be queried for effect status.
+ *
+ * Device can be queried for effect status.
+ *
+ * \sa SDL_HapticGetEffectStatus
+ */
+#define SDL_HAPTIC_STATUS (1<<14)
+
+/**
+ * \brief Device can be paused.
+ *
+ * \sa SDL_HapticPause
+ * \sa SDL_HapticUnpause
+ */
+#define SDL_HAPTIC_PAUSE (1<<15)
+
+
+/**
+ * \name Direction encodings
+ */
+/*@{*/
+
+/**
+ * \brief Uses polar coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_POLAR 0
+
+/**
+ * \brief Uses cartesian coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_CARTESIAN 1
+
+/**
+ * \brief Uses spherical coordinates for the direction.
+ *
+ * \sa SDL_HapticDirection
+ */
+#define SDL_HAPTIC_SPHERICAL 2
+
+/*@}*//*Direction encodings*/
+
+/*@}*//*Haptic features*/
+
+/*
+ * Misc defines.
+ */
+
+/**
+ * \brief Used to play a device an infinite number of times.
+ *
+ * \sa SDL_HapticRunEffect
+ */
+#define SDL_HAPTIC_INFINITY 4294967295U
+
+
+/**
+ * \brief Structure that represents a haptic direction.
+ *
+ * Directions can be specified by:
+ * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
+ * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
+ * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
+ *
+ * Cardinal directions of the haptic device are relative to the positioning
+ * of the device. North is considered to be away from the user.
+ *
+ * The following diagram represents the cardinal directions:
+ * \verbatim
+ .--.
+ |__| .-------.
+ |=.| |.-----.|
+ |--| || ||
+ | | |'-----'|
+ |__|~')_____('
+ [ COMPUTER ]
+
+
+ North (0,-1)
+ ^
+ |
+ |
+ (1,0) West <----[ HAPTIC ]----> East (-1,0)
+ |
+ |
+ v
+ South (0,1)
+
+
+ [ USER ]
+ \|||/
+ (o o)
+ ---ooO-(_)-Ooo---
+ \endverbatim
+ *
+ * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
+ * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
+ * the first \c dir parameter. The cardinal directions would be:
+ * - North: 0 (0 degrees)
+ * - East: 9000 (90 degrees)
+ * - South: 18000 (180 degrees)
+ * - West: 27000 (270 degrees)
+ *
+ * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
+ * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
+ * the first three \c dir parameters. The cardinal directions would be:
+ * - North: 0,-1, 0
+ * - East: -1, 0, 0
+ * - South: 0, 1, 0
+ * - West: 1, 0, 0
+ *
+ * The Z axis represents the height of the effect if supported, otherwise
+ * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
+ * can use any multiple you want, only the direction matters.
+ *
+ * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
+ * The first two \c dir parameters are used. The \c dir parameters are as
+ * follows (all values are in hundredths of degrees):
+ * - Degrees from (1, 0) rotated towards (0, 1).
+ * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
+ *
+ *
+ * Example of force coming from the south with all encodings (force coming
+ * from the south means the user will have to pull the stick to counteract):
+ * \code
+ * SDL_HapticDirection direction;
+ *
+ * // Cartesian directions
+ * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
+ * direction.dir[0] = 0; // X position
+ * direction.dir[1] = 1; // Y position
+ * // Assuming the device has 2 axes, we don't need to specify third parameter.
+ *
+ * // Polar directions
+ * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
+ * direction.dir[0] = 18000; // Polar only uses first parameter
+ *
+ * // Spherical coordinates
+ * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
+ * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
+ * \endcode
+ *
+ * \sa SDL_HAPTIC_POLAR
+ * \sa SDL_HAPTIC_CARTESIAN
+ * \sa SDL_HAPTIC_SPHERICAL
+ * \sa SDL_HapticEffect
+ * \sa SDL_HapticNumAxes
+ */
+typedef struct SDL_HapticDirection
+{
+ Uint8 type; /**< The type of encoding. */
+ Sint32 dir[3]; /**< The encoded direction. */
+} SDL_HapticDirection;
+
+
+/**
+ * \brief A structure containing a template for a Constant effect.
+ *
+ * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
+ *
+ * A constant effect applies a constant force in the specified direction
+ * to the joystick.
+ *
+ * \sa SDL_HAPTIC_CONSTANT
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticConstant
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Constant */
+ Sint16 level; /**< Strength of the constant effect. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticConstant;
+
+/**
+ * \brief A structure containing a template for a Periodic effect.
+ *
+ * The struct handles the following effects:
+ * - ::SDL_HAPTIC_SINE
+ * - ::SDL_HAPTIC_SQUARE
+ * - ::SDL_HAPTIC_TRIANGLE
+ * - ::SDL_HAPTIC_SAWTOOTHUP
+ * - ::SDL_HAPTIC_SAWTOOTHDOWN
+ *
+ * A periodic effect consists in a wave-shaped effect that repeats itself
+ * over time. The type determines the shape of the wave and the parameters
+ * determine the dimensions of the wave.
+ *
+ * Phase is given by hundredth of a cyle meaning that giving the phase a value
+ * of 9000 will displace it 25% of it's period. Here are sample values:
+ * - 0: No phase displacement.
+ * - 9000: Displaced 25% of it's period.
+ * - 18000: Displaced 50% of it's period.
+ * - 27000: Displaced 75% of it's period.
+ * - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered.
+ *
+ * Examples:
+ * \verbatim
+ SDL_HAPTIC_SINE
+ __ __ __ __
+ / \ / \ / \ /
+ / \__/ \__/ \__/
+
+ SDL_HAPTIC_SQUARE
+ __ __ __ __ __
+ | | | | | | | | | |
+ | |__| |__| |__| |__| |
+
+ SDL_HAPTIC_TRIANGLE
+ /\ /\ /\ /\ /\
+ / \ / \ / \ / \ /
+ / \/ \/ \/ \/
+
+ SDL_HAPTIC_SAWTOOTHUP
+ /| /| /| /| /| /| /|
+ / | / | / | / | / | / | / |
+ / |/ |/ |/ |/ |/ |/ |
+
+ SDL_HAPTIC_SAWTOOTHDOWN
+ \ |\ |\ |\ |\ |\ |\ |
+ \ | \ | \ | \ | \ | \ | \ |
+ \| \| \| \| \| \| \|
+ \endverbatim
+ *
+ * \sa SDL_HAPTIC_SINE
+ * \sa SDL_HAPTIC_SQUARE
+ * \sa SDL_HAPTIC_TRIANGLE
+ * \sa SDL_HAPTIC_SAWTOOTHUP
+ * \sa SDL_HAPTIC_SAWTOOTHDOWN
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticPeriodic
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_SQUARE,
+ ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
+ ::SDL_HAPTIC_SAWTOOTHDOWN */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Periodic */
+ Uint16 period; /**< Period of the wave. */
+ Sint16 magnitude; /**< Peak value. */
+ Sint16 offset; /**< Mean value of the wave. */
+ Uint16 phase; /**< Horizontal shift given by hundredth of a cycle. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticPeriodic;
+
+/**
+ * \brief A structure containing a template for a Condition effect.
+ *
+ * The struct handles the following effects:
+ * - ::SDL_HAPTIC_SPRING: Effect based on axes position.
+ * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
+ * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
+ * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
+ *
+ * Direction is handled by condition internals instead of a direction member.
+ * The condition effect specific members have three parameters. The first
+ * refers to the X axis, the second refers to the Y axis and the third
+ * refers to the Z axis. The right terms refer to the positive side of the
+ * axis and the left terms refer to the negative side of the axis. Please
+ * refer to the ::SDL_HapticDirection diagram for which side is positive and
+ * which is negative.
+ *
+ * \sa SDL_HapticDirection
+ * \sa SDL_HAPTIC_SPRING
+ * \sa SDL_HAPTIC_DAMPER
+ * \sa SDL_HAPTIC_INERTIA
+ * \sa SDL_HAPTIC_FRICTION
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticCondition
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
+ ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
+ SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Condition */
+ Uint16 right_sat[3]; /**< Level when joystick is to the positive side. */
+ Uint16 left_sat[3]; /**< Level when joystick is to the negative side. */
+ Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */
+ Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */
+ Uint16 deadband[3]; /**< Size of the dead zone. */
+ Sint16 center[3]; /**< Position of the dead zone. */
+} SDL_HapticCondition;
+
+/**
+ * \brief A structure containing a template for a Ramp effect.
+ *
+ * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
+ *
+ * The ramp effect starts at start strength and ends at end strength.
+ * It augments in linear fashion. If you use attack and fade with a ramp
+ * they effects get added to the ramp effect making the effect become
+ * quadratic instead of linear.
+ *
+ * \sa SDL_HAPTIC_RAMP
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticRamp
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_RAMP */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Ramp */
+ Sint16 start; /**< Beginning strength level. */
+ Sint16 end; /**< Ending strength level. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticRamp;
+
+/**
+ * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
+ *
+ * A custom force feedback effect is much like a periodic effect, where the
+ * application can define it's exact shape. You will have to allocate the
+ * data yourself. Data should consist of channels * samples Uint16 samples.
+ *
+ * If channels is one, the effect is rotated using the defined direction.
+ * Otherwise it uses the samples in data for the different axes.
+ *
+ * \sa SDL_HAPTIC_CUSTOM
+ * \sa SDL_HapticEffect
+ */
+typedef struct SDL_HapticCustom
+{
+ /* Header */
+ Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */
+ SDL_HapticDirection direction; /**< Direction of the effect. */
+
+ /* Replay */
+ Uint32 length; /**< Duration of the effect. */
+ Uint16 delay; /**< Delay before starting the effect. */
+
+ /* Trigger */
+ Uint16 button; /**< Button that triggers the effect. */
+ Uint16 interval; /**< How soon it can be triggered again after button. */
+
+ /* Custom */
+ Uint8 channels; /**< Axes to use, minimum of one. */
+ Uint16 period; /**< Sample periods. */
+ Uint16 samples; /**< Amount of samples. */
+ Uint16 *data; /**< Should contain channels*samples items. */
+
+ /* Envelope */
+ Uint16 attack_length; /**< Duration of the attack. */
+ Uint16 attack_level; /**< Level at the start of the attack. */
+ Uint16 fade_length; /**< Duration of the fade. */
+ Uint16 fade_level; /**< Level at the end of the fade. */
+} SDL_HapticCustom;
+
+/**
+ * \brief The generic template for any haptic effect.
+ *
+ * All values max at 32767 (0x7FFF). Signed values also can be negative.
+ * Time values unless specified otherwise are in milliseconds.
+ *
+ * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
+ * value. Neither delay, interval, attack_length nor fade_length support
+ * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
+ *
+ * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
+ * ::SDL_HAPTIC_INFINITY.
+ *
+ * Button triggers may not be supported on all devices, it is advised to not
+ * use them if possible. Buttons start at index 1 instead of index 0 like
+ * they joystick.
+ *
+ * If both attack_length and fade_level are 0, the envelope is not used,
+ * otherwise both values are used.
+ *
+ * Common parts:
+ * \code
+ * // Replay - All effects have this
+ * Uint32 length; // Duration of effect (ms).
+ * Uint16 delay; // Delay before starting effect.
+ *
+ * // Trigger - All effects have this
+ * Uint16 button; // Button that triggers effect.
+ * Uint16 interval; // How soon before effect can be triggered again.
+ *
+ * // Envelope - All effects except condition effects have this
+ * Uint16 attack_length; // Duration of the attack (ms).
+ * Uint16 attack_level; // Level at the start of the attack.
+ * Uint16 fade_length; // Duration of the fade out (ms).
+ * Uint16 fade_level; // Level at the end of the fade.
+ * \endcode
+ *
+ *
+ * Here we have an example of a constant effect evolution in time:
+ * \verbatim
+ Strength
+ ^
+ |
+ | effect level --> _________________
+ | / \
+ | / \
+ | / \
+ | / \
+ | attack_level --> | \
+ | | | <--- fade_level
+ |
+ +--------------------------------------------------> Time
+ [--] [---]
+ attack_length fade_length
+
+ [------------------][-----------------------]
+ delay length
+ \endverbatim
+ *
+ * Note either the attack_level or the fade_level may be above the actual
+ * effect level.
+ *
+ * \sa SDL_HapticConstant
+ * \sa SDL_HapticPeriodic
+ * \sa SDL_HapticCondition
+ * \sa SDL_HapticRamp
+ * \sa SDL_HapticCustom
+ */
+typedef union SDL_HapticEffect
+{
+ /* Common for all force feedback effects */
+ Uint16 type; /**< Effect type. */
+ SDL_HapticConstant constant; /**< Constant effect. */
+ SDL_HapticPeriodic periodic; /**< Periodic effect. */
+ SDL_HapticCondition condition; /**< Condition effect. */
+ SDL_HapticRamp ramp; /**< Ramp effect. */
+ SDL_HapticCustom custom; /**< Custom effect. */
+} SDL_HapticEffect;
+
+
+/* Function prototypes */
+/**
+ * \brief Count the number of joysticks attached to the system.
+ *
+ * \return Number of haptic devices detected on the system.
+ */
+extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
+
+/**
+ * \brief Get the implementation dependent name of a Haptic device.
+ *
+ * This can be called before any joysticks are opened.
+ * If no name can be found, this function returns NULL.
+ *
+ * \param device_index Index of the device to get it's name.
+ * \return Name of the device or NULL on error.
+ *
+ * \sa SDL_NumHaptics
+ */
+extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
+
+/**
+ * \brief Opens a Haptic device for usage.
+ *
+ * The index passed as an argument refers to the N'th Haptic device on this
+ * system.
+ *
+ * When opening a haptic device, it's gain will be set to maximum and
+ * autocenter will be disabled. To modify these values use
+ * SDL_HapticSetGain() and SDL_HapticSetAutocenter().
+ *
+ * \param device_index Index of the device to open.
+ * \return Device identifier or NULL on error.
+ *
+ * \sa SDL_HapticIndex
+ * \sa SDL_HapticOpenFromMouse
+ * \sa SDL_HapticOpenFromJoystick
+ * \sa SDL_HapticClose
+ * \sa SDL_HapticSetGain
+ * \sa SDL_HapticSetAutocenter
+ * \sa SDL_HapticPause
+ * \sa SDL_HapticStopAll
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
+
+/**
+ * \brief Checks if the haptic device at index has been opened.
+ *
+ * \param device_index Index to check to see if it has been opened.
+ * \return 1 if it has been opened or 0 if it hasn't.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticIndex
+ */
+extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
+
+/**
+ * \brief Gets the index of a haptic device.
+ *
+ * \param haptic Haptic device to get the index of.
+ * \return The index of the haptic device or -1 on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticOpened
+ */
+extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
+
+/**
+ * \brief Gets whether or not the current mouse has haptic capabilities.
+ *
+ * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
+ *
+ * \sa SDL_HapticOpenFromMouse
+ */
+extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
+
+/**
+ * \brief Tries to open a haptic device from the current mouse.
+ *
+ * \return The haptic device identifier or NULL on error.
+ *
+ * \sa SDL_MouseIsHaptic
+ * \sa SDL_HapticOpen
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
+
+/**
+ * \brief Checks to see if a joystick has haptic features.
+ *
+ * \param joystick Joystick to test for haptic capabilities.
+ * \return 1 if the joystick is haptic, 0 if it isn't
+ * or -1 if an error ocurred.
+ *
+ * \sa SDL_HapticOpenFromJoystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
+
+/**
+ * \brief Opens a Haptic device for usage from a Joystick device.
+ *
+ * You must still close the haptic device seperately. It will not be closed
+ * with the joystick.
+ *
+ * When opening from a joystick you should first close the haptic device before
+ * closing the joystick device. If not, on some implementations the haptic
+ * device will also get unallocated and you'll be unable to use force feedback
+ * on that device.
+ *
+ * \param joystick Joystick to create a haptic device from.
+ * \return A valid haptic device identifier on success or NULL on error.
+ *
+ * \sa SDL_HapticOpen
+ * \sa SDL_HapticClose
+ */
+extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
+ joystick);
+
+/**
+ * \brief Closes a Haptic device previously opened with SDL_HapticOpen().
+ *
+ * \param haptic Haptic device to close.
+ */
+extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
+
+/**
+ * \brief Returns the number of effects a haptic device can store.
+ *
+ * On some platforms this isn't fully supported, and therefore is an
+ * aproximation. Always check to see if your created effect was actually
+ * created and do not rely solely on SDL_HapticNumEffects().
+ *
+ * \param haptic The haptic device to query effect max.
+ * \return The number of effects the haptic device can store or
+ * -1 on error.
+ *
+ * \sa SDL_HapticNumEffectsPlaying
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
+
+/**
+ * \brief Returns the number of effects a haptic device can play at the same
+ * time.
+ *
+ * This is not supported on all platforms, but will always return a value.
+ * Added here for the sake of completness.
+ *
+ * \param haptic The haptic device to query maximum playing effects.
+ * \return The number of effects the haptic device can play at the same time
+ * or -1 on error.
+ *
+ * \sa SDL_HapticNumEffects
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
+
+/**
+ * \brief Gets the haptic devices supported features in bitwise matter.
+ *
+ * Example:
+ * \code
+ * if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) {
+ * printf("We have constant haptic effect!");
+ * }
+ * \endcode
+ *
+ * \param haptic The haptic device to query.
+ * \return Haptic features in bitwise manner (OR'd).
+ *
+ * \sa SDL_HapticNumEffects
+ * \sa SDL_HapticEffectSupported
+ */
+extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
+
+
+/**
+ * \brief Gets the number of haptic axes the device has.
+ *
+ * \sa SDL_HapticDirection
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
+
+/**
+ * \brief Checks to see if effect is supported by haptic.
+ *
+ * \param haptic Haptic device to check on.
+ * \param effect Effect to check to see if it is supported.
+ * \return 1 if effect is supported, 0 if it isn't or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ * \sa SDL_HapticNewEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
+ SDL_HapticEffect *
+ effect);
+
+/**
+ * \brief Creates a new haptic effect on the device.
+ *
+ * \param haptic Haptic device to create the effect on.
+ * \param effect Properties of the effect to create.
+ * \return The id of the effect on success or -1 on error.
+ *
+ * \sa SDL_HapticUpdateEffect
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
+ SDL_HapticEffect * effect);
+
+/**
+ * \brief Updates the properties of an effect.
+ *
+ * Can be used dynamically, although behaviour when dynamically changing
+ * direction may be strange. Specifically the effect may reupload itself
+ * and start playing from the start. You cannot change the type either when
+ * running SDL_HapticUpdateEffect().
+ *
+ * \param haptic Haptic device that has the effect.
+ * \param effect Effect to update.
+ * \param data New effect properties to use.
+ * \return The id of the effect on success or -1 on error.
+ *
+ * \sa SDL_HapticNewEffect
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
+ int effect,
+ SDL_HapticEffect * data);
+
+/**
+ * \brief Runs the haptic effect on it's assosciated haptic device.
+ *
+ * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
+ * repeating the envelope (attack and fade) every time. If you only want the
+ * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
+ * parameter.
+ *
+ * \param haptic Haptic device to run the effect on.
+ * \param effect Identifier of the haptic effect to run.
+ * \param iterations Number of iterations to run the effect. Use
+ * ::SDL_HAPTIC_INFINITY for infinity.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticStopEffect
+ * \sa SDL_HapticDestroyEffect
+ * \sa SDL_HapticGetEffectStatus
+ */
+extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
+ int effect,
+ Uint32 iterations);
+
+/**
+ * \brief Stops the haptic effect on it's assosciated haptic device.
+ *
+ * \param haptic Haptic device to stop the effect on.
+ * \param effect Identifier of the effect to stop.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticDestroyEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Destroys a haptic effect on the device.
+ *
+ * This will stop the effect if it's running. Effects are automatically
+ * destroyed when the device is closed.
+ *
+ * \param haptic Device to destroy the effect on.
+ * \param effect Identifier of the effect to destroy.
+ *
+ * \sa SDL_HapticNewEffect
+ */
+extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Gets the status of the current effect on the haptic device.
+ *
+ * Device must support the ::SDL_HAPTIC_STATUS feature.
+ *
+ * \param haptic Haptic device to query the effect status on.
+ * \param effect Identifier of the effect to query it's status.
+ * \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing
+ * or -1 on error.
+ *
+ * \sa SDL_HapticRunEffect
+ * \sa SDL_HapticStopEffect
+ */
+extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
+ int effect);
+
+/**
+ * \brief Sets the global gain of the device.
+ *
+ * Device must support the ::SDL_HAPTIC_GAIN feature.
+ *
+ * The user may specify the maxmimum gain by setting the environment variable
+ * ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
+ * SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the
+ * maximum.
+ *
+ * \param haptic Haptic device to set the gain on.
+ * \param gain Value to set the gain to, should be between 0 and 100.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
+
+/**
+ * \brief Sets the global autocenter of the device.
+ *
+ * Autocenter should be between 0 and 100. Setting it to 0 will disable
+ * autocentering.
+ *
+ * Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
+ *
+ * \param haptic Haptic device to set autocentering on.
+ * \param autocenter Value to set autocenter to, 0 disables autocentering.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticQuery
+ */
+extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
+ int autocenter);
+
+/**
+ * \brief Pauses a haptic device.
+ *
+ * Device must support the ::SDL_HAPTIC_PAUSE feature. Call
+ * SDL_HapticUnpause() to resume playback.
+ *
+ * Do not modify the effects nor add new ones while the device is paused.
+ * That can cause all sorts of weird errors.
+ *
+ * \param haptic Haptic device to pause.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticUnpause
+ */
+extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
+
+/**
+ * \brief Unpauses a haptic device.
+ *
+ * Call to unpause after SDL_HapticPause().
+ *
+ * \param haptic Haptic device to pause.
+ * \return 0 on success or -1 on error.
+ *
+ * \sa SDL_HapticPause
+ */
+extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
+
+/**
+ * \brief Stops all the currently playing effects on a haptic device.
+ *
+ * \param haptic Haptic device to stop.
+ * \return 0 on success or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_haptic_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_input.h b/alienblaster/project/jni/sdl/include/SDL_input.h
new file mode 100644
index 000000000..455138f1b
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_input.h
@@ -0,0 +1,88 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/**
+ * \file SDL_input.h
+ *
+ * Include file for lowlevel SDL input device handling.
+ *
+ * This talks about individual devices, and not the system cursor. If you
+ * just want to know when the user moves the pointer somewhere in your
+ * window, this is NOT the API you want. This one handles things like
+ * multi-touch, drawing tablets, and multiple, separate mice.
+ *
+ * The other API is in SDL_mouse.h
+ */
+
+#ifndef _SDL_input_h
+#define _SDL_input_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+
+/* Function prototypes */
+
+/* !!! FIXME: real documentation
+ * - Redetect devices
+ * - This invalidates all existing device information from previous queries!
+ * - There is an implicit (re)detect upon SDL_Init().
+ */
+extern DECLSPEC int SDLCALL SDL_RedetectInputDevices(void);
+
+/**
+ * \brief Get the number of mouse input devices available.
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumInputDevices(void);
+
+/**
+ * \brief Gets the name of a device with the given index.
+ *
+ * \param index is the index of the device, whose name is to be returned.
+ *
+ * \return the name of the device with the specified index
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetInputDeviceName(int index);
+
+
+extern DECLSPEC int SDLCALL SDL_IsDeviceDisconnected(int index);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_mouse_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_joystick.h b/alienblaster/project/jni/sdl/include/SDL_joystick.h
index d5135c3d5..2e70862ff 100644
--- a/alienblaster/project/jni/sdl/include/SDL_joystick.h
+++ b/alienblaster/project/jni/sdl/include/SDL_joystick.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,9 @@
slouken@libsdl.org
*/
-/** @file SDL_joystick.h
+/**
+ * \file SDL_joystick.h
+ *
* Include file for SDL joystick event handling
*/
@@ -33,109 +35,111 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** @file SDL_joystick.h
- * @note In order to use these functions, SDL_Init() must have been called
- * with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
- * for joysticks, and load appropriate drivers.
+/**
+ * \file SDL_joystick.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
+ * for joysticks, and load appropriate drivers.
*/
-/** The joystick structure used to identify an SDL joystick */
+/* The joystick structure used to identify an SDL joystick */
struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick;
+
/* Function prototypes */
/**
- * Count the number of joysticks attached to the system
+ * Count the number of joysticks attached to the system
*/
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
/**
- * Get the implementation dependent name of a joystick.
- *
- * This can be called before any joysticks are opened.
- * If no name can be found, this function returns NULL.
+ * Get the implementation dependent name of a joystick.
+ * This can be called before any joysticks are opened.
+ * If no name can be found, this function returns NULL.
*/
-extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index);
+extern DECLSPEC const char *SDLCALL SDL_JoystickName(int device_index);
/**
- * Open a joystick for use.
- *
- * @param[in] device_index
- * The index passed as an argument refers to
- * the N'th joystick on the system. This index is the value which will
- * identify this joystick in future joystick events.
- *
- * @return This function returns a joystick identifier, or NULL if an error occurred.
+ * Open a joystick for use.
+ * The index passed as an argument refers tothe N'th joystick on the system.
+ * This index is the value which will identify this joystick in future joystick
+ * events.
+ *
+ * \return A joystick identifier, or NULL if an error occurred.
*/
-extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index);
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
/**
- * Returns 1 if the joystick has been opened, or 0 if it has not.
+ * Returns 1 if the joystick has been opened, or 0 if it has not.
*/
extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
/**
- * Get the device index of an opened joystick.
+ * Get the device index of an opened joystick.
*/
-extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
+extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick * joystick);
/**
- * Get the number of general axis controls on a joystick
+ * Get the number of general axis controls on a joystick.
*/
-extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
+extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
/**
- * Get the number of trackballs on a joystick
- *
- * Joystick trackballs have only relative motion events associated
- * with them and their state cannot be polled.
+ * Get the number of trackballs on a joystick.
+ *
+ * Joystick trackballs have only relative motion events associated
+ * with them and their state cannot be polled.
*/
-extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
+extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick);
/**
- * Get the number of POV hats on a joystick
+ * Get the number of POV hats on a joystick.
*/
-extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
+extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick);
/**
- * Get the number of buttons on a joystick
+ * Get the number of buttons on a joystick.
*/
-extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
+extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick);
/**
- * Update the current state of the open joysticks.
- *
- * This is called automatically by the event loop if any joystick
- * events are enabled.
+ * Update the current state of the open joysticks.
+ *
+ * This is called automatically by the event loop if any joystick
+ * events are enabled.
*/
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
/**
- * Enable/disable joystick event polling.
- *
- * If joystick events are disabled, you must call SDL_JoystickUpdate()
- * yourself and check the state of the joystick when you want joystick
- * information.
- *
- * @param[in] state The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
+ * Enable/disable joystick event polling.
+ *
+ * If joystick events are disabled, you must call SDL_JoystickUpdate()
+ * yourself and check the state of the joystick when you want joystick
+ * information.
+ *
+ * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
*/
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
/**
- * Get the current state of an axis control on a joystick
- *
- * @param[in] axis The axis indices start at index 0.
- *
- * @return The state is a value ranging from -32768 to 32767.
+ * Get the current state of an axis control on a joystick.
+ *
+ * The state is a value ranging from -32768 to 32767.
+ *
+ * The axis indices start at index 0.
*/
-extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
+extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
+ int axis);
/**
- * @name Hat Positions
- * The return value of SDL_JoystickGetHat() is one of the following positions:
+ * \name Hat positions
*/
/*@{*/
#define SDL_HAT_CENTERED 0x00
@@ -149,39 +153,57 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int a
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
/*@}*/
-/**
- * Get the current state of a POV hat on a joystick
+/**
+ * Get the current state of a POV hat on a joystick.
*
- * @param[in] hat The hat indices start at index 0.
+ * The hat indices start at index 0.
+ *
+ * \return The return value is one of the following positions:
+ * - ::SDL_HAT_CENTERED
+ * - ::SDL_HAT_UP
+ * - ::SDL_HAT_RIGHT
+ * - ::SDL_HAT_DOWN
+ * - ::SDL_HAT_LEFT
+ * - ::SDL_HAT_RIGHTUP
+ * - ::SDL_HAT_RIGHTDOWN
+ * - ::SDL_HAT_LEFTUP
+ * - ::SDL_HAT_LEFTDOWN
*/
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
+extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
+ int hat);
/**
- * Get the ball axis change since the last poll
- *
- * @param[in] ball The ball indices start at index 0.
- *
- * @return This returns 0, or -1 if you passed it invalid parameters.
+ * Get the ball axis change since the last poll.
+ *
+ * \return 0, or -1 if you passed it invalid parameters.
+ *
+ * The ball indices start at index 0.
*/
-extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
+extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
+ int ball, int *dx, int *dy);
/**
- * Get the current state of a button on a joystick
- *
- * @param[in] button The button indices start at index 0.
+ * Get the current state of a button on a joystick.
+ *
+ * The button indices start at index 0.
*/
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
+extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
+ int button);
/**
- * Close a joystick previously opened with SDL_JoystickOpen()
+ * Close a joystick previously opened with SDL_JoystickOpen().
*/
-extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
+extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_joystick_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_keyboard.h b/alienblaster/project/jni/sdl/include/SDL_keyboard.h
index 7b59d24e5..4482ac028 100644
--- a/alienblaster/project/jni/sdl/include/SDL_keyboard.h
+++ b/alienblaster/project/jni/sdl/include/SDL_keyboard.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,9 @@
slouken@libsdl.org
*/
-/** @file SDL_keyboard.h
+/**
+ * \file SDL_keyboard.h
+ *
* Include file for SDL keyboard event handling
*/
@@ -30,106 +32,139 @@
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_keysym.h"
+#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** Keysym structure
- *
- * - The scancode is hardware dependent, and should not be used by general
- * applications. If no hardware scancode is available, it will be 0.
- *
- * - The 'unicode' translated character is only available when character
- * translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
- * this is a UNICODE character corresponding to the keypress. If the
- * high 9 bits of the character are 0, then this maps to the equivalent
- * ASCII character:
- * @code
- * char ch;
- * if ( (keysym.unicode & 0xFF80) == 0 ) {
- * ch = keysym.unicode & 0x7F;
- * } else {
- * An international character..
- * }
- * @endcode
+/**
+ * \brief The SDL keysym structure, used in key events.
*/
-typedef struct SDL_keysym {
- Uint8 scancode; /**< hardware specific scancode */
- SDLKey sym; /**< SDL virtual keysym */
- SDLMod mod; /**< current key modifiers */
- Uint16 unicode; /**< translated character */
+typedef struct SDL_keysym
+{
+ SDL_scancode scancode; /**< SDL physical key code - see ::SDL_scancode for details */
+ SDLKey sym; /**< SDL virtual key code - see ::SDLKey for details */
+ Uint16 mod; /**< current key modifiers */
+ Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */
} SDL_keysym;
-/** This is the mask which refers to all hotkey bindings */
-#define SDL_ALL_HOTKEYS 0xFFFFFFFF
-
/* Function prototypes */
-/**
- * Enable/Disable UNICODE translation of keyboard input.
- *
- * This translation has some overhead, so translation defaults off.
- *
- * @param[in] enable
- * If 'enable' is 1, translation is enabled.
- * If 'enable' is 0, translation is disabled.
- * If 'enable' is -1, the translation state is not changed.
- *
- * @return It returns the previous state of keyboard translation.
- */
-extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
-
-#define SDL_DEFAULT_REPEAT_DELAY 500
-#define SDL_DEFAULT_REPEAT_INTERVAL 30
-/**
- * Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
- *
- * @param[in] delay
- * 'delay' is the initial delay in ms between the time when a key is
- * pressed, and keyboard repeat begins.
- *
- * @param[in] interval
- * 'interval' is the time in ms between keyboard repeat events.
- *
- * If 'delay' is set to 0, keyboard repeat is disabled.
- */
-extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
-extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
/**
- * Get a snapshot of the current state of the keyboard.
- * Returns an array of keystates, indexed by the SDLK_* syms.
- * Usage:
- * @code
- * Uint8 *keystate = SDL_GetKeyState(NULL);
- * if ( keystate[SDLK_RETURN] ) //... \ is pressed.
- * @endcode
+ * \brief Get the window which currently has keyboard focus.
*/
-extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
/**
- * Get the current key modifier state
+ * \brief Get a snapshot of the current state of the keyboard.
+ *
+ * \param numkeys if non-NULL, receives the length of the returned array.
+ *
+ * \return An array of key states. Indexes into this array are obtained by using ::SDL_scancode values.
+ *
+ * \b Example:
+ * \code
+ * Uint8 *state = SDL_GetKeyboardState(NULL);
+ * if ( state[SDL_SCANCODE_RETURN] ) {
+ * printf(" is pressed.\n");
+ * }
+ * \endcode
+ */
+extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
+
+/**
+ * \brief Get the current key modifier state for the keyboard.
*/
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
/**
- * Set the current key modifier state.
- * This does not change the keyboard state, only the key modifier flags.
+ * \brief Set the current key modifier state for the keyboard.
+ *
+ * \note This does not change the keyboard state, only the key modifier flags.
*/
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
/**
- * Get the name of an SDL virtual keysym
+ * \brief Get the key code corresponding to the given scancode according
+ * to the current keyboard layout.
+ *
+ * See ::SDLKey for details.
+ *
+ * \sa SDL_GetKeyName()
*/
-extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
+extern DECLSPEC SDLKey SDLCALL SDL_GetKeyFromScancode(SDL_scancode scancode);
+
+/**
+ * \brief Get the scancode corresponding to the given key code according to the
+ * current keyboard layout.
+ *
+ * See ::SDL_scancode for details.
+ *
+ * \sa SDL_GetScancodeName()
+ */
+extern DECLSPEC SDL_scancode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
+
+/**
+ * \brief Get a human-readable name for a scancode.
+ *
+ * \return A pointer to a UTF-8 string that stays valid at least until the next
+ * call to this function. If you need it around any longer, you must
+ * copy it. If the scancode doesn't have a name, this function returns
+ * an empty string ("").
+ *
+ * \sa SDL_scancode
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_scancode
+ scancode);
+
+/**
+ * \brief Get a human-readable name for a key.
+ *
+ * \return A pointer to a UTF-8 string that stays valid at least until the next
+ * call to this function. If you need it around any longer, you must
+ * copy it. If the key doesn't have a name, this function returns an
+ * empty string ("").
+ *
+ * \sa SDLKey
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
+
+/**
+ * \brief Start accepting Unicode text input events.
+ *
+ * \sa SDL_StopTextInput()
+ * \sa SDL_SetTextInputRect()
+ */
+extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
+
+/**
+ * \brief Stop receiving any text input events.
+ *
+ * \sa SDL_StartTextInput()
+ */
+extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
+
+/**
+ * \brief Set the rectangle used to type Unicode text inputs.
+ *
+ * \sa SDL_StartTextInput()
+ */
+extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_keyboard_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_keysym.h b/alienblaster/project/jni/sdl/include/SDL_keysym.h
index 90101286e..77ff77281 100644
--- a/alienblaster/project/jni/sdl/include/SDL_keysym.h
+++ b/alienblaster/project/jni/sdl/include/SDL_keysym.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,307 +20,323 @@
slouken@libsdl.org
*/
+/**
+ * \file SDL_keysym.h
+ *
+ * Defines constants which identify keyboard keys and modifiers.
+ */
+
#ifndef _SDL_keysym_h
#define _SDL_keysym_h
-/** What we really want is a mapping of every raw key on the keyboard.
- * To support international keyboards, we use the range 0xA1 - 0xFF
- * as international virtual keycodes. We'll follow in the footsteps of X11...
- * @brief The names of the keys
+#include "SDL_stdinc.h"
+#include "SDL_scancode.h"
+
+/**
+ * \brief The SDL virtual key representation.
+ *
+ * Values of this type are used to represent keyboard keys using the current
+ * layout of the keyboard. These values include Unicode values representing
+ * the unmodified character that would be generated by pressing the key, or
+ * an SDLK_* constant for those keys that do not generate characters.
*/
-typedef enum {
- /** @name ASCII mapped keysyms
- * The keyboard syms have been cleverly chosen to map to ASCII
- */
- /*@{*/
- SDLK_UNKNOWN = 0,
- SDLK_FIRST = 0,
- SDLK_BACKSPACE = 8,
- SDLK_TAB = 9,
- SDLK_CLEAR = 12,
- SDLK_RETURN = 13,
- SDLK_PAUSE = 19,
- SDLK_ESCAPE = 27,
- SDLK_SPACE = 32,
- SDLK_EXCLAIM = 33,
- SDLK_QUOTEDBL = 34,
- SDLK_HASH = 35,
- SDLK_DOLLAR = 36,
- SDLK_AMPERSAND = 38,
- SDLK_QUOTE = 39,
- SDLK_LEFTPAREN = 40,
- SDLK_RIGHTPAREN = 41,
- SDLK_ASTERISK = 42,
- SDLK_PLUS = 43,
- SDLK_COMMA = 44,
- SDLK_MINUS = 45,
- SDLK_PERIOD = 46,
- SDLK_SLASH = 47,
- SDLK_0 = 48,
- SDLK_1 = 49,
- SDLK_2 = 50,
- SDLK_3 = 51,
- SDLK_4 = 52,
- SDLK_5 = 53,
- SDLK_6 = 54,
- SDLK_7 = 55,
- SDLK_8 = 56,
- SDLK_9 = 57,
- SDLK_COLON = 58,
- SDLK_SEMICOLON = 59,
- SDLK_LESS = 60,
- SDLK_EQUALS = 61,
- SDLK_GREATER = 62,
- SDLK_QUESTION = 63,
- SDLK_AT = 64,
- /*
- Skip uppercase letters
- */
- SDLK_LEFTBRACKET = 91,
- SDLK_BACKSLASH = 92,
- SDLK_RIGHTBRACKET = 93,
- SDLK_CARET = 94,
- SDLK_UNDERSCORE = 95,
- SDLK_BACKQUOTE = 96,
- SDLK_a = 97,
- SDLK_b = 98,
- SDLK_c = 99,
- SDLK_d = 100,
- SDLK_e = 101,
- SDLK_f = 102,
- SDLK_g = 103,
- SDLK_h = 104,
- SDLK_i = 105,
- SDLK_j = 106,
- SDLK_k = 107,
- SDLK_l = 108,
- SDLK_m = 109,
- SDLK_n = 110,
- SDLK_o = 111,
- SDLK_p = 112,
- SDLK_q = 113,
- SDLK_r = 114,
- SDLK_s = 115,
- SDLK_t = 116,
- SDLK_u = 117,
- SDLK_v = 118,
- SDLK_w = 119,
- SDLK_x = 120,
- SDLK_y = 121,
- SDLK_z = 122,
- SDLK_DELETE = 127,
- /* End of ASCII mapped keysyms */
- /*@}*/
+typedef Sint32 SDLKey;
- /** @name International keyboard syms */
- /*@{*/
- SDLK_WORLD_0 = 160, /* 0xA0 */
- SDLK_WORLD_1 = 161,
- SDLK_WORLD_2 = 162,
- SDLK_WORLD_3 = 163,
- SDLK_WORLD_4 = 164,
- SDLK_WORLD_5 = 165,
- SDLK_WORLD_6 = 166,
- SDLK_WORLD_7 = 167,
- SDLK_WORLD_8 = 168,
- SDLK_WORLD_9 = 169,
- SDLK_WORLD_10 = 170,
- SDLK_WORLD_11 = 171,
- SDLK_WORLD_12 = 172,
- SDLK_WORLD_13 = 173,
- SDLK_WORLD_14 = 174,
- SDLK_WORLD_15 = 175,
- SDLK_WORLD_16 = 176,
- SDLK_WORLD_17 = 177,
- SDLK_WORLD_18 = 178,
- SDLK_WORLD_19 = 179,
- SDLK_WORLD_20 = 180,
- SDLK_WORLD_21 = 181,
- SDLK_WORLD_22 = 182,
- SDLK_WORLD_23 = 183,
- SDLK_WORLD_24 = 184,
- SDLK_WORLD_25 = 185,
- SDLK_WORLD_26 = 186,
- SDLK_WORLD_27 = 187,
- SDLK_WORLD_28 = 188,
- SDLK_WORLD_29 = 189,
- SDLK_WORLD_30 = 190,
- SDLK_WORLD_31 = 191,
- SDLK_WORLD_32 = 192,
- SDLK_WORLD_33 = 193,
- SDLK_WORLD_34 = 194,
- SDLK_WORLD_35 = 195,
- SDLK_WORLD_36 = 196,
- SDLK_WORLD_37 = 197,
- SDLK_WORLD_38 = 198,
- SDLK_WORLD_39 = 199,
- SDLK_WORLD_40 = 200,
- SDLK_WORLD_41 = 201,
- SDLK_WORLD_42 = 202,
- SDLK_WORLD_43 = 203,
- SDLK_WORLD_44 = 204,
- SDLK_WORLD_45 = 205,
- SDLK_WORLD_46 = 206,
- SDLK_WORLD_47 = 207,
- SDLK_WORLD_48 = 208,
- SDLK_WORLD_49 = 209,
- SDLK_WORLD_50 = 210,
- SDLK_WORLD_51 = 211,
- SDLK_WORLD_52 = 212,
- SDLK_WORLD_53 = 213,
- SDLK_WORLD_54 = 214,
- SDLK_WORLD_55 = 215,
- SDLK_WORLD_56 = 216,
- SDLK_WORLD_57 = 217,
- SDLK_WORLD_58 = 218,
- SDLK_WORLD_59 = 219,
- SDLK_WORLD_60 = 220,
- SDLK_WORLD_61 = 221,
- SDLK_WORLD_62 = 222,
- SDLK_WORLD_63 = 223,
- SDLK_WORLD_64 = 224,
- SDLK_WORLD_65 = 225,
- SDLK_WORLD_66 = 226,
- SDLK_WORLD_67 = 227,
- SDLK_WORLD_68 = 228,
- SDLK_WORLD_69 = 229,
- SDLK_WORLD_70 = 230,
- SDLK_WORLD_71 = 231,
- SDLK_WORLD_72 = 232,
- SDLK_WORLD_73 = 233,
- SDLK_WORLD_74 = 234,
- SDLK_WORLD_75 = 235,
- SDLK_WORLD_76 = 236,
- SDLK_WORLD_77 = 237,
- SDLK_WORLD_78 = 238,
- SDLK_WORLD_79 = 239,
- SDLK_WORLD_80 = 240,
- SDLK_WORLD_81 = 241,
- SDLK_WORLD_82 = 242,
- SDLK_WORLD_83 = 243,
- SDLK_WORLD_84 = 244,
- SDLK_WORLD_85 = 245,
- SDLK_WORLD_86 = 246,
- SDLK_WORLD_87 = 247,
- SDLK_WORLD_88 = 248,
- SDLK_WORLD_89 = 249,
- SDLK_WORLD_90 = 250,
- SDLK_WORLD_91 = 251,
- SDLK_WORLD_92 = 252,
- SDLK_WORLD_93 = 253,
- SDLK_WORLD_94 = 254,
- SDLK_WORLD_95 = 255, /* 0xFF */
- /*@}*/
+#define SDLK_SCANCODE_MASK (1<<30)
+#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
- /** @name Numeric keypad */
- /*@{*/
- SDLK_KP0 = 256,
- SDLK_KP1 = 257,
- SDLK_KP2 = 258,
- SDLK_KP3 = 259,
- SDLK_KP4 = 260,
- SDLK_KP5 = 261,
- SDLK_KP6 = 262,
- SDLK_KP7 = 263,
- SDLK_KP8 = 264,
- SDLK_KP9 = 265,
- SDLK_KP_PERIOD = 266,
- SDLK_KP_DIVIDE = 267,
- SDLK_KP_MULTIPLY = 268,
- SDLK_KP_MINUS = 269,
- SDLK_KP_PLUS = 270,
- SDLK_KP_ENTER = 271,
- SDLK_KP_EQUALS = 272,
- /*@}*/
+enum
+{
+ SDLK_UNKNOWN = 0,
- /** @name Arrows + Home/End pad */
- /*@{*/
- SDLK_UP = 273,
- SDLK_DOWN = 274,
- SDLK_RIGHT = 275,
- SDLK_LEFT = 276,
- SDLK_INSERT = 277,
- SDLK_HOME = 278,
- SDLK_END = 279,
- SDLK_PAGEUP = 280,
- SDLK_PAGEDOWN = 281,
- /*@}*/
+ SDLK_RETURN = '\r',
+ SDLK_ESCAPE = '\033',
+ SDLK_BACKSPACE = '\b',
+ SDLK_TAB = '\t',
+ SDLK_SPACE = ' ',
+ SDLK_EXCLAIM = '!',
+ SDLK_QUOTEDBL = '"',
+ SDLK_HASH = '#',
+ SDLK_PERCENT = '%',
+ SDLK_DOLLAR = '$',
+ SDLK_AMPERSAND = '&',
+ SDLK_QUOTE = '\'',
+ SDLK_LEFTPAREN = '(',
+ SDLK_RIGHTPAREN = ')',
+ SDLK_ASTERISK = '*',
+ SDLK_PLUS = '+',
+ SDLK_COMMA = ',',
+ SDLK_MINUS = '-',
+ SDLK_PERIOD = '.',
+ SDLK_SLASH = '/',
+ SDLK_0 = '0',
+ SDLK_1 = '1',
+ SDLK_2 = '2',
+ SDLK_3 = '3',
+ SDLK_4 = '4',
+ SDLK_5 = '5',
+ SDLK_6 = '6',
+ SDLK_7 = '7',
+ SDLK_8 = '8',
+ SDLK_9 = '9',
+ SDLK_COLON = ':',
+ SDLK_SEMICOLON = ';',
+ SDLK_LESS = '<',
+ SDLK_EQUALS = '=',
+ SDLK_GREATER = '>',
+ SDLK_QUESTION = '?',
+ SDLK_AT = '@',
+ /*
+ Skip uppercase letters
+ */
+ SDLK_LEFTBRACKET = '[',
+ SDLK_BACKSLASH = '\\',
+ SDLK_RIGHTBRACKET = ']',
+ SDLK_CARET = '^',
+ SDLK_UNDERSCORE = '_',
+ SDLK_BACKQUOTE = '`',
+ SDLK_a = 'a',
+ SDLK_b = 'b',
+ SDLK_c = 'c',
+ SDLK_d = 'd',
+ SDLK_e = 'e',
+ SDLK_f = 'f',
+ SDLK_g = 'g',
+ SDLK_h = 'h',
+ SDLK_i = 'i',
+ SDLK_j = 'j',
+ SDLK_k = 'k',
+ SDLK_l = 'l',
+ SDLK_m = 'm',
+ SDLK_n = 'n',
+ SDLK_o = 'o',
+ SDLK_p = 'p',
+ SDLK_q = 'q',
+ SDLK_r = 'r',
+ SDLK_s = 's',
+ SDLK_t = 't',
+ SDLK_u = 'u',
+ SDLK_v = 'v',
+ SDLK_w = 'w',
+ SDLK_x = 'x',
+ SDLK_y = 'y',
+ SDLK_z = 'z',
- /** @name Function keys */
- /*@{*/
- SDLK_F1 = 282,
- SDLK_F2 = 283,
- SDLK_F3 = 284,
- SDLK_F4 = 285,
- SDLK_F5 = 286,
- SDLK_F6 = 287,
- SDLK_F7 = 288,
- SDLK_F8 = 289,
- SDLK_F9 = 290,
- SDLK_F10 = 291,
- SDLK_F11 = 292,
- SDLK_F12 = 293,
- SDLK_F13 = 294,
- SDLK_F14 = 295,
- SDLK_F15 = 296,
- /*@}*/
+ SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
- /** @name Key state modifier keys */
- /*@{*/
- SDLK_NUMLOCK = 300,
- SDLK_CAPSLOCK = 301,
- SDLK_SCROLLOCK = 302,
- SDLK_RSHIFT = 303,
- SDLK_LSHIFT = 304,
- SDLK_RCTRL = 305,
- SDLK_LCTRL = 306,
- SDLK_RALT = 307,
- SDLK_LALT = 308,
- SDLK_RMETA = 309,
- SDLK_LMETA = 310,
- SDLK_LSUPER = 311, /**< Left "Windows" key */
- SDLK_RSUPER = 312, /**< Right "Windows" key */
- SDLK_MODE = 313, /**< "Alt Gr" key */
- SDLK_COMPOSE = 314, /**< Multi-key compose key */
- /*@}*/
+ SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
+ SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
+ SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
+ SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
+ SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
+ SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
+ SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
+ SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
+ SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
+ SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
+ SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
+ SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
- /** @name Miscellaneous function keys */
- /*@{*/
- SDLK_HELP = 315,
- SDLK_PRINT = 316,
- SDLK_SYSREQ = 317,
- SDLK_BREAK = 318,
- SDLK_MENU = 319,
- SDLK_POWER = 320, /**< Power Macintosh power key */
- SDLK_EURO = 321, /**< Some european keyboards */
- SDLK_UNDO = 322, /**< Atari keyboard has Undo */
- /*@}*/
+ SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
+ SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
+ SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
+ SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
+ SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
+ SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
+ SDLK_DELETE = '\177',
+ SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
+ SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
+ SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
+ SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
+ SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
+ SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
- /* Add any other keys here */
+ SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
+ SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
+ SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
+ SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
+ SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
+ SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
+ SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
+ SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
+ SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
+ SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
+ SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
+ SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
+ SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
+ SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
+ SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
+ SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
+ SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
- SDLK_LAST
-} SDLKey;
+ SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
+ SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
+ SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
+ SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
+ SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
+ SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
+ SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
+ SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
+ SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
+ SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
+ SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
+ SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
+ SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
+ SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
+ SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
+ SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
+ SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
+ SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
+ SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
+ SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
+ SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
+ SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
+ SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
+ SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
+ SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
+ SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
+ SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
+ SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
+ SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
+ SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
+ SDLK_KP_EQUALSAS400 =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
-/** Enumeration of valid key mods (possibly OR'd together) */
-typedef enum {
- KMOD_NONE = 0x0000,
- KMOD_LSHIFT= 0x0001,
- KMOD_RSHIFT= 0x0002,
- KMOD_LCTRL = 0x0040,
- KMOD_RCTRL = 0x0080,
- KMOD_LALT = 0x0100,
- KMOD_RALT = 0x0200,
- KMOD_LMETA = 0x0400,
- KMOD_RMETA = 0x0800,
- KMOD_NUM = 0x1000,
- KMOD_CAPS = 0x2000,
- KMOD_MODE = 0x4000,
- KMOD_RESERVED = 0x8000
+ SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
+ SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
+ SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
+ SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
+ SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
+ SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
+ SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
+ SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
+ SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
+ SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
+ SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
+ SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
+
+ SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
+ SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
+ SDLK_THOUSANDSSEPARATOR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
+ SDLK_DECIMALSEPARATOR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
+ SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
+ SDLK_CURRENCYSUBUNIT =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
+ SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
+ SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
+ SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
+ SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
+ SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
+ SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
+ SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
+ SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
+ SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
+ SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
+ SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
+ SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
+ SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
+ SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
+ SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
+ SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
+ SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
+ SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
+ SDLK_KP_DBLAMPERSAND =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
+ SDLK_KP_VERTICALBAR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
+ SDLK_KP_DBLVERTICALBAR =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
+ SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
+ SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
+ SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
+ SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
+ SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
+ SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
+ SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
+ SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
+ SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
+ SDLK_KP_MEMSUBTRACT =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
+ SDLK_KP_MEMMULTIPLY =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
+ SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
+ SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
+ SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
+ SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
+ SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
+ SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
+ SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
+ SDLK_KP_HEXADECIMAL =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
+
+ SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
+ SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
+ SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
+ SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
+ SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
+ SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
+ SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
+ SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
+
+ SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
+
+ SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
+ SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
+ SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
+ SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
+ SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
+ SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
+ SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
+ SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
+ SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
+ SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
+ SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
+ SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
+ SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
+ SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
+ SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
+ SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
+ SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
+
+ SDLK_BRIGHTNESSDOWN =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
+ SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
+ SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
+ SDLK_KBDILLUMTOGGLE =
+ SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
+ SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
+ SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
+ SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
+ SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
+};
+
+/**
+ * \brief Enumeration of valid key mods (possibly OR'd together).
+ */
+typedef enum
+{
+ KMOD_NONE = 0x0000,
+ KMOD_LSHIFT = 0x0001,
+ KMOD_RSHIFT = 0x0002,
+ KMOD_LCTRL = 0x0040,
+ KMOD_RCTRL = 0x0080,
+ KMOD_LALT = 0x0100,
+ KMOD_RALT = 0x0200,
+ KMOD_LGUI = 0x0400,
+ KMOD_RGUI = 0x0800,
+ KMOD_NUM = 0x1000,
+ KMOD_CAPS = 0x2000,
+ KMOD_MODE = 0x4000,
+ KMOD_RESERVED = 0x8000
} SDLMod;
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
-#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
+#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
#endif /* _SDL_keysym_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_loadso.h b/alienblaster/project/jni/sdl/include/SDL_loadso.h
index 45a17f9f4..f22d8dd7f 100644
--- a/alienblaster/project/jni/sdl/include/SDL_loadso.h
+++ b/alienblaster/project/jni/sdl/include/SDL_loadso.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,26 +20,25 @@
slouken@libsdl.org
*/
-/** @file SDL_loadso.h
+/**
+ * \file SDL_loadso.h
+ *
* System dependent library loading routines
- */
-
-/** @file SDL_loadso.h
+ *
* Some things to keep in mind:
- * - These functions only work on C function names. Other languages may
- * have name mangling and intrinsic language support that varies from
- * compiler to compiler.
- * - Make sure you declare your function pointers with the same calling
- * convention as the actual library function. Your code will crash
- * mysteriously if you do not do this.
- * - Avoid namespace collisions. If you load a symbol from the library,
- * it is not defined whether or not it goes into the global symbol
- * namespace for the application. If it does and it conflicts with
- * symbols in your code or other shared libraries, you will not get
- * the results you expect. :)
+ * \li These functions only work on C function names. Other languages may
+ * have name mangling and intrinsic language support that varies from
+ * compiler to compiler.
+ * \li Make sure you declare your function pointers with the same calling
+ * convention as the actual library function. Your code will crash
+ * mysteriously if you do not do this.
+ * \li Avoid namespace collisions. If you load a symbol from the library,
+ * it is not defined whether or not it goes into the global symbol
+ * namespace for the application. If it does and it conflicts with
+ * symbols in your code or other shared libraries, you will not get
+ * the results you expect. :)
*/
-
#ifndef _SDL_loadso_h
#define _SDL_loadso_h
@@ -49,30 +48,39 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
/**
- * This function dynamically loads a shared object and returns a pointer
- * to the object handle (or NULL if there was an error).
- * The 'sofile' parameter is a system dependent name of the object file.
+ * This function dynamically loads a shared object and returns a pointer
+ * to the object handle (or NULL if there was an error).
+ * The 'sofile' parameter is a system dependent name of the object file.
*/
-extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
+extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
/**
- * Given an object handle, this function looks up the address of the
- * named function in the shared object and returns it. This address
- * is no longer valid after calling SDL_UnloadObject().
+ * Given an object handle, this function looks up the address of the
+ * named function in the shared object and returns it. This address
+ * is no longer valid after calling SDL_UnloadObject().
*/
-extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
+extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
+ const char *name);
-/** Unload a shared object from memory */
+/**
+ * Unload a shared object from memory.
+ */
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_loadso_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_main.h b/alienblaster/project/jni/sdl/include/SDL_main.h
index b7f6b2c82..803aa0fb4 100644
--- a/alienblaster/project/jni/sdl/include/SDL_main.h
+++ b/alienblaster/project/jni/sdl/include/SDL_main.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -25,14 +25,15 @@
#include "SDL_stdinc.h"
-/** @file SDL_main.h
- * Redefine main() on Win32 and MacOS so that it is called by winmain.c
+/**
+ * \file SDL_main.h
+ *
+ * Redefine main() on some platforms so that it is called by SDL.
*/
#if defined(__WIN32__) || \
(defined(__MWERKS__) && !defined(__BEOS__)) || \
- defined(__MACOS__) || defined(__MACOSX__) || \
- defined(__SYMBIAN32__) || defined(QWS)
+ defined(__SYMBIAN32__) || defined(__IPHONEOS__)
#ifdef __cplusplus
#define C_LINKAGE "C"
@@ -40,67 +41,56 @@
#define C_LINKAGE
#endif /* __cplusplus */
-/** The application's main() function must be called with C linkage,
+/**
+ * \file SDL_main.h
+ *
+ * The application's main() function must be called with C linkage,
* and should be declared like this:
- * @code
- * #ifdef __cplusplus
- * extern "C"
- * #endif
- * int main(int argc, char *argv[])
- * {
- * }
- * @endcode
+ * \code
+ * #ifdef __cplusplus
+ * extern "C"
+ * #endif
+ * int main(int argc, char *argv[])
+ * {
+ * }
+ * \endcode
*/
+
#define main SDL_main
-/** The prototype for the application's main() function */
+/**
+ * The prototype for the application's main() function
+ */
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
-/** @name From the SDL library code -- needed for registering the app on Win32 */
-/*@{*/
+/* From the SDL library code -- needed for registering the app on Win32 */
#ifdef __WIN32__
#include "begin_code.h"
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** This should be called from your WinMain() function, if any */
-extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
-/** This can also be called, but is no longer necessary */
-extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
-/** This can also be called, but is no longer necessary (SDL_Quit calls it) */
+/**
+ * This can be called to set the application class at startup
+ */
+extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
+ void *hInst);
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
+
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif
-/*@}*/
-
-/** @name From the SDL library code -- needed for registering QuickDraw on MacOS */
-/*@{*/
-#if defined(__MACOS__)
-
-#include "begin_code.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Forward declaration so we don't need to include QuickDraw.h */
-struct QDGlobals;
-
-/** This should be called from your main() function, if any */
-extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
-
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-#endif
-/*@}*/
#endif /* Need to redefine main()? */
#endif /* _SDL_main_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_mouse.h b/alienblaster/project/jni/sdl/include/SDL_mouse.h
index a573f04ee..cb3cd9ccf 100644
--- a/alienblaster/project/jni/sdl/include/SDL_mouse.h
+++ b/alienblaster/project/jni/sdl/include/SDL_mouse.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,26 @@
slouken@libsdl.org
*/
-/** @file SDL_mouse.h
- * Include file for SDL mouse event handling
+/**
+ * \file SDL_mouse.h
+ *
+ * Include file for SDL mouse event handling.
+ *
+ * Please note that this ONLY discusses "mice" with the notion of the
+ * desktop GUI. You (usually) have one system cursor, and the OS hides
+ * the hardware details from you. If you plug in 10 mice, all ten move that
+ * one cursor. For many applications and games, this is perfect, and this
+ * API has served hundreds of SDL programs well since its birth.
+ *
+ * It's not the whole picture, though. If you want more lowlevel control,
+ * SDL offers a different API, that gives you visibility into each input
+ * device, multi-touch interfaces, etc.
+ *
+ * Those two APIs are incompatible, and you usually should not use both
+ * at the same time. But for legacy purposes, this API refers to a "mouse"
+ * when it actually means the system pointer and not a physical mouse.
+ *
+ * The other API is in SDL_input.h
*/
#ifndef _SDL_mouse_h
@@ -34,110 +52,154 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-typedef struct WMcursor WMcursor; /**< Implementation dependent */
-typedef struct SDL_Cursor {
- SDL_Rect area; /**< The area of the mouse cursor */
- Sint16 hot_x, hot_y; /**< The "tip" of the cursor */
- Uint8 *data; /**< B/W cursor data */
- Uint8 *mask; /**< B/W cursor mask */
- Uint8 *save[2]; /**< Place to save cursor area */
- WMcursor *wm_cursor; /**< Window-manager cursor */
-} SDL_Cursor;
+typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
+
/* Function prototypes */
+
/**
- * Retrieve the current state of the mouse.
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * current mouse cursor position. You can pass NULL for either x or y.
+ * \brief Get the window which currently has mouse focus.
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
+
+/**
+ * \brief Retrieve the current state of the mouse.
+ *
+ * The current button state is returned as a button bitmask, which can
+ * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
+ * mouse cursor position relative to the focus window for the currently
+ * selected mouse. You can pass NULL for either x or y.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
/**
- * Retrieve the current state of the mouse.
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * mouse deltas since the last call to SDL_GetRelativeMouseState().
+ * \brief Retrieve the relative state of the mouse.
+ *
+ * The current button state is returned as a button bitmask, which can
+ * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
+ * mouse deltas since the last call to SDL_GetRelativeMouseState().
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
/**
- * Set the position of the mouse cursor (generates a mouse motion event)
+ * \brief Moves the mouse to the given position within the window.
+ *
+ * \param window The window to move the mouse into, or NULL for the current mouse focus
+ * \param x The x coordinate within the window
+ * \param y The y coordinate within the window
+ *
+ * \note This function generates a mouse motion event
*/
-extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
+extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
+ int x, int y);
/**
- * Create a cursor using the specified data and mask (in MSB format).
- * The cursor width must be a multiple of 8 bits.
+ * \brief Set relative mouse mode.
+ *
+ * \param enabled Whether or not to enable relative mode
*
- * The cursor is created in black and white according to the following:
- * data mask resulting pixel on screen
- * 0 1 White
- * 1 1 Black
- * 0 0 Transparent
- * 1 0 Inverted color if possible, black if not.
- *
- * Cursors created with this function must be freed with SDL_FreeCursor().
+ * \return 0 on success, or -1 if relative mode is not supported.
+ *
+ * While the mouse is in relative mode, the cursor is hidden, and the
+ * driver will try to report continuous motion in the current window.
+ * Only relative motion events will be delivered, the mouse position
+ * will not change.
+ *
+ * \note This function will flush any pending mouse motion.
+ *
+ * \sa SDL_GetRelativeMouseMode()
*/
-extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
- (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
+extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
/**
- * Set the currently active cursor to the specified one.
- * If the cursor is currently visible, the change will be immediately
- * represented on the display.
+ * \brief Query whether relative mouse mode is enabled.
+ *
+ * \sa SDL_SetRelativeMouseMode()
*/
-extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
+extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
/**
- * Returns the currently active cursor.
+ * \brief Create a cursor, using the specified bitmap data and
+ * mask (in MSB format).
+ *
+ * The cursor width must be a multiple of 8 bits.
+ *
+ * The cursor is created in black and white according to the following:
+ *
+ * | data | mask | resulting pixel on screen |
+ * | 0 | 1 | White |
+ * | 1 | 1 | Black |
+ * | 0 | 0 | Transparent |
+ * | 1 | 0 | Inverted color if possible, black
+ * if not. |
+ *
+ *
+ * \sa SDL_FreeCursor()
*/
-extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
+ const Uint8 * mask,
+ int w, int h, int hot_x,
+ int hot_y);
/**
- * Deallocates a cursor created with SDL_CreateCursor().
+ * \brief Set the active cursor.
*/
-extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
+extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
/**
- * Toggle whether or not the cursor is shown on the screen.
- * The cursor start off displayed, but can be turned off.
- * SDL_ShowCursor() returns 1 if the cursor was being displayed
- * before the call, or 0 if it was not. You can query the current
- * state by passing a 'toggle' value of -1.
+ * \brief Return the active cursor.
+ */
+extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
+
+/**
+ * \brief Frees a cursor created with SDL_CreateCursor().
+ *
+ * \sa SDL_CreateCursor()
+ */
+extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
+
+/**
+ * \brief Toggle whether or not the cursor is shown.
+ *
+ * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
+ * state.
+ *
+ * \return 1 if the cursor is shown, or 0 if the cursor is hidden.
*/
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
-/*@{*/
-/** Used as a mask when testing buttons in buttonstate
- * Button 1: Left mouse button
- * Button 2: Middle mouse button
- * Button 3: Right mouse button
- * Button 4: Mouse wheel up (may also be a real button)
- * Button 5: Mouse wheel down (may also be a real button)
+/**
+ * Used as a mask when testing buttons in buttonstate.
+ * - Button 1: Left mouse button
+ * - Button 2: Middle mouse button
+ * - Button 3: Right mouse button
*/
#define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2
#define SDL_BUTTON_RIGHT 3
-#define SDL_BUTTON_WHEELUP 4
-#define SDL_BUTTON_WHEELDOWN 5
-#define SDL_BUTTON_X1 6
-#define SDL_BUTTON_X2 7
+#define SDL_BUTTON_X1 4
+#define SDL_BUTTON_X2 5
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
-/*@}*/
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_mouse_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_mutex.h b/alienblaster/project/jni/sdl/include/SDL_mutex.h
index 920971dfa..dcafbb7e2 100644
--- a/alienblaster/project/jni/sdl/include/SDL_mutex.h
+++ b/alienblaster/project/jni/sdl/include/SDL_mutex.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,10 +23,10 @@
#ifndef _SDL_mutex_h
#define _SDL_mutex_h
-/** @file SDL_mutex.h
- * Functions to provide thread synchronization primitives
- *
- * @note These are independent of the other SDL routines.
+/**
+ * \file SDL_mutex.h
+ *
+ * Functions to provide thread synchronization primitives.
*/
#include "SDL_stdinc.h"
@@ -35,143 +35,189 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** Synchronization functions which can time out return this value
+/**
+ * Synchronization functions which can time out return this value
* if they time out.
*/
#define SDL_MUTEX_TIMEDOUT 1
-/** This is the timeout value which corresponds to never time out */
+/**
+ * This is the timeout value which corresponds to never time out.
+ */
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/** @name Mutex functions */ /*@{*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * \name Mutex functions
+ */
+/*@{*/
-/** The SDL mutex structure, defined in SDL_mutex.c */
+/* The SDL mutex structure, defined in SDL_mutex.c */
struct SDL_mutex;
typedef struct SDL_mutex SDL_mutex;
-/** Create a mutex, initialized unlocked */
-extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
+/**
+ * Create a mutex, initialized unlocked.
+ */
+extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
+/**
+ * Lock the mutex.
+ *
+ * \return 0, or -1 on error.
+ */
#define SDL_LockMutex(m) SDL_mutexP(m)
-/** Lock the mutex
- * @return 0, or -1 on error
- */
-extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
+extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex);
+/**
+ * Unlock the mutex.
+ *
+ * \return 0, or -1 on error.
+ *
+ * \warning It is an error to unlock a mutex that has not been locked by
+ * the current thread, and doing so results in undefined behavior.
+ */
#define SDL_UnlockMutex(m) SDL_mutexV(m)
-/** Unlock the mutex
- * @return 0, or -1 on error
- *
- * It is an error to unlock a mutex that has not been locked by
- * the current thread, and doing so results in undefined behavior.
+extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex * mutex);
+
+/**
+ * Destroy a mutex.
*/
-extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
+extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
-/** Destroy a mutex */
-extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
+/*@}*//*Mutex functions*/
-/*@}*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/** @name Semaphore functions */ /*@{*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * \name Semaphore functions
+ */
+/*@{*/
-/** The SDL semaphore structure, defined in SDL_sem.c */
+/* The SDL semaphore structure, defined in SDL_sem.c */
struct SDL_semaphore;
typedef struct SDL_semaphore SDL_sem;
-/** Create a semaphore, initialized with value, returns NULL on failure. */
-extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
-
-/** Destroy a semaphore */
-extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
+/**
+ * Create a semaphore, initialized with value, returns NULL on failure.
+ */
+extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
/**
- * This function suspends the calling thread until the semaphore pointed
- * to by sem has a positive count. It then atomically decreases the semaphore
- * count.
+ * Destroy a semaphore.
*/
-extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
+extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
-/** Non-blocking variant of SDL_SemWait().
- * @return 0 if the wait succeeds,
- * SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
+/**
+ * This function suspends the calling thread until the semaphore pointed
+ * to by \c sem has a positive count. It then atomically decreases the
+ * semaphore count.
*/
-extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
+extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
-/** Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
- * the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
- * the allotted time, and -1 on error.
- *
- * On some platforms this function is implemented by looping with a delay
- * of 1 ms, and so should be avoided if possible.
+/**
+ * Non-blocking variant of SDL_SemWait().
+ *
+ * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
+ * block, and -1 on error.
*/
-extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
+extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
-/** Atomically increases the semaphore's count (not blocking).
- * @return 0, or -1 on error.
+/**
+ * Variant of SDL_SemWait() with a timeout in milliseconds.
+ *
+ * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
+ * succeed in the allotted time, and -1 on error.
+ *
+ * \warning On some platforms this function is implemented by looping with a
+ * delay of 1 ms, and so should be avoided if possible.
*/
-extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
+extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
-/** Returns the current count of the semaphore */
-extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
+/**
+ * Atomically increases the semaphore's count (not blocking).
+ *
+ * \return 0, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
-/*@}*/
+/**
+ * Returns the current count of the semaphore.
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/** @name Condition_variable_functions */ /*@{*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*@}*//*Semaphore functions*/
+
+/**
+ * \name Condition variable functions
+ */
/*@{*/
-/** The SDL condition variable structure, defined in SDL_cond.c */
+
+/* The SDL condition variable structure, defined in SDL_cond.c */
struct SDL_cond;
typedef struct SDL_cond SDL_cond;
-/*@}*/
-/** Create a condition variable */
-extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
-
-/** Destroy a condition variable */
-extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
-
-/** Restart one of the threads that are waiting on the condition variable,
- * @return 0 or -1 on error.
+/**
+ * Create a condition variable.
*/
-extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
+extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
-/** Restart all threads that are waiting on the condition variable,
- * @return 0 or -1 on error.
+/**
+ * Destroy a condition variable.
*/
-extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
+extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
-/** Wait on the condition variable, unlocking the provided mutex.
- * The mutex must be locked before entering this function!
+/**
+ * Restart one of the threads that are waiting on the condition variable.
+ *
+ * \return 0 or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
+
+/**
+ * Restart all threads that are waiting on the condition variable.
+ * \return 0 or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
+
+/**
+ * Wait on the condition variable, unlocking the provided mutex.
+ *
+ * \warning The mutex must be locked before entering this function!
+ *
* The mutex is re-locked once the condition variable is signaled.
- * @return 0 when it is signaled, or -1 on error.
+ *
+ * \return 0 when it is signaled, or -1 on error.
*/
-extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
+extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mut);
-/** Waits for at most 'ms' milliseconds, and returns 0 if the condition
- * variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
+/**
+ * Waits for at most \c ms milliseconds, and returns 0 if the condition
+ * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
* signaled in the allotted time, and -1 on error.
- * On some platforms this function is implemented by looping with a delay
- * of 1 ms, and so should be avoided if possible.
+ *
+ * \warning On some platforms this function is implemented by looping with a
+ * delay of 1 ms, and so should be avoided if possible.
*/
-extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
+extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
+ SDL_mutex * mutex, Uint32 ms);
+
+/*@}*//*Condition variable functions*/
-/*@}*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_mutex_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_opengl.h b/alienblaster/project/jni/sdl/include/SDL_opengl.h
index 667bb3f54..771ccfea7 100644
--- a/alienblaster/project/jni/sdl/include/SDL_opengl.h
+++ b/alienblaster/project/jni/sdl/include/SDL_opengl.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,47 +20,59 @@
slouken@libsdl.org
*/
-/** @file SDL_opengl.h
- * This is a simple file to encapsulate the OpenGL API headers
+/**
+ * \file SDL_opengl.h
+ *
+ * This is a simple file to encapsulate the OpenGL API headers.
*/
+#ifndef _SDL_opengl_h
+#define _SDL_opengl_h
+
#include "SDL_config.h"
#ifdef __WIN32__
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
-#define NOMINMAX /* Don't defined min() and max() */
+#define NOMINMAX /* Don't defined min() and max() */
#endif
#include
#endif
#ifndef NO_SDL_GLEXT
-#define __glext_h_ /* Don't let gl.h include glext.h */
+#define __glext_h_ /* Don't let gl.h include glext.h */
#endif
#if defined(__MACOSX__)
-#include /* Header File For The OpenGL Library */
-#include /* Header File For The GLU Library */
-#elif defined(__MACOS__)
-#include /* Header File For The OpenGL Library */
-#include /* Header File For The GLU Library */
-#elif defined(ANDROID)
-#include /* Header File For The OpenGL Library */
-#include /* No GLU on Android */
+#include /* Header File For The OpenGL Library */
+#include /* Header File For The GLU Library */
+#define __X_GL_H
#else
-#include /* Header File For The OpenGL Library */
-#include /* Header File For The GLU Library */
+#include /* Header File For The OpenGL Library */
+#include /* Header File For The GLU Library */
#endif
#ifndef NO_SDL_GLEXT
#undef __glext_h_
#endif
-/** @name GLext.h
- * This file taken from "GLext.h" from the Jeff Molofee OpenGL tutorials.
- * It is included here because glext.h is not available on some systems.
- * If you don't want this version included, simply define "NO_SDL_GLEXT"
+/**
+ * \file SDL_opengl.h
+ *
+ * This file is included because glext.h is not available on some systems.
+ * If you don't want this version included, simply define ::NO_SDL_GLEXT.
+ *
+ * The latest version is available from:
+ * http://www.opengl.org/registry/
*/
-/*@{*/
-#ifndef NO_SDL_GLEXT
-#if !defined(__glext_h_) && !defined(GL_GLEXT_LEGACY)
+
+/**
+ * \def NO_SDL_GLEXT
+ *
+ * Define this if you have your own version of glext.h and want to disable the
+ * version included in SDL_opengl.h.
+ */
+
+#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
+/* *INDENT-OFF* */
+#ifndef __glext_h_
#define __glext_h_
#ifdef __cplusplus
@@ -68,34 +80,35 @@ extern "C" {
#endif
/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+** Copyright (c) 2007-2009 The Khronos Group Inc.
**
-** http://oss.sgi.com/projects/FreeB
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: This software was created using the
-** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
-** not been independently verified as being compliant with the OpenGL(R)
-** version 1.2.1 Specification.
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
+/* Header file version number, required by OpenGL ABI for Linux */
+/* glext.h last updated $Date$ */
+/* Current version at http://www.opengl.org/registry/ */
+#define GL_GLEXT_VERSION 54
+
+/* Function declaration macros - to move into glplatform.h */
+
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include
@@ -113,18 +126,12 @@ extern "C" {
/*************************************************************/
-/* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated 2005/06/20 */
-/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
-#define GL_GLEXT_VERSION 29
-
#ifndef GL_VERSION_1_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_RESCALE_NORMAL 0x803A
#define GL_TEXTURE_BINDING_3D 0x806A
#define GL_PACK_SKIP_IMAGES 0x806B
#define GL_PACK_IMAGE_HEIGHT 0x806C
@@ -151,17 +158,21 @@ extern "C" {
#define GL_TEXTURE_MAX_LOD 0x813B
#define GL_TEXTURE_BASE_LEVEL 0x813C
#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
-#define GL_SINGLE_COLOR 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#endif
+#ifndef GL_VERSION_1_2_DEPRECATED
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#endif
+
#ifndef GL_ARB_imaging
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
@@ -174,6 +185,9 @@ extern "C" {
#define GL_BLEND_EQUATION 0x8009
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#endif
+
+#ifndef GL_ARB_imaging_DEPRECATED
#define GL_CONVOLUTION_1D 0x8010
#define GL_CONVOLUTION_2D 0x8011
#define GL_SEPARABLE_2D 0x8012
@@ -274,12 +288,6 @@ extern "C" {
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
#define GL_MULTISAMPLE 0x809D
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
@@ -288,9 +296,6 @@ extern "C" {
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_MULTISAMPLE_BIT 0x20000000
-#define GL_NORMAL_MAP 0x8511
-#define GL_REFLECTION_MAP 0x8512
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
@@ -301,10 +306,6 @@ extern "C" {
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_COMPRESSED_ALPHA 0x84E9
-#define GL_COMPRESSED_LUMINANCE 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
-#define GL_COMPRESSED_INTENSITY 0x84EC
#define GL_COMPRESSED_RGB 0x84ED
#define GL_COMPRESSED_RGBA 0x84EE
#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
@@ -313,6 +314,22 @@ extern "C" {
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
#define GL_CLAMP_TO_BORDER 0x812D
+#endif
+
+#ifndef GL_VERSION_1_3_DEPRECATED
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
+#define GL_MULTISAMPLE_BIT 0x20000000
+#define GL_NORMAL_MAP 0x8511
+#define GL_REFLECTION_MAP 0x8512
+#define GL_COMPRESSED_ALPHA 0x84E9
+#define GL_COMPRESSED_LUMINANCE 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
+#define GL_COMPRESSED_INTENSITY 0x84EC
#define GL_COMBINE 0x8570
#define GL_COMBINE_RGB 0x8571
#define GL_COMBINE_ALPHA 0x8572
@@ -344,16 +361,26 @@ extern "C" {
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_POINT_SIZE_MIN 0x8126
-#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION 0x8129
-#define GL_GENERATE_MIPMAP 0x8191
-#define GL_GENERATE_MIPMAP_HINT 0x8192
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#define GL_MIRRORED_REPEAT 0x8370
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_LOD_BIAS 0x8501
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#endif
+
+#ifndef GL_VERSION_1_4_DEPRECATED
+#define GL_POINT_SIZE_MIN 0x8126
+#define GL_POINT_SIZE_MAX 0x8127
+#define GL_POINT_DISTANCE_ATTENUATION 0x8129
+#define GL_GENERATE_MIPMAP 0x8191
+#define GL_GENERATE_MIPMAP_HINT 0x8192
#define GL_FOG_COORDINATE_SOURCE 0x8450
#define GL_FOG_COORDINATE 0x8451
#define GL_FRAGMENT_DEPTH 0x8452
@@ -369,15 +396,8 @@ extern "C" {
#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
#define GL_SECONDARY_COLOR_ARRAY 0x845E
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
#define GL_TEXTURE_FILTER_CONTROL 0x8500
-#define GL_TEXTURE_LOD_BIAS 0x8501
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
#define GL_DEPTH_TEXTURE_MODE 0x884B
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
#define GL_COMPARE_R_TO_TEXTURE 0x884E
#endif
@@ -392,15 +412,6 @@ extern "C" {
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
#define GL_READ_ONLY 0x88B8
#define GL_WRITE_ONLY 0x88B9
@@ -418,31 +429,42 @@ extern "C" {
#define GL_DYNAMIC_READ 0x88E9
#define GL_DYNAMIC_COPY 0x88EA
#define GL_SAMPLES_PASSED 0x8914
-#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
-#define GL_FOG_COORD GL_FOG_COORDINATE
-#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE
-#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE
-#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE
-#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER
-#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY
-#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING
-#define GL_SRC0_RGB GL_SOURCE0_RGB
-#define GL_SRC1_RGB GL_SOURCE1_RGB
-#define GL_SRC2_RGB GL_SOURCE2_RGB
-#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA
-#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA
-#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA
+#endif
+
+#ifndef GL_VERSION_1_5_DEPRECATED
+#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
+#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
+#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
+#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
+#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
+#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
+#define GL_FOG_COORD_SRC 0x8450
+#define GL_FOG_COORD 0x8451
+#define GL_CURRENT_FOG_COORD 0x8453
+#define GL_FOG_COORD_ARRAY_TYPE 0x8454
+#define GL_FOG_COORD_ARRAY_STRIDE 0x8455
+#define GL_FOG_COORD_ARRAY_POINTER 0x8456
+#define GL_FOG_COORD_ARRAY 0x8457
+#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D
+#define GL_SRC0_RGB 0x8580
+#define GL_SRC1_RGB 0x8581
+#define GL_SRC2_RGB 0x8582
+#define GL_SRC0_ALPHA 0x8588
+#define GL_SRC1_ALPHA 0x8589
+#define GL_SRC2_ALPHA 0x858A
#endif
#ifndef GL_VERSION_2_0
-#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
+#define GL_BLEND_EQUATION_RGB 0x8009
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
@@ -466,11 +488,8 @@ extern "C" {
#define GL_DRAW_BUFFER14 0x8833
#define GL_DRAW_BUFFER15 0x8834
#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_POINT_SPRITE 0x8861
-#define GL_COORD_REPLACE 0x8862
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_MAX_TEXTURE_COORDS 0x8871
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
@@ -521,6 +540,427 @@ extern "C" {
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#endif
+#ifndef GL_VERSION_2_0_DEPRECATED
+#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
+#define GL_POINT_SPRITE 0x8861
+#define GL_COORD_REPLACE 0x8862
+#define GL_MAX_TEXTURE_COORDS 0x8871
+#endif
+
+#ifndef GL_VERSION_2_1
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB_ALPHA 0x8C42
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPRESSED_SRGB 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
+#endif
+
+#ifndef GL_VERSION_2_1_DEPRECATED
+#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
+#define GL_SLUMINANCE_ALPHA 0x8C44
+#define GL_SLUMINANCE8_ALPHA8 0x8C45
+#define GL_SLUMINANCE 0x8C46
+#define GL_SLUMINANCE8 0x8C47
+#define GL_COMPRESSED_SLUMINANCE 0x8C4A
+#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B
+#endif
+
+#ifndef GL_VERSION_3_0
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_CLIP_DISTANCE0 0x3000
+#define GL_CLIP_DISTANCE1 0x3001
+#define GL_CLIP_DISTANCE2 0x3002
+#define GL_CLIP_DISTANCE3 0x3003
+#define GL_CLIP_DISTANCE4 0x3004
+#define GL_CLIP_DISTANCE5 0x3005
+#define GL_CLIP_DISTANCE6 0x3006
+#define GL_CLIP_DISTANCE7 0x3007
+#define GL_MAX_CLIP_DISTANCES 0x0D32
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_CONTEXT_FLAGS 0x821E
+#define GL_DEPTH_BUFFER 0x8223
+#define GL_STENCIL_BUFFER 0x8224
+#define GL_COMPRESSED_RED 0x8225
+#define GL_COMPRESSED_RG 0x8226
+#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
+#define GL_RGBA32F 0x8814
+#define GL_RGB32F 0x8815
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_CLAMP_READ_COLOR 0x891C
+#define GL_FIXED_ONLY 0x891D
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_1D_ARRAY 0x8C18
+#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
+#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_RGB9_E5 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_TEXTURE_SHARED_SIZE 0x8C3F
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_PRIMITIVES_GENERATED 0x8C87
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI 0x8D70
+#define GL_RGB32UI 0x8D71
+#define GL_RGBA16UI 0x8D76
+#define GL_RGB16UI 0x8D77
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGB8UI 0x8D7D
+#define GL_RGBA32I 0x8D82
+#define GL_RGB32I 0x8D83
+#define GL_RGBA16I 0x8D88
+#define GL_RGB16I 0x8D89
+#define GL_RGBA8I 0x8D8E
+#define GL_RGB8I 0x8D8F
+#define GL_RED_INTEGER 0x8D94
+#define GL_GREEN_INTEGER 0x8D95
+#define GL_BLUE_INTEGER 0x8D96
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_BGR_INTEGER 0x8D9A
+#define GL_BGRA_INTEGER 0x8D9B
+#define GL_SAMPLER_1D_ARRAY 0x8DC0
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_INT_SAMPLER_1D 0x8DC9
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_QUERY_WAIT 0x8E13
+#define GL_QUERY_NO_WAIT 0x8E14
+#define GL_QUERY_BY_REGION_WAIT 0x8E15
+#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+/* Reuse tokens from ARB_depth_buffer_float */
+/* reuse GL_DEPTH_COMPONENT32F */
+/* reuse GL_DEPTH32F_STENCIL8 */
+/* reuse GL_FLOAT_32_UNSIGNED_INT_24_8_REV */
+/* Reuse tokens from ARB_framebuffer_object */
+/* reuse GL_INVALID_FRAMEBUFFER_OPERATION */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+/* reuse GL_FRAMEBUFFER_DEFAULT */
+/* reuse GL_FRAMEBUFFER_UNDEFINED */
+/* reuse GL_DEPTH_STENCIL_ATTACHMENT */
+/* reuse GL_INDEX */
+/* reuse GL_MAX_RENDERBUFFER_SIZE */
+/* reuse GL_DEPTH_STENCIL */
+/* reuse GL_UNSIGNED_INT_24_8 */
+/* reuse GL_DEPTH24_STENCIL8 */
+/* reuse GL_TEXTURE_STENCIL_SIZE */
+/* reuse GL_TEXTURE_RED_TYPE */
+/* reuse GL_TEXTURE_GREEN_TYPE */
+/* reuse GL_TEXTURE_BLUE_TYPE */
+/* reuse GL_TEXTURE_ALPHA_TYPE */
+/* reuse GL_TEXTURE_DEPTH_TYPE */
+/* reuse GL_UNSIGNED_NORMALIZED */
+/* reuse GL_FRAMEBUFFER_BINDING */
+/* reuse GL_DRAW_FRAMEBUFFER_BINDING */
+/* reuse GL_RENDERBUFFER_BINDING */
+/* reuse GL_READ_FRAMEBUFFER */
+/* reuse GL_DRAW_FRAMEBUFFER */
+/* reuse GL_READ_FRAMEBUFFER_BINDING */
+/* reuse GL_RENDERBUFFER_SAMPLES */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+/* reuse GL_FRAMEBUFFER_COMPLETE */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+/* reuse GL_FRAMEBUFFER_UNSUPPORTED */
+/* reuse GL_MAX_COLOR_ATTACHMENTS */
+/* reuse GL_COLOR_ATTACHMENT0 */
+/* reuse GL_COLOR_ATTACHMENT1 */
+/* reuse GL_COLOR_ATTACHMENT2 */
+/* reuse GL_COLOR_ATTACHMENT3 */
+/* reuse GL_COLOR_ATTACHMENT4 */
+/* reuse GL_COLOR_ATTACHMENT5 */
+/* reuse GL_COLOR_ATTACHMENT6 */
+/* reuse GL_COLOR_ATTACHMENT7 */
+/* reuse GL_COLOR_ATTACHMENT8 */
+/* reuse GL_COLOR_ATTACHMENT9 */
+/* reuse GL_COLOR_ATTACHMENT10 */
+/* reuse GL_COLOR_ATTACHMENT11 */
+/* reuse GL_COLOR_ATTACHMENT12 */
+/* reuse GL_COLOR_ATTACHMENT13 */
+/* reuse GL_COLOR_ATTACHMENT14 */
+/* reuse GL_COLOR_ATTACHMENT15 */
+/* reuse GL_DEPTH_ATTACHMENT */
+/* reuse GL_STENCIL_ATTACHMENT */
+/* reuse GL_FRAMEBUFFER */
+/* reuse GL_RENDERBUFFER */
+/* reuse GL_RENDERBUFFER_WIDTH */
+/* reuse GL_RENDERBUFFER_HEIGHT */
+/* reuse GL_RENDERBUFFER_INTERNAL_FORMAT */
+/* reuse GL_STENCIL_INDEX1 */
+/* reuse GL_STENCIL_INDEX4 */
+/* reuse GL_STENCIL_INDEX8 */
+/* reuse GL_STENCIL_INDEX16 */
+/* reuse GL_RENDERBUFFER_RED_SIZE */
+/* reuse GL_RENDERBUFFER_GREEN_SIZE */
+/* reuse GL_RENDERBUFFER_BLUE_SIZE */
+/* reuse GL_RENDERBUFFER_ALPHA_SIZE */
+/* reuse GL_RENDERBUFFER_DEPTH_SIZE */
+/* reuse GL_RENDERBUFFER_STENCIL_SIZE */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+/* reuse GL_MAX_SAMPLES */
+/* Reuse tokens from ARB_framebuffer_sRGB */
+/* reuse GL_FRAMEBUFFER_SRGB */
+/* Reuse tokens from ARB_half_float_vertex */
+/* reuse GL_HALF_FLOAT */
+/* Reuse tokens from ARB_map_buffer_range */
+/* reuse GL_MAP_READ_BIT */
+/* reuse GL_MAP_WRITE_BIT */
+/* reuse GL_MAP_INVALIDATE_RANGE_BIT */
+/* reuse GL_MAP_INVALIDATE_BUFFER_BIT */
+/* reuse GL_MAP_FLUSH_EXPLICIT_BIT */
+/* reuse GL_MAP_UNSYNCHRONIZED_BIT */
+/* Reuse tokens from ARB_texture_compression_rgtc */
+/* reuse GL_COMPRESSED_RED_RGTC1 */
+/* reuse GL_COMPRESSED_SIGNED_RED_RGTC1 */
+/* reuse GL_COMPRESSED_RG_RGTC2 */
+/* reuse GL_COMPRESSED_SIGNED_RG_RGTC2 */
+/* Reuse tokens from ARB_texture_rg */
+/* reuse GL_RG */
+/* reuse GL_RG_INTEGER */
+/* reuse GL_R8 */
+/* reuse GL_R16 */
+/* reuse GL_RG8 */
+/* reuse GL_RG16 */
+/* reuse GL_R16F */
+/* reuse GL_R32F */
+/* reuse GL_RG16F */
+/* reuse GL_RG32F */
+/* reuse GL_R8I */
+/* reuse GL_R8UI */
+/* reuse GL_R16I */
+/* reuse GL_R16UI */
+/* reuse GL_R32I */
+/* reuse GL_R32UI */
+/* reuse GL_RG8I */
+/* reuse GL_RG8UI */
+/* reuse GL_RG16I */
+/* reuse GL_RG16UI */
+/* reuse GL_RG32I */
+/* reuse GL_RG32UI */
+/* Reuse tokens from ARB_vertex_array_object */
+/* reuse GL_VERTEX_ARRAY_BINDING */
+#endif
+
+#ifndef GL_VERSION_3_0_DEPRECATED
+#define GL_CLAMP_VERTEX_COLOR 0x891A
+#define GL_CLAMP_FRAGMENT_COLOR 0x891B
+#define GL_ALPHA_INTEGER 0x8D97
+/* Reuse tokens from ARB_framebuffer_object */
+/* reuse GL_TEXTURE_LUMINANCE_TYPE */
+/* reuse GL_TEXTURE_INTENSITY_TYPE */
+#endif
+
+#ifndef GL_VERSION_3_1
+#define GL_SAMPLER_2D_RECT 0x8B63
+#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
+#define GL_SAMPLER_BUFFER 0x8DC2
+#define GL_INT_SAMPLER_2D_RECT 0x8DCD
+#define GL_INT_SAMPLER_BUFFER 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
+#define GL_TEXTURE_BUFFER 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
+#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
+#define GL_RED_SNORM 0x8F90
+#define GL_RG_SNORM 0x8F91
+#define GL_RGB_SNORM 0x8F92
+#define GL_RGBA_SNORM 0x8F93
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_R16_SNORM 0x8F98
+#define GL_RG16_SNORM 0x8F99
+#define GL_RGB16_SNORM 0x8F9A
+#define GL_RGBA16_SNORM 0x8F9B
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART 0x8F9D
+#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
+/* Reuse tokens from ARB_copy_buffer */
+/* reuse GL_COPY_READ_BUFFER */
+/* reuse GL_COPY_WRITE_BUFFER */
+/* Would reuse tokens from ARB_draw_instanced, but it has none */
+/* Reuse tokens from ARB_uniform_buffer_object */
+/* reuse GL_UNIFORM_BUFFER */
+/* reuse GL_UNIFORM_BUFFER_BINDING */
+/* reuse GL_UNIFORM_BUFFER_START */
+/* reuse GL_UNIFORM_BUFFER_SIZE */
+/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */
+/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */
+/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */
+/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */
+/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */
+/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */
+/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */
+/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */
+/* reuse GL_ACTIVE_UNIFORM_BLOCKS */
+/* reuse GL_UNIFORM_TYPE */
+/* reuse GL_UNIFORM_SIZE */
+/* reuse GL_UNIFORM_NAME_LENGTH */
+/* reuse GL_UNIFORM_BLOCK_INDEX */
+/* reuse GL_UNIFORM_OFFSET */
+/* reuse GL_UNIFORM_ARRAY_STRIDE */
+/* reuse GL_UNIFORM_MATRIX_STRIDE */
+/* reuse GL_UNIFORM_IS_ROW_MAJOR */
+/* reuse GL_UNIFORM_BLOCK_BINDING */
+/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */
+/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */
+/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */
+/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */
+/* reuse GL_INVALID_INDEX */
+#endif
+
+#ifndef GL_VERSION_3_2
+#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define GL_LINES_ADJACENCY 0x000A
+#define GL_LINE_STRIP_ADJACENCY 0x000B
+#define GL_TRIANGLES_ADJACENCY 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
+#define GL_PROGRAM_POINT_SIZE 0x8642
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
+#define GL_GEOMETRY_SHADER 0x8DD9
+#define GL_GEOMETRY_VERTICES_OUT 0x8916
+#define GL_GEOMETRY_INPUT_TYPE 0x8917
+#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_CONTEXT_PROFILE_MASK 0x9126
+/* reuse GL_MAX_VARYING_COMPONENTS */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+/* Reuse tokens from ARB_depth_clamp */
+/* reuse GL_DEPTH_CLAMP */
+/* Would reuse tokens from ARB_draw_elements_base_vertex, but it has none */
+/* Would reuse tokens from ARB_fragment_coord_conventions, but it has none */
+/* Reuse tokens from ARB_provoking_vertex */
+/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+/* reuse GL_FIRST_VERTEX_CONVENTION */
+/* reuse GL_LAST_VERTEX_CONVENTION */
+/* reuse GL_PROVOKING_VERTEX */
+/* Reuse tokens from ARB_seamless_cube_map */
+/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */
+/* Reuse tokens from ARB_sync */
+/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */
+/* reuse GL_OBJECT_TYPE */
+/* reuse GL_SYNC_CONDITION */
+/* reuse GL_SYNC_STATUS */
+/* reuse GL_SYNC_FLAGS */
+/* reuse GL_SYNC_FENCE */
+/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */
+/* reuse GL_UNSIGNALED */
+/* reuse GL_SIGNALED */
+/* reuse GL_ALREADY_SIGNALED */
+/* reuse GL_TIMEOUT_EXPIRED */
+/* reuse GL_CONDITION_SATISFIED */
+/* reuse GL_WAIT_FAILED */
+/* reuse GL_TIMEOUT_IGNORED */
+/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */
+/* reuse GL_TIMEOUT_IGNORED */
+/* Reuse tokens from ARB_texture_multisample */
+/* reuse GL_SAMPLE_POSITION */
+/* reuse GL_SAMPLE_MASK */
+/* reuse GL_SAMPLE_MASK_VALUE */
+/* reuse GL_MAX_SAMPLE_MASK_WORDS */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE */
+/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */
+/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_TEXTURE_SAMPLES */
+/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */
+/* reuse GL_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */
+/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */
+/* reuse GL_MAX_INTEGER_SAMPLES */
+/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */
+#endif
+
#ifndef GL_ARB_multitexture
#define GL_TEXTURE0_ARB 0x84C0
#define GL_TEXTURE1_ARB 0x84C1
@@ -1016,6 +1456,331 @@ extern "C" {
#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
#endif
+#ifndef GL_ARB_depth_buffer_float
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#endif
+
+#ifndef GL_ARB_draw_instanced
+#endif
+
+#ifndef GL_ARB_framebuffer_object
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#define GL_TEXTURE_RED_TYPE 0x8C10
+#define GL_TEXTURE_GREEN_TYPE 0x8C11
+#define GL_TEXTURE_BLUE_TYPE 0x8C12
+#define GL_TEXTURE_ALPHA_TYPE 0x8C13
+#define GL_TEXTURE_DEPTH_TYPE 0x8C16
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
+#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_STENCIL_INDEX1 0x8D46
+#define GL_STENCIL_INDEX4 0x8D47
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_STENCIL_INDEX16 0x8D49
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#endif
+
+#ifndef GL_ARB_framebuffer_object_DEPRECATED
+#define GL_INDEX 0x8222
+#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
+#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
+#endif
+
+#ifndef GL_ARB_framebuffer_sRGB
+#define GL_FRAMEBUFFER_SRGB 0x8DB9
+#endif
+
+#ifndef GL_ARB_geometry_shader4
+#define GL_LINES_ADJACENCY_ARB 0x000A
+#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B
+#define GL_TRIANGLES_ADJACENCY_ARB 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D
+#define GL_PROGRAM_POINT_SIZE_ARB 0x8642
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9
+#define GL_GEOMETRY_SHADER_ARB 0x8DD9
+#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA
+#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB
+#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC
+#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD
+#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1
+/* reuse GL_MAX_VARYING_COMPONENTS */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+#endif
+
+#ifndef GL_ARB_half_float_vertex
+#define GL_HALF_FLOAT 0x140B
+#endif
+
+#ifndef GL_ARB_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
+#endif
+
+#ifndef GL_ARB_map_buffer_range
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#endif
+
+#ifndef GL_ARB_texture_buffer_object
+#define GL_TEXTURE_BUFFER_ARB 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D
+#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E
+#endif
+
+#ifndef GL_ARB_texture_compression_rgtc
+#define GL_COMPRESSED_RED_RGTC1 0x8DBB
+#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
+#define GL_COMPRESSED_RG_RGTC2 0x8DBD
+#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
+#endif
+
+#ifndef GL_ARB_texture_rg
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_R16 0x822A
+#define GL_RG8 0x822B
+#define GL_RG16 0x822C
+#define GL_R16F 0x822D
+#define GL_R32F 0x822E
+#define GL_RG16F 0x822F
+#define GL_RG32F 0x8230
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#endif
+
+#ifndef GL_ARB_vertex_array_object
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#endif
+
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#endif
+
+#ifndef GL_ARB_compatibility
+/* ARB_compatibility just defines tokens from core 3.0 */
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#endif
+
+#ifndef GL_ARB_shader_texture_lod
+#endif
+
+#ifndef GL_ARB_depth_clamp
+#define GL_DEPTH_CLAMP 0x864F
+#endif
+
+#ifndef GL_ARB_draw_elements_base_vertex
+#endif
+
+#ifndef GL_ARB_fragment_coord_conventions
+#endif
+
+#ifndef GL_ARB_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION 0x8E4E
+#define GL_PROVOKING_VERTEX 0x8E4F
+#endif
+
+#ifndef GL_ARB_seamless_cube_map
+#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
+#endif
+
+#ifndef GL_ARB_sync
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#endif
+
+#ifndef GL_ARB_texture_multisample
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#endif
+
+#ifndef GL_ARB_vertex_array_bgra
+/* reuse GL_BGRA */
+#endif
+
+#ifndef GL_ARB_draw_buffers_blend
+#endif
+
+#ifndef GL_ARB_sample_shading
+#define GL_SAMPLE_SHADING 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
+#endif
+
+#ifndef GL_ARB_texture_cube_map_array
+#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B
+#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
+#endif
+
+#ifndef GL_ARB_texture_gather
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F
+#endif
+
+#ifndef GL_ARB_texture_query_lod
+#endif
+
#ifndef GL_EXT_abgr
#define GL_ABGR_EXT 0x8000
#endif
@@ -3001,7 +3766,7 @@ extern "C" {
#endif
#ifndef GL_EXT_blend_equation_separate
-#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION
+#define GL_BLEND_EQUATION_RGB_EXT 0x8009
#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D
#endif
@@ -3055,7 +3820,6 @@ extern "C" {
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
@@ -3100,13 +3864,534 @@ extern "C" {
#ifndef GL_GREMEDY_string_marker
#endif
+#ifndef GL_EXT_packed_depth_stencil
+#define GL_DEPTH_STENCIL_EXT 0x84F9
+#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
+#define GL_DEPTH24_STENCIL8_EXT 0x88F0
+#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
+#endif
+
+#ifndef GL_EXT_stencil_clear_tag
+#define GL_STENCIL_TAG_BITS_EXT 0x88F2
+#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3
+#endif
+
+#ifndef GL_EXT_texture_sRGB
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB8_EXT 0x8C41
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
+#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
+#define GL_SLUMINANCE_EXT 0x8C46
+#define GL_SLUMINANCE8_EXT 0x8C47
+#define GL_COMPRESSED_SRGB_EXT 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
+#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
+#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif
+
+#ifndef GL_EXT_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT
+#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+#endif
+
+#ifndef GL_MESAX_texture_stack
+#define GL_TEXTURE_1D_STACK_MESAX 0x8759
+#define GL_TEXTURE_2D_STACK_MESAX 0x875A
+#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B
+#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C
+#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D
+#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E
+#endif
+
+#ifndef GL_EXT_timer_query
+#define GL_TIME_ELAPSED_EXT 0x88BF
+#endif
+
+#ifndef GL_EXT_gpu_program_parameters
+#endif
+
+#ifndef GL_APPLE_flush_buffer_range
+#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12
+#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13
+#endif
+
+#ifndef GL_NV_gpu_program4
+#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905
+#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906
+#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907
+#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908
+#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909
+#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5
+#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6
+#endif
+
+#ifndef GL_NV_geometry_program4
+#define GL_LINES_ADJACENCY_EXT 0x000A
+#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
+#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
+#define GL_GEOMETRY_PROGRAM_NV 0x8C26
+#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27
+#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28
+#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA
+#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB
+#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
+#define GL_PROGRAM_POINT_SIZE_EXT 0x8642
+#endif
+
+#ifndef GL_EXT_geometry_shader4
+#define GL_GEOMETRY_SHADER_EXT 0x8DD9
+/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */
+/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */
+/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */
+/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */
+#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD
+#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE
+#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
+/* reuse GL_LINES_ADJACENCY_EXT */
+/* reuse GL_LINE_STRIP_ADJACENCY_EXT */
+/* reuse GL_TRIANGLES_ADJACENCY_EXT */
+/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+/* reuse GL_PROGRAM_POINT_SIZE_EXT */
+#endif
+
+#ifndef GL_NV_vertex_program4
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD
+#endif
+
+#ifndef GL_EXT_gpu_shader4
+#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0
+#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
+#define GL_SAMPLER_BUFFER_EXT 0x8DC2
+#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3
+#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5
+#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6
+#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7
+#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8
+#define GL_INT_SAMPLER_1D_EXT 0x8DC9
+#define GL_INT_SAMPLER_2D_EXT 0x8DCA
+#define GL_INT_SAMPLER_3D_EXT 0x8DCB
+#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC
+#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD
+#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE
+#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF
+#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1
+#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5
+#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
+#endif
+
+#ifndef GL_EXT_draw_instanced
+#endif
+
+#ifndef GL_EXT_packed_float
+#define GL_R11F_G11F_B10F_EXT 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B
+#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C
+#endif
+
+#ifndef GL_EXT_texture_array
+#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
+#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
+#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
+#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
+#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
+#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
+#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
+#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+#endif
+
+#ifndef GL_EXT_texture_buffer_object
+#define GL_TEXTURE_BUFFER_EXT 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
+#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E
+#endif
+
+#ifndef GL_EXT_texture_compression_latc
+#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
+#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
+#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
+#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
+#endif
+
+#ifndef GL_EXT_texture_compression_rgtc
+#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
+#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
+#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
+#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
+#endif
+
+#ifndef GL_EXT_texture_shared_exponent
+#define GL_RGB9_E5_EXT 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E
+#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F
+#endif
+
+#ifndef GL_NV_depth_buffer_float
+#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
+#define GL_DEPTH32F_STENCIL8_NV 0x8DAC
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD
+#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF
+#endif
+
+#ifndef GL_NV_fragment_program4
+#endif
+
+#ifndef GL_NV_framebuffer_multisample_coverage
+#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
+#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
+#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
+#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
+#endif
+
+#ifndef GL_EXT_framebuffer_sRGB
+#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
+#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
+#endif
+
+#ifndef GL_NV_geometry_shader4
+#endif
+
+#ifndef GL_NV_parameter_buffer_object
+#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0
+#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1
+#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2
+#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3
+#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4
+#endif
+
+#ifndef GL_EXT_draw_buffers2
+#endif
+
+#ifndef GL_NV_transform_feedback
+#define GL_BACK_PRIMARY_COLOR_NV 0x8C77
+#define GL_BACK_SECONDARY_COLOR_NV 0x8C78
+#define GL_TEXTURE_COORD_NV 0x8C79
+#define GL_CLIP_DISTANCE_NV 0x8C7A
+#define GL_VERTEX_ID_NV 0x8C7B
+#define GL_PRIMITIVE_ID_NV 0x8C7C
+#define GL_GENERIC_ATTRIB_NV 0x8C7D
+#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80
+#define GL_ACTIVE_VARYINGS_NV 0x8C81
+#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82
+#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85
+#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86
+#define GL_PRIMITIVES_GENERATED_NV 0x8C87
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88
+#define GL_RASTERIZER_DISCARD_NV 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C
+#define GL_SEPARATE_ATTRIBS_NV 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F
+#endif
+
+#ifndef GL_EXT_bindable_uniform
+#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2
+#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3
+#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4
+#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED
+#define GL_UNIFORM_BUFFER_EXT 0x8DEE
+#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF
+#endif
+
+#ifndef GL_EXT_texture_integer
+#define GL_RGBA32UI_EXT 0x8D70
+#define GL_RGB32UI_EXT 0x8D71
+#define GL_ALPHA32UI_EXT 0x8D72
+#define GL_INTENSITY32UI_EXT 0x8D73
+#define GL_LUMINANCE32UI_EXT 0x8D74
+#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75
+#define GL_RGBA16UI_EXT 0x8D76
+#define GL_RGB16UI_EXT 0x8D77
+#define GL_ALPHA16UI_EXT 0x8D78
+#define GL_INTENSITY16UI_EXT 0x8D79
+#define GL_LUMINANCE16UI_EXT 0x8D7A
+#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B
+#define GL_RGBA8UI_EXT 0x8D7C
+#define GL_RGB8UI_EXT 0x8D7D
+#define GL_ALPHA8UI_EXT 0x8D7E
+#define GL_INTENSITY8UI_EXT 0x8D7F
+#define GL_LUMINANCE8UI_EXT 0x8D80
+#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81
+#define GL_RGBA32I_EXT 0x8D82
+#define GL_RGB32I_EXT 0x8D83
+#define GL_ALPHA32I_EXT 0x8D84
+#define GL_INTENSITY32I_EXT 0x8D85
+#define GL_LUMINANCE32I_EXT 0x8D86
+#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87
+#define GL_RGBA16I_EXT 0x8D88
+#define GL_RGB16I_EXT 0x8D89
+#define GL_ALPHA16I_EXT 0x8D8A
+#define GL_INTENSITY16I_EXT 0x8D8B
+#define GL_LUMINANCE16I_EXT 0x8D8C
+#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D
+#define GL_RGBA8I_EXT 0x8D8E
+#define GL_RGB8I_EXT 0x8D8F
+#define GL_ALPHA8I_EXT 0x8D90
+#define GL_INTENSITY8I_EXT 0x8D91
+#define GL_LUMINANCE8I_EXT 0x8D92
+#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93
+#define GL_RED_INTEGER_EXT 0x8D94
+#define GL_GREEN_INTEGER_EXT 0x8D95
+#define GL_BLUE_INTEGER_EXT 0x8D96
+#define GL_ALPHA_INTEGER_EXT 0x8D97
+#define GL_RGB_INTEGER_EXT 0x8D98
+#define GL_RGBA_INTEGER_EXT 0x8D99
+#define GL_BGR_INTEGER_EXT 0x8D9A
+#define GL_BGRA_INTEGER_EXT 0x8D9B
+#define GL_LUMINANCE_INTEGER_EXT 0x8D9C
+#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D
+#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E
+#endif
+
+#ifndef GL_GREMEDY_frame_terminator
+#endif
+
+#ifndef GL_NV_conditional_render
+#define GL_QUERY_WAIT_NV 0x8E13
+#define GL_QUERY_NO_WAIT_NV 0x8E14
+#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
+#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
+#endif
+
+#ifndef GL_NV_present_video
+#define GL_FRAME_NV 0x8E26
+#define GL_FIELDS_NV 0x8E27
+#define GL_CURRENT_TIME_NV 0x8E28
+#define GL_NUM_FILL_STREAMS_NV 0x8E29
+#define GL_PRESENT_TIME_NV 0x8E2A
+#define GL_PRESENT_DURATION_NV 0x8E2B
+#endif
+
+#ifndef GL_EXT_transform_feedback
+#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F
+#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C
+#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D
+#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88
+#define GL_RASTERIZER_DISCARD_EXT 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76
+#endif
+
+#ifndef GL_EXT_direct_state_access
+#define GL_PROGRAM_MATRIX_EXT 0x8E2D
+#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E
+#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F
+#endif
+
+#ifndef GL_EXT_vertex_array_bgra
+/* reuse GL_BGRA */
+#endif
+
+#ifndef GL_EXT_texture_swizzle
+#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42
+#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43
+#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44
+#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45
+#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46
+#endif
+
+#ifndef GL_NV_explicit_multisample
+#define GL_SAMPLE_POSITION_NV 0x8E50
+#define GL_SAMPLE_MASK_NV 0x8E51
+#define GL_SAMPLE_MASK_VALUE_NV 0x8E52
+#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53
+#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54
+#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55
+#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56
+#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57
+#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58
+#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59
+#endif
+
+#ifndef GL_NV_transform_feedback2
+#define GL_TRANSFORM_FEEDBACK_NV 0x8E22
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25
+#endif
+
+#ifndef GL_ATI_meminfo
+#define GL_VBO_FREE_MEMORY_ATI 0x87FB
+#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
+#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
+#endif
+
+#ifndef GL_AMD_performance_monitor
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+#endif
+
+#ifndef GL_AMD_texture_texture4
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_SAMPLER_BUFFER_AMD 0x9001
+#define GL_INT_SAMPLER_BUFFER_AMD 0x9002
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003
+#define GL_TESSELLATION_MODE_AMD 0x9004
+#define GL_TESSELLATION_FACTOR_AMD 0x9005
+#define GL_DISCRETE_AMD 0x9006
+#define GL_CONTINUOUS_AMD 0x9007
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
+#define GL_PROVOKING_VERTEX_EXT 0x8E4F
+#endif
+
+#ifndef GL_EXT_texture_snorm
+#define GL_ALPHA_SNORM 0x9010
+#define GL_LUMINANCE_SNORM 0x9011
+#define GL_LUMINANCE_ALPHA_SNORM 0x9012
+#define GL_INTENSITY_SNORM 0x9013
+#define GL_ALPHA8_SNORM 0x9014
+#define GL_LUMINANCE8_SNORM 0x9015
+#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016
+#define GL_INTENSITY8_SNORM 0x9017
+#define GL_ALPHA16_SNORM 0x9018
+#define GL_LUMINANCE16_SNORM 0x9019
+#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A
+#define GL_INTENSITY16_SNORM 0x901B
+/* reuse GL_R_SNORM */
+/* reuse GL_RG_SNORM */
+/* reuse GL_RGB_SNORM */
+/* reuse GL_RGBA_SNORM */
+/* reuse GL_R8_SNORM */
+/* reuse GL_RG8_SNORM */
+/* reuse GL_RGB8_SNORM */
+/* reuse GL_RGBA8_SNORM */
+/* reuse GL_R16_SNORM */
+/* reuse GL_RG16_SNORM */
+/* reuse GL_RGB16_SNORM */
+/* reuse GL_RGBA16_SNORM */
+/* reuse GL_SIGNED_NORMALIZED */
+#endif
+
+#ifndef GL_AMD_draw_buffers_blend
+#endif
+
+#ifndef GL_APPLE_texture_range
+#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7
+#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8
+#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC
+#define GL_STORAGE_PRIVATE_APPLE 0x85BD
+/* reuse GL_STORAGE_CACHED_APPLE */
+/* reuse GL_STORAGE_SHARED_APPLE */
+#endif
+
+#ifndef GL_APPLE_float_pixels
+#define GL_HALF_APPLE 0x140B
+#define GL_RGBA_FLOAT32_APPLE 0x8814
+#define GL_RGB_FLOAT32_APPLE 0x8815
+#define GL_ALPHA_FLOAT32_APPLE 0x8816
+#define GL_INTENSITY_FLOAT32_APPLE 0x8817
+#define GL_LUMINANCE_FLOAT32_APPLE 0x8818
+#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819
+#define GL_RGBA_FLOAT16_APPLE 0x881A
+#define GL_RGB_FLOAT16_APPLE 0x881B
+#define GL_ALPHA_FLOAT16_APPLE 0x881C
+#define GL_INTENSITY_FLOAT16_APPLE 0x881D
+#define GL_LUMINANCE_FLOAT16_APPLE 0x881E
+#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F
+#define GL_COLOR_FLOAT_APPLE 0x8A0F
+#endif
+
+#ifndef GL_APPLE_vertex_program_evaluators
+#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00
+#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01
+#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02
+#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03
+#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04
+#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05
+#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06
+#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07
+#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08
+#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09
+#endif
+
+#ifndef GL_APPLE_aux_depth_stencil
+#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14
+#endif
+
+#ifndef GL_APPLE_object_purgeable
+#define GL_BUFFER_OBJECT_APPLE 0x85B3
+#define GL_RELEASED_APPLE 0x8A19
+#define GL_VOLATILE_APPLE 0x8A1A
+#define GL_RETAINED_APPLE 0x8A1B
+#define GL_UNDEFINED_APPLE 0x8A1C
+#define GL_PURGEABLE_APPLE 0x8A1D
+#endif
+
+#ifndef GL_APPLE_row_bytes
+#define GL_PACK_ROW_BYTES_APPLE 0x8A15
+#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16
+#endif
+
/*************************************************************/
#include
#ifndef GL_VERSION_2_0
/* GL type for program/shader text */
-typedef char GLchar; /* native character */
+typedef char GLchar;
#endif
#ifndef GL_VERSION_1_5
@@ -3122,12 +4407,12 @@ typedef ptrdiff_t GLsizeiptrARB;
#endif
#ifndef GL_ARB_shader_objects
-/* GL types for handling shader object handles and program/shader text */
-typedef char GLcharARB; /* native character */
-typedef unsigned int GLhandleARB; /* shader object handle */
+/* GL types for program/shader text and shader object handles */
+typedef char GLcharARB;
+typedef unsigned int GLhandleARB;
#endif
-/* GL types for "half" precision (s10e5) float data in host memory */
+/* GL type for "half" precision (s10e5) float data in host memory */
#ifndef GL_ARB_half_float_pixel
typedef unsigned short GLhalfARB;
#endif
@@ -3136,12 +4421,76 @@ typedef unsigned short GLhalfARB;
typedef unsigned short GLhalfNV;
#endif
+#ifndef GLEXT_64_TYPES_DEFINED
+/* This code block is duplicated in glxext.h, so must be protected */
+#define GLEXT_64_TYPES_DEFINED
+/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
+/* (as used in the GL_EXT_timer_query extension). */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include
+#elif defined(__sun__) || defined(__digital__)
+#include
+#if defined(__STDC__)
+#if defined(__arch64__) || defined(_LP64)
+typedef long int int64_t;
+typedef unsigned long int uint64_t;
+#else
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#endif /* __arch64__ */
+#endif /* __STDC__ */
+#elif defined( __VMS ) || defined(__sgi)
+#include
+#elif defined(__SCO__) || defined(__USLC__)
+#include
+#elif defined(__UNIXOS2__) || defined(__SOL64__)
+typedef long int int32_t;
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#elif defined(_WIN32) && (defined(__GNUC__) || defined(__WATCOMC__))
+#include
+#elif defined(_WIN32)
+typedef __int32 int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#else
+/* Fallback if nothing above works */
+#include
+#endif
+#endif
+
+#ifndef GL_EXT_timer_query
+typedef int64_t GLint64EXT;
+typedef uint64_t GLuint64EXT;
+#endif
+
+#ifndef ARB_sync
+typedef int64_t GLint64;
+typedef uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+#endif
+
#ifndef GL_VERSION_1_2
#define GL_VERSION_1_2 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf);
GLAPI void APIENTRY glBlendEquation (GLenum);
GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_VERSION_1_2_DEPRECATED
+#define GL_VERSION_1_2_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *);
GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *);
@@ -3174,13 +4523,7 @@ GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean);
GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean);
GLAPI void APIENTRY glResetHistogram (GLenum);
GLAPI void APIENTRY glResetMinmax (GLenum);
-GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
@@ -3213,15 +4556,35 @@ typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenu
typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
#endif
#ifndef GL_VERSION_1_3
#define GL_VERSION_1_3 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glActiveTexture (GLenum);
+GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean);
+GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
+#endif
+
+#ifndef GL_VERSION_1_3_DEPRECATED
+#define GL_VERSION_1_3_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glClientActiveTexture (GLenum);
GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble);
GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *);
@@ -3259,16 +4622,7 @@ GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *);
GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *);
GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *);
GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *);
-GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean);
-GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *);
#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
@@ -3306,31 +4660,36 @@ typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
#endif
#ifndef GL_VERSION_1_4
#define GL_VERSION_1_4 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glFogCoordf (GLfloat);
-GLAPI void APIENTRY glFogCoordfv (const GLfloat *);
-GLAPI void APIENTRY glFogCoordd (GLdouble);
-GLAPI void APIENTRY glFogCoorddv (const GLdouble *);
-GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei);
GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat);
GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *);
GLAPI void APIENTRY glPointParameteri (GLenum, GLint);
GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_VERSION_1_4_DEPRECATED
+#define GL_VERSION_1_4_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFogCoordf (GLfloat);
+GLAPI void APIENTRY glFogCoordfv (const GLfloat *);
+GLAPI void APIENTRY glFogCoordd (GLdouble);
+GLAPI void APIENTRY glFogCoorddv (const GLdouble *);
+GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte);
GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *);
GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble);
@@ -3365,18 +4724,11 @@ GLAPI void APIENTRY glWindowPos3iv (const GLint *);
GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort);
GLAPI void APIENTRY glWindowPos3sv (const GLshort *);
#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
@@ -3648,6 +5000,188 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
#endif
+#ifndef GL_VERSION_2_1
+#define GL_VERSION_2_1 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniformMatrix2x3fv (GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glUniformMatrix3x2fv (GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glUniformMatrix2x4fv (GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glUniformMatrix4x2fv (GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glUniformMatrix3x4fv (GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glUniformMatrix4x3fv (GLint, GLsizei, GLboolean, const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+
+#ifndef GL_VERSION_3_0
+#define GL_VERSION_3_0 1
+/* OpenGL 3.0 also reuses entry points from these extensions: */
+/* ARB_framebuffer_object */
+/* ARB_map_buffer_range */
+/* ARB_vertex_array_object */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorMaski (GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
+GLAPI void APIENTRY glGetBooleani_v (GLenum, GLuint, GLboolean *);
+GLAPI void APIENTRY glGetIntegeri_v (GLenum, GLuint, GLint *);
+GLAPI void APIENTRY glEnablei (GLenum, GLuint);
+GLAPI void APIENTRY glDisablei (GLenum, GLuint);
+GLAPI GLboolean APIENTRY glIsEnabledi (GLenum, GLuint);
+GLAPI void APIENTRY glBeginTransformFeedback (GLenum);
+GLAPI void APIENTRY glEndTransformFeedback (void);
+GLAPI void APIENTRY glBindBufferRange (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
+GLAPI void APIENTRY glBindBufferBase (GLenum, GLuint, GLuint);
+GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLchar* *, GLenum);
+GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
+GLAPI void APIENTRY glClampColor (GLenum, GLenum);
+GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum);
+GLAPI void APIENTRY glEndConditionalRender (void);
+GLAPI void APIENTRY glVertexAttribIPointer (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glGetVertexAttribIiv (GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint, GLenum, GLuint *);
+GLAPI void APIENTRY glVertexAttribI1i (GLuint, GLint);
+GLAPI void APIENTRY glVertexAttribI2i (GLuint, GLint, GLint);
+GLAPI void APIENTRY glVertexAttribI3i (GLuint, GLint, GLint, GLint);
+GLAPI void APIENTRY glVertexAttribI4i (GLuint, GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glVertexAttribI1ui (GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI2ui (GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI3ui (GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI4ui (GLuint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI1iv (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI2iv (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI3iv (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI4iv (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI1uiv (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI2uiv (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI3uiv (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI4uiv (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI4bv (GLuint, const GLbyte *);
+GLAPI void APIENTRY glVertexAttribI4sv (GLuint, const GLshort *);
+GLAPI void APIENTRY glVertexAttribI4ubv (GLuint, const GLubyte *);
+GLAPI void APIENTRY glVertexAttribI4usv (GLuint, const GLushort *);
+GLAPI void APIENTRY glGetUniformuiv (GLuint, GLint, GLuint *);
+GLAPI void APIENTRY glBindFragDataLocation (GLuint, GLuint, const GLchar *);
+GLAPI GLint APIENTRY glGetFragDataLocation (GLuint, const GLchar *);
+GLAPI void APIENTRY glUniform1ui (GLint, GLuint);
+GLAPI void APIENTRY glUniform2ui (GLint, GLuint, GLuint);
+GLAPI void APIENTRY glUniform3ui (GLint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glUniform4ui (GLint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glUniform1uiv (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glUniform2uiv (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glUniform3uiv (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glUniform4uiv (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glTexParameterIiv (GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glTexParameterIuiv (GLenum, GLenum, const GLuint *);
+GLAPI void APIENTRY glGetTexParameterIiv (GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetTexParameterIuiv (GLenum, GLenum, GLuint *);
+GLAPI void APIENTRY glClearBufferiv (GLenum, GLint, const GLint *);
+GLAPI void APIENTRY glClearBufferuiv (GLenum, GLint, const GLuint *);
+GLAPI void APIENTRY glClearBufferfv (GLenum, GLint, const GLfloat *);
+GLAPI void APIENTRY glClearBufferfi (GLenum, GLint, GLfloat, GLint);
+GLAPI const GLubyte * APIENTRY glGetStringi (GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
+typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
+typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
+typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
+typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
+typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
+typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
+typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
+typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
+typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
+typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
+#endif
+
+#ifndef GL_VERSION_3_1
+#define GL_VERSION_3_1 1
+/* OpenGL 3.1 also reuses entry points from these extensions: */
+/* ARB_copy_buffer */
+/* ARB_uniform_buffer_object */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstanced (GLenum, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glDrawElementsInstanced (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
+GLAPI void APIENTRY glTexBuffer (GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
+#endif
+
+#ifndef GL_VERSION_3_2
+#define GL_VERSION_3_2 1
+/* OpenGL 3.2 also reuses entry points from these extensions: */
+/* ARB_draw_elements_base_vertex */
+/* ARB_provoking_vertex */
+/* ARB_sync */
+/* ARB_texture_multisample */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetInteger64i_v (GLenum, GLuint, GLint64 *);
+GLAPI void APIENTRY glGetBufferParameteri64v (GLenum, GLenum, GLint64 *);
+GLAPI void APIENTRY glProgramParameteri (GLuint, GLenum, GLint);
+GLAPI void APIENTRY glFramebufferTexture (GLenum, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glFramebufferTextureFace (GLenum, GLenum, GLuint, GLint, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
+typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
+#endif
+
#ifndef GL_ARB_multitexture
#define GL_ARB_multitexture 1
#ifdef GL_GLEXT_PROTOTYPES
@@ -4227,6 +5761,278 @@ typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
#define GL_ARB_pixel_buffer_object 1
#endif
+#ifndef GL_ARB_depth_buffer_float
+#define GL_ARB_depth_buffer_float 1
+#endif
+
+#ifndef GL_ARB_draw_instanced
+#define GL_ARB_draw_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+
+#ifndef GL_ARB_framebuffer_object
+#define GL_ARB_framebuffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint);
+GLAPI void APIENTRY glBindRenderbuffer (GLenum, GLuint);
+GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei, const GLuint *);
+GLAPI void APIENTRY glGenRenderbuffers (GLsizei, GLuint *);
+GLAPI void APIENTRY glRenderbufferStorage (GLenum, GLenum, GLsizei, GLsizei);
+GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum, GLenum, GLint *);
+GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint);
+GLAPI void APIENTRY glBindFramebuffer (GLenum, GLuint);
+GLAPI void APIENTRY glDeleteFramebuffers (GLsizei, const GLuint *);
+GLAPI void APIENTRY glGenFramebuffers (GLsizei, GLuint *);
+GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum);
+GLAPI void APIENTRY glFramebufferTexture1D (GLenum, GLenum, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glFramebufferTexture2D (GLenum, GLenum, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glFramebufferTexture3D (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
+GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum, GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGenerateMipmap (GLenum);
+GLAPI void APIENTRY glBlitFramebuffer (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GLAPI void APIENTRY glFramebufferTextureLayer (GLenum, GLenum, GLuint, GLint, GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
+typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
+typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+#endif
+
+#ifndef GL_ARB_framebuffer_sRGB
+#define GL_ARB_framebuffer_sRGB 1
+#endif
+
+#ifndef GL_ARB_geometry_shader4
+#define GL_ARB_geometry_shader4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramParameteriARB (GLuint, GLenum, GLint);
+GLAPI void APIENTRY glFramebufferTextureARB (GLenum, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum, GLenum, GLuint, GLint, GLint);
+GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum, GLenum, GLuint, GLint, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
+#endif
+
+#ifndef GL_ARB_half_float_vertex
+#define GL_ARB_half_float_vertex 1
+#endif
+
+#ifndef GL_ARB_instanced_arrays
+#define GL_ARB_instanced_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
+#endif
+
+#ifndef GL_ARB_map_buffer_range
+#define GL_ARB_map_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum, GLintptr, GLsizeiptr, GLbitfield);
+GLAPI void APIENTRY glFlushMappedBufferRange (GLenum, GLintptr, GLsizeiptr);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+
+#ifndef GL_ARB_texture_buffer_object
+#define GL_ARB_texture_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexBufferARB (GLenum, GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+#endif
+
+#ifndef GL_ARB_texture_compression_rgtc
+#define GL_ARB_texture_compression_rgtc 1
+#endif
+
+#ifndef GL_ARB_texture_rg
+#define GL_ARB_texture_rg 1
+#endif
+
+#ifndef GL_ARB_vertex_array_object
+#define GL_ARB_vertex_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindVertexArray (GLuint);
+GLAPI void APIENTRY glDeleteVertexArrays (GLsizei, const GLuint *);
+GLAPI void APIENTRY glGenVertexArrays (GLsizei, GLuint *);
+GLAPI GLboolean APIENTRY glIsVertexArray (GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
+typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
+typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
+#endif
+
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_ARB_uniform_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetUniformIndices (GLuint, GLsizei, const GLchar* *, GLuint *);
+GLAPI void APIENTRY glGetActiveUniformsiv (GLuint, GLsizei, const GLuint *, GLenum, GLint *);
+GLAPI void APIENTRY glGetActiveUniformName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint, const GLchar *);
+GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint, GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI void APIENTRY glUniformBlockBinding (GLuint, GLuint, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
+typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+#endif
+
+#ifndef GL_ARB_compatibility
+#define GL_ARB_compatibility 1
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_ARB_copy_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyBufferSubData (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+
+#ifndef GL_ARB_shader_texture_lod
+#define GL_ARB_shader_texture_lod 1
+#endif
+
+#ifndef GL_ARB_depth_clamp
+#define GL_ARB_depth_clamp 1
+#endif
+
+#ifndef GL_ARB_draw_elements_base_vertex
+#define GL_ARB_draw_elements_base_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum, GLsizei, GLenum, const GLvoid *, GLint);
+GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint);
+GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint);
+GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei, const GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex);
+#endif
+
+#ifndef GL_ARB_fragment_coord_conventions
+#define GL_ARB_fragment_coord_conventions 1
+#endif
+
+#ifndef GL_ARB_provoking_vertex
+#define GL_ARB_provoking_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProvokingVertex (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
+#endif
+
+#ifndef GL_ARB_seamless_cube_map
+#define GL_ARB_seamless_cube_map 1
+#endif
+
+#ifndef GL_ARB_sync
+#define GL_ARB_sync 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLsync APIENTRY glFenceSync (GLenum, GLbitfield);
+GLAPI GLboolean APIENTRY glIsSync (GLsync);
+GLAPI void APIENTRY glDeleteSync (GLsync);
+GLAPI GLenum APIENTRY glClientWaitSync (GLsync, GLbitfield, GLuint64);
+GLAPI void APIENTRY glWaitSync (GLsync, GLbitfield, GLuint64);
+GLAPI void APIENTRY glGetInteger64v (GLenum, GLint64 *);
+GLAPI void APIENTRY glGetSynciv (GLsync, GLenum, GLsizei, GLsizei *, GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
+typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
+typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+
+#ifndef GL_ARB_texture_multisample
+#define GL_ARB_texture_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexImage2DMultisample (GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean);
+GLAPI void APIENTRY glTexImage3DMultisample (GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean);
+GLAPI void APIENTRY glGetMultisamplefv (GLenum, GLuint, GLfloat *);
+GLAPI void APIENTRY glSampleMaski (GLuint, GLbitfield);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);
+#endif
+
+#ifndef GL_ARB_vertex_array_bgra
+#define GL_ARB_vertex_array_bgra 1
+#endif
+
+#ifndef GL_ARB_draw_buffers_blend
+#define GL_ARB_draw_buffers_blend 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendEquationi (GLuint, GLenum);
+GLAPI void APIENTRY glBlendEquationSeparatei (GLuint, GLenum, GLenum);
+GLAPI void APIENTRY glBlendFunci (GLuint, GLenum, GLenum);
+GLAPI void APIENTRY glBlendFuncSeparatei (GLuint, GLenum, GLenum, GLenum, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+
+#ifndef GL_ARB_sample_shading
+#define GL_ARB_sample_shading 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMinSampleShading (GLclampf);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLclampf value);
+#endif
+
+#ifndef GL_ARB_texture_cube_map_array
+#define GL_ARB_texture_cube_map_array 1
+#endif
+
+#ifndef GL_ARB_texture_gather
+#define GL_ARB_texture_gather 1
+#endif
+
+#ifndef GL_ARB_texture_query_lod
+#define GL_ARB_texture_query_lod 1
+#endif
+
#ifndef GL_EXT_abgr
#define GL_EXT_abgr 1
#endif
@@ -4355,8 +6161,8 @@ typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum f
typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
#endif
-#ifndef GL_EXT_color_matrix
-#define GL_EXT_color_matrix 1
+#ifndef GL_SGI_color_matrix
+#define GL_SGI_color_matrix 1
#endif
#ifndef GL_SGI_color_table
@@ -6216,12 +8022,12 @@ typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint);
GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *);
+GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, GLuint *);
GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
-typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
+typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays);
typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
#endif
@@ -6549,11 +8355,979 @@ GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *);
typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string);
#endif
+#ifndef GL_EXT_packed_depth_stencil
+#define GL_EXT_packed_depth_stencil 1
+#endif
+
+#ifndef GL_EXT_stencil_clear_tag
+#define GL_EXT_stencil_clear_tag 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glStencilClearTagEXT (GLsizei, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag);
+#endif
+
+#ifndef GL_EXT_texture_sRGB
+#define GL_EXT_texture_sRGB 1
+#endif
+
+#ifndef GL_EXT_framebuffer_blit
+#define GL_EXT_framebuffer_blit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlitFramebufferEXT (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample
+#define GL_EXT_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_MESAX_texture_stack
+#define GL_MESAX_texture_stack 1
+#endif
+
+#ifndef GL_EXT_timer_query
+#define GL_EXT_timer_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint, GLenum, GLint64EXT *);
+GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint, GLenum, GLuint64EXT *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);
+#endif
+
+#ifndef GL_EXT_gpu_program_parameters
+#define GL_EXT_gpu_program_parameters 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+#endif
+
+#ifndef GL_APPLE_flush_buffer_range
+#define GL_APPLE_flush_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum, GLenum, GLint);
+GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum, GLintptr, GLsizeiptr);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);
+#endif
+
+#ifndef GL_NV_gpu_program4
+#define GL_NV_gpu_program4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum, GLuint, const GLint *);
+GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *);
+GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum, GLuint, const GLuint *);
+GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum, GLuint, const GLint *);
+GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *);
+GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum, GLuint, const GLuint *);
+GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum, GLuint, GLint *);
+GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum, GLuint, GLuint *);
+GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum, GLuint, GLint *);
+GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum, GLuint, GLuint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
+#endif
+
+#ifndef GL_NV_geometry_program4
+#define GL_NV_geometry_program4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramVertexLimitNV (GLenum, GLint);
+GLAPI void APIENTRY glFramebufferTextureEXT (GLenum, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum, GLenum, GLuint, GLint, GLint);
+GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum, GLenum, GLuint, GLint, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
+#endif
+
+#ifndef GL_EXT_geometry_shader4
+#define GL_EXT_geometry_shader4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramParameteriEXT (GLuint, GLenum, GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+#endif
+
+#ifndef GL_NV_vertex_program4
+#define GL_NV_vertex_program4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint, GLint);
+GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint, GLint, GLint);
+GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint, GLint, GLint, GLint);
+GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint, GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint, const GLint *);
+GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint, const GLuint *);
+GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint, const GLbyte *);
+GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint, const GLshort *);
+GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint, const GLubyte *);
+GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint, const GLushort *);
+GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint, GLenum, GLuint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
+#endif
+
+#ifndef GL_EXT_gpu_shader4
+#define GL_EXT_gpu_shader4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetUniformuivEXT (GLuint, GLint, GLuint *);
+GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint, GLuint, const GLchar *);
+GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint, const GLchar *);
+GLAPI void APIENTRY glUniform1uiEXT (GLint, GLuint);
+GLAPI void APIENTRY glUniform2uiEXT (GLint, GLuint, GLuint);
+GLAPI void APIENTRY glUniform3uiEXT (GLint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glUniform4uiEXT (GLint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glUniform1uivEXT (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glUniform2uivEXT (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glUniform3uivEXT (GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glUniform4uivEXT (GLint, GLsizei, const GLuint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
+typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+#endif
+
+#ifndef GL_EXT_draw_instanced
+#define GL_EXT_draw_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+
+#ifndef GL_EXT_packed_float
+#define GL_EXT_packed_float 1
+#endif
+
+#ifndef GL_EXT_texture_array
+#define GL_EXT_texture_array 1
+#endif
+
+#ifndef GL_EXT_texture_buffer_object
+#define GL_EXT_texture_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexBufferEXT (GLenum, GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+#endif
+
+#ifndef GL_EXT_texture_compression_latc
+#define GL_EXT_texture_compression_latc 1
+#endif
+
+#ifndef GL_EXT_texture_compression_rgtc
+#define GL_EXT_texture_compression_rgtc 1
+#endif
+
+#ifndef GL_EXT_texture_shared_exponent
+#define GL_EXT_texture_shared_exponent 1
+#endif
+
+#ifndef GL_NV_depth_buffer_float
+#define GL_NV_depth_buffer_float 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDepthRangedNV (GLdouble, GLdouble);
+GLAPI void APIENTRY glClearDepthdNV (GLdouble);
+GLAPI void APIENTRY glDepthBoundsdNV (GLdouble, GLdouble);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);
+typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);
+typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);
+#endif
+
+#ifndef GL_NV_fragment_program4
+#define GL_NV_fragment_program4 1
+#endif
+
+#ifndef GL_NV_framebuffer_multisample_coverage
+#define GL_NV_framebuffer_multisample_coverage 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_EXT_framebuffer_sRGB
+#define GL_EXT_framebuffer_sRGB 1
+#endif
+
+#ifndef GL_NV_geometry_shader4
+#define GL_NV_geometry_shader4 1
+#endif
+
+#ifndef GL_NV_parameter_buffer_object
+#define GL_NV_parameter_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum, GLuint, GLuint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum, GLuint, GLuint, GLsizei, const GLint *);
+GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum, GLuint, GLuint, GLsizei, const GLuint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);
+typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);
+#endif
+
+#ifndef GL_EXT_draw_buffers2
+#define GL_EXT_draw_buffers2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
+GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum, GLuint, GLboolean *);
+GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum, GLuint, GLint *);
+GLAPI void APIENTRY glEnableIndexedEXT (GLenum, GLuint);
+GLAPI void APIENTRY glDisableIndexedEXT (GLenum, GLuint);
+GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);
+typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data);
+typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
+typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);
+#endif
+
+#ifndef GL_NV_transform_feedback
+#define GL_NV_transform_feedback 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum);
+GLAPI void APIENTRY glEndTransformFeedbackNV (void);
+GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint, const GLint *, GLenum);
+GLAPI void APIENTRY glBindBufferRangeNV (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
+GLAPI void APIENTRY glBindBufferOffsetNV (GLenum, GLuint, GLuint, GLintptr);
+GLAPI void APIENTRY glBindBufferBaseNV (GLenum, GLuint, GLuint);
+GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint, GLsizei, const GLchar* *, GLenum);
+GLAPI void APIENTRY glActiveVaryingNV (GLuint, const GLchar *);
+GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint, const GLchar *);
+GLAPI void APIENTRY glGetActiveVaryingNV (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint, GLuint, GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);
+typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);
+#endif
+
+#ifndef GL_EXT_bindable_uniform
+#define GL_EXT_bindable_uniform 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniformBufferEXT (GLuint, GLint, GLuint);
+GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint, GLint);
+GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint, GLint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);
+typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);
+typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);
+#endif
+
+#ifndef GL_EXT_texture_integer
+#define GL_EXT_texture_integer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexParameterIivEXT (GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glTexParameterIuivEXT (GLenum, GLenum, const GLuint *);
+GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum, GLenum, GLuint *);
+GLAPI void APIENTRY glClearColorIiEXT (GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glClearColorIuiEXT (GLuint, GLuint, GLuint, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);
+typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);
+#endif
+
+#ifndef GL_GREMEDY_frame_terminator
+#define GL_GREMEDY_frame_terminator 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFrameTerminatorGREMEDY (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);
+#endif
+
+#ifndef GL_NV_conditional_render
+#define GL_NV_conditional_render 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint, GLenum);
+GLAPI void APIENTRY glEndConditionalRenderNV (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
+typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
+#endif
+
+#ifndef GL_NV_present_video
+#define GL_NV_present_video 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint);
+GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint);
+GLAPI void APIENTRY glGetVideoivNV (GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetVideouivNV (GLuint, GLenum, GLuint *);
+GLAPI void APIENTRY glGetVideoi64vNV (GLuint, GLenum, GLint64EXT *);
+GLAPI void APIENTRY glGetVideoui64vNV (GLuint, GLenum, GLuint64EXT *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
+typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
+typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);
+#endif
+
+#ifndef GL_EXT_transform_feedback
+#define GL_EXT_transform_feedback 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum);
+GLAPI void APIENTRY glEndTransformFeedbackEXT (void);
+GLAPI void APIENTRY glBindBufferRangeEXT (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
+GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum, GLuint, GLuint, GLintptr);
+GLAPI void APIENTRY glBindBufferBaseEXT (GLenum, GLuint, GLuint);
+GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLchar* *, GLenum);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
+typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
+typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+#endif
+
+#ifndef GL_EXT_direct_state_access
+#define GL_EXT_direct_state_access 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield);
+GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield);
+GLAPI void APIENTRY glMatrixLoadfEXT (GLenum, const GLfloat *);
+GLAPI void APIENTRY glMatrixLoaddEXT (GLenum, const GLdouble *);
+GLAPI void APIENTRY glMatrixMultfEXT (GLenum, const GLfloat *);
+GLAPI void APIENTRY glMatrixMultdEXT (GLenum, const GLdouble *);
+GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum);
+GLAPI void APIENTRY glMatrixRotatefEXT (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
+GLAPI void APIENTRY glMatrixRotatedEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
+GLAPI void APIENTRY glMatrixScalefEXT (GLenum, GLfloat, GLfloat, GLfloat);
+GLAPI void APIENTRY glMatrixScaledEXT (GLenum, GLdouble, GLdouble, GLdouble);
+GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum, GLfloat, GLfloat, GLfloat);
+GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum, GLdouble, GLdouble, GLdouble);
+GLAPI void APIENTRY glMatrixFrustumEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
+GLAPI void APIENTRY glMatrixOrthoEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
+GLAPI void APIENTRY glMatrixPopEXT (GLenum);
+GLAPI void APIENTRY glMatrixPushEXT (GLenum);
+GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum, const GLfloat *);
+GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum, const GLdouble *);
+GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum, const GLfloat *);
+GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum, const GLdouble *);
+GLAPI void APIENTRY glTextureParameterfEXT (GLuint, GLenum, GLenum, GLfloat);
+GLAPI void APIENTRY glTextureParameterfvEXT (GLuint, GLenum, GLenum, const GLfloat *);
+GLAPI void APIENTRY glTextureParameteriEXT (GLuint, GLenum, GLenum, GLint);
+GLAPI void APIENTRY glTextureParameterivEXT (GLuint, GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
+GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
+GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei);
+GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glGetTextureImageEXT (GLuint, GLenum, GLint, GLenum, GLenum, GLvoid *);
+GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint, GLenum, GLenum, GLfloat *);
+GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint, GLenum, GLint, GLenum, GLfloat *);
+GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint, GLenum, GLint, GLenum, GLint *);
+GLAPI void APIENTRY glTextureImage3DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum, GLenum, GLenum, GLfloat);
+GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum, GLenum, GLenum, const GLfloat *);
+GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum, GLenum, GLenum, GLint);
+GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum, GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
+GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
+GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei);
+GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum, GLenum, GLint, GLenum, GLenum, GLvoid *);
+GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum, GLenum, GLenum, GLfloat *);
+GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum, GLenum, GLint, GLenum, GLfloat *);
+GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum, GLenum, GLint, GLenum, GLint *);
+GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+GLAPI void APIENTRY glBindMultiTextureEXT (GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum, GLuint);
+GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum, GLuint);
+GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum, GLint, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum, GLenum, GLenum, GLfloat);
+GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum, GLenum, GLenum, const GLfloat *);
+GLAPI void APIENTRY glMultiTexEnviEXT (GLenum, GLenum, GLenum, GLint);
+GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum, GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glMultiTexGendEXT (GLenum, GLenum, GLenum, GLdouble);
+GLAPI void APIENTRY glMultiTexGendvEXT (GLenum, GLenum, GLenum, const GLdouble *);
+GLAPI void APIENTRY glMultiTexGenfEXT (GLenum, GLenum, GLenum, GLfloat);
+GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum, GLenum, GLenum, const GLfloat *);
+GLAPI void APIENTRY glMultiTexGeniEXT (GLenum, GLenum, GLenum, GLint);
+GLAPI void APIENTRY glMultiTexGenivEXT (GLenum, GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum, GLenum, GLenum, GLfloat *);
+GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum, GLenum, GLenum, GLdouble *);
+GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum, GLenum, GLenum, GLfloat *);
+GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum, GLuint, GLfloat *);
+GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum, GLuint, GLdouble *);
+GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum, GLuint, GLvoid* *);
+GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint, GLenum, GLint, GLvoid *);
+GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum, GLenum, GLint, GLvoid *);
+GLAPI void APIENTRY glNamedProgramStringEXT (GLuint, GLenum, GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint, GLenum, GLuint, const GLdouble *);
+GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint, GLenum, GLuint, const GLfloat *);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint, GLenum, GLuint, GLdouble *);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint, GLenum, GLuint, GLfloat *);
+GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint, GLenum, GLenum, GLvoid *);
+GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint, GLenum, GLuint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint, GLenum, GLuint, const GLint *);
+GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint, GLenum, GLuint, GLsizei, const GLint *);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint, GLenum, GLuint, const GLuint *);
+GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint, GLenum, GLuint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint, GLenum, GLuint, GLint *);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint, GLenum, GLuint, GLuint *);
+GLAPI void APIENTRY glTextureParameterIivEXT (GLuint, GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint, GLenum, GLenum, const GLuint *);
+GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint, GLenum, GLenum, GLuint *);
+GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum, GLenum, GLenum, const GLint *);
+GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum, GLenum, GLenum, const GLuint *);
+GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum, GLenum, GLenum, GLuint *);
+GLAPI void APIENTRY glProgramUniform1fEXT (GLuint, GLint, GLfloat);
+GLAPI void APIENTRY glProgramUniform2fEXT (GLuint, GLint, GLfloat, GLfloat);
+GLAPI void APIENTRY glProgramUniform3fEXT (GLuint, GLint, GLfloat, GLfloat, GLfloat);
+GLAPI void APIENTRY glProgramUniform4fEXT (GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat);
+GLAPI void APIENTRY glProgramUniform1iEXT (GLuint, GLint, GLint);
+GLAPI void APIENTRY glProgramUniform2iEXT (GLuint, GLint, GLint, GLint);
+GLAPI void APIENTRY glProgramUniform3iEXT (GLuint, GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glProgramUniform4iEXT (GLuint, GLint, GLint, GLint, GLint, GLint);
+GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint, GLint, GLsizei, const GLfloat *);
+GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint, GLint, GLsizei, const GLint *);
+GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint, GLint, GLsizei, const GLint *);
+GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint, GLint, GLsizei, const GLint *);
+GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint, GLint, GLsizei, const GLint *);
+GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint, GLint, GLuint);
+GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint, GLint, GLuint, GLuint);
+GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint, GLint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint, GLint, GLuint, GLuint, GLuint, GLuint);
+GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint, GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint, GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint, GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint, GLint, GLsizei, const GLuint *);
+GLAPI void APIENTRY glNamedBufferDataEXT (GLuint, GLsizeiptr, const GLvoid *, GLenum);
+GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint, GLintptr, GLsizeiptr, const GLvoid *);
+GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint, GLenum);
+GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint);
+GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint, GLenum, GLvoid* *);
+GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint, GLintptr, GLsizeiptr, GLvoid *);
+GLAPI void APIENTRY glTextureBufferEXT (GLuint, GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glMultiTexBufferEXT (GLenum, GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint, GLenum, GLsizei, GLsizei);
+GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint, GLenum, GLint *);
+GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint, GLenum);
+GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint, GLenum, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint, GLenum, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint, GLenum, GLenum, GLuint, GLint, GLint);
+GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint, GLenum, GLenum, GLuint);
+GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint, GLenum, GLenum, GLint *);
+GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint, GLenum);
+GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum, GLenum);
+GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint, GLenum);
+GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint, GLsizei, const GLenum *);
+GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint, GLenum);
+GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint, GLsizei, GLenum, GLsizei, GLsizei);
+GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei);
+GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint, GLenum, GLuint, GLint);
+GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint, GLenum, GLuint, GLint, GLint);
+GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint, GLenum, GLuint, GLint, GLenum);
+GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint, GLenum, GLuint);
+GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum, GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
+typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
+typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);
+typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
+typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
+typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
+typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data);
+typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data);
+typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid* *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, GLvoid *img);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, GLvoid *img);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, GLvoid *string);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage);
+typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);
+typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data);
+typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params);
+typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);
+typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
+typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
+typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);
+#endif
+
+#ifndef GL_EXT_vertex_array_bgra
+#define GL_EXT_vertex_array_bgra 1
+#endif
+
+#ifndef GL_EXT_texture_swizzle
+#define GL_EXT_texture_swizzle 1
+#endif
+
+#ifndef GL_NV_explicit_multisample
+#define GL_NV_explicit_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetMultisamplefvNV (GLenum, GLuint, GLfloat *);
+GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint, GLbitfield);
+GLAPI void APIENTRY glTexRenderbufferNV (GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);
+typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);
+#endif
+
+#ifndef GL_NV_transform_feedback2
+#define GL_NV_transform_feedback2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum, GLuint);
+GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei, const GLuint *);
+GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei, GLuint *);
+GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint);
+GLAPI void APIENTRY glPauseTransformFeedbackNV (void);
+GLAPI void APIENTRY glResumeTransformFeedbackNV (void);
+GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids);
+typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);
+#endif
+
+#ifndef GL_ATI_meminfo
+#define GL_ATI_meminfo 1
+#endif
+
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *, GLsizei, GLuint *);
+GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint, GLint *, GLint *, GLsizei, GLuint *);
+GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint, GLuint, GLenum, void *);
+GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei, GLuint *);
+GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei, GLuint *);
+GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint, GLboolean, GLuint, GLint, GLuint *);
+GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint);
+GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint);
+GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint, GLenum, GLsizei, GLuint *, GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
+typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+
+#ifndef GL_AMD_texture_texture4
+#define GL_AMD_texture_texture4 1
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_AMD_vertex_shader_tesselator 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTessellationFactorAMD (GLfloat);
+GLAPI void APIENTRY glTessellationModeAMD (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
+typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_EXT_provoking_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProvokingVertexEXT (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_texture_snorm
+#define GL_EXT_texture_snorm 1
+#endif
+
+#ifndef GL_AMD_draw_buffers_blend
+#define GL_AMD_draw_buffers_blend 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint, GLenum, GLenum);
+GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint, GLenum, GLenum, GLenum, GLenum);
+GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint, GLenum);
+GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint, GLenum, GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+#endif
+
+#ifndef GL_APPLE_texture_range
+#define GL_APPLE_texture_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureRangeAPPLE (GLenum, GLsizei, const GLvoid *);
+GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum, GLenum, GLvoid* *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid* *params);
+#endif
+
+#ifndef GL_APPLE_float_pixels
+#define GL_APPLE_float_pixels 1
+#endif
+
+#ifndef GL_APPLE_vertex_program_evaluators
+#define GL_APPLE_vertex_program_evaluators 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint, GLenum);
+GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint, GLenum);
+GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint, GLenum);
+GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
+GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
+GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
+GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
+typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
+typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
+#endif
+
+#ifndef GL_APPLE_aux_depth_stencil
+#define GL_APPLE_aux_depth_stencil 1
+#endif
+
+#ifndef GL_APPLE_object_purgeable
+#define GL_APPLE_object_purgeable 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum, GLuint, GLenum);
+GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum, GLuint, GLenum);
+GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum, GLuint, GLenum, GLint *);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
+typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
+typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_APPLE_row_bytes
+#define GL_APPLE_row_bytes 1
+#endif
+
#ifdef __cplusplus
}
#endif
#endif
+/* *INDENT-ON* */
#endif /* NO_SDL_GLEXT */
-/*@}*/
+
+#endif /* _SDL_opengl_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_opengles.h b/alienblaster/project/jni/sdl/include/SDL_opengles.h
new file mode 100644
index 000000000..d685a8b3b
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_opengles.h
@@ -0,0 +1,1039 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+ */
+
+/**
+ * \file SDL_opengles.h
+ *
+ * This is a simple file to encapsulate the OpenGL ES API headers.
+ *
+ * Headers copied from The Kronos Group website.
+ * http://www.khronos.org/opengles/
+ */
+
+#ifndef __gles_h_
+#define __gles_h_
+
+/* $Id: gl.h 4533 2007-11-26 11:19:35Z markc $ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef __IPHONEOS__
+#include /* Header File For The OpenGL ES Library */
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY
+#endif
+
+#ifndef GL_API
+#define GL_API
+#endif /* GL_API */
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.0 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+*/
+
+ typedef unsigned int GLenum;
+ typedef unsigned char GLboolean;
+ typedef unsigned int GLbitfield;
+ typedef signed char GLbyte;
+ typedef short GLshort;
+ typedef int GLint;
+ typedef int GLsizei;
+ typedef unsigned char GLubyte;
+ typedef unsigned short GLushort;
+ typedef unsigned int GLuint;
+ typedef float GLfloat;
+ typedef float GLclampf;
+ typedef void GLvoid;
+ typedef int GLfixed;
+ typedef int GLclampx;
+
+ typedef int GLintptr;
+ typedef int GLsizeiptr;
+
+
+/*************************************************************/
+
+/* OpenGL ES core versions */
+#define GL_VERSION_ES_CM_1_0 1
+#define GL_VERSION_ES_CL_1_0 1
+#define GL_VERSION_ES_CM_1_1 1
+#define GL_VERSION_ES_CL_1_1 1
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* AlphaFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* ClipPlaneName */
+#define GL_CLIP_PLANE0 0x3000
+#define GL_CLIP_PLANE1 0x3001
+#define GL_CLIP_PLANE2 0x3002
+#define GL_CLIP_PLANE3 0x3003
+#define GL_CLIP_PLANE4 0x3004
+#define GL_CLIP_PLANE5 0x3005
+
+/* ColorMaterialFace */
+/* GL_FRONT_AND_BACK */
+
+/* ColorMaterialParameter */
+/* GL_AMBIENT_AND_DIFFUSE */
+
+/* ColorPointerType */
+/* GL_UNSIGNED_BYTE */
+/* GL_FLOAT */
+/* GL_FIXED */
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_FOG 0x0B60
+#define GL_LIGHTING 0x0B50
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_ALPHA_TEST 0x0BC0
+#define GL_BLEND 0x0BE2
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+/* GL_LIGHT0 */
+/* GL_LIGHT1 */
+/* GL_LIGHT2 */
+/* GL_LIGHT3 */
+/* GL_LIGHT4 */
+/* GL_LIGHT5 */
+/* GL_LIGHT6 */
+/* GL_LIGHT7 */
+#define GL_POINT_SMOOTH 0x0B10
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_COLOR_MATERIAL 0x0B57
+#define GL_NORMALIZE 0x0BA1
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FogMode */
+/* GL_LINEAR */
+#define GL_EXP 0x0800
+#define GL_EXP2 0x0801
+
+/* FogParameter */
+#define GL_FOG_DENSITY 0x0B62
+#define GL_FOG_START 0x0B63
+#define GL_FOG_END 0x0B64
+#define GL_FOG_MODE 0x0B65
+#define GL_FOG_COLOR 0x0B66
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_CURRENT_COLOR 0x0B00
+#define GL_CURRENT_NORMAL 0x0B02
+#define GL_CURRENT_TEXTURE_COORDS 0x0B03
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_MIN 0x8126
+#define GL_POINT_SIZE_MAX 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
+#define GL_POINT_DISTANCE_ATTENUATION 0x8129
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_LINE_WIDTH 0x0B21
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_SHADE_MODEL 0x0B54
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_MATRIX_MODE 0x0BA0
+#define GL_VIEWPORT 0x0BA2
+#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
+#define GL_PROJECTION_STACK_DEPTH 0x0BA4
+#define GL_TEXTURE_STACK_DEPTH 0x0BA5
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#define GL_PROJECTION_MATRIX 0x0BA7
+#define GL_TEXTURE_MATRIX 0x0BA8
+#define GL_ALPHA_TEST_FUNC 0x0BC1
+#define GL_ALPHA_TEST_REF 0x0BC2
+#define GL_BLEND_DST 0x0BE0
+#define GL_BLEND_SRC 0x0BE1
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_LIGHTS 0x0D31
+#define GL_MAX_CLIP_PLANES 0x0D32
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
+#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
+#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_VERTEX_ARRAY_SIZE 0x807A
+#define GL_VERTEX_ARRAY_TYPE 0x807B
+#define GL_VERTEX_ARRAY_STRIDE 0x807C
+#define GL_NORMAL_ARRAY_TYPE 0x807E
+#define GL_NORMAL_ARRAY_STRIDE 0x807F
+#define GL_COLOR_ARRAY_SIZE 0x8081
+#define GL_COLOR_ARRAY_TYPE 0x8082
+#define GL_COLOR_ARRAY_STRIDE 0x8083
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* OpenGL ES 1.0 defines, they gone in 1.1 and 2.0 */
+#ifndef GL_MAX_ELEMENTS_VERTICES
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#endif /* GL_MAX_ELEMENTS_VERTICES */
+#ifndef GL_MAX_ELEMENTS_INDICES
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#endif /* GL_MAX_ELEMENTS_INDICES */
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
+#define GL_POINT_SMOOTH_HINT 0x0C51
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_FOG_HINT 0x0C54
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* LightModelParameter */
+#define GL_LIGHT_MODEL_AMBIENT 0x0B53
+#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
+
+/* LightParameter */
+#define GL_AMBIENT 0x1200
+#define GL_DIFFUSE 0x1201
+#define GL_SPECULAR 0x1202
+#define GL_POSITION 0x1203
+#define GL_SPOT_DIRECTION 0x1204
+#define GL_SPOT_EXPONENT 0x1205
+#define GL_SPOT_CUTOFF 0x1206
+#define GL_CONSTANT_ATTENUATION 0x1207
+#define GL_LINEAR_ATTENUATION 0x1208
+#define GL_QUADRATIC_ATTENUATION 0x1209
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* LogicOp */
+#define GL_CLEAR 0x1500
+#define GL_AND 0x1501
+#define GL_AND_REVERSE 0x1502
+#define GL_COPY 0x1503
+#define GL_AND_INVERTED 0x1504
+#define GL_NOOP 0x1505
+#define GL_XOR 0x1506
+#define GL_OR 0x1507
+#define GL_NOR 0x1508
+#define GL_EQUIV 0x1509
+#define GL_INVERT 0x150A
+#define GL_OR_REVERSE 0x150B
+#define GL_COPY_INVERTED 0x150C
+#define GL_OR_INVERTED 0x150D
+#define GL_NAND 0x150E
+#define GL_SET 0x150F
+
+/* MaterialFace */
+/* GL_FRONT_AND_BACK */
+
+/* MaterialParameter */
+#define GL_EMISSION 0x1600
+#define GL_SHININESS 0x1601
+#define GL_AMBIENT_AND_DIFFUSE 0x1602
+/* GL_AMBIENT */
+/* GL_DIFFUSE */
+/* GL_SPECULAR */
+
+/* MatrixMode */
+#define GL_MODELVIEW 0x1700
+#define GL_PROJECTION 0x1701
+#define GL_TEXTURE 0x1702
+
+/* NormalPointerType */
+/* GL_BYTE */
+/* GL_SHORT */
+/* GL_FLOAT */
+/* GL_FIXED */
+
+/* PixelFormat */
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelStoreParameter */
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* ShadingModel */
+#define GL_FLAT 0x1D00
+#define GL_SMOOTH 0x1D01
+
+/* StencilFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+/* GL_INVERT */
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TexCoordPointerType */
+/* GL_SHORT */
+/* GL_FLOAT */
+/* GL_FIXED */
+/* GL_BYTE */
+
+/* TextureEnvMode */
+#define GL_MODULATE 0x2100
+#define GL_DECAL 0x2101
+/* GL_BLEND */
+#define GL_ADD 0x0104
+/* GL_REPLACE */
+
+/* TextureEnvParameter */
+#define GL_TEXTURE_ENV_MODE 0x2200
+#define GL_TEXTURE_ENV_COLOR 0x2201
+
+/* TextureEnvTarget */
+#define GL_TEXTURE_ENV 0x2300
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_GENERATE_MIPMAP 0x8191
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+
+/* VertexPointerType */
+/* GL_SHORT */
+/* GL_FLOAT */
+/* GL_FIXED */
+/* GL_BYTE */
+
+/* LightName */
+#define GL_LIGHT0 0x4000
+#define GL_LIGHT1 0x4001
+#define GL_LIGHT2 0x4002
+#define GL_LIGHT3 0x4003
+#define GL_LIGHT4 0x4004
+#define GL_LIGHT5 0x4005
+#define GL_LIGHT6 0x4006
+#define GL_LIGHT7 0x4007
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
+
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+/* Texture combine + dot3 */
+#define GL_SUBTRACT 0x84E7
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+#define GL_OPERAND0_RGB 0x8590
+#define GL_OPERAND1_RGB 0x8591
+#define GL_OPERAND2_RGB 0x8592
+#define GL_OPERAND0_ALPHA 0x8598
+#define GL_OPERAND1_ALPHA 0x8599
+#define GL_OPERAND2_ALPHA 0x859A
+
+#define GL_ALPHA_SCALE 0x0D1C
+
+#define GL_SRC0_RGB 0x8580
+#define GL_SRC1_RGB 0x8581
+#define GL_SRC2_RGB 0x8582
+#define GL_SRC0_ALPHA 0x8588
+#define GL_SRC1_ALPHA 0x8589
+#define GL_SRC2_ALPHA 0x858A
+
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+
+/*------------------------------------------------------------------------*
+ * required OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* OES_read_format */
+#ifndef GL_OES_read_format
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif
+
+/* OES_point_size_array */
+#ifndef GL_OES_point_size_array
+#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
+#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
+#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
+#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
+#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
+#endif
+
+/* GL_OES_point_sprite */
+#ifndef GL_OES_point_sprite
+#define GL_POINT_SPRITE_OES 0x8861
+#define GL_COORD_REPLACE_OES 0x8862
+#endif
+
+/* GL_OES_draw_texture */
+#ifndef GL_OES_draw_texture
+#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
+#endif /* GL_OES_draw_texture */
+
+/* GL_OES_vertex_buffer_object */
+#ifndef GL_OES_vertex_buffer_object
+#define GL_ARRAY_BUFFER_OES 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER_OES 0x8893
+#define GL_ARRAY_BUFFER_BINDING_OES 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING_OES 0x8895
+#define GL_VERTEX_ARRAY_BUFFER_BINDING_OES 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING_OES 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING_OES 0x8898
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_OES 0x889A
+#define GL_STATIC_DRAW_OES 0x88E4
+#define GL_DYNAMIC_DRAW_OES 0x88E8
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_SIZE_OES 0x8764
+#define GL_BUFFER_USAGE_OES 0x8765
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#endif /* GL_OES_vertex_buffer_object */
+
+/*************************************************************/
+
+/* Available only in Common profile */
+ GL_API void GL_APIENTRY glAlphaFunc(GLenum func, GLclampf ref);
+ GL_API void GL_APIENTRY glClearColor(GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha);
+ GL_API void GL_APIENTRY glClearDepthf(GLclampf depth);
+ GL_API void GL_APIENTRY glClipPlanef(GLenum plane,
+ const GLfloat * equation);
+ GL_API void GL_APIENTRY glColor4f(GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha);
+ GL_API void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar);
+ GL_API void GL_APIENTRY glFogf(GLenum pname, GLfloat param);
+ GL_API void GL_APIENTRY glFogfv(GLenum pname, const GLfloat * params);
+ GL_API void GL_APIENTRY glFrustumf(GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar);
+ GL_API void GL_APIENTRY glGetClipPlanef(GLenum pname, GLfloat eqn[4]);
+ GL_API void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat * params);
+ GL_API void GL_APIENTRY glGetLightfv(GLenum light, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glGetMaterialfv(GLenum face, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glGetTexEnvfv(GLenum env, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glLightModelf(GLenum pname, GLfloat param);
+ GL_API void GL_APIENTRY glLightModelfv(GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glLightf(GLenum light, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glLightfv(GLenum light, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glLineWidth(GLfloat width);
+ GL_API void GL_APIENTRY glLoadMatrixf(const GLfloat * m);
+ GL_API void GL_APIENTRY glMaterialf(GLenum face, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glMaterialfv(GLenum face, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glMultMatrixf(const GLfloat * m);
+ GL_API void GL_APIENTRY glMultiTexCoord4f(GLenum target, GLfloat s,
+ GLfloat t, GLfloat r,
+ GLfloat q);
+ GL_API void GL_APIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
+ GL_API void GL_APIENTRY glOrthof(GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar);
+ GL_API void GL_APIENTRY glPointParameterf(GLenum pname, GLfloat param);
+ GL_API void GL_APIENTRY glPointParameterfv(GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glPointSize(GLfloat size);
+ GL_API void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units);
+ GL_API void GL_APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y,
+ GLfloat z);
+ GL_API void GL_APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z);
+ GL_API void GL_APIENTRY glTexEnvf(GLenum target, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glTexEnvfv(GLenum target, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z);
+
+/* Available in both Common and Common-Lite profiles */
+ GL_API void GL_APIENTRY glActiveTexture(GLenum texture);
+ GL_API void GL_APIENTRY glAlphaFuncx(GLenum func, GLclampx ref);
+ GL_API void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer);
+ GL_API void GL_APIENTRY glBindTexture(GLenum target, GLuint texture);
+ GL_API void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor);
+ GL_API void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size,
+ const GLvoid * data, GLenum usage);
+ GL_API void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset,
+ GLsizeiptr size,
+ const GLvoid * data);
+ GL_API void GL_APIENTRY glClear(GLbitfield mask);
+ GL_API void GL_APIENTRY glClearColorx(GLclampx red, GLclampx green,
+ GLclampx blue, GLclampx alpha);
+ GL_API void GL_APIENTRY glClearDepthx(GLclampx depth);
+ GL_API void GL_APIENTRY glClearStencil(GLint s);
+ GL_API void GL_APIENTRY glClientActiveTexture(GLenum texture);
+ GL_API void GL_APIENTRY glClipPlanex(GLenum plane,
+ const GLfixed * equation);
+ GL_API void GL_APIENTRY glColor4ub(GLubyte red, GLubyte green,
+ GLubyte blue, GLubyte alpha);
+ GL_API void GL_APIENTRY glColor4x(GLfixed red, GLfixed green,
+ GLfixed blue, GLfixed alpha);
+ GL_API void GL_APIENTRY glColorMask(GLboolean red, GLboolean green,
+ GLboolean blue, GLboolean alpha);
+ GL_API void GL_APIENTRY glColorPointer(GLint size, GLenum type,
+ GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid * data);
+ GL_API void GL_APIENTRY glCompressedTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid * data);
+ GL_API void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level,
+ GLenum internalformat, GLint x,
+ GLint y, GLsizei width,
+ GLsizei height, GLint border);
+ GL_API void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width,
+ GLsizei height);
+ GL_API void GL_APIENTRY glCullFace(GLenum mode);
+ GL_API void GL_APIENTRY glDeleteBuffers(GLsizei n,
+ const GLuint * buffers);
+ GL_API void GL_APIENTRY glDeleteTextures(GLsizei n,
+ const GLuint * textures);
+ GL_API void GL_APIENTRY glDepthFunc(GLenum func);
+ GL_API void GL_APIENTRY glDepthMask(GLboolean flag);
+ GL_API void GL_APIENTRY glDepthRangex(GLclampx zNear, GLclampx zFar);
+ GL_API void GL_APIENTRY glDisable(GLenum cap);
+ GL_API void GL_APIENTRY glDisableClientState(GLenum array);
+ GL_API void GL_APIENTRY glDrawArrays(GLenum mode, GLint first,
+ GLsizei count);
+ GL_API void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count,
+ GLenum type,
+ const GLvoid * indices);
+ GL_API void GL_APIENTRY glEnable(GLenum cap);
+ GL_API void GL_APIENTRY glEnableClientState(GLenum array);
+ GL_API void GL_APIENTRY glFinish(void);
+ GL_API void GL_APIENTRY glFlush(void);
+ GL_API void GL_APIENTRY glFogx(GLenum pname, GLfixed param);
+ GL_API void GL_APIENTRY glFogxv(GLenum pname, const GLfixed * params);
+ GL_API void GL_APIENTRY glFrontFace(GLenum mode);
+ GL_API void GL_APIENTRY glFrustumx(GLfixed left, GLfixed right,
+ GLfixed bottom, GLfixed top,
+ GLfixed zNear, GLfixed zFar);
+ GL_API void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean * params);
+ GL_API void GL_APIENTRY glGetBufferParameteriv(GLenum target,
+ GLenum pname,
+ GLint * params);
+ GL_API void GL_APIENTRY glGetClipPlanex(GLenum pname, GLfixed eqn[4]);
+ GL_API void GL_APIENTRY glGenBuffers(GLsizei n, GLuint * buffers);
+ GL_API void GL_APIENTRY glGenTextures(GLsizei n, GLuint * textures);
+ GL_API GLenum GL_APIENTRY glGetError(void);
+ GL_API void GL_APIENTRY glGetFixedv(GLenum pname, GLfixed * params);
+ GL_API void GL_APIENTRY glGetIntegerv(GLenum pname, GLint * params);
+ GL_API void GL_APIENTRY glGetLightxv(GLenum light, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glGetMaterialxv(GLenum face, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glGetPointerv(GLenum pname, void **params);
+ GL_API const GLubyte *GL_APIENTRY glGetString(GLenum name);
+ GL_API void GL_APIENTRY glGetTexEnviv(GLenum env, GLenum pname,
+ GLint * params);
+ GL_API void GL_APIENTRY glGetTexEnvxv(GLenum env, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname,
+ GLint * params);
+ GL_API void GL_APIENTRY glGetTexParameterxv(GLenum target, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glHint(GLenum target, GLenum mode);
+ GL_API GLboolean GL_APIENTRY glIsBuffer(GLuint buffer);
+ GL_API GLboolean GL_APIENTRY glIsEnabled(GLenum cap);
+ GL_API GLboolean GL_APIENTRY glIsTexture(GLuint texture);
+ GL_API void GL_APIENTRY glLightModelx(GLenum pname, GLfixed param);
+ GL_API void GL_APIENTRY glLightModelxv(GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glLightx(GLenum light, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glLightxv(GLenum light, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glLineWidthx(GLfixed width);
+ GL_API void GL_APIENTRY glLoadIdentity(void);
+ GL_API void GL_APIENTRY glLoadMatrixx(const GLfixed * m);
+ GL_API void GL_APIENTRY glLogicOp(GLenum opcode);
+ GL_API void GL_APIENTRY glMaterialx(GLenum face, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glMaterialxv(GLenum face, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glMatrixMode(GLenum mode);
+ GL_API void GL_APIENTRY glMultMatrixx(const GLfixed * m);
+ GL_API void GL_APIENTRY glMultiTexCoord4x(GLenum target, GLfixed s,
+ GLfixed t, GLfixed r,
+ GLfixed q);
+ GL_API void GL_APIENTRY glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz);
+ GL_API void GL_APIENTRY glNormalPointer(GLenum type, GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glOrthox(GLfixed left, GLfixed right,
+ GLfixed bottom, GLfixed top,
+ GLfixed zNear, GLfixed zFar);
+ GL_API void GL_APIENTRY glPixelStorei(GLenum pname, GLint param);
+ GL_API void GL_APIENTRY glPointParameterx(GLenum pname, GLfixed param);
+ GL_API void GL_APIENTRY glPointParameterxv(GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glPointSizex(GLfixed size);
+ GL_API void GL_APIENTRY glPolygonOffsetx(GLfixed factor, GLfixed units);
+ GL_API void GL_APIENTRY glPopMatrix(void);
+ GL_API void GL_APIENTRY glPushMatrix(void);
+ GL_API void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width,
+ GLsizei height, GLenum format,
+ GLenum type, GLvoid * pixels);
+ GL_API void GL_APIENTRY glRotatex(GLfixed angle, GLfixed x, GLfixed y,
+ GLfixed z);
+ GL_API void GL_APIENTRY glSampleCoverage(GLclampf value,
+ GLboolean invert);
+ GL_API void GL_APIENTRY glSampleCoveragex(GLclampx value,
+ GLboolean invert);
+ GL_API void GL_APIENTRY glScalex(GLfixed x, GLfixed y, GLfixed z);
+ GL_API void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width,
+ GLsizei height);
+ GL_API void GL_APIENTRY glShadeModel(GLenum mode);
+ GL_API void GL_APIENTRY glStencilFunc(GLenum func, GLint ref,
+ GLuint mask);
+ GL_API void GL_APIENTRY glStencilMask(GLuint mask);
+ GL_API void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail,
+ GLenum zpass);
+ GL_API void GL_APIENTRY glTexCoordPointer(GLint size, GLenum type,
+ GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glTexEnvi(GLenum target, GLenum pname,
+ GLint param);
+ GL_API void GL_APIENTRY glTexEnvx(GLenum target, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glTexEnviv(GLenum target, GLenum pname,
+ const GLint * params);
+ GL_API void GL_APIENTRY glTexEnvxv(GLenum target, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glTexImage2D(GLenum target, GLint level,
+ GLint internalformat, GLsizei width,
+ GLsizei height, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid * pixels);
+ GL_API void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname,
+ GLint param);
+ GL_API void GL_APIENTRY glTexParameterx(GLenum target, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname,
+ const GLint * params);
+ GL_API void GL_APIENTRY glTexParameterxv(GLenum target, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid * pixels);
+ GL_API void GL_APIENTRY glTranslatex(GLfixed x, GLfixed y, GLfixed z);
+ GL_API void GL_APIENTRY glVertexPointer(GLint size, GLenum type,
+ GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width,
+ GLsizei height);
+
+/*------------------------------------------------------------------------*
+ * Required OES extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_read_format */
+#ifndef GL_OES_read_format
+#define GL_OES_read_format 1
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#endif
+
+/* GL_OES_point_size_array */
+#ifndef GL_OES_point_size_array
+#define GL_OES_point_size_array 1
+ GL_API void GL_APIENTRY glPointSizePointerOES(GLenum type, GLsizei stride,
+ const GLvoid * pointer);
+#endif
+
+/* GL_OES_query_matrix */
+#ifndef GL_OES_query_matrix
+#define GL_OES_query_matrix 1
+ GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES(GLfixed mantissa[16],
+ GLint exponent[16]);
+#endif /* GL_OES_query_matrix */
+
+/* GL_OES_point_sprite */
+#ifndef GL_OES_point_sprite
+#define GL_OES_point_sprite 1
+#endif
+
+/* GL_OES_draw_texture */
+#ifndef GL_OES_draw_texture
+#define GL_OES_draw_texture 1
+ GL_API void GL_APIENTRY glDrawTexsOES(GLshort x, GLshort y, GLshort z,
+ GLshort width, GLshort height);
+ GL_API void GL_APIENTRY glDrawTexiOES(GLint x, GLint y, GLint z,
+ GLint width, GLint height);
+ GL_API void GL_APIENTRY glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z,
+ GLfixed width, GLfixed height);
+ GL_API void GL_APIENTRY glDrawTexsvOES(const GLshort * coords);
+ GL_API void GL_APIENTRY glDrawTexivOES(const GLint * coords);
+ GL_API void GL_APIENTRY glDrawTexxvOES(const GLfixed * coords);
+ GL_API void GL_APIENTRY glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z,
+ GLfloat width, GLfloat height);
+ GL_API void GL_APIENTRY glDrawTexfvOES(const GLfloat * coords);
+#endif /* GL_OES_draw_texture */
+
+/* GL_OES_single_precision */
+#ifndef GL_OES_single_precision
+#define GL_OES_single_precision 1
+ GL_API void GL_APIENTRY glDepthRangefOES(GLclampf zNear, GLclampf zFar);
+ GL_API void GL_APIENTRY glFrustumfOES(GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar);
+ GL_API void GL_APIENTRY glOrthofOES(GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar);
+ GL_API void GL_APIENTRY glClipPlanefOES(GLenum plane,
+ const GLfloat * equation);
+ GL_API void GL_APIENTRY glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]);
+ GL_API void GL_APIENTRY glClearDepthfOES(GLclampf depth);
+#endif /* GL_OES_single_precision */
+
+/* GL_OES_vertex_buffer_object */
+#ifndef GL_OES_vertex_buffer_object
+#define GL_OES_vertex_buffer_object 1
+ GL_API void APIENTRY glBindBufferOES(GLenum, GLuint);
+ GL_API void APIENTRY glDeleteBuffersOES(GLsizei, const GLuint *);
+ GL_API void APIENTRY glGenBuffersOES(GLsizei, GLuint *);
+ GL_API GLboolean APIENTRY glIsBufferOES(GLuint);
+ GL_API void APIENTRY glBufferDataOES(GLenum, GLsizeiptr, const GLvoid *,
+ GLenum);
+ GL_API void APIENTRY glBufferSubDataOES(GLenum, GLintptr, GLsizeiptr,
+ const GLvoid *);
+ GL_API void APIENTRY glGetBufferParameterivOES(GLenum, GLenum, GLint *);
+#endif /* GL_OES_vertex_buffer_object */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gles_h_ */
diff --git a/alienblaster/project/jni/sdl/include/SDL_pixels.h b/alienblaster/project/jni/sdl/include/SDL_pixels.h
new file mode 100644
index 000000000..6934105aa
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_pixels.h
@@ -0,0 +1,399 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/**
+ * \file SDL_pixels.h
+ *
+ * Header for the enumerated pixel format definitions.
+ */
+
+#ifndef _SDL_pixels_h
+#define _SDL_pixels_h
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \name Transparency definitions
+ *
+ * These define alpha as the opacity of a surface.
+ */
+/*@{*/
+#define SDL_ALPHA_OPAQUE 255
+#define SDL_ALPHA_TRANSPARENT 0
+/*@}*/
+
+/** Pixel type. */
+enum
+{
+ SDL_PIXELTYPE_UNKNOWN,
+ SDL_PIXELTYPE_INDEX1,
+ SDL_PIXELTYPE_INDEX4,
+ SDL_PIXELTYPE_INDEX8,
+ SDL_PIXELTYPE_PACKED8,
+ SDL_PIXELTYPE_PACKED16,
+ SDL_PIXELTYPE_PACKED32,
+ SDL_PIXELTYPE_ARRAYU8,
+ SDL_PIXELTYPE_ARRAYU16,
+ SDL_PIXELTYPE_ARRAYU32,
+ SDL_PIXELTYPE_ARRAYF16,
+ SDL_PIXELTYPE_ARRAYF32
+};
+
+/** Bitmap pixel order, high bit -> low bit. */
+enum
+{
+ SDL_BITMAPORDER_NONE,
+ SDL_BITMAPORDER_4321,
+ SDL_BITMAPORDER_1234
+};
+
+/** Packed component order, high bit -> low bit. */
+enum
+{
+ SDL_PACKEDORDER_NONE,
+ SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDORDER_RGBX,
+ SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDORDER_BGRX,
+ SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDORDER_BGRA
+};
+
+/** Array component order, low byte -> high byte. */
+enum
+{
+ SDL_ARRAYORDER_NONE,
+ SDL_ARRAYORDER_RGB,
+ SDL_ARRAYORDER_RGBA,
+ SDL_ARRAYORDER_ARGB,
+ SDL_ARRAYORDER_BGR,
+ SDL_ARRAYORDER_BGRA,
+ SDL_ARRAYORDER_ABGR
+};
+
+/** Packed component layout. */
+enum
+{
+ SDL_PACKEDLAYOUT_NONE,
+ SDL_PACKEDLAYOUT_332,
+ SDL_PACKEDLAYOUT_4444,
+ SDL_PACKEDLAYOUT_1555,
+ SDL_PACKEDLAYOUT_5551,
+ SDL_PACKEDLAYOUT_565,
+ SDL_PACKEDLAYOUT_8888,
+ SDL_PACKEDLAYOUT_2101010,
+ SDL_PACKEDLAYOUT_1010102
+};
+
+#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \
+ ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))
+
+#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
+ ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
+ ((bits) << 8) | ((bytes) << 0))
+
+#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
+#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
+#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
+#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
+#define SDL_BYTESPERPIXEL(X) (((X) >> 0) & 0xFF)
+
+#define SDL_ISPIXELFORMAT_INDEXED(format) \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))
+
+#define SDL_ISPIXELFORMAT_ALPHA(format) \
+ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))
+
+#define SDL_ISPIXELFORMAT_FOURCC(format) \
+ ((format) && !((format) & 0x80000000))
+
+enum
+{
+ SDL_PIXELFORMAT_UNKNOWN,
+ SDL_PIXELFORMAT_INDEX1LSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
+ 1, 0),
+ SDL_PIXELFORMAT_INDEX1MSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
+ 1, 0),
+ SDL_PIXELFORMAT_INDEX4LSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
+ 4, 0),
+ SDL_PIXELFORMAT_INDEX4MSB =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
+ 4, 0),
+ SDL_PIXELFORMAT_INDEX8 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
+ SDL_PIXELFORMAT_RGB332 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_332, 8, 1),
+ SDL_PIXELFORMAT_RGB444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_4444, 12, 2),
+ SDL_PIXELFORMAT_RGB555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_1555, 15, 2),
+ SDL_PIXELFORMAT_BGR555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_1555, 15, 2),
+ SDL_PIXELFORMAT_ARGB4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_ABGR4444 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_4444, 16, 2),
+ SDL_PIXELFORMAT_ARGB1555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_1555, 16, 2),
+ SDL_PIXELFORMAT_ABGR1555 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_1555, 16, 2),
+ SDL_PIXELFORMAT_RGB565 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_565, 16, 2),
+ SDL_PIXELFORMAT_BGR565 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_565, 16, 2),
+ SDL_PIXELFORMAT_RGB24 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
+ 24, 3),
+ SDL_PIXELFORMAT_BGR24 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
+ 24, 3),
+ SDL_PIXELFORMAT_RGB888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_BGR888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
+ SDL_PACKEDLAYOUT_8888, 24, 4),
+ SDL_PIXELFORMAT_ARGB8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_RGBA8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_ABGR8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_BGRA8888 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
+ SDL_PACKEDLAYOUT_8888, 32, 4),
+ SDL_PIXELFORMAT_ARGB2101010 =
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
+ SDL_PACKEDLAYOUT_2101010, 32, 4),
+
+ SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
+ SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
+ SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
+ SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
+ SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
+ SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U')
+};
+
+typedef struct SDL_Color
+{
+ Uint8 r;
+ Uint8 g;
+ Uint8 b;
+ Uint8 unused;
+} SDL_Color;
+#define SDL_Colour SDL_Color
+
+typedef struct SDL_Palette SDL_Palette;
+typedef int (*SDL_PaletteChangedFunc) (void *userdata, SDL_Palette * palette);
+typedef struct SDL_PaletteWatch SDL_PaletteWatch;
+
+struct SDL_Palette
+{
+ int ncolors;
+ SDL_Color *colors;
+
+ int refcount;
+ SDL_PaletteWatch *watch;
+};
+
+/**
+ * \note Everything in the pixel format structure is read-only.
+ */
+typedef struct SDL_PixelFormat
+{
+ SDL_Palette *palette;
+ Uint8 BitsPerPixel;
+ Uint8 BytesPerPixel;
+ Uint8 Rloss;
+ Uint8 Gloss;
+ Uint8 Bloss;
+ Uint8 Aloss;
+ Uint8 Rshift;
+ Uint8 Gshift;
+ Uint8 Bshift;
+ Uint8 Ashift;
+ Uint32 Rmask;
+ Uint32 Gmask;
+ Uint32 Bmask;
+ Uint32 Amask;
+} SDL_PixelFormat;
+
+/**
+ * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
+ *
+ * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
+ *
+ * \sa SDL_MasksToPixelFormatEnum()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
+ int *bpp,
+ Uint32 * Rmask,
+ Uint32 * Gmask,
+ Uint32 * Bmask,
+ Uint32 * Amask);
+
+/**
+ * \brief Convert a bpp and RGBA masks to an enumerated pixel format.
+ *
+ * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
+ * wasn't possible.
+ *
+ * \sa SDL_PixelFormatEnumToMasks()
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
+ Uint32 Rmask,
+ Uint32 Gmask,
+ Uint32 Bmask,
+ Uint32 Amask);
+
+/**
+ * \brief Create a palette structure with the specified number of color
+ * entries.
+ *
+ * \return A new palette, or NULL if there wasn't enough memory.
+ *
+ * \note The palette entries are initialized to white.
+ *
+ * \sa SDL_FreePalette()
+ */
+extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
+
+/**
+ * \brief Add a callback function which is called when the palette changes.
+ *
+ * \sa SDL_DelPaletteWatch()
+ */
+extern DECLSPEC int SDLCALL SDL_AddPaletteWatch(SDL_Palette * palette,
+ SDL_PaletteChangedFunc
+ callback, void *userdata);
+
+/**
+ * \brief Remove a callback function previously added with
+ * SDL_AddPaletteWatch().
+ *
+ * \sa SDL_AddPaletteWatch()
+ */
+extern DECLSPEC void SDLCALL SDL_DelPaletteWatch(SDL_Palette * palette,
+ SDL_PaletteChangedFunc
+ callback, void *userdata);
+
+/**
+ * \brief Set a range of colors in a palette.
+ *
+ * \param palette The palette to modify.
+ * \param colors An array of colors to copy into the palette.
+ * \param firstcolor The index of the first palette entry to modify.
+ * \param ncolors The number of entries to modify.
+ *
+ * \return 0 on success, or -1 if not all of the colors could be set.
+ */
+extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
+ const SDL_Color * colors,
+ int firstcolor, int ncolors);
+
+/**
+ * \brief Free a palette created with SDL_AllocPalette().
+ *
+ * \sa SDL_AllocPalette()
+ */
+extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
+
+/**
+ * \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
+ *
+ * \sa SDL_MapRGBA
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
+ Uint8 r, Uint8 g, Uint8 b);
+
+/**
+ * \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
+ *
+ * \sa SDL_MapRGB
+ */
+extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
+ Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a);
+
+/**
+ * \brief Get the RGB components from a pixel of the specified format.
+ *
+ * \sa SDL_GetRGBA
+ */
+extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
+ const SDL_PixelFormat * format,
+ Uint8 * r, Uint8 * g, Uint8 * b);
+
+/**
+ * \brief Get the RGBA components from a pixel of the specified format.
+ *
+ * \sa SDL_GetRGB
+ */
+extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
+ const SDL_PixelFormat * format,
+ Uint8 * r, Uint8 * g, Uint8 * b,
+ Uint8 * a);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_pixels_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_platform.h b/alienblaster/project/jni/sdl/include/SDL_platform.h
index 11d867366..f9429bdec 100644
--- a/alienblaster/project/jni/sdl/include/SDL_platform.h
+++ b/alienblaster/project/jni/sdl/include/SDL_platform.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,10 @@
slouken@libsdl.org
*/
-/** @file SDL_platform.h
- * Try to get a standard set of platform defines
+/**
+ * \file SDL_platform.h
+ *
+ * Try to get a standard set of platform defines.
*/
#ifndef _SDL_platform_h
@@ -37,7 +39,7 @@
#endif
#if defined(__HAIKU__)
#undef __HAIKU__
-#define __HAIKU__ 1
+#define __HAIKU__ 1
#endif
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
#undef __BSDI__
@@ -51,10 +53,6 @@
#undef __FREEBSD__
#define __FREEBSD__ 1
#endif
-#if defined(__HAIKU__)
-#undef __HAIKU__
-#define __HAIKU__ 1
-#endif
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
#undef __HPUX__
#define __HPUX__ 1
@@ -67,13 +65,30 @@
#undef __LINUX__
#define __LINUX__ 1
#endif
+
#if defined(__APPLE__)
+/* lets us know what version of Mac OS X we're compiling on */
+#include "AvailabilityMacros.h"
+#ifdef MAC_OS_X_VERSION_10_3
+#include "TargetConditionals.h" /* this header is in 10.3 or later */
+#if TARGET_OS_IPHONE
+/* if compiling for iPhone */
+#undef __IPHONEOS__
+#define __IPHONEOS__ 1
+#undef __MACOSX__
+#else
+/* if not compiling for iPhone */
+#undef __MACOSX__
+#define __MACOSX__ 1
+#endif /* TARGET_OS_IPHONE */
+#else
+/* if earlier verion of Mac OS X than version 10.3 */
#undef __MACOSX__
#define __MACOSX__ 1
-#elif defined(macintosh)
-#undef __MACOS__
-#define __MACOS__ 1
#endif
+
+#endif /* defined(__APPLE__) */
+
#if defined(__NetBSD__)
#undef __NETBSD__
#define __NETBSD__ 1
@@ -107,4 +122,33 @@
#define __WIN32__ 1
#endif
+#if defined(__NDS__)
+#undef __NINTENDODS__
+#define __NINTENDODS__ 1
+#endif
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \brief Gets the name of the platform.
+ */
+extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
#endif /* _SDL_platform_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_power.h b/alienblaster/project/jni/sdl/include/SDL_power.h
new file mode 100644
index 000000000..9141422f0
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_power.h
@@ -0,0 +1,80 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+#ifndef _SDL_power_h
+#define _SDL_power_h
+
+/**
+ * \file SDL_power.h
+ *
+ * Header for the SDL power management routines.
+ */
+
+#include "SDL_stdinc.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \brief The basic state for the system's power supply.
+ */
+typedef enum
+{
+ SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
+ SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
+ SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
+ SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
+ SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
+} SDL_PowerState;
+
+
+/**
+ * \brief Get the current power supply details.
+ *
+ * \param secs Seconds of battery life left. You can pass a NULL here if
+ * you don't care. Will return -1 if we can't determine a
+ * value, or we're not running on a battery.
+ *
+ * \param pct Percentage of battery life left, between 0 and 100. You can
+ * pass a NULL here if you don't care. Will return -1 if we
+ * can't determine a value, or we're not running on a battery.
+ *
+ * \return The state of the battery (if any).
+ */
+extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_power_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_quit.h b/alienblaster/project/jni/sdl/include/SDL_quit.h
index 6d82e7e06..c5e0db3c9 100644
--- a/alienblaster/project/jni/sdl/include/SDL_quit.h
+++ b/alienblaster/project/jni/sdl/include/SDL_quit.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,10 @@
slouken@libsdl.org
*/
-/** @file SDL_quit.h
- * Include file for SDL quit event handling
+/**
+ * \file SDL_quit.h
+ *
+ * Include file for SDL quit event handling.
*/
#ifndef _SDL_quit_h
@@ -30,8 +32,10 @@
#include "SDL_stdinc.h"
#include "SDL_error.h"
-/** @file SDL_quit.h
- * An SDL_QUITEVENT is generated when the user tries to close the application
+/**
+ * \file SDL_quit.h
+ *
+ * An ::SDL_QUIT event is generated when the user tries to close the application
* window. If it is ignored or filtered out, the window will remain open.
* If it is not ignored or filtered, it is queued normally and the window
* is allowed to close. When the window is closed, screen updates will
@@ -39,15 +43,15 @@
*
* SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
* and SIGTERM (system termination request), if handlers do not already
- * exist, that generate SDL_QUITEVENT events as well. There is no way
- * to determine the cause of an SDL_QUITEVENT, but setting a signal
+ * exist, that generate ::SDL_QUIT events as well. There is no way
+ * to determine the cause of an ::SDL_QUIT event, but setting a signal
* handler in your application will override the default generation of
* quit events for that signal.
+ *
+ * \sa SDL_Quit()
*/
-/** @file SDL_quit.h
- * There are no functions directly affecting the quit event
- */
+/* There are no functions directly affecting the quit event */
#define SDL_QuitRequested() \
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
diff --git a/alienblaster/project/jni/sdl/include/SDL_rect.h b/alienblaster/project/jni/sdl/include/SDL_rect.h
new file mode 100644
index 000000000..4229d34db
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_rect.h
@@ -0,0 +1,137 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/**
+ * \file SDL_rect.h
+ *
+ * Header file for SDL_rect definition and management functions.
+ */
+
+#ifndef _SDL_rect_h
+#define _SDL_rect_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_pixels.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \brief The structure that defines a point
+ *
+ * \sa SDL_EnclosePoints
+ */
+typedef struct
+{
+ int x;
+ int y;
+} SDL_Point;
+
+/**
+ * \brief A rectangle, with the origin at the upper left.
+ *
+ * \sa SDL_RectEmpty
+ * \sa SDL_RectEquals
+ * \sa SDL_HasIntersection
+ * \sa SDL_IntersectRect
+ * \sa SDL_UnionRect
+ * \sa SDL_EnclosePoints
+ */
+typedef struct SDL_Rect
+{
+ int x, y;
+ int w, h;
+} SDL_Rect;
+
+/**
+ * \brief Returns true if the rectangle has no area.
+ */
+#define SDL_RectEmpty(X) (((X)->w <= 0) || ((X)->h <= 0))
+
+/**
+ * \brief Returns true if the two rectangles are equal.
+ */
+#define SDL_RectEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
+ ((A)->w == (B)->w) && ((A)->h == (B)->h))
+
+/**
+ * \brief Determine whether two rectangles intersect.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
+ const SDL_Rect * B);
+
+/**
+ * \brief Calculate the intersection of two rectangles.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
+ const SDL_Rect * B,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate the union of two rectangles.
+ */
+extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
+ const SDL_Rect * B,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate a minimal rectangle enclosing a set of points
+ *
+ * \return SDL_TRUE if any points were within the clipping rect
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
+ int count,
+ const SDL_Rect * clip,
+ SDL_Rect * result);
+
+/**
+ * \brief Calculate the intersection of a rectangle and line segment.
+ *
+ * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
+ rect, int *X1,
+ int *Y1, int *X2,
+ int *Y2);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_rect_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_revision.h b/alienblaster/project/jni/sdl/include/SDL_revision.h
new file mode 100644
index 000000000..3af3861e3
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_revision.h
@@ -0,0 +1 @@
+#define SDL_REVISION "hg-4467:0baef09fe702"
diff --git a/alienblaster/project/jni/sdl/include/SDL_rwops.h b/alienblaster/project/jni/sdl/include/SDL_rwops.h
index a450119f1..f6ba4a8a0 100644
--- a/alienblaster/project/jni/sdl/include/SDL_rwops.h
+++ b/alienblaster/project/jni/sdl/include/SDL_rwops.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,9 @@
slouken@libsdl.org
*/
-/** @file SDL_rwops.h
+/**
+ * \file SDL_rwops.h
+ *
* This file provides a general interface for SDL to read and write
* data sources. It can easily be extended to files, memory, etc.
*/
@@ -34,122 +36,171 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** This is the read/write operation structure -- very basic */
+/**
+ * This is the read/write operation structure -- very basic.
+ */
+typedef struct SDL_RWops
+{
+ /**
+ * Seek to \c offset relative to \c whence, one of stdio's whence values:
+ * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
+ *
+ * \return the final offset in the data source.
+ */
+ long (SDLCALL * seek) (struct SDL_RWops * context, long offset,
+ int whence);
-typedef struct SDL_RWops {
- /** Seek to 'offset' relative to whence, one of stdio's whence values:
- * SEEK_SET, SEEK_CUR, SEEK_END
- * Returns the final offset in the data source.
- */
- int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
+ /**
+ * Read up to \c maxnum objects each of size \c size from the data
+ * source to the area pointed at by \c ptr.
+ *
+ * \return the number of objects read, or 0 at error or end of file.
+ */
+ size_t(SDLCALL * read) (struct SDL_RWops * context, void *ptr,
+ size_t size, size_t maxnum);
- /** Read up to 'maxnum' objects each of size 'size' from the data
- * source to the area pointed at by 'ptr'.
- * Returns the number of objects read, or -1 if the read failed.
- */
- int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
+ /**
+ * Write exactly \c num objects each of size \c objsize from the area
+ * pointed at by \c ptr to data source.
+ *
+ * \return the number of objects written, or 0 at error or end of file.
+ */
+ size_t(SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
+ size_t size, size_t num);
- /** Write exactly 'num' objects each of size 'objsize' from the area
- * pointed at by 'ptr' to data source.
- * Returns 'num', or -1 if the write failed.
- */
- int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
+ /**
+ * Close and free an allocated SDL_RWops structure.
+ *
+ * \return 0 if successful or -1 on write error when flushing data.
+ */
+ int (SDLCALL * close) (struct SDL_RWops * context);
- /** Close and free an allocated SDL_FSops structure */
- int (SDLCALL *close)(struct SDL_RWops *context);
-
- Uint32 type;
- union {
-#if defined(__WIN32__) && !defined(__SYMBIAN32__)
- struct {
- int append;
- void *h;
- struct {
- void *data;
- int size;
- int left;
- } buffer;
- } win32io;
+ Uint32 type;
+ union
+ {
+#ifdef __WIN32__
+ struct
+ {
+ SDL_bool append;
+ void *h;
+ struct
+ {
+ void *data;
+ size_t size;
+ size_t left;
+ } buffer;
+ } win32io;
#endif
-#ifdef HAVE_STDIO_H
- struct {
- int autoclose;
- FILE *fp;
- } stdio;
+#ifdef HAVE_STDIO_H
+ struct
+ {
+ SDL_bool autoclose;
+ FILE *fp;
+ } stdio;
#endif
- struct {
- Uint8 *base;
- Uint8 *here;
- Uint8 *stop;
- } mem;
- struct {
- void *data1;
- } unknown;
- } hidden;
+ struct
+ {
+ Uint8 *base;
+ Uint8 *here;
+ Uint8 *stop;
+ } mem;
+ struct
+ {
+ void *data1;
+ } unknown;
+ } hidden;
} SDL_RWops;
-/** @name Functions to create SDL_RWops structures from various data sources */
+/**
+ * \name RWFrom functions
+ *
+ * Functions to create SDL_RWops structures from various data sources.
+ */
/*@{*/
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
+ const char *mode);
#ifdef HAVE_STDIO_H
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp,
+ SDL_bool autoclose);
+#else
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
+ SDL_bool autoclose);
#endif
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
+extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
+ int size);
-extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
-extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
+/*@}*//*RWFrom functions*/
-/*@}*/
-/** @name Seek Reference Points */
-/*@{*/
-#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
-#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
-#define RW_SEEK_END 2 /**< Seek relative to the end of data */
-/*@}*/
+extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
+extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
-/** @name Macros to easily read and write from an SDL_RWops structure */
+#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
+#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
+#define RW_SEEK_END 2 /**< Seek relative to the end of data */
+
+/**
+ * \name Read/write macros
+ *
+ * Macros to easily read and write from an SDL_RWops structure.
+ */
/*@{*/
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
#define SDL_RWclose(ctx) (ctx)->close(ctx)
-/*@}*/
+/*@}*//*Read/write macros*/
-/** @name Read an item of the specified endianness and return in native format */
-/*@{*/
-extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
-extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
-/*@}*/
-/** @name Write an item of native format to the specified endianness */
+/**
+ * \name Read endian functions
+ *
+ * Read an item of the specified endianness and return in native format.
+ */
/*@{*/
-extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
-extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
-extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
-extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
-extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
-extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
-/*@}*/
+extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
+extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
+extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
+extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
+extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
+extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
+/*@}*//*Read endian functions*/
+
+/**
+ * \name Write endian functions
+ *
+ * Write an item of native format to the specified endianness.
+ */
+/*@{*/
+extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
+extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
+/*@}*//*Write endian functions*/
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_rwops_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_scancode.h b/alienblaster/project/jni/sdl/include/SDL_scancode.h
new file mode 100644
index 000000000..0efaf8850
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_scancode.h
@@ -0,0 +1,399 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/**
+ * \file SDL_scancode.h
+ *
+ * Defines keyboard scancodes.
+ */
+
+#ifndef _SDL_scancode_h
+#define _SDL_scancode_h
+
+#include "SDL_stdinc.h"
+
+/**
+ * \brief The SDL keyboard scancode representation.
+ *
+ * Values of this type are used to represent keyboard keys, among other places
+ * in the \link SDL_keysym::scancode key.keysym.scancode \endlink field of the
+ * SDL_Event structure.
+ *
+ * The values in this enumeration are based on the USB usage page standard:
+ * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
+ */
+typedef enum
+{
+ SDL_SCANCODE_UNKNOWN = 0,
+
+ /**
+ * \name Usage page 0x07
+ *
+ * These values are from usage page 0x07 (USB keyboard page).
+ */
+ /*@{*/
+
+ SDL_SCANCODE_A = 4,
+ SDL_SCANCODE_B = 5,
+ SDL_SCANCODE_C = 6,
+ SDL_SCANCODE_D = 7,
+ SDL_SCANCODE_E = 8,
+ SDL_SCANCODE_F = 9,
+ SDL_SCANCODE_G = 10,
+ SDL_SCANCODE_H = 11,
+ SDL_SCANCODE_I = 12,
+ SDL_SCANCODE_J = 13,
+ SDL_SCANCODE_K = 14,
+ SDL_SCANCODE_L = 15,
+ SDL_SCANCODE_M = 16,
+ SDL_SCANCODE_N = 17,
+ SDL_SCANCODE_O = 18,
+ SDL_SCANCODE_P = 19,
+ SDL_SCANCODE_Q = 20,
+ SDL_SCANCODE_R = 21,
+ SDL_SCANCODE_S = 22,
+ SDL_SCANCODE_T = 23,
+ SDL_SCANCODE_U = 24,
+ SDL_SCANCODE_V = 25,
+ SDL_SCANCODE_W = 26,
+ SDL_SCANCODE_X = 27,
+ SDL_SCANCODE_Y = 28,
+ SDL_SCANCODE_Z = 29,
+
+ SDL_SCANCODE_1 = 30,
+ SDL_SCANCODE_2 = 31,
+ SDL_SCANCODE_3 = 32,
+ SDL_SCANCODE_4 = 33,
+ SDL_SCANCODE_5 = 34,
+ SDL_SCANCODE_6 = 35,
+ SDL_SCANCODE_7 = 36,
+ SDL_SCANCODE_8 = 37,
+ SDL_SCANCODE_9 = 38,
+ SDL_SCANCODE_0 = 39,
+
+ SDL_SCANCODE_RETURN = 40,
+ SDL_SCANCODE_ESCAPE = 41,
+ SDL_SCANCODE_BACKSPACE = 42,
+ SDL_SCANCODE_TAB = 43,
+ SDL_SCANCODE_SPACE = 44,
+
+ SDL_SCANCODE_MINUS = 45,
+ SDL_SCANCODE_EQUALS = 46,
+ SDL_SCANCODE_LEFTBRACKET = 47,
+ SDL_SCANCODE_RIGHTBRACKET = 48,
+ SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
+ * key on ISO keyboards and at the right end
+ * of the QWERTY row on ANSI keyboards.
+ * Produces REVERSE SOLIDUS (backslash) and
+ * VERTICAL LINE in a US layout, REVERSE
+ * SOLIDUS and VERTICAL LINE in a UK Mac
+ * layout, NUMBER SIGN and TILDE in a UK
+ * Windows layout, DOLLAR SIGN and POUND SIGN
+ * in a Swiss German layout, NUMBER SIGN and
+ * APOSTROPHE in a German layout, GRAVE
+ * ACCENT and POUND SIGN in a French Mac
+ * layout, and ASTERISK and MICRO SIGN in a
+ * French Windows layout.
+ */
+ SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
+ * instead of 49 for the same key, but all
+ * OSes I've seen treat the two codes
+ * identically. So, as an implementor, unless
+ * your keyboard generates both of those
+ * codes and your OS treats them differently,
+ * you should generate SDL_SCANCODE_BACKSLASH
+ * instead of this code. As a user, you
+ * should not rely on this code because SDL
+ * will never generate it with most (all?)
+ * keyboards.
+ */
+ SDL_SCANCODE_SEMICOLON = 51,
+ SDL_SCANCODE_APOSTROPHE = 52,
+ SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
+ * and ISO keyboards). Produces GRAVE ACCENT and
+ * TILDE in a US Windows layout and in US and UK
+ * Mac layouts on ANSI keyboards, GRAVE ACCENT
+ * and NOT SIGN in a UK Windows layout, SECTION
+ * SIGN and PLUS-MINUS SIGN in US and UK Mac
+ * layouts on ISO keyboards, SECTION SIGN and
+ * DEGREE SIGN in a Swiss German layout (Mac:
+ * only on ISO keyboards), CIRCUMFLEX ACCENT and
+ * DEGREE SIGN in a German layout (Mac: only on
+ * ISO keyboards), SUPERSCRIPT TWO and TILDE in a
+ * French Windows layout, COMMERCIAL AT and
+ * NUMBER SIGN in a French Mac layout on ISO
+ * keyboards, and LESS-THAN SIGN and GREATER-THAN
+ * SIGN in a Swiss German, German, or French Mac
+ * layout on ANSI keyboards.
+ */
+ SDL_SCANCODE_COMMA = 54,
+ SDL_SCANCODE_PERIOD = 55,
+ SDL_SCANCODE_SLASH = 56,
+
+ SDL_SCANCODE_CAPSLOCK = 57,
+
+ SDL_SCANCODE_F1 = 58,
+ SDL_SCANCODE_F2 = 59,
+ SDL_SCANCODE_F3 = 60,
+ SDL_SCANCODE_F4 = 61,
+ SDL_SCANCODE_F5 = 62,
+ SDL_SCANCODE_F6 = 63,
+ SDL_SCANCODE_F7 = 64,
+ SDL_SCANCODE_F8 = 65,
+ SDL_SCANCODE_F9 = 66,
+ SDL_SCANCODE_F10 = 67,
+ SDL_SCANCODE_F11 = 68,
+ SDL_SCANCODE_F12 = 69,
+
+ SDL_SCANCODE_PRINTSCREEN = 70,
+ SDL_SCANCODE_SCROLLLOCK = 71,
+ SDL_SCANCODE_PAUSE = 72,
+ SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
+ does send code 73, not 117) */
+ SDL_SCANCODE_HOME = 74,
+ SDL_SCANCODE_PAGEUP = 75,
+ SDL_SCANCODE_DELETE = 76,
+ SDL_SCANCODE_END = 77,
+ SDL_SCANCODE_PAGEDOWN = 78,
+ SDL_SCANCODE_RIGHT = 79,
+ SDL_SCANCODE_LEFT = 80,
+ SDL_SCANCODE_DOWN = 81,
+ SDL_SCANCODE_UP = 82,
+
+ SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
+ */
+ SDL_SCANCODE_KP_DIVIDE = 84,
+ SDL_SCANCODE_KP_MULTIPLY = 85,
+ SDL_SCANCODE_KP_MINUS = 86,
+ SDL_SCANCODE_KP_PLUS = 87,
+ SDL_SCANCODE_KP_ENTER = 88,
+ SDL_SCANCODE_KP_1 = 89,
+ SDL_SCANCODE_KP_2 = 90,
+ SDL_SCANCODE_KP_3 = 91,
+ SDL_SCANCODE_KP_4 = 92,
+ SDL_SCANCODE_KP_5 = 93,
+ SDL_SCANCODE_KP_6 = 94,
+ SDL_SCANCODE_KP_7 = 95,
+ SDL_SCANCODE_KP_8 = 96,
+ SDL_SCANCODE_KP_9 = 97,
+ SDL_SCANCODE_KP_0 = 98,
+ SDL_SCANCODE_KP_PERIOD = 99,
+
+ SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
+ * keyboards have over ANSI ones,
+ * located between left shift and Y.
+ * Produces GRAVE ACCENT and TILDE in a
+ * US or UK Mac layout, REVERSE SOLIDUS
+ * (backslash) and VERTICAL LINE in a
+ * US or UK Windows layout, and
+ * LESS-THAN SIGN and GREATER-THAN SIGN
+ * in a Swiss German, German, or French
+ * layout. */
+ SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
+ SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
+ * not a physical key - but some Mac keyboards
+ * do have a power key. */
+ SDL_SCANCODE_KP_EQUALS = 103,
+ SDL_SCANCODE_F13 = 104,
+ SDL_SCANCODE_F14 = 105,
+ SDL_SCANCODE_F15 = 106,
+ SDL_SCANCODE_F16 = 107,
+ SDL_SCANCODE_F17 = 108,
+ SDL_SCANCODE_F18 = 109,
+ SDL_SCANCODE_F19 = 110,
+ SDL_SCANCODE_F20 = 111,
+ SDL_SCANCODE_F21 = 112,
+ SDL_SCANCODE_F22 = 113,
+ SDL_SCANCODE_F23 = 114,
+ SDL_SCANCODE_F24 = 115,
+ SDL_SCANCODE_EXECUTE = 116,
+ SDL_SCANCODE_HELP = 117,
+ SDL_SCANCODE_MENU = 118,
+ SDL_SCANCODE_SELECT = 119,
+ SDL_SCANCODE_STOP = 120,
+ SDL_SCANCODE_AGAIN = 121, /**< redo */
+ SDL_SCANCODE_UNDO = 122,
+ SDL_SCANCODE_CUT = 123,
+ SDL_SCANCODE_COPY = 124,
+ SDL_SCANCODE_PASTE = 125,
+ SDL_SCANCODE_FIND = 126,
+ SDL_SCANCODE_MUTE = 127,
+ SDL_SCANCODE_VOLUMEUP = 128,
+ SDL_SCANCODE_VOLUMEDOWN = 129,
+/* not sure whether there's a reason to enable these */
+/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
+/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
+/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
+ SDL_SCANCODE_KP_COMMA = 133,
+ SDL_SCANCODE_KP_EQUALSAS400 = 134,
+
+ SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
+ footnotes in USB doc */
+ SDL_SCANCODE_INTERNATIONAL2 = 136,
+ SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
+ SDL_SCANCODE_INTERNATIONAL4 = 138,
+ SDL_SCANCODE_INTERNATIONAL5 = 139,
+ SDL_SCANCODE_INTERNATIONAL6 = 140,
+ SDL_SCANCODE_INTERNATIONAL7 = 141,
+ SDL_SCANCODE_INTERNATIONAL8 = 142,
+ SDL_SCANCODE_INTERNATIONAL9 = 143,
+ SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */
+ SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */
+ SDL_SCANCODE_LANG3 = 146, /**< Katakana */
+ SDL_SCANCODE_LANG4 = 147, /**< Hiragana */
+ SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */
+ SDL_SCANCODE_LANG6 = 149, /**< reserved */
+ SDL_SCANCODE_LANG7 = 150, /**< reserved */
+ SDL_SCANCODE_LANG8 = 151, /**< reserved */
+ SDL_SCANCODE_LANG9 = 152, /**< reserved */
+
+ SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
+ SDL_SCANCODE_SYSREQ = 154,
+ SDL_SCANCODE_CANCEL = 155,
+ SDL_SCANCODE_CLEAR = 156,
+ SDL_SCANCODE_PRIOR = 157,
+ SDL_SCANCODE_RETURN2 = 158,
+ SDL_SCANCODE_SEPARATOR = 159,
+ SDL_SCANCODE_OUT = 160,
+ SDL_SCANCODE_OPER = 161,
+ SDL_SCANCODE_CLEARAGAIN = 162,
+ SDL_SCANCODE_CRSEL = 163,
+ SDL_SCANCODE_EXSEL = 164,
+
+ SDL_SCANCODE_KP_00 = 176,
+ SDL_SCANCODE_KP_000 = 177,
+ SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
+ SDL_SCANCODE_DECIMALSEPARATOR = 179,
+ SDL_SCANCODE_CURRENCYUNIT = 180,
+ SDL_SCANCODE_CURRENCYSUBUNIT = 181,
+ SDL_SCANCODE_KP_LEFTPAREN = 182,
+ SDL_SCANCODE_KP_RIGHTPAREN = 183,
+ SDL_SCANCODE_KP_LEFTBRACE = 184,
+ SDL_SCANCODE_KP_RIGHTBRACE = 185,
+ SDL_SCANCODE_KP_TAB = 186,
+ SDL_SCANCODE_KP_BACKSPACE = 187,
+ SDL_SCANCODE_KP_A = 188,
+ SDL_SCANCODE_KP_B = 189,
+ SDL_SCANCODE_KP_C = 190,
+ SDL_SCANCODE_KP_D = 191,
+ SDL_SCANCODE_KP_E = 192,
+ SDL_SCANCODE_KP_F = 193,
+ SDL_SCANCODE_KP_XOR = 194,
+ SDL_SCANCODE_KP_POWER = 195,
+ SDL_SCANCODE_KP_PERCENT = 196,
+ SDL_SCANCODE_KP_LESS = 197,
+ SDL_SCANCODE_KP_GREATER = 198,
+ SDL_SCANCODE_KP_AMPERSAND = 199,
+ SDL_SCANCODE_KP_DBLAMPERSAND = 200,
+ SDL_SCANCODE_KP_VERTICALBAR = 201,
+ SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
+ SDL_SCANCODE_KP_COLON = 203,
+ SDL_SCANCODE_KP_HASH = 204,
+ SDL_SCANCODE_KP_SPACE = 205,
+ SDL_SCANCODE_KP_AT = 206,
+ SDL_SCANCODE_KP_EXCLAM = 207,
+ SDL_SCANCODE_KP_MEMSTORE = 208,
+ SDL_SCANCODE_KP_MEMRECALL = 209,
+ SDL_SCANCODE_KP_MEMCLEAR = 210,
+ SDL_SCANCODE_KP_MEMADD = 211,
+ SDL_SCANCODE_KP_MEMSUBTRACT = 212,
+ SDL_SCANCODE_KP_MEMMULTIPLY = 213,
+ SDL_SCANCODE_KP_MEMDIVIDE = 214,
+ SDL_SCANCODE_KP_PLUSMINUS = 215,
+ SDL_SCANCODE_KP_CLEAR = 216,
+ SDL_SCANCODE_KP_CLEARENTRY = 217,
+ SDL_SCANCODE_KP_BINARY = 218,
+ SDL_SCANCODE_KP_OCTAL = 219,
+ SDL_SCANCODE_KP_DECIMAL = 220,
+ SDL_SCANCODE_KP_HEXADECIMAL = 221,
+
+ SDL_SCANCODE_LCTRL = 224,
+ SDL_SCANCODE_LSHIFT = 225,
+ SDL_SCANCODE_LALT = 226, /**< alt, option */
+ SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
+ SDL_SCANCODE_RCTRL = 228,
+ SDL_SCANCODE_RSHIFT = 229,
+ SDL_SCANCODE_RALT = 230, /**< alt gr, option */
+ SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
+
+ SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
+ * by any of the above, but since there's a
+ * special KMOD_MODE for it I'm adding it here
+ */
+
+ /*@}*//*Usage page 0x07*/
+
+ /**
+ * \name Usage page 0x0C
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /*@{*/
+
+ SDL_SCANCODE_AUDIONEXT = 258,
+ SDL_SCANCODE_AUDIOPREV = 259,
+ SDL_SCANCODE_AUDIOSTOP = 260,
+ SDL_SCANCODE_AUDIOPLAY = 261,
+ SDL_SCANCODE_AUDIOMUTE = 262,
+ SDL_SCANCODE_MEDIASELECT = 263,
+ SDL_SCANCODE_WWW = 264,
+ SDL_SCANCODE_MAIL = 265,
+ SDL_SCANCODE_CALCULATOR = 266,
+ SDL_SCANCODE_COMPUTER = 267,
+ SDL_SCANCODE_AC_SEARCH = 268,
+ SDL_SCANCODE_AC_HOME = 269,
+ SDL_SCANCODE_AC_BACK = 270,
+ SDL_SCANCODE_AC_FORWARD = 271,
+ SDL_SCANCODE_AC_STOP = 272,
+ SDL_SCANCODE_AC_REFRESH = 273,
+ SDL_SCANCODE_AC_BOOKMARKS = 274,
+
+ /*@}*//*Usage page 0x0C*/
+
+ /**
+ * \name Walther keys
+ *
+ * These are values that Christian Walther added (for mac keyboard?).
+ */
+ /*@{*/
+
+ SDL_SCANCODE_BRIGHTNESSDOWN = 275,
+ SDL_SCANCODE_BRIGHTNESSUP = 276,
+ SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
+ switch, video mode switch */
+ SDL_SCANCODE_KBDILLUMTOGGLE = 278,
+ SDL_SCANCODE_KBDILLUMDOWN = 279,
+ SDL_SCANCODE_KBDILLUMUP = 280,
+ SDL_SCANCODE_EJECT = 281,
+ SDL_SCANCODE_SLEEP = 282,
+
+ /*@}*//*Walther keys*/
+
+ /* Add any other keys here. */
+
+ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
+ for array bounds */
+} SDL_scancode;
+
+#endif /* _SDL_scancode_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_stdinc.h b/alienblaster/project/jni/sdl/include/SDL_stdinc.h
index e1f85fb75..c7e7edd57 100644
--- a/alienblaster/project/jni/sdl/include/SDL_stdinc.h
+++ b/alienblaster/project/jni/sdl/include/SDL_stdinc.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,10 @@
slouken@libsdl.org
*/
-/** @file SDL_stdinc.h
- * This is a general header that includes C language support
+/**
+ * \file SDL_stdinc.h
+ *
+ * This is a general header that includes C language support.
*/
#ifndef _SDL_stdinc_h
@@ -70,16 +72,26 @@
#ifdef HAVE_CTYPE_H
# include
#endif
+#ifdef HAVE_MATH_H
+# include
+#endif
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
# include
#endif
-/** The number of elements in an array */
+/**
+ * The number of elements in an array.
+ */
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
#define SDL_TABLESIZE(table) SDL_arraysize(table)
-/* Use proper C++ casts when compiled as C++ to be compatible with the option
- -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */
+/**
+ * \name Cast operators
+ *
+ * Use proper C++ casts when compiled as C++ to be compatible with the option
+ * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
+ */
+/*@{*/
#ifdef __cplusplus
#define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression)
#define SDL_static_cast(type, expression) static_cast(expression)
@@ -87,93 +99,130 @@
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
#define SDL_static_cast(type, expression) ((type)(expression))
#endif
+/*@}*//*Cast operators*/
-/** @name Basic data types */
+/**
+ * \name Basic data types
+ */
/*@{*/
-typedef enum {
- SDL_FALSE = 0,
- SDL_TRUE = 1
+
+typedef enum
+{
+ SDL_FALSE = 0,
+ SDL_TRUE = 1
} SDL_bool;
-typedef int8_t Sint8;
-typedef uint8_t Uint8;
-typedef int16_t Sint16;
-typedef uint16_t Uint16;
-typedef int32_t Sint32;
-typedef uint32_t Uint32;
+/**
+ * \brief A signed 8-bit integer type.
+ */
+typedef int8_t Sint8;
+/**
+ * \brief An unsigned 8-bit integer type.
+ */
+typedef uint8_t Uint8;
+/**
+ * \brief A signed 16-bit integer type.
+ */
+typedef int16_t Sint16;
+/**
+ * \brief An unsigned 16-bit integer type.
+ */
+typedef uint16_t Uint16;
+/**
+ * \brief A signed 32-bit integer type.
+ */
+typedef int32_t Sint32;
+/**
+ * \brief An unsigned 32-bit integer type.
+ */
+typedef uint32_t Uint32;
#ifdef SDL_HAS_64BIT_TYPE
-typedef int64_t Sint64;
-#ifndef SYMBIAN32_GCCE
-typedef uint64_t Uint64;
-#endif
+/**
+ * \brief A signed 64-bit integer type.
+ * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32!
+ */
+typedef int64_t Sint64;
+/**
+ * \brief An unsigned 64-bit integer type.
+ * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32!
+ */
+typedef uint64_t Uint64;
#else
/* This is really just a hack to prevent the compiler from complaining */
-typedef struct {
- Uint32 hi;
- Uint32 lo;
-} Uint64, Sint64;
+typedef Sint32 Sint64;
+typedef Uint32 Uint64;
#endif
-/*@}*/
+/*@}*//*Basic data types*/
+
-/** @name Make sure the types really have the right sizes */
-/*@{*/
#define SDL_COMPILE_TIME_ASSERT(name, x) \
typedef int SDL_dummy_ ## name[(x) * 2 - 1]
-
+/** \cond */
+#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
+#ifndef __NINTENDODS__ /* TODO: figure out why the following happens:
+ include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
+ include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
-/*@}*/
+#endif
+#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
+/** \endcond */
-/** @name Enum Size Check
- * Check to make sure enums are the size of ints, for structure packing.
- * For both Watcom C/C++ and Borland C/C++ the compiler option that makes
- * enums having the size of an int must be enabled.
- * This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
- */
+/* Check to make sure enums are the size of ints, for structure packing.
+ For both Watcom C/C++ and Borland C/C++ the compiler option that makes
+ enums having the size of an int must be enabled.
+ This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
+*/
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
#ifdef __MWERKS__
#pragma enumsalwaysint on
#endif
-typedef enum {
- DUMMY_ENUM_VALUE
+/** \cond */
+#ifndef DOXYGEN_SHOULD_IGNORE_THIS
+#ifndef __NINTENDODS__ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
+typedef enum
+{
+ DUMMY_ENUM_VALUE
} SDL_DUMMY_ENUM;
-#ifndef __NDS__
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#endif
-/*@}*/
+#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
+/** \endcond */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
#ifdef HAVE_MALLOC
#define SDL_malloc malloc
#else
-extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
+extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
#endif
#ifdef HAVE_CALLOC
#define SDL_calloc calloc
#else
-extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size);
+extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
#endif
#ifdef HAVE_REALLOC
#define SDL_realloc realloc
#else
-extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
+extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
#endif
#ifdef HAVE_FREE
@@ -197,11 +246,11 @@ extern DECLSPEC void SDLCALL SDL_free(void *mem);
# elif defined(__DMC__)
# include
# elif defined(__AIX__)
- #pragma alloca
+#pragma alloca
# elif defined(__MRC__)
- void *alloca (unsigned);
+void *alloca(unsigned);
# else
- char *alloca ();
+char *alloca();
# endif
#endif
#ifdef HAVE_ALLOCA
@@ -215,20 +264,23 @@ extern DECLSPEC void SDLCALL SDL_free(void *mem);
#ifdef HAVE_GETENV
#define SDL_getenv getenv
#else
-extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
+extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
#endif
-#ifdef HAVE_PUTENV
-#define SDL_putenv putenv
+/* SDL_putenv() has moved to SDL_compat. */
+#ifdef HAVE_SETENV
+#define SDL_setenv setenv
#else
-extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
+extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value,
+ int overwrite);
#endif
#ifdef HAVE_QSORT
#define SDL_qsort qsort
#else
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
- int (*compare)(const void *, const void *));
+ int (*compare) (const void *,
+ const void *));
#endif
#ifdef HAVE_ABS
@@ -255,8 +307,10 @@ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
#ifdef HAVE_MEMSET
#define SDL_memset memset
#else
-extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
+extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
#endif
+#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
+#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
#if defined(__GNUC__) && defined(i386)
#define SDL_memset4(dst, val, len) \
@@ -275,7 +329,7 @@ do { \
do { \
unsigned _count = (len); \
unsigned _n = (_count + 3) / 4; \
- Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
+ Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
Uint32 _val = (val); \
if (len == 0) break; \
switch (_count % 4) { \
@@ -316,7 +370,8 @@ do { \
#elif defined(HAVE_BCOPY)
#define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
#else
-extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
+extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
+ size_t len);
#endif
#endif
@@ -343,8 +398,8 @@ do { \
#define SDL_revcpy(dst, src, len) \
do { \
int u0, u1, u2; \
- char *dstp = SDL_static_cast(char *, dst); \
- char *srcp = SDL_static_cast(char *, src); \
+ char *dstp = SDL_static_cast(char *, dst); \
+ char *srcp = SDL_static_cast(char *, src); \
int n = (len); \
if ( n >= 4 ) { \
__asm__ __volatile__ ( \
@@ -367,7 +422,8 @@ do { \
} while(0)
#endif
#ifndef SDL_revcpy
-extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len);
+extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src,
+ size_t len);
#endif
#ifdef HAVE_MEMMOVE
@@ -388,7 +444,8 @@ do { \
#ifdef HAVE_MEMCMP
#define SDL_memcmp memcmp
#else
-extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2,
+ size_t len);
#endif
#ifdef HAVE_STRLEN
@@ -397,40 +454,51 @@ extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t le
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
#endif
+#ifdef HAVE_WCSLEN
+#define SDL_wcslen wcslen
+#else
+#if !defined(wchar_t) && defined(__NINTENDODS__)
+#define wchar_t short /* TODO: figure out why libnds doesn't have this */
+#endif
+extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
+#endif
+
#ifdef HAVE_STRLCPY
#define SDL_strlcpy strlcpy
#else
-extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
+extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
+ size_t maxlen);
#endif
#ifdef HAVE_STRLCAT
#define SDL_strlcat strlcat
#else
-extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
+extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
+ size_t maxlen);
#endif
#ifdef HAVE_STRDUP
#define SDL_strdup strdup
#else
-extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
+extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
#endif
#ifdef HAVE__STRREV
#define SDL_strrev _strrev
#else
-extern DECLSPEC char * SDLCALL SDL_strrev(char *string);
+extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
#endif
#ifdef HAVE__STRUPR
#define SDL_strupr _strupr
#else
-extern DECLSPEC char * SDLCALL SDL_strupr(char *string);
+extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
#endif
#ifdef HAVE__STRLWR
#define SDL_strlwr _strlwr
#else
-extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
+extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
#endif
#ifdef HAVE_STRCHR
@@ -438,7 +506,7 @@ extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
#elif defined(HAVE_INDEX)
#define SDL_strchr index
#else
-extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
+extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
#endif
#ifdef HAVE_STRRCHR
@@ -446,13 +514,14 @@ extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
#elif defined(HAVE_RINDEX)
#define SDL_strrchr rindex
#else
-extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c);
+extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
#endif
#ifdef HAVE_STRSTR
#define SDL_strstr strstr
#else
-extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack,
+ const char *needle);
#endif
#ifdef HAVE_ITOA
@@ -464,7 +533,7 @@ extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *need
#ifdef HAVE__LTOA
#define SDL_ltoa _ltoa
#else
-extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
+extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix);
#endif
#ifdef HAVE__UITOA
@@ -476,19 +545,22 @@ extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
#ifdef HAVE__ULTOA
#define SDL_ultoa _ultoa
#else
-extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix);
+extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
+ int radix);
#endif
#ifdef HAVE_STRTOL
#define SDL_strtol strtol
#else
-extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
+extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
+ int base);
#endif
#ifdef HAVE_STRTOUL
#define SDL_strtoul strtoul
#else
-extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
+extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
+ char **endp, int base);
#endif
#ifdef SDL_HAS_64BIT_TYPE
@@ -496,25 +568,29 @@ extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **end
#ifdef HAVE__I64TOA
#define SDL_lltoa _i64toa
#else
-extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix);
+extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
+ int radix);
#endif
#ifdef HAVE__UI64TOA
#define SDL_ulltoa _ui64toa
#else
-extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
+extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
+ int radix);
#endif
#ifdef HAVE_STRTOLL
#define SDL_strtoll strtoll
#else
-extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
+extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
+ int base);
#endif
#ifdef HAVE_STRTOULL
#define SDL_strtoull strtoull
#else
-extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
+extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
+ int base);
#endif
#endif /* SDL_HAS_64BIT_TYPE */
@@ -546,7 +622,8 @@ extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
#ifdef HAVE_STRNCMP
#define SDL_strncmp strncmp
#else
-extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
+ size_t maxlen);
#endif
#ifdef HAVE_STRCASECMP
@@ -554,7 +631,8 @@ extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size
#elif defined(HAVE__STRICMP)
#define SDL_strcasecmp _stricmp
#else
-extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
+extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
+ const char *str2);
#endif
#ifdef HAVE_STRNCASECMP
@@ -562,36 +640,112 @@ extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
#elif defined(HAVE__STRNICMP)
#define SDL_strncasecmp _strnicmp
#else
-extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
+ const char *str2, size_t maxlen);
#endif
#ifdef HAVE_SSCANF
#define SDL_sscanf sscanf
#else
-extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
+extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt,
+ ...);
#endif
#ifdef HAVE_SNPRINTF
#define SDL_snprintf snprintf
#else
-extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
+extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
+ const char *fmt, ...);
#endif
#ifdef HAVE_VSNPRINTF
#define SDL_vsnprintf vsnprintf
#else
-extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
+extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
+ const char *fmt, va_list ap);
#endif
-/** @name SDL_ICONV Error Codes
- * The SDL implementation of iconv() returns these error codes
- */
-/*@{*/
+#ifndef HAVE_M_PI
+#define M_PI 3.14159265358979323846264338327950288 /* pi */
+#endif
+
+#ifdef HAVE_CEIL
+#define SDL_ceil ceil
+#else
+#define SDL_ceil(x) ((double)(int)((x)+0.5))
+#endif
+
+#ifdef HAVE_COPYSIGN
+#define SDL_copysign copysign
+#else
+extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+#endif
+
+#ifdef HAVE_COS
+#define SDL_cos cos
+#else
+extern DECLSPEC double SDLCALL SDL_cos(double x);
+#endif
+
+#ifdef HAVE_COSF
+#define SDL_cosf cosf
+#else
+#define SDL_cosf(x) (float)SDL_cos((double)x)
+#endif
+
+#ifdef HAVE_FABS
+#define SDL_fabs fabs
+#else
+extern DECLSPEC double SDLCALL SDL_fabs(double x);
+#endif
+
+#ifdef HAVE_FLOOR
+#define SDL_floor floor
+#else
+extern DECLSPEC double SDLCALL SDL_floor(double x);
+#endif
+
+#ifdef HAVE_LOG
+#define SDL_log log
+#else
+extern DECLSPEC double SDLCALL SDL_log(double x);
+#endif
+
+#ifdef HAVE_POW
+#define SDL_pow pow
+#else
+extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+#endif
+
+#ifdef HAVE_SCALBN
+#define SDL_scalbn scalbn
+#else
+extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+#endif
+
+#ifdef HAVE_SIN
+#define SDL_sin sin
+#else
+extern DECLSPEC double SDLCALL SDL_sin(double x);
+#endif
+
+#ifdef HAVE_SINF
+#define SDL_sinf sinf
+#else
+#define SDL_sinf(x) (float)SDL_sin((double)x)
+#endif
+
+#ifdef HAVE_SQRT
+#define SDL_sqrt sqrt
+#else
+extern DECLSPEC double SDLCALL SDL_sqrt(double x);
+#endif
+
+/* The SDL implementation of iconv() returns these error codes */
#define SDL_ICONV_ERROR (size_t)-1
#define SDL_ICONV_E2BIG (size_t)-2
#define SDL_ICONV_EILSEQ (size_t)-3
#define SDL_ICONV_EINVAL (size_t)-4
-/*@}*/
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
#define SDL_iconv_t iconv_t
@@ -599,22 +753,33 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char
#define SDL_iconv_close iconv_close
#else
typedef struct _SDL_iconv_t *SDL_iconv_t;
-extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
+extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
+ const char *fromcode);
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
#endif
-extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
-/** This function converts a string between encodings in one pass, returning a
+extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
+ size_t * inbytesleft, char **outbuf,
+ size_t * outbytesleft);
+/**
+ * This function converts a string between encodings in one pass, returning a
* string that must be freed with SDL_free() or NULL on error.
*/
-extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
+extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
+ const char *fromcode,
+ const char *inbuf,
+ size_t inbytesleft);
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_stdinc_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_surface.h b/alienblaster/project/jni/sdl/include/SDL_surface.h
new file mode 100644
index 000000000..2068076f3
--- /dev/null
+++ b/alienblaster/project/jni/sdl/include/SDL_surface.h
@@ -0,0 +1,700 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/**
+ * \file SDL_surface.h
+ *
+ * Header file for ::SDL_surface definition and management functions.
+ */
+
+#ifndef _SDL_surface_h
+#define _SDL_surface_h
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_rwops.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \name Surface flags
+ *
+ * These are the currently supported flags for the ::SDL_surface.
+ *
+ * \internal
+ * Used internally (read-only).
+ */
+/*@{*/
+#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
+#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
+/*@}*//*Surface flags*/
+
+/**
+ * Evaluates to true if the surface needs to be locked before access.
+ */
+#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
+
+/**
+ * \brief A collection of pixels used in software blitting.
+ *
+ * \note This structure should be treated as read-only, except for \c pixels,
+ * which, if not NULL, contains the raw pixel data for the surface.
+ */
+typedef struct SDL_Surface
+{
+ Uint32 flags; /**< Read-only */
+ SDL_PixelFormat *format; /**< Read-only */
+ int w, h; /**< Read-only */
+ int pitch; /**< Read-only */
+ void *pixels; /**< Read-write */
+
+ /** Application data associated with the surface */
+ void *userdata; /**< Read-write */
+
+ /** information needed for surfaces requiring locks */
+ int locked; /**< Read-only */
+ void *lock_data; /**< Read-only */
+
+ /** clipping information */
+ SDL_Rect clip_rect; /**< Read-only */
+
+ /** info for fast blit mapping to other surfaces */
+ struct SDL_BlitMap *map; /**< Private */
+
+ /** format version, bumped at every change to invalidate blit maps */
+ unsigned int format_version; /**< Private */
+
+ /** Reference count -- used when freeing surface */
+ int refcount; /**< Read-mostly */
+} SDL_Surface;
+
+/**
+ * \brief The type of function used for surface blitting functions.
+ */
+typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+ struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * Allocate and free an RGB surface.
+ *
+ * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
+ * If the depth is greater than 8 bits, the pixel format is set using the
+ * flags '[RGB]mask'.
+ *
+ * If the function runs out of memory, it will return NULL.
+ *
+ * \param flags The \c flags are obsolete and should be set to 0.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
+ (Uint32 flags, int width, int height, int depth,
+ Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
+ int width,
+ int height,
+ int depth,
+ int pitch,
+ Uint32 Rmask,
+ Uint32 Gmask,
+ Uint32 Bmask,
+ Uint32 Amask);
+extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
+
+/**
+ * \brief Set the palette used by a surface.
+ *
+ * \return 0, or -1 if the surface format doesn't use a palette.
+ *
+ * \note A single palette can be shared with many surfaces.
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
+ SDL_Palette * palette);
+
+/**
+ * \brief Sets up a surface for directly accessing the pixels.
+ *
+ * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
+ * to and read from \c surface->pixels, using the pixel format stored in
+ * \c surface->format. Once you are done accessing the surface, you should
+ * use SDL_UnlockSurface() to release it.
+ *
+ * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
+ * to 0, then you can read and write to the surface at any time, and the
+ * pixel format of the surface will not change.
+ *
+ * No operating system or library calls should be made between lock/unlock
+ * pairs, as critical system locks may be held during this time.
+ *
+ * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
+ *
+ * \sa SDL_UnlockSurface()
+ */
+extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
+/** \sa SDL_LockSurface() */
+extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
+
+/**
+ * Load a surface from a seekable SDL data source (memory or file).
+ *
+ * If \c freesrc is non-zero, the source will be closed after being read.
+ *
+ * The new surface should be freed with SDL_FreeSurface().
+ *
+ * \return the new surface, or NULL if there was an error.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
+ int freesrc);
+
+/**
+ * Load a surface from a file.
+ *
+ * Convenience macro.
+ */
+#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
+
+/**
+ * Save a surface to a seekable SDL data source (memory or file).
+ *
+ * If \c freedst is non-zero, the source will be closed after being written.
+ *
+ * \return 0 if successful or -1 if there was an error.
+ */
+extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
+ (SDL_Surface * surface, SDL_RWops * dst, int freedst);
+
+/**
+ * Save a surface to a file.
+ *
+ * Convenience macro.
+ */
+#define SDL_SaveBMP(surface, file) \
+ SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
+
+/**
+ * \brief Sets the RLE acceleration hint for a surface.
+ *
+ * \return 0 on success, or -1 if the surface is not valid
+ *
+ * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
+ * but the surface must be locked before directly accessing the pixels.
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
+ int flag);
+
+/**
+ * \brief Sets the color key (transparent pixel) in a blittable surface.
+ *
+ * \param surface The surface to update
+ * \param flag Non-zero to enable colorkey and 0 to disable colorkey
+ * \param key The transparent pixel in the native surface format
+ *
+ * \return 0 on success, or -1 if the surface is not valid
+ */
+extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
+ int flag, Uint32 key);
+
+/**
+ * \brief Gets the color key (transparent pixel) in a blittable surface.
+ *
+ * \param surface The surface to update
+ * \param key A pointer filled in with the transparent pixel in the native
+ * surface format
+ *
+ * \return 0 on success, or -1 if the surface is not valid or colorkey is not
+ * enabled.
+ */
+extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
+ Uint32 * key);
+
+/**
+ * \brief Set an additional color value used in blit operations.
+ *
+ * \param surface The surface to update.
+ * \param r The red source color value multiplied into blit operations.
+ * \param g The green source color value multiplied into blit operations.
+ * \param b The blue source color value multiplied into blit operations.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_GetSurfaceColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
+ Uint8 r, Uint8 g, Uint8 b);
+
+
+/**
+ * \brief Get the additional color value used in blit operations.
+ *
+ * \param surface The surface to query.
+ * \param r A pointer filled in with the source red color value.
+ * \param g A pointer filled in with the source green color value.
+ * \param b A pointer filled in with the source blue color value.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
+ Uint8 * r, Uint8 * g,
+ Uint8 * b);
+
+/**
+ * \brief Set an additional alpha value used in blit operations.
+ *
+ * \param surface The surface to update.
+ * \param alpha The source alpha value multiplied into blit operations.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_GetSurfaceAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
+ Uint8 alpha);
+
+/**
+ * \brief Get the additional alpha value used in blit operations.
+ *
+ * \param surface The surface to query.
+ * \param alpha A pointer filled in with the source alpha value.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
+ Uint8 * alpha);
+
+/**
+ * \brief Set the blend mode used for blit operations.
+ *
+ * \param surface The surface to update.
+ * \param blendMode ::SDL_BlendMode to use for blit blending.
+ *
+ * \return 0 on success, or -1 if the parameters are not valid.
+ *
+ * \sa SDL_GetSurfaceBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
+ int blendMode);
+
+/**
+ * \brief Get the blend mode used for blit operations.
+ *
+ * \param surface The surface to query.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
+ int *blendMode);
+
+/**
+ * \brief Set the scale mode used for blit operations.
+ *
+ * \param surface The surface to update.
+ * \param scaleMode ::SDL_TextureScaleMode to use for blit scaling.
+ *
+ * \return 0 on success, or -1 if the surface is not valid or the scale mode is
+ * not supported.
+ *
+ * \note If the scale mode is not supported, the closest supported mode is
+ * chosen. Currently only ::SDL_TEXTURESCALEMODE_FAST is supported on
+ * surfaces.
+ *
+ * \sa SDL_GetSurfaceScaleMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
+ int scaleMode);
+
+/**
+ * \brief Get the scale mode used for blit operations.
+ *
+ * \param surface The surface to query.
+ * \param scaleMode A pointer filled in with the current scale mode.
+ *
+ * \return 0 on success, or -1 if the surface is not valid.
+ *
+ * \sa SDL_SetSurfaceScaleMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
+ int *scaleMode);
+
+/**
+ * Sets the clipping rectangle for the destination surface in a blit.
+ *
+ * If the clip rectangle is NULL, clipping will be disabled.
+ *
+ * If the clip rectangle doesn't intersect the surface, the function will
+ * return SDL_FALSE and blits will be completely clipped. Otherwise the
+ * function returns SDL_TRUE and blits to the surface will be clipped to
+ * the intersection of the surface area and the clipping rectangle.
+ *
+ * Note that blits are automatically clipped to the edges of the source
+ * and destination surfaces.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
+ const SDL_Rect * rect);
+
+/**
+ * Gets the clipping rectangle for the destination surface in a blit.
+ *
+ * \c rect must be a pointer to a valid rectangle which will be filled
+ * with the correct values.
+ */
+extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
+ SDL_Rect * rect);
+
+/**
+ * Creates a new surface of the specified format, and then copies and maps
+ * the given surface to it so the blit of the converted surface will be as
+ * fast as possible. If this function fails, it returns NULL.
+ *
+ * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those
+ * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and
+ * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
+ * surface.
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
+ (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
+
+/**
+ * \brief Copy a block of pixels of one format to another format
+ */
+extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
+ Uint32 src_format,
+ const void * src, int src_pitch,
+ Uint32 dst_format,
+ void * dst, int dst_pitch);
+
+/**
+ * Draws a point with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_DrawPoint
+ (SDL_Surface * dst, int x, int y, Uint32 color);
+extern DECLSPEC int SDLCALL SDL_DrawPoints
+ (SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
+
+/**
+ * Blends a point with an RGBA value.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendPoint
+ (SDL_Surface * dst, int x, int y,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+extern DECLSPEC int SDLCALL SDL_BlendPoints
+ (SDL_Surface * dst, const SDL_Point * points, int count,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/**
+ * Draws a line with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_DrawLine
+ (SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color);
+extern DECLSPEC int SDLCALL SDL_DrawLines
+ (SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
+
+/**
+ * Blends an RGBA value along a line.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendLine
+ (SDL_Surface * dst, int x1, int y1, int x2, int y2,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+extern DECLSPEC int SDLCALL SDL_BlendLines
+ (SDL_Surface * dst, const SDL_Point * points, int count,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/**
+ * Draws the given rectangle with \c color.
+ *
+ * If \c rect is NULL, the whole surface will be outlined with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_DrawRect
+ (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
+extern DECLSPEC int SDLCALL SDL_DrawRects
+ (SDL_Surface * dst, const SDL_Rect ** rects, int count, Uint32 color);
+
+/**
+ * Blends an RGBA value into the outline of the given rectangle.
+ *
+ * If \c rect is NULL, the whole surface will have a blended outline.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendRect
+ (SDL_Surface * dst, const SDL_Rect * rect,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+extern DECLSPEC int SDLCALL SDL_BlendRects
+ (SDL_Surface * dst, const SDL_Rect ** rects, int count,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/**
+ * Performs a fast fill of the given rectangle with \c color.
+ *
+ * If \c rect is NULL, the whole surface will be filled with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_FillRect
+ (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
+extern DECLSPEC int SDLCALL SDL_FillRects
+ (SDL_Surface * dst, const SDL_Rect ** rects, int count, Uint32 color);
+
+/**
+ * Blends an RGBA value into the given rectangle.
+ *
+ * If \c rect is NULL, the whole surface will be blended with the color.
+ *
+ * \return This function returns 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendFillRect
+ (SDL_Surface * dst, const SDL_Rect * rect,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+extern DECLSPEC int SDLCALL SDL_BlendFillRects
+ (SDL_Surface * dst, const SDL_Rect ** rects, int count,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+#if 0
+/**
+ * Draws the given circle with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_DrawCircle
+ (SDL_Surface * dst, int x, int y, int radius, Uint32 color);
+
+/**
+ * Blends an RGBA value into the outline of the given circle.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendCircle
+ (SDL_Surface * dst, int x, int y, int radius,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/**
+ * Fills the given circle with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_FillCircle
+ (SDL_Surface * dst, int x, int y, int radius, Uint32 color);
+
+/**
+ * Blends an RGBA value into the given circle.
+ *
+ * \return This function returns 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendFillCircle
+ (SDL_Surface * dst, int x, int y, int radius,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/**
+ * Draws the given ellipse with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_DrawEllipse
+ (SDL_Surface * dst, int x, int y, int w, int h, Uint32 color);
+
+/**
+ * Blends an RGBA value into the outline of the given ellipse.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendEllipse
+ (SDL_Surface * dst, int x, int y, int w, int h,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+
+/**
+ * Fills the given ellipse with \c color.
+ *
+ * The color should be a pixel of the format used by the surface, and
+ * can be generated by the SDL_MapRGB() function.
+ *
+ * \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_FillEllipse
+ (SDL_Surface * dst, int x, int y, int w, int h, Uint32 color);
+
+/**
+ * Blends an RGBA value into the given ellipse.
+ *
+ * \return This function returns 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_BlendFillEllipse
+ (SDL_Surface * dst, int x, int y, int w, int h,
+ int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+#endif // 0
+
+/**
+ * Performs a fast blit from the source surface to the destination surface.
+ *
+ * This assumes that the source and destination rectangles are
+ * the same size. If either \c srcrect or \c dstrect are NULL, the entire
+ * surface (\c src or \c dst) is copied. The final blit rectangles are saved
+ * in \c srcrect and \c dstrect after all clipping is performed.
+ *
+ * \return If the blit is successful, it returns 0, otherwise it returns -1.
+ *
+ * The blit function should not be called on a locked surface.
+ *
+ * The blit semantics for surfaces with and without alpha and colorkey
+ * are defined as follows:
+ * \verbatim
+ RGBA->RGB:
+ SDL_SRCALPHA set:
+ alpha-blend (using alpha-channel).
+ SDL_SRCCOLORKEY ignored.
+ SDL_SRCALPHA not set:
+ copy RGB.
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ RGB values of the source colour key, ignoring alpha in the
+ comparison.
+
+ RGB->RGBA:
+ SDL_SRCALPHA set:
+ alpha-blend (using the source per-surface alpha value);
+ set destination alpha to opaque.
+ SDL_SRCALPHA not set:
+ copy RGB, set destination alpha to source per-surface alpha value.
+ both:
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ source colour key.
+
+ RGBA->RGBA:
+ SDL_SRCALPHA set:
+ alpha-blend (using the source alpha channel) the RGB values;
+ leave destination alpha untouched. [Note: is this correct?]
+ SDL_SRCCOLORKEY ignored.
+ SDL_SRCALPHA not set:
+ copy all of RGBA to the destination.
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ RGB values of the source colour key, ignoring alpha in the
+ comparison.
+
+ RGB->RGB:
+ SDL_SRCALPHA set:
+ alpha-blend (using the source per-surface alpha value).
+ SDL_SRCALPHA not set:
+ copy RGB.
+ both:
+ if SDL_SRCCOLORKEY set, only copy the pixels matching the
+ source colour key.
+ \endverbatim
+ *
+ * If either of the surfaces were in video memory, and the blit returns -2,
+ * the video memory was lost, so it should be reloaded with artwork and
+ * re-blitted:
+ * @code
+ * while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
+ * while ( SDL_LockSurface(image) < 0 )
+ * Sleep(10);
+ * -- Write image pixels to image->pixels --
+ * SDL_UnlockSurface(image);
+ * }
+ * @endcode
+ *
+ * This happens under DirectX 5.0 when the system switches away from your
+ * fullscreen application. The lock will also fail until you have access
+ * to the video memory again.
+ *
+ * You should call SDL_BlitSurface() unless you know exactly how SDL
+ * blitting works internally and how to use the other blit functions.
+ */
+#define SDL_BlitSurface SDL_UpperBlit
+
+/**
+ * This is the public blit function, SDL_BlitSurface(), and it performs
+ * rectangle validation and clipping before passing it to SDL_LowerBlit()
+ */
+extern DECLSPEC int SDLCALL SDL_UpperBlit
+ (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * This is a semi-private blit function and it performs low-level surface
+ * blitting only.
+ */
+extern DECLSPEC int SDLCALL SDL_LowerBlit
+ (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief Perform a fast, low quality, stretch blit between two surfaces of the
+ * same pixel format.
+ *
+ * \note This function uses a static buffer, and is not thread-safe.
+ */
+extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
+ const SDL_Rect * srcrect,
+ SDL_Surface * dst,
+ const SDL_Rect * dstrect);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_surface_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_syswm.h b/alienblaster/project/jni/sdl/include/SDL_syswm.h
index 716dddcb7..56ef7f6d2 100644
--- a/alienblaster/project/jni/sdl/include/SDL_syswm.h
+++ b/alienblaster/project/jni/sdl/include/SDL_syswm.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,10 @@
slouken@libsdl.org
*/
-/** @file SDL_syswm.h
- * Include file for SDL custom system window manager hooks
+/**
+ * \file SDL_syswm.h
+ *
+ * Include file for SDL custom system window manager hooks.
*/
#ifndef _SDL_syswm_h
@@ -29,23 +31,27 @@
#include "SDL_stdinc.h"
#include "SDL_error.h"
+#include "SDL_video.h"
#include "SDL_version.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** @file SDL_syswm.h
- * Your application has access to a special type of event 'SDL_SYSWMEVENT',
+/**
+ * \file SDL_syswm.h
+ *
+ * Your application has access to a special type of event ::SDL_SYSWMEVENT,
* which contains window-manager specific information and arrives whenever
* an unhandled window event occurs. This event is ignored by default, but
- * you can enable it with SDL_EventState()
+ * you can enable it with SDL_EventState().
*/
#ifdef SDL_PROTOTYPES_ONLY
struct SDL_SysWMinfo;
-typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#else
/* This is the structure for custom window manager events */
@@ -63,163 +69,194 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#undef Cursor
#endif
-/** These are the various supported subsystems under UNIX */
-typedef enum {
- SDL_SYSWM_X11
+/**
+ * These are the various supported subsystems under UNIX.
+ */
+typedef enum
+{
+ SDL_SYSWM_X11
} SDL_SYSWM_TYPE;
-/** The UNIX custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union {
- XEvent xevent;
- } event;
+/**
+ * The UNIX custom event structure.
+ */
+struct SDL_SysWMmsg
+{
+ SDL_version version;
+ SDL_SYSWM_TYPE subsystem;
+ union
+ {
+ XEvent xevent;
+ } event;
};
-/** The UNIX custom window manager information structure.
+/**
+ * The UNIX custom window manager information structure.
+ *
* When this structure is returned, it holds information about which
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
*/
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union {
- struct {
- Display *display; /**< The X11 display */
- Window window; /**< The X11 display window */
- /** These locking functions should be called around
- * any X11 functions using the display variable,
- * but not the gfxdisplay variable.
- * They lock the event thread, so should not be
- * called around event functions or from event filters.
- */
- /*@{*/
- void (*lock_func)(void);
- void (*unlock_func)(void);
- /*@}*/
+struct SDL_SysWMinfo
+{
+ SDL_version version;
+ SDL_SYSWM_TYPE subsystem;
+ union
+ {
+ struct
+ {
+ Display *display; /**< The X11 display */
+ Window window; /**< The X11 display window */
+ /**
+ * These locking functions should be called around
+ * any X11 functions using the display variable.
+ * They lock the event thread, so should not be
+ * called around event functions or from event filters.
+ */
+ /*@{*/
+ void (*lock_func) (void);
+ void (*unlock_func) (void);
+ /*@}*/
- /** @name Introduced in SDL 1.0.2 */
- /*@{*/
- Window fswindow; /**< The X11 fullscreen window */
- Window wmwindow; /**< The X11 managed input window */
- /*@}*/
-
- /** @name Introduced in SDL 1.2.12 */
- /*@{*/
- Display *gfxdisplay; /**< The X11 display to which rendering is done */
- /*@}*/
- } x11;
- } info;
-} SDL_SysWMinfo;
-
-#elif defined(SDL_VIDEO_DRIVER_NANOX)
-#include
-
-/** The generic custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int data;
+ /**
+ * Introduced in SDL 1.0.2.
+ */
+ /*@{*/
+ Window fswindow; /**< The X11 fullscreen window */
+ Window wmwindow; /**< The X11 managed input window */
+ /*@}*/
+ } x11;
+ } info;
};
-/** The windows custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version ;
- GR_WINDOW_ID window ; /* The display window */
-} SDL_SysWMinfo;
-
-#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
+#elif defined(SDL_VIDEO_DRIVER_WIN32)
#define WIN32_LEAN_AND_MEAN
#include
-/** The windows custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- HWND hwnd; /**< The window for the message */
- UINT msg; /**< The type of message */
- WPARAM wParam; /**< WORD message parameter */
- LPARAM lParam; /**< LONG message parameter */
+/**
+ * The windows custom event structure.
+ */
+struct SDL_SysWMmsg
+{
+ SDL_version version;
+ HWND hwnd; /**< The window for the message */
+ UINT msg; /**< The type of message */
+ WPARAM wParam; /**< WORD message parameter */
+ LPARAM lParam; /**< LONG message parameter */
};
-/** The windows custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- HWND window; /**< The Win32 display window */
- HGLRC hglrc; /**< The OpenGL context, if any */
-} SDL_SysWMinfo;
+/**
+ * The windows custom window manager information structure.
+ */
+struct SDL_SysWMinfo
+{
+ SDL_version version;
+ HWND window; /**< The Win32 display window */
+};
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
-/** RISC OS custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int eventCode; /**< The window for the message */
- int pollBlock[64];
+/**
+ * RISC OS custom event structure.
+ */
+struct SDL_SysWMmsg
+{
+ SDL_version version;
+ int eventCode; /**< The window for the message */
+ int pollBlock[64];
};
-/** The RISC OS custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- int wimpVersion; /**< Wimp version running under */
- int taskHandle; /**< The RISC OS task handle */
- int window; /**< The RISC OS display window */
-} SDL_SysWMinfo;
+/**
+ * The RISC OS custom window manager information structure.
+ */
+struct SDL_SysWMinfo
+{
+ SDL_version version;
+ int wimpVersion; /**< Wimp version running under */
+ int taskHandle; /**< The RISC OS task handle */
+ int window; /**< The RISC OS display window */
+};
-#elif defined(SDL_VIDEO_DRIVER_PHOTON)
+#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
#include
+#if defined(SDL_VIDEO_OPENGL_ES)
+#include
+#endif /* SDL_VIDEO_OPENGL_ES */
#include
-/** The QNX custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int data;
+/**
+ * The QNX custom event structure.
+ */
+struct SDL_SysWMmsg
+{
+ SDL_version version;
+ int data;
};
-/** The QNX custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- int data;
-} SDL_SysWMinfo;
+/**
+ * The QNX Photon custom window manager information structure.
+ */
+struct SDL_SysWMinfo
+{
+ SDL_version version;
+ int data;
+};
#else
-/** The generic custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int data;
+/**
+ * The generic custom event structure.
+ */
+struct SDL_SysWMmsg
+{
+ SDL_version version;
+ int data;
};
-/** The generic custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- int data;
-} SDL_SysWMinfo;
+/**
+ * The generic custom window manager information structure.
+ */
+struct SDL_SysWMinfo
+{
+ SDL_version version;
+ int data;
+};
#endif /* video driver type */
#endif /* SDL_PROTOTYPES_ONLY */
+typedef struct SDL_SysWMinfo SDL_SysWMinfo;
+
/* Function prototypes */
/**
- * This function gives you custom hooks into the window manager information.
- * It fills the structure pointed to by 'info' with custom information and
- * returns 1 if the function is implemented. If it's not implemented, or
- * the version member of the 'info' structure is invalid, it returns 0.
- *
- * You typically use this function like this:
- * @code
- * SDL_SysWMInfo info;
- * SDL_VERSION(&info.version);
- * if ( SDL_GetWMInfo(&info) ) { ... }
- * @endcode
+ * \brief This function allows access to driver-dependent window information.
+ *
+ * \param windowID The window about which information is being requested
+ * \param info This structure must be initialized with the SDL version, and is
+ * then filled in with information about the given window.
+ *
+ * \return SDL_TRUE if the function is implemented and the version member of
+ * the \c info struct is valid, SDL_FALSE otherwise.
+ *
+ * You typically use this function like this:
+ * \code
+ * SDL_SysWMInfo info;
+ * SDL_VERSION(&info.version);
+ * if ( SDL_GetWindowWMInfo(&info) ) { ... }
+ * \endcode
*/
-extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
+extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
+ SDL_SysWMinfo * info);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_syswm_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_thread.h b/alienblaster/project/jni/sdl/include/SDL_thread.h
index 1ca9a1bc4..fc3d36d75 100644
--- a/alienblaster/project/jni/sdl/include/SDL_thread.h
+++ b/alienblaster/project/jni/sdl/include/SDL_thread.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,10 +23,10 @@
#ifndef _SDL_thread_h
#define _SDL_thread_h
-/** @file SDL_thread.h
- * Header for the SDL thread management routines
- *
- * @note These are independent of the other SDL routines.
+/**
+ * \file SDL_thread.h
+ *
+ * Header for the SDL thread management routines.
*/
#include "SDL_stdinc.h"
@@ -38,83 +38,136 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** The SDL thread structure, defined in SDL_thread.c */
+/* The SDL thread structure, defined in SDL_thread.c */
struct SDL_Thread;
typedef struct SDL_Thread SDL_Thread;
-/** Create a thread */
-#if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
+/* The SDL thread ID */
+typedef unsigned long SDL_threadID;
+
+#if defined(__WIN32__) && !defined(HAVE_LIBC)
/**
- * We compile SDL into a DLL on OS/2. This means, that it's the DLL which
+ * \file SDL_thread.h
+ *
+ * We compile SDL into a DLL. This means, that it's the DLL which
* creates a new thread for the calling process with the SDL_CreateThread()
* API. There is a problem with this, that only the RTL of the SDL.DLL will
- * be initialized for those threads, and not the RTL of the calling application!
+ * be initialized for those threads, and not the RTL of the calling
+ * application!
+ *
* To solve this, we make a little hack here.
+ *
* We'll always use the caller's _beginthread() and _endthread() APIs to
* start a new thread. This way, if it's the SDL.DLL which uses this API,
* then the RTL of SDL.DLL will be used to create the new thread, and if it's
* the application, then the RTL of the application will be used.
+ *
* So, in short:
- * Always use the _beginthread() and _endthread() of the calling runtime library!
+ * Always use the _beginthread() and _endthread() of the calling runtime
+ * library!
*/
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
#ifndef _WIN32_WCE
-#include /* This has _beginthread() and _endthread() defined! */
+#include /* This has _beginthread() and _endthread() defined! */
#endif
-#ifdef __OS2__
-typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
-typedef void (*pfnSDL_CurrentEndThread)(void);
-#elif __GNUC__
-typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *func)(void *), void *arg,
- unsigned, unsigned *threadID);
-typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
+#ifdef __GNUC__
+typedef unsigned long (__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
+ unsigned
+ (__stdcall *
+ func) (void *),
+ void *arg,
+ unsigned,
+ unsigned
+ *threadID);
+typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
#else
-typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *func)(void *), void *arg,
- unsigned, unsigned *threadID);
-typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
+ unsigned (__stdcall *
+ func) (void
+ *),
+ void *arg, unsigned,
+ unsigned *threadID);
+typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
#endif
-extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
+/**
+ * Create a thread.
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(int (SDLCALL * f) (void *), void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
-#ifdef __OS2__
-#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
-#elif defined(_WIN32_WCE)
+#if defined(_WIN32_WCE)
+
+/**
+ * Create a thread.
+ */
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
+
#else
+
+/**
+ * Create a thread.
+ */
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
+
#endif
#else
-extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
+
+/**
+ * Create a thread.
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(int (SDLCALL * fn) (void *), void *data);
+
#endif
-/** Get the 32-bit thread identifier for the current thread */
-extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
-
-/** Get the 32-bit thread identifier for the specified thread,
- * equivalent to SDL_ThreadID() if the specified thread is NULL.
+/**
+ * Get the thread identifier for the current thread.
*/
-extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
+extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
-/** Wait for a thread to finish.
+/**
+ * Get the thread identifier for the specified thread.
+ *
+ * Equivalent to SDL_ThreadID() if the specified thread is NULL.
+ */
+extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
+
+/**
+ * Wait for a thread to finish.
+ *
* The return code for the thread function is placed in the area
- * pointed to by 'status', if 'status' is not NULL.
+ * pointed to by \c status, if \c status is not NULL.
*/
-extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
+extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
-/** Forcefully kill a thread without worrying about its state */
-extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
+/**
+ * \deprecated This function is here for binary compatibility with legacy apps,
+ * but in SDL 1.3 and later, it's a no-op.
+ *
+ * You cannot forcibly kill a thread in a safe manner on many platforms. You
+ * should instead find a way to alert your thread that it is time to terminate,
+ * and then have it gracefully exit on its own. Do not ever call this function!
+ */
+extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread * thread);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_thread_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_timer.h b/alienblaster/project/jni/sdl/include/SDL_timer.h
index d7cd02460..91160f6f9 100644
--- a/alienblaster/project/jni/sdl/include/SDL_timer.h
+++ b/alienblaster/project/jni/sdl/include/SDL_timer.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,8 +23,10 @@
#ifndef _SDL_timer_h
#define _SDL_timer_h
-/** @file SDL_timer.h
- * Header for the SDL time management routines
+/**
+ * \file SDL_timer.h
+ *
+ * Header for the SDL time management routines.
*/
#include "SDL_stdinc.h"
@@ -33,93 +35,119 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** This is the OS scheduler timeslice, in milliseconds */
+/**
+ * This is the OS scheduler timeslice, in milliseconds.
+ */
#define SDL_TIMESLICE 10
-/** This is the maximum resolution of the SDL timer on all platforms */
-#define TIMER_RESOLUTION 10 /**< Experimentally determined */
+/**
+ * This is the maximum resolution of the SDL timer on all platforms.
+ */
+#define TIMER_RESOLUTION 10 /**< Experimentally determined */
/**
- * Get the number of milliseconds since the SDL library initialization.
- * Note that this value wraps if the program runs for more than ~49 days.
- */
+ * Get the number of milliseconds since the SDL library initialization.
+ *
+ * Note that this value wraps if the program runs for more than ~49 days.
+ */
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
-/** Wait a specified number of milliseconds before returning */
+/**
+ * Wait a specified number of milliseconds before returning.
+ */
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
-/** Function prototype for the timer callback function */
-typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
+/**
+ * Function prototype for the timer callback function.
+ */
+typedef Uint32(SDLCALL * SDL_TimerCallback) (Uint32 interval);
/**
- * Set a callback to run after the specified number of milliseconds has
- * elapsed. The callback function is passed the current timer interval
- * and returns the next timer interval. If the returned value is the
- * same as the one passed in, the periodic alarm continues, otherwise a
- * new alarm is scheduled. If the callback returns 0, the periodic alarm
- * is cancelled.
- *
- * To cancel a currently running timer, call SDL_SetTimer(0, NULL);
- *
- * The timer callback function may run in a different thread than your
- * main code, and so shouldn't call any functions from within itself.
- *
- * The maximum resolution of this timer is 10 ms, which means that if
- * you request a 16 ms timer, your callback will run approximately 20 ms
- * later on an unloaded system. If you wanted to set a flag signaling
- * a frame update at 30 frames per second (every 33 ms), you might set a
- * timer for 30 ms:
- * @code SDL_SetTimer((33/10)*10, flag_update); @endcode
- *
- * If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
- *
- * Under UNIX, you should not use raise or use SIGALRM and this function
- * in the same program, as it is implemented using setitimer(). You also
- * should not use this function in multi-threaded applications as signals
- * to multi-threaded apps have undefined behavior in some implementations.
- *
- * This function returns 0 if successful, or -1 if there was an error.
+ * Set a callback to run after the specified number of milliseconds has
+ * elapsed. The callback function is passed the current timer interval
+ * and returns the next timer interval. If the returned value is the
+ * same as the one passed in, the periodic alarm continues, otherwise a
+ * new alarm is scheduled. If the callback returns 0, the periodic alarm
+ * is cancelled.
+ *
+ * To cancel a currently running timer, call
+ * \code SDL_SetTimer(0, NULL); \endcode
+ *
+ * The timer callback function may run in a different thread than your
+ * main code, and so shouldn't call any functions from within itself.
+ *
+ * The maximum resolution of this timer is 10 ms, which means that if
+ * you request a 16 ms timer, your callback will run approximately 20 ms
+ * later on an unloaded system. If you wanted to set a flag signaling
+ * a frame update at 30 frames per second (every 33 ms), you might set a
+ * timer for 30 ms:
+ * \code
+ * SDL_SetTimer((33/10)*10, flag_update);
+ * \endcode
+ *
+ * If you use this function, you need to pass ::SDL_INIT_TIMER to SDL_Init().
+ *
+ * Under UNIX, you should not use raise or use SIGALRM and this function
+ * in the same program, as it is implemented using setitimer(). You also
+ * should not use this function in multi-threaded applications as signals
+ * to multi-threaded apps have undefined behavior in some implementations.
+ *
+ * \return 0 if successful, or -1 if there was an error.
*/
-extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
+extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval,
+ SDL_TimerCallback callback);
-/** @name New timer API
- * New timer API, supports multiple timers
- * Written by Stephane Peter
+/**
+ * \name Peter timers
+ * New timer API, supports multiple timers
+ * Written by Stephane Peter
*/
/*@{*/
/**
- * Function prototype for the new timer callback function.
- * The callback function is passed the current timer interval and returns
- * the next timer interval. If the returned value is the same as the one
- * passed in, the periodic alarm continues, otherwise a new alarm is
- * scheduled. If the callback returns 0, the periodic alarm is cancelled.
+ * Function prototype for the new timer callback function.
+ *
+ * The callback function is passed the current timer interval and returns
+ * the next timer interval. If the returned value is the same as the one
+ * passed in, the periodic alarm continues, otherwise a new alarm is
+ * scheduled. If the callback returns 0, the periodic alarm is cancelled.
*/
-typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
-
-/** Definition of the timer ID type */
-typedef struct _SDL_TimerID *SDL_TimerID;
-
-/** Add a new timer to the pool of timers already running.
- * Returns a timer ID, or NULL when an error occurs.
- */
-extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
+typedef Uint32(SDLCALL * SDL_NewTimerCallback) (Uint32 interval, void *param);
/**
- * Remove one of the multiple timers knowing its ID.
- * Returns a boolean value indicating success.
+ * Definition of the timer ID type.
+ */
+typedef struct _SDL_TimerID *SDL_TimerID;
+
+/**
+ * Add a new timer to the pool of timers already running.
+ * \return A timer ID, or NULL when an error occurs.
+ */
+extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
+ SDL_NewTimerCallback
+ callback, void *param);
+
+/**
+ * Remove one of the multiple timers knowing its ID.
+ * \return A boolean value indicating success or failure.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
-/*@}*/
+/*@}*//*Peter timers*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_timer_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_types.h b/alienblaster/project/jni/sdl/include/SDL_types.h
index cfa35236a..86279fe4a 100644
--- a/alienblaster/project/jni/sdl/include/SDL_types.h
+++ b/alienblaster/project/jni/sdl/include/SDL_types.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,10 @@
slouken@libsdl.org
*/
-/** @file SDL_types.h
- * @deprecated Use SDL_stdinc.h instead.
+/**
+ * \file SDL_types.h
+ *
+ * \deprecated
*/
/* DEPRECATED */
diff --git a/alienblaster/project/jni/sdl/include/SDL_version.h b/alienblaster/project/jni/sdl/include/SDL_version.h
index fa02c3f6d..a2ab71c2a 100644
--- a/alienblaster/project/jni/sdl/include/SDL_version.h
+++ b/alienblaster/project/jni/sdl/include/SDL_version.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,72 +20,139 @@
slouken@libsdl.org
*/
-/** @file SDL_version.h
- * This header defines the current SDL version
+/**
+ * \file SDL_version.h
+ *
+ * This header defines the current SDL version.
*/
#ifndef _SDL_version_h
#define _SDL_version_h
#include "SDL_stdinc.h"
+#include "SDL_revision.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** @name Version Number
- * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
+/**
+ * \brief Information the version of SDL in use.
+ *
+ * Represents the library's version as three levels: major revision
+ * (increments with massive changes, additions, and enhancements),
+ * minor revision (increments with backwards-compatible changes to the
+ * major revision), and patchlevel (increments with fixes to the minor
+ * revision).
+ *
+ * \sa SDL_VERSION
+ * \sa SDL_GetVersion
*/
-/*@{*/
-#define SDL_MAJOR_VERSION 1
-#define SDL_MINOR_VERSION 2
-#define SDL_PATCHLEVEL 14
-/*@}*/
-
-typedef struct SDL_version {
- Uint8 major;
- Uint8 minor;
- Uint8 patch;
+typedef struct SDL_version
+{
+ Uint8 major; /**< major version */
+ Uint8 minor; /**< minor version */
+ Uint8 patch; /**< update version */
} SDL_version;
+/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
+*/
+#define SDL_MAJOR_VERSION 1
+#define SDL_MINOR_VERSION 3
+#define SDL_PATCHLEVEL 0
+
/**
- * This macro can be used to fill a version structure with the compile-time
- * version of the SDL library.
+ * \brief Macro to determine SDL version program was compiled against.
+ *
+ * This macro fills in a SDL_version structure with the version of the
+ * library you compiled against. This is determined by what header the
+ * compiler uses. Note that if you dynamically linked the library, you might
+ * have a slightly newer or older version at runtime. That version can be
+ * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
+ * is not a macro.
+ *
+ * \param x A pointer to a SDL_version struct to initialize.
+ *
+ * \sa SDL_version
+ * \sa SDL_GetVersion
*/
-#define SDL_VERSION(X) \
+#define SDL_VERSION(x) \
{ \
- (X)->major = SDL_MAJOR_VERSION; \
- (X)->minor = SDL_MINOR_VERSION; \
- (X)->patch = SDL_PATCHLEVEL; \
+ (x)->major = SDL_MAJOR_VERSION; \
+ (x)->minor = SDL_MINOR_VERSION; \
+ (x)->patch = SDL_PATCHLEVEL; \
}
-/** This macro turns the version numbers into a numeric value:
- * (1,2,3) -> (1203)
- * This assumes that there will never be more than 100 patchlevels
+/**
+ * This macro turns the version numbers into a numeric value:
+ * \verbatim
+ (1,2,3) -> (1203)
+ \endverbatim
+ *
+ * This assumes that there will never be more than 100 patchlevels.
*/
#define SDL_VERSIONNUM(X, Y, Z) \
((X)*1000 + (Y)*100 + (Z))
-/** This is the version number macro for the current SDL version */
+/**
+ * This is the version number macro for the current SDL version.
+ */
#define SDL_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
-/** This macro will evaluate to true if compiled with SDL at least X.Y.Z */
+/**
+ * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
+ */
#define SDL_VERSION_ATLEAST(X, Y, Z) \
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-/** This function gets the version of the dynamically linked SDL library.
- * it should NOT be used to fill a version structure, instead you should
- * use the SDL_Version() macro.
+/**
+ * \brief Get the version of SDL that is linked against your program.
+ *
+ * If you are using a shared library (DLL) version of SDL, then it is
+ * possible that it will be different than the version you compiled against.
+ *
+ * This is a real function; the macro SDL_VERSION() tells you what version
+ * of SDL you compiled against:
+ *
+ * \code
+ * SDL_version compiled;
+ * SDL_version linked;
+ *
+ * SDL_VERSION(&compiled);
+ * SDL_GetVersion(&linked);
+ * printf("We compiled against SDL version %d.%d.%d ...\n",
+ * compiled.major, compiled.minor, compiled.patch);
+ * printf("But we linked against SDL version %d.%d.%d.\n",
+ * linked.major, linked.minor, linked.patch);
+ * \endcode
+ *
+ * This function may be called safely at any time, even before SDL_Init().
+ *
+ * \sa SDL_VERSION
*/
-extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
+extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
+
+/**
+ * \brief Get the code revision of SDL that is linked against your program.
+ *
+ * This is an arbitrary string (a hash value, actually), and is only useful
+ * in comparing against other revisions. It is NOT an incrementing number.
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_version_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/SDL_video.h b/alienblaster/project/jni/sdl/include/SDL_video.h
index 8f7f30520..804869f69 100644
--- a/alienblaster/project/jni/sdl/include/SDL_video.h
+++ b/alienblaster/project/jni/sdl/include/SDL_video.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,214 +20,247 @@
slouken@libsdl.org
*/
-/** @file SDL_video.h
- * Header file for access to the SDL raw framebuffer window
+/**
+ * \file SDL_video.h
+ *
+ * Header file for SDL video functions.
*/
#ifndef _SDL_video_h
#define _SDL_video_h
#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_rwops.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_surface.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
extern "C" {
+/* *INDENT-ON* */
#endif
-/** @name Transparency definitions
- * These define alpha as the opacity of a surface
+/**
+ * \brief The structure that defines a display mode
+ *
+ * \sa SDL_GetNumDisplayModes()
+ * \sa SDL_GetDisplayMode()
+ * \sa SDL_GetDesktopDisplayMode()
+ * \sa SDL_GetCurrentDisplayMode()
+ * \sa SDL_GetClosestDisplayMode()
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_GetWindowDisplayMode()
*/
-/*@{*/
-#define SDL_ALPHA_OPAQUE 255
-#define SDL_ALPHA_TRANSPARENT 0
-/*@}*/
+typedef struct
+{
+ Uint32 format; /**< pixel format */
+ int w; /**< width */
+ int h; /**< height */
+ int refresh_rate; /**< refresh rate (or zero for unspecified) */
+ void *driverdata; /**< driver-specific data, initialize to 0 */
+} SDL_DisplayMode;
-/** @name Useful data types */
-/*@{*/
-typedef struct SDL_Rect {
- Sint16 x, y;
- Uint16 w, h;
-} SDL_Rect;
-
-typedef struct SDL_Color {
- Uint8 r;
- Uint8 g;
- Uint8 b;
- Uint8 unused;
-} SDL_Color;
-#define SDL_Colour SDL_Color
-
-typedef struct SDL_Palette {
- int ncolors;
- SDL_Color *colors;
-} SDL_Palette;
-/*@}*/
-
-/** Everything in the pixel format structure is read-only */
-typedef struct SDL_PixelFormat {
- SDL_Palette *palette;
- Uint8 BitsPerPixel;
- Uint8 BytesPerPixel;
- Uint8 Rloss;
- Uint8 Gloss;
- Uint8 Bloss;
- Uint8 Aloss;
- Uint8 Rshift;
- Uint8 Gshift;
- Uint8 Bshift;
- Uint8 Ashift;
- Uint32 Rmask;
- Uint32 Gmask;
- Uint32 Bmask;
- Uint32 Amask;
-
- /** RGB color key information */
- Uint32 colorkey;
- /** Alpha value information (per-surface alpha) */
- Uint8 alpha;
-} SDL_PixelFormat;
-
-/** This structure should be treated as read-only, except for 'pixels',
- * which, if not NULL, contains the raw pixel data for the surface.
+/**
+ * \brief The type used to identify a window
+ *
+ * \sa SDL_CreateWindow()
+ * \sa SDL_CreateWindowFrom()
+ * \sa SDL_DestroyWindow()
+ * \sa SDL_GetWindowData()
+ * \sa SDL_GetWindowFlags()
+ * \sa SDL_GetWindowGrab()
+ * \sa SDL_GetWindowPosition()
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_GetWindowTitle()
+ * \sa SDL_HideWindow()
+ * \sa SDL_MaximizeWindow()
+ * \sa SDL_MinimizeWindow()
+ * \sa SDL_RaiseWindow()
+ * \sa SDL_RestoreWindow()
+ * \sa SDL_SetWindowData()
+ * \sa SDL_SetWindowFullscreen()
+ * \sa SDL_SetWindowGrab()
+ * \sa SDL_SetWindowIcon()
+ * \sa SDL_SetWindowPosition()
+ * \sa SDL_SetWindowSize()
+ * \sa SDL_SetWindowTitle()
+ * \sa SDL_ShowWindow()
*/
-typedef struct SDL_Surface {
- Uint32 flags; /**< Read-only */
- SDL_PixelFormat *format; /**< Read-only */
- int w, h; /**< Read-only */
- Uint16 pitch; /**< Read-only */
- void *pixels; /**< Read-write */
- int offset; /**< Private */
+typedef struct SDL_Window SDL_Window;
- /** Hardware-specific surface info */
- struct private_hwdata *hwdata;
-
- /** clipping information */
- SDL_Rect clip_rect; /**< Read-only */
- Uint32 unused1; /**< for binary compatibility */
-
- /** Allow recursive locks */
- Uint32 locked; /**< Private */
-
- /** info for fast blit mapping to other surfaces */
- struct SDL_BlitMap *map; /**< Private */
-
- /** format version, bumped at every change to invalidate blit maps */
- unsigned int format_version; /**< Private */
-
- /** Reference count -- used when freeing surface */
- int refcount; /**< Read-mostly */
-} SDL_Surface;
-
-/** @name SDL_Surface Flags
- * These are the currently supported flags for the SDL_surface
+/**
+ * \brief The flags on a window
+ *
+ * \sa SDL_GetWindowFlags()
*/
-/*@{*/
+typedef enum
+{
+ SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window, implies borderless */
+ SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
+ SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
+ SDL_WINDOW_BORDERLESS = 0x00000008, /**< no window decoration */
+ SDL_WINDOW_RESIZABLE = 0x00000010, /**< window can be resized */
+ SDL_WINDOW_MINIMIZED = 0x00000020, /**< window is minimized */
+ SDL_WINDOW_MAXIMIZED = 0x00000040, /**< window is maximized */
+ SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
+ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
+ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
+ SDL_WINDOW_FOREIGN = 0x00000800 /**< window not created by SDL */
+} SDL_WindowFlags;
-/** Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
-/*@{*/
-#define SDL_SWSURFACE 0x00000000 /**< Surface is in system memory */
-#define SDL_HWSURFACE 0x00000001 /**< Surface is in video memory */
-#define SDL_ASYNCBLIT 0x00000004 /**< Use asynchronous blits if possible */
-/*@}*/
-
-/** Available for SDL_SetVideoMode() */
-/*@{*/
-#define SDL_ANYFORMAT 0x10000000 /**< Allow any video depth/pixel-format */
-#define SDL_HWPALETTE 0x20000000 /**< Surface has exclusive palette */
-#define SDL_DOUBLEBUF 0x40000000 /**< Set up double-buffered video mode */
-#define SDL_FULLSCREEN 0x80000000 /**< Surface is a full screen display */
-#define SDL_OPENGL 0x00000002 /**< Create an OpenGL rendering context */
-#define SDL_OPENGLBLIT 0x0000000A /**< Create an OpenGL rendering context and use it for blitting */
-#define SDL_RESIZABLE 0x00000010 /**< This video mode may be resized */
-#define SDL_NOFRAME 0x00000020 /**< No window caption or edge frame */
-/*@}*/
-
-/** Used internally (read-only) */
-/*@{*/
-#define SDL_HWACCEL 0x00000100 /**< Blit uses hardware acceleration */
-#define SDL_SRCCOLORKEY 0x00001000 /**< Blit uses a source color key */
-#define SDL_RLEACCELOK 0x00002000 /**< Private flag */
-#define SDL_RLEACCEL 0x00004000 /**< Surface is RLE encoded */
-#define SDL_SRCALPHA 0x00010000 /**< Blit uses source alpha blending */
-#define SDL_PREALLOC 0x01000000 /**< Surface uses preallocated memory */
-/*@}*/
-
-/*@}*/
-
-/** Evaluates to true if the surface needs to be locked before access */
-#define SDL_MUSTLOCK(surface) \
- (surface->offset || \
- ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
-
-/** typedef for private surface blitting functions */
-typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
- struct SDL_Surface *dst, SDL_Rect *dstrect);
-
-
-/** Useful for determining the video hardware capabilities */
-typedef struct SDL_VideoInfo {
- Uint32 hw_available :1; /**< Flag: Can you create hardware surfaces? */
- Uint32 wm_available :1; /**< Flag: Can you talk to a window manager? */
- Uint32 UnusedBits1 :6;
- Uint32 UnusedBits2 :1;
- Uint32 blit_hw :1; /**< Flag: Accelerated blits HW --> HW */
- Uint32 blit_hw_CC :1; /**< Flag: Accelerated blits with Colorkey */
- Uint32 blit_hw_A :1; /**< Flag: Accelerated blits with Alpha */
- Uint32 blit_sw :1; /**< Flag: Accelerated blits SW --> HW */
- Uint32 blit_sw_CC :1; /**< Flag: Accelerated blits with Colorkey */
- Uint32 blit_sw_A :1; /**< Flag: Accelerated blits with Alpha */
- Uint32 blit_fill :1; /**< Flag: Accelerated color fill */
- Uint32 UnusedBits3 :16;
- Uint32 video_mem; /**< The total amount of video memory (in K) */
- SDL_PixelFormat *vfmt; /**< Value: The format of the video surface */
- int current_w; /**< Value: The current video mode width */
- int current_h; /**< Value: The current video mode height */
-} SDL_VideoInfo;
-
-
-/** @name Overlay Formats
- * The most common video overlay formats.
- * For an explanation of these pixel formats, see:
- * http://www.webartz.com/fourcc/indexyuv.htm
- *
- * For information on the relationship between color spaces, see:
- * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
+/**
+ * \brief Used to indicate that you don't care what the window position is.
*/
-/*@{*/
-#define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */
-#define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */
-#define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
-#define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
-#define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
-/*@}*/
+#define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
-/** The YUV hardware video overlay */
-typedef struct SDL_Overlay {
- Uint32 format; /**< Read-only */
- int w, h; /**< Read-only */
- int planes; /**< Read-only */
- Uint16 *pitches; /**< Read-only */
- Uint8 **pixels; /**< Read-write */
+/**
+ * \brief Used to indicate that the window position should be centered.
+ */
+#define SDL_WINDOWPOS_CENTERED 0x7FFFFFE
- /** @name Hardware-specific surface info */
- /*@{*/
- struct private_yuvhwfuncs *hwfuncs;
- struct private_yuvhwdata *hwdata;
- /*@{*/
+/**
+ * \brief Event subtype for window events
+ */
+typedef enum
+{
+ SDL_WINDOWEVENT_NONE, /**< Never used */
+ SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */
+ SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */
+ SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be
+ redrawn */
+ SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
+ */
+ SDL_WINDOWEVENT_RESIZED, /**< Window size changed to data1xdata2 */
+ SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
+ SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
+ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
+ and position */
+ SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */
+ SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */
+ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */
+ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */
+ SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the
+ window be closed */
+} SDL_WindowEventID;
- /** @name Special flags */
- /*@{*/
- Uint32 hw_overlay :1; /**< Flag: This overlay hardware accelerated? */
- Uint32 UnusedBits :31;
- /*@}*/
-} SDL_Overlay;
+/**
+ * \brief Flags used when creating a rendering context
+ */
+typedef enum
+{
+ SDL_RENDERER_SINGLEBUFFER = 0x00000001, /**< Render directly to the
+ window, if possible */
+
+ SDL_RENDERER_PRESENTCOPY = 0x00000002, /**< Present uses a copy from
+ back buffer to the front
+ buffer */
+
+ SDL_RENDERER_PRESENTFLIP2 = 0x00000004, /**< Present uses a flip,
+ swapping back buffer and
+ front buffer */
+
+ SDL_RENDERER_PRESENTFLIP3 = 0x00000008, /**< Present uses a flip,
+ rotating between two back
+ buffers and a front buffer
+ */
+
+ SDL_RENDERER_PRESENTDISCARD = 0x00000010, /**< Present leaves the contents
+ of the backbuffer undefined
+ */
+
+ SDL_RENDERER_PRESENTVSYNC = 0x00000020, /**< Present is synchronized
+ with the refresh rate */
+
+ SDL_RENDERER_ACCELERATED = 0x00000040 /**< The renderer uses hardware
+ acceleration */
+
+ } SDL_RendererFlags;
+/**
+ * \brief Information on the capabilities of a render driver or context.
+ */
+typedef struct SDL_RendererInfo
+{
+ const char *name; /**< The name of the renderer */
+ Uint32 flags; /**< Supported ::SDL_RendererFlags */
+ Uint32 mod_modes; /**< A mask of supported channel modulation */
+ Uint32 blend_modes; /**< A mask of supported blend modes */
+ Uint32 scale_modes; /**< A mask of supported scale modes */
+ Uint32 num_texture_formats; /**< The number of available texture formats */
+ Uint32 texture_formats[20]; /**< The available texture formats */
+ int max_texture_width; /**< The maximimum texture width */
+ int max_texture_height; /**< The maximimum texture height */
+} SDL_RendererInfo;
-/** Public enumeration for setting the OpenGL window attributes. */
-typedef enum {
+/**
+ * \brief The access pattern allowed for a texture.
+ */
+typedef enum
+{
+ SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
+ SDL_TEXTUREACCESS_STREAMING /**< Changes frequently, lockable */
+} SDL_TextureAccess;
+
+/**
+ * \brief The texture channel modulation used in SDL_RenderCopy().
+ */
+typedef enum
+{
+ SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
+ SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
+ SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
+} SDL_TextureModulate;
+
+/**
+ * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
+ */
+typedef enum
+{
+ SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */
+ SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst
+ (alpha is mask) */
+
+ SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
+ SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
+ SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
+} SDL_BlendMode;
+
+/**
+ * \brief The texture scale mode used in SDL_RenderCopy().
+ */
+typedef enum
+{
+ SDL_TEXTURESCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must
+ match dimensions */
+
+ SDL_TEXTURESCALEMODE_FAST = 0x00000001, /**< Point sampling or
+ equivalent algorithm */
+
+ SDL_TEXTURESCALEMODE_SLOW = 0x00000002, /**< Linear filtering or
+ equivalent algorithm */
+
+ SDL_TEXTURESCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or
+ equivalent algorithm */
+} SDL_TextureScaleMode;
+
+/**
+ * \brief An efficient driver-specific representation of pixel data
+ */
+struct SDL_Texture;
+typedef struct SDL_Texture SDL_Texture;
+
+/**
+ * \brief An opaque handle to an OpenGL context.
+ */
+typedef void *SDL_GLContext;
+
+/**
+ * \brief OpenGL configuration attributes
+ */
+typedef enum
+{
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
@@ -244,708 +277,1182 @@ typedef enum {
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
- SDL_GL_SWAP_CONTROL
+ SDL_GL_RETAINED_BACKING,
+ SDL_GL_CONTEXT_MAJOR_VERSION,
+ SDL_GL_CONTEXT_MINOR_VERSION
} SDL_GLattr;
-/** @name flags for SDL_SetPalette() */
-/*@{*/
-#define SDL_LOGPAL 0x01
-#define SDL_PHYSPAL 0x02
-/*@}*/
/* Function prototypes */
/**
- * @name Video Init and Quit
- * These functions are used internally, and should not be used unless you
- * have a specific need to specify the video driver you want to use.
- * You should normally use SDL_Init() or SDL_InitSubSystem().
+ * \brief Get the number of video drivers compiled into SDL
+ *
+ * \sa SDL_GetVideoDriver()
*/
-/*@{*/
+extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
+
/**
- * Initializes the video subsystem. Sets up a connection
- * to the window manager, etc, and determines the current video mode and
- * pixel format, but does not initialize a window or graphics mode.
- * Note that event handling is activated by this routine.
- *
- * If you use both sound and video in your application, you need to call
- * SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
- * you won't be able to set full-screen display modes.
+ * \brief Get the name of a built in video driver.
+ *
+ * \note The video drivers are presented in the order in which they are
+ * normally checked during initialization.
+ *
+ * \sa SDL_GetNumVideoDrivers()
+ */
+extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
+
+/**
+ * \brief Initialize the video subsystem, optionally specifying a video driver.
+ *
+ * \param driver_name Initialize a specific driver by name, or NULL for the
+ * default video driver.
+ *
+ * \param flags FIXME: Still needed?
+ *
+ * \return 0 on success, -1 on error
+ *
+ * This function initializes the video subsystem; setting up a connection
+ * to the window manager, etc, and determines the available display modes
+ * and pixel formats, but does not initialize a window or graphics mode.
+ *
+ * \sa SDL_VideoQuit()
+ */
+extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
+ Uint32 flags);
+
+/**
+ * \brief Shuts down the video subsystem.
+ *
+ * This function closes all windows, and restores the original video mode.
+ *
+ * \sa SDL_VideoInit()
*/
-extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
-/*@}*/
/**
- * This function fills the given character buffer with the name of the
- * video driver, and returns a pointer to it if the video driver has
- * been initialized. It returns NULL if no driver has been initialized.
+ * \brief Returns the name of the currently initialized video driver.
+ *
+ * \return The name of the current video driver or NULL if no driver
+ * has been initialized
+ *
+ * \sa SDL_GetNumVideoDrivers()
+ * \sa SDL_GetVideoDriver()
*/
-extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
+extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
/**
- * This function returns a pointer to the current display surface.
- * If SDL is doing format conversion on the display surface, this
- * function returns the publicly visible surface, not the real video
- * surface.
+ * \brief Returns the number of available video displays.
+ *
+ * \sa SDL_GetDisplayBounds()
+ * \sa SDL_SelectVideoDisplay()
*/
-extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
+extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
/**
- * This function returns a read-only pointer to information about the
- * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
- * member of the returned structure will contain the pixel format of the
- * "best" video mode.
+ * \brief Get the desktop area represented by a display, with the primary
+ * display located at 0,0
+ *
+ * \return 0 on success, or -1 if the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
*/
-extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
+extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int index, SDL_Rect * rect);
/**
- * Check to see if a particular video mode is supported.
- * It returns 0 if the requested mode is not supported under any bit depth,
- * or returns the bits-per-pixel of the closest available mode with the
- * given width and height. If this bits-per-pixel is different from the
- * one used when setting the video mode, SDL_SetVideoMode() will succeed,
- * but will emulate the requested bits-per-pixel with a shadow surface.
- *
- * The arguments to SDL_VideoModeOK() are the same ones you would pass to
- * SDL_SetVideoMode()
+ * \brief Set the index of the currently selected display.
+ *
+ * \return 0 on success, or -1 if the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ * \sa SDL_GetCurrentVideoDisplay()
*/
-extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
+extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
/**
- * Return a pointer to an array of available screen dimensions for the
- * given format and video flags, sorted largest to smallest. Returns
- * NULL if there are no dimensions available for a particular format,
- * or (SDL_Rect **)-1 if any dimension is okay for the given format.
- *
- * If 'format' is NULL, the mode list will be for the format given
- * by SDL_GetVideoInfo()->vfmt
+ * \brief Get the index of the currently selected display.
+ *
+ * \return The index of the currently selected display.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ * \sa SDL_SelectVideoDisplay()
*/
-extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
+extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
/**
- * Set up a video mode with the specified width, height and bits-per-pixel.
- *
- * If 'bpp' is 0, it is treated as the current display bits per pixel.
- *
- * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
- * requested bits-per-pixel, but will return whatever video pixel format is
- * available. The default is to emulate the requested pixel format if it
- * is not natively available.
- *
- * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
- * video memory, if possible, and you may have to call SDL_LockSurface()
- * in order to access the raw framebuffer. Otherwise, the video surface
- * will be created in system memory.
- *
- * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
- * updates asynchronously, but you must always lock before accessing pixels.
- * SDL will wait for updates to complete before returning from the lock.
- *
- * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
- * that the colors set by SDL_SetColors() will be the colors you get.
- * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
- * of the colors exactly the way they are requested, and you should look
- * at the video surface structure to determine the actual palette.
- * If SDL cannot guarantee that the colors you request can be set,
- * i.e. if the colormap is shared, then the video surface may be created
- * under emulation in system memory, overriding the SDL_HWSURFACE flag.
- *
- * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
- * a fullscreen video mode. The default is to create a windowed mode
- * if the current graphics system has a window manager.
- * If the SDL library is able to set a fullscreen video mode, this flag
- * will be set in the surface that is returned.
- *
- * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
- * two surfaces in video memory and swap between them when you call
- * SDL_Flip(). This is usually slower than the normal single-buffering
- * scheme, but prevents "tearing" artifacts caused by modifying video
- * memory while the monitor is refreshing. It should only be used by
- * applications that redraw the entire screen on every update.
- *
- * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
- * window manager, if any, to resize the window at runtime. When this
- * occurs, SDL will send a SDL_VIDEORESIZE event to you application,
- * and you must respond to the event by re-calling SDL_SetVideoMode()
- * with the requested size (or another size that suits the application).
- *
- * If SDL_NOFRAME is set in 'flags', the SDL library will create a window
- * without any title bar or frame decoration. Fullscreen video modes have
- * this flag set automatically.
- *
- * This function returns the video framebuffer surface, or NULL if it fails.
- *
- * If you rely on functionality provided by certain video flags, check the
- * flags of the returned surface to make sure that functionality is available.
- * SDL will fall back to reduced functionality if the exact flags you wanted
- * are not available.
+ * \brief Returns the number of available display modes for the current display.
+ *
+ * \sa SDL_GetDisplayMode()
*/
-extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
- (int width, int height, int bpp, Uint32 flags);
-
-/** @name SDL_Update Functions
- * These functions should not be called while 'screen' is locked.
- */
-/*@{*/
-/**
- * Makes sure the given list of rectangles is updated on the given screen.
- */
-extern DECLSPEC void SDLCALL SDL_UpdateRects
- (SDL_Surface *screen, int numrects, SDL_Rect *rects);
-/**
- * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
- * screen.
- */
-extern DECLSPEC void SDLCALL SDL_UpdateRect
- (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
-/*@}*/
+extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
/**
- * On hardware that supports double-buffering, this function sets up a flip
- * and returns. The hardware will wait for vertical retrace, and then swap
- * video buffers before the next video surface blit or lock will return.
- * On hardware that doesn not support double-buffering, this is equivalent
- * to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
- * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
- * setting the video mode for this function to perform hardware flipping.
- * This function returns 0 if successful, or -1 if there was an error.
+ * \brief Fill in information about a specific display mode.
+ *
+ * \note The display modes are sorted in this priority:
+ * \li bits per pixel -> more colors to fewer colors
+ * \li width -> largest to smallest
+ * \li height -> largest to smallest
+ * \li refresh rate -> highest to lowest
+ *
+ * \sa SDL_GetNumDisplayModes()
*/
-extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
+extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
+ SDL_DisplayMode * mode);
/**
- * Set the gamma correction for each of the color channels.
- * The gamma values range (approximately) between 0.1 and 10.0
- *
- * If this function isn't supported directly by the hardware, it will
- * be emulated using gamma ramps, if available. If successful, this
- * function returns 0, otherwise it returns -1.
+ * \brief Fill in information about the desktop display mode for the current
+ * display.
+ */
+extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
+
+/**
+ * \brief Fill in information about the current display mode.
+ */
+extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
+
+
+/**
+ * \brief Get the closest match to the requested display mode.
+ *
+ * \param mode The desired display mode
+ * \param closest A pointer to a display mode to be filled in with the closest
+ * match of the available display modes.
+ *
+ * \return The passed in value \c closest, or NULL if no matching video mode
+ * was available.
+ *
+ * The available display modes are scanned, and \c closest is filled in with the
+ * closest mode matching the requested mode and returned. The mode format and
+ * refresh_rate default to the desktop mode if they are 0. The modes are
+ * scanned with size being first priority, format being second priority, and
+ * finally checking the refresh_rate. If all the available modes are too
+ * small, then NULL is returned.
+ *
+ * \sa SDL_GetNumDisplayModes()
+ * \sa SDL_GetDisplayMode()
+ */
+extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
+ SDL_DisplayMode
+ * mode,
+ SDL_DisplayMode
+ * closest);
+
+/**
+ * \brief Set the display mode used when a fullscreen window is visible
+ * on the currently selected display. By default the window's
+ * dimensions and the desktop format and refresh rate are used.
+ *
+ * \param mode The mode to use, or NULL for the default mode.
+ *
+ * \return 0 on success, or -1 if setting the display mode failed.
+ *
+ * \sa SDL_GetWindowDisplayMode()
+ * \sa SDL_SetWindowFullscreen()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
+ const SDL_DisplayMode
+ * mode);
+
+/**
+ * \brief Fill in information about the display mode used when a fullscreen
+ * window is visible on the currently selected display.
+ *
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_SetWindowFullscreen()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
+ SDL_DisplayMode * mode);
+
+/**
+ * \brief Set the palette entries for indexed display modes.
+ *
+ * \return 0 on success, or -1 if the display mode isn't palettized or the
+ * colors couldn't be set.
+ */
+extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors,
+ int firstcolor,
+ int ncolors);
+
+/**
+ * \brief Gets the palette entries for indexed display modes.
+ *
+ * \return 0 on success, or -1 if the display mode isn't palettized
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors,
+ int firstcolor,
+ int ncolors);
+
+/**
+ * \brief Set the gamma correction for each of the color channels on the
+ * currently selected display.
+ *
+ * \return 0 on success, or -1 if setting the gamma isn't supported.
+ *
+ * \sa SDL_SetGammaRamp()
*/
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
/**
- * Set the gamma translation table for the red, green, and blue channels
- * of the video hardware. Each table is an array of 256 16-bit quantities,
- * representing a mapping between the input and output for that channel.
- * The input is the index into the array, and the output is the 16-bit
- * gamma value at that index, scaled to the output color precision.
- *
- * You may pass NULL for any of the channels to leave it unchanged.
- * If the call succeeds, it will return 0. If the display driver or
- * hardware does not support gamma translation, or otherwise fails,
- * this function will return -1.
+ * \brief Set the gamma ramp for the currently selected display.
+ *
+ * \param red The translation table for the red channel, or NULL.
+ * \param green The translation table for the green channel, or NULL.
+ * \param blue The translation table for the blue channel, or NULL.
+ *
+ * \return 0 on success, or -1 if gamma ramps are unsupported.
+ *
+ * Set the gamma translation table for the red, green, and blue channels
+ * of the video hardware. Each table is an array of 256 16-bit quantities,
+ * representing a mapping between the input and output for that channel.
+ * The input is the index into the array, and the output is the 16-bit
+ * gamma value at that index, scaled to the output color precision.
+ *
+ * \sa SDL_GetGammaRamp()
*/
-extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
+extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
+ const Uint16 * green,
+ const Uint16 * blue);
/**
- * Retrieve the current values of the gamma translation tables.
- *
- * You must pass in valid pointers to arrays of 256 16-bit quantities.
- * Any of the pointers may be NULL to ignore that channel.
- * If the call succeeds, it will return 0. If the display driver or
- * hardware does not support gamma translation, or otherwise fails,
- * this function will return -1.
+ * \brief Get the gamma ramp for the currently selected display.
+ *
+ * \param red A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the red channel, or NULL.
+ * \param green A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the green channel, or NULL.
+ * \param blue A pointer to a 256 element array of 16-bit quantities to hold
+ * the translation table for the blue channel, or NULL.
+ *
+ * \return 0 on success, or -1 if gamma ramps are unsupported.
+ *
+ * \sa SDL_SetGammaRamp()
*/
-extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
+extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
+ Uint16 * blue);
+
/**
- * Sets a portion of the colormap for the given 8-bit surface. If 'surface'
- * is not a palettized surface, this function does nothing, returning 0.
- * If all of the colors were set as passed to SDL_SetColors(), it will
- * return 1. If not all the color entries were set exactly as given,
- * it will return 0, and you should look at the surface palette to
- * determine the actual color palette.
- *
- * When 'surface' is the surface associated with the current display, the
- * display colormap will be updated with the requested colors. If
- * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
- * will always return 1, and the palette is guaranteed to be set the way
- * you desire, even if the window colormap has to be warped or run under
- * emulation.
+ * \brief Create a window with the specified position, dimensions, and flags.
+ *
+ * \param title The title of the window, in UTF-8 encoding.
+ * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
+ * ::SDL_WINDOWPOS_UNDEFINED.
+ * \param w The width of the window.
+ * \param h The height of the window.
+ * \param flags The flags for the window, a mask of any of the following:
+ * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
+ * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS,
+ * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
+ * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED.
+ *
+ * \return The id of the window created, or zero if window creation failed.
+ *
+ * \sa SDL_DestroyWindow()
*/
-extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
- SDL_Color *colors, int firstcolor, int ncolors);
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
+ int x, int y, int w,
+ int h, Uint32 flags);
/**
- * Sets a portion of the colormap for a given 8-bit surface.
- * 'flags' is one or both of:
- * SDL_LOGPAL -- set logical palette, which controls how blits are mapped
- * to/from the surface,
- * SDL_PHYSPAL -- set physical palette, which controls how pixels look on
- * the screen
- * Only screens have physical palettes. Separate change of physical/logical
- * palettes is only possible if the screen has SDL_HWPALETTE set.
- *
- * The return value is 1 if all colours could be set as requested, and 0
- * otherwise.
- *
- * SDL_SetColors() is equivalent to calling this function with
- * flags = (SDL_LOGPAL|SDL_PHYSPAL).
+ * \brief Create an SDL window from an existing native window.
+ *
+ * \param data A pointer to driver-dependent window creation data
+ *
+ * \return The id of the window created, or zero if window creation failed.
+ *
+ * \sa SDL_DestroyWindow()
*/
-extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
- SDL_Color *colors, int firstcolor,
- int ncolors);
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
/**
- * Maps an RGB triple to an opaque pixel value for a given pixel format
+ * \brief Get the numeric ID of the window, for logging purposes.
*/
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
-(const SDL_PixelFormat * const format,
- const Uint8 r, const Uint8 g, const Uint8 b);
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
/**
- * Maps an RGBA quadruple to a pixel value for a given pixel format
+ * \brief Get a window from a stored ID, or NULL if it doesn't exist.
*/
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
-(const SDL_PixelFormat * const format,
- const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a);
+extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
/**
- * Maps a pixel value into the RGB components for a given pixel format
+ * \brief Get the window flags.
*/
-extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
- const SDL_PixelFormat * const fmt,
- Uint8 *r, Uint8 *g, Uint8 *b);
+extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
/**
- * Maps a pixel value into the RGBA components for a given pixel format
+ * \brief Set the title of the window, in UTF-8 format.
+ *
+ * \sa SDL_GetWindowTitle()
*/
-extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
- const SDL_PixelFormat * const fmt,
- Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
-
-/** @sa SDL_CreateRGBSurface */
-#define SDL_AllocSurface SDL_CreateRGBSurface
-/**
- * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
- * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
- * If the depth is greater than 8 bits, the pixel format is set using the
- * flags '[RGB]mask'.
- * If the function runs out of memory, it will return NULL.
- *
- * The 'flags' tell what kind of surface to create.
- * SDL_SWSURFACE means that the surface should be created in system memory.
- * SDL_HWSURFACE means that the surface should be created in video memory,
- * with the same format as the display surface. This is useful for surfaces
- * that will not change much, to take advantage of hardware acceleration
- * when being blitted to the display surface.
- * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
- * this surface, but you must always lock it before accessing the pixels.
- * SDL will wait for current blits to finish before returning from the lock.
- * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
- * If the hardware supports acceleration of colorkey blits between
- * two surfaces in video memory, SDL will try to place the surface in
- * video memory. If this isn't possible or if there is no hardware
- * acceleration available, the surface will be placed in system memory.
- * SDL_SRCALPHA means that the surface will be used for alpha blits and
- * if the hardware supports hardware acceleration of alpha blits between
- * two surfaces in video memory, to place the surface in video memory
- * if possible, otherwise it will be placed in system memory.
- * If the surface is created in video memory, blits will be _much_ faster,
- * but the surface format must be identical to the video surface format,
- * and the only way to access the pixels member of the surface is to use
- * the SDL_LockSurface() and SDL_UnlockSurface() calls.
- * If the requested surface actually resides in video memory, SDL_HWSURFACE
- * will be set in the flags member of the returned surface. If for some
- * reason the surface could not be placed in video memory, it will not have
- * the SDL_HWSURFACE flag set, and will be created in system memory instead.
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
- (Uint32 flags, int width, int height, int depth,
- Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
-/** @sa SDL_CreateRGBSurface */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
- int width, int height, int depth, int pitch,
- Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
-extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
+extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
+ const char *title);
/**
- * SDL_LockSurface() sets up a surface for directly accessing the pixels.
- * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
- * to and read from 'surface->pixels', using the pixel format stored in
- * 'surface->format'. Once you are done accessing the surface, you should
- * use SDL_UnlockSurface() to release it.
- *
- * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
- * to 0, then you can read and write to the surface at any time, and the
- * pixel format of the surface will not change. In particular, if the
- * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
- * will not need to lock the display surface before accessing it.
- *
- * No operating system or library calls should be made between lock/unlock
- * pairs, as critical system locks may be held during this time.
- *
- * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
+ * \brief Get the title of the window, in UTF-8 format.
+ *
+ * \sa SDL_SetWindowTitle()
*/
-extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
-extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
+extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
/**
- * Load a surface from a seekable SDL data source (memory or file.)
- * If 'freesrc' is non-zero, the source will be closed after being read.
- * Returns the new surface, or NULL if there was an error.
- * The new surface should be freed with SDL_FreeSurface().
+ * \brief Set the icon of the window.
+ *
+ * \param icon The icon for the window.
*/
-extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
-
-/** Convenience macro -- load a surface from a file */
-#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
+extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
+ SDL_Surface * icon);
/**
- * Save a surface to a seekable SDL data source (memory or file.)
- * If 'freedst' is non-zero, the source will be closed after being written.
- * Returns 0 if successful or -1 if there was an error.
+ * \brief Associate an arbitrary pointer with the window.
+ *
+ * \sa SDL_GetWindowData()
*/
-extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
- (SDL_Surface *surface, SDL_RWops *dst, int freedst);
-
-/** Convenience macro -- save a surface to a file */
-#define SDL_SaveBMP(surface, file) \
- SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
+extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_Window * window,
+ void *userdata);
/**
- * Sets the color key (transparent pixel) in a blittable surface.
- * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
- * 'key' will be the transparent pixel in the source image of a blit.
- * SDL_RLEACCEL requests RLE acceleration for the surface if present,
- * and removes RLE acceleration if absent.
- * If 'flag' is 0, this function clears any current color key.
- * This function returns 0, or -1 if there was an error.
+ * \brief Retrieve the data pointer associated with the window.
+ *
+ * \sa SDL_SetWindowData()
*/
-extern DECLSPEC int SDLCALL SDL_SetColorKey
- (SDL_Surface *surface, Uint32 flag, Uint32 key);
+extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window);
/**
- * This function sets the alpha value for the entire surface, as opposed to
- * using the alpha component of each pixel. This value measures the range
- * of transparency of the surface, 0 being completely transparent to 255
- * being completely opaque. An 'alpha' value of 255 causes blits to be
- * opaque, the source pixels copied to the destination (the default). Note
- * that per-surface alpha can be combined with colorkey transparency.
- *
- * If 'flag' is 0, alpha blending is disabled for the surface.
- * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
- * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
- * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
- *
- * The 'alpha' parameter is ignored for surfaces that have an alpha channel.
+ * \brief Set the position of the window.
+ *
+ * \param window The window to reposition.
+ * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
+ ::SDL_WINDOWPOS_UNDEFINED.
+ * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
+ ::SDL_WINDOWPOS_UNDEFINED.
+ *
+ * \note The window coordinate origin is the upper left of the display.
+ *
+ * \sa SDL_GetWindowPosition()
*/
-extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
+extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
+ int x, int y);
/**
- * Sets the clipping rectangle for the destination surface in a blit.
- *
- * If the clip rectangle is NULL, clipping will be disabled.
- * If the clip rectangle doesn't intersect the surface, the function will
- * return SDL_FALSE and blits will be completely clipped. Otherwise the
- * function returns SDL_TRUE and blits to the surface will be clipped to
- * the intersection of the surface area and the clipping rectangle.
- *
- * Note that blits are automatically clipped to the edges of the source
- * and destination surfaces.
+ * \brief Get the position of the window.
+ *
+ * \sa SDL_SetWindowPosition()
*/
-extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
+extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
+ int *x, int *y);
/**
- * Gets the clipping rectangle for the destination surface in a blit.
- * 'rect' must be a pointer to a valid rectangle which will be filled
- * with the correct values.
+ * \brief Set the size of the window's client area.
+ *
+ * \note You can't change the size of a fullscreen window, it automatically
+ * matches the size of the display mode.
+ *
+ * \sa SDL_GetWindowSize()
*/
-extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
+extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
+ int h);
/**
- * Creates a new surface of the specified format, and then copies and maps
- * the given surface to it so the blit of the converted surface will be as
- * fast as possible. If this function fails, it returns NULL.
- *
- * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
- * semantics. You can also pass SDL_RLEACCEL in the flags parameter and
- * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
- * surface.
- *
- * This function is used internally by SDL_DisplayFormat().
+ * \brief Get the size of the window's client area.
+ *
+ * \sa SDL_SetWindowSize()
*/
-extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
- (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
+extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
+ int *h);
/**
- * This performs a fast blit from the source surface to the destination
- * surface. It assumes that the source and destination rectangles are
- * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
- * surface (src or dst) is copied. The final blit rectangles are saved
- * in 'srcrect' and 'dstrect' after all clipping is performed.
- * If the blit is successful, it returns 0, otherwise it returns -1.
- *
- * The blit function should not be called on a locked surface.
- *
- * The blit semantics for surfaces with and without alpha and colorkey
- * are defined as follows:
- *
- * RGBA->RGB:
- * SDL_SRCALPHA set:
- * alpha-blend (using alpha-channel).
- * SDL_SRCCOLORKEY ignored.
- * SDL_SRCALPHA not set:
- * copy RGB.
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * RGB values of the source colour key, ignoring alpha in the
- * comparison.
- *
- * RGB->RGBA:
- * SDL_SRCALPHA set:
- * alpha-blend (using the source per-surface alpha value);
- * set destination alpha to opaque.
- * SDL_SRCALPHA not set:
- * copy RGB, set destination alpha to source per-surface alpha value.
- * both:
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * source colour key.
- *
- * RGBA->RGBA:
- * SDL_SRCALPHA set:
- * alpha-blend (using the source alpha channel) the RGB values;
- * leave destination alpha untouched. [Note: is this correct?]
- * SDL_SRCCOLORKEY ignored.
- * SDL_SRCALPHA not set:
- * copy all of RGBA to the destination.
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * RGB values of the source colour key, ignoring alpha in the
- * comparison.
- *
- * RGB->RGB:
- * SDL_SRCALPHA set:
- * alpha-blend (using the source per-surface alpha value).
- * SDL_SRCALPHA not set:
- * copy RGB.
- * both:
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * source colour key.
- *
- * If either of the surfaces were in video memory, and the blit returns -2,
- * the video memory was lost, so it should be reloaded with artwork and
- * re-blitted:
- * @code
- * while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
- * while ( SDL_LockSurface(image) < 0 )
- * Sleep(10);
- * -- Write image pixels to image->pixels --
- * SDL_UnlockSurface(image);
- * }
- * @endcode
- *
- * This happens under DirectX 5.0 when the system switches away from your
- * fullscreen application. The lock will also fail until you have access
- * to the video memory again.
- *
- * You should call SDL_BlitSurface() unless you know exactly how SDL
- * blitting works internally and how to use the other blit functions.
+ * \brief Show the window.
+ *
+ * \sa SDL_HideWindow()
*/
-#define SDL_BlitSurface SDL_UpperBlit
-
-/** This is the public blit function, SDL_BlitSurface(), and it performs
- * rectangle validation and clipping before passing it to SDL_LowerBlit()
- */
-extern DECLSPEC int SDLCALL SDL_UpperBlit
- (SDL_Surface *src, SDL_Rect *srcrect,
- SDL_Surface *dst, SDL_Rect *dstrect);
-/** This is a semi-private blit function and it performs low-level surface
- * blitting only.
- */
-extern DECLSPEC int SDLCALL SDL_LowerBlit
- (SDL_Surface *src, SDL_Rect *srcrect,
- SDL_Surface *dst, SDL_Rect *dstrect);
+extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
/**
- * This function performs a fast fill of the given rectangle with 'color'
- * The given rectangle is clipped to the destination surface clip area
- * and the final fill rectangle is saved in the passed in pointer.
- * If 'dstrect' is NULL, the whole surface will be filled with 'color'
- * The color should be a pixel of the format used by the surface, and
- * can be generated by the SDL_MapRGB() function.
- * This function returns 0 on success, or -1 on error.
+ * \brief Hide the window.
+ *
+ * \sa SDL_ShowWindow()
*/
-extern DECLSPEC int SDLCALL SDL_FillRect
- (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
+extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
/**
- * This function takes a surface and copies it to a new surface of the
- * pixel format and colors of the video framebuffer, suitable for fast
- * blitting onto the display surface. It calls SDL_ConvertSurface()
- *
- * If you want to take advantage of hardware colorkey or alpha blit
- * acceleration, you should set the colorkey and alpha value before
- * calling this function.
- *
- * If the conversion fails or runs out of memory, it returns NULL
+ * \brief Raise the window above other windows and set the input focus.
*/
-extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
+extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
/**
- * This function takes a surface and copies it to a new surface of the
- * pixel format and colors of the video framebuffer (if possible),
- * suitable for fast alpha blitting onto the display surface.
- * The new surface will always have an alpha channel.
- *
- * If you want to take advantage of hardware colorkey or alpha blit
- * acceleration, you should set the colorkey and alpha value before
- * calling this function.
- *
- * If the conversion fails or runs out of memory, it returns NULL
+ * \brief Make the window as large as possible.
+ *
+ * \sa SDL_RestoreWindow()
*/
-extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/** @name YUV video surface overlay functions */ /*@{*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/** This function creates a video output overlay
- * Calling the returned surface an overlay is something of a misnomer because
- * the contents of the display surface underneath the area where the overlay
- * is shown is undefined - it may be overwritten with the converted YUV data.
- */
-extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
- Uint32 format, SDL_Surface *display);
-
-/** Lock an overlay for direct access, and unlock it when you are done */
-extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
-extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
-
-/** Blit a video overlay to the display surface.
- * The contents of the video surface underneath the blit destination are
- * not defined.
- * The width and height of the destination rectangle may be different from
- * that of the overlay, but currently only 2x scaling is supported.
- */
-extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
-
-/** Free a video overlay */
-extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
-
-/*@}*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/** @name OpenGL support functions. */ /*@{*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
/**
- * Dynamically load an OpenGL library, or the default one if path is NULL
- *
- * If you do this, you need to retrieve all of the GL functions used in
- * your program from the dynamic library using SDL_GL_GetProcAddress().
+ * \brief Minimize the window to an iconic representation.
+ *
+ * \sa SDL_RestoreWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
+
+/**
+ * \brief Restore the size and position of a minimized or maximized window.
+ *
+ * \sa SDL_MaximizeWindow()
+ * \sa SDL_MinimizeWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
+
+/**
+ * \brief Set the window's fullscreen state.
+ *
+ * \return 0 on success, or -1 if setting the display mode failed.
+ *
+ * \sa SDL_SetWindowDisplayMode()
+ * \sa SDL_GetWindowDisplayMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
+ int fullscreen);
+
+/**
+ * \brief Set the window's input grab mode.
+ *
+ * \param mode This is 1 to grab input, and 0 to release input.
+ *
+ * \sa SDL_GetWindowGrab()
+ */
+extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
+ int mode);
+
+/**
+ * \brief Get the window's input grab mode.
+ *
+ * \return This returns 1 if input is grabbed, and 0 otherwise.
+ *
+ * \sa SDL_SetWindowGrab()
+ */
+extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window);
+
+/**
+ * \brief Get driver specific information about a window.
+ *
+ * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
+ */
+struct SDL_SysWMinfo;
+extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
+ struct SDL_SysWMinfo
+ *info);
+
+/**
+ * \brief Destroy a window.
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
+
+/**
+ * \brief Get the number of 2D rendering drivers available for the current
+ * display.
+ *
+ * A render driver is a set of code that handles rendering and texture
+ * management on a particular display. Normally there is only one, but
+ * some drivers may have several available with different capabilities.
+ *
+ * \sa SDL_GetRenderDriverInfo()
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
+
+/**
+ * \brief Get information about a specific 2D rendering driver for the current
+ * display.
+ *
+ * \param index The index of the driver to query information about.
+ * \param info A pointer to an SDL_RendererInfo struct to be filled with
+ * information on the rendering driver.
+ *
+ * \return 0 on success, -1 if the index was out of range.
+ *
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
+ SDL_RendererInfo * info);
+
+/**
+ * \brief Create and make active a 2D rendering context for a window.
+ *
+ * \param window The window where rendering is displayed.
+ * \param index The index of the rendering driver to initialize, or -1 to
+ * initialize the first one supporting the requested flags.
+ * \param flags ::SDL_RendererFlags.
+ *
+ * \return 0 on success, -1 if there was an error creating the renderer.
+ *
+ * \sa SDL_SelectRenderer()
+ * \sa SDL_GetRendererInfo()
+ * \sa SDL_DestroyRenderer()
+ */
+extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_Window * window,
+ int index, Uint32 flags);
+
+/**
+ * \brief Select the rendering context for a particular window.
+ *
+ * \return 0 on success, -1 if the selected window doesn't have a
+ * rendering context.
+ */
+extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_Window * window);
+
+/**
+ * \brief Get information about the current rendering context.
+ */
+extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info);
+
+/**
+ * \brief Create a texture for the current rendering context.
+ *
+ * \param format The format of the texture.
+ * \param access One of the enumerated values in ::SDL_TextureAccess.
+ * \param w The width of the texture in pixels.
+ * \param h The height of the texture in pixels.
+ *
+ * \return The created texture is returned, or 0 if no rendering context was
+ * active, the format was unsupported, or the width or height were out
+ * of range.
+ *
+ * \sa SDL_QueryTexture()
+ * \sa SDL_DestroyTexture()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(Uint32 format,
+ int access, int w,
+ int h);
+
+/**
+ * \brief Create a texture from an existing surface.
+ *
+ * \param format The format of the texture, or 0 to pick an appropriate format.
+ * \param surface The surface containing pixel data used to fill the texture.
+ *
+ * \return The created texture is returned, or 0 if no rendering context was
+ * active, the format was unsupported, or the surface width or height
+ * were out of range.
+ *
+ * \note The surface is not modified or freed by this function.
+ *
+ * \sa SDL_QueryTexture()
+ * \sa SDL_DestroyTexture()
+ */
+extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(Uint32
+ format,
+ SDL_Surface
+ * surface);
+
+/**
+ * \brief Query the attributes of a texture
+ *
+ * \param texture A texture to be queried.
+ * \param format A pointer filled in with the raw format of the texture. The
+ * actual format may differ, but pixel transfers will use this
+ * format.
+ * \param access A pointer filled in with the actual access to the texture.
+ * \param w A pointer filled in with the width of the texture in pixels.
+ * \param h A pointer filled in with the height of the texture in pixels.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ */
+extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
+ Uint32 * format, int *access,
+ int *w, int *h);
+
+/**
+ * \brief Query the pixels of a texture, if the texture does not need to be
+ * locked for pixel access.
+ *
+ * \param texture A texture to be queried, which was created with
+ * ::SDL_TEXTUREACCESS_STREAMING.
+ * \param pixels A pointer filled with a pointer to the pixels for the
+ * texture.
+ * \param pitch A pointer filled in with the pitch of the pixel data.
+ *
+ * \return 0 on success, or -1 if the texture is not valid, or must be locked
+ * for pixel access.
+ */
+extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_Texture * texture,
+ void **pixels, int *pitch);
+
+/**
+ * \brief Set the color palette of an indexed texture.
+ *
+ * \param texture The texture to update.
+ * \param colors The array of RGB color data.
+ * \param firstcolor The first index to update.
+ * \param ncolors The number of palette entries to fill with the color data.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or not an indexed
+ * texture.
+ */
+extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_Texture * texture,
+ const SDL_Color * colors,
+ int firstcolor,
+ int ncolors);
+
+/**
+ * \brief Get the color palette from an indexed texture if it has one.
+ *
+ * \param texture The texture to update.
+ * \param colors The array to fill with RGB color data.
+ * \param firstcolor The first index to retrieve.
+ * \param ncolors The number of palette entries to retrieve.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or not an indexed
+ * texture.
+ */
+extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_Texture * texture,
+ SDL_Color * colors,
+ int firstcolor,
+ int ncolors);
+
+/**
+ * \brief Set an additional color value used in render copy operations.
+ *
+ * \param texture The texture to update.
+ * \param r The red source color value multiplied into copy operations.
+ * \param g The green source color value multiplied into copy operations.
+ * \param b The blue source color value multiplied into copy operations.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or color modulation
+ * is not supported.
+ *
+ * \sa SDL_GetTextureColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
+ Uint8 r, Uint8 g, Uint8 b);
+
+
+/**
+ * \brief Get the additional color value used in render copy operations.
+ *
+ * \param texture The texture to query.
+ * \param r A pointer filled in with the source red color value.
+ * \param g A pointer filled in with the source green color value.
+ * \param b A pointer filled in with the source blue color value.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureColorMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
+ Uint8 * r, Uint8 * g,
+ Uint8 * b);
+
+/**
+ * \brief Set an additional alpha value used in render copy operations.
+ *
+ * \param texture The texture to update.
+ * \param alpha The source alpha value multiplied into copy operations.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or alpha modulation
+ * is not supported.
+ *
+ * \sa SDL_GetTextureAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
+ Uint8 alpha);
+
+/**
+ * \brief Get the additional alpha value used in render copy operations.
+ *
+ * \param texture The texture to query.
+ * \param alpha A pointer filled in with the source alpha value.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureAlphaMod()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
+ Uint8 * alpha);
+
+/**
+ * \brief Set the blend mode used for texture copy operations.
+ *
+ * \param texture The texture to update.
+ * \param blendMode ::SDL_BlendMode to use for texture blending.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or the blend mode is
+ * not supported.
+ *
+ * \note If the blend mode is not supported, the closest supported mode is
+ * chosen.
+ *
+ * \sa SDL_GetTextureBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
+ int blendMode);
+
+/**
+ * \brief Get the blend mode used for texture copy operations.
+ *
+ * \param texture The texture to query.
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
+ int *blendMode);
+
+/**
+ * \brief Set the scale mode used for texture copy operations.
+ *
+ * \param texture The texture to update.
+ * \param scaleMode ::SDL_TextureScaleMode to use for texture scaling.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or the scale mode is
+ * not supported.
+ *
+ * \note If the scale mode is not supported, the closest supported mode is
+ * chosen.
+ *
+ * \sa SDL_GetTextureScaleMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
+ int scaleMode);
+
+/**
+ * \brief Get the scale mode used for texture copy operations.
+ *
+ * \param texture The texture to query.
+ * \param scaleMode A pointer filled in with the current scale mode.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \sa SDL_SetTextureScaleMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
+ int *scaleMode);
+
+/**
+ * \brief Update the given texture rectangle with new pixel data.
+ *
+ * \param texture The texture to update
+ * \param rect A pointer to the rectangle of pixels to update, or NULL to
+ * update the entire texture.
+ * \param pixels The raw pixel data.
+ * \param pitch The number of bytes between rows of pixel data.
+ *
+ * \return 0 on success, or -1 if the texture is not valid.
+ *
+ * \note This is a fairly slow function.
+ */
+extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ const void *pixels, int pitch);
+
+/**
+ * \brief Lock a portion of the texture for pixel access.
+ *
+ * \param texture The texture to lock for access, which was created with
+ * ::SDL_TEXTUREACCESS_STREAMING.
+ * \param rect A pointer to the rectangle to lock for access. If the rect
+ * is NULL, the entire texture will be locked.
+ * \param markDirty If this is nonzero, the locked area will be marked dirty
+ * when the texture is unlocked.
+ * \param pixels This is filled in with a pointer to the locked pixels,
+ * appropriately offset by the locked area.
+ * \param pitch This is filled in with the pitch of the locked pixels.
+ *
+ * \return 0 on success, or -1 if the texture is not valid or was created with
+ * ::SDL_TEXTUREACCESS_STATIC.
+ *
+ * \sa SDL_DirtyTexture()
+ * \sa SDL_UnlockTexture()
+ */
+extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
+ const SDL_Rect * rect,
+ int markDirty, void **pixels,
+ int *pitch);
+
+/**
+ * \brief Unlock a texture, uploading the changes to video memory, if needed.
+ *
+ * \sa SDL_LockTexture()
+ * \sa SDL_DirtyTexture()
+ */
+extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
+
+/**
+ * \brief Mark the specified rectangles of the texture as dirty.
+ *
+ * \param texture The texture to mark dirty, which was created with
+ * ::SDL_TEXTUREACCESS_STREAMING.
+ * \param numrects The number of rectangles pointed to by rects.
+ * \param rects The pointer to an array of dirty rectangles.
+ *
+ * \sa SDL_LockTexture()
+ * \sa SDL_UnlockTexture()
+ */
+extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_Texture * texture,
+ int numrects,
+ const SDL_Rect * rects);
+
+/**
+ * \brief Set the color used for drawing operations (Fill and Line).
+ *
+ * \param r The red value used to draw on the rendering target.
+ * \param g The green value used to draw on the rendering target.
+ * \param b The blue value used to draw on the rendering target.
+ * \param a The alpha value used to draw on the rendering target, usually
+ * ::SDL_ALPHA_OPAQUE (255).
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a);
+
+/**
+ * \brief Get the color used for drawing operations (Fill and Line).
+ *
+ * \param r A pointer to the red value used to draw on the rendering target.
+ * \param g A pointer to the green value used to draw on the rendering target.
+ * \param b A pointer to the blue value used to draw on the rendering target.
+ * \param a A pointer to the alpha value used to draw on the rendering target,
+ * usually ::SDL_ALPHA_OPAQUE (255).
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b,
+ Uint8 * a);
+
+/**
+ * \brief Set the blend mode used for drawing operations (Fill and Line).
+ *
+ * \param blendMode ::SDL_BlendMode to use for blending.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ *
+ * \note If the blend mode is not supported, the closest supported mode is
+ * chosen.
+ *
+ * \sa SDL_GetRenderDrawBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode);
+
+/**
+ * \brief Get the blend mode used for drawing operations.
+ *
+ * \param blendMode A pointer filled in with the current blend mode.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ *
+ * \sa SDL_SetRenderDrawBlendMode()
+ */
+extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode);
+
+/**
+ * \brief Clear the current rendering target with the drawing color
+ */
+extern DECLSPEC int SDLCALL SDL_RenderClear(void);
+
+/**
+ * \brief Draw a point on the current rendering target.
+ *
+ * \param x The x coordinate of the point.
+ * \param y The y coordinate of the point.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(int x, int y);
+
+/**
+ * \brief Draw some number of points on the current rendering target.
+ *
+ * \param points The points to draw
+ * \param count The number of points to draw
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(const SDL_Point * points,
+ int count);
+
+/**
+ * \brief Draw a line on the current rendering target.
+ *
+ * \param x1 The x coordinate of the start point.
+ * \param y1 The y coordinate of the start point.
+ * \param x2 The x coordinate of the end point.
+ * \param y2 The y coordinate of the end point.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLine(int x1, int y1, int x2, int y2);
+
+/**
+ * \brief Draw a series of connected lines on the current rendering target.
+ *
+ * \param points The points along the lines
+ * \param count The number of points, drawing count-1 lines
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLines(const SDL_Point * points,
+ int count);
+
+/**
+ * \brief Draw a rectangle on the current rendering target with the drawing color.
+ *
+ * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRect(const SDL_Rect * rect);
+
+/**
+ * \brief Draw some number of rectangles in the current rendering target with the drawing color.
+ *
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRects(const SDL_Rect ** rect, int count);
+
+/**
+ * \brief Fill a rectangle on the current rendering target with the drawing color.
+ *
+ * \param rect A pointer to the destination rectangle, or NULL for the entire
+ * rendering target.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRect(const SDL_Rect * rect);
+
+/**
+ * \brief Fill some number of rectangles in the current rendering target with the drawing color.
+ *
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRects(const SDL_Rect ** rect, int count);
+
+/**
+ * \brief Copy a portion of the texture to the current rendering target.
+ *
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ *
+ * \return 0 on success, or -1 if there is no rendering context current, or the
+ * driver doesn't support the requested operation.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_Rect * dstrect);
+
+/**
+ * \brief Read pixels from the current rendering target.
+ *
+ * \param rect A pointer to the rectangle to read, or NULL for the entire
+ * render target.
+ * \param format The desired format of the pixel data, or 0 to use the format
+ * of the rendering target
+ * \param pixels A pointer to be filled in with the pixel data
+ * \param pitch The pitch of the pixels parameter.
+ *
+ * \return 0 on success, or -1 if pixel reading is not supported.
+ *
+ * \warning This is a very slow operation, and should not be used frequently.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
+ Uint32 format,
+ void *pixels, int pitch);
+
+/**
+ * \brief Write pixels to the current rendering target.
+ *
+ * \param rect A pointer to the rectangle to write, or NULL for the entire
+ * render target.
+ * \param format The format of the pixel data, or 0 to use the format
+ * of the rendering target
+ * \param pixels A pointer to the pixel data to write.
+ * \param pitch The pitch of the pixels parameter.
+ *
+ * \return 0 on success, or -1 if pixel writing is not supported.
+ *
+ * \warning This is a very slow operation, and should not be used frequently.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
+ Uint32 format,
+ const void *pixels,
+ int pitch);
+
+/**
+ * \brief Update the screen with rendering performed.
+ */
+extern DECLSPEC void SDLCALL SDL_RenderPresent(void);
+
+/**
+ * \brief Destroy the specified texture.
+ *
+ * \sa SDL_CreateTexture()
+ * \sa SDL_CreateTextureFromSurface()
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
+
+/**
+ * \brief Destroy the rendering context for a window and free associated
+ * textures.
+ *
+ * \sa SDL_CreateRenderer()
+ */
+extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Window * window);
+
+/**
+ * \brief Returns whether the screensaver is currently enabled (default off).
+ *
+ * \sa SDL_EnableScreenSaver()
+ * \sa SDL_DisableScreenSaver()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
+
+/**
+ * \brief Allow the screen to be blanked by a screensaver
+ *
+ * \sa SDL_IsScreenSaverEnabled()
+ * \sa SDL_DisableScreenSaver()
+ */
+extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
+
+/**
+ * \brief Prevent the screen from being blanked by a screensaver
+ *
+ * \sa SDL_IsScreenSaverEnabled()
+ * \sa SDL_EnableScreenSaver()
+ */
+extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
+
+
+/**
+ * \name OpenGL support functions
+ */
+/*@{*/
+
+/**
+ * \brief Dynamically load an OpenGL library.
+ *
+ * \param path The platform dependent OpenGL library name, or NULL to open the
+ * default OpenGL library.
+ *
+ * \return 0 on success, or -1 if the library couldn't be loaded.
+ *
+ * This should be done after initializing the video driver, but before
+ * creating any OpenGL windows. If no OpenGL library is loaded, the default
+ * library will be loaded upon creation of the first OpenGL window.
+ *
+ * \note If you do this, you need to retrieve all of the GL functions used in
+ * your program from the dynamic library using SDL_GL_GetProcAddress().
+ *
+ * \sa SDL_GL_GetProcAddress()
+ * \sa SDL_GL_UnloadLibrary()
*/
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
/**
- * Get the address of a GL function
+ * \brief Get the address of an OpenGL function.
*/
-extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
+extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
/**
- * Set an attribute of the OpenGL subsystem before intialization.
+ * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
+ *
+ * \sa SDL_GL_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
+
+/**
+ * \brief Return true if an OpenGL extension is supported for the current
+ * context.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
+ *extension);
+
+/**
+ * \brief Set an OpenGL window attribute before window creation.
*/
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
/**
- * Get an attribute of the OpenGL subsystem from the windowing
- * interface, such as glX. This is of course different from getting
- * the values from SDL's internal OpenGL subsystem, which only
- * stores the values you request before initialization.
- *
- * Developers should track the values they pass into SDL_GL_SetAttribute
- * themselves if they want to retrieve these values.
+ * \brief Get the actual value for an attribute from the current context.
*/
-extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
+extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
/**
- * Swap the OpenGL buffers, if double-buffering is supported.
+ * \brief Create an OpenGL context for use with an OpenGL window, and make it
+ * current.
+ *
+ * \sa SDL_GL_DeleteContext()
*/
-extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
-
-/** @name OpenGL Internal Functions
- * Internal functions that should not be called unless you have read
- * and understood the source code for these functions.
- */
-/*@{*/
-extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
-extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
-extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
-/*@}*/
-
-/*@}*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/** @name Window Manager Functions */
-/** These functions allow interaction with the window manager, if any. */ /*@{*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
+ window);
/**
- * Sets the title and icon text of the display window (UTF-8 encoded)
+ * \brief Set up an OpenGL context for rendering into an OpenGL window.
+ *
+ * \note The context must have been created with a compatible window.
*/
-extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
-/**
- * Gets the title and icon text of the display window (UTF-8 encoded)
- */
-extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
+extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
+ SDL_GLContext context);
/**
- * Sets the icon for the display window.
- * This function must be called before the first call to SDL_SetVideoMode().
- * It takes an icon surface, and a mask in MSB format.
- * If 'mask' is NULL, the entire icon surface will be used as the icon.
+ * \brief Set the swap interval for the current OpenGL context.
+ *
+ * \param interval 0 for immediate updates, 1 for updates synchronized with the
+ * vertical retrace.
+ *
+ * \return 0 on success, or -1 if setting the swap interval is not supported.
+ *
+ * \sa SDL_GL_GetSwapInterval()
*/
-extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
+extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
/**
- * This function iconifies the window, and returns 1 if it succeeded.
- * If the function succeeds, it generates an SDL_APPACTIVE loss event.
- * This function is a noop and returns 0 in non-windowed environments.
+ * \brief Get the swap interval for the current OpenGL context.
+ *
+ * \return 0 if there is no vertical retrace synchronization, 1 if the buffer
+ * swap is synchronized with the vertical retrace, and -1 if getting
+ * the swap interval is not supported.
+ *
+ * \sa SDL_GL_SetSwapInterval()
*/
-extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
+extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
/**
- * Toggle fullscreen mode without changing the contents of the screen.
- * If the display surface does not require locking before accessing
- * the pixel information, then the memory pointers will not change.
- *
- * If this function was able to toggle fullscreen mode (change from
- * running in a window to fullscreen, or vice-versa), it will return 1.
- * If it is not implemented, or fails, it returns 0.
- *
- * The next call to SDL_SetVideoMode() will set the mode fullscreen
- * attribute based on the flags parameter - if SDL_FULLSCREEN is not
- * set, then the display will be windowed by default where supported.
- *
- * This is currently only implemented in the X11 video driver.
+ * \brief Swap the OpenGL buffers for the window, if double-buffering is
+ * supported.
*/
-extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
+extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
-typedef enum {
- SDL_GRAB_QUERY = -1,
- SDL_GRAB_OFF = 0,
- SDL_GRAB_ON = 1,
- SDL_GRAB_FULLSCREEN /**< Used internally */
-} SDL_GrabMode;
/**
- * This function allows you to set and query the input grab state of
- * the application. It returns the new input grab state.
- *
- * Grabbing means that the mouse is confined to the application window,
- * and nearly all keyboard input is passed directly to the application,
- * and not interpreted by a window manager, if any.
+ * \brief Delete an OpenGL context.
+ *
+ * \sa SDL_GL_CreateContext()
*/
-extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
+extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
+
+/*@}*//*OpenGL support functions*/
-/*@}*/
-/** @internal Not in public API at the moment - do not use! */
-extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
- SDL_Surface *dst, SDL_Rect *dstrect);
-
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
+/* *INDENT-OFF* */
}
+/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_video_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/include/begin_code.h b/alienblaster/project/jni/sdl/include/begin_code.h
index 22748090c..395dc7c6a 100644
--- a/alienblaster/project/jni/sdl/include/begin_code.h
+++ b/alienblaster/project/jni/sdl/include/begin_code.h
@@ -1,45 +1,40 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
-/**
- * @file begin_code.h
+/**
+ * \file begin_code.h
+ *
* This file sets things up for C dynamic library function definitions,
* static inlined functions, and structures aligned at 4-byte alignment.
* If you don't like ugly C preprocessor code, don't look at this file. :)
*/
-/**
- * @file begin_code.h
- * This shouldn't be nested -- included it around code only.
- */
+/* This shouldn't be nested -- included it around code only. */
#ifdef _begin_code_h
#error Nested inclusion of begin_code.h
#endif
#define _begin_code_h
-/**
- * @def DECLSPEC
- * Some compilers use a special export keyword
- */
+/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# if defined(__BEOS__) || defined(__HAIKU__)
# if defined(__GNUC__)
@@ -50,32 +45,13 @@
# elif defined(__WIN32__)
# ifdef __BORLANDC__
# ifdef BUILD_SDL
-# define DECLSPEC
+# define DECLSPEC
# else
# define DECLSPEC __declspec(dllimport)
# endif
# else
# define DECLSPEC __declspec(dllexport)
# endif
-# elif defined(__OS2__)
-# ifdef __WATCOMC__
-# ifdef BUILD_SDL
-# define DECLSPEC __declspec(dllexport)
-# else
-# define DECLSPEC
-# endif
-# elif defined (__GNUC__) && __GNUC__ < 4
-# /* Added support for GCC-EMX = 4
# define DECLSPEC __attribute__ ((visibility("default")))
@@ -85,45 +61,25 @@
# endif
#endif
-/**
- * @def SDLCALL
- * By default SDL uses the C calling convention
- */
+/* By default SDL uses the C calling convention */
#ifndef SDLCALL
-# if defined(__WIN32__) && !defined(__GNUC__)
-# define SDLCALL __cdecl
-# elif defined(__OS2__)
-# if defined (__GNUC__) && __GNUC__ < 4
-# /* Added support for GCC-EMX , where is the value of
+# the FILE_VERSION_FILTER tag, and is the name of an input file
+# provided by doxygen. Whatever the progam writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
-# The QUIET tag can be used to turn on/off the messages that are generated
+# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
WARN_FORMAT = "$file:$line: $text"
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
# to stderr.
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = include
+INPUT =
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl *.odl
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-FILE_PATTERNS = *.h
+FILE_PATTERNS =
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = NO
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE =
+EXCLUDE =
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
-# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
EXCLUDE_SYMLINKS = NO
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
# the \include command).
-EXAMPLE_PATH =
+EXAMPLE_PATH =
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
-EXAMPLE_PATTERNS =
+EXAMPLE_PATTERNS =
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
# the \image command).
-IMAGE_PATH =
+IMAGE_PATH =
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command , where
-# is the value of the INPUT_FILTER tag, and is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command , where
+# is the value of the INPUT_FILTER tag, and is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
-INPUT_FILTER =
+INPUT_FILTER =
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse.
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
@@ -395,144 +542,181 @@ FILTER_SOURCE_FILES = NO
# configuration options related to source browsing
#---------------------------------------------------------------------------
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = NO
-# Setting the INLINE_SOURCES tag to YES will include the body
+# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = YES
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = YES
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = NO
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
-HTML_HEADER =
+HTML_HEADER =
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
-HTML_FOOTER =
+HTML_FOOTER =
-# The HTML_STYLESHEET tag can be used to specify a user defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
-HTML_STYLESHEET =
+HTML_STYLESHEET =
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the Html help documentation and to the tree view.
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
-# This tag can be used to set the number of enum values (range [1..20])
+# This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation.
ENUM_VALUES_PER_LINE = 4
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
-# or Internet explorer 4.0+). Note that for large projects the tree generation
-# can take a very long time. In such cases it is better to disable this feature.
-# Windows users are probably better off using the HTML help feature.
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
@@ -541,406 +725,505 @@ TREEVIEW_WIDTH = 250
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
-GENERATE_LATEX = NO
+GENERATE_LATEX = YES
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
LATEX_CMD_NAME = latex
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
-LATEX_HEADER =
+LATEX_HEADER =
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = NO
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = NO
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimised for Word 97 and may not look very pretty with
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
-GENERATE_RTF = YES
+GENERATE_RTF = NO
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assigments. You only have to provide
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
-# Set optional variables used in the generation of an rtf document.
+# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
-RTF_EXTENSIONS_FILE =
+RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = YES
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
-# The MAN_EXTENSION tag determines the extension that is added to
+# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
-MAN_LINKS = YES
+MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
GENERATE_XML = NO
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
+# configuration options related to the Perl module output
#---------------------------------------------------------------------------
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = YES
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_PREDEFINED tags.
EXPAND_ONLY_PREDEF = YES
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
SEARCH_INCLUDES = YES
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
# the preprocessor.
-INCLUDE_PATH =
+INCLUDE_PATH =
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
-PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 SDLCALL= SNDDECLSPEC=
+PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \
+ DECLSPEC= SDLCALL=
-# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line and do not end with a semicolon. Such function macros are typically
-# used for boiler-plate code, and will confuse the parser if not removed.
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
+# Configuration::additions related to external references
#---------------------------------------------------------------------------
-# The TAGFILES tag can be used to specify one or more tagfiles.
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
-TAGFILES =
+TAGFILES =
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = YES
-# The PERL_PATH should be the absolute path and name of the perl script
+# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
+# Configuration options related to the dot tool
#---------------------------------------------------------------------------
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yields more powerful graphs.
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
CLASS_DIAGRAMS = NO
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = NO
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO.
-CLASS_GRAPH = NO
+CLASS_GRAPH = YES
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
-COLLABORATION_GRAPH = NO
+COLLABORATION_GRAPH = YES
-# If set to YES, the inheritance and collaboration graphs will show the
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = NO
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = NO
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = YES
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = YES
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. Possible values are png, jpg, or gif
# If left blank png will be used.
DOT_IMAGE_FORMAT = png
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
-DOT_PATH =
+DOT_PATH =
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
# \dotfile command).
-DOTFILE_DIRS =
+DOTFILE_DIRS =
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_WIDTH = 1024
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_HEIGHT = 1024
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that a graph may be further truncated if the graph's
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, which results in a white background.
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermedate dot files that are used to generate
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
+# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
-# The SEARCHENGINE tag specifies whether or not a search engine should be
+# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
-
-# The CGI_NAME tag should be the name of the CGI script that
-# starts the search engine (doxysearch) with the correct parameters.
-# A script with this name will be generated by doxygen.
-
-CGI_NAME = search.cgi
-
-# The CGI_URL tag should be the absolute URL to the directory where the
-# cgi binaries are located. See the documentation of your http daemon for
-# details.
-
-CGI_URL =
-
-# The DOC_URL tag should be the absolute URL to the directory where the
-# documentation is located. If left blank the absolute path to the
-# documentation, with file:// prepended to it, will be used.
-
-DOC_URL =
-
-# The DOC_ABSPATH tag should be the absolute path to the directory where the
-# documentation is located. If left blank the directory on the local machine
-# will be used.
-
-DOC_ABSPATH =
-
-# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
-# is installed.
-
-BIN_ABSPATH = /usr/local/bin/
-
-# The EXT_DOC_PATHS tag can be used to specify one or more paths to
-# documentation generated for other projects. This allows doxysearch to search
-# the documentation for these projects as well.
-
-EXT_DOC_PATHS =
diff --git a/alienblaster/project/jni/sdl/sdl-config.in b/alienblaster/project/jni/sdl/sdl-config.in
deleted file mode 100644
index e0fcc0ced..000000000
--- a/alienblaster/project/jni/sdl/sdl-config.in
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec_prefix_set=no
-libdir=@libdir@
-
-@ENABLE_STATIC_FALSE@usage="\
-@ENABLE_STATIC_FALSE@Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
-@ENABLE_STATIC_TRUE@usage="\
-@ENABLE_STATIC_TRUE@Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
-
-if test $# -eq 0; then
- echo "${usage}" 1>&2
- exit 1
-fi
-
-while test $# -gt 0; do
- case "$1" in
- -*=*) optarg=`echo "$1" | LC_ALL="C" sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- case $1 in
- --prefix=*)
- prefix=$optarg
- if test $exec_prefix_set = no ; then
- exec_prefix=$optarg
- fi
- ;;
- --prefix)
- echo $prefix
- ;;
- --exec-prefix=*)
- exec_prefix=$optarg
- exec_prefix_set=yes
- ;;
- --exec-prefix)
- echo $exec_prefix
- ;;
- --version)
- echo @SDL_VERSION@
- ;;
- --cflags)
- echo -I@includedir@/SDL @SDL_CFLAGS@
- ;;
-@ENABLE_SHARED_TRUE@ --libs)
-@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
-@ENABLE_SHARED_TRUE@ ;;
-@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
-@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)
-@ENABLE_STATIC_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_STATIC_LIBS@
-@ENABLE_STATIC_TRUE@ ;;
- *)
- echo "${usage}" 1>&2
- exit 1
- ;;
- esac
- shift
-done
diff --git a/alienblaster/project/jni/sdl/sdl.m4 b/alienblaster/project/jni/sdl/sdl.m4
deleted file mode 100644
index 4a10202d4..000000000
--- a/alienblaster/project/jni/sdl/sdl.m4
+++ /dev/null
@@ -1,183 +0,0 @@
-# Configure paths for SDL
-# Sam Lantinga 9/21/99
-# stolen from Manish Singh
-# stolen back from Frank Belew
-# stolen from Manish Singh
-# Shamelessly stolen from Owen Taylor
-
-dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
-dnl
-AC_DEFUN([AM_PATH_SDL],
-[dnl
-dnl Get the cflags and libraries from the sdl-config script
-dnl
-AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
- sdl_prefix="$withval", sdl_prefix="")
-AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
- sdl_exec_prefix="$withval", sdl_exec_prefix="")
-AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
- , enable_sdltest=yes)
-
- if test x$sdl_exec_prefix != x ; then
- sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
- if test x${SDL_CONFIG+set} != xset ; then
- SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
- fi
- fi
- if test x$sdl_prefix != x ; then
- sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
- if test x${SDL_CONFIG+set} != xset ; then
- SDL_CONFIG=$sdl_prefix/bin/sdl-config
- fi
- fi
-
- as_save_PATH="$PATH"
- if test "x$prefix" != xNONE; then
- PATH="$prefix/bin:$prefix/usr/bin:$PATH"
- fi
- AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
- PATH="$as_save_PATH"
- min_sdl_version=ifelse([$1], ,0.11.0,$1)
- AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
- no_sdl=""
- if test "$SDL_CONFIG" = "no" ; then
- no_sdl=yes
- else
- SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
- SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
-
- sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x$enable_sdltest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_CXXFLAGS="$CXXFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $SDL_CFLAGS"
- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
- LIBS="$LIBS $SDL_LIBS"
-dnl
-dnl Now check if the installed SDL is sufficiently new. (Also sanity
-dnl checks the results of sdl-config to some extent
-dnl
- rm -f conf.sdltest
- AC_TRY_RUN([
-#include
-#include
-#include
-#include "SDL.h"
-
-char*
-my_strdup (char *str)
-{
- char *new_str;
-
- if (str)
- {
- new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
- strcpy (new_str, str);
- }
- else
- new_str = NULL;
-
- return new_str;
-}
-
-int main (int argc, char *argv[])
-{
- int major, minor, micro;
- char *tmp_version;
-
- /* This hangs on some systems (?)
- system ("touch conf.sdltest");
- */
- { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = my_strdup("$min_sdl_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
- printf("%s, bad version string\n", "$min_sdl_version");
- exit(1);
- }
-
- if (($sdl_major_version > major) ||
- (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
- (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
- printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
- printf("*** best to upgrade to the required version.\n");
- printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
- printf("*** to point to the correct copy of sdl-config, and remove the file\n");
- printf("*** config.cache before re-running configure\n");
- return 1;
- }
-}
-
-],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- CXXFLAGS="$ac_save_CXXFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_sdl" = x ; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT(no)
- if test "$SDL_CONFIG" = "no" ; then
- echo "*** The sdl-config script installed by SDL could not be found"
- echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the SDL_CONFIG environment variable to the"
- echo "*** full path to sdl-config."
- else
- if test -f conf.sdltest ; then
- :
- else
- echo "*** Could not run SDL test program, checking why..."
- CFLAGS="$CFLAGS $SDL_CFLAGS"
- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
- LIBS="$LIBS $SDL_LIBS"
- AC_TRY_LINK([
-#include
-#include "SDL.h"
-
-int main(int argc, char *argv[])
-{ return 0; }
-#undef main
-#define main K_and_R_C_main
-], [ return 0; ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding SDL or finding the wrong"
- echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means SDL was incorrectly installed"
- echo "*** or that you have moved SDL since it was installed. In the latter case, you"
- echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- CXXFLAGS="$ac_save_CXXFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- SDL_CFLAGS=""
- SDL_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(SDL_CFLAGS)
- AC_SUBST(SDL_LIBS)
- rm -f conf.sdltest
-])
diff --git a/alienblaster/project/jni/sdl/sdl.pc.in b/alienblaster/project/jni/sdl/sdl.pc.in
deleted file mode 100644
index 2d43ac925..000000000
--- a/alienblaster/project/jni/sdl/sdl.pc.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# sdl pkg-config source file
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: sdl
-Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
-Version: @SDL_VERSION@
-Requires:
-Conflicts:
-Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@
-Libs.private: @SDL_STATIC_LIBS@
-Cflags: -I${includedir}/SDL @SDL_CFLAGS@
diff --git a/alienblaster/project/jni/sdl/src/SDL.c b/alienblaster/project/jni/sdl/src/SDL.c
index 6058b3e4e..52f141578 100644
--- a/alienblaster/project/jni/sdl/src/SDL.c
+++ b/alienblaster/project/jni/sdl/src/SDL.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -25,326 +25,336 @@
#include "SDL.h"
#include "SDL_fatal.h"
+#include "SDL_assert.h"
+
#if !SDL_VIDEO_DISABLED
#include "video/SDL_leaks.h"
#endif
-#if SDL_THREAD_PTH
-#include
-#endif
-
/* Initialization/Cleanup routines */
#if !SDL_JOYSTICK_DISABLED
-extern int SDL_JoystickInit(void);
+extern int SDL_JoystickInit(void);
extern void SDL_JoystickQuit(void);
#endif
-#if !SDL_CDROM_DISABLED
-extern int SDL_CDROMInit(void);
-extern void SDL_CDROMQuit(void);
+#if !SDL_HAPTIC_DISABLED
+extern int SDL_HapticInit(void);
+extern int SDL_HapticQuit(void);
#endif
#if !SDL_TIMERS_DISABLED
extern void SDL_StartTicks(void);
-extern int SDL_TimerInit(void);
+extern int SDL_TimerInit(void);
extern void SDL_TimerQuit(void);
#endif
+#if defined(__WIN32__)
+extern int SDL_HelperWindowCreate(void);
+extern int SDL_HelperWindowDestroy(void);
+#endif
-/* The current SDL version */
-static SDL_version version =
- { SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL };
+extern int SDL_AssertionsInit(void);
+extern void SDL_AssertionsQuit(void);
/* The initialized subsystems */
static Uint32 SDL_initialized = 0;
-#if !SDL_TIMERS_DISABLED
static Uint32 ticks_started = 0;
-#endif
#ifdef CHECK_LEAKS
int surfaces_allocated = 0;
#endif
-int SDL_InitSubSystem(Uint32 flags)
+int
+SDL_InitSubSystem(Uint32 flags)
{
#if !SDL_VIDEO_DISABLED
- /* Initialize the video/event subsystem */
- if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) {
- if ( SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"),
- (flags&SDL_INIT_EVENTTHREAD)) < 0 ) {
- return(-1);
- }
- SDL_initialized |= SDL_INIT_VIDEO;
- }
+ /* Initialize the video/event subsystem */
+ if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) {
+ if (SDL_VideoInit(NULL, (flags & SDL_INIT_EVENTTHREAD)) < 0) {
+ return (-1);
+ }
+ SDL_initialized |= SDL_INIT_VIDEO;
+ }
#else
- if ( flags & SDL_INIT_VIDEO ) {
- SDL_SetError("SDL not built with video support");
- return(-1);
- }
+ if (flags & SDL_INIT_VIDEO) {
+ SDL_SetError("SDL not built with video support");
+ return (-1);
+ }
#endif
#if !SDL_AUDIO_DISABLED
- /* Initialize the audio subsystem */
- if ( (flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO) ) {
- if ( SDL_AudioInit(SDL_getenv("SDL_AUDIODRIVER")) < 0 ) {
- return(-1);
- }
- SDL_initialized |= SDL_INIT_AUDIO;
- }
+ /* Initialize the audio subsystem */
+ if ((flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO)) {
+ if (SDL_AudioInit(NULL) < 0) {
+ return (-1);
+ }
+ SDL_initialized |= SDL_INIT_AUDIO;
+ }
#else
- if ( flags & SDL_INIT_AUDIO ) {
- SDL_SetError("SDL not built with audio support");
- return(-1);
- }
+ if (flags & SDL_INIT_AUDIO) {
+ SDL_SetError("SDL not built with audio support");
+ return (-1);
+ }
#endif
#if !SDL_TIMERS_DISABLED
- /* Initialize the timer subsystem */
- if ( ! ticks_started ) {
- SDL_StartTicks();
- ticks_started = 1;
- }
- if ( (flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER) ) {
- if ( SDL_TimerInit() < 0 ) {
- return(-1);
- }
- SDL_initialized |= SDL_INIT_TIMER;
- }
+ /* Initialize the timer subsystem */
+ if (!ticks_started) {
+ SDL_StartTicks();
+ ticks_started = 1;
+ }
+ if ((flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER)) {
+ if (SDL_TimerInit() < 0) {
+ return (-1);
+ }
+ SDL_initialized |= SDL_INIT_TIMER;
+ }
#else
- if ( flags & SDL_INIT_TIMER ) {
- SDL_SetError("SDL not built with timer support");
- return(-1);
- }
+ if (flags & SDL_INIT_TIMER) {
+ SDL_SetError("SDL not built with timer support");
+ return (-1);
+ }
#endif
#if !SDL_JOYSTICK_DISABLED
- /* Initialize the joystick subsystem */
- if ( (flags & SDL_INIT_JOYSTICK) &&
- !(SDL_initialized & SDL_INIT_JOYSTICK) ) {
- if ( SDL_JoystickInit() < 0 ) {
- return(-1);
- }
- SDL_initialized |= SDL_INIT_JOYSTICK;
- }
+ /* Initialize the joystick subsystem */
+ if ((flags & SDL_INIT_JOYSTICK) && !(SDL_initialized & SDL_INIT_JOYSTICK)) {
+ if (SDL_JoystickInit() < 0) {
+ return (-1);
+ }
+ SDL_initialized |= SDL_INIT_JOYSTICK;
+ }
#else
- if ( flags & SDL_INIT_JOYSTICK ) {
- SDL_SetError("SDL not built with joystick support");
- return(-1);
- }
+ if (flags & SDL_INIT_JOYSTICK) {
+ SDL_SetError("SDL not built with joystick support");
+ return (-1);
+ }
#endif
-#if !SDL_CDROM_DISABLED
- /* Initialize the CD-ROM subsystem */
- if ( (flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM) ) {
- if ( SDL_CDROMInit() < 0 ) {
- return(-1);
- }
- SDL_initialized |= SDL_INIT_CDROM;
- }
+#if !SDL_HAPTIC_DISABLED
+ /* Initialize the haptic subsystem */
+ if ((flags & SDL_INIT_HAPTIC) && !(SDL_initialized & SDL_INIT_HAPTIC)) {
+ if (SDL_HapticInit() < 0) {
+ return (-1);
+ }
+ SDL_initialized |= SDL_INIT_HAPTIC;
+ }
#else
- if ( flags & SDL_INIT_CDROM ) {
- SDL_SetError("SDL not built with cdrom support");
- return(-1);
- }
+ if (flags & SDL_INIT_HAPTIC) {
+ SDL_SetError("SDL not built with haptic (force feedback) support");
+ return (-1);
+ }
#endif
- return(0);
+ return (0);
}
-int SDL_Init(Uint32 flags)
+int
+SDL_Init(Uint32 flags)
{
-#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
- if (!pth_init()) {
- return -1;
- }
+ if (SDL_AssertionsInit() < 0) {
+ return -1;
+ }
+
+ /* Clear the error message */
+ SDL_ClearError();
+
+#if defined(__WIN32__)
+ if (SDL_HelperWindowCreate() < 0) {
+ return -1;
+ }
#endif
- /* Clear the error message */
- SDL_ClearError();
+ /* Initialize the desired subsystems */
+ if (SDL_InitSubSystem(flags) < 0) {
+ return (-1);
+ }
- /* Initialize the desired subsystems */
- if ( SDL_InitSubSystem(flags) < 0 ) {
- return(-1);
- }
+ /* Everything is initialized */
+ if (!(flags & SDL_INIT_NOPARACHUTE)) {
+ SDL_InstallParachute();
+ }
- /* Everything is initialized */
- if ( !(flags & SDL_INIT_NOPARACHUTE) ) {
- SDL_InstallParachute();
- }
- return(0);
+ return (0);
}
-void SDL_QuitSubSystem(Uint32 flags)
+void
+SDL_QuitSubSystem(Uint32 flags)
{
- /* Shut down requested initialized subsystems */
-#if !SDL_CDROM_DISABLED
- if ( (flags & SDL_initialized & SDL_INIT_CDROM) ) {
- SDL_CDROMQuit();
- SDL_initialized &= ~SDL_INIT_CDROM;
- }
-#endif
+ /* Shut down requested initialized subsystems */
#if !SDL_JOYSTICK_DISABLED
- if ( (flags & SDL_initialized & SDL_INIT_JOYSTICK) ) {
- SDL_JoystickQuit();
- SDL_initialized &= ~SDL_INIT_JOYSTICK;
- }
+ if ((flags & SDL_initialized & SDL_INIT_JOYSTICK)) {
+ SDL_JoystickQuit();
+ SDL_initialized &= ~SDL_INIT_JOYSTICK;
+ }
+#endif
+#if !SDL_HAPTIC_DISABLED
+ if ((flags & SDL_initialized & SDL_INIT_HAPTIC)) {
+ SDL_HapticQuit();
+ SDL_initialized &= ~SDL_INIT_HAPTIC;
+ }
#endif
#if !SDL_TIMERS_DISABLED
- if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) {
- SDL_TimerQuit();
- SDL_initialized &= ~SDL_INIT_TIMER;
- }
+ if ((flags & SDL_initialized & SDL_INIT_TIMER)) {
+ SDL_TimerQuit();
+ SDL_initialized &= ~SDL_INIT_TIMER;
+ }
#endif
#if !SDL_AUDIO_DISABLED
- if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) {
- SDL_AudioQuit();
- SDL_initialized &= ~SDL_INIT_AUDIO;
- }
+ if ((flags & SDL_initialized & SDL_INIT_AUDIO)) {
+ SDL_AudioQuit();
+ SDL_initialized &= ~SDL_INIT_AUDIO;
+ }
#endif
#if !SDL_VIDEO_DISABLED
- if ( (flags & SDL_initialized & SDL_INIT_VIDEO) ) {
- SDL_VideoQuit();
- SDL_initialized &= ~SDL_INIT_VIDEO;
- }
+ if ((flags & SDL_initialized & SDL_INIT_VIDEO)) {
+ SDL_VideoQuit();
+ SDL_initialized &= ~SDL_INIT_VIDEO;
+ }
#endif
}
-Uint32 SDL_WasInit(Uint32 flags)
+Uint32
+SDL_WasInit(Uint32 flags)
{
- if ( ! flags ) {
- flags = SDL_INIT_EVERYTHING;
- }
- return (SDL_initialized&flags);
+ if (!flags) {
+ flags = SDL_INIT_EVERYTHING;
+ }
+ return (SDL_initialized & flags);
}
-void SDL_Quit(void)
+void
+SDL_Quit(void)
{
- /* Quit all subsystems */
+ /* Quit all subsystems */
#ifdef DEBUG_BUILD
- printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n"); fflush(stdout);
+ printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n");
+ fflush(stdout);
#endif
- SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
+
+#if defined(__WIN32__)
+ SDL_HelperWindowDestroy();
+#endif
+ SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
#ifdef CHECK_LEAKS
#ifdef DEBUG_BUILD
- printf("[SDL_Quit] : CHECK_LEAKS\n"); fflush(stdout);
+ printf("[SDL_Quit] : CHECK_LEAKS\n");
+ fflush(stdout);
#endif
- /* Print the number of surfaces not freed */
- if ( surfaces_allocated != 0 ) {
- fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
- surfaces_allocated);
- }
-#endif
-#ifdef DEBUG_BUILD
- printf("[SDL_Quit] : SDL_UninstallParachute()\n"); fflush(stdout);
-#endif
-
- /* Uninstall any parachute signal handlers */
- SDL_UninstallParachute();
-
-#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
- pth_kill();
-#endif
-#ifdef DEBUG_BUILD
- printf("[SDL_Quit] : Returning!\n"); fflush(stdout);
-#endif
-
-}
-
-/* Return the library version number */
-const SDL_version * SDL_Linked_Version(void)
-{
- return(&version);
-}
-
-#if defined(__OS2__)
-/* Building for OS/2 */
-#ifdef __WATCOMC__
-
-#define INCL_DOSERRORS
-#define INCL_DOSEXCEPTIONS
-#include
-
-/* Exception handler to prevent the Audio thread hanging, making a zombie process! */
-ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec,
- PEXCEPTIONREGISTRATIONRECORD pERegRec,
- PCONTEXTRECORD pCtxRec,
- PVOID p)
-{
- if (pERepRec->fHandlerFlags & EH_EXIT_UNWIND)
- return XCPT_CONTINUE_SEARCH;
- if (pERepRec->fHandlerFlags & EH_UNWINDING)
- return XCPT_CONTINUE_SEARCH;
- if (pERepRec->fHandlerFlags & EH_NESTED_CALL)
- return XCPT_CONTINUE_SEARCH;
-
- /* Do cleanup at every fatal exception! */
- if (((pERepRec->ExceptionNum & XCPT_SEVERITY_CODE) == XCPT_FATAL_EXCEPTION) &&
- (pERepRec->ExceptionNum != XCPT_BREAKPOINT) &&
- (pERepRec->ExceptionNum != XCPT_SINGLE_STEP)
- )
- {
- if (SDL_initialized & SDL_INIT_AUDIO)
- {
- /* This removes the zombie audio thread in case of emergency. */
-#ifdef DEBUG_BUILD
- printf("[SDL_Main_ExceptionHandler] : Calling SDL_CloseAudio()!\n");
-#endif
- SDL_CloseAudio();
+ /* !!! FIXME: make this an assertion. */
+ /* Print the number of surfaces not freed */
+ if (surfaces_allocated != 0) {
+ fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
+ surfaces_allocated);
}
- }
- return (XCPT_CONTINUE_SEARCH);
+#endif
+#ifdef DEBUG_BUILD
+ printf("[SDL_Quit] : SDL_UninstallParachute()\n");
+ fflush(stdout);
+#endif
+
+ /* Uninstall any parachute signal handlers */
+ SDL_UninstallParachute();
+
+ SDL_AssertionsQuit();
+
+#ifdef DEBUG_BUILD
+ printf("[SDL_Quit] : Returning!\n");
+ fflush(stdout);
+#endif
+
}
-
-EXCEPTIONREGISTRATIONRECORD SDL_Main_xcpthand = {0, SDL_Main_ExceptionHandler};
-
-/* The main DLL entry for DLL Initialization and Uninitialization: */
-unsigned _System LibMain(unsigned hmod, unsigned termination)
+/* Get the library version number */
+void
+SDL_GetVersion(SDL_version * ver)
{
- if (termination)
- {
-#ifdef DEBUG_BUILD
-/* printf("[SDL DLL Unintialization] : Removing exception handler\n"); */
-#endif
- DosUnsetExceptionHandler(&SDL_Main_xcpthand);
- return 1;
- } else
- {
-#ifdef DEBUG_BUILD
- /* Make stdout and stderr unbuffered! */
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
-#endif
- /* Fire up exception handler */
-#ifdef DEBUG_BUILD
-/* printf("[SDL DLL Initialization] : Setting exception handler\n"); */
-#endif
- /* Set exception handler */
- DosSetExceptionHandler(&SDL_Main_xcpthand);
-
- return 1;
- }
+ SDL_VERSION(ver);
}
-#endif /* __WATCOMC__ */
-#elif defined(__WIN32__) && !defined(__SYMBIAN32__)
+/* Get the library source revision */
+const char *
+SDL_GetRevision(void)
+{
+ return SDL_REVISION;
+}
+
+/* Get the name of the platform */
+const char *
+SDL_GetPlatform()
+{
+#if __AIX__
+ return "AIX";
+#elif __HAIKU__
+/* Haiku must appear here before BeOS, since it also defines __BEOS__ */
+ return "Haiku";
+#elif __BEOS__
+ return "BeOS";
+#elif __BSDI__
+ return "BSDI";
+#elif __DREAMCAST__
+ return "Dreamcast";
+#elif __FREEBSD__
+ return "FreeBSD";
+#elif __HPUX__
+ return "HP-UX";
+#elif __IRIX__
+ return "Irix";
+#elif __LINUX__
+ return "Linux";
+#elif __MINT__
+ return "Atari MiNT";
+#elif __MACOS__
+ return "MacOS Classic";
+#elif __MACOSX__
+ return "Mac OS X";
+#elif __NETBSD__
+ return "NetBSD";
+#elif __OPENBSD__
+ return "OpenBSD";
+#elif __OS2__
+ return "OS/2";
+#elif __OSF__
+ return "OSF/1";
+#elif __QNXNTO__
+ return "QNX Neutrino";
+#elif __RISCOS__
+ return "RISC OS";
+#elif __SOLARIS__
+ return "Solaris";
+#elif __WIN32__
+#ifdef _WIN32_WCE
+ return "Windows CE";
+#else
+ return "Windows";
+#endif
+#elif __IPHONEOS__
+ return "iPhone OS";
+#else
+ return "Unknown (see SDL_platform.h)";
+#endif
+}
+
+#if defined(__WIN32__)
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
/* Need to include DllMain() on Watcom C for some reason.. */
#define WIN32_LEAN_AND_MEAN
#include
-BOOL APIENTRY _DllMainCRTStartup( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved )
+BOOL APIENTRY
+_DllMainCRTStartup(HANDLE hModule,
+ DWORD ul_reason_for_call, LPVOID lpReserved)
{
- switch (ul_reason_for_call) {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
+ switch (ul_reason_for_call) {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
}
#endif /* building DLL with Watcom C */
-#endif /* OS/2 elif __WIN32__ */
+#endif /* __WIN32__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/SDL_assert.c b/alienblaster/project/jni/sdl/src/SDL_assert.c
new file mode 100644
index 000000000..34cf45868
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/SDL_assert.c
@@ -0,0 +1,475 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+#include "SDL.h"
+#include "SDL_assert.h"
+#include "video/SDL_sysvideo.h"
+
+#ifdef _WINDOWS
+#define WIN32_LEAN_AND_MEAN 1
+#include
+#else /* fprintf, _exit(), etc. */
+#include
+#include
+#include
+#endif
+
+static SDL_assert_state
+SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
+
+/*
+ * We keep all triggered assertions in a singly-linked list so we can
+ * generate a report later.
+ */
+static SDL_assert_data assertion_list_terminator = { 0, 0, 0, 0, 0, 0, 0 };
+static SDL_assert_data *triggered_assertions = &assertion_list_terminator;
+
+static SDL_mutex *assertion_mutex = NULL;
+static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion;
+static void *assertion_userdata = NULL;
+
+#ifdef __GNUC__
+static void
+debug_print(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+#endif
+
+static void
+debug_print(const char *fmt, ...)
+{
+#ifdef _WINDOWS
+ /* Format into a buffer for OutputDebugStringA(). */
+ char buf[1024];
+ char *startptr;
+ char *ptr;
+ int len;
+ va_list ap;
+ va_start(ap, fmt);
+ len = (int) SDL_vsnprintf(buf, sizeof (buf), fmt, ap);
+ va_end(ap);
+
+ /* Visual C's vsnprintf() may not null-terminate the buffer. */
+ if ((len >= sizeof (buf)) || (len < 0)) {
+ buf[sizeof (buf) - 1] = '\0';
+ }
+
+ /* Write it, sorting out the Unix newlines... */
+ startptr = buf;
+ for (ptr = startptr; *ptr; ptr++) {
+ if (*ptr == '\n') {
+ *ptr = '\0';
+ OutputDebugStringA(startptr);
+ OutputDebugStringA("\r\n");
+ startptr = ptr+1;
+ }
+ }
+
+ /* catch that last piece if it didn't have a newline... */
+ if (startptr != ptr) {
+ OutputDebugStringA(startptr);
+ }
+#else
+ /* Unix has it easy. Just dump it to stderr. */
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fflush(stderr);
+#endif
+}
+
+
+#ifdef _WINDOWS
+static SDL_assert_state SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT;
+static const SDL_assert_data *SDL_Windows_AssertData = NULL;
+
+static LRESULT CALLBACK
+SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_CREATE:
+ {
+ /* !!! FIXME: all this code stinks. */
+ const SDL_assert_data *data = SDL_Windows_AssertData;
+ char buf[1024];
+ const int w = 100;
+ const int h = 25;
+ const int gap = 10;
+ int x = gap;
+ int y = 50;
+ int len;
+ int i;
+ static const struct {
+ const char *name;
+ SDL_assert_state state;
+ } buttons[] = {
+ {"Abort", SDL_ASSERTION_ABORT },
+ {"Break", SDL_ASSERTION_BREAK },
+ {"Retry", SDL_ASSERTION_RETRY },
+ {"Ignore", SDL_ASSERTION_IGNORE },
+ {"Always Ignore", SDL_ASSERTION_ALWAYS_IGNORE },
+ };
+
+ len = (int) SDL_snprintf(buf, sizeof (buf),
+ "Assertion failure at %s (%s:%d), triggered %u time%s:\r\n '%s'",
+ data->function, data->filename, data->linenum,
+ data->trigger_count, (data->trigger_count == 1) ? "" : "s",
+ data->condition);
+ if ((len < 0) || (len >= sizeof (buf))) {
+ buf[sizeof (buf) - 1] = '\0';
+ }
+
+ CreateWindowA("STATIC", buf,
+ WS_VISIBLE | WS_CHILD | SS_LEFT,
+ x, y, 550, 100,
+ hwnd, (HMENU) 1, NULL, NULL);
+ y += 110;
+
+ for (i = 0; i < (sizeof (buttons) / sizeof (buttons[0])); i++) {
+ CreateWindowA("BUTTON", buttons[i].name,
+ WS_VISIBLE | WS_CHILD,
+ x, y, w, h,
+ hwnd, (HMENU) buttons[i].state, NULL, NULL);
+ x += w + gap;
+ }
+ break;
+ }
+
+ case WM_COMMAND:
+ SDL_Windows_AssertChoice = ((SDL_assert_state) (LOWORD(wParam)));
+ SDL_Windows_AssertData = NULL;
+ break;
+
+ case WM_DESTROY:
+ SDL_Windows_AssertData = NULL;
+ break;
+ }
+
+ return DefWindowProc(hwnd, msg, wParam, lParam);
+}
+
+static SDL_assert_state
+SDL_PromptAssertion_windows(const SDL_assert_data *data)
+{
+ HINSTANCE hInstance = 0; /* !!! FIXME? */
+ HWND hwnd;
+ MSG msg;
+ WNDCLASS wc = {0};
+
+ SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT;
+ SDL_Windows_AssertData = data;
+
+ wc.lpszClassName = TEXT("SDL_assert");
+ wc.hInstance = hInstance ;
+ wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
+ wc.lpfnWndProc = SDL_Assertion_WndProc;
+ wc.hCursor = LoadCursor(0, IDC_ARROW);
+
+ RegisterClass(&wc);
+ hwnd = CreateWindow(wc.lpszClassName, TEXT("SDL assertion failure"),
+ WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 150, 150, 570, 260, 0, 0, hInstance, 0);
+
+ while (GetMessage(&msg, NULL, 0, 0) && (SDL_Windows_AssertData != NULL)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ DestroyWindow(hwnd);
+ UnregisterClass(wc.lpszClassName, hInstance);
+ return SDL_Windows_AssertChoice;
+}
+#endif
+
+
+static void SDL_AddAssertionToReport(SDL_assert_data *data)
+{
+ /* (data) is always a static struct defined with the assert macros, so
+ we don't have to worry about copying or allocating them. */
+ if (data->next == NULL) { /* not yet added? */
+ data->next = triggered_assertions;
+ triggered_assertions = data;
+ }
+}
+
+
+static void SDL_GenerateAssertionReport(void)
+{
+ const SDL_assert_data *item;
+
+ /* only do this if the app hasn't assigned an assertion handler. */
+ if (assertion_handler != SDL_PromptAssertion)
+ return;
+
+ item = SDL_GetAssertionReport();
+ if (item->condition)
+ {
+ debug_print("\n\nSDL assertion report.\n");
+ debug_print("All SDL assertions between last init/quit:\n\n");
+
+ while (item->condition) {
+ debug_print(
+ "'%s'\n"
+ " * %s (%s:%d)\n"
+ " * triggered %u time%s.\n"
+ " * always ignore: %s.\n",
+ item->condition, item->function, item->filename,
+ item->linenum, item->trigger_count,
+ (item->trigger_count == 1) ? "" : "s",
+ item->always_ignore ? "yes" : "no");
+ item = item->next;
+ }
+ debug_print("\n");
+
+ SDL_ResetAssertionReport();
+ }
+}
+
+static void SDL_ExitProcess(int exitcode)
+{
+#ifdef _WINDOWS
+ ExitProcess(42);
+#else
+ _exit(42);
+#endif
+}
+
+static void SDL_AbortAssertion(void)
+{
+ SDL_Quit();
+ SDL_ExitProcess(42);
+}
+
+
+static SDL_assert_state
+SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
+{
+ const char *envr;
+ SDL_assert_state state = SDL_ASSERTION_ABORT;
+ SDL_Window *window;
+
+ (void) userdata; /* unused in default handler. */
+
+ debug_print("\n\n"
+ "Assertion failure at %s (%s:%d), triggered %u time%s:\n"
+ " '%s'\n"
+ "\n",
+ data->function, data->filename, data->linenum,
+ data->trigger_count, (data->trigger_count == 1) ? "" : "s",
+ data->condition);
+
+ /* let env. variable override, so unit tests won't block in a GUI. */
+ envr = SDL_getenv("SDL_ASSERT");
+ if (envr != NULL) {
+ if (SDL_strcmp(envr, "abort") == 0) {
+ return SDL_ASSERTION_ABORT;
+ } else if (SDL_strcmp(envr, "break") == 0) {
+ return SDL_ASSERTION_BREAK;
+ } else if (SDL_strcmp(envr, "retry") == 0) {
+ return SDL_ASSERTION_RETRY;
+ } else if (SDL_strcmp(envr, "ignore") == 0) {
+ return SDL_ASSERTION_IGNORE;
+ } else if (SDL_strcmp(envr, "always_ignore") == 0) {
+ return SDL_ASSERTION_ALWAYS_IGNORE;
+ } else {
+ return SDL_ASSERTION_ABORT; /* oh well. */
+ }
+ }
+
+ /* Leave fullscreen mode, if possible (scary!) */
+ window = SDL_GetFocusWindow();
+ if (window) {
+ if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) {
+ SDL_MinimizeWindow(window);
+ } else {
+ /* !!! FIXME: ungrab the input if we're not fullscreen? */
+ /* No need to mess with the window */
+ window = 0;
+ }
+ }
+
+ /* platform-specific UI... */
+
+#ifdef _WINDOWS
+ state = SDL_PromptAssertion_windows(data);
+
+#elif __MACOSX__
+ /* This has to be done in an Objective-C (*.m) file, so we call out. */
+ extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *);
+ state = SDL_PromptAssertion_cocoa(data);
+
+#else
+ /* this is a little hacky. */
+ for ( ; ; ) {
+ char buf[32];
+ fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : ");
+ fflush(stderr);
+ if (fgets(buf, sizeof (buf), stdin) == NULL) {
+ break;
+ }
+
+ if (SDL_strcmp(buf, "a") == 0) {
+ state = SDL_ASSERTION_ABORT;
+ break;
+ } else if (SDL_strcmp(envr, "b") == 0) {
+ state = SDL_ASSERTION_BREAK;
+ break;
+ } else if (SDL_strcmp(envr, "r") == 0) {
+ state = SDL_ASSERTION_RETRY;
+ break;
+ } else if (SDL_strcmp(envr, "i") == 0) {
+ state = SDL_ASSERTION_IGNORE;
+ break;
+ } else if (SDL_strcmp(envr, "A") == 0) {
+ state = SDL_ASSERTION_ALWAYS_IGNORE;
+ break;
+ }
+ }
+#endif
+
+ /* Re-enter fullscreen mode */
+ if (window) {
+ SDL_RestoreWindow(window);
+ }
+
+ return state;
+}
+
+
+SDL_assert_state
+SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
+ int line)
+{
+ static int assertion_running = 0;
+ static SDL_SpinLock spinlock = 0;
+ SDL_assert_state state = SDL_ASSERTION_IGNORE;
+
+ SDL_AtomicLock(&spinlock);
+ if (assertion_mutex == NULL) { /* never called SDL_Init()? */
+ assertion_mutex = SDL_CreateMutex();
+ if (assertion_mutex == NULL) {
+ SDL_AtomicUnlock(&spinlock);
+ return SDL_ASSERTION_IGNORE; /* oh well, I guess. */
+ }
+ }
+ SDL_AtomicUnlock(&spinlock);
+
+ if (SDL_LockMutex(assertion_mutex) < 0) {
+ return SDL_ASSERTION_IGNORE; /* oh well, I guess. */
+ }
+
+ /* doing this because Visual C is upset over assigning in the macro. */
+ if (data->trigger_count == 0) {
+ data->function = func;
+ data->filename = file;
+ data->linenum = line;
+ }
+
+ SDL_AddAssertionToReport(data);
+
+ data->trigger_count++;
+
+ assertion_running++;
+ if (assertion_running > 1) { /* assert during assert! Abort. */
+ if (assertion_running == 2) {
+ SDL_AbortAssertion();
+ } else if (assertion_running == 3) { /* Abort asserted! */
+ SDL_ExitProcess(42);
+ } else {
+ while (1) { /* do nothing but spin; what else can you do?! */ }
+ }
+ }
+
+ if (!data->always_ignore) {
+ state = assertion_handler(data, assertion_userdata);
+ }
+
+ switch (state)
+ {
+ case SDL_ASSERTION_ABORT:
+ SDL_AbortAssertion();
+ return SDL_ASSERTION_IGNORE; /* shouldn't return, but oh well. */
+
+ case SDL_ASSERTION_ALWAYS_IGNORE:
+ state = SDL_ASSERTION_IGNORE;
+ data->always_ignore = 1;
+ break;
+
+ case SDL_ASSERTION_IGNORE:
+ case SDL_ASSERTION_RETRY:
+ case SDL_ASSERTION_BREAK:
+ break; /* macro handles these. */
+ }
+
+ assertion_running--;
+ SDL_UnlockMutex(assertion_mutex);
+
+ return state;
+}
+
+
+int SDL_AssertionsInit(void)
+{
+ /* this is a no-op at the moment. */
+ return 0;
+}
+
+void SDL_AssertionsQuit(void)
+{
+ SDL_GenerateAssertionReport();
+ if (assertion_mutex != NULL) {
+ SDL_DestroyMutex(assertion_mutex);
+ assertion_mutex = NULL;
+ }
+}
+
+void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)
+{
+ if (handler != NULL) {
+ assertion_handler = handler;
+ assertion_userdata = userdata;
+ } else {
+ assertion_handler = SDL_PromptAssertion;
+ assertion_userdata = NULL;
+ }
+}
+
+const SDL_assert_data *SDL_GetAssertionReport(void)
+{
+ return triggered_assertions;
+}
+
+void SDL_ResetAssertionReport(void)
+{
+ SDL_assert_data *item = triggered_assertions;
+ SDL_assert_data *next = NULL;
+ for (item = triggered_assertions; item->condition; item = next) {
+ next = (SDL_assert_data *) item->next;
+ item->always_ignore = SDL_FALSE;
+ item->trigger_count = 0;
+ item->next = NULL;
+ }
+
+ triggered_assertions = &assertion_list_terminator;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/SDL_compat.c b/alienblaster/project/jni/sdl/src/SDL_compat.c
new file mode 100644
index 000000000..0c094e8a7
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/SDL_compat.c
@@ -0,0 +1,1775 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+/* This file contains functions for backwards compatibility with SDL 1.2 */
+
+#include "SDL.h"
+#include "SDL_syswm.h"
+
+#include "video/SDL_sysvideo.h"
+#include "video/SDL_pixels_c.h"
+#include "video/SDL_yuv_sw_c.h"
+
+static SDL_Window *SDL_VideoWindow = NULL;
+static SDL_RendererInfo SDL_VideoRendererInfo;
+static SDL_Texture *SDL_VideoTexture = NULL;
+static SDL_Surface *SDL_VideoSurface = NULL;
+static SDL_Surface *SDL_ShadowSurface = NULL;
+static SDL_Surface *SDL_PublicSurface = NULL;
+static SDL_GLContext *SDL_VideoContext = NULL;
+static Uint32 SDL_VideoFlags = 0;
+static char *wm_title = NULL;
+static SDL_Surface *SDL_VideoIcon;
+static int SDL_enabled_UNICODE = 0;
+
+char *
+SDL_AudioDriverName(char *namebuf, int maxlen)
+{
+ const char *name = SDL_GetCurrentAudioDriver();
+ if (name) {
+ SDL_strlcpy(namebuf, name, maxlen);
+ return namebuf;
+ }
+ return NULL;
+}
+
+char *
+SDL_VideoDriverName(char *namebuf, int maxlen)
+{
+ const char *name = SDL_GetCurrentVideoDriver();
+ if (name) {
+ SDL_strlcpy(namebuf, name, maxlen);
+ return namebuf;
+ }
+ return NULL;
+}
+
+static void
+SelectVideoDisplay()
+{
+ const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
+ if ( !variable ) {
+ variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
+ }
+ if ( variable ) {
+ SDL_SelectVideoDisplay(SDL_atoi(variable));
+ }
+}
+
+const SDL_VideoInfo *
+SDL_GetVideoInfo(void)
+{
+ static SDL_VideoInfo info;
+ SDL_DisplayMode mode;
+
+ SelectVideoDisplay();
+
+ /* Memory leak, compatibility code, who cares? */
+ if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) {
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+
+ SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask,
+ &Amask);
+ info.vfmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
+ info.current_w = mode.w;
+ info.current_h = mode.h;
+ }
+ return &info;
+}
+
+int
+SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
+{
+ int i, actual_bpp = 0;
+
+ if (!SDL_GetVideoDevice()) {
+ return 0;
+ }
+
+ SelectVideoDisplay();
+
+ if (!(flags & SDL_FULLSCREEN)) {
+ SDL_DisplayMode mode;
+ SDL_GetDesktopDisplayMode(&mode);
+ return SDL_BITSPERPIXEL(mode.format);
+ }
+
+ for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
+ SDL_DisplayMode mode;
+ SDL_GetDisplayMode(i, &mode);
+ if (!mode.w || !mode.h || (width == mode.w && height == mode.h)) {
+ if (!mode.format) {
+ return bpp;
+ }
+ if (SDL_BITSPERPIXEL(mode.format) >= (Uint32) bpp) {
+ actual_bpp = SDL_BITSPERPIXEL(mode.format);
+ }
+ }
+ }
+ return actual_bpp;
+}
+
+SDL_Rect **
+SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
+{
+ int i, nmodes;
+ SDL_Rect **modes;
+
+ if (!SDL_GetVideoDevice()) {
+ return NULL;
+ }
+
+ SelectVideoDisplay();
+
+ if (!(flags & SDL_FULLSCREEN)) {
+ return (SDL_Rect **) (-1);
+ }
+
+ if (!format) {
+ format = SDL_GetVideoInfo()->vfmt;
+ }
+
+ /* Memory leak, but this is a compatibility function, who cares? */
+ nmodes = 0;
+ modes = NULL;
+ for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
+ SDL_DisplayMode mode;
+ SDL_GetDisplayMode(i, &mode);
+ if (!mode.w || !mode.h) {
+ return (SDL_Rect **) (-1);
+ }
+ if (SDL_BITSPERPIXEL(mode.format) != format->BitsPerPixel) {
+ continue;
+ }
+ if (nmodes > 0 && modes[nmodes - 1]->w == mode.w
+ && modes[nmodes - 1]->h == mode.h) {
+ continue;
+ }
+
+ modes = SDL_realloc(modes, (nmodes + 2) * sizeof(*modes));
+ if (!modes) {
+ return NULL;
+ }
+ modes[nmodes] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
+ if (!modes[nmodes]) {
+ return NULL;
+ }
+ modes[nmodes]->x = 0;
+ modes[nmodes]->y = 0;
+ modes[nmodes]->w = mode.w;
+ modes[nmodes]->h = mode.h;
+ ++nmodes;
+ }
+ if (modes) {
+ modes[nmodes] = NULL;
+ }
+ return modes;
+}
+
+static int
+SDL_CompatEventFilter(void *userdata, SDL_Event * event)
+{
+ SDL_Event fake;
+
+ switch (event->type) {
+ case SDL_WINDOWEVENT:
+ switch (event->window.event) {
+ case SDL_WINDOWEVENT_EXPOSED:
+ if (!SDL_HasEvent(SDL_VIDEOEXPOSE)) {
+ fake.type = SDL_VIDEOEXPOSE;
+ SDL_PushEvent(&fake);
+ }
+ break;
+ case SDL_WINDOWEVENT_RESIZED:
+ SDL_FlushEvent(SDL_VIDEORESIZE);
+ fake.type = SDL_VIDEORESIZE;
+ fake.resize.w = event->window.data1;
+ fake.resize.h = event->window.data2;
+ SDL_PushEvent(&fake);
+ break;
+ case SDL_WINDOWEVENT_MINIMIZED:
+ fake.type = SDL_ACTIVEEVENT;
+ fake.active.gain = 0;
+ fake.active.state = SDL_APPACTIVE;
+ SDL_PushEvent(&fake);
+ break;
+ case SDL_WINDOWEVENT_RESTORED:
+ fake.type = SDL_ACTIVEEVENT;
+ fake.active.gain = 1;
+ fake.active.state = SDL_APPACTIVE;
+ SDL_PushEvent(&fake);
+ break;
+ case SDL_WINDOWEVENT_ENTER:
+ fake.type = SDL_ACTIVEEVENT;
+ fake.active.gain = 1;
+ fake.active.state = SDL_APPMOUSEFOCUS;
+ SDL_PushEvent(&fake);
+ break;
+ case SDL_WINDOWEVENT_LEAVE:
+ fake.type = SDL_ACTIVEEVENT;
+ fake.active.gain = 0;
+ fake.active.state = SDL_APPMOUSEFOCUS;
+ SDL_PushEvent(&fake);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_GAINED:
+ fake.type = SDL_ACTIVEEVENT;
+ fake.active.gain = 1;
+ fake.active.state = SDL_APPINPUTFOCUS;
+ SDL_PushEvent(&fake);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_LOST:
+ fake.type = SDL_ACTIVEEVENT;
+ fake.active.gain = 0;
+ fake.active.state = SDL_APPINPUTFOCUS;
+ SDL_PushEvent(&fake);
+ break;
+ case SDL_WINDOWEVENT_CLOSE:
+ fake.type = SDL_QUIT;
+ SDL_PushEvent(&fake);
+ break;
+ }
+ case SDL_KEYDOWN:
+ case SDL_KEYUP:
+ {
+ Uint32 unicode = 0;
+ if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym < 256) {
+ unicode = event->key.keysym.sym;
+ if (unicode >= 'a' && unicode <= 'z') {
+ int shifted = !!(event->key.keysym.mod & KMOD_SHIFT);
+ int capslock = !!(event->key.keysym.mod & KMOD_CAPS);
+ if ((shifted ^ capslock) != 0) {
+ unicode = SDL_toupper(unicode);
+ }
+ }
+ }
+ if (unicode) {
+ event->key.keysym.unicode = unicode;
+ }
+ break;
+ }
+ case SDL_TEXTINPUT:
+ {
+ /* FIXME: Generate an old style key repeat event if needed */
+ //printf("TEXTINPUT: '%s'\n", event->text.text);
+ break;
+ }
+ case SDL_MOUSEWHEEL:
+ {
+ Uint8 button;
+ int x, y;
+
+ if (event->wheel.y == 0) {
+ break;
+ }
+
+ SDL_GetMouseState(&x, &y);
+
+ if (event->wheel.y > 0) {
+ button = SDL_BUTTON_WHEELUP;
+ } else {
+ button = SDL_BUTTON_WHEELDOWN;
+ }
+
+ fake.button.button = button;
+ fake.button.x = x;
+ fake.button.y = y;
+ fake.button.windowID = event->wheel.windowID;
+
+ fake.type = SDL_MOUSEBUTTONDOWN;
+ fake.button.state = SDL_PRESSED;
+ SDL_PushEvent(&fake);
+
+ fake.type = SDL_MOUSEBUTTONUP;
+ fake.button.state = SDL_RELEASED;
+ SDL_PushEvent(&fake);
+ break;
+ }
+
+ }
+ return 1;
+}
+
+static int
+SDL_VideoPaletteChanged(void *userdata, SDL_Palette * palette)
+{
+ if (userdata == SDL_ShadowSurface) {
+ /* If the shadow palette changed, make the changes visible */
+ if (!SDL_VideoSurface->format->palette) {
+ SDL_UpdateRect(SDL_ShadowSurface, 0, 0, 0, 0);
+ }
+ }
+ if (userdata == SDL_VideoSurface) {
+ if (SDL_SetDisplayPalette(palette->colors, 0, palette->ncolors) < 0) {
+ return -1;
+ }
+ if (SDL_SetTexturePalette
+ (SDL_VideoTexture, palette->colors, 0, palette->ncolors) < 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static void
+GetEnvironmentWindowPosition(int w, int h, int *x, int *y)
+{
+ const char *window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
+ const char *center = SDL_getenv("SDL_VIDEO_CENTERED");
+ if (window) {
+ if (SDL_sscanf(window, "%d,%d", x, y) == 2) {
+ return;
+ }
+ if (SDL_strcmp(window, "center") == 0) {
+ center = window;
+ }
+ }
+ if (center) {
+ SDL_DisplayMode mode;
+ SDL_GetDesktopDisplayMode(&mode);
+ *x = (mode.w - w) / 2;
+ *y = (mode.h - h) / 2;
+ }
+}
+
+static SDL_Surface *
+CreateVideoSurface(SDL_Texture * texture)
+{
+ SDL_Surface *surface;
+ Uint32 format;
+ int w, h;
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
+ void *pixels;
+ int pitch;
+
+ if (SDL_QueryTexture(texture, &format, NULL, &w, &h) < 0) {
+ return NULL;
+ }
+
+ if (!SDL_PixelFormatEnumToMasks
+ (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
+ SDL_SetError("Unknown texture format");
+ return NULL;
+ }
+
+ if (SDL_QueryTexturePixels(texture, &pixels, &pitch) == 0) {
+ surface =
+ SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, Gmask,
+ Bmask, Amask);
+ } else {
+ surface =
+ SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
+ }
+ return surface;
+}
+
+static void
+ClearVideoSurface()
+{
+ Uint32 black;
+
+ /* Clear the surface for display */
+ black = SDL_MapRGB(SDL_PublicSurface->format, 0, 0, 0);
+ SDL_FillRect(SDL_PublicSurface, NULL, black);
+ SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0);
+}
+
+static void
+SetupScreenSaver(int flags)
+{
+ const char *env;
+ SDL_bool allow_screensaver;
+
+ /* Allow environment override of screensaver disable */
+ env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER");
+ if (env) {
+ allow_screensaver = SDL_atoi(env) ? SDL_TRUE : SDL_FALSE;
+ } else if (flags & SDL_FULLSCREEN) {
+ allow_screensaver = SDL_FALSE;
+ } else {
+ allow_screensaver = SDL_TRUE;
+ }
+ if (allow_screensaver) {
+ SDL_EnableScreenSaver();
+ } else {
+ SDL_DisableScreenSaver();
+ }
+}
+
+int
+SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
+{
+ int w, h;
+ Uint32 format;
+ int access;
+ void *pixels;
+ int pitch;
+
+ /* We can't resize something we don't have... */
+ if (!SDL_VideoWindow) {
+ return -1;
+ }
+
+ /* We probably have to recreate the window in fullscreen mode */
+ if (flags & SDL_FULLSCREEN) {
+ return -1;
+ }
+
+ /* I don't think there's any change we can gracefully make in flags */
+ if (flags != SDL_VideoFlags) {
+ return -1;
+ }
+
+ /* Resize the window */
+ SDL_GetWindowSize(SDL_VideoWindow, &w, &h);
+ if (w != width || h != height) {
+ SDL_SetWindowSize(SDL_VideoWindow, width, height);
+ }
+
+ /* If we're in OpenGL mode, just resize the stub surface and we're done! */
+ if (flags & SDL_OPENGL) {
+ SDL_VideoSurface->w = width;
+ SDL_VideoSurface->h = height;
+ return 0;
+ }
+
+ /* Destroy the screen texture and recreate it */
+ SDL_QueryTexture(SDL_VideoTexture, &format, &access, &w, &h);
+ SDL_DestroyTexture(SDL_VideoTexture);
+ SDL_VideoTexture = SDL_CreateTexture(format, access, width, height);
+ if (!SDL_VideoTexture) {
+ return -1;
+ }
+
+ SDL_VideoSurface->w = width;
+ SDL_VideoSurface->h = height;
+ if (SDL_QueryTexturePixels(SDL_VideoTexture, &pixels, &pitch) == 0) {
+ SDL_VideoSurface->pixels = pixels;
+ SDL_VideoSurface->pitch = pitch;
+ } else {
+ SDL_CalculatePitch(SDL_VideoSurface);
+ SDL_VideoSurface->pixels =
+ SDL_realloc(SDL_VideoSurface->pixels,
+ SDL_VideoSurface->h * SDL_VideoSurface->pitch);
+ }
+ SDL_SetClipRect(SDL_VideoSurface, NULL);
+ SDL_InvalidateMap(SDL_VideoSurface->map);
+
+ if (SDL_ShadowSurface) {
+ SDL_ShadowSurface->w = width;
+ SDL_ShadowSurface->h = height;
+ SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface);
+ SDL_ShadowSurface->pixels =
+ SDL_realloc(SDL_ShadowSurface->pixels,
+ SDL_ShadowSurface->h * SDL_ShadowSurface->pitch);
+ SDL_SetClipRect(SDL_ShadowSurface, NULL);
+ SDL_InvalidateMap(SDL_ShadowSurface->map);
+ }
+
+ ClearVideoSurface();
+
+ return 0;
+}
+
+SDL_Surface *
+SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
+{
+ SDL_DisplayMode desktop_mode;
+ int window_x = SDL_WINDOWPOS_UNDEFINED;
+ int window_y = SDL_WINDOWPOS_UNDEFINED;
+ Uint32 window_flags;
+ Uint32 desktop_format;
+ Uint32 desired_format;
+ Uint32 surface_flags;
+
+ if (!SDL_GetVideoDevice()) {
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
+ return NULL;
+ }
+ }
+
+ SelectVideoDisplay();
+
+ SDL_GetDesktopDisplayMode(&desktop_mode);
+
+ if (width == 0) {
+ width = desktop_mode.w;
+ }
+ if (height == 0) {
+ height = desktop_mode.h;
+ }
+
+ /* See if we can simply resize the existing window and surface */
+ if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) {
+ return SDL_PublicSurface;
+ }
+
+ /* Destroy existing window */
+ SDL_PublicSurface = NULL;
+ if (SDL_ShadowSurface) {
+ SDL_FreeSurface(SDL_ShadowSurface);
+ SDL_ShadowSurface = NULL;
+ }
+ if (SDL_VideoSurface) {
+ SDL_DelPaletteWatch(SDL_VideoSurface->format->palette,
+ SDL_VideoPaletteChanged, NULL);
+ SDL_FreeSurface(SDL_VideoSurface);
+ SDL_VideoSurface = NULL;
+ }
+ if (SDL_VideoContext) {
+ /* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */
+ SDL_GL_DeleteContext(SDL_VideoContext);
+ SDL_VideoContext = NULL;
+ }
+ if (SDL_VideoWindow) {
+ SDL_GetWindowPosition(SDL_VideoWindow, &window_x, &window_y);
+ SDL_DestroyWindow(SDL_VideoWindow);
+ }
+
+ /* Set up the event filter */
+ if (!SDL_GetEventFilter(NULL, NULL)) {
+ SDL_SetEventFilter(SDL_CompatEventFilter, NULL);
+ }
+
+ /* Create a new window */
+ window_flags = SDL_WINDOW_SHOWN;
+ if (flags & SDL_FULLSCREEN) {
+ window_flags |= SDL_WINDOW_FULLSCREEN;
+ }
+ if (flags & SDL_OPENGL) {
+ window_flags |= SDL_WINDOW_OPENGL;
+ }
+ if (flags & SDL_RESIZABLE) {
+ window_flags |= SDL_WINDOW_RESIZABLE;
+ }
+ if (flags & SDL_NOFRAME) {
+ window_flags |= SDL_WINDOW_BORDERLESS;
+ }
+ GetEnvironmentWindowPosition(width, height, &window_x, &window_y);
+ SDL_VideoWindow =
+ SDL_CreateWindow(wm_title, window_x, window_y, width, height,
+ window_flags);
+ if (!SDL_VideoWindow) {
+ return NULL;
+ }
+ SDL_SetWindowIcon(SDL_VideoWindow, SDL_VideoIcon);
+
+ window_flags = SDL_GetWindowFlags(SDL_VideoWindow);
+ surface_flags = 0;
+ if (window_flags & SDL_WINDOW_FULLSCREEN) {
+ surface_flags |= SDL_FULLSCREEN;
+ }
+ if (window_flags & SDL_WINDOW_OPENGL) {
+ surface_flags |= SDL_OPENGL;
+ }
+ if (window_flags & SDL_WINDOW_RESIZABLE) {
+ surface_flags |= SDL_RESIZABLE;
+ }
+ if (window_flags & SDL_WINDOW_BORDERLESS) {
+ surface_flags |= SDL_NOFRAME;
+ }
+
+ /* Set up the desired display mode */
+ desktop_format = desktop_mode.format;
+ if (desktop_format && ((flags & SDL_ANYFORMAT)
+ || (bpp == SDL_BITSPERPIXEL(desktop_format)))) {
+ desired_format = desktop_format;
+ } else {
+ switch (bpp) {
+ case 0:
+ if (desktop_format) {
+ desired_format = desktop_format;
+ } else {
+ desired_format = SDL_PIXELFORMAT_RGB888;
+ }
+ bpp = SDL_BITSPERPIXEL(desired_format);
+ break;
+ case 8:
+ desired_format = SDL_PIXELFORMAT_INDEX8;
+ break;
+ case 15:
+ desired_format = SDL_PIXELFORMAT_RGB555;
+ break;
+ case 16:
+ desired_format = SDL_PIXELFORMAT_RGB565;
+ break;
+ case 24:
+ desired_format = SDL_PIXELFORMAT_RGB24;
+ break;
+ case 32:
+ desired_format = SDL_PIXELFORMAT_RGB888;
+ break;
+ default:
+ SDL_SetError("Unsupported bpp in SDL_SetVideoMode()");
+ return NULL;
+ }
+ }
+
+ /* Set up the desired display mode */
+ if (flags & SDL_FULLSCREEN) {
+ SDL_DisplayMode mode;
+
+ SDL_zero(mode);
+ mode.format = desired_format;
+ if (SDL_SetWindowDisplayMode(SDL_VideoWindow, &mode) < 0) {
+ return NULL;
+ }
+ }
+
+ /* If we're in OpenGL mode, just create a stub surface and we're done! */
+ if (flags & SDL_OPENGL) {
+ SDL_VideoContext = SDL_GL_CreateContext(SDL_VideoWindow);
+ if (!SDL_VideoContext) {
+ return NULL;
+ }
+ if (SDL_GL_MakeCurrent(SDL_VideoWindow, SDL_VideoContext) < 0) {
+ return NULL;
+ }
+ SDL_VideoSurface =
+ SDL_CreateRGBSurfaceFrom(NULL, width, height, bpp, 0, 0, 0, 0, 0);
+ if (!SDL_VideoSurface) {
+ return NULL;
+ }
+ SDL_VideoSurface->flags |= surface_flags;
+ SDL_PublicSurface = SDL_VideoSurface;
+ return SDL_PublicSurface;
+ }
+
+ /* Create a renderer for the window */
+ if (SDL_CreateRenderer
+ (SDL_VideoWindow, -1,
+ SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD) < 0) {
+ return NULL;
+ }
+ SDL_GetRendererInfo(&SDL_VideoRendererInfo);
+
+ /* Create a texture for the screen surface */
+ SDL_VideoTexture =
+ SDL_CreateTexture(desired_format, SDL_TEXTUREACCESS_STREAMING, width,
+ height);
+
+ if (!SDL_VideoTexture) {
+ SDL_VideoTexture =
+ SDL_CreateTexture(desktop_format,
+ SDL_TEXTUREACCESS_STREAMING, width, height);
+ }
+ if (!SDL_VideoTexture) {
+ return NULL;
+ }
+
+ /* Create the screen surface */
+ SDL_VideoSurface = CreateVideoSurface(SDL_VideoTexture);
+ if (!SDL_VideoSurface) {
+ return NULL;
+ }
+ SDL_VideoSurface->flags |= surface_flags;
+
+ /* Set a default screen palette */
+ if (SDL_VideoSurface->format->palette) {
+ SDL_VideoSurface->flags |= SDL_HWPALETTE;
+ SDL_DitherColors(SDL_VideoSurface->format->palette->colors,
+ SDL_VideoSurface->format->BitsPerPixel);
+ SDL_AddPaletteWatch(SDL_VideoSurface->format->palette,
+ SDL_VideoPaletteChanged, SDL_VideoSurface);
+ SDL_SetPaletteColors(SDL_VideoSurface->format->palette,
+ SDL_VideoSurface->format->palette->colors, 0,
+ SDL_VideoSurface->format->palette->ncolors);
+ }
+
+ /* Create a shadow surface if necessary */
+ if ((bpp != SDL_VideoSurface->format->BitsPerPixel)
+ && !(flags & SDL_ANYFORMAT)) {
+ SDL_ShadowSurface =
+ SDL_CreateRGBSurface(0, width, height, bpp, 0, 0, 0, 0);
+ if (!SDL_ShadowSurface) {
+ return NULL;
+ }
+ SDL_ShadowSurface->flags |= surface_flags;
+
+ /* 8-bit SDL_ShadowSurface surfaces report that they have exclusive palette */
+ if (SDL_ShadowSurface->format->palette) {
+ SDL_ShadowSurface->flags |= SDL_HWPALETTE;
+ if (SDL_VideoSurface->format->palette) {
+ SDL_SetSurfacePalette(SDL_ShadowSurface,
+ SDL_VideoSurface->format->palette);
+ } else {
+ SDL_DitherColors(SDL_ShadowSurface->format->palette->colors,
+ SDL_ShadowSurface->format->BitsPerPixel);
+ }
+ SDL_AddPaletteWatch(SDL_ShadowSurface->format->palette,
+ SDL_VideoPaletteChanged, SDL_ShadowSurface);
+ }
+ }
+ SDL_PublicSurface =
+ (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface);
+
+ SDL_VideoFlags = flags;
+
+ ClearVideoSurface();
+
+ SetupScreenSaver(flags);
+
+ /* We're finally done! */
+ return SDL_PublicSurface;
+}
+
+SDL_Surface *
+SDL_GetVideoSurface(void)
+{
+ return SDL_PublicSurface;
+}
+
+int
+SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
+{
+ if (flag & SDL_SRCALPHA) {
+ /* According to the docs, value is ignored for alpha surfaces */
+ if (surface->format->Amask) {
+ value = 0xFF;
+ }
+ SDL_SetSurfaceAlphaMod(surface, value);
+ SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
+ } else {
+ SDL_SetSurfaceAlphaMod(surface, 0xFF);
+ SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
+ }
+ SDL_SetSurfaceRLE(surface, (flag & SDL_RLEACCEL));
+
+ return 0;
+}
+
+SDL_Surface *
+SDL_DisplayFormat(SDL_Surface * surface)
+{
+ SDL_PixelFormat *format;
+
+ if (!SDL_PublicSurface) {
+ SDL_SetError("No video mode has been set");
+ return NULL;
+ }
+ format = SDL_PublicSurface->format;
+
+ /* Set the flags appropriate for copying to display surface */
+ return SDL_ConvertSurface(surface, format, SDL_RLEACCEL);
+}
+
+SDL_Surface *
+SDL_DisplayFormatAlpha(SDL_Surface * surface)
+{
+ SDL_PixelFormat *vf;
+ SDL_PixelFormat *format;
+ SDL_Surface *converted;
+ /* default to ARGB8888 */
+ Uint32 amask = 0xff000000;
+ Uint32 rmask = 0x00ff0000;
+ Uint32 gmask = 0x0000ff00;
+ Uint32 bmask = 0x000000ff;
+
+ if (!SDL_PublicSurface) {
+ SDL_SetError("No video mode has been set");
+ return NULL;
+ }
+ vf = SDL_PublicSurface->format;
+
+ switch (vf->BytesPerPixel) {
+ case 2:
+ /* For XGY5[56]5, use, AXGY8888, where {X, Y} = {R, B}.
+ For anything else (like ARGB4444) it doesn't matter
+ since we have no special code for it anyway */
+ if ((vf->Rmask == 0x1f) &&
+ (vf->Bmask == 0xf800 || vf->Bmask == 0x7c00)) {
+ rmask = 0xff;
+ bmask = 0xff0000;
+ }
+ break;
+
+ case 3:
+ case 4:
+ /* Keep the video format, as long as the high 8 bits are
+ unused or alpha */
+ if ((vf->Rmask == 0xff) && (vf->Bmask == 0xff0000)) {
+ rmask = 0xff;
+ bmask = 0xff0000;
+ }
+ break;
+
+ default:
+ /* We have no other optimised formats right now. When/if a new
+ optimised alpha format is written, add the converter here */
+ break;
+ }
+ format = SDL_AllocFormat(32, rmask, gmask, bmask, amask);
+ converted = SDL_ConvertSurface(surface, format, SDL_RLEACCEL);
+ SDL_FreeFormat(format);
+ return converted;
+}
+
+int
+SDL_Flip(SDL_Surface * screen)
+{
+ SDL_UpdateRect(screen, 0, 0, 0, 0);
+ return 0;
+}
+
+void
+SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h)
+{
+ if (screen) {
+ SDL_Rect rect;
+
+ /* Fill the rectangle */
+ rect.x = (int) x;
+ rect.y = (int) y;
+ rect.w = (int) (w ? w : screen->w);
+ rect.h = (int) (h ? h : screen->h);
+ SDL_UpdateRects(screen, 1, &rect);
+ }
+}
+
+void
+SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
+{
+ int i;
+
+ if (screen == SDL_ShadowSurface) {
+ for (i = 0; i < numrects; ++i) {
+ SDL_LowerBlit(SDL_ShadowSurface, &rects[i], SDL_VideoSurface,
+ &rects[i]);
+ }
+
+ /* Fall through to video surface update */
+ screen = SDL_VideoSurface;
+ }
+ if (screen == SDL_VideoSurface) {
+ if (screen->flags & SDL_PREALLOC) {
+ /* The surface memory is maintained by the renderer */
+ SDL_DirtyTexture(SDL_VideoTexture, numrects, rects);
+ } else {
+ /* The surface memory needs to be copied to texture */
+ int pitch = screen->pitch;
+ int psize = screen->format->BytesPerPixel;
+ for (i = 0; i < numrects; ++i) {
+ const SDL_Rect *rect = &rects[i];
+ void *pixels =
+ (Uint8 *) screen->pixels + rect->y * pitch +
+ rect->x * psize;
+ SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch);
+ }
+ }
+ if (SDL_VideoRendererInfo.flags & SDL_RENDERER_PRESENTCOPY) {
+ for (i = 0; i < numrects; ++i) {
+ SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i]);
+ }
+ } else {
+ SDL_Rect rect;
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = screen->w;
+ rect.h = screen->h;
+ SDL_RenderCopy(SDL_VideoTexture, &rect, &rect);
+ }
+ SDL_RenderPresent();
+ }
+}
+
+void
+SDL_WM_SetCaption(const char *title, const char *icon)
+{
+ if (wm_title) {
+ SDL_free(wm_title);
+ }
+ if (title) {
+ wm_title = SDL_strdup(title);
+ } else {
+ wm_title = NULL;
+ }
+ SDL_SetWindowTitle(SDL_VideoWindow, wm_title);
+}
+
+void
+SDL_WM_GetCaption(const char **title, const char **icon)
+{
+ if (title) {
+ *title = wm_title;
+ }
+ if (icon) {
+ *icon = "";
+ }
+}
+
+void
+SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
+{
+ SDL_VideoIcon = icon;
+}
+
+int
+SDL_WM_IconifyWindow(void)
+{
+ SDL_MinimizeWindow(SDL_VideoWindow);
+ return 0;
+}
+
+int
+SDL_WM_ToggleFullScreen(SDL_Surface * surface)
+{
+ if (SDL_GetWindowFlags(SDL_VideoWindow) & SDL_WINDOW_FULLSCREEN) {
+ if (SDL_SetWindowFullscreen(SDL_VideoWindow, 0) < 0) {
+ return 0;
+ }
+ SDL_PublicSurface->flags &= ~SDL_FULLSCREEN;
+ } else {
+ if (SDL_SetWindowFullscreen(SDL_VideoWindow, 1) < 0) {
+ return 0;
+ }
+ SDL_PublicSurface->flags |= SDL_FULLSCREEN;
+ }
+ return 1;
+}
+
+SDL_GrabMode
+SDL_WM_GrabInput(SDL_GrabMode mode)
+{
+ if (mode != SDL_GRAB_QUERY) {
+ SDL_SetWindowGrab(SDL_VideoWindow, mode);
+ }
+ return (SDL_GrabMode) SDL_GetWindowGrab(SDL_VideoWindow);
+}
+
+void
+SDL_WarpMouse(Uint16 x, Uint16 y)
+{
+ SDL_WarpMouseInWindow(SDL_VideoWindow, x, y);
+}
+
+Uint8
+SDL_GetAppState(void)
+{
+ Uint8 state = 0;
+ Uint32 flags = 0;
+
+ flags = SDL_GetWindowFlags(SDL_VideoWindow);
+ if ((flags & SDL_WINDOW_SHOWN) && !(flags & SDL_WINDOW_MINIMIZED)) {
+ state |= SDL_APPACTIVE;
+ }
+ if (flags & SDL_WINDOW_INPUT_FOCUS) {
+ state |= SDL_APPINPUTFOCUS;
+ }
+ if (flags & SDL_WINDOW_MOUSE_FOCUS) {
+ state |= SDL_APPMOUSEFOCUS;
+ }
+ return state;
+}
+
+const SDL_version *
+SDL_Linked_Version(void)
+{
+ static SDL_version version;
+ SDL_VERSION(&version);
+ return &version;
+}
+
+int
+SDL_SetPalette(SDL_Surface * surface, int flags, const SDL_Color * colors,
+ int firstcolor, int ncolors)
+{
+ return SDL_SetColors(surface, colors, firstcolor, ncolors);
+}
+
+int
+SDL_SetColors(SDL_Surface * surface, const SDL_Color * colors, int firstcolor,
+ int ncolors)
+{
+ if (SDL_SetPaletteColors
+ (surface->format->palette, colors, firstcolor, ncolors) == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int
+SDL_GetWMInfo(SDL_SysWMinfo * info)
+{
+ return SDL_GetWindowWMInfo(SDL_VideoWindow, info);
+}
+
+#if 0
+void
+SDL_MoveCursor(int x, int y)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+ /* Erase and update the current mouse position */
+ if (SHOULD_DRAWCURSOR(SDL_cursorstate)) {
+ /* Erase and redraw mouse cursor in new position */
+ SDL_LockCursor();
+ SDL_EraseCursor(SDL_VideoSurface);
+ SDL_cursor->area.x = (x - SDL_cursor->hot_x);
+ SDL_cursor->area.y = (y - SDL_cursor->hot_y);
+ SDL_DrawCursor(SDL_VideoSurface);
+ SDL_UnlockCursor();
+ } else if (_this->MoveWMCursor) {
+ _this->MoveWMCursor(_this, x, y);
+ }
+}
+
+/* Keep track of the current cursor colors */
+static int palette_changed = 1;
+static Uint8 pixels8[2];
+
+void
+SDL_CursorPaletteChanged(void)
+{
+ palette_changed = 1;
+}
+
+void
+SDL_MouseRect(SDL_Rect * area)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+ int clip_diff;
+
+ *area = SDL_cursor->area;
+ if (area->x < 0) {
+ area->w += area->x;
+ area->x = 0;
+ }
+ if (area->y < 0) {
+ area->h += area->y;
+ area->y = 0;
+ }
+ clip_diff = (area->x + area->w) - SDL_VideoSurface->w;
+ if (clip_diff > 0) {
+ area->w = area->w < clip_diff ? 0 : area->w - clip_diff;
+ }
+ clip_diff = (area->y + area->h) - SDL_VideoSurface->h;
+ if (clip_diff > 0) {
+ area->h = area->h < clip_diff ? 0 : area->h - clip_diff;
+ }
+}
+
+static void
+SDL_DrawCursorFast(SDL_Surface * screen, SDL_Rect * area)
+{
+ const Uint32 pixels[2] = { 0xFFFFFFFF, 0x00000000 };
+ int i, w, h;
+ Uint8 *data, datab;
+ Uint8 *mask, maskb;
+
+ data = SDL_cursor->data + area->y * SDL_cursor->area.w / 8;
+ mask = SDL_cursor->mask + area->y * SDL_cursor->area.w / 8;
+ switch (screen->format->BytesPerPixel) {
+
+ case 1:
+ {
+ Uint8 *dst;
+ int dstskip;
+
+ if (palette_changed) {
+ pixels8[0] =
+ (Uint8) SDL_MapRGB(screen->format, 255, 255, 255);
+ pixels8[1] = (Uint8) SDL_MapRGB(screen->format, 0, 0, 0);
+ palette_changed = 0;
+ }
+ dst = (Uint8 *) screen->pixels +
+ (SDL_cursor->area.y + area->y) * screen->pitch +
+ SDL_cursor->area.x;
+ dstskip = screen->pitch - area->w;
+
+ for (h = area->h; h; h--) {
+ for (w = area->w / 8; w; w--) {
+ maskb = *mask++;
+ datab = *data++;
+ for (i = 0; i < 8; ++i) {
+ if (maskb & 0x80) {
+ *dst = pixels8[datab >> 7];
+ }
+ maskb <<= 1;
+ datab <<= 1;
+ dst++;
+ }
+ }
+ dst += dstskip;
+ }
+ }
+ break;
+
+ case 2:
+ {
+ Uint16 *dst;
+ int dstskip;
+
+ dst = (Uint16 *) screen->pixels +
+ (SDL_cursor->area.y + area->y) * screen->pitch / 2 +
+ SDL_cursor->area.x;
+ dstskip = (screen->pitch / 2) - area->w;
+
+ for (h = area->h; h; h--) {
+ for (w = area->w / 8; w; w--) {
+ maskb = *mask++;
+ datab = *data++;
+ for (i = 0; i < 8; ++i) {
+ if (maskb & 0x80) {
+ *dst = (Uint16) pixels[datab >> 7];
+ }
+ maskb <<= 1;
+ datab <<= 1;
+ dst++;
+ }
+ }
+ dst += dstskip;
+ }
+ }
+ break;
+
+ case 3:
+ {
+ Uint8 *dst;
+ int dstskip;
+
+ dst = (Uint8 *) screen->pixels +
+ (SDL_cursor->area.y + area->y) * screen->pitch +
+ SDL_cursor->area.x * 3;
+ dstskip = screen->pitch - area->w * 3;
+
+ for (h = area->h; h; h--) {
+ for (w = area->w / 8; w; w--) {
+ maskb = *mask++;
+ datab = *data++;
+ for (i = 0; i < 8; ++i) {
+ if (maskb & 0x80) {
+ SDL_memset(dst, pixels[datab >> 7], 3);
+ }
+ maskb <<= 1;
+ datab <<= 1;
+ dst += 3;
+ }
+ }
+ dst += dstskip;
+ }
+ }
+ break;
+
+ case 4:
+ {
+ Uint32 *dst;
+ int dstskip;
+
+ dst = (Uint32 *) screen->pixels +
+ (SDL_cursor->area.y + area->y) * screen->pitch / 4 +
+ SDL_cursor->area.x;
+ dstskip = (screen->pitch / 4) - area->w;
+
+ for (h = area->h; h; h--) {
+ for (w = area->w / 8; w; w--) {
+ maskb = *mask++;
+ datab = *data++;
+ for (i = 0; i < 8; ++i) {
+ if (maskb & 0x80) {
+ *dst = pixels[datab >> 7];
+ }
+ maskb <<= 1;
+ datab <<= 1;
+ dst++;
+ }
+ }
+ dst += dstskip;
+ }
+ }
+ break;
+ }
+}
+
+static void
+SDL_DrawCursorSlow(SDL_Surface * screen, SDL_Rect * area)
+{
+ const Uint32 pixels[2] = { 0xFFFFFF, 0x000000 };
+ int h;
+ int x, minx, maxx;
+ Uint8 *data, datab = 0;
+ Uint8 *mask, maskb = 0;
+ Uint8 *dst;
+ int dstbpp, dstskip;
+
+ data = SDL_cursor->data + area->y * SDL_cursor->area.w / 8;
+ mask = SDL_cursor->mask + area->y * SDL_cursor->area.w / 8;
+ dstbpp = screen->format->BytesPerPixel;
+ dst = (Uint8 *) screen->pixels +
+ (SDL_cursor->area.y + area->y) * screen->pitch +
+ SDL_cursor->area.x * dstbpp;
+ dstskip = screen->pitch - SDL_cursor->area.w * dstbpp;
+
+ minx = area->x;
+ maxx = area->x + area->w;
+ if (screen->format->BytesPerPixel == 1) {
+ if (palette_changed) {
+ pixels8[0] = (Uint8) SDL_MapRGB(screen->format, 255, 255, 255);
+ pixels8[1] = (Uint8) SDL_MapRGB(screen->format, 0, 0, 0);
+ palette_changed = 0;
+ }
+ for (h = area->h; h; h--) {
+ for (x = 0; x < SDL_cursor->area.w; ++x) {
+ if ((x % 8) == 0) {
+ maskb = *mask++;
+ datab = *data++;
+ }
+ if ((x >= minx) && (x < maxx)) {
+ if (maskb & 0x80) {
+ SDL_memset(dst, pixels8[datab >> 7], dstbpp);
+ }
+ }
+ maskb <<= 1;
+ datab <<= 1;
+ dst += dstbpp;
+ }
+ dst += dstskip;
+ }
+ } else {
+ for (h = area->h; h; h--) {
+ for (x = 0; x < SDL_cursor->area.w; ++x) {
+ if ((x % 8) == 0) {
+ maskb = *mask++;
+ datab = *data++;
+ }
+ if ((x >= minx) && (x < maxx)) {
+ if (maskb & 0x80) {
+ SDL_memset(dst, pixels[datab >> 7], dstbpp);
+ }
+ }
+ maskb <<= 1;
+ datab <<= 1;
+ dst += dstbpp;
+ }
+ dst += dstskip;
+ }
+ }
+}
+
+/* This handles the ugly work of converting the saved cursor background from
+ the pixel format of the shadow surface to that of the video surface.
+ This is only necessary when blitting from a shadow surface of a different
+ pixel format than the video surface, and using a software rendered cursor.
+*/
+static void
+SDL_ConvertCursorSave(SDL_Surface * screen, int w, int h)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+ SDL_BlitInfo info;
+ SDL_loblit RunBlit;
+
+ /* Make sure we can steal the blit mapping */
+ if (screen->map->dst != SDL_VideoSurface) {
+ return;
+ }
+
+ /* Set up the blit information */
+ info.s_pixels = SDL_cursor->save[1];
+ info.s_width = w;
+ info.s_height = h;
+ info.s_skip = 0;
+ info.d_pixels = SDL_cursor->save[0];
+ info.d_width = w;
+ info.d_height = h;
+ info.d_skip = 0;
+ info.aux_data = screen->map->sw_data->aux_data;
+ info.src = screen->format;
+ info.table = screen->map->table;
+ info.dst = SDL_VideoSurface->format;
+ RunBlit = screen->map->sw_data->blit;
+
+ /* Run the actual software blit */
+ RunBlit(&info);
+}
+
+void
+SDL_DrawCursorNoLock(SDL_Surface * screen)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+ SDL_Rect area;
+
+ /* Get the mouse rectangle, clipped to the screen */
+ SDL_MouseRect(&area);
+ if ((area.w == 0) || (area.h == 0)) {
+ return;
+ }
+
+ /* Copy mouse background */
+ {
+ int w, h, screenbpp;
+ Uint8 *src, *dst;
+
+ /* Set up the copy pointers */
+ screenbpp = screen->format->BytesPerPixel;
+ if ((screen == SDL_VideoSurface) ||
+ FORMAT_EQUAL(screen->format, SDL_VideoSurface->format)) {
+ dst = SDL_cursor->save[0];
+ } else {
+ dst = SDL_cursor->save[1];
+ }
+ src = (Uint8 *) screen->pixels + area.y * screen->pitch +
+ area.x * screenbpp;
+
+ /* Perform the copy */
+ w = area.w * screenbpp;
+ h = area.h;
+ while (h--) {
+ SDL_memcpy(dst, src, w);
+ dst += w;
+ src += screen->pitch;
+ }
+ }
+
+ /* Draw the mouse cursor */
+ area.x -= SDL_cursor->area.x;
+ area.y -= SDL_cursor->area.y;
+ if ((area.x == 0) && (area.w == SDL_cursor->area.w)) {
+ SDL_DrawCursorFast(screen, &area);
+ } else {
+ SDL_DrawCursorSlow(screen, &area);
+ }
+}
+
+void
+SDL_DrawCursor(SDL_Surface * screen)
+{
+ /* Lock the screen if necessary */
+ if (screen == NULL) {
+ return;
+ }
+ if (SDL_MUSTLOCK(screen)) {
+ if (SDL_LockSurface(screen) < 0) {
+ return;
+ }
+ }
+
+ SDL_DrawCursorNoLock(screen);
+
+ /* Unlock the screen and update if necessary */
+ if (SDL_MUSTLOCK(screen)) {
+ SDL_UnlockSurface(screen);
+ }
+ if (screen->flags & SDL_SCREEN_SURFACE) {
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+ SDL_Window *window;
+ SDL_Rect area;
+
+ window = SDL_GetWindowFromSurface(screen);
+ if (!window) {
+ return;
+ }
+
+ SDL_MouseRect(&area);
+
+ if (_this->UpdateWindowSurface) {
+ _this->UpdateWindowSurface(_this, window, 1, &area);
+ }
+ }
+}
+
+void
+SDL_EraseCursorNoLock(SDL_Surface * screen)
+{
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+ SDL_Window *window;
+ SDL_Rect area;
+
+ /* Get the window associated with the surface */
+ window = SDL_GetWindowFromSurface(screen);
+ if (!window || !window->surface) {
+ return;
+ }
+
+ /* Get the mouse rectangle, clipped to the screen */
+ SDL_MouseRect(&area);
+ if ((area.w == 0) || (area.h == 0)) {
+ return;
+ }
+
+ /* Copy mouse background */
+ {
+ int w, h, screenbpp;
+ Uint8 *src, *dst;
+
+ /* Set up the copy pointers */
+ screenbpp = screen->format->BytesPerPixel;
+ if ((screen->flags & SDL_SCREEN_SURFACE) ||
+ FORMAT_EQUAL(screen->format, window->surface->format)) {
+ src = SDL_cursor->save[0];
+ } else {
+ src = SDL_cursor->save[1];
+ }
+ dst = (Uint8 *) screen->pixels + area.y * screen->pitch +
+ area.x * screenbpp;
+
+ /* Perform the copy */
+ w = area.w * screenbpp;
+ h = area.h;
+ while (h--) {
+ SDL_memcpy(dst, src, w);
+ src += w;
+ dst += screen->pitch;
+ }
+
+ /* Perform pixel conversion on cursor background */
+ if (src > SDL_cursor->save[1]) {
+ SDL_ConvertCursorSave(screen, area.w, area.h);
+ }
+ }
+}
+
+void
+SDL_EraseCursor(SDL_Surface * screen)
+{
+ /* Lock the screen if necessary */
+ if (screen == NULL) {
+ return;
+ }
+ if (SDL_MUSTLOCK(screen)) {
+ if (SDL_LockSurface(screen) < 0) {
+ return;
+ }
+ }
+
+ SDL_EraseCursorNoLock(screen);
+
+ /* Unlock the screen and update if necessary */
+ if (SDL_MUSTLOCK(screen)) {
+ SDL_UnlockSurface(screen);
+ }
+ if (screen->flags & SDL_SCREEN_SURFACE) {
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
+ SDL_Window *window;
+ SDL_Rect area;
+
+ window = SDL_GetWindowFromSurface(screen);
+ if (!window) {
+ return;
+ }
+
+ SDL_MouseRect(&area);
+
+ if (_this->UpdateWindowSurface) {
+ _this->UpdateWindowSurface(_this, window, 1, &area);
+ }
+ }
+}
+
+/* Reset the cursor on video mode change
+ FIXME: Keep track of all cursors, and reset them all.
+ */
+void
+SDL_ResetCursor(void)
+{
+ int savelen;
+
+ if (SDL_cursor) {
+ savelen = SDL_cursor->area.w * 4 * SDL_cursor->area.h;
+ SDL_cursor->area.x = 0;
+ SDL_cursor->area.y = 0;
+ SDL_memset(SDL_cursor->save[0], 0, savelen);
+ }
+}
+#endif
+
+struct private_yuvhwdata
+{
+ Uint16 pitches[3];
+ Uint8 *planes[3];
+
+ SDL_SW_YUVTexture *sw;
+
+ SDL_Texture *texture;
+ Uint32 texture_format;
+};
+
+SDL_Overlay *
+SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
+{
+ SDL_Overlay *overlay;
+ Uint32 texture_format;
+
+ if ((display->flags & SDL_OPENGL) == SDL_OPENGL) {
+ SDL_SetError("YUV overlays are not supported in OpenGL mode");
+ return NULL;
+ }
+
+ if (display != SDL_PublicSurface) {
+ SDL_SetError("YUV display is only supported on the screen surface");
+ return NULL;
+ }
+
+ switch (format) {
+ case SDL_YV12_OVERLAY:
+ texture_format = SDL_PIXELFORMAT_YV12;
+ break;
+ case SDL_IYUV_OVERLAY:
+ texture_format = SDL_PIXELFORMAT_IYUV;
+ break;
+ case SDL_YUY2_OVERLAY:
+ texture_format = SDL_PIXELFORMAT_YUY2;
+ break;
+ case SDL_UYVY_OVERLAY:
+ texture_format = SDL_PIXELFORMAT_UYVY;
+ break;
+ case SDL_YVYU_OVERLAY:
+ texture_format = SDL_PIXELFORMAT_YVYU;
+ break;
+ default:
+ SDL_SetError("Unknown YUV format");
+ return NULL;
+ }
+
+ overlay = (SDL_Overlay *) SDL_malloc(sizeof(*overlay));
+ if (!overlay) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_zerop(overlay);
+
+ overlay->hwdata =
+ (struct private_yuvhwdata *) SDL_malloc(sizeof(*overlay->hwdata));
+ if (!overlay->hwdata) {
+ SDL_free(overlay);
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ overlay->format = format;
+ overlay->w = w;
+ overlay->h = h;
+ if (format == SDL_YV12_OVERLAY || format == SDL_IYUV_OVERLAY) {
+ overlay->planes = 3;
+ } else {
+ overlay->planes = 1;
+ }
+ overlay->pitches = overlay->hwdata->pitches;
+ overlay->pixels = overlay->hwdata->planes;
+
+ switch (format) {
+ case SDL_YV12_OVERLAY:
+ case SDL_IYUV_OVERLAY:
+ overlay->pitches[0] = overlay->w;
+ overlay->pitches[1] = overlay->w / 2;
+ overlay->pitches[2] = overlay->w / 2;
+ break;
+ case SDL_YUY2_OVERLAY:
+ case SDL_UYVY_OVERLAY:
+ case SDL_YVYU_OVERLAY:
+ overlay->pitches[0] = overlay->w * 2;
+ break;
+ }
+
+ overlay->hwdata->texture =
+ SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h);
+ if (overlay->hwdata->texture) {
+ overlay->hwdata->sw = NULL;
+ } else {
+ SDL_DisplayMode current_mode;
+
+ overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h);
+ if (!overlay->hwdata->sw) {
+ SDL_FreeYUVOverlay(overlay);
+ return NULL;
+ }
+
+ /* Create a supported RGB format texture for display */
+ SDL_GetCurrentDisplayMode(¤t_mode);
+ texture_format = current_mode.format;
+ overlay->hwdata->texture =
+ SDL_CreateTexture(texture_format,
+ SDL_TEXTUREACCESS_STREAMING, w, h);
+ }
+ if (!overlay->hwdata->texture) {
+ SDL_FreeYUVOverlay(overlay);
+ return NULL;
+ }
+ overlay->hwdata->texture_format = texture_format;
+
+ return overlay;
+}
+
+int
+SDL_LockYUVOverlay(SDL_Overlay * overlay)
+{
+ void *pixels;
+ int pitch;
+
+ if (!overlay) {
+ SDL_SetError("Passed a NULL overlay");
+ return -1;
+ }
+ if (overlay->hwdata->sw) {
+ if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch)
+ < 0) {
+ return -1;
+ }
+ } else {
+ if (SDL_LockTexture
+ (overlay->hwdata->texture, NULL, 1, &pixels, &pitch)
+ < 0) {
+ return -1;
+ }
+ }
+ overlay->pixels[0] = (Uint8 *) pixels;
+ overlay->pitches[0] = pitch;
+ switch (overlay->format) {
+ case SDL_YV12_OVERLAY:
+ case SDL_IYUV_OVERLAY:
+ overlay->pitches[1] = pitch / 2;
+ overlay->pitches[2] = pitch / 2;
+ overlay->pixels[1] =
+ overlay->pixels[0] + overlay->pitches[0] * overlay->h;
+ overlay->pixels[2] =
+ overlay->pixels[1] + overlay->pitches[1] * overlay->h / 2;
+ break;
+ case SDL_YUY2_OVERLAY:
+ case SDL_UYVY_OVERLAY:
+ case SDL_YVYU_OVERLAY:
+ break;
+ }
+ return 0;
+}
+
+void
+SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
+{
+ if (!overlay) {
+ return;
+ }
+ if (overlay->hwdata->sw) {
+ void *pixels;
+ int pitch;
+ if (SDL_LockTexture
+ (overlay->hwdata->texture, NULL, 1, &pixels, &pitch) == 0) {
+ SDL_Rect srcrect;
+
+ srcrect.x = 0;
+ srcrect.y = 0;
+ srcrect.w = overlay->w;
+ srcrect.h = overlay->h;
+ SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
+ overlay->hwdata->texture_format,
+ overlay->w, overlay->h, pixels, pitch);
+ SDL_UnlockTexture(overlay->hwdata->texture);
+ }
+ } else {
+ SDL_UnlockTexture(overlay->hwdata->texture);
+ }
+}
+
+int
+SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect)
+{
+ if (!overlay || !dstrect) {
+ SDL_SetError("Passed a NULL overlay or dstrect");
+ return -1;
+ }
+ if (SDL_RenderCopy(overlay->hwdata->texture, NULL, dstrect) < 0) {
+ return -1;
+ }
+ SDL_RenderPresent();
+ return 0;
+}
+
+void
+SDL_FreeYUVOverlay(SDL_Overlay * overlay)
+{
+ if (!overlay) {
+ return;
+ }
+ if (overlay->hwdata) {
+ if (overlay->hwdata->texture) {
+ SDL_DestroyTexture(overlay->hwdata->texture);
+ }
+ SDL_free(overlay->hwdata);
+ }
+ SDL_free(overlay);
+}
+
+void
+SDL_GL_SwapBuffers(void)
+{
+ SDL_GL_SwapWindow(SDL_VideoWindow);
+}
+
+
+int
+SDL_EnableKeyRepeat(int delay, int interval)
+{
+ return 0;
+}
+
+void
+SDL_GetKeyRepeat(int *delay, int *interval)
+{
+ if (delay) {
+ *delay = SDL_DEFAULT_REPEAT_DELAY;
+ }
+ if (interval) {
+ *interval = SDL_DEFAULT_REPEAT_INTERVAL;
+ }
+}
+
+int
+SDL_EnableUNICODE(int enable)
+{
+ int previous = SDL_enabled_UNICODE;
+
+ switch (enable) {
+ case 1:
+ SDL_enabled_UNICODE = 1;
+ SDL_StartTextInput();
+ break;
+ case 0:
+ SDL_enabled_UNICODE = 0;
+ SDL_StopTextInput();
+ break;
+ }
+ return previous;
+}
+
+
+int
+SDL_putenv(const char *_var)
+{
+ char *ptr = NULL;
+ char *var = SDL_strdup(_var);
+ if (var == NULL) {
+ return -1; /* we don't set errno. */
+ }
+
+ ptr = SDL_strchr(var, '=');
+ if (ptr == NULL) {
+ SDL_free(var);
+ return -1;
+ }
+
+ *ptr = '\0'; /* split the string into name and value. */
+ SDL_setenv(var, ptr + 1, 1);
+ SDL_free(var);
+ return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/SDL_error.c b/alienblaster/project/jni/sdl/src/SDL_error.c
index 900309ee3..894409d86 100644
--- a/alienblaster/project/jni/sdl/src/SDL_error.c
+++ b/alienblaster/project/jni/sdl/src/SDL_error.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -28,6 +28,7 @@
/* Routine to get the thread-specific error variable */
#if SDL_THREADS_DISABLED
+/* !!! FIXME: what does this comment mean? Victim of Search and Replace? */
/* The SDL_arraysize(The ),default (non-thread-safe) global error variable */
static SDL_error SDL_global_error;
#define SDL_GetErrBuf() (&SDL_global_error)
@@ -39,200 +40,220 @@ extern SDL_error *SDL_GetErrBuf(void);
/* Private functions */
-static const char *SDL_LookupString(const char *key)
+static const char *
+SDL_LookupString(const char *key)
{
- /* FIXME: Add code to lookup key in language string hash-table */
- return key;
+ /* FIXME: Add code to lookup key in language string hash-table */
+ return key;
}
/* Public functions */
-void SDL_SetError (const char *fmt, ...)
+void
+SDL_SetError(const char *fmt, ...)
{
- va_list ap;
- SDL_error *error;
+ va_list ap;
+ SDL_error *error;
- /* Copy in the key, mark error as valid */
- error = SDL_GetErrBuf();
- error->error = 1;
- SDL_strlcpy((char *)error->key, fmt, sizeof(error->key));
+ /* Copy in the key, mark error as valid */
+ error = SDL_GetErrBuf();
+ error->error = 1;
+ SDL_strlcpy((char *) error->key, fmt, sizeof(error->key));
- va_start(ap, fmt);
- error->argc = 0;
- while ( *fmt ) {
- if ( *fmt++ == '%' ) {
- while ( *fmt == '.' || (*fmt >= '0' && *fmt <= '9') ) {
- ++fmt;
- }
- switch (*fmt++) {
- case 0: /* Malformed format string.. */
- --fmt;
- break;
- case 'c':
- case 'i':
- case 'd':
- case 'u':
- case 'o':
- case 'x':
- case 'X':
- error->args[error->argc++].value_i =
- va_arg(ap, int);
- break;
- case 'f':
- error->args[error->argc++].value_f =
- va_arg(ap, double);
- break;
- case 'p':
- error->args[error->argc++].value_ptr =
- va_arg(ap, void *);
- break;
- case 's':
- {
- int i = error->argc;
- const char *str = va_arg(ap, const char *);
- if (str == NULL)
- str = "(null)";
- SDL_strlcpy((char *)error->args[i].buf, str, ERR_MAX_STRLEN);
- error->argc++;
- }
- break;
- default:
- break;
- }
- if ( error->argc >= ERR_MAX_ARGS ) {
- break;
- }
- }
- }
- va_end(ap);
+ va_start(ap, fmt);
+ error->argc = 0;
+ while (*fmt) {
+ if (*fmt++ == '%') {
+ while (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) {
+ ++fmt;
+ }
+ switch (*fmt++) {
+ case 0: /* Malformed format string.. */
+ --fmt;
+ break;
+ case 'c':
+ case 'i':
+ case 'd':
+ case 'u':
+ case 'o':
+ case 'x':
+ case 'X':
+ error->args[error->argc++].value_i = va_arg(ap, int);
+ break;
+ case 'f':
+ error->args[error->argc++].value_f = va_arg(ap, double);
+ break;
+ case 'p':
+ error->args[error->argc++].value_ptr = va_arg(ap, void *);
+ break;
+ case 's':
+ {
+ int i = error->argc;
+ const char *str = va_arg(ap, const char *);
+ if (str == NULL)
+ str = "(null)";
+ SDL_strlcpy((char *) error->args[i].buf, str,
+ ERR_MAX_STRLEN);
+ error->argc++;
+ }
+ break;
+ default:
+ break;
+ }
+ if (error->argc >= ERR_MAX_ARGS) {
+ break;
+ }
+ }
+ }
+ va_end(ap);
- /* If we are in debug mode, print out an error message */
+ /* If we are in debug mode, print out an error message */
#ifdef DEBUG_ERROR
- fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
+ fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
#endif
}
/* This function has a bit more overhead than most error functions
so that it supports internationalization and thread-safe errors.
*/
-char *SDL_GetErrorMsg(char *errstr, unsigned int maxlen)
+char *
+SDL_GetErrorMsg(char *errstr, unsigned int maxlen)
{
- SDL_error *error;
+ SDL_error *error;
- /* Clear the error string */
- *errstr = '\0'; --maxlen;
+ /* Clear the error string */
+ *errstr = '\0';
+ --maxlen;
- /* Get the thread-safe error, and print it out */
- error = SDL_GetErrBuf();
- if ( error->error ) {
- const char *fmt;
- char *msg = errstr;
- int len;
- int argi;
+ /* Get the thread-safe error, and print it out */
+ error = SDL_GetErrBuf();
+ if (error->error) {
+ const char *fmt;
+ char *msg = errstr;
+ int len;
+ int argi;
- fmt = SDL_LookupString(error->key);
- argi = 0;
- while ( *fmt && (maxlen > 0) ) {
- if ( *fmt == '%' ) {
- char tmp[32], *spot = tmp;
- *spot++ = *fmt++;
- while ( (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) && spot < (tmp+SDL_arraysize(tmp)-2) ) {
- *spot++ = *fmt++;
- }
- *spot++ = *fmt++;
- *spot++ = '\0';
- switch (spot[-2]) {
- case '%':
- *msg++ = '%';
- maxlen -= 1;
- break;
- case 'c':
- case 'i':
- case 'd':
- case 'u':
- case 'o':
- case 'x':
- case 'X':
- len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_i);
- msg += len;
- maxlen -= len;
- break;
- case 'f':
- len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_f);
- msg += len;
- maxlen -= len;
- break;
- case 'p':
- len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_ptr);
- msg += len;
- maxlen -= len;
- break;
- case 's':
- len = SDL_snprintf(msg, maxlen, tmp, SDL_LookupString(error->args[argi++].buf));
- msg += len;
- maxlen -= len;
- break;
- }
- } else {
- *msg++ = *fmt++;
- maxlen -= 1;
- }
- }
- *msg = 0; /* NULL terminate the string */
- }
- return(errstr);
+ fmt = SDL_LookupString(error->key);
+ argi = 0;
+ while (*fmt && (maxlen > 0)) {
+ if (*fmt == '%') {
+ char tmp[32], *spot = tmp;
+ *spot++ = *fmt++;
+ while ((*fmt == '.' || (*fmt >= '0' && *fmt <= '9'))
+ && spot < (tmp + SDL_arraysize(tmp) - 2)) {
+ *spot++ = *fmt++;
+ }
+ *spot++ = *fmt++;
+ *spot++ = '\0';
+ switch (spot[-2]) {
+ case '%':
+ *msg++ = '%';
+ maxlen -= 1;
+ break;
+ case 'c':
+ case 'i':
+ case 'd':
+ case 'u':
+ case 'o':
+ case 'x':
+ case 'X':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ error->args[argi++].value_i);
+ msg += len;
+ maxlen -= len;
+ break;
+ case 'f':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ error->args[argi++].value_f);
+ msg += len;
+ maxlen -= len;
+ break;
+ case 'p':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ error->args[argi++].value_ptr);
+ msg += len;
+ maxlen -= len;
+ break;
+ case 's':
+ len =
+ SDL_snprintf(msg, maxlen, tmp,
+ SDL_LookupString(error->args[argi++].
+ buf));
+ msg += len;
+ maxlen -= len;
+ break;
+ }
+ } else {
+ *msg++ = *fmt++;
+ maxlen -= 1;
+ }
+ }
+ *msg = 0; /* NULL terminate the string */
+ }
+ return (errstr);
}
/* Available for backwards compatibility */
-char *SDL_GetError (void)
+char *
+SDL_GetError(void)
{
- static char errmsg[SDL_ERRBUFIZE];
+ static char errmsg[SDL_ERRBUFIZE];
- return((char *)SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE));
+ return ((char *) SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE));
}
-void SDL_ClearError(void)
+void
+SDL_ClearError(void)
{
- SDL_error *error;
+ SDL_error *error;
- error = SDL_GetErrBuf();
- error->error = 0;
+ error = SDL_GetErrBuf();
+ error->error = 0;
}
/* Very common errors go here */
-void SDL_Error(SDL_errorcode code)
+void
+SDL_Error(SDL_errorcode code)
{
- switch (code) {
- case SDL_ENOMEM:
- SDL_SetError("Out of memory");
- break;
- case SDL_EFREAD:
- SDL_SetError("Error reading from datastream");
- break;
- case SDL_EFWRITE:
- SDL_SetError("Error writing to datastream");
- break;
- case SDL_EFSEEK:
- SDL_SetError("Error seeking in datastream");
- break;
- default:
- SDL_SetError("Unknown SDL error");
- break;
- }
+ switch (code) {
+ case SDL_ENOMEM:
+ SDL_SetError("Out of memory");
+ break;
+ case SDL_EFREAD:
+ SDL_SetError("Error reading from datastream");
+ break;
+ case SDL_EFWRITE:
+ SDL_SetError("Error writing to datastream");
+ break;
+ case SDL_EFSEEK:
+ SDL_SetError("Error seeking in datastream");
+ break;
+ case SDL_UNSUPPORTED:
+ SDL_SetError("That operation is not supported");
+ break;
+ default:
+ SDL_SetError("Unknown SDL error");
+ break;
+ }
}
#ifdef TEST_ERROR
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
- char buffer[BUFSIZ+1];
+ char buffer[BUFSIZ + 1];
- SDL_SetError("Hi there!");
- printf("Error 1: %s\n", SDL_GetError());
- SDL_ClearError();
- SDL_memset(buffer, '1', BUFSIZ);
- buffer[BUFSIZ] = 0;
- SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
- printf("Error 2: %s\n", SDL_GetError());
- exit(0);
+ SDL_SetError("Hi there!");
+ printf("Error 1: %s\n", SDL_GetError());
+ SDL_ClearError();
+ SDL_memset(buffer, '1', BUFSIZ);
+ buffer[BUFSIZ] = 0;
+ SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
+ printf("Error 2: %s\n", SDL_GetError());
+ exit(0);
}
#endif
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/SDL_error_c.h b/alienblaster/project/jni/sdl/src/SDL_error_c.h
index d8f08ee5e..bdb59517a 100644
--- a/alienblaster/project/jni/sdl/src/SDL_error_c.h
+++ b/alienblaster/project/jni/sdl/src/SDL_error_c.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -31,28 +31,31 @@
#define ERR_MAX_STRLEN 128
#define ERR_MAX_ARGS 5
-typedef struct SDL_error {
- /* This is a numeric value corresponding to the current error */
- int error;
+typedef struct SDL_error
+{
+ /* This is a numeric value corresponding to the current error */
+ int error;
- /* This is a key used to index into a language hashtable containing
- internationalized versions of the SDL error messages. If the key
- is not in the hashtable, or no hashtable is available, the key is
- used directly as an error message format string.
- */
- char key[ERR_MAX_STRLEN];
+ /* This is a key used to index into a language hashtable containing
+ internationalized versions of the SDL error messages. If the key
+ is not in the hashtable, or no hashtable is available, the key is
+ used directly as an error message format string.
+ */
+ char key[ERR_MAX_STRLEN];
- /* These are the arguments for the error functions */
- int argc;
- union {
- void *value_ptr;
-#if 0 /* What is a character anyway? (UNICODE issues) */
- unsigned char value_c;
+ /* These are the arguments for the error functions */
+ int argc;
+ union
+ {
+ void *value_ptr;
+#if 0 /* What is a character anyway? (UNICODE issues) */
+ unsigned char value_c;
#endif
- int value_i;
- double value_f;
- char buf[ERR_MAX_STRLEN];
- } args[ERR_MAX_ARGS];
+ int value_i;
+ double value_f;
+ char buf[ERR_MAX_STRLEN];
+ } args[ERR_MAX_ARGS];
} SDL_error;
#endif /* _SDL_error_c_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/SDL_fatal.c b/alienblaster/project/jni/sdl/src/SDL_fatal.c
index 15c0be7f9..31c1e1921 100644
--- a/alienblaster/project/jni/sdl/src/SDL_fatal.c
+++ b/alienblaster/project/jni/sdl/src/SDL_fatal.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -35,85 +35,88 @@
the program crashes.
*/
-static void SDL_Parachute(int sig)
+static void
+SDL_Parachute(int sig)
{
- signal(sig, SIG_DFL);
- SDL_Quit();
- raise(sig);
+ signal(sig, SIG_DFL);
+ SDL_Quit();
+ raise(sig);
}
-static int SDL_fatal_signals[] = {
- SIGSEGV,
+static const int SDL_fatal_signals[] = {
+ SIGSEGV,
#ifdef SIGBUS
- SIGBUS,
+ SIGBUS,
#endif
#ifdef SIGFPE
- SIGFPE,
+ SIGFPE,
#endif
#ifdef SIGQUIT
- SIGQUIT,
+ SIGQUIT,
#endif
- 0
+ 0
};
-void SDL_InstallParachute(void)
+void
+SDL_InstallParachute(void)
{
- /* Set a handler for any fatal signal not already handled */
- int i;
+ /* Set a handler for any fatal signal not already handled */
+ int i;
#ifdef HAVE_SIGACTION
- struct sigaction action;
+ struct sigaction action;
- for ( i=0; SDL_fatal_signals[i]; ++i ) {
- sigaction(SDL_fatal_signals[i], NULL, &action);
- if ( action.sa_handler == SIG_DFL ) {
- action.sa_handler = SDL_Parachute;
- sigaction(SDL_fatal_signals[i], &action, NULL);
- }
- }
+ for (i = 0; SDL_fatal_signals[i]; ++i) {
+ sigaction(SDL_fatal_signals[i], NULL, &action);
+ if (action.sa_handler == SIG_DFL) {
+ action.sa_handler = SDL_Parachute;
+ sigaction(SDL_fatal_signals[i], &action, NULL);
+ }
+ }
#ifdef SIGALRM
- /* Set SIGALRM to be ignored -- necessary on Solaris */
- sigaction(SIGALRM, NULL, &action);
- if ( action.sa_handler == SIG_DFL ) {
- action.sa_handler = SIG_IGN;
- sigaction(SIGALRM, &action, NULL);
- }
+ /* Set SIGALRM to be ignored -- necessary on Solaris */
+ sigaction(SIGALRM, NULL, &action);
+ if (action.sa_handler == SIG_DFL) {
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGALRM, &action, NULL);
+ }
#endif
#else
- void (*ohandler)(int);
+ void (*ohandler) (int);
- for ( i=0; SDL_fatal_signals[i]; ++i ) {
- ohandler = signal(SDL_fatal_signals[i], SDL_Parachute);
- if ( ohandler != SIG_DFL ) {
- signal(SDL_fatal_signals[i], ohandler);
- }
- }
+ for (i = 0; SDL_fatal_signals[i]; ++i) {
+ ohandler = signal(SDL_fatal_signals[i], SDL_Parachute);
+ if (ohandler != SIG_DFL) {
+ signal(SDL_fatal_signals[i], ohandler);
+ }
+ }
#endif /* HAVE_SIGACTION */
- return;
+ return;
}
-void SDL_UninstallParachute(void)
+void
+SDL_UninstallParachute(void)
{
- /* Remove a handler for any fatal signal handled */
- int i;
+ /* Remove a handler for any fatal signal handled */
+ int i;
#ifdef HAVE_SIGACTION
- struct sigaction action;
+ struct sigaction action;
- for ( i=0; SDL_fatal_signals[i]; ++i ) {
- sigaction(SDL_fatal_signals[i], NULL, &action);
- if ( action.sa_handler == SDL_Parachute ) {
- action.sa_handler = SIG_DFL;
- sigaction(SDL_fatal_signals[i], &action, NULL);
- }
- }
+ for (i = 0; SDL_fatal_signals[i]; ++i) {
+ sigaction(SDL_fatal_signals[i], NULL, &action);
+ if (action.sa_handler == SDL_Parachute) {
+ action.sa_handler = SIG_DFL;
+ sigaction(SDL_fatal_signals[i], &action, NULL);
+ }
+ }
#else
- void (*ohandler)(int);
+ void (*ohandler) (int);
- for ( i=0; SDL_fatal_signals[i]; ++i ) {
- ohandler = signal(SDL_fatal_signals[i], SIG_DFL);
- if ( ohandler != SDL_Parachute ) {
- signal(SDL_fatal_signals[i], ohandler);
- }
- }
+ for (i = 0; SDL_fatal_signals[i]; ++i) {
+ ohandler = signal(SDL_fatal_signals[i], SIG_DFL);
+ if (ohandler != SDL_Parachute) {
+ signal(SDL_fatal_signals[i], ohandler);
+ }
+ }
#endif /* HAVE_SIGACTION */
}
@@ -121,14 +124,17 @@ void SDL_UninstallParachute(void)
/* No signals on this platform, nothing to do.. */
-void SDL_InstallParachute(void)
+void
+SDL_InstallParachute(void)
{
- return;
+ return;
}
-void SDL_UninstallParachute(void)
+void
+SDL_UninstallParachute(void)
{
- return;
+ return;
}
#endif /* HAVE_SIGNAL_H */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/SDL_fatal.h b/alienblaster/project/jni/sdl/src/SDL_fatal.h
index 8211caf42..261b1b4d6 100644
--- a/alienblaster/project/jni/sdl/src/SDL_fatal.h
+++ b/alienblaster/project/jni/sdl/src/SDL_fatal.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -25,4 +25,4 @@
extern void SDL_InstallParachute(void);
extern void SDL_UninstallParachute(void);
-
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/atomic/dummy/SDL_atomic.c b/alienblaster/project/jni/sdl/src/atomic/dummy/SDL_atomic.c
new file mode 100644
index 000000000..c4ee7701b
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/atomic/dummy/SDL_atomic.c
@@ -0,0 +1,469 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+
+ Contributed by Bob Pendleton, bob@pendleton.com
+*/
+
+#include "SDL_stdinc.h"
+#include "SDL_atomic.h"
+
+#include "SDL_error.h"
+
+/*
+ This file provides 32, and 64 bit atomic operations. If the
+ operations are provided by the native hardware and operating system
+ they are used. If they are not then the operations are emulated
+ using the SDL spin lock operations. If spin lock can not be
+ implemented then these functions must fail.
+*/
+
+/*
+ DUMMY VERSION.
+
+ This version of the code assumes there is no support for atomic
+ operations. Therefore, every function sets the SDL error
+ message. Oddly enough, if you only have one thread then this
+ version actuallys works.
+*/
+
+/*
+ Native spinlock routines. Because this is the dummy implementation
+ these will always call SDL_SetError() and do nothing.
+*/
+
+void
+SDL_AtomicLock(SDL_SpinLock *lock)
+{
+ SDL_SetError("SDL_atomic.c: is not implemented on this platform");
+}
+
+void
+SDL_AtomicUnlock(SDL_SpinLock *lock)
+{
+ SDL_SetError("SDL_atomic.c: is not implemented on this platform");
+}
+
+/*
+ Note that platform specific versions can be built from this version
+ by changing the #undefs to #defines and adding platform specific
+ code.
+*/
+
+#undef nativeTestThenSet32
+#undef nativeClear32
+#undef nativeFetchThenIncrement32
+#undef nativeFetchThenDecrement32
+#undef nativeFetchThenAdd32
+#undef nativeFetchThenSubtract32
+#undef nativeIncrementThenFetch32
+#undef nativeDecrementThenFetch32
+#undef nativeAddThenFetch32
+#undef nativeSubtractThenFetch32
+
+#undef nativeTestThenSet64
+#undef nativeClear64
+#undef nativeFetchThenIncrement64
+#undef nativeFetchThenDecrement64
+#undef nativeFetchThenAdd64
+#undef nativeFetchThenSubtract64
+#undef nativeIncrementThenFetch64
+#undef nativeDecrementThenFetch64
+#undef nativeAddThenFetch64
+#undef nativeSubtractThenFetch64
+
+/*
+ If any of the operations are not provided then we must emulate some
+ of them. That means we need a nice implementation of spin locks
+ that avoids the "one big lock" problem. We use a vector of spin
+ locks and pick which one to use based on the address of the operand
+ of the function.
+
+ To generate the index of the lock we first shift by 3 bits to get
+ rid on the zero bits that result from 32 and 64 bit allignment of
+ data. We then mask off all but 5 bits and use those 5 bits as an
+ index into the table.
+
+ Picking the lock this way insures that accesses to the same data at
+ the same time will go to the same lock. OTOH, accesses to different
+ data have only a 1/32 chance of hitting the same lock. That should
+ pretty much eliminate the chances of several atomic operations on
+ different data from waiting on the same "big lock". If it isn't
+ then the table of locks can be expanded to a new size so long as
+ the new size is a power of two.
+*/
+
+static SDL_SpinLock locks[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static __inline__ void
+privateWaitLock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicLock(&locks[index]);
+}
+
+static __inline__ void
+privateUnlock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicUnlock(&locks[index]);
+}
+
+/* 32 bit atomic operations */
+
+SDL_bool
+SDL_AtomicTestThenSet32(volatile Uint32 * ptr)
+{
+#ifdef nativeTestThenSet32
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear32(volatile Uint32 * ptr)
+{
+#ifdef nativeClear32
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenIncrement32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenDecrement32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenAdd32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenSubtract32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeIncrementThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeDecrementThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeAddThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeSubtractThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+/* 64 bit atomic operations */
+#ifdef SDL_HAS_64BIT_TYPE
+
+SDL_bool
+SDL_AtomicTestThenSet64(volatile Uint64 * ptr)
+{
+#ifdef nativeTestThenSet64
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear64(volatile Uint64 * ptr)
+{
+#ifdef nativeClear64
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenIncrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenDecrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenAdd64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenSubtract64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeIncrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeDecrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeAddThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeSubtractThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+#endif
+
diff --git a/alienblaster/project/jni/sdl/src/atomic/linux/SDL_atomic.c b/alienblaster/project/jni/sdl/src/atomic/linux/SDL_atomic.c
new file mode 100644
index 000000000..7b74a962d
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/atomic/linux/SDL_atomic.c
@@ -0,0 +1,510 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+
+ Contributed by Bob Pendleton, bob@pendleton.com
+*/
+
+#include "SDL_stdinc.h"
+#include "SDL_atomic.h"
+
+#include "SDL_error.h"
+
+/*
+ This file provides 32, and 64 bit atomic operations. If the
+ operations are provided by the native hardware and operating system
+ they are used. If they are not then the operations are emulated
+ using the SDL spin lock operations. If spin lock can not be
+ implemented then these functions must fail.
+*/
+
+/*
+ LINUX/GCC VERSION.
+
+ This version of the code assumes support of the atomic builtins as
+ documented at gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html This
+ code should work on any modern x86 or other processor supported by
+ GCC.
+
+ Some processors will only support some of these operations so
+ #ifdefs will have to be added as incompatibilities are discovered
+*/
+
+/*
+ Native spinlock routines.
+*/
+
+void
+SDL_AtomicLock(SDL_SpinLock *lock)
+{
+ while (0 != __sync_lock_test_and_set(lock, 1))
+ {
+ }
+}
+
+void
+SDL_AtomicUnlock(SDL_SpinLock *lock)
+{
+ __sync_lock_test_and_set(lock, 0);
+}
+
+/*
+ Note that platform specific versions can be built from this version
+ by changing the #undefs to #defines and adding platform specific
+ code.
+*/
+
+#define nativeTestThenSet32
+#define nativeClear32
+#define nativeFetchThenIncrement32
+#define nativeFetchThenDecrement32
+#define nativeFetchThenAdd32
+#define nativeFetchThenSubtract32
+#define nativeIncrementThenFetch32
+#define nativeDecrementThenFetch32
+#define nativeAddThenFetch32
+#define nativeSubtractThenFetch32
+
+#ifdef SDL_HAS_64BIT_TYPE
+ #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+ #define nativeTestThenSet64
+ #define nativeClear64
+ #define nativeFetchThenIncrement64
+ #define nativeFetchThenDecrement64
+ #define nativeFetchThenAdd64
+ #define nativeFetchThenSubtract64
+ #define nativeIncrementThenFetch64
+ #define nativeDecrementThenFetch64
+ #define nativeAddThenFetch64
+ #define nativeSubtractThenFetch64
+ #else
+ #undef nativeTestThenSet64
+ #undef nativeClear64
+ #undef nativeFetchThenIncrement64
+ #undef nativeFetchThenDecrement64
+ #undef nativeFetchThenAdd64
+ #undef nativeFetchThenSubtract64
+ #undef nativeIncrementThenFetch64
+ #undef nativeDecrementThenFetch64
+ #undef nativeAddThenFetch64
+ #undef nativeSubtractThenFetch64
+ #endif /* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 */
+#endif /* SDL_HAS_64BIT_TYPE */
+
+/*
+ If any of the operations are not provided then we must emulate some
+ of them. That means we need a nice implementation of spin locks
+ that avoids the "one big lock" problem. We use a vector of spin
+ locks and pick which one to use based on the address of the operand
+ of the function.
+
+ To generate the index of the lock we first shift by 3 bits to get
+ rid on the zero bits that result from 32 and 64 bit allignment of
+ data. We then mask off all but 5 bits and use those 5 bits as an
+ index into the table.
+
+ Picking the lock this way insures that accesses to the same data at
+ the same time will go to the same lock. OTOH, accesses to different
+ data have only a 1/32 chance of hitting the same lock. That should
+ pretty much eliminate the chances of several atomic operations on
+ different data from waiting on the same "big lock". If it isn't
+ then the table of locks can be expanded to a new size so long as
+ the new size is a power of two.
+*/
+
+static SDL_SpinLock locks[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static __inline__ void
+privateWaitLock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicLock(&locks[index]);
+}
+
+static __inline__ void
+privateUnlock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicUnlock(&locks[index]);
+}
+
+/* 32 bit atomic operations */
+
+SDL_bool
+SDL_AtomicTestThenSet32(volatile Uint32 * ptr)
+{
+#ifdef nativeTestThenSet32
+ return 0 == __sync_lock_test_and_set(ptr, 1);
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear32(volatile Uint32 * ptr)
+{
+#ifdef nativeClear32
+ __sync_lock_test_and_set(ptr, 0);
+ return;
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenIncrement32
+ return __sync_fetch_and_add(ptr, 1);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenDecrement32
+ return __sync_fetch_and_sub(ptr, 1);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenAdd32
+ return __sync_fetch_and_add(ptr, value);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenSubtract32
+ return __sync_fetch_and_sub(ptr, value);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeIncrementThenFetch32
+ return __sync_add_and_fetch(ptr, 1);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeDecrementThenFetch32
+ return __sync_sub_and_fetch(ptr, 1);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeAddThenFetch32
+ return __sync_add_and_fetch(ptr, value);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeSubtractThenFetch32
+ return __sync_sub_and_fetch(ptr, value);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+/* 64 bit atomic operations */
+#ifdef SDL_HAS_64BIT_TYPE
+
+SDL_bool
+SDL_AtomicTestThenSet64(volatile Uint64 * ptr)
+{
+#ifdef nativeTestThenSet64
+ return 0 == __sync_lock_test_and_set(ptr, 1);
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear64(volatile Uint64 * ptr)
+{
+#ifdef nativeClear64
+ __sync_lock_test_and_set(ptr, 0);
+ return;
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenIncrement64
+ return __sync_fetch_and_add(ptr, 1);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenDecrement64
+ return __sync_fetch_and_sub(ptr, 1);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenAdd64
+ return __sync_fetch_and_add(ptr, value);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenSubtract64
+ return __sync_fetch_and_sub(ptr, value);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeIncrementThenFetch64
+ return __sync_add_and_fetch(ptr, 1);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeDecrementThenFetch64
+ return __sync_sub_and_fetch(ptr, 1);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeAddThenFetch64
+ return __sync_add_and_fetch(ptr, value);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeSubtractThenFetch64
+ return __sync_sub_and_fetch(ptr, value);
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+#endif /* SDL_HAS_64BIT_TYPE */
diff --git a/alienblaster/project/jni/sdl/src/atomic/macosx/SDL_atomic.c b/alienblaster/project/jni/sdl/src/atomic/macosx/SDL_atomic.c
new file mode 100644
index 000000000..c4ee7701b
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/atomic/macosx/SDL_atomic.c
@@ -0,0 +1,469 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+
+ Contributed by Bob Pendleton, bob@pendleton.com
+*/
+
+#include "SDL_stdinc.h"
+#include "SDL_atomic.h"
+
+#include "SDL_error.h"
+
+/*
+ This file provides 32, and 64 bit atomic operations. If the
+ operations are provided by the native hardware and operating system
+ they are used. If they are not then the operations are emulated
+ using the SDL spin lock operations. If spin lock can not be
+ implemented then these functions must fail.
+*/
+
+/*
+ DUMMY VERSION.
+
+ This version of the code assumes there is no support for atomic
+ operations. Therefore, every function sets the SDL error
+ message. Oddly enough, if you only have one thread then this
+ version actuallys works.
+*/
+
+/*
+ Native spinlock routines. Because this is the dummy implementation
+ these will always call SDL_SetError() and do nothing.
+*/
+
+void
+SDL_AtomicLock(SDL_SpinLock *lock)
+{
+ SDL_SetError("SDL_atomic.c: is not implemented on this platform");
+}
+
+void
+SDL_AtomicUnlock(SDL_SpinLock *lock)
+{
+ SDL_SetError("SDL_atomic.c: is not implemented on this platform");
+}
+
+/*
+ Note that platform specific versions can be built from this version
+ by changing the #undefs to #defines and adding platform specific
+ code.
+*/
+
+#undef nativeTestThenSet32
+#undef nativeClear32
+#undef nativeFetchThenIncrement32
+#undef nativeFetchThenDecrement32
+#undef nativeFetchThenAdd32
+#undef nativeFetchThenSubtract32
+#undef nativeIncrementThenFetch32
+#undef nativeDecrementThenFetch32
+#undef nativeAddThenFetch32
+#undef nativeSubtractThenFetch32
+
+#undef nativeTestThenSet64
+#undef nativeClear64
+#undef nativeFetchThenIncrement64
+#undef nativeFetchThenDecrement64
+#undef nativeFetchThenAdd64
+#undef nativeFetchThenSubtract64
+#undef nativeIncrementThenFetch64
+#undef nativeDecrementThenFetch64
+#undef nativeAddThenFetch64
+#undef nativeSubtractThenFetch64
+
+/*
+ If any of the operations are not provided then we must emulate some
+ of them. That means we need a nice implementation of spin locks
+ that avoids the "one big lock" problem. We use a vector of spin
+ locks and pick which one to use based on the address of the operand
+ of the function.
+
+ To generate the index of the lock we first shift by 3 bits to get
+ rid on the zero bits that result from 32 and 64 bit allignment of
+ data. We then mask off all but 5 bits and use those 5 bits as an
+ index into the table.
+
+ Picking the lock this way insures that accesses to the same data at
+ the same time will go to the same lock. OTOH, accesses to different
+ data have only a 1/32 chance of hitting the same lock. That should
+ pretty much eliminate the chances of several atomic operations on
+ different data from waiting on the same "big lock". If it isn't
+ then the table of locks can be expanded to a new size so long as
+ the new size is a power of two.
+*/
+
+static SDL_SpinLock locks[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static __inline__ void
+privateWaitLock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicLock(&locks[index]);
+}
+
+static __inline__ void
+privateUnlock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicUnlock(&locks[index]);
+}
+
+/* 32 bit atomic operations */
+
+SDL_bool
+SDL_AtomicTestThenSet32(volatile Uint32 * ptr)
+{
+#ifdef nativeTestThenSet32
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear32(volatile Uint32 * ptr)
+{
+#ifdef nativeClear32
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenIncrement32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenDecrement32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenAdd32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenSubtract32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeIncrementThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeDecrementThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeAddThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeSubtractThenFetch32
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+/* 64 bit atomic operations */
+#ifdef SDL_HAS_64BIT_TYPE
+
+SDL_bool
+SDL_AtomicTestThenSet64(volatile Uint64 * ptr)
+{
+#ifdef nativeTestThenSet64
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear64(volatile Uint64 * ptr)
+{
+#ifdef nativeClear64
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenIncrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenDecrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenAdd64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenSubtract64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeIncrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeDecrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeAddThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeSubtractThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+#endif
+
diff --git a/alienblaster/project/jni/sdl/src/atomic/qnx/SDL_atomic.c b/alienblaster/project/jni/sdl/src/atomic/qnx/SDL_atomic.c
new file mode 100644
index 000000000..d9f51df9a
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/atomic/qnx/SDL_atomic.c
@@ -0,0 +1,505 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+
+ QNX native atomic operations
+ Copyright (C) 2009 Mike Gorchak
+ (mike@malva.ua, lestat@i.com.ua)
+*/
+
+#include "SDL_stdinc.h"
+#include "SDL_atomic.h"
+#include "SDL_error.h"
+
+#include
+
+/* SMP Exchange for PPC platform */
+#ifdef __PPC__
+#include
+#endif /* __PPC__ */
+
+/* SMP Exchange for ARM platform */
+#ifdef __ARM__
+#include
+#endif /* __ARM__ */
+
+/* SMP Exchange for MIPS platform */
+#if defined (__MIPSEB__) || defined(__MIPSEL__)
+#include
+#endif /* __MIPSEB__ || __MIPSEL__ */
+
+/* SMP Exchange for SH platform */
+#ifdef __SH__
+#include
+#endif /* __SH__ */
+
+/* SMP Exchange for x86 platform */
+#ifdef __X86__
+#include
+#endif /* __X86__ */
+
+/*
+ This file provides 32, and 64 bit atomic operations. If the
+ operations are provided by the native hardware and operating system
+ they are used. If they are not then the operations are emulated
+ using the SDL spin lock operations. If spin lock can not be
+ implemented then these functions must fail.
+*/
+
+void
+SDL_AtomicLock(SDL_SpinLock *lock)
+{
+ unsigned volatile* l = (unsigned volatile*)lock;
+ Uint32 oldval = 0;
+ Uint32 newval = 1;
+
+ oldval = _smp_xchg(l, newval);
+ while(1 == oldval)
+ {
+ oldval = _smp_xchg(l, newval);
+ }
+}
+
+void
+SDL_AtomicUnlock(SDL_SpinLock *lock)
+{
+ unsigned volatile* l = (unsigned volatile*)lock;
+ Uint32 newval = 0;
+
+ _smp_xchg(l, newval);
+}
+
+/*
+ QNX 6.4.1 supports only 32 bit atomic access
+*/
+
+#undef nativeTestThenSet32
+#define nativeClear32
+#define nativeFetchThenIncrement32
+#define nativeFetchThenDecrement32
+#define nativeFetchThenAdd32
+#define nativeFetchThenSubtract32
+#define nativeIncrementThenFetch32
+#define nativeDecrementThenFetch32
+#define nativeAddThenFetch32
+#define nativeSubtractThenFetch32
+
+#undef nativeTestThenSet64
+#undef nativeClear64
+#undef nativeFetchThenIncrement64
+#undef nativeFetchThenDecrement64
+#undef nativeFetchThenAdd64
+#undef nativeFetchThenSubtract64
+#undef nativeIncrementThenFetch64
+#undef nativeDecrementThenFetch64
+#undef nativeAddThenFetch64
+#undef nativeSubtractThenFetch64
+
+/*
+ If any of the operations are not provided then we must emulate some
+ of them. That means we need a nice implementation of spin locks
+ that avoids the "one big lock" problem. We use a vector of spin
+ locks and pick which one to use based on the address of the operand
+ of the function.
+
+ To generate the index of the lock we first shift by 3 bits to get
+ rid on the zero bits that result from 32 and 64 bit allignment of
+ data. We then mask off all but 5 bits and use those 5 bits as an
+ index into the table.
+
+ Picking the lock this way insures that accesses to the same data at
+ the same time will go to the same lock. OTOH, accesses to different
+ data have only a 1/32 chance of hitting the same lock. That should
+ pretty much eliminate the chances of several atomic operations on
+ different data from waiting on the same "big lock". If it isn't
+ then the table of locks can be expanded to a new size so long as
+ the new size is a power of two.
+*/
+
+static SDL_SpinLock locks[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static __inline__ void
+privateWaitLock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif /* SIZEOF_VOIDP */
+
+ SDL_AtomicLock(&locks[index]);
+}
+
+static __inline__ void
+privateUnlock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif /* SIZEOF_VOIDP */
+
+ SDL_AtomicUnlock(&locks[index]);
+}
+
+/* 32 bit atomic operations */
+
+SDL_bool
+SDL_AtomicTestThenSet32(volatile Uint32 * ptr)
+{
+#ifdef nativeTestThenSet32
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif /* nativeTestThenSet32 */
+}
+
+void
+SDL_AtomicClear32(volatile Uint32 * ptr)
+{
+#ifdef nativeClear32
+ atomic_clr(ptr, 0xFFFFFFFF);
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif /* nativeClear32 */
+}
+
+Uint32
+SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenIncrement32
+ return atomic_add_value(ptr, 0x00000001);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenIncrement32 */
+}
+
+Uint32
+SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenDecrement32
+ return atomic_sub_value(ptr, 0x00000001);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenDecrement32 */
+}
+
+Uint32
+SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenAdd32
+ return atomic_add_value(ptr, value);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenAdd32 */
+}
+
+Uint32
+SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenSubtract32
+ return atomic_sub_value(ptr, value);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenSubtract32 */
+}
+
+Uint32
+SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeIncrementThenFetch32
+ atomic_add(ptr, 0x00000001);
+ return atomic_add_value(ptr, 0x00000000);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeIncrementThenFetch32 */
+}
+
+Uint32
+SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeDecrementThenFetch32
+ atomic_sub(ptr, 0x00000001);
+ return atomic_sub_value(ptr, 0x00000000);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeDecrementThenFetch32 */
+}
+
+Uint32
+SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeAddThenFetch32
+ atomic_add(ptr, value);
+ return atomic_add_value(ptr, 0x00000000);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeAddThenFetch32 */
+}
+
+Uint32
+SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeSubtractThenFetch32
+ atomic_sub(ptr, value);
+ return atomic_sub_value(ptr, 0x00000000);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeSubtractThenFetch32 */
+}
+
+/* 64 bit atomic operations */
+#ifdef SDL_HAS_64BIT_TYPE
+
+SDL_bool
+SDL_AtomicTestThenSet64(volatile Uint64 * ptr)
+{
+#ifdef nativeTestThenSet64
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif /* nativeTestThenSet64 */
+}
+
+void
+SDL_AtomicClear64(volatile Uint64 * ptr)
+{
+#ifdef nativeClear64
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif /* nativeClear64 */
+}
+
+Uint64
+SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenIncrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenIncrement64 */
+}
+
+Uint64
+SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenDecrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenDecrement64 */
+}
+
+Uint64
+SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenAdd64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenAdd64 */
+}
+
+Uint64
+SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenSubtract64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeFetchThenSubtract64 */
+}
+
+Uint64
+SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeIncrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeIncrementThenFetch64 */
+}
+
+Uint64
+SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeDecrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeDecrementThenFetch64 */
+}
+
+Uint64
+SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeAddThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeAddThenFetch64 */
+}
+
+Uint64
+SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeSubtractThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif /* nativeSubtractThenFetch64 */
+}
+
+#endif /* SDL_HAS_64BIT_TYPE */
diff --git a/alienblaster/project/jni/sdl/src/atomic/win32/SDL_atomic.c b/alienblaster/project/jni/sdl/src/atomic/win32/SDL_atomic.c
new file mode 100644
index 000000000..e009fd0d2
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/atomic/win32/SDL_atomic.c
@@ -0,0 +1,512 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+
+ Contributed by Bob Pendleton, bob@pendleton.com
+*/
+
+#include "SDL_stdinc.h"
+#include "SDL_atomic.h"
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+#include "SDL_error.h"
+
+/*
+ This file provides 32, and 64 bit atomic operations. If the
+ operations are provided by the native hardware and operating system
+ they are used. If they are not then the operations are emulated
+ using the SDL spin lock operations. If spin lock can not be
+ implemented then these functions must fail.
+*/
+
+/*
+ WIN32 VERSION.
+
+ This makes use of native Windows atomic operations.
+*/
+
+/*
+ Native spinlock routines. Because this is the dummy implementation
+ these will always call SDL_SetError() and do nothing.
+*/
+
+void
+SDL_AtomicLock(SDL_SpinLock *lock)
+{
+ long volatile * l = (long volatile *)lock;
+ Uint32 old = 0;
+ Uint32 new = 1;
+
+ old = InterlockedExchange(l, new);
+ while(1 == old)
+ {
+ old = InterlockedExchange(l, new);
+ }
+}
+
+void
+SDL_AtomicUnlock(SDL_SpinLock *lock)
+{
+ long volatile * l = (long volatile *)lock;
+ Uint32 new = 0;
+
+ InterlockedExchange(l, new);
+}
+
+/*
+ Note that platform specific versions can be built from this version
+ by changing the #undefs to #defines and adding platform specific
+ code.
+*/
+
+#define nativeTestThenSet32
+#define nativeClear32
+#define nativeFetchThenIncrement32
+#define nativeFetchThenDecrement32
+#define nativeFetchThenAdd32
+#define nativeFetchThenSubtract32
+#define nativeIncrementThenFetch32
+#define nativeDecrementThenFetch32
+#define nativeAddThenFetch32
+#define nativeSubtractThenFetch32
+
+#undef nativeTestThenSet64
+#undef nativeClear64
+#undef nativeFetchThenIncrement64
+#undef nativeFetchThenDecrement64
+#undef nativeFetchThenAdd64
+#undef nativeFetchThenSubtract64
+#undef nativeIncrementThenFetch64
+#undef nativeDecrementThenFetch64
+#undef nativeAddThenFetch64
+#undef nativeSubtractThenFetch64
+
+/*
+ If any of the operations are not provided then we must emulate some
+ of them. That means we need a nice implementation of spin locks
+ that avoids the "one big lock" problem. We use a vector of spin
+ locks and pick which one to use based on the address of the operand
+ of the function.
+
+ To generate the index of the lock we first shift by 3 bits to get
+ rid on the zero bits that result from 32 and 64 bit allignment of
+ data. We then mask off all but 5 bits and use those 5 bits as an
+ index into the table.
+
+ Picking the lock this way insures that accesses to the same data at
+ the same time will go to the same lock. OTOH, accesses to different
+ data have only a 1/32 chance of hitting the same lock. That should
+ pretty much eliminate the chances of several atomic operations on
+ different data from waiting on the same "big lock". If it isn't
+ then the table of locks can be expanded to a new size so long as
+ the new size is a power of two.
+*/
+
+static SDL_SpinLock locks[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static __inline__ void
+privateWaitLock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicLock(&locks[index]);
+}
+
+static __inline__ void
+privateUnlock(volatile void *ptr)
+{
+#if SIZEOF_VOIDP == 4
+ Uint32 index = ((((Uint32)ptr) >> 3) & 0x1f);
+#elif SIZEOF_VOIDP == 8
+ Uint64 index = ((((Uint64)ptr) >> 3) & 0x1f);
+#endif
+
+ SDL_AtomicUnlock(&locks[index]);
+}
+
+/* 32 bit atomic operations */
+
+SDL_bool
+SDL_AtomicTestThenSet32(volatile Uint32 * ptr)
+{
+#ifdef nativeTestThenSet32
+ long volatile * p = (long volatile *)ptr;
+ Uint32 new = 1;
+
+ return 0 == InterlockedExchange(p, new);
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear32(volatile Uint32 * ptr)
+{
+#ifdef nativeClear32
+ long volatile * p = (long volatile *)ptr;
+ Uint32 new = 0;
+
+ InterlockedExchange(p, new);
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenIncrement32
+ long volatile * p = (long volatile *)ptr;
+
+ return InterlockedExchangeAdd(p, 1);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr)
+{
+#ifdef nativeFetchThenDecrement32
+ long volatile * p = (long volatile *)ptr;
+
+ return InterlockedExchangeAdd(p, -1);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenAdd32
+ long volatile * p = (long volatile *)ptr;
+
+ return InterlockedExchangeAdd(p, value);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeFetchThenSubtract32
+ long volatile * p = (long volatile *)ptr;
+
+ return InterlockedExchangeAdd(p, (0 - value));
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeIncrementThenFetch32
+ long volatile * p = (LONG volatile *)ptr;
+
+ return InterlockedIncrement(p);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr)
+{
+#ifdef nativeDecrementThenFetch32
+ long volatile * p = (LONG volatile *)ptr;
+
+ return InterlockedDecrement(p);
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeAddThenFetch32
+ long volatile * p = (long volatile *)ptr;
+
+ return InterlockedExchangeAdd(p, value) + value;
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint32
+SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value)
+{
+#ifdef nativeSubtractThenFetch32
+ long volatile * p = (long volatile *)ptr;
+
+ return InterlockedExchangeAdd(p, (0 - value)) - value;
+#else
+ Uint32 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+/* 64 bit atomic operations */
+#ifdef SDL_HAS_64BIT_TYPE
+
+SDL_bool
+SDL_AtomicTestThenSet64(volatile Uint64 * ptr)
+{
+#ifdef nativeTestThenSet64
+#else
+ SDL_bool result = SDL_FALSE;
+
+ privateWaitLock(ptr);
+ result = (*ptr == 0);
+ if (result)
+ {
+ *ptr = 1;
+ }
+ privateUnlock(ptr);
+
+ return result;
+#endif
+}
+
+void
+SDL_AtomicClear64(volatile Uint64 * ptr)
+{
+#ifdef nativeClear64
+#else
+ privateWaitLock(ptr);
+ *ptr = 0;
+ privateUnlock(ptr);
+
+ return;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenIncrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr)
+{
+#ifdef nativeFetchThenDecrement64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr) -= 1;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenAdd64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)+= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeFetchThenSubtract64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ tmp = *ptr;
+ (*ptr)-= value;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeIncrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr)
+{
+#ifdef nativeDecrementThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= 1;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeAddThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)+= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+
+Uint64
+SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value)
+{
+#ifdef nativeSubtractThenFetch64
+#else
+ Uint64 tmp = 0;
+
+ privateWaitLock(ptr);
+ (*ptr)-= value;
+ tmp = *ptr;
+ privateUnlock(ptr);
+
+ return tmp;
+#endif
+}
+#endif
+
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_audio.c b/alienblaster/project/jni/sdl/src/audio/SDL_audio.c
index 9e0a1aae4..6ce18145c 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_audio.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_audio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,675 +24,1189 @@
/* Allow access to a raw mixing buffer */
#include "SDL.h"
+#include "SDL_audio.h"
#include "SDL_audio_c.h"
#include "SDL_audiomem.h"
#include "SDL_sysaudio.h"
-#ifdef __OS2__
-/* We'll need the DosSetPriority() API! */
-#define INCL_DOSPROCESS
-#include
-#endif
+#define _THIS SDL_AudioDevice *this
+
+static SDL_AudioDriver current_audio;
+static SDL_AudioDevice *open_devices[16];
+
+/* !!! FIXME: These are wordy and unlocalized... */
+#define DEFAULT_OUTPUT_DEVNAME "System audio output device"
+#define DEFAULT_INPUT_DEVNAME "System audio capture device"
+
+
+/*
+ * Not all of these will be compiled and linked in, but it's convenient
+ * to have a complete list here and saves yet-another block of #ifdefs...
+ * Please see bootstrap[], below, for the actual #ifdef mess.
+ */
+extern AudioBootStrap BSD_AUDIO_bootstrap;
+extern AudioBootStrap DSP_bootstrap;
+extern AudioBootStrap DMA_bootstrap;
+extern AudioBootStrap ALSA_bootstrap;
+extern AudioBootStrap PULSEAUDIO_bootstrap;
+extern AudioBootStrap QSAAUDIO_bootstrap;
+extern AudioBootStrap SUNAUDIO_bootstrap;
+extern AudioBootStrap DMEDIA_bootstrap;
+extern AudioBootStrap ARTS_bootstrap;
+extern AudioBootStrap ESD_bootstrap;
+extern AudioBootStrap NAS_bootstrap;
+extern AudioBootStrap DSOUND_bootstrap;
+extern AudioBootStrap WINWAVEOUT_bootstrap;
+extern AudioBootStrap PAUDIO_bootstrap;
+extern AudioBootStrap BEOSAUDIO_bootstrap;
+extern AudioBootStrap COREAUDIO_bootstrap;
+extern AudioBootStrap COREAUDIOIPHONE_bootstrap;
+extern AudioBootStrap SNDMGR_bootstrap;
+extern AudioBootStrap DISKAUD_bootstrap;
+extern AudioBootStrap DUMMYAUD_bootstrap;
+extern AudioBootStrap DCAUD_bootstrap;
+extern AudioBootStrap MMEAUDIO_bootstrap;
+extern AudioBootStrap DART_bootstrap;
+extern AudioBootStrap NDSAUD_bootstrap;
+extern AudioBootStrap FUSIONSOUND_bootstrap;
+extern AudioBootStrap ANDROIDAUD_bootstrap;
+
/* Available audio drivers */
-static AudioBootStrap *bootstrap[] = {
+static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_BSD
- &BSD_AUDIO_bootstrap,
+ &BSD_AUDIO_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_PULSE
- &PULSE_bootstrap,
+#if SDL_AUDIO_DRIVER_PULSEAUDIO
+ &PULSEAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_ALSA
- &ALSA_bootstrap,
+ &ALSA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_OSS
- &DSP_bootstrap,
- &DMA_bootstrap,
+ &DSP_bootstrap,
+ &DMA_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_QNXNTO
- &QNXNTOAUDIO_bootstrap,
+#if SDL_AUDIO_DRIVER_QSA
+ &QSAAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_SUNAUDIO
- &SUNAUDIO_bootstrap,
+ &SUNAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DMEDIA
- &DMEDIA_bootstrap,
+ &DMEDIA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_ARTS
- &ARTS_bootstrap,
+ &ARTS_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_ESD
- &ESD_bootstrap,
+ &ESD_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_NAS
- &NAS_bootstrap,
+ &NAS_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DSOUND
- &DSOUND_bootstrap,
+ &DSOUND_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_WAVEOUT
- &WAVEOUT_bootstrap,
+#if SDL_AUDIO_DRIVER_WINWAVEOUT
+ &WINWAVEOUT_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_PAUD
- &Paud_bootstrap,
+#if SDL_AUDIO_DRIVER_PAUDIO
+ &PAUDIO_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_BAUDIO
- &BAUDIO_bootstrap,
+#if SDL_AUDIO_DRIVER_BEOSAUDIO
+ &BEOSAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_COREAUDIO
- &COREAUDIO_bootstrap,
+ &COREAUDIO_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_SNDMGR
- &SNDMGR_bootstrap,
-#endif
-#if SDL_AUDIO_DRIVER_MINT
- &MINTAUDIO_GSXB_bootstrap,
- &MINTAUDIO_MCSN_bootstrap,
- &MINTAUDIO_STFA_bootstrap,
- &MINTAUDIO_XBIOS_bootstrap,
- &MINTAUDIO_DMA8_bootstrap,
+#if SDL_AUDIO_DRIVER_COREAUDIOIPHONE
+ &COREAUDIOIPHONE_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DISK
- &DISKAUD_bootstrap,
+ &DISKAUD_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DUMMY
- &DUMMYAUD_bootstrap,
-#endif
-#if SDL_AUDIO_DRIVER_DC
- &DCAUD_bootstrap,
-#endif
-#if SDL_AUDIO_DRIVER_NDS
- &NDSAUD_bootstrap,
+ &DUMMYAUD_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_MMEAUDIO
- &MMEAUDIO_bootstrap,
+ &MMEAUDIO_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_DART
- &DART_bootstrap,
+#if SDL_AUDIO_DRIVER_NDS
+ &NDSAUD_bootstrap,
#endif
-#if SDL_AUDIO_DRIVER_EPOCAUDIO
- &EPOCAudio_bootstrap,
+#if SDL_AUDIO_DRIVER_FUSIONSOUND
+ &FUSIONSOUND_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_ANDROID
&ANDROIDAUD_bootstrap,
#endif
- NULL
+ NULL
};
-SDL_AudioDevice *current_audio = NULL;
-/* Various local functions */
-int SDL_AudioInit(const char *driver_name);
-void SDL_AudioQuit(void);
+static SDL_AudioDevice *
+get_audio_device(SDL_AudioDeviceID id)
+{
+ id--;
+ if ((id >= SDL_arraysize(open_devices)) || (open_devices[id] == NULL)) {
+ SDL_SetError("Invalid audio device ID");
+ return NULL;
+ }
+
+ return open_devices[id];
+}
+
+
+/* stubs for audio drivers that don't need a specific entry point... */
+static int
+SDL_AudioDetectDevices_Default(int iscapture)
+{
+ return -1;
+}
+
+static void
+SDL_AudioThreadInit_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioWaitDevice_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioPlayDevice_Default(_THIS)
+{ /* no-op. */
+}
+
+static Uint8 *
+SDL_AudioGetDeviceBuf_Default(_THIS)
+{
+ return NULL;
+}
+
+static void
+SDL_AudioWaitDone_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioCloseDevice_Default(_THIS)
+{ /* no-op. */
+}
+
+static void
+SDL_AudioDeinitialize_Default(void)
+{ /* no-op. */
+}
+
+static int
+SDL_AudioOpenDevice_Default(_THIS, const char *devname, int iscapture)
+{
+ return 0;
+}
+
+static const char *
+SDL_AudioGetDeviceName_Default(int index, int iscapture)
+{
+ SDL_SetError("No such device");
+ return NULL;
+}
+
+static void
+SDL_AudioLockDevice_Default(SDL_AudioDevice * device)
+{
+ if (device->thread && (SDL_ThreadID() == device->threadid)) {
+ return;
+ }
+ SDL_mutexP(device->mixer_lock);
+}
+
+static void
+SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device)
+{
+ if (device->thread && (SDL_ThreadID() == device->threadid)) {
+ return;
+ }
+ SDL_mutexV(device->mixer_lock);
+}
+
+
+static void
+finalize_audio_entry_points(void)
+{
+ /*
+ * Fill in stub functions for unused driver entry points. This lets us
+ * blindly call them without having to check for validity first.
+ */
+
+#define FILL_STUB(x) \
+ if (current_audio.impl.x == NULL) { \
+ current_audio.impl.x = SDL_Audio##x##_Default; \
+ }
+ FILL_STUB(DetectDevices);
+ FILL_STUB(GetDeviceName);
+ FILL_STUB(OpenDevice);
+ FILL_STUB(ThreadInit);
+ FILL_STUB(WaitDevice);
+ FILL_STUB(PlayDevice);
+ FILL_STUB(GetDeviceBuf);
+ FILL_STUB(WaitDone);
+ FILL_STUB(CloseDevice);
+ FILL_STUB(LockDevice);
+ FILL_STUB(UnlockDevice);
+ FILL_STUB(Deinitialize);
+#undef FILL_STUB
+}
+
+/* Streaming functions (for when the input and output buffer sizes are different) */
+/* Write [length] bytes from buf into the streamer */
+void
+SDL_StreamWrite(SDL_AudioStreamer * stream, Uint8 * buf, int length)
+{
+ int i;
+
+ for (i = 0; i < length; ++i) {
+ stream->buffer[stream->write_pos] = buf[i];
+ ++stream->write_pos;
+ }
+}
+
+/* Read [length] bytes out of the streamer into buf */
+void
+SDL_StreamRead(SDL_AudioStreamer * stream, Uint8 * buf, int length)
+{
+ int i;
+
+ for (i = 0; i < length; ++i) {
+ buf[i] = stream->buffer[stream->read_pos];
+ ++stream->read_pos;
+ }
+}
+
+int
+SDL_StreamLength(SDL_AudioStreamer * stream)
+{
+ return (stream->write_pos - stream->read_pos) % stream->max_len;
+}
+
+/* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */
+int
+SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence)
+{
+ /* First try to allocate the buffer */
+ stream->buffer = (Uint8 *) SDL_malloc(max_len);
+ if (stream->buffer == NULL) {
+ return -1;
+ }
+
+ stream->max_len = max_len;
+ stream->read_pos = 0;
+ stream->write_pos = 0;
+
+ /* Zero out the buffer */
+ SDL_memset(stream->buffer, silence, max_len);
+
+ return 0;
+}
+
+/* Deinitialize the stream simply by freeing the buffer */
+void
+SDL_StreamDeinit(SDL_AudioStreamer * stream)
+{
+ if (stream->buffer != NULL) {
+ SDL_free(stream->buffer);
+ }
+}
+
/* The general mixing thread function */
-int SDLCALL SDL_RunAudio(void *audiop)
+int SDLCALL
+SDL_RunAudio(void *devicep)
{
- SDL_AudioDevice *audio = (SDL_AudioDevice *)audiop;
- Uint8 *stream;
- int stream_len;
- void *udata;
- void (SDLCALL *fill)(void *userdata,Uint8 *stream, int len);
- int silence;
+ SDL_AudioDevice *device = (SDL_AudioDevice *) devicep;
+ Uint8 *stream;
+ int stream_len;
+ void *udata;
+ void (SDLCALL * fill) (void *userdata, Uint8 * stream, int len);
+ int silence;
+ Uint32 delay;
- /* Perform any thread setup */
- if ( audio->ThreadInit ) {
- audio->ThreadInit(audio);
- }
- audio->threadid = SDL_ThreadID();
+ /* For streaming when the buffer sizes don't match up */
+ Uint8 *istream;
+ int istream_len;
- /* Set up the mixing function */
- fill = audio->spec.callback;
- udata = audio->spec.userdata;
+ /* Perform any thread setup */
+ device->threadid = SDL_ThreadID();
+ current_audio.impl.ThreadInit(device);
- if ( audio->convert.needed ) {
- if ( audio->convert.src_format == AUDIO_U8 ) {
- silence = 0x80;
- } else {
- silence = 0;
- }
- stream_len = audio->convert.len;
- } else {
- silence = audio->spec.silence;
- stream_len = audio->spec.size;
- }
+ /* Set up the mixing function */
+ fill = device->spec.callback;
+ udata = device->spec.userdata;
-#ifdef __OS2__
- /* Increase the priority of this thread to make sure that
- the audio will be continuous all the time! */
-#ifdef USE_DOSSETPRIORITY
- if (SDL_getenv("SDL_USE_TIMECRITICAL_AUDIO"))
- {
-#ifdef DEBUG_BUILD
- printf("[SDL_RunAudio] : Setting priority to TimeCritical+0! (TID%d)\n", SDL_ThreadID());
-#endif
- DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0);
+ /* By default do not stream */
+ device->use_streamer = 0;
+
+ if (device->convert.needed) {
+ if (device->convert.src_format == AUDIO_U8) {
+ silence = 0x80;
+ } else {
+ silence = 0;
}
- else
- {
-#ifdef DEBUG_BUILD
- printf("[SDL_RunAudio] : Setting priority to ForegroundServer+0! (TID%d)\n", SDL_ThreadID());
-#endif
- DosSetPriority(PRTYS_THREAD, PRTYC_FOREGROUNDSERVER, 0, 0);
+
+#if 0 /* !!! FIXME: I took len_div out of the structure. Use rate_incr instead? */
+ /* If the result of the conversion alters the length, i.e. resampling is being used, use the streamer */
+ if (device->convert.len_mult != 1 || device->convert.len_div != 1) {
+ /* The streamer's maximum length should be twice whichever is larger: spec.size or len_cvt */
+ stream_max_len = 2 * device->spec.size;
+ if (device->convert.len_mult > device->convert.len_div) {
+ stream_max_len *= device->convert.len_mult;
+ stream_max_len /= device->convert.len_div;
+ }
+ if (SDL_StreamInit(&device->streamer, stream_max_len, silence) <
+ 0)
+ return -1;
+ device->use_streamer = 1;
+
+ /* istream_len should be the length of what we grab from the callback and feed to conversion,
+ so that we get close to spec_size. I.e. we want device.spec_size = istream_len * u / d
+ */
+ istream_len =
+ device->spec.size * device->convert.len_div /
+ device->convert.len_mult;
}
-#endif
#endif
- /* Loop, filling the audio buffers */
- while ( audio->enabled ) {
+ /* stream_len = device->convert.len; */
+ stream_len = device->spec.size;
+ } else {
+ silence = device->spec.silence;
+ stream_len = device->spec.size;
+ }
- /* Fill the current buffer with sound */
- if ( audio->convert.needed ) {
- if ( audio->convert.buf ) {
- stream = audio->convert.buf;
- } else {
- continue;
- }
- } else {
- stream = audio->GetAudioBuf(audio);
- if ( stream == NULL ) {
- stream = audio->fake_stream;
- }
- }
+ /* Calculate the delay while paused */
+ delay = ((device->spec.samples * 1000) / device->spec.freq);
- SDL_memset(stream, silence, stream_len);
+ /* Determine if the streamer is necessary here */
+ if (device->use_streamer == 1) {
+ /* This code is almost the same as the old code. The difference is, instead of reading
+ directly from the callback into "stream", then converting and sending the audio off,
+ we go: callback -> "istream" -> (conversion) -> streamer -> stream -> device.
+ However, reading and writing with streamer are done separately:
+ - We only call the callback and write to the streamer when the streamer does not
+ contain enough samples to output to the device.
+ - We only read from the streamer and tell the device to play when the streamer
+ does have enough samples to output.
+ This allows us to perform resampling in the conversion step, where the output of the
+ resampling process can be any number. We will have to see what a good size for the
+ stream's maximum length is, but I suspect 2*max(len_cvt, stream_len) is a good figure.
+ */
+ while (device->enabled) {
- if ( ! audio->paused ) {
- SDL_mutexP(audio->mixer_lock);
- (*fill)(udata, stream, stream_len);
- SDL_mutexV(audio->mixer_lock);
- }
+ if (device->paused) {
+ SDL_Delay(delay);
+ continue;
+ }
- /* Convert the audio if necessary */
- if ( audio->convert.needed ) {
- SDL_ConvertAudio(&audio->convert);
- stream = audio->GetAudioBuf(audio);
- if ( stream == NULL ) {
- stream = audio->fake_stream;
- }
- SDL_memcpy(stream, audio->convert.buf,
- audio->convert.len_cvt);
- }
+ /* Only read in audio if the streamer doesn't have enough already (if it does not have enough samples to output) */
+ if (SDL_StreamLength(&device->streamer) < stream_len) {
+ /* Set up istream */
+ if (device->convert.needed) {
+ if (device->convert.buf) {
+ istream = device->convert.buf;
+ } else {
+ continue;
+ }
+ } else {
+/* FIXME: Ryan, this is probably wrong. I imagine we don't want to get
+ * a device buffer both here and below in the stream output.
+ */
+ istream = current_audio.impl.GetDeviceBuf(device);
+ if (istream == NULL) {
+ istream = device->fake_stream;
+ }
+ }
- /* Ready current buffer for play and change current buffer */
- if ( stream != audio->fake_stream ) {
- audio->PlayAudio(audio);
- }
+ /* Read from the callback into the _input_ stream */
+ SDL_mutexP(device->mixer_lock);
+ (*fill) (udata, istream, istream_len);
+ SDL_mutexV(device->mixer_lock);
- /* Wait for an audio buffer to become available */
- if ( stream == audio->fake_stream ) {
- SDL_Delay((audio->spec.samples*1000)/audio->spec.freq);
- } else {
- audio->WaitAudio(audio);
- }
- }
+ /* Convert the audio if necessary and write to the streamer */
+ if (device->convert.needed) {
+ SDL_ConvertAudio(&device->convert);
+ if (istream == NULL) {
+ istream = device->fake_stream;
+ }
+ /*SDL_memcpy(istream, device->convert.buf, device->convert.len_cvt); */
+ SDL_StreamWrite(&device->streamer, device->convert.buf,
+ device->convert.len_cvt);
+ } else {
+ SDL_StreamWrite(&device->streamer, istream, istream_len);
+ }
+ }
- /* Wait for the audio to drain.. */
- if ( audio->WaitDone ) {
- audio->WaitDone(audio);
- }
+ /* Only output audio if the streamer has enough to output */
+ if (SDL_StreamLength(&device->streamer) >= stream_len) {
+ /* Set up the output stream */
+ if (device->convert.needed) {
+ if (device->convert.buf) {
+ stream = device->convert.buf;
+ } else {
+ continue;
+ }
+ } else {
+ stream = current_audio.impl.GetDeviceBuf(device);
+ if (stream == NULL) {
+ stream = device->fake_stream;
+ }
+ }
-#ifdef __OS2__
-#ifdef DEBUG_BUILD
- printf("[SDL_RunAudio] : Task exiting. (TID%d)\n", SDL_ThreadID());
-#endif
-#endif
- return(0);
+ /* Now read from the streamer */
+ SDL_StreamRead(&device->streamer, stream, stream_len);
+
+ /* Ready current buffer for play and change current buffer */
+ if (stream != device->fake_stream) {
+ current_audio.impl.PlayDevice(device);
+ /* Wait for an audio buffer to become available */
+ current_audio.impl.WaitDevice(device);
+ } else {
+ SDL_Delay(delay);
+ }
+ }
+
+ }
+ } else {
+ /* Otherwise, do not use the streamer. This is the old code. */
+
+ /* Loop, filling the audio buffers */
+ while (device->enabled) {
+
+ if (device->paused) {
+ SDL_Delay(delay);
+ continue;
+ }
+
+ /* Fill the current buffer with sound */
+ if (device->convert.needed) {
+ if (device->convert.buf) {
+ stream = device->convert.buf;
+ } else {
+ continue;
+ }
+ } else {
+ stream = current_audio.impl.GetDeviceBuf(device);
+ if (stream == NULL) {
+ stream = device->fake_stream;
+ }
+ }
+
+ SDL_mutexP(device->mixer_lock);
+ (*fill) (udata, stream, stream_len);
+ SDL_mutexV(device->mixer_lock);
+
+ /* Convert the audio if necessary */
+ if (device->convert.needed) {
+ SDL_ConvertAudio(&device->convert);
+ stream = current_audio.impl.GetDeviceBuf(device);
+ if (stream == NULL) {
+ stream = device->fake_stream;
+ }
+ SDL_memcpy(stream, device->convert.buf,
+ device->convert.len_cvt);
+ }
+
+ /* Ready current buffer for play and change current buffer */
+ if (stream != device->fake_stream) {
+ current_audio.impl.PlayDevice(device);
+ /* Wait for an audio buffer to become available */
+ current_audio.impl.WaitDevice(device);
+ } else {
+ SDL_Delay(delay);
+ }
+ }
+ }
+
+ /* Wait for the audio to drain.. */
+ current_audio.impl.WaitDone(device);
+
+ /* If necessary, deinit the streamer */
+ if (device->use_streamer == 1)
+ SDL_StreamDeinit(&device->streamer);
+
+ return (0);
}
-static void SDL_LockAudio_Default(SDL_AudioDevice *audio)
+
+static SDL_AudioFormat
+SDL_ParseAudioFormat(const char *string)
{
- if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) {
- return;
- }
- SDL_mutexP(audio->mixer_lock);
+#define CHECK_FMT_STRING(x) if (SDL_strcmp(string, #x) == 0) return AUDIO_##x
+ CHECK_FMT_STRING(U8);
+ CHECK_FMT_STRING(S8);
+ CHECK_FMT_STRING(U16LSB);
+ CHECK_FMT_STRING(S16LSB);
+ CHECK_FMT_STRING(U16MSB);
+ CHECK_FMT_STRING(S16MSB);
+ CHECK_FMT_STRING(U16SYS);
+ CHECK_FMT_STRING(S16SYS);
+ CHECK_FMT_STRING(U16);
+ CHECK_FMT_STRING(S16);
+ CHECK_FMT_STRING(S32LSB);
+ CHECK_FMT_STRING(S32MSB);
+ CHECK_FMT_STRING(S32SYS);
+ CHECK_FMT_STRING(S32);
+ CHECK_FMT_STRING(F32LSB);
+ CHECK_FMT_STRING(F32MSB);
+ CHECK_FMT_STRING(F32SYS);
+ CHECK_FMT_STRING(F32);
+#undef CHECK_FMT_STRING
+ return 0;
}
-static void SDL_UnlockAudio_Default(SDL_AudioDevice *audio)
+int
+SDL_GetNumAudioDrivers(void)
{
- if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) {
- return;
- }
- SDL_mutexV(audio->mixer_lock);
+ return (SDL_arraysize(bootstrap) - 1);
}
-static Uint16 SDL_ParseAudioFormat(const char *string)
+const char *
+SDL_GetAudioDriver(int index)
{
- Uint16 format = 0;
-
- switch (*string) {
- case 'U':
- ++string;
- format |= 0x0000;
- break;
- case 'S':
- ++string;
- format |= 0x8000;
- break;
- default:
- return 0;
- }
- switch (SDL_atoi(string)) {
- case 8:
- string += 1;
- format |= 8;
- break;
- case 16:
- string += 2;
- format |= 16;
- if ( SDL_strcmp(string, "LSB") == 0
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- || SDL_strcmp(string, "SYS") == 0
-#endif
- ) {
- format |= 0x0000;
- }
- if ( SDL_strcmp(string, "MSB") == 0
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- || SDL_strcmp(string, "SYS") == 0
-#endif
- ) {
- format |= 0x1000;
- }
- break;
- default:
- return 0;
- }
- return format;
+ if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
+ return (bootstrap[index]->name);
+ }
+ return (NULL);
}
-int SDL_AudioInit(const char *driver_name)
+int
+SDL_AudioInit(const char *driver_name)
{
- SDL_AudioDevice *audio;
- int i = 0, idx;
+ int i = 0;
+ int initialized = 0;
+ int tried_to_init = 0;
- /* Check to make sure we don't overwrite 'current_audio' */
- if ( current_audio != NULL ) {
- SDL_AudioQuit();
- }
+ if (SDL_WasInit(SDL_INIT_AUDIO)) {
+ SDL_AudioQuit(); /* shutdown driver if already running. */
+ }
- /* Select the proper audio driver */
- audio = NULL;
- idx = 0;
-#if SDL_AUDIO_DRIVER_ESD
- if ( (driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL) ) {
- /* Ahem, we know that if ESPEAKER is set, user probably wants
- to use ESD, but don't start it if it's not already running.
- This probably isn't the place to do this, but... Shh! :)
- */
- for ( i=0; bootstrap[i]; ++i ) {
- if ( SDL_strcasecmp(bootstrap[i]->name, "esd") == 0 ) {
-#ifdef HAVE_PUTENV
- const char *esd_no_spawn;
+ SDL_memset(¤t_audio, '\0', sizeof(current_audio));
+ SDL_memset(open_devices, '\0', sizeof(open_devices));
- /* Don't start ESD if it's not running */
- esd_no_spawn = getenv("ESD_NO_SPAWN");
- if ( esd_no_spawn == NULL ) {
- putenv("ESD_NO_SPAWN=1");
- }
-#endif
- if ( bootstrap[i]->available() ) {
- audio = bootstrap[i]->create(0);
- break;
- }
-#ifdef HAVE_UNSETENV
- if ( esd_no_spawn == NULL ) {
- unsetenv("ESD_NO_SPAWN");
- }
-#endif
- }
- }
- }
-#endif /* SDL_AUDIO_DRIVER_ESD */
- if ( audio == NULL ) {
- if ( driver_name != NULL ) {
-#if 0 /* This will be replaced with a better driver selection API */
- if ( SDL_strrchr(driver_name, ':') != NULL ) {
- idx = atoi(SDL_strrchr(driver_name, ':')+1);
- }
-#endif
- for ( i=0; bootstrap[i]; ++i ) {
- if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {
- if ( bootstrap[i]->available() ) {
- audio=bootstrap[i]->create(idx);
- break;
- }
- }
- }
- } else {
- for ( i=0; bootstrap[i]; ++i ) {
- if ( bootstrap[i]->available() ) {
- audio = bootstrap[i]->create(idx);
- if ( audio != NULL ) {
- break;
- }
- }
- }
- }
- if ( audio == NULL ) {
- SDL_SetError("No available audio device");
-#if 0 /* Don't fail SDL_Init() if audio isn't available.
- SDL_OpenAudio() will handle it at that point. *sigh*
- */
- return(-1);
-#endif
- }
- }
- current_audio = audio;
- if ( current_audio ) {
- current_audio->name = bootstrap[i]->name;
- if ( !current_audio->LockAudio && !current_audio->UnlockAudio ) {
- current_audio->LockAudio = SDL_LockAudio_Default;
- current_audio->UnlockAudio = SDL_UnlockAudio_Default;
- }
- }
- return(0);
+ /* Select the proper audio driver */
+ if (driver_name == NULL) {
+ driver_name = SDL_getenv("SDL_AUDIODRIVER");
+ }
+
+ for (i = 0; (!initialized) && (bootstrap[i]); ++i) {
+ /* make sure we should even try this driver before doing so... */
+ const AudioBootStrap *backend = bootstrap[i];
+ if (((driver_name) && (SDL_strcasecmp(backend->name, driver_name))) ||
+ ((!driver_name) && (backend->demand_only))) {
+ continue;
+ }
+
+ tried_to_init = 1;
+ SDL_memset(¤t_audio, 0, sizeof(current_audio));
+ current_audio.name = backend->name;
+ current_audio.desc = backend->desc;
+ initialized = backend->init(¤t_audio.impl);
+ }
+
+ if (!initialized) {
+ /* specific drivers will set the error message if they fail... */
+ if (!tried_to_init) {
+ if (driver_name) {
+ SDL_SetError("Audio target '%s' not available", driver_name);
+ } else {
+ SDL_SetError("No available audio device");
+ }
+ }
+
+ SDL_memset(¤t_audio, 0, sizeof(current_audio));
+ return (-1); /* No driver was available, so fail. */
+ }
+
+ finalize_audio_entry_points();
+
+ return (0);
}
-char *SDL_AudioDriverName(char *namebuf, int maxlen)
+/*
+ * Get the current audio driver name
+ */
+const char *
+SDL_GetCurrentAudioDriver()
{
- if ( current_audio != NULL ) {
- SDL_strlcpy(namebuf, current_audio->name, maxlen);
- return(namebuf);
- }
- return(NULL);
+ return current_audio.name;
}
-int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
+
+int
+SDL_GetNumAudioDevices(int iscapture)
{
- SDL_AudioDevice *audio;
- const char *env;
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ return -1;
+ }
+ if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) {
+ return 0;
+ }
- /* Start up the audio driver, if necessary */
- if ( ! current_audio ) {
- if ( (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) ||
- (current_audio == NULL) ) {
- return(-1);
- }
- }
- audio = current_audio;
+ if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) {
+ return 1;
+ }
- if (audio->opened) {
- SDL_SetError("Audio device is already opened");
- return(-1);
- }
+ if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) {
+ return 1;
+ }
- /* Verify some parameters */
- if ( desired->freq == 0 ) {
- env = SDL_getenv("SDL_AUDIO_FREQUENCY");
- if ( env ) {
- desired->freq = SDL_atoi(env);
- }
- }
- if ( desired->freq == 0 ) {
- /* Pick some default audio frequency */
- desired->freq = 22050;
- }
- if ( desired->format == 0 ) {
- env = SDL_getenv("SDL_AUDIO_FORMAT");
- if ( env ) {
- desired->format = SDL_ParseAudioFormat(env);
- }
- }
- if ( desired->format == 0 ) {
- /* Pick some default audio format */
- desired->format = AUDIO_S16;
- }
- if ( desired->channels == 0 ) {
- env = SDL_getenv("SDL_AUDIO_CHANNELS");
- if ( env ) {
- desired->channels = (Uint8)SDL_atoi(env);
- }
- }
- if ( desired->channels == 0 ) {
- /* Pick a default number of channels */
- desired->channels = 2;
- }
- switch ( desired->channels ) {
- case 1: /* Mono */
- case 2: /* Stereo */
- case 4: /* surround */
- case 6: /* surround with center and lfe */
- break;
- default:
- SDL_SetError("1 (mono) and 2 (stereo) channels supported");
- return(-1);
- }
- if ( desired->samples == 0 ) {
- env = SDL_getenv("SDL_AUDIO_SAMPLES");
- if ( env ) {
- desired->samples = (Uint16)SDL_atoi(env);
- }
- }
- if ( desired->samples == 0 ) {
- /* Pick a default of ~46 ms at desired frequency */
- int samples = (desired->freq / 1000) * 46;
- int power2 = 1;
- while ( power2 < samples ) {
- power2 *= 2;
- }
- desired->samples = power2;
- }
- if ( desired->callback == NULL ) {
- SDL_SetError("SDL_OpenAudio() passed a NULL callback");
- return(-1);
- }
+ return current_audio.impl.DetectDevices(iscapture);
+}
-#if SDL_THREADS_DISABLED
- /* Uses interrupt driven audio, without thread */
-#else
- /* Create a semaphore for locking the sound buffers */
- audio->mixer_lock = SDL_CreateMutex();
- if ( audio->mixer_lock == NULL ) {
- SDL_SetError("Couldn't create mixer lock");
- SDL_CloseAudio();
- return(-1);
- }
-#endif /* SDL_THREADS_DISABLED */
- /* Calculate the silence and size of the audio specification */
- SDL_CalculateAudioSpec(desired);
+const char *
+SDL_GetAudioDeviceName(int index, int iscapture)
+{
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ SDL_SetError("Audio subsystem is not initialized");
+ return NULL;
+ }
- /* Open the audio subsystem */
- SDL_memcpy(&audio->spec, desired, sizeof(audio->spec));
- audio->convert.needed = 0;
- audio->enabled = 1;
- audio->paused = 1;
+ if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) {
+ SDL_SetError("No capture support");
+ return NULL;
+ }
- audio->opened = audio->OpenAudio(audio, &audio->spec)+1;
+ if (index < 0) {
+ SDL_SetError("No such device");
+ return NULL;
+ }
- if ( ! audio->opened ) {
- SDL_CloseAudio();
- return(-1);
- }
+ if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) {
+ return DEFAULT_INPUT_DEVNAME;
+ }
- /* If the audio driver changes the buffer size, accept it */
- if ( audio->spec.samples != desired->samples ) {
- desired->samples = audio->spec.samples;
- SDL_CalculateAudioSpec(desired);
- }
+ if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) {
+ return DEFAULT_OUTPUT_DEVNAME;
+ }
- /* Allocate a fake audio memory buffer */
- audio->fake_stream = SDL_AllocAudioMem(audio->spec.size);
- if ( audio->fake_stream == NULL ) {
- SDL_CloseAudio();
- SDL_OutOfMemory();
- return(-1);
- }
+ return current_audio.impl.GetDeviceName(index, iscapture);
+}
- /* See if we need to do any conversion */
- if ( obtained != NULL ) {
- SDL_memcpy(obtained, &audio->spec, sizeof(audio->spec));
- } else if ( desired->freq != audio->spec.freq ||
- desired->format != audio->spec.format ||
- desired->channels != audio->spec.channels ) {
- /* Build an audio conversion block */
- if ( SDL_BuildAudioCVT(&audio->convert,
- desired->format, desired->channels,
- desired->freq,
- audio->spec.format, audio->spec.channels,
- audio->spec.freq) < 0 ) {
- SDL_CloseAudio();
- return(-1);
- }
- if ( audio->convert.needed ) {
- audio->convert.len = (int) ( ((double) audio->spec.size) /
- audio->convert.len_ratio );
- audio->convert.buf =(Uint8 *)SDL_AllocAudioMem(
- audio->convert.len*audio->convert.len_mult);
- if ( audio->convert.buf == NULL ) {
- SDL_CloseAudio();
- SDL_OutOfMemory();
- return(-1);
- }
- }
- }
- /* Start the audio thread if necessary */
- switch (audio->opened) {
- case 1:
- /* Start the audio thread */
-#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC) && !defined(__SYMBIAN32__)
+static void
+close_audio_device(SDL_AudioDevice * device)
+{
+ device->enabled = 0;
+ if (device->thread != NULL) {
+ SDL_WaitThread(device->thread, NULL);
+ }
+ if (device->mixer_lock != NULL) {
+ SDL_DestroyMutex(device->mixer_lock);
+ }
+ if (device->fake_stream != NULL) {
+ SDL_FreeAudioMem(device->fake_stream);
+ }
+ if (device->convert.needed) {
+ SDL_FreeAudioMem(device->convert.buf);
+ }
+ if (device->opened) {
+ current_audio.impl.CloseDevice(device);
+ device->opened = 0;
+ }
+ SDL_FreeAudioMem(device);
+}
+
+
+/*
+ * Sanity check desired AudioSpec for SDL_OpenAudio() in (orig).
+ * Fills in a sanitized copy in (prepared).
+ * Returns non-zero if okay, zero on fatal parameters in (orig).
+ */
+static int
+prepare_audiospec(const SDL_AudioSpec * orig, SDL_AudioSpec * prepared)
+{
+ SDL_memcpy(prepared, orig, sizeof(SDL_AudioSpec));
+
+ if (orig->callback == NULL) {
+ SDL_SetError("SDL_OpenAudio() passed a NULL callback");
+ return 0;
+ }
+
+ if (orig->freq == 0) {
+ const char *env = SDL_getenv("SDL_AUDIO_FREQUENCY");
+ if ((!env) || ((prepared->freq = SDL_atoi(env)) == 0)) {
+ prepared->freq = 22050; /* a reasonable default */
+ }
+ }
+
+ if (orig->format == 0) {
+ const char *env = SDL_getenv("SDL_AUDIO_FORMAT");
+ if ((!env) || ((prepared->format = SDL_ParseAudioFormat(env)) == 0)) {
+ prepared->format = AUDIO_S16; /* a reasonable default */
+ }
+ }
+
+ switch (orig->channels) {
+ case 0:{
+ const char *env = SDL_getenv("SDL_AUDIO_CHANNELS");
+ if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) {
+ prepared->channels = 2; /* a reasonable default */
+ }
+ break;
+ }
+ case 1: /* Mono */
+ case 2: /* Stereo */
+ case 4: /* surround */
+ case 6: /* surround with center and lfe */
+ break;
+ default:
+ SDL_SetError("Unsupported number of audio channels.");
+ return 0;
+ }
+
+ if (orig->samples == 0) {
+ const char *env = SDL_getenv("SDL_AUDIO_SAMPLES");
+ if ((!env) || ((prepared->samples = (Uint16) SDL_atoi(env)) == 0)) {
+ /* Pick a default of ~46 ms at desired frequency */
+ /* !!! FIXME: remove this when the non-Po2 resampling is in. */
+ const int samples = (prepared->freq / 1000) * 46;
+ int power2 = 1;
+ while (power2 < samples) {
+ power2 *= 2;
+ }
+ prepared->samples = power2;
+ }
+ }
+
+ /* Calculate the silence and size of the audio specification */
+ SDL_CalculateAudioSpec(prepared);
+
+ return 1;
+}
+
+
+static SDL_AudioDeviceID
+open_audio_device(const char *devname, int iscapture,
+ const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
+ int allowed_changes, int min_id)
+{
+ SDL_AudioDeviceID id = 0;
+ SDL_AudioSpec _obtained;
+ SDL_AudioDevice *device;
+ SDL_bool build_cvt;
+ int i = 0;
+
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ SDL_SetError("Audio subsystem is not initialized");
+ return 0;
+ }
+
+ if ((iscapture) && (!current_audio.impl.HasCaptureSupport)) {
+ SDL_SetError("No capture support");
+ return 0;
+ }
+
+ if (!obtained) {
+ obtained = &_obtained;
+ }
+ if (!prepare_audiospec(desired, obtained)) {
+ return 0;
+ }
+
+ /* If app doesn't care about a specific device, let the user override. */
+ if (devname == NULL) {
+ devname = SDL_getenv("SDL_AUDIO_DEVICE_NAME");
+ }
+
+ /*
+ * Catch device names at the high level for the simple case...
+ * This lets us have a basic "device enumeration" for systems that
+ * don't have multiple devices, but makes sure the device name is
+ * always NULL when it hits the low level.
+ *
+ * Also make sure that the simple case prevents multiple simultaneous
+ * opens of the default system device.
+ */
+
+ if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) {
+ if ((devname) && (SDL_strcmp(devname, DEFAULT_INPUT_DEVNAME) != 0)) {
+ SDL_SetError("No such device");
+ return 0;
+ }
+ devname = NULL;
+
+ for (i = 0; i < SDL_arraysize(open_devices); i++) {
+ if ((open_devices[i]) && (open_devices[i]->iscapture)) {
+ SDL_SetError("Audio device already open");
+ return 0;
+ }
+ }
+ }
+
+ if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) {
+ if ((devname) && (SDL_strcmp(devname, DEFAULT_OUTPUT_DEVNAME) != 0)) {
+ SDL_SetError("No such device");
+ return 0;
+ }
+ devname = NULL;
+
+ for (i = 0; i < SDL_arraysize(open_devices); i++) {
+ if ((open_devices[i]) && (!open_devices[i]->iscapture)) {
+ SDL_SetError("Audio device already open");
+ return 0;
+ }
+ }
+ }
+
+ device = (SDL_AudioDevice *) SDL_AllocAudioMem(sizeof(SDL_AudioDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(device, '\0', sizeof(SDL_AudioDevice));
+ device->spec = *obtained;
+ device->enabled = 1;
+ device->paused = 1;
+ device->iscapture = iscapture;
+
+ /* Create a semaphore for locking the sound buffers */
+ if (!current_audio.impl.SkipMixerLock) {
+ device->mixer_lock = SDL_CreateMutex();
+ if (device->mixer_lock == NULL) {
+ close_audio_device(device);
+ SDL_SetError("Couldn't create mixer lock");
+ return 0;
+ }
+ }
+
+ if (!current_audio.impl.OpenDevice(device, devname, iscapture)) {
+ close_audio_device(device);
+ return 0;
+ }
+ device->opened = 1;
+
+ /* Allocate a fake audio memory buffer */
+ device->fake_stream = SDL_AllocAudioMem(device->spec.size);
+ if (device->fake_stream == NULL) {
+ close_audio_device(device);
+ SDL_OutOfMemory();
+ return 0;
+ }
+
+ /* If the audio driver changes the buffer size, accept it */
+ if (device->spec.samples != obtained->samples) {
+ obtained->samples = device->spec.samples;
+ SDL_CalculateAudioSpec(obtained);
+ }
+
+ /* See if we need to do any conversion */
+ build_cvt = SDL_FALSE;
+ if (obtained->freq != device->spec.freq) {
+ if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) {
+ obtained->freq = device->spec.freq;
+ } else {
+ build_cvt = SDL_TRUE;
+ }
+ }
+ if (obtained->format != device->spec.format) {
+ if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) {
+ obtained->format = device->spec.format;
+ } else {
+ build_cvt = SDL_TRUE;
+ }
+ }
+ if (obtained->channels != device->spec.channels) {
+ if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) {
+ obtained->channels = device->spec.channels;
+ } else {
+ build_cvt = SDL_TRUE;
+ }
+ }
+ if (build_cvt) {
+ /* Build an audio conversion block */
+ if (SDL_BuildAudioCVT(&device->convert,
+ obtained->format, obtained->channels,
+ obtained->freq,
+ device->spec.format, device->spec.channels,
+ device->spec.freq) < 0) {
+ close_audio_device(device);
+ return 0;
+ }
+ if (device->convert.needed) {
+ device->convert.len = (int) (((double) obtained->size) /
+ device->convert.len_ratio);
+
+ device->convert.buf =
+ (Uint8 *) SDL_AllocAudioMem(device->convert.len *
+ device->convert.len_mult);
+ if (device->convert.buf == NULL) {
+ close_audio_device(device);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ }
+ }
+
+ /* Find an available device ID and store the structure... */
+ for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) {
+ if (open_devices[id] == NULL) {
+ open_devices[id] = device;
+ break;
+ }
+ }
+
+ if (id == SDL_arraysize(open_devices)) {
+ SDL_SetError("Too many open audio devices");
+ close_audio_device(device);
+ return 0;
+ }
+
+ /* Start the audio thread if necessary */
+ if (!current_audio.impl.ProvidesOwnCallbackThread) {
+ /* Start the audio thread */
+/* !!! FIXME: this is nasty. */
+#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
#undef SDL_CreateThread
- audio->thread = SDL_CreateThread(SDL_RunAudio, audio, NULL, NULL);
+ device->thread = SDL_CreateThread(SDL_RunAudio, device, NULL, NULL);
#else
- audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
+ device->thread = SDL_CreateThread(SDL_RunAudio, device);
#endif
- if ( audio->thread == NULL ) {
- SDL_CloseAudio();
- SDL_SetError("Couldn't create audio thread");
- return(-1);
- }
- break;
+ if (device->thread == NULL) {
+ SDL_CloseAudioDevice(id + 1);
+ SDL_SetError("Couldn't create audio thread");
+ return 0;
+ }
+ }
- default:
- /* The audio is now playing */
- break;
- }
-
- return(0);
+ return id + 1;
}
-SDL_audiostatus SDL_GetAudioStatus(void)
+
+int
+SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained)
{
- SDL_AudioDevice *audio = current_audio;
- SDL_audiostatus status;
+ SDL_AudioDeviceID id = 0;
- status = SDL_AUDIO_STOPPED;
- if ( audio && audio->enabled ) {
- if ( audio->paused ) {
- status = SDL_AUDIO_PAUSED;
- } else {
- status = SDL_AUDIO_PLAYING;
- }
- }
- return(status);
+ /* Start up the audio driver, if necessary. This is legacy behaviour! */
+ if (!SDL_WasInit(SDL_INIT_AUDIO)) {
+ if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
+ return (-1);
+ }
+ }
+
+ /* SDL_OpenAudio() is legacy and can only act on Device ID #1. */
+ if (open_devices[0] != NULL) {
+ SDL_SetError("Audio device is already opened");
+ return (-1);
+ }
+
+ if (obtained) {
+ id = open_audio_device(NULL, 0, desired, obtained,
+ SDL_AUDIO_ALLOW_ANY_CHANGE, 1);
+ } else {
+ id = open_audio_device(NULL, 0, desired, desired, 0, 1);
+ }
+ if (id > 1) { /* this should never happen in theory... */
+ SDL_CloseAudioDevice(id);
+ SDL_SetError("Internal error"); /* MUST be Device ID #1! */
+ return (-1);
+ }
+
+ return ((id == 0) ? -1 : 0);
}
-void SDL_PauseAudio (int pause_on)
+SDL_AudioDeviceID
+SDL_OpenAudioDevice(const char *device, int iscapture,
+ const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
+ int allowed_changes)
{
- SDL_AudioDevice *audio = current_audio;
-
- if ( audio ) {
- audio->paused = pause_on;
- }
+ return open_audio_device(device, iscapture, desired, obtained,
+ allowed_changes, 2);
}
-void SDL_LockAudio (void)
+SDL_AudioStatus
+SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
{
- SDL_AudioDevice *audio = current_audio;
-
- /* Obtain a lock on the mixing buffers */
- if ( audio && audio->LockAudio ) {
- audio->LockAudio(audio);
- }
+ SDL_AudioDevice *device = get_audio_device(devid);
+ SDL_AudioStatus status = SDL_AUDIO_STOPPED;
+ if (device && device->enabled) {
+ if (device->paused) {
+ status = SDL_AUDIO_PAUSED;
+ } else {
+ status = SDL_AUDIO_PLAYING;
+ }
+ }
+ return (status);
}
-void SDL_UnlockAudio (void)
+
+SDL_AudioStatus
+SDL_GetAudioStatus(void)
{
- SDL_AudioDevice *audio = current_audio;
-
- /* Release lock on the mixing buffers */
- if ( audio && audio->UnlockAudio ) {
- audio->UnlockAudio(audio);
- }
+ return SDL_GetAudioDeviceStatus(1);
}
-void SDL_CloseAudio (void)
+void
+SDL_PauseAudioDevice(SDL_AudioDeviceID devid, int pause_on)
{
- SDL_QuitSubSystem(SDL_INIT_AUDIO);
+ SDL_AudioDevice *device = get_audio_device(devid);
+ if (device) {
+ device->paused = pause_on;
+ }
}
-void SDL_AudioQuit(void)
+void
+SDL_PauseAudio(int pause_on)
{
- SDL_AudioDevice *audio = current_audio;
-
- if ( audio ) {
- audio->enabled = 0;
- if ( audio->thread != NULL ) {
- SDL_WaitThread(audio->thread, NULL);
- }
- if ( audio->mixer_lock != NULL ) {
- SDL_DestroyMutex(audio->mixer_lock);
- }
- if ( audio->fake_stream != NULL ) {
- SDL_FreeAudioMem(audio->fake_stream);
- }
- if ( audio->convert.needed ) {
- SDL_FreeAudioMem(audio->convert.buf);
-
- }
- if ( audio->opened ) {
- audio->CloseAudio(audio);
- audio->opened = 0;
- }
- /* Free the driver data */
- audio->free(audio);
- current_audio = NULL;
- }
+ SDL_PauseAudioDevice(1, pause_on);
}
-#define NUM_FORMATS 6
+
+void
+SDL_LockAudioDevice(SDL_AudioDeviceID devid)
+{
+ /* Obtain a lock on the mixing buffers */
+ SDL_AudioDevice *device = get_audio_device(devid);
+ if (device) {
+ current_audio.impl.LockDevice(device);
+ }
+}
+
+void
+SDL_LockAudio(void)
+{
+ SDL_LockAudioDevice(1);
+}
+
+void
+SDL_UnlockAudioDevice(SDL_AudioDeviceID devid)
+{
+ /* Obtain a lock on the mixing buffers */
+ SDL_AudioDevice *device = get_audio_device(devid);
+ if (device) {
+ current_audio.impl.UnlockDevice(device);
+ }
+}
+
+void
+SDL_UnlockAudio(void)
+{
+ SDL_UnlockAudioDevice(1);
+}
+
+void
+SDL_CloseAudioDevice(SDL_AudioDeviceID devid)
+{
+ SDL_AudioDevice *device = get_audio_device(devid);
+ if (device) {
+ close_audio_device(device);
+ open_devices[devid - 1] = NULL;
+ }
+}
+
+void
+SDL_CloseAudio(void)
+{
+ SDL_CloseAudioDevice(1);
+}
+
+void
+SDL_AudioQuit(void)
+{
+ SDL_AudioDeviceID i;
+ for (i = 0; i < SDL_arraysize(open_devices); i++) {
+ SDL_CloseAudioDevice(i);
+ }
+
+ /* Free the driver data */
+ current_audio.impl.Deinitialize();
+ SDL_memset(¤t_audio, '\0', sizeof(current_audio));
+ SDL_memset(open_devices, '\0', sizeof(open_devices));
+}
+
+#define NUM_FORMATS 10
static int format_idx;
static int format_idx_sub;
-static Uint16 format_list[NUM_FORMATS][NUM_FORMATS] = {
- { AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB },
- { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB },
- { AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8 },
- { AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8 },
- { AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 },
- { AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 },
+static SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS] = {
+ {AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB,
+ AUDIO_U16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB},
+ {AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB,
+ AUDIO_U16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB},
+ {AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S32LSB,
+ AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S32MSB,
+ AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB,
+ AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_S32MSB,
+ AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S16LSB,
+ AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S16MSB,
+ AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S16LSB,
+ AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8},
+ {AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_S16MSB,
+ AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8},
};
-Uint16 SDL_FirstAudioFormat(Uint16 format)
+SDL_AudioFormat
+SDL_FirstAudioFormat(SDL_AudioFormat format)
{
- for ( format_idx=0; format_idx < NUM_FORMATS; ++format_idx ) {
- if ( format_list[format_idx][0] == format ) {
- break;
- }
- }
- format_idx_sub = 0;
- return(SDL_NextAudioFormat());
+ for (format_idx = 0; format_idx < NUM_FORMATS; ++format_idx) {
+ if (format_list[format_idx][0] == format) {
+ break;
+ }
+ }
+ format_idx_sub = 0;
+ return (SDL_NextAudioFormat());
}
-Uint16 SDL_NextAudioFormat(void)
+SDL_AudioFormat
+SDL_NextAudioFormat(void)
{
- if ( (format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS) ) {
- return(0);
- }
- return(format_list[format_idx][format_idx_sub++]);
+ if ((format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS)) {
+ return (0);
+ }
+ return (format_list[format_idx][format_idx_sub++]);
}
-void SDL_CalculateAudioSpec(SDL_AudioSpec *spec)
+void
+SDL_CalculateAudioSpec(SDL_AudioSpec * spec)
{
- switch (spec->format) {
- case AUDIO_U8:
- spec->silence = 0x80;
- break;
- default:
- spec->silence = 0x00;
- break;
- }
- spec->size = (spec->format&0xFF)/8;
- spec->size *= spec->channels;
- spec->size *= spec->samples;
+ switch (spec->format) {
+ case AUDIO_U8:
+ spec->silence = 0x80;
+ break;
+ default:
+ spec->silence = 0x00;
+ break;
+ }
+ spec->size = SDL_AUDIO_BITSIZE(spec->format) / 8;
+ spec->size *= spec->channels;
+ spec->size *= spec->samples;
}
+
+
+/*
+ * Moved here from SDL_mixer.c, since it relies on internals of an opened
+ * audio device (and is deprecated, by the way!).
+ */
+void
+SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume)
+{
+ /* Mix the user-level audio format */
+ SDL_AudioDevice *device = get_audio_device(1);
+ if (device != NULL) {
+ SDL_AudioFormat format;
+ if (device->convert.needed) {
+ format = device->convert.src_format;
+ } else {
+ format = device->spec.format;
+ }
+ SDL_MixAudioFormat(dst, src, format, len, volume);
+ }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_audio_c.h b/alienblaster/project/jni/sdl/src/audio/SDL_audio_c.h
index 3a5c10259..df88025fa 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_audio_c.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_audio_c.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,11 +24,33 @@
/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
/* Functions to get a list of "close" audio formats */
-extern Uint16 SDL_FirstAudioFormat(Uint16 format);
-extern Uint16 SDL_NextAudioFormat(void);
+extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format);
+extern SDL_AudioFormat SDL_NextAudioFormat(void);
/* Function to calculate the size and silence for a SDL_AudioSpec */
-extern void SDL_CalculateAudioSpec(SDL_AudioSpec *spec);
+extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);
/* The actual mixing thread function */
extern int SDLCALL SDL_RunAudio(void *audiop);
+
+/* this is used internally to access some autogenerated code. */
+typedef struct
+{
+ SDL_AudioFormat src_fmt;
+ SDL_AudioFormat dst_fmt;
+ SDL_AudioFilter filter;
+} SDL_AudioTypeFilters;
+extern const SDL_AudioTypeFilters sdl_audio_type_filters[];
+
+/* this is used internally to access some autogenerated code. */
+typedef struct
+{
+ SDL_AudioFormat fmt;
+ int channels;
+ int upsample;
+ int multiple;
+ SDL_AudioFilter filter;
+} SDL_AudioRateFilters;
+extern const SDL_AudioRateFilters sdl_audio_rate_filters[];
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_audiocvt.c b/alienblaster/project/jni/sdl/src/audio/SDL_audiocvt.c
index 5db30b347..3af35f13a 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_audiocvt.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_audiocvt.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,1487 +24,1057 @@
/* Functions for audio drivers to perform runtime conversion of audio format */
#include "SDL_audio.h"
+#include "SDL_audio_c.h"
+/* #define DEBUG_CONVERT */
+
+/* !!! FIXME */
+#ifndef assert
+#define assert(x)
+#endif
/* Effectively mix right and left channels into a single channel */
-void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
+static void SDLCALL
+SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format)
{
- int i;
- Sint32 sample;
+ int i;
+ Sint32 sample;
#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting to mono\n");
+ fprintf(stderr, "Converting to mono\n");
#endif
- switch (format&0x8018) {
+ switch (format & (SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_BITSIZE)) {
+ case AUDIO_U8:
+ {
+ Uint8 *src, *dst;
- case AUDIO_U8: {
- Uint8 *src, *dst;
+ src = cvt->buf;
+ dst = cvt->buf;
+ for (i = cvt->len_cvt / 2; i; --i) {
+ sample = src[0] + src[1];
+ *dst = (Uint8) (sample / 2);
+ src += 2;
+ dst += 1;
+ }
+ }
+ break;
- src = cvt->buf;
- dst = cvt->buf;
- for ( i=cvt->len_cvt/2; i; --i ) {
- sample = src[0] + src[1];
- *dst = (Uint8)(sample / 2);
- src += 2;
- dst += 1;
- }
- }
- break;
+ case AUDIO_S8:
+ {
+ Sint8 *src, *dst;
- case AUDIO_S8: {
- Sint8 *src, *dst;
+ src = (Sint8 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / 2; i; --i) {
+ sample = src[0] + src[1];
+ *dst = (Sint8) (sample / 2);
+ src += 2;
+ dst += 1;
+ }
+ }
+ break;
- src = (Sint8 *)cvt->buf;
- dst = (Sint8 *)cvt->buf;
- for ( i=cvt->len_cvt/2; i; --i ) {
- sample = src[0] + src[1];
- *dst = (Sint8)(sample / 2);
- src += 2;
- dst += 1;
- }
- }
- break;
+ case AUDIO_U16:
+ {
+ Uint8 *src, *dst;
- case AUDIO_U16: {
- Uint8 *src, *dst;
+ src = cvt->buf;
+ dst = cvt->buf;
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ sample = (Uint16) ((src[0] << 8) | src[1]) +
+ (Uint16) ((src[2] << 8) | src[3]);
+ sample /= 2;
+ dst[1] = (sample & 0xFF);
+ sample >>= 8;
+ dst[0] = (sample & 0xFF);
+ src += 4;
+ dst += 2;
+ }
+ } else {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ sample = (Uint16) ((src[1] << 8) | src[0]) +
+ (Uint16) ((src[3] << 8) | src[2]);
+ sample /= 2;
+ dst[0] = (sample & 0xFF);
+ sample >>= 8;
+ dst[1] = (sample & 0xFF);
+ src += 4;
+ dst += 2;
+ }
+ }
+ }
+ break;
- src = cvt->buf;
- dst = cvt->buf;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/4; i; --i ) {
- sample = (Uint16)((src[0]<<8)|src[1])+
- (Uint16)((src[2]<<8)|src[3]);
- sample /= 2;
- dst[1] = (sample&0xFF);
- sample >>= 8;
- dst[0] = (sample&0xFF);
- src += 4;
- dst += 2;
- }
- } else {
- for ( i=cvt->len_cvt/4; i; --i ) {
- sample = (Uint16)((src[1]<<8)|src[0])+
- (Uint16)((src[3]<<8)|src[2]);
- sample /= 2;
- dst[0] = (sample&0xFF);
- sample >>= 8;
- dst[1] = (sample&0xFF);
- src += 4;
- dst += 2;
- }
- }
- }
- break;
+ case AUDIO_S16:
+ {
+ Uint8 *src, *dst;
- case AUDIO_S16: {
- Uint8 *src, *dst;
+ src = cvt->buf;
+ dst = cvt->buf;
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ sample = (Sint16) ((src[0] << 8) | src[1]) +
+ (Sint16) ((src[2] << 8) | src[3]);
+ sample /= 2;
+ dst[1] = (sample & 0xFF);
+ sample >>= 8;
+ dst[0] = (sample & 0xFF);
+ src += 4;
+ dst += 2;
+ }
+ } else {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ sample = (Sint16) ((src[1] << 8) | src[0]) +
+ (Sint16) ((src[3] << 8) | src[2]);
+ sample /= 2;
+ dst[0] = (sample & 0xFF);
+ sample >>= 8;
+ dst[1] = (sample & 0xFF);
+ src += 4;
+ dst += 2;
+ }
+ }
+ }
+ break;
- src = cvt->buf;
- dst = cvt->buf;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/4; i; --i ) {
- sample = (Sint16)((src[0]<<8)|src[1])+
- (Sint16)((src[2]<<8)|src[3]);
- sample /= 2;
- dst[1] = (sample&0xFF);
- sample >>= 8;
- dst[0] = (sample&0xFF);
- src += 4;
- dst += 2;
- }
- } else {
- for ( i=cvt->len_cvt/4; i; --i ) {
- sample = (Sint16)((src[1]<<8)|src[0])+
- (Sint16)((src[3]<<8)|src[2]);
- sample /= 2;
- dst[0] = (sample&0xFF);
- sample >>= 8;
- dst[1] = (sample&0xFF);
- src += 4;
- dst += 2;
- }
- }
- }
- break;
- }
- cvt->len_cvt /= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+ case AUDIO_S32:
+ {
+ const Uint32 *src = (const Uint32 *) cvt->buf;
+ Uint32 *dst = (Uint32 *) cvt->buf;
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 8; i; --i, src += 2) {
+ const Sint64 added =
+ (((Sint64) (Sint32) SDL_SwapBE32(src[0])) +
+ ((Sint64) (Sint32) SDL_SwapBE32(src[1])));
+ *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added / 2)));
+ }
+ } else {
+ for (i = cvt->len_cvt / 8; i; --i, src += 2) {
+ const Sint64 added =
+ (((Sint64) (Sint32) SDL_SwapLE32(src[0])) +
+ ((Sint64) (Sint32) SDL_SwapLE32(src[1])));
+ *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added / 2)));
+ }
+ }
+ }
+ break;
+
+ case AUDIO_F32:
+ {
+ const float *src = (const float *) cvt->buf;
+ float *dst = (float *) cvt->buf;
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 8; i; --i, src += 2) {
+ const float src1 = SDL_SwapFloatBE(src[0]);
+ const float src2 = SDL_SwapFloatBE(src[1]);
+ const double added = ((double) src1) + ((double) src2);
+ const float halved = (float) (added * 0.5);
+ *(dst++) = SDL_SwapFloatBE(halved);
+ }
+ } else {
+ for (i = cvt->len_cvt / 8; i; --i, src += 2) {
+ const float src1 = SDL_SwapFloatLE(src[0]);
+ const float src2 = SDL_SwapFloatLE(src[1]);
+ const double added = ((double) src1) + ((double) src2);
+ const float halved = (float) (added * 0.5);
+ *(dst++) = SDL_SwapFloatLE(halved);
+ }
+ }
+ }
+ break;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
}
+
/* Discard top 4 channels */
-void SDLCALL SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format)
+static void SDLCALL
+SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format)
{
- int i;
- Sint32 lsample, rsample;
+ int i;
#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting down to stereo\n");
+ fprintf(stderr, "Converting down from 6 channels to stereo\n");
#endif
- switch (format&0x8018) {
- case AUDIO_U8: {
- Uint8 *src, *dst;
+#define strip_chans_6_to_2(type) \
+ { \
+ const type *src = (const type *) cvt->buf; \
+ type *dst = (type *) cvt->buf; \
+ for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \
+ dst[0] = src[0]; \
+ dst[1] = src[1]; \
+ src += 6; \
+ dst += 2; \
+ } \
+ }
- src = cvt->buf;
- dst = cvt->buf;
- for ( i=cvt->len_cvt/6; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- src += 6;
- dst += 2;
- }
- }
- break;
+ /* this function only cares about typesize, and data as a block of bits. */
+ switch (SDL_AUDIO_BITSIZE(format)) {
+ case 8:
+ strip_chans_6_to_2(Uint8);
+ break;
+ case 16:
+ strip_chans_6_to_2(Uint16);
+ break;
+ case 32:
+ strip_chans_6_to_2(Uint32);
+ break;
+ }
- case AUDIO_S8: {
- Sint8 *src, *dst;
+#undef strip_chans_6_to_2
- src = (Sint8 *)cvt->buf;
- dst = (Sint8 *)cvt->buf;
- for ( i=cvt->len_cvt/6; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- src += 6;
- dst += 2;
- }
- }
- break;
-
- case AUDIO_U16: {
- Uint8 *src, *dst;
-
- src = cvt->buf;
- dst = cvt->buf;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/12; i; --i ) {
- lsample = (Uint16)((src[0]<<8)|src[1]);
- rsample = (Uint16)((src[2]<<8)|src[3]);
- dst[1] = (lsample&0xFF);
- lsample >>= 8;
- dst[0] = (lsample&0xFF);
- dst[3] = (rsample&0xFF);
- rsample >>= 8;
- dst[2] = (rsample&0xFF);
- src += 12;
- dst += 4;
- }
- } else {
- for ( i=cvt->len_cvt/12; i; --i ) {
- lsample = (Uint16)((src[1]<<8)|src[0]);
- rsample = (Uint16)((src[3]<<8)|src[2]);
- dst[0] = (lsample&0xFF);
- lsample >>= 8;
- dst[1] = (lsample&0xFF);
- dst[2] = (rsample&0xFF);
- rsample >>= 8;
- dst[3] = (rsample&0xFF);
- src += 12;
- dst += 4;
- }
- }
- }
- break;
-
- case AUDIO_S16: {
- Uint8 *src, *dst;
-
- src = cvt->buf;
- dst = cvt->buf;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/12; i; --i ) {
- lsample = (Sint16)((src[0]<<8)|src[1]);
- rsample = (Sint16)((src[2]<<8)|src[3]);
- dst[1] = (lsample&0xFF);
- lsample >>= 8;
- dst[0] = (lsample&0xFF);
- dst[3] = (rsample&0xFF);
- rsample >>= 8;
- dst[2] = (rsample&0xFF);
- src += 12;
- dst += 4;
- }
- } else {
- for ( i=cvt->len_cvt/12; i; --i ) {
- lsample = (Sint16)((src[1]<<8)|src[0]);
- rsample = (Sint16)((src[3]<<8)|src[2]);
- dst[0] = (lsample&0xFF);
- lsample >>= 8;
- dst[1] = (lsample&0xFF);
- dst[2] = (rsample&0xFF);
- rsample >>= 8;
- dst[3] = (rsample&0xFF);
- src += 12;
- dst += 4;
- }
- }
- }
- break;
- }
- cvt->len_cvt /= 3;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+ cvt->len_cvt /= 3;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
}
/* Discard top 2 channels of 6 */
-void SDLCALL SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format)
+static void SDLCALL
+SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
{
- int i;
- Sint32 lsample, rsample;
+ int i;
#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting 6 down to quad\n");
+ fprintf(stderr, "Converting 6 down to quad\n");
#endif
- switch (format&0x8018) {
- case AUDIO_U8: {
- Uint8 *src, *dst;
+#define strip_chans_6_to_4(type) \
+ { \
+ const type *src = (const type *) cvt->buf; \
+ type *dst = (type *) cvt->buf; \
+ for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \
+ dst[0] = src[0]; \
+ dst[1] = src[1]; \
+ dst[2] = src[2]; \
+ dst[3] = src[3]; \
+ src += 6; \
+ dst += 4; \
+ } \
+ }
- src = cvt->buf;
- dst = cvt->buf;
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- src += 4;
- dst += 2;
- }
- }
- break;
+ /* this function only cares about typesize, and data as a block of bits. */
+ switch (SDL_AUDIO_BITSIZE(format)) {
+ case 8:
+ strip_chans_6_to_4(Uint8);
+ break;
+ case 16:
+ strip_chans_6_to_4(Uint16);
+ break;
+ case 32:
+ strip_chans_6_to_4(Uint32);
+ break;
+ }
- case AUDIO_S8: {
- Sint8 *src, *dst;
+#undef strip_chans_6_to_4
- src = (Sint8 *)cvt->buf;
- dst = (Sint8 *)cvt->buf;
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- src += 4;
- dst += 2;
- }
- }
- break;
-
- case AUDIO_U16: {
- Uint8 *src, *dst;
-
- src = cvt->buf;
- dst = cvt->buf;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/8; i; --i ) {
- lsample = (Uint16)((src[0]<<8)|src[1]);
- rsample = (Uint16)((src[2]<<8)|src[3]);
- dst[1] = (lsample&0xFF);
- lsample >>= 8;
- dst[0] = (lsample&0xFF);
- dst[3] = (rsample&0xFF);
- rsample >>= 8;
- dst[2] = (rsample&0xFF);
- src += 8;
- dst += 4;
- }
- } else {
- for ( i=cvt->len_cvt/8; i; --i ) {
- lsample = (Uint16)((src[1]<<8)|src[0]);
- rsample = (Uint16)((src[3]<<8)|src[2]);
- dst[0] = (lsample&0xFF);
- lsample >>= 8;
- dst[1] = (lsample&0xFF);
- dst[2] = (rsample&0xFF);
- rsample >>= 8;
- dst[3] = (rsample&0xFF);
- src += 8;
- dst += 4;
- }
- }
- }
- break;
-
- case AUDIO_S16: {
- Uint8 *src, *dst;
-
- src = cvt->buf;
- dst = cvt->buf;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/8; i; --i ) {
- lsample = (Sint16)((src[0]<<8)|src[1]);
- rsample = (Sint16)((src[2]<<8)|src[3]);
- dst[1] = (lsample&0xFF);
- lsample >>= 8;
- dst[0] = (lsample&0xFF);
- dst[3] = (rsample&0xFF);
- rsample >>= 8;
- dst[2] = (rsample&0xFF);
- src += 8;
- dst += 4;
- }
- } else {
- for ( i=cvt->len_cvt/8; i; --i ) {
- lsample = (Sint16)((src[1]<<8)|src[0]);
- rsample = (Sint16)((src[3]<<8)|src[2]);
- dst[0] = (lsample&0xFF);
- lsample >>= 8;
- dst[1] = (lsample&0xFF);
- dst[2] = (rsample&0xFF);
- rsample >>= 8;
- dst[3] = (rsample&0xFF);
- src += 8;
- dst += 4;
- }
- }
- }
- break;
- }
- cvt->len_cvt /= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+ cvt->len_cvt /= 6;
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
}
/* Duplicate a mono channel to both stereo channels */
-void SDLCALL SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format)
+static void SDLCALL
+SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format)
{
- int i;
+ int i;
#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting to stereo\n");
+ fprintf(stderr, "Converting to stereo\n");
#endif
- if ( (format & 0xFF) == 16 ) {
- Uint16 *src, *dst;
- src = (Uint16 *)(cvt->buf+cvt->len_cvt);
- dst = (Uint16 *)(cvt->buf+cvt->len_cvt*2);
- for ( i=cvt->len_cvt/2; i; --i ) {
- dst -= 2;
- src -= 1;
- dst[0] = src[0];
- dst[1] = src[0];
- }
- } else {
- Uint8 *src, *dst;
+#define dup_chans_1_to_2(type) \
+ { \
+ const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
+ type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
+ for (i = cvt->len_cvt / 2; i; --i, --src) { \
+ const type val = *src; \
+ dst -= 2; \
+ dst[0] = dst[1] = val; \
+ } \
+ }
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
- for ( i=cvt->len_cvt; i; --i ) {
- dst -= 2;
- src -= 1;
- dst[0] = src[0];
- dst[1] = src[0];
- }
- }
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+ /* this function only cares about typesize, and data as a block of bits. */
+ switch (SDL_AUDIO_BITSIZE(format)) {
+ case 8:
+ dup_chans_1_to_2(Uint8);
+ break;
+ case 16:
+ dup_chans_1_to_2(Uint16);
+ break;
+ case 32:
+ dup_chans_1_to_2(Uint32);
+ break;
+ }
+
+#undef dup_chans_1_to_2
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
}
/* Duplicate a stereo channel to a pseudo-5.1 stream */
-void SDLCALL SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format)
+static void SDLCALL
+SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format)
{
- int i;
+ int i;
#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting stereo to surround\n");
+ fprintf(stderr, "Converting stereo to surround\n");
#endif
- switch (format&0x8018) {
- case AUDIO_U8: {
- Uint8 *src, *dst, lf, rf, ce;
+ switch (format & (SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_BITSIZE)) {
+ case AUDIO_U8:
+ {
+ Uint8 *src, *dst, lf, rf, ce;
- src = (Uint8 *)(cvt->buf+cvt->len_cvt);
- dst = (Uint8 *)(cvt->buf+cvt->len_cvt*3);
- for ( i=cvt->len_cvt; i; --i ) {
- dst -= 6;
- src -= 2;
- lf = src[0];
- rf = src[1];
- ce = (lf/2) + (rf/2);
- dst[0] = lf;
- dst[1] = rf;
- dst[2] = lf - ce;
- dst[3] = rf - ce;
- dst[4] = ce;
- dst[5] = ce;
- }
- }
- break;
+ src = (Uint8 *) (cvt->buf + cvt->len_cvt);
+ dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 3);
+ for (i = cvt->len_cvt; i; --i) {
+ dst -= 6;
+ src -= 2;
+ lf = src[0];
+ rf = src[1];
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = lf;
+ dst[1] = rf;
+ dst[2] = lf - ce;
+ dst[3] = rf - ce;
+ dst[4] = ce;
+ dst[5] = ce;
+ }
+ }
+ break;
- case AUDIO_S8: {
- Sint8 *src, *dst, lf, rf, ce;
+ case AUDIO_S8:
+ {
+ Sint8 *src, *dst, lf, rf, ce;
- src = (Sint8 *)cvt->buf+cvt->len_cvt;
- dst = (Sint8 *)cvt->buf+cvt->len_cvt*3;
- for ( i=cvt->len_cvt; i; --i ) {
- dst -= 6;
- src -= 2;
- lf = src[0];
- rf = src[1];
- ce = (lf/2) + (rf/2);
- dst[0] = lf;
- dst[1] = rf;
- dst[2] = lf - ce;
- dst[3] = rf - ce;
- dst[4] = ce;
- dst[5] = ce;
- }
- }
- break;
+ src = (Sint8 *) cvt->buf + cvt->len_cvt;
+ dst = (Sint8 *) cvt->buf + cvt->len_cvt * 3;
+ for (i = cvt->len_cvt; i; --i) {
+ dst -= 6;
+ src -= 2;
+ lf = src[0];
+ rf = src[1];
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = lf;
+ dst[1] = rf;
+ dst[2] = lf - ce;
+ dst[3] = rf - ce;
+ dst[4] = ce;
+ dst[5] = ce;
+ }
+ }
+ break;
- case AUDIO_U16: {
- Uint8 *src, *dst;
- Uint16 lf, rf, ce, lr, rr;
+ case AUDIO_U16:
+ {
+ Uint8 *src, *dst;
+ Uint16 lf, rf, ce, lr, rr;
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*3;
+ src = cvt->buf + cvt->len_cvt;
+ dst = cvt->buf + cvt->len_cvt * 3;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 12;
- src -= 4;
- lf = (Uint16)((src[0]<<8)|src[1]);
- rf = (Uint16)((src[2]<<8)|src[3]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[1] = (lf&0xFF);
- dst[0] = ((lf>>8)&0xFF);
- dst[3] = (rf&0xFF);
- dst[2] = ((rf>>8)&0xFF);
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 12;
+ src -= 4;
+ lf = (Uint16) ((src[0] << 8) | src[1]);
+ rf = (Uint16) ((src[2] << 8) | src[3]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[1] = (lf & 0xFF);
+ dst[0] = ((lf >> 8) & 0xFF);
+ dst[3] = (rf & 0xFF);
+ dst[2] = ((rf >> 8) & 0xFF);
- dst[1+4] = (lr&0xFF);
- dst[0+4] = ((lr>>8)&0xFF);
- dst[3+4] = (rr&0xFF);
- dst[2+4] = ((rr>>8)&0xFF);
+ dst[1 + 4] = (lr & 0xFF);
+ dst[0 + 4] = ((lr >> 8) & 0xFF);
+ dst[3 + 4] = (rr & 0xFF);
+ dst[2 + 4] = ((rr >> 8) & 0xFF);
- dst[1+8] = (ce&0xFF);
- dst[0+8] = ((ce>>8)&0xFF);
- dst[3+8] = (ce&0xFF);
- dst[2+8] = ((ce>>8)&0xFF);
- }
- } else {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 12;
- src -= 4;
- lf = (Uint16)((src[1]<<8)|src[0]);
- rf = (Uint16)((src[3]<<8)|src[2]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[0] = (lf&0xFF);
- dst[1] = ((lf>>8)&0xFF);
- dst[2] = (rf&0xFF);
- dst[3] = ((rf>>8)&0xFF);
+ dst[1 + 8] = (ce & 0xFF);
+ dst[0 + 8] = ((ce >> 8) & 0xFF);
+ dst[3 + 8] = (ce & 0xFF);
+ dst[2 + 8] = ((ce >> 8) & 0xFF);
+ }
+ } else {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 12;
+ src -= 4;
+ lf = (Uint16) ((src[1] << 8) | src[0]);
+ rf = (Uint16) ((src[3] << 8) | src[2]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[0] = (lf & 0xFF);
+ dst[1] = ((lf >> 8) & 0xFF);
+ dst[2] = (rf & 0xFF);
+ dst[3] = ((rf >> 8) & 0xFF);
- dst[0+4] = (lr&0xFF);
- dst[1+4] = ((lr>>8)&0xFF);
- dst[2+4] = (rr&0xFF);
- dst[3+4] = ((rr>>8)&0xFF);
+ dst[0 + 4] = (lr & 0xFF);
+ dst[1 + 4] = ((lr >> 8) & 0xFF);
+ dst[2 + 4] = (rr & 0xFF);
+ dst[3 + 4] = ((rr >> 8) & 0xFF);
- dst[0+8] = (ce&0xFF);
- dst[1+8] = ((ce>>8)&0xFF);
- dst[2+8] = (ce&0xFF);
- dst[3+8] = ((ce>>8)&0xFF);
- }
- }
- }
- break;
+ dst[0 + 8] = (ce & 0xFF);
+ dst[1 + 8] = ((ce >> 8) & 0xFF);
+ dst[2 + 8] = (ce & 0xFF);
+ dst[3 + 8] = ((ce >> 8) & 0xFF);
+ }
+ }
+ }
+ break;
- case AUDIO_S16: {
- Uint8 *src, *dst;
- Sint16 lf, rf, ce, lr, rr;
+ case AUDIO_S16:
+ {
+ Uint8 *src, *dst;
+ Sint16 lf, rf, ce, lr, rr;
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*3;
+ src = cvt->buf + cvt->len_cvt;
+ dst = cvt->buf + cvt->len_cvt * 3;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 12;
- src -= 4;
- lf = (Sint16)((src[0]<<8)|src[1]);
- rf = (Sint16)((src[2]<<8)|src[3]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[1] = (lf&0xFF);
- dst[0] = ((lf>>8)&0xFF);
- dst[3] = (rf&0xFF);
- dst[2] = ((rf>>8)&0xFF);
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 12;
+ src -= 4;
+ lf = (Sint16) ((src[0] << 8) | src[1]);
+ rf = (Sint16) ((src[2] << 8) | src[3]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[1] = (lf & 0xFF);
+ dst[0] = ((lf >> 8) & 0xFF);
+ dst[3] = (rf & 0xFF);
+ dst[2] = ((rf >> 8) & 0xFF);
- dst[1+4] = (lr&0xFF);
- dst[0+4] = ((lr>>8)&0xFF);
- dst[3+4] = (rr&0xFF);
- dst[2+4] = ((rr>>8)&0xFF);
+ dst[1 + 4] = (lr & 0xFF);
+ dst[0 + 4] = ((lr >> 8) & 0xFF);
+ dst[3 + 4] = (rr & 0xFF);
+ dst[2 + 4] = ((rr >> 8) & 0xFF);
- dst[1+8] = (ce&0xFF);
- dst[0+8] = ((ce>>8)&0xFF);
- dst[3+8] = (ce&0xFF);
- dst[2+8] = ((ce>>8)&0xFF);
- }
- } else {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 12;
- src -= 4;
- lf = (Sint16)((src[1]<<8)|src[0]);
- rf = (Sint16)((src[3]<<8)|src[2]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[0] = (lf&0xFF);
- dst[1] = ((lf>>8)&0xFF);
- dst[2] = (rf&0xFF);
- dst[3] = ((rf>>8)&0xFF);
+ dst[1 + 8] = (ce & 0xFF);
+ dst[0 + 8] = ((ce >> 8) & 0xFF);
+ dst[3 + 8] = (ce & 0xFF);
+ dst[2 + 8] = ((ce >> 8) & 0xFF);
+ }
+ } else {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 12;
+ src -= 4;
+ lf = (Sint16) ((src[1] << 8) | src[0]);
+ rf = (Sint16) ((src[3] << 8) | src[2]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[0] = (lf & 0xFF);
+ dst[1] = ((lf >> 8) & 0xFF);
+ dst[2] = (rf & 0xFF);
+ dst[3] = ((rf >> 8) & 0xFF);
- dst[0+4] = (lr&0xFF);
- dst[1+4] = ((lr>>8)&0xFF);
- dst[2+4] = (rr&0xFF);
- dst[3+4] = ((rr>>8)&0xFF);
+ dst[0 + 4] = (lr & 0xFF);
+ dst[1 + 4] = ((lr >> 8) & 0xFF);
+ dst[2 + 4] = (rr & 0xFF);
+ dst[3 + 4] = ((rr >> 8) & 0xFF);
- dst[0+8] = (ce&0xFF);
- dst[1+8] = ((ce>>8)&0xFF);
- dst[2+8] = (ce&0xFF);
- dst[3+8] = ((ce>>8)&0xFF);
- }
- }
- }
- break;
- }
- cvt->len_cvt *= 3;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+ dst[0 + 8] = (ce & 0xFF);
+ dst[1 + 8] = ((ce >> 8) & 0xFF);
+ dst[2 + 8] = (ce & 0xFF);
+ dst[3 + 8] = ((ce >> 8) & 0xFF);
+ }
+ }
+ }
+ break;
+
+ case AUDIO_S32:
+ {
+ Sint32 lf, rf, ce;
+ const Uint32 *src = (const Uint32 *) cvt->buf + cvt->len_cvt;
+ Uint32 *dst = (Uint32 *) cvt->buf + cvt->len_cvt * 3;
+
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 8; i; --i) {
+ dst -= 6;
+ src -= 2;
+ lf = (Sint32) SDL_SwapBE32(src[0]);
+ rf = (Sint32) SDL_SwapBE32(src[1]);
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = SDL_SwapBE32((Uint32) lf);
+ dst[1] = SDL_SwapBE32((Uint32) rf);
+ dst[2] = SDL_SwapBE32((Uint32) (lf - ce));
+ dst[3] = SDL_SwapBE32((Uint32) (rf - ce));
+ dst[4] = SDL_SwapBE32((Uint32) ce);
+ dst[5] = SDL_SwapBE32((Uint32) ce);
+ }
+ } else {
+ for (i = cvt->len_cvt / 8; i; --i) {
+ dst -= 6;
+ src -= 2;
+ lf = (Sint32) SDL_SwapLE32(src[0]);
+ rf = (Sint32) SDL_SwapLE32(src[1]);
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = SDL_SwapLE32((Uint32) (lf - ce));
+ dst[3] = SDL_SwapLE32((Uint32) (rf - ce));
+ dst[4] = SDL_SwapLE32((Uint32) ce);
+ dst[5] = SDL_SwapLE32((Uint32) ce);
+ }
+ }
+ }
+ break;
+
+ case AUDIO_F32:
+ {
+ float lf, rf, ce;
+ const float *src = (const float *) cvt->buf + cvt->len_cvt;
+ float *dst = (float *) cvt->buf + cvt->len_cvt * 3;
+
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 8; i; --i) {
+ dst -= 6;
+ src -= 2;
+ lf = SDL_SwapFloatBE(src[0]);
+ rf = SDL_SwapFloatBE(src[1]);
+ ce = (lf * 0.5f) + (rf * 0.5f);
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = SDL_SwapFloatBE(lf - ce);
+ dst[3] = SDL_SwapFloatBE(rf - ce);
+ dst[4] = dst[5] = SDL_SwapFloatBE(ce);
+ }
+ } else {
+ for (i = cvt->len_cvt / 8; i; --i) {
+ dst -= 6;
+ src -= 2;
+ lf = SDL_SwapFloatLE(src[0]);
+ rf = SDL_SwapFloatLE(src[1]);
+ ce = (lf * 0.5f) + (rf * 0.5f);
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = SDL_SwapFloatLE(lf - ce);
+ dst[3] = SDL_SwapFloatLE(rf - ce);
+ dst[4] = dst[5] = SDL_SwapFloatLE(ce);
+ }
+ }
+ }
+ break;
+
+ }
+ cvt->len_cvt *= 3;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
}
/* Duplicate a stereo channel to a pseudo-4.0 stream */
-void SDLCALL SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format)
+static void SDLCALL
+SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
{
- int i;
+ int i;
#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting stereo to quad\n");
+ fprintf(stderr, "Converting stereo to quad\n");
#endif
- switch (format&0x8018) {
- case AUDIO_U8: {
- Uint8 *src, *dst, lf, rf, ce;
+ switch (format & (SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_BITSIZE)) {
+ case AUDIO_U8:
+ {
+ Uint8 *src, *dst, lf, rf, ce;
- src = (Uint8 *)(cvt->buf+cvt->len_cvt);
- dst = (Uint8 *)(cvt->buf+cvt->len_cvt*2);
- for ( i=cvt->len_cvt; i; --i ) {
- dst -= 4;
- src -= 2;
- lf = src[0];
- rf = src[1];
- ce = (lf/2) + (rf/2);
- dst[0] = lf;
- dst[1] = rf;
- dst[2] = lf - ce;
- dst[3] = rf - ce;
- }
- }
- break;
+ src = (Uint8 *) (cvt->buf + cvt->len_cvt);
+ dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 2);
+ for (i = cvt->len_cvt; i; --i) {
+ dst -= 4;
+ src -= 2;
+ lf = src[0];
+ rf = src[1];
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = lf;
+ dst[1] = rf;
+ dst[2] = lf - ce;
+ dst[3] = rf - ce;
+ }
+ }
+ break;
- case AUDIO_S8: {
- Sint8 *src, *dst, lf, rf, ce;
+ case AUDIO_S8:
+ {
+ Sint8 *src, *dst, lf, rf, ce;
- src = (Sint8 *)cvt->buf+cvt->len_cvt;
- dst = (Sint8 *)cvt->buf+cvt->len_cvt*2;
- for ( i=cvt->len_cvt; i; --i ) {
- dst -= 4;
- src -= 2;
- lf = src[0];
- rf = src[1];
- ce = (lf/2) + (rf/2);
- dst[0] = lf;
- dst[1] = rf;
- dst[2] = lf - ce;
- dst[3] = rf - ce;
- }
- }
- break;
+ src = (Sint8 *) cvt->buf + cvt->len_cvt;
+ dst = (Sint8 *) cvt->buf + cvt->len_cvt * 2;
+ for (i = cvt->len_cvt; i; --i) {
+ dst -= 4;
+ src -= 2;
+ lf = src[0];
+ rf = src[1];
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = lf;
+ dst[1] = rf;
+ dst[2] = lf - ce;
+ dst[3] = rf - ce;
+ }
+ }
+ break;
- case AUDIO_U16: {
- Uint8 *src, *dst;
- Uint16 lf, rf, ce, lr, rr;
+ case AUDIO_U16:
+ {
+ Uint8 *src, *dst;
+ Uint16 lf, rf, ce, lr, rr;
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
+ src = cvt->buf + cvt->len_cvt;
+ dst = cvt->buf + cvt->len_cvt * 2;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 8;
- src -= 4;
- lf = (Uint16)((src[0]<<8)|src[1]);
- rf = (Uint16)((src[2]<<8)|src[3]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[1] = (lf&0xFF);
- dst[0] = ((lf>>8)&0xFF);
- dst[3] = (rf&0xFF);
- dst[2] = ((rf>>8)&0xFF);
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 8;
+ src -= 4;
+ lf = (Uint16) ((src[0] << 8) | src[1]);
+ rf = (Uint16) ((src[2] << 8) | src[3]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[1] = (lf & 0xFF);
+ dst[0] = ((lf >> 8) & 0xFF);
+ dst[3] = (rf & 0xFF);
+ dst[2] = ((rf >> 8) & 0xFF);
- dst[1+4] = (lr&0xFF);
- dst[0+4] = ((lr>>8)&0xFF);
- dst[3+4] = (rr&0xFF);
- dst[2+4] = ((rr>>8)&0xFF);
- }
- } else {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 8;
- src -= 4;
- lf = (Uint16)((src[1]<<8)|src[0]);
- rf = (Uint16)((src[3]<<8)|src[2]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[0] = (lf&0xFF);
- dst[1] = ((lf>>8)&0xFF);
- dst[2] = (rf&0xFF);
- dst[3] = ((rf>>8)&0xFF);
+ dst[1 + 4] = (lr & 0xFF);
+ dst[0 + 4] = ((lr >> 8) & 0xFF);
+ dst[3 + 4] = (rr & 0xFF);
+ dst[2 + 4] = ((rr >> 8) & 0xFF);
+ }
+ } else {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 8;
+ src -= 4;
+ lf = (Uint16) ((src[1] << 8) | src[0]);
+ rf = (Uint16) ((src[3] << 8) | src[2]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[0] = (lf & 0xFF);
+ dst[1] = ((lf >> 8) & 0xFF);
+ dst[2] = (rf & 0xFF);
+ dst[3] = ((rf >> 8) & 0xFF);
- dst[0+4] = (lr&0xFF);
- dst[1+4] = ((lr>>8)&0xFF);
- dst[2+4] = (rr&0xFF);
- dst[3+4] = ((rr>>8)&0xFF);
- }
- }
- }
- break;
+ dst[0 + 4] = (lr & 0xFF);
+ dst[1 + 4] = ((lr >> 8) & 0xFF);
+ dst[2 + 4] = (rr & 0xFF);
+ dst[3 + 4] = ((rr >> 8) & 0xFF);
+ }
+ }
+ }
+ break;
- case AUDIO_S16: {
- Uint8 *src, *dst;
- Sint16 lf, rf, ce, lr, rr;
+ case AUDIO_S16:
+ {
+ Uint8 *src, *dst;
+ Sint16 lf, rf, ce, lr, rr;
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
+ src = cvt->buf + cvt->len_cvt;
+ dst = cvt->buf + cvt->len_cvt * 2;
- if ( (format & 0x1000) == 0x1000 ) {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 8;
- src -= 4;
- lf = (Sint16)((src[0]<<8)|src[1]);
- rf = (Sint16)((src[2]<<8)|src[3]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[1] = (lf&0xFF);
- dst[0] = ((lf>>8)&0xFF);
- dst[3] = (rf&0xFF);
- dst[2] = ((rf>>8)&0xFF);
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 8;
+ src -= 4;
+ lf = (Sint16) ((src[0] << 8) | src[1]);
+ rf = (Sint16) ((src[2] << 8) | src[3]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[1] = (lf & 0xFF);
+ dst[0] = ((lf >> 8) & 0xFF);
+ dst[3] = (rf & 0xFF);
+ dst[2] = ((rf >> 8) & 0xFF);
- dst[1+4] = (lr&0xFF);
- dst[0+4] = ((lr>>8)&0xFF);
- dst[3+4] = (rr&0xFF);
- dst[2+4] = ((rr>>8)&0xFF);
- }
- } else {
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst -= 8;
- src -= 4;
- lf = (Sint16)((src[1]<<8)|src[0]);
- rf = (Sint16)((src[3]<<8)|src[2]);
- ce = (lf/2) + (rf/2);
- rr = lf - ce;
- lr = rf - ce;
- dst[0] = (lf&0xFF);
- dst[1] = ((lf>>8)&0xFF);
- dst[2] = (rf&0xFF);
- dst[3] = ((rf>>8)&0xFF);
+ dst[1 + 4] = (lr & 0xFF);
+ dst[0 + 4] = ((lr >> 8) & 0xFF);
+ dst[3 + 4] = (rr & 0xFF);
+ dst[2 + 4] = ((rr >> 8) & 0xFF);
+ }
+ } else {
+ for (i = cvt->len_cvt / 4; i; --i) {
+ dst -= 8;
+ src -= 4;
+ lf = (Sint16) ((src[1] << 8) | src[0]);
+ rf = (Sint16) ((src[3] << 8) | src[2]);
+ ce = (lf / 2) + (rf / 2);
+ rr = lf - ce;
+ lr = rf - ce;
+ dst[0] = (lf & 0xFF);
+ dst[1] = ((lf >> 8) & 0xFF);
+ dst[2] = (rf & 0xFF);
+ dst[3] = ((rf >> 8) & 0xFF);
- dst[0+4] = (lr&0xFF);
- dst[1+4] = ((lr>>8)&0xFF);
- dst[2+4] = (rr&0xFF);
- dst[3+4] = ((rr>>8)&0xFF);
- }
- }
- }
- break;
- }
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+ dst[0 + 4] = (lr & 0xFF);
+ dst[1 + 4] = ((lr >> 8) & 0xFF);
+ dst[2 + 4] = (rr & 0xFF);
+ dst[3 + 4] = ((rr >> 8) & 0xFF);
+ }
+ }
+ }
+ break;
+
+ case AUDIO_S32:
+ {
+ const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt);
+ Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 2);
+ Sint32 lf, rf, ce;
+
+ if (SDL_AUDIO_ISBIGENDIAN(format)) {
+ for (i = cvt->len_cvt / 8; i; --i) {
+ dst -= 4;
+ src -= 2;
+ lf = (Sint32) SDL_SwapBE32(src[0]);
+ rf = (Sint32) SDL_SwapBE32(src[1]);
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = SDL_SwapBE32((Uint32) (lf - ce));
+ dst[3] = SDL_SwapBE32((Uint32) (rf - ce));
+ }
+ } else {
+ for (i = cvt->len_cvt / 8; i; --i) {
+ dst -= 4;
+ src -= 2;
+ lf = (Sint32) SDL_SwapLE32(src[0]);
+ rf = (Sint32) SDL_SwapLE32(src[1]);
+ ce = (lf / 2) + (rf / 2);
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = SDL_SwapLE32((Uint32) (lf - ce));
+ dst[3] = SDL_SwapLE32((Uint32) (rf - ce));
+ }
+ }
+ }
+ break;
+ }
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
}
-/* Convert 8-bit to 16-bit - LSB */
-void SDLCALL SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format)
+int
+SDL_ConvertAudio(SDL_AudioCVT * cvt)
{
- int i;
- Uint8 *src, *dst;
+ /* !!! FIXME: (cvt) should be const; stack-copy it here. */
+ /* !!! FIXME: (actually, we can't...len_cvt needs to be updated. Grr.) */
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting to 16-bit LSB\n");
+ /* Make sure there's data to convert */
+ if (cvt->buf == NULL) {
+ SDL_SetError("No buffer allocated for conversion");
+ return (-1);
+ }
+ /* Return okay if no conversion is necessary */
+ cvt->len_cvt = cvt->len;
+ if (cvt->filters[0] == NULL) {
+ return (0);
+ }
+
+ /* Set up the conversion and go! */
+ cvt->filter_index = 0;
+ cvt->filters[0] (cvt, cvt->src_format);
+ return (0);
+}
+
+
+static SDL_AudioFilter
+SDL_HandTunedTypeCVT(SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt)
+{
+ /*
+ * Fill in any future conversions that are specialized to a
+ * processor, platform, compiler, or library here.
+ */
+
+ return NULL; /* no specialized converter code available. */
+}
+
+
+/*
+ * Find a converter between two data types. We try to select a hand-tuned
+ * asm/vectorized/optimized function first, and then fallback to an
+ * autogenerated function that is customized to convert between two
+ * specific data types.
+ */
+static int
+SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt,
+ SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt)
+{
+ if (src_fmt != dst_fmt) {
+ const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt);
+ const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt);
+ SDL_AudioFilter filter = SDL_HandTunedTypeCVT(src_fmt, dst_fmt);
+
+ /* No hand-tuned converter? Try the autogenerated ones. */
+ if (filter == NULL) {
+ int i;
+ for (i = 0; sdl_audio_type_filters[i].filter != NULL; i++) {
+ const SDL_AudioTypeFilters *filt = &sdl_audio_type_filters[i];
+ if ((filt->src_fmt == src_fmt) && (filt->dst_fmt == dst_fmt)) {
+ filter = filt->filter;
+ break;
+ }
+ }
+
+ if (filter == NULL) {
+ SDL_SetError("No conversion available for these formats");
+ return -1;
+ }
+ }
+
+ /* Update (cvt) with filter details... */
+ cvt->filters[cvt->filter_index++] = filter;
+ if (src_bitsize < dst_bitsize) {
+ const int mult = (dst_bitsize / src_bitsize);
+ cvt->len_mult *= mult;
+ cvt->len_ratio *= mult;
+ } else if (src_bitsize > dst_bitsize) {
+ cvt->len_ratio /= (src_bitsize / dst_bitsize);
+ }
+
+ return 1; /* added a converter. */
+ }
+
+ return 0; /* no conversion necessary. */
+}
+
+
+static SDL_AudioFilter
+SDL_HandTunedResampleCVT(SDL_AudioCVT * cvt, int dst_channels,
+ int src_rate, int dst_rate)
+{
+ /*
+ * Fill in any future conversions that are specialized to a
+ * processor, platform, compiler, or library here.
+ */
+
+ return NULL; /* no specialized converter code available. */
+}
+
+static int
+SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate)
+{
+ int retval = 0;
+
+ /* If we only built with the arbitrary resamplers, ignore multiples. */
+#if !LESS_RESAMPLERS
+ int lo, hi;
+ int div;
+
+ assert(src_rate != 0);
+ assert(dst_rate != 0);
+ assert(src_rate != dst_rate);
+
+ if (src_rate < dst_rate) {
+ lo = src_rate;
+ hi = dst_rate;
+ } else {
+ lo = dst_rate;
+ hi = src_rate;
+ }
+
+ /* zero means "not a supported multiple" ... we only do 2x and 4x. */
+ if ((hi % lo) != 0)
+ return 0; /* not a multiple. */
+
+ div = hi / lo;
+ retval = ((div == 2) || (div == 4)) ? div : 0;
#endif
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
- for ( i=cvt->len_cvt; i; --i ) {
- src -= 1;
- dst -= 2;
- dst[1] = *src;
- dst[0] = 0;
- }
- format = ((format & ~0x0008) | AUDIO_U16LSB);
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+
+ return retval;
}
-/* Convert 8-bit to 16-bit - MSB */
-void SDLCALL SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format)
+
+static int
+SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, int dst_channels,
+ int src_rate, int dst_rate)
{
- int i;
- Uint8 *src, *dst;
+ if (src_rate != dst_rate) {
+ SDL_AudioFilter filter = SDL_HandTunedResampleCVT(cvt, dst_channels,
+ src_rate, dst_rate);
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting to 16-bit MSB\n");
-#endif
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
- for ( i=cvt->len_cvt; i; --i ) {
- src -= 1;
- dst -= 2;
- dst[0] = *src;
- dst[1] = 0;
- }
- format = ((format & ~0x0008) | AUDIO_U16MSB);
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
+ /* No hand-tuned converter? Try the autogenerated ones. */
+ if (filter == NULL) {
+ int i;
+ const int upsample = (src_rate < dst_rate) ? 1 : 0;
+ const int multiple =
+ SDL_FindFrequencyMultiple(src_rate, dst_rate);
-/* Convert 16-bit to 8-bit */
-void SDLCALL SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
+ for (i = 0; sdl_audio_rate_filters[i].filter != NULL; i++) {
+ const SDL_AudioRateFilters *filt = &sdl_audio_rate_filters[i];
+ if ((filt->fmt == cvt->dst_format) &&
+ (filt->channels == dst_channels) &&
+ (filt->upsample == upsample) &&
+ (filt->multiple == multiple)) {
+ filter = filt->filter;
+ break;
+ }
+ }
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting to 8-bit\n");
-#endif
- src = cvt->buf;
- dst = cvt->buf;
- if ( (format & 0x1000) != 0x1000 ) { /* Little endian */
- ++src;
- }
- for ( i=cvt->len_cvt/2; i; --i ) {
- *dst = *src;
- src += 2;
- dst += 1;
- }
- format = ((format & ~0x9010) | AUDIO_U8);
- cvt->len_cvt /= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
+ if (filter == NULL) {
+ SDL_SetError("No conversion available for these rates");
+ return -1;
+ }
+ }
-/* Toggle signed/unsigned */
-void SDLCALL SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *data;
+ /* Update (cvt) with filter details... */
+ cvt->filters[cvt->filter_index++] = filter;
+ if (src_rate < dst_rate) {
+ const double mult = ((double) dst_rate) / ((double) src_rate);
+ cvt->len_mult *= (int) SDL_ceil(mult);
+ cvt->len_ratio *= mult;
+ } else {
+ cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate);
+ }
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio signedness\n");
-#endif
- data = cvt->buf;
- if ( (format & 0xFF) == 16 ) {
- if ( (format & 0x1000) != 0x1000 ) { /* Little endian */
- ++data;
- }
- for ( i=cvt->len_cvt/2; i; --i ) {
- *data ^= 0x80;
- data += 2;
- }
- } else {
- for ( i=cvt->len_cvt; i; --i ) {
- *data++ ^= 0x80;
- }
- }
- format = (format ^ 0x8000);
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
+ return 1; /* added a converter. */
+ }
-/* Toggle endianness */
-void SDLCALL SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *data, tmp;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio endianness\n");
-#endif
- data = cvt->buf;
- for ( i=cvt->len_cvt/2; i; --i ) {
- tmp = data[0];
- data[0] = data[1];
- data[1] = tmp;
- data += 2;
- }
- format = (format ^ 0x1000);
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-/* Convert rate up by multiple of 2 */
-void SDLCALL SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate * 2\n");
-#endif
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt; i; --i ) {
- src -= 1;
- dst -= 2;
- dst[0] = src[0];
- dst[1] = src[0];
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/2; i; --i ) {
- src -= 2;
- dst -= 4;
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[0];
- dst[3] = src[1];
- }
- break;
- }
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
+ return 0; /* no conversion necessary. */
}
-/* Convert rate up by multiple of 2, for stereo */
-void SDLCALL SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate * 2\n");
-#endif
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt/2; i; --i ) {
- src -= 2;
- dst -= 4;
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[0];
- dst[3] = src[1];
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/4; i; --i ) {
- src -= 4;
- dst -= 8;
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[0];
- dst[5] = src[1];
- dst[6] = src[2];
- dst[7] = src[3];
- }
- break;
- }
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-/* Convert rate up by multiple of 2, for quad */
-void SDLCALL SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate * 2\n");
-#endif
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt/4; i; --i ) {
- src -= 4;
- dst -= 8;
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[0];
- dst[5] = src[1];
- dst[6] = src[2];
- dst[7] = src[3];
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/8; i; --i ) {
- src -= 8;
- dst -= 16;
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[6];
- dst[7] = src[7];
- dst[8] = src[0];
- dst[9] = src[1];
- dst[10] = src[2];
- dst[11] = src[3];
- dst[12] = src[4];
- dst[13] = src[5];
- dst[14] = src[6];
- dst[15] = src[7];
- }
- break;
- }
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-
-/* Convert rate up by multiple of 2, for 5.1 */
-void SDLCALL SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate * 2\n");
-#endif
- src = cvt->buf+cvt->len_cvt;
- dst = cvt->buf+cvt->len_cvt*2;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt/6; i; --i ) {
- src -= 6;
- dst -= 12;
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[0];
- dst[7] = src[1];
- dst[8] = src[2];
- dst[9] = src[3];
- dst[10] = src[4];
- dst[11] = src[5];
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/12; i; --i ) {
- src -= 12;
- dst -= 24;
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[6];
- dst[7] = src[7];
- dst[8] = src[8];
- dst[9] = src[9];
- dst[10] = src[10];
- dst[11] = src[11];
- dst[12] = src[0];
- dst[13] = src[1];
- dst[14] = src[2];
- dst[15] = src[3];
- dst[16] = src[4];
- dst[17] = src[5];
- dst[18] = src[6];
- dst[19] = src[7];
- dst[20] = src[8];
- dst[21] = src[9];
- dst[22] = src[10];
- dst[23] = src[11];
- }
- break;
- }
- cvt->len_cvt *= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-/* Convert rate down by multiple of 2 */
-void SDLCALL SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate / 2\n");
-#endif
- src = cvt->buf;
- dst = cvt->buf;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt/2; i; --i ) {
- dst[0] = src[0];
- src += 2;
- dst += 1;
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- src += 4;
- dst += 2;
- }
- break;
- }
- cvt->len_cvt /= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-
-/* Convert rate down by multiple of 2, for stereo */
-void SDLCALL SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate / 2\n");
-#endif
- src = cvt->buf;
- dst = cvt->buf;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt/4; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- src += 4;
- dst += 2;
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/8; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- src += 8;
- dst += 4;
- }
- break;
- }
- cvt->len_cvt /= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-
-/* Convert rate down by multiple of 2, for quad */
-void SDLCALL SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate / 2\n");
-#endif
- src = cvt->buf;
- dst = cvt->buf;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt/8; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- src += 8;
- dst += 4;
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/16; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[6];
- dst[7] = src[7];
- src += 16;
- dst += 8;
- }
- break;
- }
- cvt->len_cvt /= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-/* Convert rate down by multiple of 2, for 5.1 */
-void SDLCALL SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format)
-{
- int i;
- Uint8 *src, *dst;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate / 2\n");
-#endif
- src = cvt->buf;
- dst = cvt->buf;
- switch (format & 0xFF) {
- case 8:
- for ( i=cvt->len_cvt/12; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- src += 12;
- dst += 6;
- }
- break;
- case 16:
- for ( i=cvt->len_cvt/24; i; --i ) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[6];
- dst[7] = src[7];
- dst[8] = src[8];
- dst[9] = src[9];
- dst[10] = src[10];
- dst[11] = src[11];
- src += 24;
- dst += 12;
- }
- break;
- }
- cvt->len_cvt /= 2;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-/* Very slow rate conversion routine */
-void SDLCALL SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format)
-{
- double ipos;
- int i, clen;
-
-#ifdef DEBUG_CONVERT
- fprintf(stderr, "Converting audio rate * %4.4f\n", 1.0/cvt->rate_incr);
-#endif
- clen = (int)((double)cvt->len_cvt / cvt->rate_incr);
- if ( cvt->rate_incr > 1.0 ) {
- switch (format & 0xFF) {
- case 8: {
- Uint8 *output;
-
- output = cvt->buf;
- ipos = 0.0;
- for ( i=clen; i; --i ) {
- *output = cvt->buf[(int)ipos];
- ipos += cvt->rate_incr;
- output += 1;
- }
- }
- break;
-
- case 16: {
- Uint16 *output;
-
- clen &= ~1;
- output = (Uint16 *)cvt->buf;
- ipos = 0.0;
- for ( i=clen/2; i; --i ) {
- *output=((Uint16 *)cvt->buf)[(int)ipos];
- ipos += cvt->rate_incr;
- output += 1;
- }
- }
- break;
- }
- } else {
- switch (format & 0xFF) {
- case 8: {
- Uint8 *output;
-
- output = cvt->buf+clen;
- ipos = (double)cvt->len_cvt;
- for ( i=clen; i; --i ) {
- ipos -= cvt->rate_incr;
- output -= 1;
- *output = cvt->buf[(int)ipos];
- }
- }
- break;
-
- case 16: {
- Uint16 *output;
-
- clen &= ~1;
- output = (Uint16 *)(cvt->buf+clen);
- ipos = (double)cvt->len_cvt/2;
- for ( i=clen/2; i; --i ) {
- ipos -= cvt->rate_incr;
- output -= 1;
- *output=((Uint16 *)cvt->buf)[(int)ipos];
- }
- }
- break;
- }
- }
- cvt->len_cvt = clen;
- if ( cvt->filters[++cvt->filter_index] ) {
- cvt->filters[cvt->filter_index](cvt, format);
- }
-}
-
-int SDL_ConvertAudio(SDL_AudioCVT *cvt)
-{
- /* Make sure there's data to convert */
- if ( cvt->buf == NULL ) {
- SDL_SetError("No buffer allocated for conversion");
- return(-1);
- }
- /* Return okay if no conversion is necessary */
- cvt->len_cvt = cvt->len;
- if ( cvt->filters[0] == NULL ) {
- return(0);
- }
-
- /* Set up the conversion and go! */
- cvt->filter_index = 0;
- cvt->filters[0](cvt, cvt->src_format);
- return(0);
-}
-
-/* Creates a set of audio filters to convert from one format to another.
- Returns -1 if the format conversion is not supported, or 1 if the
- audio filter is set up.
+/* Creates a set of audio filters to convert from one format to another.
+ Returns -1 if the format conversion is not supported, 0 if there's
+ no conversion needed, or 1 if the audio filter is set up.
*/
-
-int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
- Uint16 src_format, Uint8 src_channels, int src_rate,
- Uint16 dst_format, Uint8 dst_channels, int dst_rate)
+
+int
+SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
+ SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate,
+ SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate)
{
-/*printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n",
- src_format, dst_format, src_channels, dst_channels, src_rate, dst_rate);*/
- /* Start off with no conversion necessary */
- cvt->needed = 0;
- cvt->filter_index = 0;
- cvt->filters[0] = NULL;
- cvt->len_mult = 1;
- cvt->len_ratio = 1.0;
+ /*
+ * !!! FIXME: reorder filters based on which grow/shrink the buffer.
+ * !!! FIXME: ideally, we should do everything that shrinks the buffer
+ * !!! FIXME: first, so we don't have to process as many bytes in a given
+ * !!! FIXME: filter and abuse the CPU cache less. This might not be as
+ * !!! FIXME: good in practice as it sounds in theory, though.
+ */
- /* First filter: Endian conversion from src to dst */
- if ( (src_format & 0x1000) != (dst_format & 0x1000)
- && ((src_format & 0xff) == 16) && ((dst_format & 0xff) == 16)) {
- cvt->filters[cvt->filter_index++] = SDL_ConvertEndian;
- }
-
- /* Second filter: Sign conversion -- signed/unsigned */
- if ( (src_format & 0x8000) != (dst_format & 0x8000) ) {
- cvt->filters[cvt->filter_index++] = SDL_ConvertSign;
- }
+ /* there are no unsigned types over 16 bits, so catch this up front. */
+ if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) {
+ SDL_SetError("Invalid source format");
+ return -1;
+ }
+ if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) {
+ SDL_SetError("Invalid destination format");
+ return -1;
+ }
- /* Next filter: Convert 16 bit <--> 8 bit PCM */
- if ( (src_format & 0xFF) != (dst_format & 0xFF) ) {
- switch (dst_format&0x10FF) {
- case AUDIO_U8:
- cvt->filters[cvt->filter_index++] =
- SDL_Convert8;
- cvt->len_ratio /= 2;
- break;
- case AUDIO_U16LSB:
- cvt->filters[cvt->filter_index++] =
- SDL_Convert16LSB;
- cvt->len_mult *= 2;
- cvt->len_ratio *= 2;
- break;
- case AUDIO_U16MSB:
- cvt->filters[cvt->filter_index++] =
- SDL_Convert16MSB;
- cvt->len_mult *= 2;
- cvt->len_ratio *= 2;
- break;
- }
- }
-
- /* Last filter: Mono/Stereo conversion */
- if ( src_channels != dst_channels ) {
- if ( (src_channels == 1) && (dst_channels > 1) ) {
- cvt->filters[cvt->filter_index++] =
- SDL_ConvertStereo;
- cvt->len_mult *= 2;
- src_channels = 2;
- cvt->len_ratio *= 2;
- }
- if ( (src_channels == 2) &&
- (dst_channels == 6) ) {
- cvt->filters[cvt->filter_index++] =
- SDL_ConvertSurround;
- src_channels = 6;
- cvt->len_mult *= 3;
- cvt->len_ratio *= 3;
- }
- if ( (src_channels == 2) &&
- (dst_channels == 4) ) {
- cvt->filters[cvt->filter_index++] =
- SDL_ConvertSurround_4;
- src_channels = 4;
- cvt->len_mult *= 2;
- cvt->len_ratio *= 2;
- }
- while ( (src_channels*2) <= dst_channels ) {
- cvt->filters[cvt->filter_index++] =
- SDL_ConvertStereo;
- cvt->len_mult *= 2;
- src_channels *= 2;
- cvt->len_ratio *= 2;
- }
- if ( (src_channels == 6) &&
- (dst_channels <= 2) ) {
- cvt->filters[cvt->filter_index++] =
- SDL_ConvertStrip;
- src_channels = 2;
- cvt->len_ratio /= 3;
- }
- if ( (src_channels == 6) &&
- (dst_channels == 4) ) {
- cvt->filters[cvt->filter_index++] =
- SDL_ConvertStrip_2;
- src_channels = 4;
- cvt->len_ratio /= 2;
- }
- /* This assumes that 4 channel audio is in the format:
- Left {front/back} + Right {front/back}
- so converting to L/R stereo works properly.
- */
- while ( ((src_channels%2) == 0) &&
- ((src_channels/2) >= dst_channels) ) {
- cvt->filters[cvt->filter_index++] =
- SDL_ConvertMono;
- src_channels /= 2;
- cvt->len_ratio /= 2;
- }
- if ( src_channels != dst_channels ) {
- /* Uh oh.. */;
- }
- }
-
- /* Do rate conversion */
- cvt->rate_incr = 0.0;
- if ( (src_rate/100) != (dst_rate/100) ) {
- Uint32 hi_rate, lo_rate;
- int len_mult;
- double len_ratio;
- void (SDLCALL *rate_cvt)(SDL_AudioCVT *cvt, Uint16 format);
-
- if ( src_rate > dst_rate ) {
- hi_rate = src_rate;
- lo_rate = dst_rate;
- switch (src_channels) {
- case 1: rate_cvt = SDL_RateDIV2; break;
- case 2: rate_cvt = SDL_RateDIV2_c2; break;
- case 4: rate_cvt = SDL_RateDIV2_c4; break;
- case 6: rate_cvt = SDL_RateDIV2_c6; break;
- default: return -1;
- }
- len_mult = 1;
- len_ratio = 0.5;
- } else {
- hi_rate = dst_rate;
- lo_rate = src_rate;
- switch (src_channels) {
- case 1: rate_cvt = SDL_RateMUL2; break;
- case 2: rate_cvt = SDL_RateMUL2_c2; break;
- case 4: rate_cvt = SDL_RateMUL2_c4; break;
- case 6: rate_cvt = SDL_RateMUL2_c6; break;
- default: return -1;
- }
- len_mult = 2;
- len_ratio = 2.0;
- }
- /* If hi_rate = lo_rate*2^x then conversion is easy */
- while ( ((lo_rate*2)/100) <= (hi_rate/100) ) {
- cvt->filters[cvt->filter_index++] = rate_cvt;
- cvt->len_mult *= len_mult;
- lo_rate *= 2;
- cvt->len_ratio *= len_ratio;
- }
- /* We may need a slow conversion here to finish up */
- if ( (lo_rate/100) != (hi_rate/100) ) {
-#if 1
- /* The problem with this is that if the input buffer is
- say 1K, and the conversion rate is say 1.1, then the
- output buffer is 1.1K, which may not be an acceptable
- buffer size for the audio driver (not a power of 2)
- */
- /* For now, punt and hope the rate distortion isn't great.
- */
-#else
- if ( src_rate < dst_rate ) {
- cvt->rate_incr = (double)lo_rate/hi_rate;
- cvt->len_mult *= 2;
- cvt->len_ratio /= cvt->rate_incr;
- } else {
- cvt->rate_incr = (double)hi_rate/lo_rate;
- cvt->len_ratio *= cvt->rate_incr;
- }
- cvt->filters[cvt->filter_index++] = SDL_RateSLOW;
+ /* prevent possible divisions by zero, etc. */
+ if ((src_rate == 0) || (dst_rate == 0)) {
+ SDL_SetError("Source or destination rate is zero");
+ return -1;
+ }
+#ifdef DEBUG_CONVERT
+ printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n",
+ src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate);
#endif
- }
- }
- /* Set up the filter information */
- if ( cvt->filter_index != 0 ) {
- cvt->needed = 1;
- cvt->src_format = src_format;
- cvt->dst_format = dst_format;
- cvt->len = 0;
- cvt->buf = NULL;
- cvt->filters[cvt->filter_index] = NULL;
- }
- return(cvt->needed);
+ /* Start off with no conversion necessary */
+ SDL_zerop(cvt);
+ cvt->src_format = src_fmt;
+ cvt->dst_format = dst_fmt;
+ cvt->needed = 0;
+ cvt->filter_index = 0;
+ cvt->filters[0] = NULL;
+ cvt->len_mult = 1;
+ cvt->len_ratio = 1.0;
+ cvt->rate_incr = ((double) dst_rate) / ((double) src_rate);
+
+ /* Convert data types, if necessary. Updates (cvt). */
+ if (SDL_BuildAudioTypeCVT(cvt, src_fmt, dst_fmt) == -1) {
+ return -1; /* shouldn't happen, but just in case... */
+ }
+
+ /* Channel conversion */
+ if (src_channels != dst_channels) {
+ if ((src_channels == 1) && (dst_channels > 1)) {
+ cvt->filters[cvt->filter_index++] = SDL_ConvertStereo;
+ cvt->len_mult *= 2;
+ src_channels = 2;
+ cvt->len_ratio *= 2;
+ }
+ if ((src_channels == 2) && (dst_channels == 6)) {
+ cvt->filters[cvt->filter_index++] = SDL_ConvertSurround;
+ src_channels = 6;
+ cvt->len_mult *= 3;
+ cvt->len_ratio *= 3;
+ }
+ if ((src_channels == 2) && (dst_channels == 4)) {
+ cvt->filters[cvt->filter_index++] = SDL_ConvertSurround_4;
+ src_channels = 4;
+ cvt->len_mult *= 2;
+ cvt->len_ratio *= 2;
+ }
+ while ((src_channels * 2) <= dst_channels) {
+ cvt->filters[cvt->filter_index++] = SDL_ConvertStereo;
+ cvt->len_mult *= 2;
+ src_channels *= 2;
+ cvt->len_ratio *= 2;
+ }
+ if ((src_channels == 6) && (dst_channels <= 2)) {
+ cvt->filters[cvt->filter_index++] = SDL_ConvertStrip;
+ src_channels = 2;
+ cvt->len_ratio /= 3;
+ }
+ if ((src_channels == 6) && (dst_channels == 4)) {
+ cvt->filters[cvt->filter_index++] = SDL_ConvertStrip_2;
+ src_channels = 4;
+ cvt->len_ratio /= 2;
+ }
+ /* This assumes that 4 channel audio is in the format:
+ Left {front/back} + Right {front/back}
+ so converting to L/R stereo works properly.
+ */
+ while (((src_channels % 2) == 0) &&
+ ((src_channels / 2) >= dst_channels)) {
+ cvt->filters[cvt->filter_index++] = SDL_ConvertMono;
+ src_channels /= 2;
+ cvt->len_ratio /= 2;
+ }
+ if (src_channels != dst_channels) {
+ /* Uh oh.. */ ;
+ }
+ }
+
+ /* Do rate conversion, if necessary. Updates (cvt). */
+ if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) ==
+ -1) {
+ return -1; /* shouldn't happen, but just in case... */
+ }
+
+ /* Set up the filter information */
+ if (cvt->filter_index != 0) {
+ cvt->needed = 1;
+ cvt->src_format = src_fmt;
+ cvt->dst_format = dst_fmt;
+ cvt->len = 0;
+ cvt->buf = NULL;
+ cvt->filters[cvt->filter_index] = NULL;
+ }
+ return (cvt->needed);
}
+
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_audiodev.c b/alienblaster/project/jni/sdl/src/audio/SDL_audiodev.c
index 41d882f54..dda23f8d8 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_audiodev.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_audiodev.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -46,134 +46,93 @@
#define _PATH_DEV_AUDIO "/dev/audio"
#endif
-
-int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
-{
- const char *audiodev;
- int audio_fd;
- char audiopath[1024];
-
- /* Figure out what our audio device is */
- if ( ((audiodev=SDL_getenv("SDL_PATH_DSP")) == NULL) &&
- ((audiodev=SDL_getenv("AUDIODEV")) == NULL) ) {
- if ( classic ) {
- audiodev = _PATH_DEV_AUDIO;
- } else {
- struct stat sb;
-
- /* Added support for /dev/sound/\* in Linux 2.4 */
- if ( ((stat("/dev/sound", &sb) == 0) && S_ISDIR(sb.st_mode)) &&
- ((stat(_PATH_DEV_DSP24, &sb) == 0) && S_ISCHR(sb.st_mode)) ) {
- audiodev = _PATH_DEV_DSP24;
- } else {
- audiodev = _PATH_DEV_DSP;
- }
- }
- }
- audio_fd = open(audiodev, flags, 0);
-
- /* If the first open fails, look for other devices */
- if ( (audio_fd < 0) && (SDL_strlen(audiodev) < (sizeof(audiopath)-3)) ) {
- int exists, instance;
- struct stat sb;
-
- instance = 1;
- do { /* Don't use errno ENOENT - it may not be thread-safe */
- SDL_snprintf(audiopath, SDL_arraysize(audiopath),
- "%s%d", audiodev, instance++);
- exists = 0;
- if ( stat(audiopath, &sb) == 0 ) {
- exists = 1;
- audio_fd = open(audiopath, flags, 0);
- }
- } while ( exists && (audio_fd < 0) );
- audiodev = audiopath;
- }
- if ( path != NULL ) {
- SDL_strlcpy(path, audiodev, maxlen);
- path[maxlen-1] = '\0';
- }
- return(audio_fd);
-}
-
-#elif SDL_AUDIO_DRIVER_PAUD
-
-/* Get the name of the audio device we use for output */
-
-#include
-#include
-
-#include "SDL_stdinc.h"
-#include "SDL_audiodev_c.h"
-
-#ifndef _PATH_DEV_DSP
-#define _PATH_DEV_DSP "/dev/%caud%c/%c"
-#endif
-
-char devsettings[][3] =
-{
- { 'p', '0', '1' }, { 'p', '0', '2' }, { 'p', '0', '3' }, { 'p', '0', '4' },
- { 'p', '1', '1' }, { 'p', '1', '2' }, { 'p', '1', '3' }, { 'p', '1', '4' },
- { 'p', '2', '1' }, { 'p', '2', '2' }, { 'p', '2', '3' }, { 'p', '2', '4' },
- { 'p', '3', '1' }, { 'p', '3', '2' }, { 'p', '3', '3' }, { 'p', '3', '4' },
- { 'b', '0', '1' }, { 'b', '0', '2' }, { 'b', '0', '3' }, { 'b', '0', '4' },
- { 'b', '1', '1' }, { 'b', '1', '2' }, { 'b', '1', '3' }, { 'b', '1', '4' },
- { 'b', '2', '1' }, { 'b', '2', '2' }, { 'b', '2', '3' }, { 'b', '2', '4' },
- { 'b', '3', '1' }, { 'b', '3', '2' }, { 'b', '3', '3' }, { 'b', '3', '4' },
- { '\0', '\0', '\0' }
-};
-
-static int OpenUserDefinedDevice(char *path, int maxlen, int flags)
-{
- const char *audiodev;
- int audio_fd;
-
- /* Figure out what our audio device is */
- if ((audiodev=SDL_getenv("SDL_PATH_DSP")) == NULL) {
- audiodev=SDL_getenv("AUDIODEV");
- }
- if ( audiodev == NULL ) {
- return -1;
- }
- audio_fd = open(audiodev, flags, 0);
- if ( path != NULL ) {
- SDL_strlcpy(path, audiodev, maxlen);
- path[maxlen-1] = '\0';
- }
- return audio_fd;
-}
-
-int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
+static inline void
+test_device(const char *fname, int flags, int (*test) (int fd),
+ char ***devices, int *devCount)
{
struct stat sb;
- int audio_fd;
- char audiopath[1024];
- int cycle;
+ if ((stat(fname, &sb) == 0) && (S_ISCHR(sb.st_mode))) {
+ int audio_fd = open(fname, flags, 0);
+ if ((audio_fd >= 0) && (test(audio_fd))) {
+ void *p =
+ SDL_realloc(*devices, ((*devCount) + 1) * sizeof(char *));
+ if (p != NULL) {
+ size_t len = strlen(fname) + 1;
+ char *str = (char *) SDL_malloc(len);
+ *devices = (char **) p;
+ if (str != NULL) {
+ SDL_strlcpy(str, fname, len);
+ (*devices)[(*devCount)++] = str;
+ }
+ }
+ close(audio_fd);
+ }
+ }
+}
- audio_fd = OpenUserDefinedDevice(path,maxlen,flags);
- if ( audio_fd != -1 ) {
- return audio_fd;
+void
+SDL_FreeUnixAudioDevices(char ***devices, int *devCount)
+{
+ int i = *devCount;
+ if ((i > 0) && (*devices != NULL)) {
+ while (i--) {
+ SDL_free((*devices)[i]);
+ }
}
- cycle = 0;
- while( devsettings[cycle][0] != '\0' ) {
- SDL_snprintf( audiopath, SDL_arraysize(audiopath),
- _PATH_DEV_DSP,
- devsettings[cycle][0],
- devsettings[cycle][1],
- devsettings[cycle][2]);
-
- if ( stat(audiopath, &sb) == 0 ) {
- audio_fd = open(audiopath, flags, 0);
- if ( audio_fd > 0 ) {
- if ( path != NULL ) {
- SDL_strlcpy( path, audiopath, maxlen );
- }
- return audio_fd;
- }
- }
+ if (*devices != NULL) {
+ SDL_free(*devices);
+ }
+
+ *devices = NULL;
+ *devCount = 0;
+}
+
+static int
+test_stub(int fd)
+{
+ return 1;
+}
+
+void
+SDL_EnumUnixAudioDevices(int flags, int classic, int (*test) (int fd),
+ char ***devices, int *devCount)
+{
+ const char *audiodev;
+ char audiopath[1024];
+
+ if (test == NULL)
+ test = test_stub;
+
+ /* Figure out what our audio device is */
+ if (((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) &&
+ ((audiodev = SDL_getenv("AUDIODEV")) == NULL)) {
+ if (classic) {
+ audiodev = _PATH_DEV_AUDIO;
+ } else {
+ struct stat sb;
+
+ /* Added support for /dev/sound/\* in Linux 2.4 */
+ if (((stat("/dev/sound", &sb) == 0) && S_ISDIR(sb.st_mode))
+ && ((stat(_PATH_DEV_DSP24, &sb) == 0)
+ && S_ISCHR(sb.st_mode))) {
+ audiodev = _PATH_DEV_DSP24;
+ } else {
+ audiodev = _PATH_DEV_DSP;
+ }
+ }
+ }
+ test_device(audiodev, flags, test, devices, devCount);
+
+ if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) {
+ int instance = 0;
+ while (instance++ <= 64) {
+ SDL_snprintf(audiopath, SDL_arraysize(audiopath),
+ "%s%d", audiodev, instance);
+ test_device(audiopath, flags, test, devices, devCount);
+ }
}
- return -1;
}
#endif /* Audio driver selection */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_audiodev_c.h b/alienblaster/project/jni/sdl/src/audio/SDL_audiodev_c.h
index d4c0c9c95..7b0143f71 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_audiodev_c.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_audiodev_c.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,8 @@
*/
#include "SDL_config.h"
-/* Open the audio device, storing the pathname in 'path' */
-extern int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic);
+void SDL_EnumUnixAudioDevices(int flags, int classic, int (*test) (int fd),
+ char ***devs, int *count);
+void SDL_FreeUnixAudioDevices(char ***devices, int *devCount);
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_audiomem.h b/alienblaster/project/jni/sdl/src/audio/SDL_audiomem.h
index 3b164ab2e..a539259e5 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_audiomem.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_audiomem.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,3 +23,4 @@
#define SDL_AllocAudioMem SDL_malloc
#define SDL_FreeAudioMem SDL_free
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_audiotypecvt.c b/alienblaster/project/jni/sdl/src/audio/SDL_audiotypecvt.c
new file mode 100644
index 000000000..5fb0d510d
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_audiotypecvt.c
@@ -0,0 +1,16216 @@
+/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+#include "SDL_config.h"
+#include "SDL_audio.h"
+#include "SDL_audio_c.h"
+
+#ifndef DEBUG_CONVERT
+#define DEBUG_CONVERT 0
+#endif
+
+
+/* If you can guarantee your data and need space, you can eliminate code... */
+
+/* Just build the arbitrary resamplers if you're saving code space. */
+#ifndef LESS_RESAMPLERS
+#define LESS_RESAMPLERS 0
+#endif
+
+/* Don't build any resamplers if you're REALLY saving code space. */
+#ifndef NO_RESAMPLERS
+#define NO_RESAMPLERS 0
+#endif
+
+/* Don't build any type converters if you're saving code space. */
+#ifndef NO_CONVERTERS
+#define NO_CONVERTERS 0
+#endif
+
+
+/* *INDENT-OFF* */
+
+#define DIVBY127 0.0078740157480315f
+#define DIVBY32767 3.05185094759972e-05f
+#define DIVBY2147483647 4.6566128752458e-10f
+
+#if !NO_CONVERTERS
+
+static void SDLCALL
+SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n");
+#endif
+
+ src = (const Uint8 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
+ const Sint8 val = ((*src) ^ 0x80);
+ *dst = ((Sint8) val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Uint16 val = (((Uint16) *src) << 8);
+ *dst = SDL_SwapLE16(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Uint16 val = (((Uint16) *src) << 8);
+ *dst = SDL_SwapBE16(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const float val = ((((float) *src) * DIVBY127) - 1.0f);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const float val = ((((float) *src) * DIVBY127) - 1.0f);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n");
+#endif
+
+ src = (const Uint8 *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
+ const Uint8 val = ((((Sint8) *src)) ^ 0x80);
+ *dst = val;
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
+ *dst = SDL_SwapLE16(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
+ *dst = SDL_SwapBE16(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const float val = (((float) ((Sint8) *src)) * DIVBY127);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint8 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
+#endif
+
+ src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+ const float val = (((float) ((Sint8) *src)) * DIVBY127);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ cvt->len_cvt *= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint16 val = SDL_SwapLE16(*src);
+ *dst = SDL_SwapBE16(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
+ *dst = SDL_SwapLE16(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
+ *dst = SDL_SwapBE16(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) SDL_SwapLE16(*src));
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint16 val = SDL_SwapBE16(*src);
+ *dst = SDL_SwapLE16(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
+ *dst = SDL_SwapLE16(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) SDL_SwapBE16(*src));
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n");
+#endif
+
+ src = (const Uint16 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
+ const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
+ *dst = SDL_SwapBE16(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint16 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n");
+#endif
+
+ src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+ for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
+ const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ cvt->len_cvt *= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
+ *dst = SDL_SwapLE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
+ *dst = SDL_SwapBE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint32 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint32 val = ((Sint32) SDL_SwapLE32(*src));
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (float *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (float *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
+ *dst = SDL_SwapLE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
+ *dst = SDL_SwapBE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (Sint32 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const Sint32 val = ((Sint32) SDL_SwapBE32(*src));
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (float *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const Uint32 *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n");
+#endif
+
+ src = (const Uint32 *) cvt->buf;
+ dst = (float *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
+ const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
+ *dst = SDL_SwapLE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
+ *dst = SDL_SwapBE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint32 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint32 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (float *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const float val = SDL_SwapFloatLE(*src);
+ *dst = SDL_SwapFloatBE(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Uint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Uint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f));
+ *dst = val;
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint8 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint8 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f));
+ *dst = ((Sint8) val);
+ }
+
+ cvt->len_cvt /= 4;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
+ *dst = SDL_SwapLE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
+ *dst = ((Sint16) SDL_SwapLE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Uint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Uint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
+ *dst = SDL_SwapBE16(val);
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint16 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint16 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
+ *dst = ((Sint16) SDL_SwapBE16(val));
+ }
+
+ cvt->len_cvt /= 2;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint32 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
+ *dst = ((Sint32) SDL_SwapLE32(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ Sint32 *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (Sint32 *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
+ *dst = ((Sint32) SDL_SwapBE32(val));
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
+ }
+}
+
+static void SDLCALL
+SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+ int i;
+ const float *src;
+ float *dst;
+
+#if DEBUG_CONVERT
+ fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n");
+#endif
+
+ src = (const float *) cvt->buf;
+ dst = (float *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
+ const float val = SDL_SwapFloatBE(*src);
+ *dst = SDL_SwapFloatLE(val);
+ }
+
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
+ }
+}
+
+#endif /* !NO_CONVERTERS */
+
+
+const SDL_AudioTypeFilters sdl_audio_type_filters[] =
+{
+#if !NO_CONVERTERS
+ { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 },
+ { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB },
+ { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB },
+ { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB },
+ { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB },
+ { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB },
+ { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB },
+ { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB },
+ { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB },
+ { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 },
+ { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB },
+ { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB },
+ { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB },
+ { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB },
+ { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB },
+ { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB },
+ { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB },
+ { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB },
+ { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 },
+ { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 },
+ { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB },
+ { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB },
+ { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB },
+ { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB },
+ { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB },
+ { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB },
+ { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB },
+ { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 },
+ { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 },
+ { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB },
+ { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB },
+ { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB },
+ { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB },
+ { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB },
+ { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB },
+ { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB },
+ { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 },
+ { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 },
+ { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB },
+ { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB },
+ { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB },
+ { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB },
+ { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB },
+ { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB },
+ { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB },
+ { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 },
+ { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 },
+ { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB },
+ { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB },
+ { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB },
+ { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB },
+ { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB },
+ { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB },
+ { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB },
+ { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 },
+ { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 },
+ { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB },
+ { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB },
+ { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB },
+ { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB },
+ { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB },
+ { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB },
+ { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB },
+ { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 },
+ { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 },
+ { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB },
+ { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB },
+ { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB },
+ { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB },
+ { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB },
+ { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB },
+ { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB },
+ { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 },
+ { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 },
+ { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB },
+ { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB },
+ { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB },
+ { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB },
+ { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB },
+ { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB },
+ { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB },
+ { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 },
+ { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 },
+ { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB },
+ { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB },
+ { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB },
+ { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB },
+ { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB },
+ { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB },
+ { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB },
+#endif /* !NO_CONVERTERS */
+ { 0, 0, NULL }
+};
+
+
+#if !NO_RESAMPLERS
+
+static void SDLCALL
+SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 16;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
+ Uint8 sample0 = src[0];
+ Uint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = sample0;
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 16;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Uint8 sample0 = src[0];
+ Uint8 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = sample0;
+ dst++;
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
+ Uint8 sample1 = src[1];
+ Uint8 sample0 = src[0];
+ Uint8 last_sample1 = sample1;
+ Uint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = sample1;
+ dst[0] = sample0;
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Uint8 sample0 = src[0];
+ Uint8 sample1 = src[1];
+ Uint8 last_sample0 = sample0;
+ Uint8 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = sample0;
+ dst[1] = sample1;
+ dst += 2;
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
+ Uint8 sample3 = src[3];
+ Uint8 sample2 = src[2];
+ Uint8 sample1 = src[1];
+ Uint8 sample0 = src[0];
+ Uint8 last_sample3 = sample3;
+ Uint8 last_sample2 = sample2;
+ Uint8 last_sample1 = sample1;
+ Uint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = sample3;
+ dst[2] = sample2;
+ dst[1] = sample1;
+ dst[0] = sample0;
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
+ sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Uint8 sample0 = src[0];
+ Uint8 sample1 = src[1];
+ Uint8 sample2 = src[2];
+ Uint8 sample3 = src[3];
+ Uint8 last_sample0 = sample0;
+ Uint8 last_sample1 = sample1;
+ Uint8 last_sample2 = sample2;
+ Uint8 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = sample0;
+ dst[1] = sample1;
+ dst[2] = sample2;
+ dst[3] = sample3;
+ dst += 4;
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
+ sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 96;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
+ Uint8 sample5 = src[5];
+ Uint8 sample4 = src[4];
+ Uint8 sample3 = src[3];
+ Uint8 sample2 = src[2];
+ Uint8 sample1 = src[1];
+ Uint8 sample0 = src[0];
+ Uint8 last_sample5 = sample5;
+ Uint8 last_sample4 = sample4;
+ Uint8 last_sample3 = sample3;
+ Uint8 last_sample2 = sample2;
+ Uint8 last_sample1 = sample1;
+ Uint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = sample5;
+ dst[4] = sample4;
+ dst[3] = sample3;
+ dst[2] = sample2;
+ dst[1] = sample1;
+ dst[0] = sample0;
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
+ sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
+ sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
+ sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 96;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Uint8 sample0 = src[0];
+ Uint8 sample1 = src[1];
+ Uint8 sample2 = src[2];
+ Uint8 sample3 = src[3];
+ Uint8 sample4 = src[4];
+ Uint8 sample5 = src[5];
+ Uint8 last_sample0 = sample0;
+ Uint8 last_sample1 = sample1;
+ Uint8 last_sample2 = sample2;
+ Uint8 last_sample3 = sample3;
+ Uint8 last_sample4 = sample4;
+ Uint8 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = sample0;
+ dst[1] = sample1;
+ dst[2] = sample2;
+ dst[3] = sample3;
+ dst[4] = sample4;
+ dst[5] = sample5;
+ dst += 6;
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
+ sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
+ sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
+ sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
+ Uint8 sample7 = src[7];
+ Uint8 sample6 = src[6];
+ Uint8 sample5 = src[5];
+ Uint8 sample4 = src[4];
+ Uint8 sample3 = src[3];
+ Uint8 sample2 = src[2];
+ Uint8 sample1 = src[1];
+ Uint8 sample0 = src[0];
+ Uint8 last_sample7 = sample7;
+ Uint8 last_sample6 = sample6;
+ Uint8 last_sample5 = sample5;
+ Uint8 last_sample4 = sample4;
+ Uint8 last_sample3 = sample3;
+ Uint8 last_sample2 = sample2;
+ Uint8 last_sample1 = sample1;
+ Uint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = sample7;
+ dst[6] = sample6;
+ dst[5] = sample5;
+ dst[4] = sample4;
+ dst[3] = sample3;
+ dst[2] = sample2;
+ dst[1] = sample1;
+ dst[0] = sample0;
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
+ sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
+ sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
+ sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
+ sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
+ sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Uint8 sample0 = src[0];
+ Uint8 sample1 = src[1];
+ Uint8 sample2 = src[2];
+ Uint8 sample3 = src[3];
+ Uint8 sample4 = src[4];
+ Uint8 sample5 = src[5];
+ Uint8 sample6 = src[6];
+ Uint8 sample7 = src[7];
+ Uint8 last_sample0 = sample0;
+ Uint8 last_sample1 = sample1;
+ Uint8 last_sample2 = sample2;
+ Uint8 last_sample3 = sample3;
+ Uint8 last_sample4 = sample4;
+ Uint8 last_sample5 = sample5;
+ Uint8 last_sample6 = sample6;
+ Uint8 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = sample0;
+ dst[1] = sample1;
+ dst[2] = sample2;
+ dst[3] = sample3;
+ dst[4] = sample4;
+ dst[5] = sample5;
+ dst[6] = sample6;
+ dst[7] = sample7;
+ dst += 8;
+ sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1);
+ sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1);
+ sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1);
+ sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1);
+ sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1);
+ sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1);
+ sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 16;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = ((Sint8) sample0);
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 16;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint8) sample0);
+ dst++;
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 last_sample1 = sample1;
+ Sint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = ((Sint8) sample1);
+ dst[0] = ((Sint8) sample0);
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 last_sample0 = sample0;
+ Sint8 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint8) sample0);
+ dst[1] = ((Sint8) sample1);
+ dst += 2;
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
+ Sint8 sample3 = ((Sint8) src[3]);
+ Sint8 sample2 = ((Sint8) src[2]);
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 last_sample3 = sample3;
+ Sint8 last_sample2 = sample2;
+ Sint8 last_sample1 = sample1;
+ Sint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = ((Sint8) sample3);
+ dst[2] = ((Sint8) sample2);
+ dst[1] = ((Sint8) sample1);
+ dst[0] = ((Sint8) sample0);
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
+ sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 sample2 = ((Sint8) src[2]);
+ Sint8 sample3 = ((Sint8) src[3]);
+ Sint8 last_sample0 = sample0;
+ Sint8 last_sample1 = sample1;
+ Sint8 last_sample2 = sample2;
+ Sint8 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint8) sample0);
+ dst[1] = ((Sint8) sample1);
+ dst[2] = ((Sint8) sample2);
+ dst[3] = ((Sint8) sample3);
+ dst += 4;
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
+ sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 96;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
+ Sint8 sample5 = ((Sint8) src[5]);
+ Sint8 sample4 = ((Sint8) src[4]);
+ Sint8 sample3 = ((Sint8) src[3]);
+ Sint8 sample2 = ((Sint8) src[2]);
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 last_sample5 = sample5;
+ Sint8 last_sample4 = sample4;
+ Sint8 last_sample3 = sample3;
+ Sint8 last_sample2 = sample2;
+ Sint8 last_sample1 = sample1;
+ Sint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = ((Sint8) sample5);
+ dst[4] = ((Sint8) sample4);
+ dst[3] = ((Sint8) sample3);
+ dst[2] = ((Sint8) sample2);
+ dst[1] = ((Sint8) sample1);
+ dst[0] = ((Sint8) sample0);
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
+ sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
+ sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
+ sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 96;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 sample2 = ((Sint8) src[2]);
+ Sint8 sample3 = ((Sint8) src[3]);
+ Sint8 sample4 = ((Sint8) src[4]);
+ Sint8 sample5 = ((Sint8) src[5]);
+ Sint8 last_sample0 = sample0;
+ Sint8 last_sample1 = sample1;
+ Sint8 last_sample2 = sample2;
+ Sint8 last_sample3 = sample3;
+ Sint8 last_sample4 = sample4;
+ Sint8 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint8) sample0);
+ dst[1] = ((Sint8) sample1);
+ dst[2] = ((Sint8) sample2);
+ dst[3] = ((Sint8) sample3);
+ dst[4] = ((Sint8) sample4);
+ dst[5] = ((Sint8) sample5);
+ dst += 6;
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
+ sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
+ sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
+ sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
+ Sint8 sample7 = ((Sint8) src[7]);
+ Sint8 sample6 = ((Sint8) src[6]);
+ Sint8 sample5 = ((Sint8) src[5]);
+ Sint8 sample4 = ((Sint8) src[4]);
+ Sint8 sample3 = ((Sint8) src[3]);
+ Sint8 sample2 = ((Sint8) src[2]);
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 last_sample7 = sample7;
+ Sint8 last_sample6 = sample6;
+ Sint8 last_sample5 = sample5;
+ Sint8 last_sample4 = sample4;
+ Sint8 last_sample3 = sample3;
+ Sint8 last_sample2 = sample2;
+ Sint8 last_sample1 = sample1;
+ Sint8 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = ((Sint8) sample7);
+ dst[6] = ((Sint8) sample6);
+ dst[5] = ((Sint8) sample5);
+ dst[4] = ((Sint8) sample4);
+ dst[3] = ((Sint8) sample3);
+ dst[2] = ((Sint8) sample2);
+ dst[1] = ((Sint8) sample1);
+ dst[0] = ((Sint8) sample0);
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
+ sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
+ sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
+ sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
+ sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
+ sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint8 sample0 = ((Sint8) src[0]);
+ Sint8 sample1 = ((Sint8) src[1]);
+ Sint8 sample2 = ((Sint8) src[2]);
+ Sint8 sample3 = ((Sint8) src[3]);
+ Sint8 sample4 = ((Sint8) src[4]);
+ Sint8 sample5 = ((Sint8) src[5]);
+ Sint8 sample6 = ((Sint8) src[6]);
+ Sint8 sample7 = ((Sint8) src[7]);
+ Sint8 last_sample0 = sample0;
+ Sint8 last_sample1 = sample1;
+ Sint8 last_sample2 = sample2;
+ Sint8 last_sample3 = sample3;
+ Sint8 last_sample4 = sample4;
+ Sint8 last_sample5 = sample5;
+ Sint8 last_sample6 = sample6;
+ Sint8 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint8) sample0);
+ dst[1] = ((Sint8) sample1);
+ dst[2] = ((Sint8) sample2);
+ dst[3] = ((Sint8) sample3);
+ dst[4] = ((Sint8) sample4);
+ dst[5] = ((Sint8) sample5);
+ dst[6] = ((Sint8) sample6);
+ dst[7] = ((Sint8) sample7);
+ dst += 8;
+ sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1);
+ sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1);
+ sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1);
+ sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1);
+ sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1);
+ sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1);
+ sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1);
+ sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = SDL_SwapLE16(sample0);
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapLE16(sample0);
+ dst++;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = SDL_SwapLE16(sample1);
+ dst[0] = SDL_SwapLE16(sample0);
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapLE16(sample0);
+ dst[1] = SDL_SwapLE16(sample1);
+ dst += 2;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+ Uint16 sample3 = SDL_SwapLE16(src[3]);
+ Uint16 sample2 = SDL_SwapLE16(src[2]);
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = SDL_SwapLE16(sample3);
+ dst[2] = SDL_SwapLE16(sample2);
+ dst[1] = SDL_SwapLE16(sample1);
+ dst[0] = SDL_SwapLE16(sample0);
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 sample2 = SDL_SwapLE16(src[2]);
+ Uint16 sample3 = SDL_SwapLE16(src[3]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapLE16(sample0);
+ dst[1] = SDL_SwapLE16(sample1);
+ dst[2] = SDL_SwapLE16(sample2);
+ dst[3] = SDL_SwapLE16(sample3);
+ dst += 4;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+ Uint16 sample5 = SDL_SwapLE16(src[5]);
+ Uint16 sample4 = SDL_SwapLE16(src[4]);
+ Uint16 sample3 = SDL_SwapLE16(src[3]);
+ Uint16 sample2 = SDL_SwapLE16(src[2]);
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 last_sample5 = sample5;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = SDL_SwapLE16(sample5);
+ dst[4] = SDL_SwapLE16(sample4);
+ dst[3] = SDL_SwapLE16(sample3);
+ dst[2] = SDL_SwapLE16(sample2);
+ dst[1] = SDL_SwapLE16(sample1);
+ dst[0] = SDL_SwapLE16(sample0);
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 sample2 = SDL_SwapLE16(src[2]);
+ Uint16 sample3 = SDL_SwapLE16(src[3]);
+ Uint16 sample4 = SDL_SwapLE16(src[4]);
+ Uint16 sample5 = SDL_SwapLE16(src[5]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapLE16(sample0);
+ dst[1] = SDL_SwapLE16(sample1);
+ dst[2] = SDL_SwapLE16(sample2);
+ dst[3] = SDL_SwapLE16(sample3);
+ dst[4] = SDL_SwapLE16(sample4);
+ dst[5] = SDL_SwapLE16(sample5);
+ dst += 6;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+ Uint16 sample7 = SDL_SwapLE16(src[7]);
+ Uint16 sample6 = SDL_SwapLE16(src[6]);
+ Uint16 sample5 = SDL_SwapLE16(src[5]);
+ Uint16 sample4 = SDL_SwapLE16(src[4]);
+ Uint16 sample3 = SDL_SwapLE16(src[3]);
+ Uint16 sample2 = SDL_SwapLE16(src[2]);
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 last_sample7 = sample7;
+ Uint16 last_sample6 = sample6;
+ Uint16 last_sample5 = sample5;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = SDL_SwapLE16(sample7);
+ dst[6] = SDL_SwapLE16(sample6);
+ dst[5] = SDL_SwapLE16(sample5);
+ dst[4] = SDL_SwapLE16(sample4);
+ dst[3] = SDL_SwapLE16(sample3);
+ dst[2] = SDL_SwapLE16(sample2);
+ dst[1] = SDL_SwapLE16(sample1);
+ dst[0] = SDL_SwapLE16(sample0);
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
+ sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
+ sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapLE16(src[0]);
+ Uint16 sample1 = SDL_SwapLE16(src[1]);
+ Uint16 sample2 = SDL_SwapLE16(src[2]);
+ Uint16 sample3 = SDL_SwapLE16(src[3]);
+ Uint16 sample4 = SDL_SwapLE16(src[4]);
+ Uint16 sample5 = SDL_SwapLE16(src[5]);
+ Uint16 sample6 = SDL_SwapLE16(src[6]);
+ Uint16 sample7 = SDL_SwapLE16(src[7]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample5 = sample5;
+ Uint16 last_sample6 = sample6;
+ Uint16 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapLE16(sample0);
+ dst[1] = SDL_SwapLE16(sample1);
+ dst[2] = SDL_SwapLE16(sample2);
+ dst[3] = SDL_SwapLE16(sample3);
+ dst[4] = SDL_SwapLE16(sample4);
+ dst[5] = SDL_SwapLE16(sample5);
+ dst[6] = SDL_SwapLE16(sample6);
+ dst[7] = SDL_SwapLE16(sample7);
+ dst += 8;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1);
+ sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst++;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst += 2;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+ Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
+ Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = ((Sint16) SDL_SwapLE16(sample3));
+ dst[2] = ((Sint16) SDL_SwapLE16(sample2));
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
+ Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst[2] = ((Sint16) SDL_SwapLE16(sample2));
+ dst[3] = ((Sint16) SDL_SwapLE16(sample3));
+ dst += 4;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+ Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
+ Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
+ Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
+ Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 last_sample5 = sample5;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = ((Sint16) SDL_SwapLE16(sample5));
+ dst[4] = ((Sint16) SDL_SwapLE16(sample4));
+ dst[3] = ((Sint16) SDL_SwapLE16(sample3));
+ dst[2] = ((Sint16) SDL_SwapLE16(sample2));
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
+ Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
+ Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
+ Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst[2] = ((Sint16) SDL_SwapLE16(sample2));
+ dst[3] = ((Sint16) SDL_SwapLE16(sample3));
+ dst[4] = ((Sint16) SDL_SwapLE16(sample4));
+ dst[5] = ((Sint16) SDL_SwapLE16(sample5));
+ dst += 6;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+ Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
+ Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
+ Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
+ Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
+ Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
+ Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 last_sample7 = sample7;
+ Sint16 last_sample6 = sample6;
+ Sint16 last_sample5 = sample5;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = ((Sint16) SDL_SwapLE16(sample7));
+ dst[6] = ((Sint16) SDL_SwapLE16(sample6));
+ dst[5] = ((Sint16) SDL_SwapLE16(sample5));
+ dst[4] = ((Sint16) SDL_SwapLE16(sample4));
+ dst[3] = ((Sint16) SDL_SwapLE16(sample3));
+ dst[2] = ((Sint16) SDL_SwapLE16(sample2));
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
+ sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1]));
+ Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2]));
+ Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3]));
+ Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4]));
+ Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5]));
+ Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6]));
+ Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample5 = sample5;
+ Sint16 last_sample6 = sample6;
+ Sint16 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapLE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapLE16(sample1));
+ dst[2] = ((Sint16) SDL_SwapLE16(sample2));
+ dst[3] = ((Sint16) SDL_SwapLE16(sample3));
+ dst[4] = ((Sint16) SDL_SwapLE16(sample4));
+ dst[5] = ((Sint16) SDL_SwapLE16(sample5));
+ dst[6] = ((Sint16) SDL_SwapLE16(sample6));
+ dst[7] = ((Sint16) SDL_SwapLE16(sample7));
+ dst += 8;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
+ sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = SDL_SwapBE16(sample0);
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapBE16(sample0);
+ dst++;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = SDL_SwapBE16(sample1);
+ dst[0] = SDL_SwapBE16(sample0);
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapBE16(sample0);
+ dst[1] = SDL_SwapBE16(sample1);
+ dst += 2;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+ Uint16 sample3 = SDL_SwapBE16(src[3]);
+ Uint16 sample2 = SDL_SwapBE16(src[2]);
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = SDL_SwapBE16(sample3);
+ dst[2] = SDL_SwapBE16(sample2);
+ dst[1] = SDL_SwapBE16(sample1);
+ dst[0] = SDL_SwapBE16(sample0);
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 sample2 = SDL_SwapBE16(src[2]);
+ Uint16 sample3 = SDL_SwapBE16(src[3]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapBE16(sample0);
+ dst[1] = SDL_SwapBE16(sample1);
+ dst[2] = SDL_SwapBE16(sample2);
+ dst[3] = SDL_SwapBE16(sample3);
+ dst += 4;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+ Uint16 sample5 = SDL_SwapBE16(src[5]);
+ Uint16 sample4 = SDL_SwapBE16(src[4]);
+ Uint16 sample3 = SDL_SwapBE16(src[3]);
+ Uint16 sample2 = SDL_SwapBE16(src[2]);
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 last_sample5 = sample5;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = SDL_SwapBE16(sample5);
+ dst[4] = SDL_SwapBE16(sample4);
+ dst[3] = SDL_SwapBE16(sample3);
+ dst[2] = SDL_SwapBE16(sample2);
+ dst[1] = SDL_SwapBE16(sample1);
+ dst[0] = SDL_SwapBE16(sample0);
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 sample2 = SDL_SwapBE16(src[2]);
+ Uint16 sample3 = SDL_SwapBE16(src[3]);
+ Uint16 sample4 = SDL_SwapBE16(src[4]);
+ Uint16 sample5 = SDL_SwapBE16(src[5]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapBE16(sample0);
+ dst[1] = SDL_SwapBE16(sample1);
+ dst[2] = SDL_SwapBE16(sample2);
+ dst[3] = SDL_SwapBE16(sample3);
+ dst[4] = SDL_SwapBE16(sample4);
+ dst[5] = SDL_SwapBE16(sample5);
+ dst += 6;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+ Uint16 sample7 = SDL_SwapBE16(src[7]);
+ Uint16 sample6 = SDL_SwapBE16(src[6]);
+ Uint16 sample5 = SDL_SwapBE16(src[5]);
+ Uint16 sample4 = SDL_SwapBE16(src[4]);
+ Uint16 sample3 = SDL_SwapBE16(src[3]);
+ Uint16 sample2 = SDL_SwapBE16(src[2]);
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 last_sample7 = sample7;
+ Uint16 last_sample6 = sample6;
+ Uint16 last_sample5 = sample5;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = SDL_SwapBE16(sample7);
+ dst[6] = SDL_SwapBE16(sample6);
+ dst[5] = SDL_SwapBE16(sample5);
+ dst[4] = SDL_SwapBE16(sample4);
+ dst[3] = SDL_SwapBE16(sample3);
+ dst[2] = SDL_SwapBE16(sample2);
+ dst[1] = SDL_SwapBE16(sample1);
+ dst[0] = SDL_SwapBE16(sample0);
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
+ sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
+ sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Uint16 sample0 = SDL_SwapBE16(src[0]);
+ Uint16 sample1 = SDL_SwapBE16(src[1]);
+ Uint16 sample2 = SDL_SwapBE16(src[2]);
+ Uint16 sample3 = SDL_SwapBE16(src[3]);
+ Uint16 sample4 = SDL_SwapBE16(src[4]);
+ Uint16 sample5 = SDL_SwapBE16(src[5]);
+ Uint16 sample6 = SDL_SwapBE16(src[6]);
+ Uint16 sample7 = SDL_SwapBE16(src[7]);
+ Uint16 last_sample0 = sample0;
+ Uint16 last_sample1 = sample1;
+ Uint16 last_sample2 = sample2;
+ Uint16 last_sample3 = sample3;
+ Uint16 last_sample4 = sample4;
+ Uint16 last_sample5 = sample5;
+ Uint16 last_sample6 = sample6;
+ Uint16 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapBE16(sample0);
+ dst[1] = SDL_SwapBE16(sample1);
+ dst[2] = SDL_SwapBE16(sample2);
+ dst[3] = SDL_SwapBE16(sample3);
+ dst[4] = SDL_SwapBE16(sample4);
+ dst[5] = SDL_SwapBE16(sample5);
+ dst[6] = SDL_SwapBE16(sample6);
+ dst[7] = SDL_SwapBE16(sample7);
+ dst += 8;
+ sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1);
+ sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1);
+ sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 32;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst++;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst += 2;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+ Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
+ Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = ((Sint16) SDL_SwapBE16(sample3));
+ dst[2] = ((Sint16) SDL_SwapBE16(sample2));
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
+ Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst[2] = ((Sint16) SDL_SwapBE16(sample2));
+ dst[3] = ((Sint16) SDL_SwapBE16(sample3));
+ dst += 4;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+ Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
+ Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
+ Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
+ Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 last_sample5 = sample5;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = ((Sint16) SDL_SwapBE16(sample5));
+ dst[4] = ((Sint16) SDL_SwapBE16(sample4));
+ dst[3] = ((Sint16) SDL_SwapBE16(sample3));
+ dst[2] = ((Sint16) SDL_SwapBE16(sample2));
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 192;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
+ Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
+ Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
+ Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst[2] = ((Sint16) SDL_SwapBE16(sample2));
+ dst[3] = ((Sint16) SDL_SwapBE16(sample3));
+ dst[4] = ((Sint16) SDL_SwapBE16(sample4));
+ dst[5] = ((Sint16) SDL_SwapBE16(sample5));
+ dst += 6;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+ Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
+ Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
+ Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
+ Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
+ Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
+ Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 last_sample7 = sample7;
+ Sint16 last_sample6 = sample6;
+ Sint16 last_sample5 = sample5;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = ((Sint16) SDL_SwapBE16(sample7));
+ dst[6] = ((Sint16) SDL_SwapBE16(sample6));
+ dst[5] = ((Sint16) SDL_SwapBE16(sample5));
+ dst[4] = ((Sint16) SDL_SwapBE16(sample4));
+ dst[3] = ((Sint16) SDL_SwapBE16(sample3));
+ dst[2] = ((Sint16) SDL_SwapBE16(sample2));
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
+ sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0]));
+ Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1]));
+ Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2]));
+ Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3]));
+ Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4]));
+ Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5]));
+ Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6]));
+ Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7]));
+ Sint16 last_sample0 = sample0;
+ Sint16 last_sample1 = sample1;
+ Sint16 last_sample2 = sample2;
+ Sint16 last_sample3 = sample3;
+ Sint16 last_sample4 = sample4;
+ Sint16 last_sample5 = sample5;
+ Sint16 last_sample6 = sample6;
+ Sint16 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint16) SDL_SwapBE16(sample0));
+ dst[1] = ((Sint16) SDL_SwapBE16(sample1));
+ dst[2] = ((Sint16) SDL_SwapBE16(sample2));
+ dst[3] = ((Sint16) SDL_SwapBE16(sample3));
+ dst[4] = ((Sint16) SDL_SwapBE16(sample4));
+ dst[5] = ((Sint16) SDL_SwapBE16(sample5));
+ dst[6] = ((Sint16) SDL_SwapBE16(sample6));
+ dst[7] = ((Sint16) SDL_SwapBE16(sample7));
+ dst += 8;
+ sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1);
+ sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1);
+ sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1);
+ sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1);
+ sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1);
+ sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1);
+ sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1);
+ sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst++;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst += 2;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+ Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
+ Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = ((Sint32) SDL_SwapLE32(sample3));
+ dst[2] = ((Sint32) SDL_SwapLE32(sample2));
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
+ Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst[2] = ((Sint32) SDL_SwapLE32(sample2));
+ dst[3] = ((Sint32) SDL_SwapLE32(sample3));
+ dst += 4;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+ Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
+ Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
+ Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
+ Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 last_sample5 = sample5;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = ((Sint32) SDL_SwapLE32(sample5));
+ dst[4] = ((Sint32) SDL_SwapLE32(sample4));
+ dst[3] = ((Sint32) SDL_SwapLE32(sample3));
+ dst[2] = ((Sint32) SDL_SwapLE32(sample2));
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
+ Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
+ Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
+ Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst[2] = ((Sint32) SDL_SwapLE32(sample2));
+ dst[3] = ((Sint32) SDL_SwapLE32(sample3));
+ dst[4] = ((Sint32) SDL_SwapLE32(sample4));
+ dst[5] = ((Sint32) SDL_SwapLE32(sample5));
+ dst += 6;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+ Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
+ Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
+ Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
+ Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
+ Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
+ Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 last_sample7 = sample7;
+ Sint32 last_sample6 = sample6;
+ Sint32 last_sample5 = sample5;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = ((Sint32) SDL_SwapLE32(sample7));
+ dst[6] = ((Sint32) SDL_SwapLE32(sample6));
+ dst[5] = ((Sint32) SDL_SwapLE32(sample5));
+ dst[4] = ((Sint32) SDL_SwapLE32(sample4));
+ dst[3] = ((Sint32) SDL_SwapLE32(sample3));
+ dst[2] = ((Sint32) SDL_SwapLE32(sample2));
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
+ sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1]));
+ Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2]));
+ Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3]));
+ Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4]));
+ Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5]));
+ Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6]));
+ Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample5 = sample5;
+ Sint32 last_sample6 = sample6;
+ Sint32 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapLE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapLE32(sample1));
+ dst[2] = ((Sint32) SDL_SwapLE32(sample2));
+ dst[3] = ((Sint32) SDL_SwapLE32(sample3));
+ dst[4] = ((Sint32) SDL_SwapLE32(sample4));
+ dst[5] = ((Sint32) SDL_SwapLE32(sample5));
+ dst[6] = ((Sint32) SDL_SwapLE32(sample6));
+ dst[7] = ((Sint32) SDL_SwapLE32(sample7));
+ dst += 8;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
+ sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst++;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst += 2;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+ Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
+ Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = ((Sint32) SDL_SwapBE32(sample3));
+ dst[2] = ((Sint32) SDL_SwapBE32(sample2));
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
+ Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst[2] = ((Sint32) SDL_SwapBE32(sample2));
+ dst[3] = ((Sint32) SDL_SwapBE32(sample3));
+ dst += 4;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+ Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
+ Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
+ Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
+ Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 last_sample5 = sample5;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = ((Sint32) SDL_SwapBE32(sample5));
+ dst[4] = ((Sint32) SDL_SwapBE32(sample4));
+ dst[3] = ((Sint32) SDL_SwapBE32(sample3));
+ dst[2] = ((Sint32) SDL_SwapBE32(sample2));
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
+ Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
+ Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
+ Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst[2] = ((Sint32) SDL_SwapBE32(sample2));
+ dst[3] = ((Sint32) SDL_SwapBE32(sample3));
+ dst[4] = ((Sint32) SDL_SwapBE32(sample4));
+ dst[5] = ((Sint32) SDL_SwapBE32(sample5));
+ dst += 6;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+ Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
+ Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
+ Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
+ Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
+ Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
+ Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 last_sample7 = sample7;
+ Sint32 last_sample6 = sample6;
+ Sint32 last_sample5 = sample5;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = ((Sint32) SDL_SwapBE32(sample7));
+ dst[6] = ((Sint32) SDL_SwapBE32(sample6));
+ dst[5] = ((Sint32) SDL_SwapBE32(sample5));
+ dst[4] = ((Sint32) SDL_SwapBE32(sample4));
+ dst[3] = ((Sint32) SDL_SwapBE32(sample3));
+ dst[2] = ((Sint32) SDL_SwapBE32(sample2));
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
+ sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0]));
+ Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1]));
+ Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2]));
+ Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3]));
+ Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4]));
+ Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5]));
+ Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6]));
+ Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7]));
+ Sint32 last_sample0 = sample0;
+ Sint32 last_sample1 = sample1;
+ Sint32 last_sample2 = sample2;
+ Sint32 last_sample3 = sample3;
+ Sint32 last_sample4 = sample4;
+ Sint32 last_sample5 = sample5;
+ Sint32 last_sample6 = sample6;
+ Sint32 last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = ((Sint32) SDL_SwapBE32(sample0));
+ dst[1] = ((Sint32) SDL_SwapBE32(sample1));
+ dst[2] = ((Sint32) SDL_SwapBE32(sample2));
+ dst[3] = ((Sint32) SDL_SwapBE32(sample3));
+ dst[4] = ((Sint32) SDL_SwapBE32(sample4));
+ dst[5] = ((Sint32) SDL_SwapBE32(sample5));
+ dst[6] = ((Sint32) SDL_SwapBE32(sample6));
+ dst[7] = ((Sint32) SDL_SwapBE32(sample7));
+ dst += 8;
+ sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1);
+ sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1);
+ sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1);
+ sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1);
+ sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1);
+ sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1);
+ sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1);
+ sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 1;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
+ const float *target = ((const float *) cvt->buf) - 1;
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst++;
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 2;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
+ const float *target = ((const float *) cvt->buf) - 2;
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst += 2;
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 4;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
+ const float *target = ((const float *) cvt->buf) - 4;
+ float sample3 = SDL_SwapFloatLE(src[3]);
+ float sample2 = SDL_SwapFloatLE(src[2]);
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float last_sample3 = sample3;
+ float last_sample2 = sample2;
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = SDL_SwapFloatLE(sample3);
+ dst[2] = SDL_SwapFloatLE(sample2);
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float sample2 = SDL_SwapFloatLE(src[2]);
+ float sample3 = SDL_SwapFloatLE(src[3]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ float last_sample2 = sample2;
+ float last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst[2] = SDL_SwapFloatLE(sample2);
+ dst[3] = SDL_SwapFloatLE(sample3);
+ dst += 4;
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 6;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
+ const float *target = ((const float *) cvt->buf) - 6;
+ float sample5 = SDL_SwapFloatLE(src[5]);
+ float sample4 = SDL_SwapFloatLE(src[4]);
+ float sample3 = SDL_SwapFloatLE(src[3]);
+ float sample2 = SDL_SwapFloatLE(src[2]);
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float last_sample5 = sample5;
+ float last_sample4 = sample4;
+ float last_sample3 = sample3;
+ float last_sample2 = sample2;
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = SDL_SwapFloatLE(sample5);
+ dst[4] = SDL_SwapFloatLE(sample4);
+ dst[3] = SDL_SwapFloatLE(sample3);
+ dst[2] = SDL_SwapFloatLE(sample2);
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float sample2 = SDL_SwapFloatLE(src[2]);
+ float sample3 = SDL_SwapFloatLE(src[3]);
+ float sample4 = SDL_SwapFloatLE(src[4]);
+ float sample5 = SDL_SwapFloatLE(src[5]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ float last_sample2 = sample2;
+ float last_sample3 = sample3;
+ float last_sample4 = sample4;
+ float last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst[2] = SDL_SwapFloatLE(sample2);
+ dst[3] = SDL_SwapFloatLE(sample3);
+ dst[4] = SDL_SwapFloatLE(sample4);
+ dst[5] = SDL_SwapFloatLE(sample5);
+ dst += 6;
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+ const float *target = ((const float *) cvt->buf) - 8;
+ float sample7 = SDL_SwapFloatLE(src[7]);
+ float sample6 = SDL_SwapFloatLE(src[6]);
+ float sample5 = SDL_SwapFloatLE(src[5]);
+ float sample4 = SDL_SwapFloatLE(src[4]);
+ float sample3 = SDL_SwapFloatLE(src[3]);
+ float sample2 = SDL_SwapFloatLE(src[2]);
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float last_sample7 = sample7;
+ float last_sample6 = sample6;
+ float last_sample5 = sample5;
+ float last_sample4 = sample4;
+ float last_sample3 = sample3;
+ float last_sample2 = sample2;
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = SDL_SwapFloatLE(sample7);
+ dst[6] = SDL_SwapFloatLE(sample6);
+ dst[5] = SDL_SwapFloatLE(sample5);
+ dst[4] = SDL_SwapFloatLE(sample4);
+ dst[3] = SDL_SwapFloatLE(sample3);
+ dst[2] = SDL_SwapFloatLE(sample2);
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
+ sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
+ sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatLE(src[0]);
+ float sample1 = SDL_SwapFloatLE(src[1]);
+ float sample2 = SDL_SwapFloatLE(src[2]);
+ float sample3 = SDL_SwapFloatLE(src[3]);
+ float sample4 = SDL_SwapFloatLE(src[4]);
+ float sample5 = SDL_SwapFloatLE(src[5]);
+ float sample6 = SDL_SwapFloatLE(src[6]);
+ float sample7 = SDL_SwapFloatLE(src[7]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ float last_sample2 = sample2;
+ float last_sample3 = sample3;
+ float last_sample4 = sample4;
+ float last_sample5 = sample5;
+ float last_sample6 = sample6;
+ float last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatLE(sample0);
+ dst[1] = SDL_SwapFloatLE(sample1);
+ dst[2] = SDL_SwapFloatLE(sample2);
+ dst[3] = SDL_SwapFloatLE(sample3);
+ dst[4] = SDL_SwapFloatLE(sample4);
+ dst[5] = SDL_SwapFloatLE(sample5);
+ dst[6] = SDL_SwapFloatLE(sample6);
+ dst[7] = SDL_SwapFloatLE(sample7);
+ dst += 8;
+ sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5);
+ sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5);
+ sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 1;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
+ const float *target = ((const float *) cvt->buf) - 1;
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst--;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src--;
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 64;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float last_sample0 = sample0;
+ while (dst != target) {
+ src++;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst++;
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample0 = sample0;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 2;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
+ const float *target = ((const float *) cvt->buf) - 2;
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst -= 2;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 2;
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 128;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ while (dst != target) {
+ src += 2;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst += 2;
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 4;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
+ const float *target = ((const float *) cvt->buf) - 4;
+ float sample3 = SDL_SwapFloatBE(src[3]);
+ float sample2 = SDL_SwapFloatBE(src[2]);
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float last_sample3 = sample3;
+ float last_sample2 = sample2;
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[3] = SDL_SwapFloatBE(sample3);
+ dst[2] = SDL_SwapFloatBE(sample2);
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst -= 4;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 4;
+ sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 256;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float sample2 = SDL_SwapFloatBE(src[2]);
+ float sample3 = SDL_SwapFloatBE(src[3]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ float last_sample2 = sample2;
+ float last_sample3 = sample3;
+ while (dst != target) {
+ src += 4;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst[2] = SDL_SwapFloatBE(sample2);
+ dst[3] = SDL_SwapFloatBE(sample3);
+ dst += 4;
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 6;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
+ const float *target = ((const float *) cvt->buf) - 6;
+ float sample5 = SDL_SwapFloatBE(src[5]);
+ float sample4 = SDL_SwapFloatBE(src[4]);
+ float sample3 = SDL_SwapFloatBE(src[3]);
+ float sample2 = SDL_SwapFloatBE(src[2]);
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float last_sample5 = sample5;
+ float last_sample4 = sample4;
+ float last_sample3 = sample3;
+ float last_sample2 = sample2;
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[5] = SDL_SwapFloatBE(sample5);
+ dst[4] = SDL_SwapFloatBE(sample4);
+ dst[3] = SDL_SwapFloatBE(sample3);
+ dst[2] = SDL_SwapFloatBE(sample2);
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst -= 6;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 6;
+ sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 384;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float sample2 = SDL_SwapFloatBE(src[2]);
+ float sample3 = SDL_SwapFloatBE(src[3]);
+ float sample4 = SDL_SwapFloatBE(src[4]);
+ float sample5 = SDL_SwapFloatBE(src[5]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ float last_sample2 = sample2;
+ float last_sample3 = sample3;
+ float last_sample4 = sample4;
+ float last_sample5 = sample5;
+ while (dst != target) {
+ src += 6;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst[2] = SDL_SwapFloatBE(sample2);
+ dst[3] = SDL_SwapFloatBE(sample3);
+ dst[4] = SDL_SwapFloatBE(sample4);
+ dst[5] = SDL_SwapFloatBE(sample5);
+ dst += 6;
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+ const float *target = ((const float *) cvt->buf) - 8;
+ float sample7 = SDL_SwapFloatBE(src[7]);
+ float sample6 = SDL_SwapFloatBE(src[6]);
+ float sample5 = SDL_SwapFloatBE(src[5]);
+ float sample4 = SDL_SwapFloatBE(src[4]);
+ float sample3 = SDL_SwapFloatBE(src[3]);
+ float sample2 = SDL_SwapFloatBE(src[2]);
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float last_sample7 = sample7;
+ float last_sample6 = sample6;
+ float last_sample5 = sample5;
+ float last_sample4 = sample4;
+ float last_sample3 = sample3;
+ float last_sample2 = sample2;
+ float last_sample1 = sample1;
+ float last_sample0 = sample0;
+ while (dst != target) {
+ dst[7] = SDL_SwapFloatBE(sample7);
+ dst[6] = SDL_SwapFloatBE(sample6);
+ dst[5] = SDL_SwapFloatBE(sample5);
+ dst[4] = SDL_SwapFloatBE(sample4);
+ dst[3] = SDL_SwapFloatBE(sample3);
+ dst[2] = SDL_SwapFloatBE(sample2);
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst -= 8;
+ eps += srcsize;
+ if ((eps << 1) >= dstsize) {
+ src -= 8;
+ sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
+ sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
+ sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ eps -= dstsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - 512;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ float sample0 = SDL_SwapFloatBE(src[0]);
+ float sample1 = SDL_SwapFloatBE(src[1]);
+ float sample2 = SDL_SwapFloatBE(src[2]);
+ float sample3 = SDL_SwapFloatBE(src[3]);
+ float sample4 = SDL_SwapFloatBE(src[4]);
+ float sample5 = SDL_SwapFloatBE(src[5]);
+ float sample6 = SDL_SwapFloatBE(src[6]);
+ float sample7 = SDL_SwapFloatBE(src[7]);
+ float last_sample0 = sample0;
+ float last_sample1 = sample1;
+ float last_sample2 = sample2;
+ float last_sample3 = sample3;
+ float last_sample4 = sample4;
+ float last_sample5 = sample5;
+ float last_sample6 = sample6;
+ float last_sample7 = sample7;
+ while (dst != target) {
+ src += 8;
+ eps += dstsize;
+ if ((eps << 1) >= srcsize) {
+ dst[0] = SDL_SwapFloatBE(sample0);
+ dst[1] = SDL_SwapFloatBE(sample1);
+ dst[2] = SDL_SwapFloatBE(sample2);
+ dst[3] = SDL_SwapFloatBE(sample3);
+ dst[4] = SDL_SwapFloatBE(sample4);
+ dst[5] = SDL_SwapFloatBE(sample5);
+ dst[6] = SDL_SwapFloatBE(sample6);
+ dst[7] = SDL_SwapFloatBE(sample7);
+ dst += 8;
+ sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5);
+ sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5);
+ sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5);
+ sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5);
+ sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5);
+ sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5);
+ sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5);
+ sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ eps -= srcsize;
+ }
+ }
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+
+#if !LESS_RESAMPLERS
+
+static void SDLCALL
+SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ src--;
+ dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Uint8) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ src += 2;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 1;
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ src--;
+ dst[3] = (Uint8) sample0;
+ dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ src += 4;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 2;
+ dst[3] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) sample1;
+ dst[0] = (Uint8) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ src += 4;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 2;
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 2;
+ dst[7] = (Uint8) sample1;
+ dst[6] = (Uint8) sample0;
+ dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ src += 8;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 4;
+ dst[7] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Uint8) sample3;
+ dst[2] = (Uint8) sample2;
+ dst[1] = (Uint8) sample1;
+ dst[0] = (Uint8) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample3 = (Sint16) src[3];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample3 = (Sint16) src[3];
+ src += 8;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 4;
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 4;
+ dst[15] = (Uint8) sample3;
+ dst[14] = (Uint8) sample2;
+ dst[13] = (Uint8) sample1;
+ dst[12] = (Uint8) sample0;
+ dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample3 = (Sint16) src[3];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample3 = (Sint16) src[3];
+ src += 16;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
+ Sint16 last_sample5 = (Sint16) src[5];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample5 = (Sint16) src[5];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 6;
+ dst[11] = (Uint8) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Uint8) sample5;
+ dst[4] = (Uint8) sample4;
+ dst[3] = (Uint8) sample3;
+ dst[2] = (Uint8) sample2;
+ dst[1] = (Uint8) sample1;
+ dst[0] = (Uint8) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample5 = (Sint16) src[5];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample5 = (Sint16) src[5];
+ src += 12;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 6;
+ Sint16 last_sample5 = (Sint16) src[5];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample5 = (Sint16) src[5];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 6;
+ dst[23] = (Uint8) sample5;
+ dst[22] = (Uint8) sample4;
+ dst[21] = (Uint8) sample3;
+ dst[20] = (Uint8) sample2;
+ dst[19] = (Uint8) sample1;
+ dst[18] = (Uint8) sample0;
+ dst[17] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Uint8) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample5 = (Sint16) src[5];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample5 = (Sint16) src[5];
+ src += 24;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
+ Sint16 last_sample7 = (Sint16) src[7];
+ Sint16 last_sample6 = (Sint16) src[6];
+ Sint16 last_sample5 = (Sint16) src[5];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample7 = (Sint16) src[7];
+ const Sint16 sample6 = (Sint16) src[6];
+ const Sint16 sample5 = (Sint16) src[5];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 8;
+ dst[15] = (Uint8) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Uint8) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Uint8) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Uint8) sample7;
+ dst[6] = (Uint8) sample6;
+ dst[5] = (Uint8) sample5;
+ dst[4] = (Uint8) sample4;
+ dst[3] = (Uint8) sample3;
+ dst[2] = (Uint8) sample2;
+ dst[1] = (Uint8) sample1;
+ dst[0] = (Uint8) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample5 = (Sint16) src[5];
+ Sint16 last_sample6 = (Sint16) src[6];
+ Sint16 last_sample7 = (Sint16) src[7];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample5 = (Sint16) src[5];
+ const Sint16 sample6 = (Sint16) src[6];
+ const Sint16 sample7 = (Sint16) src[7];
+ src += 16;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
+ const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint8 *target = ((const Uint8 *) cvt->buf) - 8;
+ Sint16 last_sample7 = (Sint16) src[7];
+ Sint16 last_sample6 = (Sint16) src[6];
+ Sint16 last_sample5 = (Sint16) src[5];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample0 = (Sint16) src[0];
+ while (dst > target) {
+ const Sint16 sample7 = (Sint16) src[7];
+ const Sint16 sample6 = (Sint16) src[6];
+ const Sint16 sample5 = (Sint16) src[5];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample0 = (Sint16) src[0];
+ src -= 8;
+ dst[31] = (Uint8) sample7;
+ dst[30] = (Uint8) sample6;
+ dst[29] = (Uint8) sample5;
+ dst[28] = (Uint8) sample4;
+ dst[27] = (Uint8) sample3;
+ dst[26] = (Uint8) sample2;
+ dst[25] = (Uint8) sample1;
+ dst[24] = (Uint8) sample0;
+ dst[23] = (Uint8) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Uint8) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Uint8) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Uint8) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Uint8) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Uint8) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Uint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Uint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Uint8) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Uint8) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Uint8) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint8 *dst = (Uint8 *) cvt->buf;
+ const Uint8 *src = (Uint8 *) cvt->buf;
+ const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) src[0];
+ Sint16 last_sample1 = (Sint16) src[1];
+ Sint16 last_sample2 = (Sint16) src[2];
+ Sint16 last_sample3 = (Sint16) src[3];
+ Sint16 last_sample4 = (Sint16) src[4];
+ Sint16 last_sample5 = (Sint16) src[5];
+ Sint16 last_sample6 = (Sint16) src[6];
+ Sint16 last_sample7 = (Sint16) src[7];
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) src[0];
+ const Sint16 sample1 = (Sint16) src[1];
+ const Sint16 sample2 = (Sint16) src[2];
+ const Sint16 sample3 = (Sint16) src[3];
+ const Sint16 sample4 = (Sint16) src[4];
+ const Sint16 sample5 = (Sint16) src[5];
+ const Sint16 sample6 = (Sint16) src[6];
+ const Sint16 sample7 = (Sint16) src[7];
+ src += 32;
+ dst[0] = (Uint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint8) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Uint8) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Uint8) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src--;
+ dst[1] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint8) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src += 2;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 1;
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src--;
+ dst[3] = (Sint8) sample0;
+ dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src += 4;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 2;
+ dst[3] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) sample1;
+ dst[0] = (Sint8) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ src += 4;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 2;
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 2;
+ dst[7] = (Sint8) sample1;
+ dst[6] = (Sint8) sample0;
+ dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ src += 8;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 4;
+ dst[7] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint8) sample3;
+ dst[2] = (Sint8) sample2;
+ dst[1] = (Sint8) sample1;
+ dst[0] = (Sint8) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ src += 8;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 4;
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 4;
+ dst[15] = (Sint8) sample3;
+ dst[14] = (Sint8) sample2;
+ dst[13] = (Sint8) sample1;
+ dst[12] = (Sint8) sample0;
+ dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ src += 16;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 6;
+ dst[11] = (Sint8) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint8) sample5;
+ dst[4] = (Sint8) sample4;
+ dst[3] = (Sint8) sample3;
+ dst[2] = (Sint8) sample2;
+ dst[1] = (Sint8) sample1;
+ dst[0] = (Sint8) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ src += 12;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 6;
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 6;
+ dst[23] = (Sint8) sample5;
+ dst[22] = (Sint8) sample4;
+ dst[21] = (Sint8) sample3;
+ dst[20] = (Sint8) sample2;
+ dst[19] = (Sint8) sample1;
+ dst[18] = (Sint8) sample0;
+ dst[17] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Sint8) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ src += 24;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
+ Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
+ Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
+ const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 8;
+ dst[15] = (Sint8) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint8) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint8) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint8) sample7;
+ dst[6] = (Sint8) sample6;
+ dst[5] = (Sint8) sample5;
+ dst[4] = (Sint8) sample4;
+ dst[3] = (Sint8) sample3;
+ dst[2] = (Sint8) sample2;
+ dst[1] = (Sint8) sample1;
+ dst[0] = (Sint8) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
+ Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
+ const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
+ src += 16;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
+ const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint8 *target = ((const Sint8 *) cvt->buf) - 8;
+ Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
+ Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ while (dst > target) {
+ const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
+ const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ src -= 8;
+ dst[31] = (Sint8) sample7;
+ dst[30] = (Sint8) sample6;
+ dst[29] = (Sint8) sample5;
+ dst[28] = (Sint8) sample4;
+ dst[27] = (Sint8) sample3;
+ dst[26] = (Sint8) sample2;
+ dst[25] = (Sint8) sample1;
+ dst[24] = (Sint8) sample0;
+ dst[23] = (Sint8) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Sint8) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Sint8) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Sint8) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Sint8) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Sint8) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Sint8) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Sint8) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Sint8) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint8) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint8) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint8 *dst = (Sint8 *) cvt->buf;
+ const Sint8 *src = (Sint8 *) cvt->buf;
+ const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize);
+ Sint16 last_sample0 = (Sint16) ((Sint8) src[0]);
+ Sint16 last_sample1 = (Sint16) ((Sint8) src[1]);
+ Sint16 last_sample2 = (Sint16) ((Sint8) src[2]);
+ Sint16 last_sample3 = (Sint16) ((Sint8) src[3]);
+ Sint16 last_sample4 = (Sint16) ((Sint8) src[4]);
+ Sint16 last_sample5 = (Sint16) ((Sint8) src[5]);
+ Sint16 last_sample6 = (Sint16) ((Sint8) src[6]);
+ Sint16 last_sample7 = (Sint16) ((Sint8) src[7]);
+ while (dst < target) {
+ const Sint16 sample0 = (Sint16) ((Sint8) src[0]);
+ const Sint16 sample1 = (Sint16) ((Sint8) src[1]);
+ const Sint16 sample2 = (Sint16) ((Sint8) src[2]);
+ const Sint16 sample3 = (Sint16) ((Sint8) src[3]);
+ const Sint16 sample4 = (Sint16) ((Sint8) src[4]);
+ const Sint16 sample5 = (Sint16) ((Sint8) src[5]);
+ const Sint16 sample6 = (Sint16) ((Sint8) src[6]);
+ const Sint16 sample7 = (Sint16) ((Sint8) src[7]);
+ src += 32;
+ dst[0] = (Sint8) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint8) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint8) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint8) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint8) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint8) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint8) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint8) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src--;
+ dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Uint16) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src += 2;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src--;
+ dst[3] = (Uint16) sample0;
+ dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src += 4;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 2;
+ dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ src += 4;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 2;
+ dst[7] = (Uint16) sample1;
+ dst[6] = (Uint16) sample0;
+ dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ src += 8;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 4;
+ dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Uint16) sample3;
+ dst[2] = (Uint16) sample2;
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ src += 8;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 4;
+ dst[15] = (Uint16) sample3;
+ dst[14] = (Uint16) sample2;
+ dst[13] = (Uint16) sample1;
+ dst[12] = (Uint16) sample0;
+ dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ src += 16;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 6;
+ dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Uint16) sample5;
+ dst[4] = (Uint16) sample4;
+ dst[3] = (Uint16) sample3;
+ dst[2] = (Uint16) sample2;
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ src += 12;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 6;
+ dst[23] = (Uint16) sample5;
+ dst[22] = (Uint16) sample4;
+ dst[21] = (Uint16) sample3;
+ dst[20] = (Uint16) sample2;
+ dst[19] = (Uint16) sample1;
+ dst[18] = (Uint16) sample0;
+ dst[17] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ src += 24;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 8;
+ dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Uint16) sample7;
+ dst[6] = (Uint16) sample6;
+ dst[5] = (Uint16) sample5;
+ dst[4] = (Uint16) sample4;
+ dst[3] = (Uint16) sample3;
+ dst[2] = (Uint16) sample2;
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ src += 16;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ src -= 8;
+ dst[31] = (Uint16) sample7;
+ dst[30] = (Uint16) sample6;
+ dst[29] = (Uint16) sample5;
+ dst[28] = (Uint16) sample4;
+ dst[27] = (Uint16) sample3;
+ dst[26] = (Uint16) sample2;
+ dst[25] = (Uint16) sample1;
+ dst[24] = (Uint16) sample0;
+ dst[23] = (Uint16) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Uint16) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]);
+ const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]);
+ const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]);
+ src += 32;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src--;
+ dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint16) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src += 2;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src--;
+ dst[3] = (Sint16) sample0;
+ dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src += 4;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 2;
+ dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ src += 4;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 2;
+ dst[7] = (Sint16) sample1;
+ dst[6] = (Sint16) sample0;
+ dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ src += 8;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 4;
+ dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint16) sample3;
+ dst[2] = (Sint16) sample2;
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ src += 8;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 4;
+ dst[15] = (Sint16) sample3;
+ dst[14] = (Sint16) sample2;
+ dst[13] = (Sint16) sample1;
+ dst[12] = (Sint16) sample0;
+ dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ src += 16;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 6;
+ dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint16) sample5;
+ dst[4] = (Sint16) sample4;
+ dst[3] = (Sint16) sample3;
+ dst[2] = (Sint16) sample2;
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ src += 12;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 6;
+ dst[23] = (Sint16) sample5;
+ dst[22] = (Sint16) sample4;
+ dst[21] = (Sint16) sample3;
+ dst[20] = (Sint16) sample2;
+ dst[19] = (Sint16) sample1;
+ dst[18] = (Sint16) sample0;
+ dst[17] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ src += 24;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 8;
+ dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint16) sample7;
+ dst[6] = (Sint16) sample6;
+ dst[5] = (Sint16) sample5;
+ dst[4] = (Sint16) sample4;
+ dst[3] = (Sint16) sample3;
+ dst[2] = (Sint16) sample2;
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ src += 16;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ src -= 8;
+ dst[31] = (Sint16) sample7;
+ dst[30] = (Sint16) sample6;
+ dst[29] = (Sint16) sample5;
+ dst[28] = (Sint16) sample4;
+ dst[27] = (Sint16) sample3;
+ dst[26] = (Sint16) sample2;
+ dst[25] = (Sint16) sample1;
+ dst[24] = (Sint16) sample0;
+ dst[23] = (Sint16) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Sint16) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6]));
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7]));
+ src += 32;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src--;
+ dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Uint16) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src += 2;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src--;
+ dst[3] = (Uint16) sample0;
+ dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src += 4;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 2;
+ dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ src += 4;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 2;
+ dst[7] = (Uint16) sample1;
+ dst[6] = (Uint16) sample0;
+ dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ src += 8;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 4;
+ dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Uint16) sample3;
+ dst[2] = (Uint16) sample2;
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ src += 8;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 4;
+ dst[15] = (Uint16) sample3;
+ dst[14] = (Uint16) sample2;
+ dst[13] = (Uint16) sample1;
+ dst[12] = (Uint16) sample0;
+ dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ src += 16;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 6;
+ dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Uint16) sample5;
+ dst[4] = (Uint16) sample4;
+ dst[3] = (Uint16) sample3;
+ dst[2] = (Uint16) sample2;
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ src += 12;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 6;
+ dst[23] = (Uint16) sample5;
+ dst[22] = (Uint16) sample4;
+ dst[21] = (Uint16) sample3;
+ dst[20] = (Uint16) sample2;
+ dst[19] = (Uint16) sample1;
+ dst[18] = (Uint16) sample0;
+ dst[17] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ src += 24;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 8;
+ dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Uint16) sample7;
+ dst[6] = (Uint16) sample6;
+ dst[5] = (Uint16) sample5;
+ dst[4] = (Uint16) sample4;
+ dst[3] = (Uint16) sample3;
+ dst[2] = (Uint16) sample2;
+ dst[1] = (Uint16) sample1;
+ dst[0] = (Uint16) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ src += 16;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
+ const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Uint16 *target = ((const Uint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ src -= 8;
+ dst[31] = (Uint16) sample7;
+ dst[30] = (Uint16) sample6;
+ dst[29] = (Uint16) sample5;
+ dst[28] = (Uint16) sample4;
+ dst[27] = (Uint16) sample3;
+ dst[26] = (Uint16) sample2;
+ dst[25] = (Uint16) sample1;
+ dst[24] = (Uint16) sample0;
+ dst[23] = (Uint16) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Uint16) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Uint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Uint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Uint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Uint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Uint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Uint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Uint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Uint16 *dst = (Uint16 *) cvt->buf;
+ const Uint16 *src = (Uint16 *) cvt->buf;
+ const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]);
+ const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]);
+ const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]);
+ const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]);
+ const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]);
+ const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]);
+ const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]);
+ const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]);
+ src += 32;
+ dst[0] = (Uint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Uint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Uint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Uint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Uint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Uint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Uint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Uint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src--;
+ dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint16) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src += 2;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 1;
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src--;
+ dst[3] = (Sint16) sample0;
+ dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src += 4;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 2;
+ dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ src += 4;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 2;
+ dst[7] = (Sint16) sample1;
+ dst[6] = (Sint16) sample0;
+ dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ src += 8;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 4;
+ dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint16) sample3;
+ dst[2] = (Sint16) sample2;
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ src += 8;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 4;
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 4;
+ dst[15] = (Sint16) sample3;
+ dst[14] = (Sint16) sample2;
+ dst[13] = (Sint16) sample1;
+ dst[12] = (Sint16) sample0;
+ dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ src += 16;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 6;
+ dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint16) sample5;
+ dst[4] = (Sint16) sample4;
+ dst[3] = (Sint16) sample3;
+ dst[2] = (Sint16) sample2;
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ src += 12;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 6;
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 6;
+ dst[23] = (Sint16) sample5;
+ dst[22] = (Sint16) sample4;
+ dst[21] = (Sint16) sample3;
+ dst[20] = (Sint16) sample2;
+ dst[19] = (Sint16) sample1;
+ dst[18] = (Sint16) sample0;
+ dst[17] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ src += 24;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 8;
+ dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint16) sample7;
+ dst[6] = (Sint16) sample6;
+ dst[5] = (Sint16) sample5;
+ dst[4] = (Sint16) sample4;
+ dst[3] = (Sint16) sample3;
+ dst[2] = (Sint16) sample2;
+ dst[1] = (Sint16) sample1;
+ dst[0] = (Sint16) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ src += 16;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
+ const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint16 *target = ((const Sint16 *) cvt->buf) - 8;
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ while (dst > target) {
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ src -= 8;
+ dst[31] = (Sint16) sample7;
+ dst[30] = (Sint16) sample6;
+ dst[29] = (Sint16) sample5;
+ dst[28] = (Sint16) sample4;
+ dst[27] = (Sint16) sample3;
+ dst[26] = (Sint16) sample2;
+ dst[25] = (Sint16) sample1;
+ dst[24] = (Sint16) sample0;
+ dst[23] = (Sint16) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Sint16) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Sint16) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Sint16) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Sint16) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Sint16) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Sint16) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Sint16) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Sint16) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint16 *dst = (Sint16 *) cvt->buf;
+ const Sint16 *src = (Sint16 *) cvt->buf;
+ const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize);
+ Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ while (dst < target) {
+ const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0]));
+ const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1]));
+ const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2]));
+ const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3]));
+ const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4]));
+ const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5]));
+ const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6]));
+ const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7]));
+ src += 32;
+ dst[0] = (Sint16) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint16) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint16) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint16) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint16) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint16) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint16) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint16) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src--;
+ dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint32) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src += 2;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src--;
+ dst[3] = (Sint32) sample0;
+ dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src += 4;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 2;
+ dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ src += 4;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 2;
+ dst[7] = (Sint32) sample1;
+ dst[6] = (Sint32) sample0;
+ dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ src += 8;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 4;
+ dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint32) sample3;
+ dst[2] = (Sint32) sample2;
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ src += 8;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 4;
+ dst[15] = (Sint32) sample3;
+ dst[14] = (Sint32) sample2;
+ dst[13] = (Sint32) sample1;
+ dst[12] = (Sint32) sample0;
+ dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ src += 16;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 6;
+ dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint32) sample5;
+ dst[4] = (Sint32) sample4;
+ dst[3] = (Sint32) sample3;
+ dst[2] = (Sint32) sample2;
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ src += 12;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 6;
+ dst[23] = (Sint32) sample5;
+ dst[22] = (Sint32) sample4;
+ dst[21] = (Sint32) sample3;
+ dst[20] = (Sint32) sample2;
+ dst[19] = (Sint32) sample1;
+ dst[18] = (Sint32) sample0;
+ dst[17] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ src += 24;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 8;
+ dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint32) sample7;
+ dst[6] = (Sint32) sample6;
+ dst[5] = (Sint32) sample5;
+ dst[4] = (Sint32) sample4;
+ dst[3] = (Sint32) sample3;
+ dst[2] = (Sint32) sample2;
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ src += 16;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ src -= 8;
+ dst[31] = (Sint32) sample7;
+ dst[30] = (Sint32) sample6;
+ dst[29] = (Sint32) sample5;
+ dst[28] = (Sint32) sample4;
+ dst[27] = (Sint32) sample3;
+ dst[26] = (Sint32) sample2;
+ dst[25] = (Sint32) sample1;
+ dst[24] = (Sint32) sample0;
+ dst[23] = (Sint32) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Sint32) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6]));
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7]));
+ src += 32;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src--;
+ dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint32) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src += 2;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 1;
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src--;
+ dst[3] = (Sint32) sample0;
+ dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[1] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src += 4;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 2;
+ dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ src += 4;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 2;
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 2;
+ dst[7] = (Sint32) sample1;
+ dst[6] = (Sint32) sample0;
+ dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[3] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ src += 8;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 4;
+ dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint32) sample3;
+ dst[2] = (Sint32) sample2;
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ src += 8;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 4;
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 4;
+ dst[15] = (Sint32) sample3;
+ dst[14] = (Sint32) sample2;
+ dst[13] = (Sint32) sample1;
+ dst[12] = (Sint32) sample0;
+ dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
+ dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
+ dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[7] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[6] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[5] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[4] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ src += 16;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 6;
+ dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint32) sample5;
+ dst[4] = (Sint32) sample4;
+ dst[3] = (Sint32) sample3;
+ dst[2] = (Sint32) sample2;
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ src += 12;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 6;
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 6;
+ dst[23] = (Sint32) sample5;
+ dst[22] = (Sint32) sample4;
+ dst[21] = (Sint32) sample3;
+ dst[20] = (Sint32) sample2;
+ dst[19] = (Sint32) sample1;
+ dst[18] = (Sint32) sample0;
+ dst[17] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
+ dst[16] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
+ dst[15] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
+ dst[14] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
+ dst[13] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[12] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[11] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[10] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[9] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[8] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[7] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[6] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ src += 24;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 8;
+ dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint32) sample7;
+ dst[6] = (Sint32) sample6;
+ dst[5] = (Sint32) sample5;
+ dst[4] = (Sint32) sample4;
+ dst[3] = (Sint32) sample3;
+ dst[2] = (Sint32) sample2;
+ dst[1] = (Sint32) sample1;
+ dst[0] = (Sint32) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ src += 16;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
+ const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
+ const Sint32 *target = ((const Sint32 *) cvt->buf) - 8;
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ while (dst > target) {
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ src -= 8;
+ dst[31] = (Sint32) sample7;
+ dst[30] = (Sint32) sample6;
+ dst[29] = (Sint32) sample5;
+ dst[28] = (Sint32) sample4;
+ dst[27] = (Sint32) sample3;
+ dst[26] = (Sint32) sample2;
+ dst[25] = (Sint32) sample1;
+ dst[24] = (Sint32) sample0;
+ dst[23] = (Sint32) (((3 * sample7) + last_sample7) >> 2);
+ dst[22] = (Sint32) (((3 * sample6) + last_sample6) >> 2);
+ dst[21] = (Sint32) (((3 * sample5) + last_sample5) >> 2);
+ dst[20] = (Sint32) (((3 * sample4) + last_sample4) >> 2);
+ dst[19] = (Sint32) (((3 * sample3) + last_sample3) >> 2);
+ dst[18] = (Sint32) (((3 * sample2) + last_sample2) >> 2);
+ dst[17] = (Sint32) (((3 * sample1) + last_sample1) >> 2);
+ dst[16] = (Sint32) (((3 * sample0) + last_sample0) >> 2);
+ dst[15] = (Sint32) ((sample7 + last_sample7) >> 1);
+ dst[14] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[13] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[12] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[11] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[10] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[9] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[8] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[7] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2);
+ dst[6] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2);
+ dst[5] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2);
+ dst[4] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2);
+ dst[3] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2);
+ dst[2] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2);
+ dst[1] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2);
+ dst[0] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ Sint32 *dst = (Sint32 *) cvt->buf;
+ const Sint32 *src = (Sint32 *) cvt->buf;
+ const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize);
+ Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ while (dst < target) {
+ const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0]));
+ const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1]));
+ const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2]));
+ const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3]));
+ const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4]));
+ const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5]));
+ const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6]));
+ const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7]));
+ src += 32;
+ dst[0] = (Sint32) ((sample0 + last_sample0) >> 1);
+ dst[1] = (Sint32) ((sample1 + last_sample1) >> 1);
+ dst[2] = (Sint32) ((sample2 + last_sample2) >> 1);
+ dst[3] = (Sint32) ((sample3 + last_sample3) >> 1);
+ dst[4] = (Sint32) ((sample4 + last_sample4) >> 1);
+ dst[5] = (Sint32) ((sample5 + last_sample5) >> 1);
+ dst[6] = (Sint32) ((sample6 + last_sample6) >> 1);
+ dst[7] = (Sint32) ((sample7 + last_sample7) >> 1);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 1;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
+ const float *target = ((const float *) cvt->buf) - 1;
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src--;
+ dst[1] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[0] = (float) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src += 2;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 1;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
+ const float *target = ((const float *) cvt->buf) - 1;
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src--;
+ dst[3] = (float) sample0;
+ dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[1] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src += 4;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 2;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
+ const float *target = ((const float *) cvt->buf) - 2;
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 2;
+ dst[3] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ src += 4;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 2;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
+ const float *target = ((const float *) cvt->buf) - 2;
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 2;
+ dst[7] = (float) sample1;
+ dst[6] = (float) sample0;
+ dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[3] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ src += 8;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 4;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
+ const float *target = ((const float *) cvt->buf) - 4;
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 4;
+ dst[7] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[6] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[5] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[4] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[3] = (float) sample3;
+ dst[2] = (float) sample2;
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ src += 8;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 4;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
+ const float *target = ((const float *) cvt->buf) - 4;
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 4;
+ dst[15] = (float) sample3;
+ dst[14] = (float) sample2;
+ dst[13] = (float) sample1;
+ dst[12] = (float) sample0;
+ dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
+ dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
+ dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[7] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[6] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[5] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[4] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
+ dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ src += 16;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 6;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
+ const float *target = ((const float *) cvt->buf) - 6;
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 6;
+ dst[11] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[10] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[9] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[8] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[7] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[6] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[5] = (float) sample5;
+ dst[4] = (float) sample4;
+ dst[3] = (float) sample3;
+ dst[2] = (float) sample2;
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ src += 12;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 6;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
+ const float *target = ((const float *) cvt->buf) - 6;
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 6;
+ dst[23] = (float) sample5;
+ dst[22] = (float) sample4;
+ dst[21] = (float) sample3;
+ dst[20] = (float) sample2;
+ dst[19] = (float) sample1;
+ dst[18] = (float) sample0;
+ dst[17] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
+ dst[16] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
+ dst[15] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
+ dst[14] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
+ dst[13] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[12] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[11] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[10] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[9] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[8] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[7] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[6] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
+ dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
+ dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
+ dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ src += 24;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+ const float *target = ((const float *) cvt->buf) - 8;
+ double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
+ double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample7 = (double) SDL_SwapFloatLE(src[7]);
+ const double sample6 = (double) SDL_SwapFloatLE(src[6]);
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 8;
+ dst[15] = (float) ((sample7 + last_sample7) * 0.5);
+ dst[14] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[13] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[12] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[11] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[10] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[9] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[8] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[7] = (float) sample7;
+ dst[6] = (float) sample6;
+ dst[5] = (float) sample5;
+ dst[4] = (float) sample4;
+ dst[3] = (float) sample3;
+ dst[2] = (float) sample2;
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
+ double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ const double sample6 = (double) SDL_SwapFloatLE(src[6]);
+ const double sample7 = (double) SDL_SwapFloatLE(src[7]);
+ src += 16;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[6] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[7] = (float) ((sample7 + last_sample7) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+ const float *target = ((const float *) cvt->buf) - 8;
+ double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
+ double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ while (dst > target) {
+ const double sample7 = (double) SDL_SwapFloatLE(src[7]);
+ const double sample6 = (double) SDL_SwapFloatLE(src[6]);
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ src -= 8;
+ dst[31] = (float) sample7;
+ dst[30] = (float) sample6;
+ dst[29] = (float) sample5;
+ dst[28] = (float) sample4;
+ dst[27] = (float) sample3;
+ dst[26] = (float) sample2;
+ dst[25] = (float) sample1;
+ dst[24] = (float) sample0;
+ dst[23] = (float) (((3.0 * sample7) + last_sample7) * 0.25);
+ dst[22] = (float) (((3.0 * sample6) + last_sample6) * 0.25);
+ dst[21] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
+ dst[20] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
+ dst[19] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
+ dst[18] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
+ dst[17] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[16] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[15] = (float) ((sample7 + last_sample7) * 0.5);
+ dst[14] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[13] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[12] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[11] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[10] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[9] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[8] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[7] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25);
+ dst[6] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25);
+ dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
+ dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
+ dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
+ dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatLE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatLE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatLE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatLE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatLE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatLE(src[5]);
+ double last_sample6 = (double) SDL_SwapFloatLE(src[6]);
+ double last_sample7 = (double) SDL_SwapFloatLE(src[7]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatLE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatLE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatLE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatLE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatLE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatLE(src[5]);
+ const double sample6 = (double) SDL_SwapFloatLE(src[6]);
+ const double sample7 = (double) SDL_SwapFloatLE(src[7]);
+ src += 32;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[6] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[7] = (float) ((sample7 + last_sample7) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 1;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
+ const float *target = ((const float *) cvt->buf) - 1;
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src--;
+ dst[1] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[0] = (float) sample0;
+ last_sample0 = sample0;
+ dst -= 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src += 2;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 1;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
+ const float *target = ((const float *) cvt->buf) - 1;
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src--;
+ dst[3] = (float) sample0;
+ dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[1] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src += 4;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ last_sample0 = sample0;
+ dst++;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 2;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
+ const float *target = ((const float *) cvt->buf) - 2;
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 2;
+ dst[3] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ src += 4;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 2;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
+ const float *target = ((const float *) cvt->buf) - 2;
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 2;
+ dst[7] = (float) sample1;
+ dst[6] = (float) sample0;
+ dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[3] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ src += 8;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ dst += 2;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 4;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
+ const float *target = ((const float *) cvt->buf) - 4;
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 4;
+ dst[7] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[6] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[5] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[4] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[3] = (float) sample3;
+ dst[2] = (float) sample2;
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ src += 8;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 4;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
+ const float *target = ((const float *) cvt->buf) - 4;
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 4;
+ dst[15] = (float) sample3;
+ dst[14] = (float) sample2;
+ dst[13] = (float) sample1;
+ dst[12] = (float) sample0;
+ dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
+ dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
+ dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[7] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[6] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[5] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[4] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
+ dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ src += 16;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ dst += 4;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 6;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
+ const float *target = ((const float *) cvt->buf) - 6;
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 6;
+ dst[11] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[10] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[9] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[8] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[7] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[6] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[5] = (float) sample5;
+ dst[4] = (float) sample4;
+ dst[3] = (float) sample3;
+ dst[2] = (float) sample2;
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 12;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ src += 12;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 6;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
+ const float *target = ((const float *) cvt->buf) - 6;
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 6;
+ dst[23] = (float) sample5;
+ dst[22] = (float) sample4;
+ dst[21] = (float) sample3;
+ dst[20] = (float) sample2;
+ dst[19] = (float) sample1;
+ dst[18] = (float) sample0;
+ dst[17] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
+ dst[16] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
+ dst[15] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
+ dst[14] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
+ dst[13] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[12] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[11] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[10] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[9] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[8] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[7] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[6] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
+ dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
+ dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
+ dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 24;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ src += 24;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ dst += 6;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 2;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+ const float *target = ((const float *) cvt->buf) - 8;
+ double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
+ double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample7 = (double) SDL_SwapFloatBE(src[7]);
+ const double sample6 = (double) SDL_SwapFloatBE(src[6]);
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 8;
+ dst[15] = (float) ((sample7 + last_sample7) * 0.5);
+ dst[14] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[13] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[12] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[11] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[10] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[9] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[8] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[7] = (float) sample7;
+ dst[6] = (float) sample6;
+ dst[5] = (float) sample5;
+ dst[4] = (float) sample4;
+ dst[3] = (float) sample3;
+ dst[2] = (float) sample2;
+ dst[1] = (float) sample1;
+ dst[0] = (float) sample0;
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 16;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 2;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
+ double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ const double sample6 = (double) SDL_SwapFloatBE(src[6]);
+ const double sample7 = (double) SDL_SwapFloatBE(src[7]);
+ src += 16;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[6] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[7] = (float) ((sample7 + last_sample7) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt * 4;
+ float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+ const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+ const float *target = ((const float *) cvt->buf) - 8;
+ double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
+ double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ while (dst > target) {
+ const double sample7 = (double) SDL_SwapFloatBE(src[7]);
+ const double sample6 = (double) SDL_SwapFloatBE(src[6]);
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ src -= 8;
+ dst[31] = (float) sample7;
+ dst[30] = (float) sample6;
+ dst[29] = (float) sample5;
+ dst[28] = (float) sample4;
+ dst[27] = (float) sample3;
+ dst[26] = (float) sample2;
+ dst[25] = (float) sample1;
+ dst[24] = (float) sample0;
+ dst[23] = (float) (((3.0 * sample7) + last_sample7) * 0.25);
+ dst[22] = (float) (((3.0 * sample6) + last_sample6) * 0.25);
+ dst[21] = (float) (((3.0 * sample5) + last_sample5) * 0.25);
+ dst[20] = (float) (((3.0 * sample4) + last_sample4) * 0.25);
+ dst[19] = (float) (((3.0 * sample3) + last_sample3) * 0.25);
+ dst[18] = (float) (((3.0 * sample2) + last_sample2) * 0.25);
+ dst[17] = (float) (((3.0 * sample1) + last_sample1) * 0.25);
+ dst[16] = (float) (((3.0 * sample0) + last_sample0) * 0.25);
+ dst[15] = (float) ((sample7 + last_sample7) * 0.5);
+ dst[14] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[13] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[12] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[11] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[10] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[9] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[8] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[7] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25);
+ dst[6] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25);
+ dst[5] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25);
+ dst[4] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25);
+ dst[3] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25);
+ dst[2] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25);
+ dst[1] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25);
+ dst[0] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25);
+ last_sample7 = sample7;
+ last_sample6 = sample6;
+ last_sample5 = sample5;
+ last_sample4 = sample4;
+ last_sample3 = sample3;
+ last_sample2 = sample2;
+ last_sample1 = sample1;
+ last_sample0 = sample0;
+ dst -= 32;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+static void SDLCALL
+SDL_Downsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format)
+{
+#if DEBUG_CONVERT
+ fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n");
+#endif
+
+ const int srcsize = cvt->len_cvt;
+ const int dstsize = cvt->len_cvt / 4;
+ float *dst = (float *) cvt->buf;
+ const float *src = (float *) cvt->buf;
+ const float *target = (const float *) (cvt->buf + dstsize);
+ double last_sample0 = (double) SDL_SwapFloatBE(src[0]);
+ double last_sample1 = (double) SDL_SwapFloatBE(src[1]);
+ double last_sample2 = (double) SDL_SwapFloatBE(src[2]);
+ double last_sample3 = (double) SDL_SwapFloatBE(src[3]);
+ double last_sample4 = (double) SDL_SwapFloatBE(src[4]);
+ double last_sample5 = (double) SDL_SwapFloatBE(src[5]);
+ double last_sample6 = (double) SDL_SwapFloatBE(src[6]);
+ double last_sample7 = (double) SDL_SwapFloatBE(src[7]);
+ while (dst < target) {
+ const double sample0 = (double) SDL_SwapFloatBE(src[0]);
+ const double sample1 = (double) SDL_SwapFloatBE(src[1]);
+ const double sample2 = (double) SDL_SwapFloatBE(src[2]);
+ const double sample3 = (double) SDL_SwapFloatBE(src[3]);
+ const double sample4 = (double) SDL_SwapFloatBE(src[4]);
+ const double sample5 = (double) SDL_SwapFloatBE(src[5]);
+ const double sample6 = (double) SDL_SwapFloatBE(src[6]);
+ const double sample7 = (double) SDL_SwapFloatBE(src[7]);
+ src += 32;
+ dst[0] = (float) ((sample0 + last_sample0) * 0.5);
+ dst[1] = (float) ((sample1 + last_sample1) * 0.5);
+ dst[2] = (float) ((sample2 + last_sample2) * 0.5);
+ dst[3] = (float) ((sample3 + last_sample3) * 0.5);
+ dst[4] = (float) ((sample4 + last_sample4) * 0.5);
+ dst[5] = (float) ((sample5 + last_sample5) * 0.5);
+ dst[6] = (float) ((sample6 + last_sample6) * 0.5);
+ dst[7] = (float) ((sample7 + last_sample7) * 0.5);
+ last_sample0 = sample0;
+ last_sample1 = sample1;
+ last_sample2 = sample2;
+ last_sample3 = sample3;
+ last_sample4 = sample4;
+ last_sample5 = sample5;
+ last_sample6 = sample6;
+ last_sample7 = sample7;
+ dst += 8;
+ }
+
+ cvt->len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+#endif /* !LESS_RESAMPLERS */
+#endif /* !NO_RESAMPLERS */
+
+
+const SDL_AudioRateFilters sdl_audio_rate_filters[] =
+{
+#if !NO_RESAMPLERS
+ { AUDIO_U8, 1, 0, 0, SDL_Downsample_U8_1c },
+ { AUDIO_U8, 1, 1, 0, SDL_Upsample_U8_1c },
+ { AUDIO_U8, 2, 0, 0, SDL_Downsample_U8_2c },
+ { AUDIO_U8, 2, 1, 0, SDL_Upsample_U8_2c },
+ { AUDIO_U8, 4, 0, 0, SDL_Downsample_U8_4c },
+ { AUDIO_U8, 4, 1, 0, SDL_Upsample_U8_4c },
+ { AUDIO_U8, 6, 0, 0, SDL_Downsample_U8_6c },
+ { AUDIO_U8, 6, 1, 0, SDL_Upsample_U8_6c },
+ { AUDIO_U8, 8, 0, 0, SDL_Downsample_U8_8c },
+ { AUDIO_U8, 8, 1, 0, SDL_Upsample_U8_8c },
+ { AUDIO_S8, 1, 0, 0, SDL_Downsample_S8_1c },
+ { AUDIO_S8, 1, 1, 0, SDL_Upsample_S8_1c },
+ { AUDIO_S8, 2, 0, 0, SDL_Downsample_S8_2c },
+ { AUDIO_S8, 2, 1, 0, SDL_Upsample_S8_2c },
+ { AUDIO_S8, 4, 0, 0, SDL_Downsample_S8_4c },
+ { AUDIO_S8, 4, 1, 0, SDL_Upsample_S8_4c },
+ { AUDIO_S8, 6, 0, 0, SDL_Downsample_S8_6c },
+ { AUDIO_S8, 6, 1, 0, SDL_Upsample_S8_6c },
+ { AUDIO_S8, 8, 0, 0, SDL_Downsample_S8_8c },
+ { AUDIO_S8, 8, 1, 0, SDL_Upsample_S8_8c },
+ { AUDIO_U16LSB, 1, 0, 0, SDL_Downsample_U16LSB_1c },
+ { AUDIO_U16LSB, 1, 1, 0, SDL_Upsample_U16LSB_1c },
+ { AUDIO_U16LSB, 2, 0, 0, SDL_Downsample_U16LSB_2c },
+ { AUDIO_U16LSB, 2, 1, 0, SDL_Upsample_U16LSB_2c },
+ { AUDIO_U16LSB, 4, 0, 0, SDL_Downsample_U16LSB_4c },
+ { AUDIO_U16LSB, 4, 1, 0, SDL_Upsample_U16LSB_4c },
+ { AUDIO_U16LSB, 6, 0, 0, SDL_Downsample_U16LSB_6c },
+ { AUDIO_U16LSB, 6, 1, 0, SDL_Upsample_U16LSB_6c },
+ { AUDIO_U16LSB, 8, 0, 0, SDL_Downsample_U16LSB_8c },
+ { AUDIO_U16LSB, 8, 1, 0, SDL_Upsample_U16LSB_8c },
+ { AUDIO_S16LSB, 1, 0, 0, SDL_Downsample_S16LSB_1c },
+ { AUDIO_S16LSB, 1, 1, 0, SDL_Upsample_S16LSB_1c },
+ { AUDIO_S16LSB, 2, 0, 0, SDL_Downsample_S16LSB_2c },
+ { AUDIO_S16LSB, 2, 1, 0, SDL_Upsample_S16LSB_2c },
+ { AUDIO_S16LSB, 4, 0, 0, SDL_Downsample_S16LSB_4c },
+ { AUDIO_S16LSB, 4, 1, 0, SDL_Upsample_S16LSB_4c },
+ { AUDIO_S16LSB, 6, 0, 0, SDL_Downsample_S16LSB_6c },
+ { AUDIO_S16LSB, 6, 1, 0, SDL_Upsample_S16LSB_6c },
+ { AUDIO_S16LSB, 8, 0, 0, SDL_Downsample_S16LSB_8c },
+ { AUDIO_S16LSB, 8, 1, 0, SDL_Upsample_S16LSB_8c },
+ { AUDIO_U16MSB, 1, 0, 0, SDL_Downsample_U16MSB_1c },
+ { AUDIO_U16MSB, 1, 1, 0, SDL_Upsample_U16MSB_1c },
+ { AUDIO_U16MSB, 2, 0, 0, SDL_Downsample_U16MSB_2c },
+ { AUDIO_U16MSB, 2, 1, 0, SDL_Upsample_U16MSB_2c },
+ { AUDIO_U16MSB, 4, 0, 0, SDL_Downsample_U16MSB_4c },
+ { AUDIO_U16MSB, 4, 1, 0, SDL_Upsample_U16MSB_4c },
+ { AUDIO_U16MSB, 6, 0, 0, SDL_Downsample_U16MSB_6c },
+ { AUDIO_U16MSB, 6, 1, 0, SDL_Upsample_U16MSB_6c },
+ { AUDIO_U16MSB, 8, 0, 0, SDL_Downsample_U16MSB_8c },
+ { AUDIO_U16MSB, 8, 1, 0, SDL_Upsample_U16MSB_8c },
+ { AUDIO_S16MSB, 1, 0, 0, SDL_Downsample_S16MSB_1c },
+ { AUDIO_S16MSB, 1, 1, 0, SDL_Upsample_S16MSB_1c },
+ { AUDIO_S16MSB, 2, 0, 0, SDL_Downsample_S16MSB_2c },
+ { AUDIO_S16MSB, 2, 1, 0, SDL_Upsample_S16MSB_2c },
+ { AUDIO_S16MSB, 4, 0, 0, SDL_Downsample_S16MSB_4c },
+ { AUDIO_S16MSB, 4, 1, 0, SDL_Upsample_S16MSB_4c },
+ { AUDIO_S16MSB, 6, 0, 0, SDL_Downsample_S16MSB_6c },
+ { AUDIO_S16MSB, 6, 1, 0, SDL_Upsample_S16MSB_6c },
+ { AUDIO_S16MSB, 8, 0, 0, SDL_Downsample_S16MSB_8c },
+ { AUDIO_S16MSB, 8, 1, 0, SDL_Upsample_S16MSB_8c },
+ { AUDIO_S32LSB, 1, 0, 0, SDL_Downsample_S32LSB_1c },
+ { AUDIO_S32LSB, 1, 1, 0, SDL_Upsample_S32LSB_1c },
+ { AUDIO_S32LSB, 2, 0, 0, SDL_Downsample_S32LSB_2c },
+ { AUDIO_S32LSB, 2, 1, 0, SDL_Upsample_S32LSB_2c },
+ { AUDIO_S32LSB, 4, 0, 0, SDL_Downsample_S32LSB_4c },
+ { AUDIO_S32LSB, 4, 1, 0, SDL_Upsample_S32LSB_4c },
+ { AUDIO_S32LSB, 6, 0, 0, SDL_Downsample_S32LSB_6c },
+ { AUDIO_S32LSB, 6, 1, 0, SDL_Upsample_S32LSB_6c },
+ { AUDIO_S32LSB, 8, 0, 0, SDL_Downsample_S32LSB_8c },
+ { AUDIO_S32LSB, 8, 1, 0, SDL_Upsample_S32LSB_8c },
+ { AUDIO_S32MSB, 1, 0, 0, SDL_Downsample_S32MSB_1c },
+ { AUDIO_S32MSB, 1, 1, 0, SDL_Upsample_S32MSB_1c },
+ { AUDIO_S32MSB, 2, 0, 0, SDL_Downsample_S32MSB_2c },
+ { AUDIO_S32MSB, 2, 1, 0, SDL_Upsample_S32MSB_2c },
+ { AUDIO_S32MSB, 4, 0, 0, SDL_Downsample_S32MSB_4c },
+ { AUDIO_S32MSB, 4, 1, 0, SDL_Upsample_S32MSB_4c },
+ { AUDIO_S32MSB, 6, 0, 0, SDL_Downsample_S32MSB_6c },
+ { AUDIO_S32MSB, 6, 1, 0, SDL_Upsample_S32MSB_6c },
+ { AUDIO_S32MSB, 8, 0, 0, SDL_Downsample_S32MSB_8c },
+ { AUDIO_S32MSB, 8, 1, 0, SDL_Upsample_S32MSB_8c },
+ { AUDIO_F32LSB, 1, 0, 0, SDL_Downsample_F32LSB_1c },
+ { AUDIO_F32LSB, 1, 1, 0, SDL_Upsample_F32LSB_1c },
+ { AUDIO_F32LSB, 2, 0, 0, SDL_Downsample_F32LSB_2c },
+ { AUDIO_F32LSB, 2, 1, 0, SDL_Upsample_F32LSB_2c },
+ { AUDIO_F32LSB, 4, 0, 0, SDL_Downsample_F32LSB_4c },
+ { AUDIO_F32LSB, 4, 1, 0, SDL_Upsample_F32LSB_4c },
+ { AUDIO_F32LSB, 6, 0, 0, SDL_Downsample_F32LSB_6c },
+ { AUDIO_F32LSB, 6, 1, 0, SDL_Upsample_F32LSB_6c },
+ { AUDIO_F32LSB, 8, 0, 0, SDL_Downsample_F32LSB_8c },
+ { AUDIO_F32LSB, 8, 1, 0, SDL_Upsample_F32LSB_8c },
+ { AUDIO_F32MSB, 1, 0, 0, SDL_Downsample_F32MSB_1c },
+ { AUDIO_F32MSB, 1, 1, 0, SDL_Upsample_F32MSB_1c },
+ { AUDIO_F32MSB, 2, 0, 0, SDL_Downsample_F32MSB_2c },
+ { AUDIO_F32MSB, 2, 1, 0, SDL_Upsample_F32MSB_2c },
+ { AUDIO_F32MSB, 4, 0, 0, SDL_Downsample_F32MSB_4c },
+ { AUDIO_F32MSB, 4, 1, 0, SDL_Upsample_F32MSB_4c },
+ { AUDIO_F32MSB, 6, 0, 0, SDL_Downsample_F32MSB_6c },
+ { AUDIO_F32MSB, 6, 1, 0, SDL_Upsample_F32MSB_6c },
+ { AUDIO_F32MSB, 8, 0, 0, SDL_Downsample_F32MSB_8c },
+ { AUDIO_F32MSB, 8, 1, 0, SDL_Upsample_F32MSB_8c },
+#if !LESS_RESAMPLERS
+ { AUDIO_U8, 1, 0, 2, SDL_Downsample_U8_1c_x2 },
+ { AUDIO_U8, 1, 1, 2, SDL_Upsample_U8_1c_x2 },
+ { AUDIO_U8, 1, 0, 4, SDL_Downsample_U8_1c_x4 },
+ { AUDIO_U8, 1, 1, 4, SDL_Upsample_U8_1c_x4 },
+ { AUDIO_U8, 2, 0, 2, SDL_Downsample_U8_2c_x2 },
+ { AUDIO_U8, 2, 1, 2, SDL_Upsample_U8_2c_x2 },
+ { AUDIO_U8, 2, 0, 4, SDL_Downsample_U8_2c_x4 },
+ { AUDIO_U8, 2, 1, 4, SDL_Upsample_U8_2c_x4 },
+ { AUDIO_U8, 4, 0, 2, SDL_Downsample_U8_4c_x2 },
+ { AUDIO_U8, 4, 1, 2, SDL_Upsample_U8_4c_x2 },
+ { AUDIO_U8, 4, 0, 4, SDL_Downsample_U8_4c_x4 },
+ { AUDIO_U8, 4, 1, 4, SDL_Upsample_U8_4c_x4 },
+ { AUDIO_U8, 6, 0, 2, SDL_Downsample_U8_6c_x2 },
+ { AUDIO_U8, 6, 1, 2, SDL_Upsample_U8_6c_x2 },
+ { AUDIO_U8, 6, 0, 4, SDL_Downsample_U8_6c_x4 },
+ { AUDIO_U8, 6, 1, 4, SDL_Upsample_U8_6c_x4 },
+ { AUDIO_U8, 8, 0, 2, SDL_Downsample_U8_8c_x2 },
+ { AUDIO_U8, 8, 1, 2, SDL_Upsample_U8_8c_x2 },
+ { AUDIO_U8, 8, 0, 4, SDL_Downsample_U8_8c_x4 },
+ { AUDIO_U8, 8, 1, 4, SDL_Upsample_U8_8c_x4 },
+ { AUDIO_S8, 1, 0, 2, SDL_Downsample_S8_1c_x2 },
+ { AUDIO_S8, 1, 1, 2, SDL_Upsample_S8_1c_x2 },
+ { AUDIO_S8, 1, 0, 4, SDL_Downsample_S8_1c_x4 },
+ { AUDIO_S8, 1, 1, 4, SDL_Upsample_S8_1c_x4 },
+ { AUDIO_S8, 2, 0, 2, SDL_Downsample_S8_2c_x2 },
+ { AUDIO_S8, 2, 1, 2, SDL_Upsample_S8_2c_x2 },
+ { AUDIO_S8, 2, 0, 4, SDL_Downsample_S8_2c_x4 },
+ { AUDIO_S8, 2, 1, 4, SDL_Upsample_S8_2c_x4 },
+ { AUDIO_S8, 4, 0, 2, SDL_Downsample_S8_4c_x2 },
+ { AUDIO_S8, 4, 1, 2, SDL_Upsample_S8_4c_x2 },
+ { AUDIO_S8, 4, 0, 4, SDL_Downsample_S8_4c_x4 },
+ { AUDIO_S8, 4, 1, 4, SDL_Upsample_S8_4c_x4 },
+ { AUDIO_S8, 6, 0, 2, SDL_Downsample_S8_6c_x2 },
+ { AUDIO_S8, 6, 1, 2, SDL_Upsample_S8_6c_x2 },
+ { AUDIO_S8, 6, 0, 4, SDL_Downsample_S8_6c_x4 },
+ { AUDIO_S8, 6, 1, 4, SDL_Upsample_S8_6c_x4 },
+ { AUDIO_S8, 8, 0, 2, SDL_Downsample_S8_8c_x2 },
+ { AUDIO_S8, 8, 1, 2, SDL_Upsample_S8_8c_x2 },
+ { AUDIO_S8, 8, 0, 4, SDL_Downsample_S8_8c_x4 },
+ { AUDIO_S8, 8, 1, 4, SDL_Upsample_S8_8c_x4 },
+ { AUDIO_U16LSB, 1, 0, 2, SDL_Downsample_U16LSB_1c_x2 },
+ { AUDIO_U16LSB, 1, 1, 2, SDL_Upsample_U16LSB_1c_x2 },
+ { AUDIO_U16LSB, 1, 0, 4, SDL_Downsample_U16LSB_1c_x4 },
+ { AUDIO_U16LSB, 1, 1, 4, SDL_Upsample_U16LSB_1c_x4 },
+ { AUDIO_U16LSB, 2, 0, 2, SDL_Downsample_U16LSB_2c_x2 },
+ { AUDIO_U16LSB, 2, 1, 2, SDL_Upsample_U16LSB_2c_x2 },
+ { AUDIO_U16LSB, 2, 0, 4, SDL_Downsample_U16LSB_2c_x4 },
+ { AUDIO_U16LSB, 2, 1, 4, SDL_Upsample_U16LSB_2c_x4 },
+ { AUDIO_U16LSB, 4, 0, 2, SDL_Downsample_U16LSB_4c_x2 },
+ { AUDIO_U16LSB, 4, 1, 2, SDL_Upsample_U16LSB_4c_x2 },
+ { AUDIO_U16LSB, 4, 0, 4, SDL_Downsample_U16LSB_4c_x4 },
+ { AUDIO_U16LSB, 4, 1, 4, SDL_Upsample_U16LSB_4c_x4 },
+ { AUDIO_U16LSB, 6, 0, 2, SDL_Downsample_U16LSB_6c_x2 },
+ { AUDIO_U16LSB, 6, 1, 2, SDL_Upsample_U16LSB_6c_x2 },
+ { AUDIO_U16LSB, 6, 0, 4, SDL_Downsample_U16LSB_6c_x4 },
+ { AUDIO_U16LSB, 6, 1, 4, SDL_Upsample_U16LSB_6c_x4 },
+ { AUDIO_U16LSB, 8, 0, 2, SDL_Downsample_U16LSB_8c_x2 },
+ { AUDIO_U16LSB, 8, 1, 2, SDL_Upsample_U16LSB_8c_x2 },
+ { AUDIO_U16LSB, 8, 0, 4, SDL_Downsample_U16LSB_8c_x4 },
+ { AUDIO_U16LSB, 8, 1, 4, SDL_Upsample_U16LSB_8c_x4 },
+ { AUDIO_S16LSB, 1, 0, 2, SDL_Downsample_S16LSB_1c_x2 },
+ { AUDIO_S16LSB, 1, 1, 2, SDL_Upsample_S16LSB_1c_x2 },
+ { AUDIO_S16LSB, 1, 0, 4, SDL_Downsample_S16LSB_1c_x4 },
+ { AUDIO_S16LSB, 1, 1, 4, SDL_Upsample_S16LSB_1c_x4 },
+ { AUDIO_S16LSB, 2, 0, 2, SDL_Downsample_S16LSB_2c_x2 },
+ { AUDIO_S16LSB, 2, 1, 2, SDL_Upsample_S16LSB_2c_x2 },
+ { AUDIO_S16LSB, 2, 0, 4, SDL_Downsample_S16LSB_2c_x4 },
+ { AUDIO_S16LSB, 2, 1, 4, SDL_Upsample_S16LSB_2c_x4 },
+ { AUDIO_S16LSB, 4, 0, 2, SDL_Downsample_S16LSB_4c_x2 },
+ { AUDIO_S16LSB, 4, 1, 2, SDL_Upsample_S16LSB_4c_x2 },
+ { AUDIO_S16LSB, 4, 0, 4, SDL_Downsample_S16LSB_4c_x4 },
+ { AUDIO_S16LSB, 4, 1, 4, SDL_Upsample_S16LSB_4c_x4 },
+ { AUDIO_S16LSB, 6, 0, 2, SDL_Downsample_S16LSB_6c_x2 },
+ { AUDIO_S16LSB, 6, 1, 2, SDL_Upsample_S16LSB_6c_x2 },
+ { AUDIO_S16LSB, 6, 0, 4, SDL_Downsample_S16LSB_6c_x4 },
+ { AUDIO_S16LSB, 6, 1, 4, SDL_Upsample_S16LSB_6c_x4 },
+ { AUDIO_S16LSB, 8, 0, 2, SDL_Downsample_S16LSB_8c_x2 },
+ { AUDIO_S16LSB, 8, 1, 2, SDL_Upsample_S16LSB_8c_x2 },
+ { AUDIO_S16LSB, 8, 0, 4, SDL_Downsample_S16LSB_8c_x4 },
+ { AUDIO_S16LSB, 8, 1, 4, SDL_Upsample_S16LSB_8c_x4 },
+ { AUDIO_U16MSB, 1, 0, 2, SDL_Downsample_U16MSB_1c_x2 },
+ { AUDIO_U16MSB, 1, 1, 2, SDL_Upsample_U16MSB_1c_x2 },
+ { AUDIO_U16MSB, 1, 0, 4, SDL_Downsample_U16MSB_1c_x4 },
+ { AUDIO_U16MSB, 1, 1, 4, SDL_Upsample_U16MSB_1c_x4 },
+ { AUDIO_U16MSB, 2, 0, 2, SDL_Downsample_U16MSB_2c_x2 },
+ { AUDIO_U16MSB, 2, 1, 2, SDL_Upsample_U16MSB_2c_x2 },
+ { AUDIO_U16MSB, 2, 0, 4, SDL_Downsample_U16MSB_2c_x4 },
+ { AUDIO_U16MSB, 2, 1, 4, SDL_Upsample_U16MSB_2c_x4 },
+ { AUDIO_U16MSB, 4, 0, 2, SDL_Downsample_U16MSB_4c_x2 },
+ { AUDIO_U16MSB, 4, 1, 2, SDL_Upsample_U16MSB_4c_x2 },
+ { AUDIO_U16MSB, 4, 0, 4, SDL_Downsample_U16MSB_4c_x4 },
+ { AUDIO_U16MSB, 4, 1, 4, SDL_Upsample_U16MSB_4c_x4 },
+ { AUDIO_U16MSB, 6, 0, 2, SDL_Downsample_U16MSB_6c_x2 },
+ { AUDIO_U16MSB, 6, 1, 2, SDL_Upsample_U16MSB_6c_x2 },
+ { AUDIO_U16MSB, 6, 0, 4, SDL_Downsample_U16MSB_6c_x4 },
+ { AUDIO_U16MSB, 6, 1, 4, SDL_Upsample_U16MSB_6c_x4 },
+ { AUDIO_U16MSB, 8, 0, 2, SDL_Downsample_U16MSB_8c_x2 },
+ { AUDIO_U16MSB, 8, 1, 2, SDL_Upsample_U16MSB_8c_x2 },
+ { AUDIO_U16MSB, 8, 0, 4, SDL_Downsample_U16MSB_8c_x4 },
+ { AUDIO_U16MSB, 8, 1, 4, SDL_Upsample_U16MSB_8c_x4 },
+ { AUDIO_S16MSB, 1, 0, 2, SDL_Downsample_S16MSB_1c_x2 },
+ { AUDIO_S16MSB, 1, 1, 2, SDL_Upsample_S16MSB_1c_x2 },
+ { AUDIO_S16MSB, 1, 0, 4, SDL_Downsample_S16MSB_1c_x4 },
+ { AUDIO_S16MSB, 1, 1, 4, SDL_Upsample_S16MSB_1c_x4 },
+ { AUDIO_S16MSB, 2, 0, 2, SDL_Downsample_S16MSB_2c_x2 },
+ { AUDIO_S16MSB, 2, 1, 2, SDL_Upsample_S16MSB_2c_x2 },
+ { AUDIO_S16MSB, 2, 0, 4, SDL_Downsample_S16MSB_2c_x4 },
+ { AUDIO_S16MSB, 2, 1, 4, SDL_Upsample_S16MSB_2c_x4 },
+ { AUDIO_S16MSB, 4, 0, 2, SDL_Downsample_S16MSB_4c_x2 },
+ { AUDIO_S16MSB, 4, 1, 2, SDL_Upsample_S16MSB_4c_x2 },
+ { AUDIO_S16MSB, 4, 0, 4, SDL_Downsample_S16MSB_4c_x4 },
+ { AUDIO_S16MSB, 4, 1, 4, SDL_Upsample_S16MSB_4c_x4 },
+ { AUDIO_S16MSB, 6, 0, 2, SDL_Downsample_S16MSB_6c_x2 },
+ { AUDIO_S16MSB, 6, 1, 2, SDL_Upsample_S16MSB_6c_x2 },
+ { AUDIO_S16MSB, 6, 0, 4, SDL_Downsample_S16MSB_6c_x4 },
+ { AUDIO_S16MSB, 6, 1, 4, SDL_Upsample_S16MSB_6c_x4 },
+ { AUDIO_S16MSB, 8, 0, 2, SDL_Downsample_S16MSB_8c_x2 },
+ { AUDIO_S16MSB, 8, 1, 2, SDL_Upsample_S16MSB_8c_x2 },
+ { AUDIO_S16MSB, 8, 0, 4, SDL_Downsample_S16MSB_8c_x4 },
+ { AUDIO_S16MSB, 8, 1, 4, SDL_Upsample_S16MSB_8c_x4 },
+ { AUDIO_S32LSB, 1, 0, 2, SDL_Downsample_S32LSB_1c_x2 },
+ { AUDIO_S32LSB, 1, 1, 2, SDL_Upsample_S32LSB_1c_x2 },
+ { AUDIO_S32LSB, 1, 0, 4, SDL_Downsample_S32LSB_1c_x4 },
+ { AUDIO_S32LSB, 1, 1, 4, SDL_Upsample_S32LSB_1c_x4 },
+ { AUDIO_S32LSB, 2, 0, 2, SDL_Downsample_S32LSB_2c_x2 },
+ { AUDIO_S32LSB, 2, 1, 2, SDL_Upsample_S32LSB_2c_x2 },
+ { AUDIO_S32LSB, 2, 0, 4, SDL_Downsample_S32LSB_2c_x4 },
+ { AUDIO_S32LSB, 2, 1, 4, SDL_Upsample_S32LSB_2c_x4 },
+ { AUDIO_S32LSB, 4, 0, 2, SDL_Downsample_S32LSB_4c_x2 },
+ { AUDIO_S32LSB, 4, 1, 2, SDL_Upsample_S32LSB_4c_x2 },
+ { AUDIO_S32LSB, 4, 0, 4, SDL_Downsample_S32LSB_4c_x4 },
+ { AUDIO_S32LSB, 4, 1, 4, SDL_Upsample_S32LSB_4c_x4 },
+ { AUDIO_S32LSB, 6, 0, 2, SDL_Downsample_S32LSB_6c_x2 },
+ { AUDIO_S32LSB, 6, 1, 2, SDL_Upsample_S32LSB_6c_x2 },
+ { AUDIO_S32LSB, 6, 0, 4, SDL_Downsample_S32LSB_6c_x4 },
+ { AUDIO_S32LSB, 6, 1, 4, SDL_Upsample_S32LSB_6c_x4 },
+ { AUDIO_S32LSB, 8, 0, 2, SDL_Downsample_S32LSB_8c_x2 },
+ { AUDIO_S32LSB, 8, 1, 2, SDL_Upsample_S32LSB_8c_x2 },
+ { AUDIO_S32LSB, 8, 0, 4, SDL_Downsample_S32LSB_8c_x4 },
+ { AUDIO_S32LSB, 8, 1, 4, SDL_Upsample_S32LSB_8c_x4 },
+ { AUDIO_S32MSB, 1, 0, 2, SDL_Downsample_S32MSB_1c_x2 },
+ { AUDIO_S32MSB, 1, 1, 2, SDL_Upsample_S32MSB_1c_x2 },
+ { AUDIO_S32MSB, 1, 0, 4, SDL_Downsample_S32MSB_1c_x4 },
+ { AUDIO_S32MSB, 1, 1, 4, SDL_Upsample_S32MSB_1c_x4 },
+ { AUDIO_S32MSB, 2, 0, 2, SDL_Downsample_S32MSB_2c_x2 },
+ { AUDIO_S32MSB, 2, 1, 2, SDL_Upsample_S32MSB_2c_x2 },
+ { AUDIO_S32MSB, 2, 0, 4, SDL_Downsample_S32MSB_2c_x4 },
+ { AUDIO_S32MSB, 2, 1, 4, SDL_Upsample_S32MSB_2c_x4 },
+ { AUDIO_S32MSB, 4, 0, 2, SDL_Downsample_S32MSB_4c_x2 },
+ { AUDIO_S32MSB, 4, 1, 2, SDL_Upsample_S32MSB_4c_x2 },
+ { AUDIO_S32MSB, 4, 0, 4, SDL_Downsample_S32MSB_4c_x4 },
+ { AUDIO_S32MSB, 4, 1, 4, SDL_Upsample_S32MSB_4c_x4 },
+ { AUDIO_S32MSB, 6, 0, 2, SDL_Downsample_S32MSB_6c_x2 },
+ { AUDIO_S32MSB, 6, 1, 2, SDL_Upsample_S32MSB_6c_x2 },
+ { AUDIO_S32MSB, 6, 0, 4, SDL_Downsample_S32MSB_6c_x4 },
+ { AUDIO_S32MSB, 6, 1, 4, SDL_Upsample_S32MSB_6c_x4 },
+ { AUDIO_S32MSB, 8, 0, 2, SDL_Downsample_S32MSB_8c_x2 },
+ { AUDIO_S32MSB, 8, 1, 2, SDL_Upsample_S32MSB_8c_x2 },
+ { AUDIO_S32MSB, 8, 0, 4, SDL_Downsample_S32MSB_8c_x4 },
+ { AUDIO_S32MSB, 8, 1, 4, SDL_Upsample_S32MSB_8c_x4 },
+ { AUDIO_F32LSB, 1, 0, 2, SDL_Downsample_F32LSB_1c_x2 },
+ { AUDIO_F32LSB, 1, 1, 2, SDL_Upsample_F32LSB_1c_x2 },
+ { AUDIO_F32LSB, 1, 0, 4, SDL_Downsample_F32LSB_1c_x4 },
+ { AUDIO_F32LSB, 1, 1, 4, SDL_Upsample_F32LSB_1c_x4 },
+ { AUDIO_F32LSB, 2, 0, 2, SDL_Downsample_F32LSB_2c_x2 },
+ { AUDIO_F32LSB, 2, 1, 2, SDL_Upsample_F32LSB_2c_x2 },
+ { AUDIO_F32LSB, 2, 0, 4, SDL_Downsample_F32LSB_2c_x4 },
+ { AUDIO_F32LSB, 2, 1, 4, SDL_Upsample_F32LSB_2c_x4 },
+ { AUDIO_F32LSB, 4, 0, 2, SDL_Downsample_F32LSB_4c_x2 },
+ { AUDIO_F32LSB, 4, 1, 2, SDL_Upsample_F32LSB_4c_x2 },
+ { AUDIO_F32LSB, 4, 0, 4, SDL_Downsample_F32LSB_4c_x4 },
+ { AUDIO_F32LSB, 4, 1, 4, SDL_Upsample_F32LSB_4c_x4 },
+ { AUDIO_F32LSB, 6, 0, 2, SDL_Downsample_F32LSB_6c_x2 },
+ { AUDIO_F32LSB, 6, 1, 2, SDL_Upsample_F32LSB_6c_x2 },
+ { AUDIO_F32LSB, 6, 0, 4, SDL_Downsample_F32LSB_6c_x4 },
+ { AUDIO_F32LSB, 6, 1, 4, SDL_Upsample_F32LSB_6c_x4 },
+ { AUDIO_F32LSB, 8, 0, 2, SDL_Downsample_F32LSB_8c_x2 },
+ { AUDIO_F32LSB, 8, 1, 2, SDL_Upsample_F32LSB_8c_x2 },
+ { AUDIO_F32LSB, 8, 0, 4, SDL_Downsample_F32LSB_8c_x4 },
+ { AUDIO_F32LSB, 8, 1, 4, SDL_Upsample_F32LSB_8c_x4 },
+ { AUDIO_F32MSB, 1, 0, 2, SDL_Downsample_F32MSB_1c_x2 },
+ { AUDIO_F32MSB, 1, 1, 2, SDL_Upsample_F32MSB_1c_x2 },
+ { AUDIO_F32MSB, 1, 0, 4, SDL_Downsample_F32MSB_1c_x4 },
+ { AUDIO_F32MSB, 1, 1, 4, SDL_Upsample_F32MSB_1c_x4 },
+ { AUDIO_F32MSB, 2, 0, 2, SDL_Downsample_F32MSB_2c_x2 },
+ { AUDIO_F32MSB, 2, 1, 2, SDL_Upsample_F32MSB_2c_x2 },
+ { AUDIO_F32MSB, 2, 0, 4, SDL_Downsample_F32MSB_2c_x4 },
+ { AUDIO_F32MSB, 2, 1, 4, SDL_Upsample_F32MSB_2c_x4 },
+ { AUDIO_F32MSB, 4, 0, 2, SDL_Downsample_F32MSB_4c_x2 },
+ { AUDIO_F32MSB, 4, 1, 2, SDL_Upsample_F32MSB_4c_x2 },
+ { AUDIO_F32MSB, 4, 0, 4, SDL_Downsample_F32MSB_4c_x4 },
+ { AUDIO_F32MSB, 4, 1, 4, SDL_Upsample_F32MSB_4c_x4 },
+ { AUDIO_F32MSB, 6, 0, 2, SDL_Downsample_F32MSB_6c_x2 },
+ { AUDIO_F32MSB, 6, 1, 2, SDL_Upsample_F32MSB_6c_x2 },
+ { AUDIO_F32MSB, 6, 0, 4, SDL_Downsample_F32MSB_6c_x4 },
+ { AUDIO_F32MSB, 6, 1, 4, SDL_Upsample_F32MSB_6c_x4 },
+ { AUDIO_F32MSB, 8, 0, 2, SDL_Downsample_F32MSB_8c_x2 },
+ { AUDIO_F32MSB, 8, 1, 2, SDL_Upsample_F32MSB_8c_x2 },
+ { AUDIO_F32MSB, 8, 0, 4, SDL_Downsample_F32MSB_8c_x4 },
+ { AUDIO_F32MSB, 8, 1, 4, SDL_Upsample_F32MSB_8c_x4 },
+#endif /* !LESS_RESAMPLERS */
+#endif /* !NO_RESAMPLERS */
+ { 0, 0, 0, 0, NULL }
+};
+
+/* 390 converters generated. */
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_mixer.c b/alienblaster/project/jni/sdl/src/audio/SDL_mixer.c
index 5a1d7efe8..2cc7a8771 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_mixer.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_mixer.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -35,230 +35,331 @@
* the value to avoid overflow. (used with permission from ARDI)
* Changed to use 0xFE instead of 0xFF for better sound quality.
*/
-static const Uint8 mix8[] =
-{
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
- 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
- 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24,
- 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
- 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
- 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
- 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
- 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
- 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92,
- 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D,
- 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8,
- 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
- 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE,
- 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9,
- 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4,
- 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
- 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
- 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5,
- 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE
+static const Uint8 mix8[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+ 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
+ 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24,
+ 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
+ 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
+ 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
+ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
+ 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+ 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
+ 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
+ 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92,
+ 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D,
+ 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8,
+ 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
+ 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE,
+ 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9,
+ 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4,
+ 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
+ 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5,
+ 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+ 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE
};
/* The volume ranges from 0 - 128 */
#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
-void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume)
+
+void
+SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
+ Uint32 len, int volume)
{
- Uint16 format;
+ if (volume == 0) {
+ return;
+ }
- if ( volume == 0 ) {
- return;
- }
- /* Mix the user-level audio format */
- if ( current_audio ) {
- if ( current_audio->convert.needed ) {
- format = current_audio->convert.src_format;
- } else {
- format = current_audio->spec.format;
- }
- } else {
- /* HACK HACK HACK */
- format = AUDIO_S16;
- }
- switch (format) {
+ switch (format) {
- case AUDIO_U8: {
-#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
- SDL_MixAudio_m68k_U8((char*)dst,(char*)src,(unsigned long)len,(long)volume,(char *)mix8);
+ case AUDIO_U8:
+ {
+#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
+ SDL_MixAudio_m68k_U8((char *) dst, (char *) src,
+ (unsigned long) len, (long) volume,
+ (char *) mix8);
#else
- Uint8 src_sample;
+ Uint8 src_sample;
- while ( len-- ) {
- src_sample = *src;
- ADJUST_VOLUME_U8(src_sample, volume);
- *dst = mix8[*dst+src_sample];
- ++dst;
- ++src;
- }
+ while (len--) {
+ src_sample = *src;
+ ADJUST_VOLUME_U8(src_sample, volume);
+ *dst = mix8[*dst + src_sample];
+ ++dst;
+ ++src;
+ }
#endif
- }
- break;
+ }
+ break;
- case AUDIO_S8: {
+ case AUDIO_S8:
+ {
#if defined(SDL_BUGGY_MMX_MIXERS) /* buggy, so we're disabling them. --ryan. */
#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
- if (SDL_HasMMX())
- {
- SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
- }
- else
+ if (SDL_HasMMX()) {
+ SDL_MixAudio_MMX_S8((char *) dst, (char *) src,
+ (unsigned int) len, (int) volume);
+ } else
#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
- if (SDL_HasMMX())
- {
- SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
- }
- else
+ if (SDL_HasMMX()) {
+ SDL_MixAudio_MMX_S8_VC((char *) dst, (char *) src,
+ (unsigned int) len, (int) volume);
+ } else
#endif
#endif
-
-#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
- SDL_MixAudio_m68k_S8((char*)dst,(char*)src,(unsigned long)len,(long)volume);
+#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
+ SDL_MixAudio_m68k_S8((char *) dst, (char *) src,
+ (unsigned long) len, (long) volume);
#else
- {
- Sint8 *dst8, *src8;
- Sint8 src_sample;
- int dst_sample;
- const int max_audioval = ((1<<(8-1))-1);
- const int min_audioval = -(1<<(8-1));
+ {
+ Sint8 *dst8, *src8;
+ Sint8 src_sample;
+ int dst_sample;
+ const int max_audioval = ((1 << (8 - 1)) - 1);
+ const int min_audioval = -(1 << (8 - 1));
- src8 = (Sint8 *)src;
- dst8 = (Sint8 *)dst;
- while ( len-- ) {
- src_sample = *src8;
- ADJUST_VOLUME(src_sample, volume);
- dst_sample = *dst8 + src_sample;
- if ( dst_sample > max_audioval ) {
- *dst8 = max_audioval;
- } else
- if ( dst_sample < min_audioval ) {
- *dst8 = min_audioval;
- } else {
- *dst8 = dst_sample;
- }
- ++dst8;
- ++src8;
- }
- }
+ src8 = (Sint8 *) src;
+ dst8 = (Sint8 *) dst;
+ while (len--) {
+ src_sample = *src8;
+ ADJUST_VOLUME(src_sample, volume);
+ dst_sample = *dst8 + src_sample;
+ if (dst_sample > max_audioval) {
+ *dst8 = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ *dst8 = min_audioval;
+ } else {
+ *dst8 = dst_sample;
+ }
+ ++dst8;
+ ++src8;
+ }
+ }
#endif
- }
- break;
+ }
+ break;
- case AUDIO_S16LSB: {
+ case AUDIO_S16LSB:
+ {
#if defined(SDL_BUGGY_MMX_MIXERS) /* buggy, so we're disabling them. --ryan. */
#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
- if (SDL_HasMMX())
- {
- SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
- }
- else
+ if (SDL_HasMMX()) {
+ SDL_MixAudio_MMX_S16((char *) dst, (char *) src,
+ (unsigned int) len, (int) volume);
+ } else
#elif ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
- if (SDL_HasMMX())
- {
- SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
- }
- else
+ if (SDL_HasMMX()) {
+ SDL_MixAudio_MMX_S16_VC((char *) dst, (char *) src,
+ (unsigned int) len, (int) volume);
+ } else
#endif
#endif
-
-#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
- SDL_MixAudio_m68k_S16LSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
+#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
+ SDL_MixAudio_m68k_S16LSB((short *) dst, (short *) src,
+ (unsigned long) len, (long) volume);
#else
- {
- Sint16 src1, src2;
- int dst_sample;
- const int max_audioval = ((1<<(16-1))-1);
- const int min_audioval = -(1<<(16-1));
+ {
+ Sint16 src1, src2;
+ int dst_sample;
+ const int max_audioval = ((1 << (16 - 1)) - 1);
+ const int min_audioval = -(1 << (16 - 1));
- len /= 2;
- while ( len-- ) {
- src1 = ((src[1])<<8|src[0]);
- ADJUST_VOLUME(src1, volume);
- src2 = ((dst[1])<<8|dst[0]);
- src += 2;
- dst_sample = src1+src2;
- if ( dst_sample > max_audioval ) {
- dst_sample = max_audioval;
- } else
- if ( dst_sample < min_audioval ) {
- dst_sample = min_audioval;
- }
- dst[0] = dst_sample&0xFF;
- dst_sample >>= 8;
- dst[1] = dst_sample&0xFF;
- dst += 2;
- }
- }
+ len /= 2;
+ while (len--) {
+ src1 = ((src[1]) << 8 | src[0]);
+ ADJUST_VOLUME(src1, volume);
+ src2 = ((dst[1]) << 8 | dst[0]);
+ src += 2;
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ dst[0] = dst_sample & 0xFF;
+ dst_sample >>= 8;
+ dst[1] = dst_sample & 0xFF;
+ dst += 2;
+ }
+ }
#endif
- }
- break;
+ }
+ break;
- case AUDIO_S16MSB: {
-#if defined(__GNUC__) && defined(__M68000__) && defined(SDL_ASSEMBLY_ROUTINES)
- SDL_MixAudio_m68k_S16MSB((short*)dst,(short*)src,(unsigned long)len,(long)volume);
+ case AUDIO_S16MSB:
+ {
+#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
+ SDL_MixAudio_m68k_S16MSB((short *) dst, (short *) src,
+ (unsigned long) len, (long) volume);
#else
- Sint16 src1, src2;
- int dst_sample;
- const int max_audioval = ((1<<(16-1))-1);
- const int min_audioval = -(1<<(16-1));
+ Sint16 src1, src2;
+ int dst_sample;
+ const int max_audioval = ((1 << (16 - 1)) - 1);
+ const int min_audioval = -(1 << (16 - 1));
- len /= 2;
- while ( len-- ) {
- src1 = ((src[0])<<8|src[1]);
- ADJUST_VOLUME(src1, volume);
- src2 = ((dst[0])<<8|dst[1]);
- src += 2;
- dst_sample = src1+src2;
- if ( dst_sample > max_audioval ) {
- dst_sample = max_audioval;
- } else
- if ( dst_sample < min_audioval ) {
- dst_sample = min_audioval;
- }
- dst[1] = dst_sample&0xFF;
- dst_sample >>= 8;
- dst[0] = dst_sample&0xFF;
- dst += 2;
- }
+ len /= 2;
+ while (len--) {
+ src1 = ((src[0]) << 8 | src[1]);
+ ADJUST_VOLUME(src1, volume);
+ src2 = ((dst[0]) << 8 | dst[1]);
+ src += 2;
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ dst[1] = dst_sample & 0xFF;
+ dst_sample >>= 8;
+ dst[0] = dst_sample & 0xFF;
+ dst += 2;
+ }
#endif
- }
- break;
+ }
+ break;
- default: /* If this happens... FIXME! */
- SDL_SetError("SDL_MixAudio(): unknown audio format");
- return;
- }
+ case AUDIO_S32LSB:
+ {
+ const Uint32 *src32 = (Uint32 *) src;
+ Uint32 *dst32 = (Uint32 *) dst;
+ Sint64 src1, src2;
+ Sint64 dst_sample;
+ const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
+ const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
+
+ len /= 4;
+ while (len--) {
+ src1 = (Sint64) ((Sint32) SDL_SwapLE32(*src32));
+ src32++;
+ ADJUST_VOLUME(src1, volume);
+ src2 = (Sint64) ((Sint32) SDL_SwapLE32(*dst32));
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapLE32((Uint32) ((Sint32) dst_sample));
+ }
+ }
+ break;
+
+ case AUDIO_S32MSB:
+ {
+ const Uint32 *src32 = (Uint32 *) src;
+ Uint32 *dst32 = (Uint32 *) dst;
+ Sint64 src1, src2;
+ Sint64 dst_sample;
+ const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
+ const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
+
+ len /= 4;
+ while (len--) {
+ src1 = (Sint64) ((Sint32) SDL_SwapBE32(*src32));
+ src32++;
+ ADJUST_VOLUME(src1, volume);
+ src2 = (Sint64) ((Sint32) SDL_SwapBE32(*dst32));
+ dst_sample = src1 + src2;
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapBE32((Uint32) ((Sint32) dst_sample));
+ }
+ }
+ break;
+
+ case AUDIO_F32LSB:
+ {
+ const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME);
+ const float fvolume = (float) volume;
+ const float *src32 = (float *) src;
+ float *dst32 = (float *) dst;
+ float src1, src2;
+ double dst_sample;
+ /* !!! FIXME: are these right? */
+ const double max_audioval = 3.402823466e+38F;
+ const double min_audioval = -3.402823466e+38F;
+
+ len /= 4;
+ while (len--) {
+ src1 = ((SDL_SwapFloatLE(*src32) * fvolume) * fmaxvolume);
+ src2 = SDL_SwapFloatLE(*dst32);
+ src32++;
+
+ dst_sample = ((double) src1) + ((double) src2);
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapFloatLE((float) dst_sample);
+ }
+ }
+ break;
+
+ case AUDIO_F32MSB:
+ {
+ const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME);
+ const float fvolume = (float) volume;
+ const float *src32 = (float *) src;
+ float *dst32 = (float *) dst;
+ float src1, src2;
+ double dst_sample;
+ /* !!! FIXME: are these right? */
+ const double max_audioval = 3.402823466e+38F;
+ const double min_audioval = -3.402823466e+38F;
+
+ len /= 4;
+ while (len--) {
+ src1 = ((SDL_SwapFloatBE(*src32) * fvolume) * fmaxvolume);
+ src2 = SDL_SwapFloatBE(*dst32);
+ src32++;
+
+ dst_sample = ((double) src1) + ((double) src2);
+ if (dst_sample > max_audioval) {
+ dst_sample = max_audioval;
+ } else if (dst_sample < min_audioval) {
+ dst_sample = min_audioval;
+ }
+ *(dst32++) = SDL_SwapFloatBE((float) dst_sample);
+ }
+ }
+ break;
+
+ default: /* If this happens... FIXME! */
+ SDL_SetError("SDL_MixAudio(): unknown audio format");
+ return;
+ }
}
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.c b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.c
index 10b1ccb0c..40b880585 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -37,100 +37,50 @@
#if defined(SDL_BUGGY_MMX_MIXERS) /* buggy, so we're disabling them. --ryan. */
#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
-void SDL_MixAudio_MMX_S16(char* dst,char* src,unsigned int size,int volume)
+void
+SDL_MixAudio_MMX_S16(char *dst, char *src, unsigned int size, int volume)
{
- __asm__ __volatile__ (
-
-" movl %3,%%eax\n" /* eax = volume */
-
-" movl %2,%%edx\n" /* edx = size */
-
-" shrl $4,%%edx\n" /* process 16 bytes per iteration = 8 samples */
-
-" jz .endS16\n"
-
-" pxor %%mm0,%%mm0\n"
-
-" movd %%eax,%%mm0\n"
-" movq %%mm0,%%mm1\n"
-" psllq $16,%%mm0\n"
-" por %%mm1,%%mm0\n"
-" psllq $16,%%mm0\n"
-" por %%mm1,%%mm0\n"
-" psllq $16,%%mm0\n"
-" por %%mm1,%%mm0\n" /* mm0 = vol|vol|vol|vol */
-
-".align 8\n"
-" .mixloopS16:\n"
-
-" movq (%1),%%mm1\n" /* mm1 = a|b|c|d */
-
-" movq %%mm1,%%mm2\n" /* mm2 = a|b|c|d */
-
-" movq 8(%1),%%mm4\n" /* mm4 = e|f|g|h */
-
- /* pré charger le buffer dst dans mm7 */
-" movq (%0),%%mm7\n" /* mm7 = dst[0] */
-
- /* multiplier par le volume */
-" pmullw %%mm0,%%mm1\n" /* mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v) */
-
-" pmulhw %%mm0,%%mm2\n" /* mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v) */
-" movq %%mm4,%%mm5\n" /* mm5 = e|f|g|h */
-
-" pmullw %%mm0,%%mm4\n" /* mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v) */
-
-" pmulhw %%mm0,%%mm5\n" /* mm5 = h(e*v)|h(f*v)|h(g*v)|h(h*v) */
-" movq %%mm1,%%mm3\n" /* mm3 = l(a*v)|l(b*v)|l(c*v)|l(d*v) */
-
-" punpckhwd %%mm2,%%mm1\n" /* mm1 = a*v|b*v */
-
-" movq %%mm4,%%mm6\n" /* mm6 = l(e*v)|l(f*v)|l(g*v)|l(h*v) */
-" punpcklwd %%mm2,%%mm3\n" /* mm3 = c*v|d*v */
-
-" punpckhwd %%mm5,%%mm4\n" /* mm4 = e*f|f*v */
-
-" punpcklwd %%mm5,%%mm6\n" /* mm6 = g*v|h*v */
-
- /* pré charger le buffer dst dans mm5 */
-" movq 8(%0),%%mm5\n" /* mm5 = dst[1] */
-
- /* diviser par 128 */
-" psrad $7,%%mm1\n" /* mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME */
-" add $16,%1\n"
-
-" psrad $7,%%mm3\n" /* mm3 = c*v/128|d*v/128 */
-
-" psrad $7,%%mm4\n" /* mm4 = e*v/128|f*v/128 */
-
- /* mm1 = le sample avec le volume modifié */
-" packssdw %%mm1,%%mm3\n" /* mm3 = s(a*v|b*v|c*v|d*v) */
-
-" psrad $7,%%mm6\n" /* mm6= g*v/128|h*v/128 */
-" paddsw %%mm7,%%mm3\n" /* mm3 = adjust_volume(src)+dst */
-
- /* mm4 = le sample avec le volume modifié */
-" packssdw %%mm4,%%mm6\n" /* mm6 = s(e*v|f*v|g*v|h*v) */
-" movq %%mm3,(%0)\n"
-
-" paddsw %%mm5,%%mm6\n" /* mm6 = adjust_volume(src)+dst */
-
-" movq %%mm6,8(%0)\n"
-
-" add $16,%0\n"
-
-" dec %%edx\n"
-
-" jnz .mixloopS16\n"
-
-" emms\n"
-
-".endS16:\n"
- :
- : "r" (dst), "r"(src),"m"(size),
- "m"(volume)
- : "eax","edx","memory"
- );
+ __asm__ __volatile__(" movl %3,%%eax\n" /* eax = volume */
+ " movl %2,%%edx\n" /* edx = size */
+ " shrl $4,%%edx\n" /* process 16 bytes per iteration = 8 samples */
+ " jz .endS16\n" " pxor %%mm0,%%mm0\n" " movd %%eax,%%mm0\n" " movq %%mm0,%%mm1\n" " psllq $16,%%mm0\n" " por %%mm1,%%mm0\n" " psllq $16,%%mm0\n" " por %%mm1,%%mm0\n" " psllq $16,%%mm0\n" " por %%mm1,%%mm0\n" /* mm0 = vol|vol|vol|vol */
+ ".align 8\n" " .mixloopS16:\n" " movq (%1),%%mm1\n" /* mm1 = a|b|c|d */
+ " movq %%mm1,%%mm2\n" /* mm2 = a|b|c|d */
+ " movq 8(%1),%%mm4\n" /* mm4 = e|f|g|h */
+ /* pré charger le buffer dst dans mm7 */
+ " movq (%0),%%mm7\n" /* mm7 = dst[0] */
+ /* multiplier par le volume */
+ " pmullw %%mm0,%%mm1\n" /* mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v) */
+ " pmulhw %%mm0,%%mm2\n" /* mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v) */
+ " movq %%mm4,%%mm5\n" /* mm5 = e|f|g|h */
+ " pmullw %%mm0,%%mm4\n" /* mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v) */
+ " pmulhw %%mm0,%%mm5\n" /* mm5 = h(e*v)|h(f*v)|h(g*v)|h(h*v) */
+ " movq %%mm1,%%mm3\n" /* mm3 = l(a*v)|l(b*v)|l(c*v)|l(d*v) */
+ " punpckhwd %%mm2,%%mm1\n" /* mm1 = a*v|b*v */
+ " movq %%mm4,%%mm6\n" /* mm6 = l(e*v)|l(f*v)|l(g*v)|l(h*v) */
+ " punpcklwd %%mm2,%%mm3\n" /* mm3 = c*v|d*v */
+ " punpckhwd %%mm5,%%mm4\n" /* mm4 = e*f|f*v */
+ " punpcklwd %%mm5,%%mm6\n" /* mm6 = g*v|h*v */
+ /* pré charger le buffer dst dans mm5 */
+ " movq 8(%0),%%mm5\n" /* mm5 = dst[1] */
+ /* diviser par 128 */
+ " psrad $7,%%mm1\n" /* mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME */
+ " add $16,%1\n" " psrad $7,%%mm3\n" /* mm3 = c*v/128|d*v/128 */
+ " psrad $7,%%mm4\n" /* mm4 = e*v/128|f*v/128 */
+ /* mm1 = le sample avec le volume modifié */
+ " packssdw %%mm1,%%mm3\n" /* mm3 = s(a*v|b*v|c*v|d*v) */
+ " psrad $7,%%mm6\n" /* mm6= g*v/128|h*v/128 */
+ " paddsw %%mm7,%%mm3\n" /* mm3 = adjust_volume(src)+dst */
+ /* mm4 = le sample avec le volume modifié */
+ " packssdw %%mm4,%%mm6\n" /* mm6 = s(e*v|f*v|g*v|h*v) */
+ " movq %%mm3,(%0)\n" " paddsw %%mm5,%%mm6\n" /* mm6 = adjust_volume(src)+dst */
+ " movq %%mm6,8(%0)\n"
+ " add $16,%0\n"
+ " dec %%edx\n"
+ " jnz .mixloopS16\n"
+ " emms\n"
+ ".endS16:\n"::"r"(dst), "r"(src),
+ "m"(size), "m"(volume):"eax", "edx", "memory");
}
@@ -139,69 +89,36 @@ void SDL_MixAudio_MMX_S16(char* dst,char* src,unsigned int size,int volume)
/* Mixing for 8 bit signed buffers */
/*////////////////////////////////////////////// */
-void SDL_MixAudio_MMX_S8(char* dst,char* src,unsigned int size,int volume)
+void
+SDL_MixAudio_MMX_S8(char *dst, char *src, unsigned int size, int volume)
{
- __asm__ __volatile__ (
-
-" movl %3,%%eax\n" /* eax = volume */
-
-" movd %%eax,%%mm0\n"
-" movq %%mm0,%%mm1\n"
-" psllq $16,%%mm0\n"
-" por %%mm1,%%mm0\n"
-" psllq $16,%%mm0\n"
-" por %%mm1,%%mm0\n"
-" psllq $16,%%mm0\n"
-" por %%mm1,%%mm0\n"
-
-" movl %2,%%edx\n" /* edx = size */
-" shr $3,%%edx\n" /* process 8 bytes per iteration = 8 samples */
-
-" cmp $0,%%edx\n"
-" je .endS8\n"
-
-".align 8\n"
-" .mixloopS8:\n"
-
-" pxor %%mm2,%%mm2\n" /* mm2 = 0 */
-" movq (%1),%%mm1\n" /* mm1 = a|b|c|d|e|f|g|h */
-
-" movq %%mm1,%%mm3\n" /* mm3 = a|b|c|d|e|f|g|h */
-
- /* on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0 */
-" pcmpgtb %%mm1,%%mm2\n" /* mm2 = 11111111|00000000|00000000.... */
-
-" punpckhbw %%mm2,%%mm1\n" /* mm1 = 0|a|0|b|0|c|0|d */
-
-" punpcklbw %%mm2,%%mm3\n" /* mm3 = 0|e|0|f|0|g|0|h */
-" movq (%0),%%mm2\n" /* mm2 = destination */
-
-" pmullw %%mm0,%%mm1\n" /* mm1 = v*a|v*b|v*c|v*d */
-" add $8,%1\n"
-
-" pmullw %%mm0,%%mm3\n" /* mm3 = v*e|v*f|v*g|v*h */
-" psraw $7,%%mm1\n" /* mm1 = v*a/128|v*b/128|v*c/128|v*d/128 */
-
-" psraw $7,%%mm3\n" /* mm3 = v*e/128|v*f/128|v*g/128|v*h/128 */
-
-" packsswb %%mm1,%%mm3\n" /* mm1 = v*a/128|v*b/128|v*c/128|v*d/128|v*e/128|v*f/128|v*g/128|v*h/128 */
-
-" paddsb %%mm2,%%mm3\n" /* add to destination buffer */
-
-" movq %%mm3,(%0)\n" /* store back to ram */
-" add $8,%0\n"
-
-" dec %%edx\n"
-
-" jnz .mixloopS8\n"
-
-".endS8:\n"
-" emms\n"
- :
- : "r" (dst), "r"(src),"m"(size),
- "m"(volume)
- : "eax","edx","memory"
- );
+ __asm__ __volatile__(" movl %3,%%eax\n" /* eax = volume */
+ " movd %%eax,%%mm0\n" " movq %%mm0,%%mm1\n" " psllq $16,%%mm0\n" " por %%mm1,%%mm0\n" " psllq $16,%%mm0\n" " por %%mm1,%%mm0\n" " psllq $16,%%mm0\n" " por %%mm1,%%mm0\n" " movl %2,%%edx\n" /* edx = size */
+ " shr $3,%%edx\n" /* process 8 bytes per iteration = 8 samples */
+ " cmp $0,%%edx\n" " je .endS8\n" ".align 8\n" " .mixloopS8:\n" " pxor %%mm2,%%mm2\n" /* mm2 = 0 */
+ " movq (%1),%%mm1\n" /* mm1 = a|b|c|d|e|f|g|h */
+ " movq %%mm1,%%mm3\n" /* mm3 = a|b|c|d|e|f|g|h */
+ /* on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0 */
+ " pcmpgtb %%mm1,%%mm2\n" /* mm2 = 11111111|00000000|00000000.... */
+ " punpckhbw %%mm2,%%mm1\n" /* mm1 = 0|a|0|b|0|c|0|d */
+ " punpcklbw %%mm2,%%mm3\n" /* mm3 = 0|e|0|f|0|g|0|h */
+ " movq (%0),%%mm2\n" /* mm2 = destination */
+ " pmullw %%mm0,%%mm1\n" /* mm1 = v*a|v*b|v*c|v*d */
+ " add $8,%1\n" " pmullw %%mm0,%%mm3\n" /* mm3 = v*e|v*f|v*g|v*h */
+ " psraw $7,%%mm1\n" /* mm1 = v*a/128|v*b/128|v*c/128|v*d/128 */
+ " psraw $7,%%mm3\n" /* mm3 = v*e/128|v*f/128|v*g/128|v*h/128 */
+ " packsswb %%mm1,%%mm3\n" /* mm1 = v*a/128|v*b/128|v*c/128|v*d/128|v*e/128|v*f/128|v*g/128|v*h/128 */
+ " paddsb %%mm2,%%mm3\n" /* add to destination buffer */
+ " movq %%mm3,(%0)\n" /* store back to ram */
+ " add $8,%0\n"
+ " dec %%edx\n"
+ " jnz .mixloopS8\n"
+ ".endS8:\n"
+ " emms\n"::"r"(dst), "r"(src), "m"(size),
+ "m"(volume):"eax", "edx", "memory");
}
#endif
-#endif
+
+#endif /* SDL_BUGGY_MMX_MIXERS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.h b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.h
index 836b25959..c45b5731a 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX.h
@@ -10,8 +10,8 @@
#if defined(SDL_BUGGY_MMX_MIXERS) /* buggy, so we're disabling them. --ryan. */
#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
-void SDL_MixAudio_MMX_S16(char* ,char* ,unsigned int ,int );
-void SDL_MixAudio_MMX_S8(char* ,char* ,unsigned int ,int );
+void SDL_MixAudio_MMX_S16(char *, char *, unsigned int, int);
+void SDL_MixAudio_MMX_S8(char *, char *, unsigned int, int);
#endif
-#endif
-
+#endif /* SDL_BUGGY_MMX_MIXERS */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.c b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.c
index e9d53c134..94e710635 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -38,8 +38,10 @@
// Mixing for 16 bit signed buffers
////////////////////////////////////////////////
-void SDL_MixAudio_MMX_S16_VC(char* dst,char* src,unsigned int nSize,int volume)
+void
+SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
{
+ /* *INDENT-OFF* */
__asm
{
@@ -112,15 +114,17 @@ endS16:
pop esi
pop edi
}
-
+ /* *INDENT-ON* */
}
////////////////////////////////////////////////
// Mixing for 8 bit signed buffers
////////////////////////////////////////////////
-void SDL_MixAudio_MMX_S8_VC(char* dst,char* src,unsigned int nSize,int volume)
+void
+SDL_MixAudio_MMX_S8_VC(char *dst, char *src, unsigned int nSize, int volume)
{
+ /* *INDENT-OFF* */
_asm
{
@@ -177,7 +181,10 @@ endS8:
pop esi
pop edi
}
+ /* *INDENT-ON* */
}
#endif /* SDL_ASSEMBLY_ROUTINES */
#endif /* SDL_BUGGY_MMX_MIXERS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.h b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.h
index 7c67a36b5..45f95b617 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_MMX_VC.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,6 @@
*/
#include "SDL_config.h"
-
#if defined(SDL_BUGGY_MMX_MIXERS) /* buggy, so we're disabling them. --ryan. */
#if ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
/* headers for MMX assembler version of SDL_MixAudio
@@ -32,7 +31,9 @@
Assumes buffer size in bytes is a multiple of 16
Assumes SDL_MIX_MAXVOLUME = 128
*/
-void SDL_MixAudio_MMX_S16_VC(char* ,char* ,unsigned int ,int );
-void SDL_MixAudio_MMX_S8_VC(char* ,char* ,unsigned int ,int );
-#endif
+void SDL_MixAudio_MMX_S16_VC(char *, char *, unsigned int, int);
+void SDL_MixAudio_MMX_S8_VC(char *, char *, unsigned int, int);
#endif
+#endif /* SDL_BUGGY_MMX_MIXERS */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.c b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.c
index 477a6bbcf..72f7c96e5 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.c
@@ -1,20 +1,20 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
@@ -27,185 +27,114 @@
Patrice Mandin
*/
-#if defined(__M68000__) && defined(__GNUC__)
-void SDL_MixAudio_m68k_U8(char* dst, char* src, long len, long volume, char* mix8)
+#if defined(__M68000__) && !defined(__mcoldfire__) && defined(__GNUC__)
+void
+SDL_MixAudio_m68k_U8(char *dst, char *src, long len, long volume, char *mix8)
{
- __asm__ __volatile__ (
-
- "tstl %2\n"
-" beqs stoploop_u8\n"
-"mixloop_u8:\n"
-
- /* Mix a sample */
-
-" moveq #0,%%d0\n"
-" moveq #0,%%d1\n"
-
-" moveb %1@+,%%d0\n" /* d0 = *src++ */
-" sub #128,%%d0\n" /* d0 -= 128 */
-" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
-" moveb %0@,%%d1\n" /* d1 = *dst */
-" asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
-" add #128,%%d0\n" /* d0 += 128 */
-
-" add %%d1,%%d0\n"
-
-" moveb %4@(%%d0:w),%0@+\n"
-
- /* Loop till done */
-
-" subql #1,%2\n"
-" bhis mixloop_u8\n"
-"stoploop_u8:\n"
-
- : /* no return value */
- : /* input */
- "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8)
- : /* clobbered registers */
- "d0", "d1", "cc", "memory"
- );
+ __asm__ __volatile__("tstl %2\n" " beqs stoploop_u8\n" "mixloop_u8:\n"
+ /* Mix a sample */
+ " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */
+ " sub #128,%%d0\n" /* d0 -= 128 */
+ " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
+ " moveb %0@,%%d1\n" /* d1 = *dst */
+ " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
+ " add #128,%%d0\n" /* d0 += 128 */
+ " add %%d1,%%d0\n"
+ " moveb %4@(%%d0:w),%0@+\n"
+ /* Loop till done */
+ " subql #1,%2\n" " bhis mixloop_u8\n" "stoploop_u8:\n": /* no return value */
+ : /* input */
+ "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8): /* clobbered registers */
+ "d0", "d1", "cc", "memory");
}
-void SDL_MixAudio_m68k_S8(char* dst, char* src, long len, long volume)
+void
+SDL_MixAudio_m68k_S8(char *dst, char *src, long len, long volume)
{
- __asm__ __volatile__ (
-
- "tstl %2\n"
-" beqs stoploop_s8\n"
-" moveq #-128,%%d2\n"
-" moveq #127,%%d3\n"
-"mixloop_s8:\n"
-
- /* Mix a sample */
-
-" moveq #0,%%d0\n"
-" moveq #0,%%d1\n"
-
-" moveb %1@+,%%d0\n" /* d0 = *src++ */
-" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
-" moveb %0@,%%d1\n" /* d1 = *dst */
-" asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
-
-" add %%d1,%%d0\n"
-
-" cmp %%d2,%%d0\n"
-" bges lower_limit_s8\n"
-" move %%d2,%%d0\n"
-"lower_limit_s8:\n"
-
-" cmp %%d3,%%d0\n"
-" bles upper_limit_s8\n"
-" move %%d3,%%d0\n"
-"upper_limit_s8:\n"
-" moveb %%d0,%0@+\n"
-
- /* Loop till done */
-
-" subql #1,%2\n"
-" bhis mixloop_s8\n"
-"stoploop_s8:\n"
-
- : /* no return value */
- : /* input */
- "a"(dst), "a"(src), "d"(len), "d"(volume)
- : /* clobbered registers */
- "d0", "d1", "d2", "d3", "cc", "memory"
- );
+ __asm__ __volatile__("tstl %2\n"
+ " beqs stoploop_s8\n"
+ " moveq #-128,%%d2\n"
+ " moveq #127,%%d3\n" "mixloop_s8:\n"
+ /* Mix a sample */
+ " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */
+ " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
+ " moveb %0@,%%d1\n" /* d1 = *dst */
+ " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
+ " add %%d1,%%d0\n"
+ " cmp %%d2,%%d0\n"
+ " bges lower_limit_s8\n"
+ " move %%d2,%%d0\n"
+ "lower_limit_s8:\n"
+ " cmp %%d3,%%d0\n"
+ " bles upper_limit_s8\n"
+ " move %%d3,%%d0\n"
+ "upper_limit_s8:\n" " moveb %%d0,%0@+\n"
+ /* Loop till done */
+ " subql #1,%2\n" " bhis mixloop_s8\n" "stoploop_s8:\n": /* no return value */
+ : /* input */
+ "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
+ "d0", "d1", "d2", "d3", "cc", "memory");
}
-void SDL_MixAudio_m68k_S16MSB(short* dst, short* src, long len, long volume)
+void
+SDL_MixAudio_m68k_S16MSB(short *dst, short *src, long len, long volume)
{
- __asm__ __volatile__ (
-
- "tstl %2\n"
-" beqs stoploop_s16msb\n"
-" movel #-32768,%%d2\n"
-" movel #32767,%%d3\n"
-" lsrl #1,%2\n"
-"mixloop_s16msb:\n"
-
- /* Mix a sample */
-
-" move %1@+,%%d0\n" /* d0 = *src++ */
-" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
-" move %0@,%%d1\n" /* d1 = *dst */
-" extl %%d1\n" /* extend d1 to 32 bits */
-" asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
-
-" addl %%d1,%%d0\n"
-
-" cmpl %%d2,%%d0\n"
-" bges lower_limit_s16msb\n"
-" move %%d2,%%d0\n"
-"lower_limit_s16msb:\n"
-
-" cmpl %%d3,%%d0\n"
-" bles upper_limit_s16msb\n"
-" move %%d3,%%d0\n"
-"upper_limit_s16msb:\n"
-" move %%d0,%0@+\n"
-
- /* Loop till done */
-
-" subql #1,%2\n"
-" bhis mixloop_s16msb\n"
-"stoploop_s16msb:\n"
-
- : /* no return value */
- : /* input */
- "a"(dst), "a"(src), "d"(len), "d"(volume)
- : /* clobbered registers */
- "d0", "d1", "d2", "d3", "cc", "memory"
- );
+ __asm__ __volatile__("tstl %2\n"
+ " beqs stoploop_s16msb\n"
+ " movel #-32768,%%d2\n"
+ " movel #32767,%%d3\n"
+ " lsrl #1,%2\n" "mixloop_s16msb:\n"
+ /* Mix a sample */
+ " move %1@+,%%d0\n" /* d0 = *src++ */
+ " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
+ " move %0@,%%d1\n" /* d1 = *dst */
+ " extl %%d1\n" /* extend d1 to 32 bits */
+ " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
+ " addl %%d1,%%d0\n"
+ " cmpl %%d2,%%d0\n"
+ " bges lower_limit_s16msb\n"
+ " move %%d2,%%d0\n"
+ "lower_limit_s16msb:\n"
+ " cmpl %%d3,%%d0\n"
+ " bles upper_limit_s16msb\n"
+ " move %%d3,%%d0\n"
+ "upper_limit_s16msb:\n" " move %%d0,%0@+\n"
+ /* Loop till done */
+ " subql #1,%2\n" " bhis mixloop_s16msb\n" "stoploop_s16msb:\n": /* no return value */
+ : /* input */
+ "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
+ "d0", "d1", "d2", "d3", "cc", "memory");
}
-void SDL_MixAudio_m68k_S16LSB(short* dst, short* src, long len, long volume)
+void
+SDL_MixAudio_m68k_S16LSB(short *dst, short *src, long len, long volume)
{
- __asm__ __volatile__ (
-
- "tstl %2\n"
-" beqs stoploop_s16lsb\n"
-" movel #-32768,%%d2\n"
-" movel #32767,%%d3\n"
-" lsrl #1,%2\n"
-"mixloop_s16lsb:\n"
-
- /* Mix a sample */
-
-" move %1@+,%%d0\n" /* d0 = *src++ */
-" rorw #8,%%d0\n"
-" muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
-" move %0@,%%d1\n" /* d1 = *dst */
-" rorw #8,%%d1\n"
-" extl %%d1\n" /* extend d1 to 32 bits */
-" asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
-
-" addl %%d1,%%d0\n"
-
-" cmpl %%d2,%%d0\n"
-" bges lower_limit_s16lsb\n"
-" move %%d2,%%d0\n"
-"lower_limit_s16lsb:\n"
-
-" cmpl %%d3,%%d0\n"
-" bles upper_limit_s16lsb\n"
-" move %%d3,%%d0\n"
-"upper_limit_s16lsb:\n"
-" rorw #8,%%d0\n"
-" move %%d0,%0@+\n"
-
- /* Loop till done */
-
-" subql #1,%2\n"
-" bhis mixloop_s16lsb\n"
-"stoploop_s16lsb:\n"
-
- : /* no return value */
- : /* input */
- "a"(dst), "a"(src), "d"(len), "d"(volume)
- : /* clobbered registers */
- "d0", "d1", "d2", "d3", "cc", "memory"
- );
+ __asm__ __volatile__("tstl %2\n"
+ " beqs stoploop_s16lsb\n"
+ " movel #-32768,%%d2\n"
+ " movel #32767,%%d3\n"
+ " lsrl #1,%2\n" "mixloop_s16lsb:\n"
+ /* Mix a sample */
+ " move %1@+,%%d0\n" /* d0 = *src++ */
+ " rorw #8,%%d0\n" " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
+ " move %0@,%%d1\n" /* d1 = *dst */
+ " rorw #8,%%d1\n" " extl %%d1\n" /* extend d1 to 32 bits */
+ " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
+ " addl %%d1,%%d0\n"
+ " cmpl %%d2,%%d0\n"
+ " bges lower_limit_s16lsb\n"
+ " move %%d2,%%d0\n"
+ "lower_limit_s16lsb:\n"
+ " cmpl %%d3,%%d0\n"
+ " bles upper_limit_s16lsb\n"
+ " move %%d3,%%d0\n"
+ "upper_limit_s16lsb:\n"
+ " rorw #8,%%d0\n" " move %%d0,%0@+\n"
+ /* Loop till done */
+ " subql #1,%2\n" " bhis mixloop_s16lsb\n" "stoploop_s16lsb:\n": /* no return value */
+ : /* input */
+ "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
+ "d0", "d1", "d2", "d3", "cc", "memory");
}
#endif
-
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.h b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.h
index 12b7f355c..c0b4754c6 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_mixer_m68k.h
@@ -1,20 +1,20 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
@@ -28,9 +28,11 @@
*/
#if defined(__M68000__) && defined(__GNUC__)
-void SDL_MixAudio_m68k_U8(char* dst,char* src, long len, long volume, char* mix8);
-void SDL_MixAudio_m68k_S8(char* dst,char* src, long len, long volume);
+void SDL_MixAudio_m68k_U8(char *dst, char *src, long len, long volume,
+ char *mix8);
+void SDL_MixAudio_m68k_S8(char *dst, char *src, long len, long volume);
-void SDL_MixAudio_m68k_S16MSB(short* dst,short* src, long len, long volume);
-void SDL_MixAudio_m68k_S16LSB(short* dst,short* src, long len, long volume);
+void SDL_MixAudio_m68k_S16MSB(short *dst, short *src, long len, long volume);
+void SDL_MixAudio_m68k_S16LSB(short *dst, short *src, long len, long volume);
#endif
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_sysaudio.h b/alienblaster/project/jni/sdl/src/audio/SDL_sysaudio.h
index 189cb321f..329e417bf 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_sysaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_sysaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is SDL_free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -29,159 +29,101 @@
/* The SDL audio driver */
typedef struct SDL_AudioDevice SDL_AudioDevice;
+#define _THIS SDL_AudioDevice *_this
+
+typedef struct SDL_AudioDriverImpl
+{
+ int (*DetectDevices) (int iscapture);
+ const char *(*GetDeviceName) (int index, int iscapture);
+ int (*OpenDevice) (_THIS, const char *devname, int iscapture);
+ void (*ThreadInit) (_THIS); /* Called by audio thread at start */
+ void (*WaitDevice) (_THIS);
+ void (*PlayDevice) (_THIS);
+ Uint8 *(*GetDeviceBuf) (_THIS);
+ void (*WaitDone) (_THIS);
+ void (*CloseDevice) (_THIS);
+ void (*LockDevice) (_THIS);
+ void (*UnlockDevice) (_THIS);
+ void (*Deinitialize) (void);
+
+ /* Some flags to push duplicate code into the core and reduce #ifdefs. */
+ int ProvidesOwnCallbackThread:1;
+ int SkipMixerLock:1;
+ int HasCaptureSupport:1;
+ int OnlyHasDefaultOutputDevice:1;
+ int OnlyHasDefaultInputDevice:1;
+} SDL_AudioDriverImpl;
+
+
+typedef struct SDL_AudioDriver
+{
+ /* * * */
+ /* The name of this audio driver */
+ const char *name;
+
+ /* * * */
+ /* The description of this audio driver */
+ const char *desc;
+
+ SDL_AudioDriverImpl impl;
+} SDL_AudioDriver;
+
+
+/* Streamer */
+typedef struct
+{
+ Uint8 *buffer;
+ int max_len; /* the maximum length in bytes */
+ int read_pos, write_pos; /* the position of the write and read heads in bytes */
+} SDL_AudioStreamer;
+
/* Define the SDL audio driver structure */
-#define _THIS SDL_AudioDevice *_this
-#ifndef _STATUS
-#define _STATUS SDL_status *status
-#endif
-struct SDL_AudioDevice {
- /* * * */
- /* The name of this audio driver */
- const char *name;
+struct SDL_AudioDevice
+{
+ /* * * */
+ /* Data common to all devices */
- /* * * */
- /* The description of this audio driver */
- const char *desc;
+ /* The current audio specification (shared with audio thread) */
+ SDL_AudioSpec spec;
- /* * * */
- /* Public driver functions */
- int (*OpenAudio)(_THIS, SDL_AudioSpec *spec);
- void (*ThreadInit)(_THIS); /* Called by audio thread at start */
- void (*WaitAudio)(_THIS);
- void (*PlayAudio)(_THIS);
- Uint8 *(*GetAudioBuf)(_THIS);
- void (*WaitDone)(_THIS);
- void (*CloseAudio)(_THIS);
+ /* An audio conversion block for audio format emulation */
+ SDL_AudioCVT convert;
- /* * * */
- /* Lock / Unlock functions added for the Mac port */
- void (*LockAudio)(_THIS);
- void (*UnlockAudio)(_THIS);
+ /* The streamer, if sample rate conversion necessitates it */
+ int use_streamer;
+ SDL_AudioStreamer streamer;
- /* * * */
- /* Data common to all devices */
+ /* Current state flags */
+ int iscapture;
+ int enabled;
+ int paused;
+ int opened;
- /* The current audio specification (shared with audio thread) */
- SDL_AudioSpec spec;
+ /* Fake audio buffer for when the audio hardware is busy */
+ Uint8 *fake_stream;
- /* An audio conversion block for audio format emulation */
- SDL_AudioCVT convert;
+ /* A semaphore for locking the mixing buffers */
+ SDL_mutex *mixer_lock;
- /* Current state flags */
- int enabled;
- int paused;
- int opened;
+ /* A thread to feed the audio device */
+ SDL_Thread *thread;
+ SDL_threadID threadid;
- /* Fake audio buffer for when the audio hardware is busy */
- Uint8 *fake_stream;
-
- /* A semaphore for locking the mixing buffers */
- SDL_mutex *mixer_lock;
-
- /* A thread to feed the audio device */
- SDL_Thread *thread;
- Uint32 threadid;
-
- /* * * */
- /* Data private to this driver */
- struct SDL_PrivateAudioData *hidden;
-
- /* * * */
- /* The function used to dispose of this structure */
- void (*free)(_THIS);
+ /* * * */
+ /* Data private to this driver */
+ struct SDL_PrivateAudioData *hidden;
};
#undef _THIS
-typedef struct AudioBootStrap {
- const char *name;
- const char *desc;
- int (*available)(void);
- SDL_AudioDevice *(*create)(int devindex);
+typedef struct AudioBootStrap
+{
+ const char *name;
+ const char *desc;
+ int (*init) (SDL_AudioDriverImpl * impl);
+ int demand_only:1; /* 1==request explicitly, or it won't be available. */
} AudioBootStrap;
-#if SDL_AUDIO_DRIVER_BSD
-extern AudioBootStrap BSD_AUDIO_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_PULSE
-extern AudioBootStrap PULSE_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_ALSA
-extern AudioBootStrap ALSA_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_OSS
-extern AudioBootStrap DSP_bootstrap;
-extern AudioBootStrap DMA_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_QNXNTO
-extern AudioBootStrap QNXNTOAUDIO_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_SUNAUDIO
-extern AudioBootStrap SUNAUDIO_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_DMEDIA
-extern AudioBootStrap DMEDIA_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_ARTS
-extern AudioBootStrap ARTS_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_ESD
-extern AudioBootStrap ESD_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_NAS
-extern AudioBootStrap NAS_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_DSOUND
-extern AudioBootStrap DSOUND_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_WAVEOUT
-extern AudioBootStrap WAVEOUT_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_PAUD
-extern AudioBootStrap Paud_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_BAUDIO
-extern AudioBootStrap BAUDIO_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_COREAUDIO
-extern AudioBootStrap COREAUDIO_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_SNDMGR
-extern AudioBootStrap SNDMGR_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_MINT
-extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
-extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
-extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
-extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
-extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_DISK
-extern AudioBootStrap DISKAUD_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_DUMMY
-extern AudioBootStrap DUMMYAUD_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_DC
-extern AudioBootStrap DCAUD_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_NDS
-extern AudioBootStrap NDSAUD_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_MMEAUDIO
-extern AudioBootStrap MMEAUDIO_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_DART
-extern AudioBootStrap DART_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_EPOCAUDIO
-extern AudioBootStrap EPOCAudio_bootstrap;
-#endif
-#if SDL_AUDIO_DRIVER_ANDROID
-extern AudioBootStrap ANDROIDAUD_bootstrap;
-#endif
-
-/* This is the current audio device */
-extern SDL_AudioDevice *current_audio;
-
#endif /* _SDL_sysaudio_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_wave.c b/alienblaster/project/jni/sdl/src/audio/SDL_wave.c
index a2f11641c..d770e6ff4 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_wave.c
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_wave.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -27,574 +27,610 @@
#include "SDL_wave.h"
-static int ReadChunk(SDL_RWops *src, Chunk *chunk);
+static int ReadChunk(SDL_RWops * src, Chunk * chunk);
-struct MS_ADPCM_decodestate {
- Uint8 hPredictor;
- Uint16 iDelta;
- Sint16 iSamp1;
- Sint16 iSamp2;
+struct MS_ADPCM_decodestate
+{
+ Uint8 hPredictor;
+ Uint16 iDelta;
+ Sint16 iSamp1;
+ Sint16 iSamp2;
};
-static struct MS_ADPCM_decoder {
- WaveFMT wavefmt;
- Uint16 wSamplesPerBlock;
- Uint16 wNumCoef;
- Sint16 aCoeff[7][2];
- /* * * */
- struct MS_ADPCM_decodestate state[2];
+static struct MS_ADPCM_decoder
+{
+ WaveFMT wavefmt;
+ Uint16 wSamplesPerBlock;
+ Uint16 wNumCoef;
+ Sint16 aCoeff[7][2];
+ /* * * */
+ struct MS_ADPCM_decodestate state[2];
} MS_ADPCM_state;
-static int InitMS_ADPCM(WaveFMT *format)
+static int
+InitMS_ADPCM(WaveFMT * format)
{
- Uint8 *rogue_feel;
- Uint16 extra_info;
- int i;
+ Uint8 *rogue_feel;
+ Uint16 extra_info;
+ int i;
- /* Set the rogue pointer to the MS_ADPCM specific data */
- MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
- MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
- MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
- MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
- MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
- MS_ADPCM_state.wavefmt.bitspersample =
- SDL_SwapLE16(format->bitspersample);
- rogue_feel = (Uint8 *)format+sizeof(*format);
- if ( sizeof(*format) == 16 ) {
- extra_info = ((rogue_feel[1]<<8)|rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- }
- MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- MS_ADPCM_state.wNumCoef = ((rogue_feel[1]<<8)|rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- if ( MS_ADPCM_state.wNumCoef != 7 ) {
- SDL_SetError("Unknown set of MS_ADPCM coefficients");
- return(-1);
- }
- for ( i=0; iencoding);
+ MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
+ MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
+ MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
+ MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
+ MS_ADPCM_state.wavefmt.bitspersample =
+ SDL_SwapLE16(format->bitspersample);
+ rogue_feel = (Uint8 *) format + sizeof(*format);
+ if (sizeof(*format) == 16) {
+ extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ }
+ MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ MS_ADPCM_state.wNumCoef = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ if (MS_ADPCM_state.wNumCoef != 7) {
+ SDL_SetError("Unknown set of MS_ADPCM coefficients");
+ return (-1);
+ }
+ for (i = 0; i < MS_ADPCM_state.wNumCoef; ++i) {
+ MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ }
+ return (0);
}
-static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
- Uint8 nybble, Sint16 *coeff)
+static Sint32
+MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
+ Uint8 nybble, Sint16 * coeff)
{
- const Sint32 max_audioval = ((1<<(16-1))-1);
- const Sint32 min_audioval = -(1<<(16-1));
- const Sint32 adaptive[] = {
- 230, 230, 230, 230, 307, 409, 512, 614,
- 768, 614, 512, 409, 307, 230, 230, 230
- };
- Sint32 new_sample, delta;
+ const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
+ const Sint32 min_audioval = -(1 << (16 - 1));
+ const Sint32 adaptive[] = {
+ 230, 230, 230, 230, 307, 409, 512, 614,
+ 768, 614, 512, 409, 307, 230, 230, 230
+ };
+ Sint32 new_sample, delta;
- new_sample = ((state->iSamp1 * coeff[0]) +
- (state->iSamp2 * coeff[1]))/256;
- if ( nybble & 0x08 ) {
- new_sample += state->iDelta * (nybble-0x10);
- } else {
- new_sample += state->iDelta * nybble;
- }
- if ( new_sample < min_audioval ) {
- new_sample = min_audioval;
- } else
- if ( new_sample > max_audioval ) {
- new_sample = max_audioval;
- }
- delta = ((Sint32)state->iDelta * adaptive[nybble])/256;
- if ( delta < 16 ) {
- delta = 16;
- }
- state->iDelta = (Uint16)delta;
- state->iSamp2 = state->iSamp1;
- state->iSamp1 = (Sint16)new_sample;
- return(new_sample);
+ new_sample = ((state->iSamp1 * coeff[0]) +
+ (state->iSamp2 * coeff[1])) / 256;
+ if (nybble & 0x08) {
+ new_sample += state->iDelta * (nybble - 0x10);
+ } else {
+ new_sample += state->iDelta * nybble;
+ }
+ if (new_sample < min_audioval) {
+ new_sample = min_audioval;
+ } else if (new_sample > max_audioval) {
+ new_sample = max_audioval;
+ }
+ delta = ((Sint32) state->iDelta * adaptive[nybble]) / 256;
+ if (delta < 16) {
+ delta = 16;
+ }
+ state->iDelta = (Uint16) delta;
+ state->iSamp2 = state->iSamp1;
+ state->iSamp1 = (Sint16) new_sample;
+ return (new_sample);
}
-static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+static int
+MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
{
- struct MS_ADPCM_decodestate *state[2];
- Uint8 *freeable, *encoded, *decoded;
- Sint32 encoded_len, samplesleft;
- Sint8 nybble, stereo;
- Sint16 *coeff[2];
- Sint32 new_sample;
+ struct MS_ADPCM_decodestate *state[2];
+ Uint8 *freeable, *encoded, *decoded;
+ Sint32 encoded_len, samplesleft;
+ Sint8 nybble, stereo;
+ Sint16 *coeff[2];
+ Sint32 new_sample;
- /* Allocate the proper sized output buffer */
- encoded_len = *audio_len;
- encoded = *audio_buf;
- freeable = *audio_buf;
- *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) *
- MS_ADPCM_state.wSamplesPerBlock*
- MS_ADPCM_state.wavefmt.channels*sizeof(Sint16);
- *audio_buf = (Uint8 *)SDL_malloc(*audio_len);
- if ( *audio_buf == NULL ) {
- SDL_Error(SDL_ENOMEM);
- return(-1);
- }
- decoded = *audio_buf;
+ /* Allocate the proper sized output buffer */
+ encoded_len = *audio_len;
+ encoded = *audio_buf;
+ freeable = *audio_buf;
+ *audio_len = (encoded_len / MS_ADPCM_state.wavefmt.blockalign) *
+ MS_ADPCM_state.wSamplesPerBlock *
+ MS_ADPCM_state.wavefmt.channels * sizeof(Sint16);
+ *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
+ if (*audio_buf == NULL) {
+ SDL_Error(SDL_ENOMEM);
+ return (-1);
+ }
+ decoded = *audio_buf;
- /* Get ready... Go! */
- stereo = (MS_ADPCM_state.wavefmt.channels == 2);
- state[0] = &MS_ADPCM_state.state[0];
- state[1] = &MS_ADPCM_state.state[stereo];
- while ( encoded_len >= MS_ADPCM_state.wavefmt.blockalign ) {
- /* Grab the initial information for this block */
- state[0]->hPredictor = *encoded++;
- if ( stereo ) {
- state[1]->hPredictor = *encoded++;
- }
- state[0]->iDelta = ((encoded[1]<<8)|encoded[0]);
- encoded += sizeof(Sint16);
- if ( stereo ) {
- state[1]->iDelta = ((encoded[1]<<8)|encoded[0]);
- encoded += sizeof(Sint16);
- }
- state[0]->iSamp1 = ((encoded[1]<<8)|encoded[0]);
- encoded += sizeof(Sint16);
- if ( stereo ) {
- state[1]->iSamp1 = ((encoded[1]<<8)|encoded[0]);
- encoded += sizeof(Sint16);
- }
- state[0]->iSamp2 = ((encoded[1]<<8)|encoded[0]);
- encoded += sizeof(Sint16);
- if ( stereo ) {
- state[1]->iSamp2 = ((encoded[1]<<8)|encoded[0]);
- encoded += sizeof(Sint16);
- }
- coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor];
- coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor];
+ /* Get ready... Go! */
+ stereo = (MS_ADPCM_state.wavefmt.channels == 2);
+ state[0] = &MS_ADPCM_state.state[0];
+ state[1] = &MS_ADPCM_state.state[stereo];
+ while (encoded_len >= MS_ADPCM_state.wavefmt.blockalign) {
+ /* Grab the initial information for this block */
+ state[0]->hPredictor = *encoded++;
+ if (stereo) {
+ state[1]->hPredictor = *encoded++;
+ }
+ state[0]->iDelta = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ if (stereo) {
+ state[1]->iDelta = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ }
+ state[0]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ if (stereo) {
+ state[1]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ }
+ state[0]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ if (stereo) {
+ state[1]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
+ encoded += sizeof(Sint16);
+ }
+ coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor];
+ coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor];
- /* Store the two initial samples we start with */
- decoded[0] = state[0]->iSamp2&0xFF;
- decoded[1] = state[0]->iSamp2>>8;
- decoded += 2;
- if ( stereo ) {
- decoded[0] = state[1]->iSamp2&0xFF;
- decoded[1] = state[1]->iSamp2>>8;
- decoded += 2;
- }
- decoded[0] = state[0]->iSamp1&0xFF;
- decoded[1] = state[0]->iSamp1>>8;
- decoded += 2;
- if ( stereo ) {
- decoded[0] = state[1]->iSamp1&0xFF;
- decoded[1] = state[1]->iSamp1>>8;
- decoded += 2;
- }
+ /* Store the two initial samples we start with */
+ decoded[0] = state[0]->iSamp2 & 0xFF;
+ decoded[1] = state[0]->iSamp2 >> 8;
+ decoded += 2;
+ if (stereo) {
+ decoded[0] = state[1]->iSamp2 & 0xFF;
+ decoded[1] = state[1]->iSamp2 >> 8;
+ decoded += 2;
+ }
+ decoded[0] = state[0]->iSamp1 & 0xFF;
+ decoded[1] = state[0]->iSamp1 >> 8;
+ decoded += 2;
+ if (stereo) {
+ decoded[0] = state[1]->iSamp1 & 0xFF;
+ decoded[1] = state[1]->iSamp1 >> 8;
+ decoded += 2;
+ }
- /* Decode and store the other samples in this block */
- samplesleft = (MS_ADPCM_state.wSamplesPerBlock-2)*
- MS_ADPCM_state.wavefmt.channels;
- while ( samplesleft > 0 ) {
- nybble = (*encoded)>>4;
- new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]);
- decoded[0] = new_sample&0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample&0xFF;
- decoded += 2;
+ /* Decode and store the other samples in this block */
+ samplesleft = (MS_ADPCM_state.wSamplesPerBlock - 2) *
+ MS_ADPCM_state.wavefmt.channels;
+ while (samplesleft > 0) {
+ nybble = (*encoded) >> 4;
+ new_sample = MS_ADPCM_nibble(state[0], nybble, coeff[0]);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2;
- nybble = (*encoded)&0x0F;
- new_sample = MS_ADPCM_nibble(state[1],nybble,coeff[1]);
- decoded[0] = new_sample&0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample&0xFF;
- decoded += 2;
+ nybble = (*encoded) & 0x0F;
+ new_sample = MS_ADPCM_nibble(state[1], nybble, coeff[1]);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2;
- ++encoded;
- samplesleft -= 2;
- }
- encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
- }
- SDL_free(freeable);
- return(0);
+ ++encoded;
+ samplesleft -= 2;
+ }
+ encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
+ }
+ SDL_free(freeable);
+ return (0);
}
-struct IMA_ADPCM_decodestate {
- Sint32 sample;
- Sint8 index;
+struct IMA_ADPCM_decodestate
+{
+ Sint32 sample;
+ Sint8 index;
};
-static struct IMA_ADPCM_decoder {
- WaveFMT wavefmt;
- Uint16 wSamplesPerBlock;
- /* * * */
- struct IMA_ADPCM_decodestate state[2];
+static struct IMA_ADPCM_decoder
+{
+ WaveFMT wavefmt;
+ Uint16 wSamplesPerBlock;
+ /* * * */
+ struct IMA_ADPCM_decodestate state[2];
} IMA_ADPCM_state;
-static int InitIMA_ADPCM(WaveFMT *format)
+static int
+InitIMA_ADPCM(WaveFMT * format)
{
- Uint8 *rogue_feel;
- Uint16 extra_info;
+ Uint8 *rogue_feel;
+ Uint16 extra_info;
- /* Set the rogue pointer to the IMA_ADPCM specific data */
- IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
- IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
- IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
- IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
- IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
- IMA_ADPCM_state.wavefmt.bitspersample =
- SDL_SwapLE16(format->bitspersample);
- rogue_feel = (Uint8 *)format+sizeof(*format);
- if ( sizeof(*format) == 16 ) {
- extra_info = ((rogue_feel[1]<<8)|rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- }
- IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]);
- return(0);
+ /* Set the rogue pointer to the IMA_ADPCM specific data */
+ IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
+ IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
+ IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
+ IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
+ IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
+ IMA_ADPCM_state.wavefmt.bitspersample =
+ SDL_SwapLE16(format->bitspersample);
+ rogue_feel = (Uint8 *) format + sizeof(*format);
+ if (sizeof(*format) == 16) {
+ extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ }
+ IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
+ return (0);
}
-static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble)
+static Sint32
+IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble)
{
- const Sint32 max_audioval = ((1<<(16-1))-1);
- const Sint32 min_audioval = -(1<<(16-1));
- const int index_table[16] = {
- -1, -1, -1, -1,
- 2, 4, 6, 8,
- -1, -1, -1, -1,
- 2, 4, 6, 8
- };
- const Sint32 step_table[89] = {
- 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31,
- 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130,
- 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408,
- 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282,
- 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327,
- 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630,
- 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350,
- 22385, 24623, 27086, 29794, 32767
- };
- Sint32 delta, step;
+ const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
+ const Sint32 min_audioval = -(1 << (16 - 1));
+ const int index_table[16] = {
+ -1, -1, -1, -1,
+ 2, 4, 6, 8,
+ -1, -1, -1, -1,
+ 2, 4, 6, 8
+ };
+ const Sint32 step_table[89] = {
+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31,
+ 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130,
+ 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408,
+ 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282,
+ 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327,
+ 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630,
+ 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350,
+ 22385, 24623, 27086, 29794, 32767
+ };
+ Sint32 delta, step;
- /* Compute difference and new sample value */
- step = step_table[state->index];
- delta = step >> 3;
- if ( nybble & 0x04 ) delta += step;
- if ( nybble & 0x02 ) delta += (step >> 1);
- if ( nybble & 0x01 ) delta += (step >> 2);
- if ( nybble & 0x08 ) delta = -delta;
- state->sample += delta;
+ /* Compute difference and new sample value */
+ step = step_table[state->index];
+ delta = step >> 3;
+ if (nybble & 0x04)
+ delta += step;
+ if (nybble & 0x02)
+ delta += (step >> 1);
+ if (nybble & 0x01)
+ delta += (step >> 2);
+ if (nybble & 0x08)
+ delta = -delta;
+ state->sample += delta;
- /* Update index value */
- state->index += index_table[nybble];
- if ( state->index > 88 ) {
- state->index = 88;
- } else
- if ( state->index < 0 ) {
- state->index = 0;
- }
+ /* Update index value */
+ state->index += index_table[nybble];
+ if (state->index > 88) {
+ state->index = 88;
+ } else if (state->index < 0) {
+ state->index = 0;
+ }
- /* Clamp output sample */
- if ( state->sample > max_audioval ) {
- state->sample = max_audioval;
- } else
- if ( state->sample < min_audioval ) {
- state->sample = min_audioval;
- }
- return(state->sample);
+ /* Clamp output sample */
+ if (state->sample > max_audioval) {
+ state->sample = max_audioval;
+ } else if (state->sample < min_audioval) {
+ state->sample = min_audioval;
+ }
+ return (state->sample);
}
/* Fill the decode buffer with a channel block of data (8 samples) */
-static void Fill_IMA_ADPCM_block(Uint8 *decoded, Uint8 *encoded,
- int channel, int numchannels, struct IMA_ADPCM_decodestate *state)
+static void
+Fill_IMA_ADPCM_block(Uint8 * decoded, Uint8 * encoded,
+ int channel, int numchannels,
+ struct IMA_ADPCM_decodestate *state)
{
- int i;
- Sint8 nybble;
- Sint32 new_sample;
+ int i;
+ Sint8 nybble;
+ Sint32 new_sample;
- decoded += (channel * 2);
- for ( i=0; i<4; ++i ) {
- nybble = (*encoded)&0x0F;
- new_sample = IMA_ADPCM_nibble(state, nybble);
- decoded[0] = new_sample&0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample&0xFF;
- decoded += 2 * numchannels;
+ decoded += (channel * 2);
+ for (i = 0; i < 4; ++i) {
+ nybble = (*encoded) & 0x0F;
+ new_sample = IMA_ADPCM_nibble(state, nybble);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2 * numchannels;
- nybble = (*encoded)>>4;
- new_sample = IMA_ADPCM_nibble(state, nybble);
- decoded[0] = new_sample&0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample&0xFF;
- decoded += 2 * numchannels;
+ nybble = (*encoded) >> 4;
+ new_sample = IMA_ADPCM_nibble(state, nybble);
+ decoded[0] = new_sample & 0xFF;
+ new_sample >>= 8;
+ decoded[1] = new_sample & 0xFF;
+ decoded += 2 * numchannels;
- ++encoded;
- }
+ ++encoded;
+ }
}
-static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+static int
+IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
{
- struct IMA_ADPCM_decodestate *state;
- Uint8 *freeable, *encoded, *decoded;
- Sint32 encoded_len, samplesleft;
- unsigned int c, channels;
+ struct IMA_ADPCM_decodestate *state;
+ Uint8 *freeable, *encoded, *decoded;
+ Sint32 encoded_len, samplesleft;
+ unsigned int c, channels;
- /* Check to make sure we have enough variables in the state array */
- channels = IMA_ADPCM_state.wavefmt.channels;
- if ( channels > SDL_arraysize(IMA_ADPCM_state.state) ) {
- SDL_SetError("IMA ADPCM decoder can only handle %d channels",
- SDL_arraysize(IMA_ADPCM_state.state));
- return(-1);
- }
- state = IMA_ADPCM_state.state;
+ /* Check to make sure we have enough variables in the state array */
+ channels = IMA_ADPCM_state.wavefmt.channels;
+ if (channels > SDL_arraysize(IMA_ADPCM_state.state)) {
+ SDL_SetError("IMA ADPCM decoder can only handle %d channels",
+ SDL_arraysize(IMA_ADPCM_state.state));
+ return (-1);
+ }
+ state = IMA_ADPCM_state.state;
- /* Allocate the proper sized output buffer */
- encoded_len = *audio_len;
- encoded = *audio_buf;
- freeable = *audio_buf;
- *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) *
- IMA_ADPCM_state.wSamplesPerBlock*
- IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16);
- *audio_buf = (Uint8 *)SDL_malloc(*audio_len);
- if ( *audio_buf == NULL ) {
- SDL_Error(SDL_ENOMEM);
- return(-1);
- }
- decoded = *audio_buf;
+ /* Allocate the proper sized output buffer */
+ encoded_len = *audio_len;
+ encoded = *audio_buf;
+ freeable = *audio_buf;
+ *audio_len = (encoded_len / IMA_ADPCM_state.wavefmt.blockalign) *
+ IMA_ADPCM_state.wSamplesPerBlock *
+ IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16);
+ *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
+ if (*audio_buf == NULL) {
+ SDL_Error(SDL_ENOMEM);
+ return (-1);
+ }
+ decoded = *audio_buf;
- /* Get ready... Go! */
- while ( encoded_len >= IMA_ADPCM_state.wavefmt.blockalign ) {
- /* Grab the initial information for this block */
- for ( c=0; c= IMA_ADPCM_state.wavefmt.blockalign) {
+ /* Grab the initial information for this block */
+ for (c = 0; c < channels; ++c) {
+ /* Fill the state information for this block */
+ state[c].sample = ((encoded[1] << 8) | encoded[0]);
+ encoded += 2;
+ if (state[c].sample & 0x8000) {
+ state[c].sample -= 0x10000;
+ }
+ state[c].index = *encoded++;
+ /* Reserved byte in buffer header, should be 0 */
+ if (*encoded++ != 0) {
+ /* Uh oh, corrupt data? Buggy code? */ ;
+ }
- /* Store the initial sample we start with */
- decoded[0] = (Uint8)(state[c].sample&0xFF);
- decoded[1] = (Uint8)(state[c].sample>>8);
- decoded += 2;
- }
+ /* Store the initial sample we start with */
+ decoded[0] = (Uint8) (state[c].sample & 0xFF);
+ decoded[1] = (Uint8) (state[c].sample >> 8);
+ decoded += 2;
+ }
- /* Decode and store the other samples in this block */
- samplesleft = (IMA_ADPCM_state.wSamplesPerBlock-1)*channels;
- while ( samplesleft > 0 ) {
- for ( c=0; c 0) {
+ for (c = 0; c < channels; ++c) {
+ Fill_IMA_ADPCM_block(decoded, encoded,
+ c, channels, &state[c]);
+ encoded += 4;
+ samplesleft -= 8;
+ }
+ decoded += (channels * 8 * 2);
+ }
+ encoded_len -= IMA_ADPCM_state.wavefmt.blockalign;
+ }
+ SDL_free(freeable);
+ return (0);
}
-SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
- SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
+SDL_AudioSpec *
+SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
+ SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len)
{
- int was_error;
- Chunk chunk;
- int lenread;
- int MS_ADPCM_encoded, IMA_ADPCM_encoded;
- int samplesize;
+ int was_error;
+ Chunk chunk;
+ int lenread;
+ int IEEE_float_encoded, MS_ADPCM_encoded, IMA_ADPCM_encoded;
+ int samplesize;
- /* WAV magic header */
- Uint32 RIFFchunk;
- Uint32 wavelen = 0;
- Uint32 WAVEmagic;
- Uint32 headerDiff = 0;
+ /* WAV magic header */
+ Uint32 RIFFchunk;
+ Uint32 wavelen = 0;
+ Uint32 WAVEmagic;
+ Uint32 headerDiff = 0;
- /* FMT chunk */
- WaveFMT *format = NULL;
+ /* FMT chunk */
+ WaveFMT *format = NULL;
- /* Make sure we are passed a valid data source */
- was_error = 0;
- if ( src == NULL ) {
- was_error = 1;
- goto done;
- }
-
- /* Check the magic header */
- RIFFchunk = SDL_ReadLE32(src);
- wavelen = SDL_ReadLE32(src);
- if ( wavelen == WAVE ) { /* The RIFFchunk has already been read */
- WAVEmagic = wavelen;
- wavelen = RIFFchunk;
- RIFFchunk = RIFF;
- } else {
- WAVEmagic = SDL_ReadLE32(src);
- }
- if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) {
- SDL_SetError("Unrecognized file type (not WAVE)");
- was_error = 1;
- goto done;
- }
- headerDiff += sizeof(Uint32); /* for WAVE */
+ /* Make sure we are passed a valid data source */
+ was_error = 0;
+ if (src == NULL) {
+ was_error = 1;
+ goto done;
+ }
- /* Read the audio data format chunk */
- chunk.data = NULL;
- do {
- if ( chunk.data != NULL ) {
- SDL_free(chunk.data);
- chunk.data = NULL;
- }
- lenread = ReadChunk(src, &chunk);
- if ( lenread < 0 ) {
- was_error = 1;
- goto done;
- }
- /* 2 Uint32's for chunk header+len, plus the lenread */
- headerDiff += lenread + 2 * sizeof(Uint32);
- } while ( (chunk.magic == FACT) || (chunk.magic == LIST) );
+ /* Check the magic header */
+ RIFFchunk = SDL_ReadLE32(src);
+ wavelen = SDL_ReadLE32(src);
+ if (wavelen == WAVE) { /* The RIFFchunk has already been read */
+ WAVEmagic = wavelen;
+ wavelen = RIFFchunk;
+ RIFFchunk = RIFF;
+ } else {
+ WAVEmagic = SDL_ReadLE32(src);
+ }
+ if ((RIFFchunk != RIFF) || (WAVEmagic != WAVE)) {
+ SDL_SetError("Unrecognized file type (not WAVE)");
+ was_error = 1;
+ goto done;
+ }
+ headerDiff += sizeof(Uint32); /* for WAVE */
- /* Decode the audio data format */
- format = (WaveFMT *)chunk.data;
- if ( chunk.magic != FMT ) {
- SDL_SetError("Complex WAVE files not supported");
- was_error = 1;
- goto done;
- }
- MS_ADPCM_encoded = IMA_ADPCM_encoded = 0;
- switch (SDL_SwapLE16(format->encoding)) {
- case PCM_CODE:
- /* We can understand this */
- break;
- case MS_ADPCM_CODE:
- /* Try to understand this */
- if ( InitMS_ADPCM(format) < 0 ) {
- was_error = 1;
- goto done;
- }
- MS_ADPCM_encoded = 1;
- break;
- case IMA_ADPCM_CODE:
- /* Try to understand this */
- if ( InitIMA_ADPCM(format) < 0 ) {
- was_error = 1;
- goto done;
- }
- IMA_ADPCM_encoded = 1;
- break;
- case MP3_CODE:
- SDL_SetError("MPEG Layer 3 data not supported",
- SDL_SwapLE16(format->encoding));
- was_error = 1;
- goto done;
- default:
- SDL_SetError("Unknown WAVE data format: 0x%.4x",
- SDL_SwapLE16(format->encoding));
- was_error = 1;
- goto done;
- }
- SDL_memset(spec, 0, (sizeof *spec));
- spec->freq = SDL_SwapLE32(format->frequency);
- switch (SDL_SwapLE16(format->bitspersample)) {
- case 4:
- if ( MS_ADPCM_encoded || IMA_ADPCM_encoded ) {
- spec->format = AUDIO_S16;
- } else {
- was_error = 1;
- }
- break;
- case 8:
- spec->format = AUDIO_U8;
- break;
- case 16:
- spec->format = AUDIO_S16;
- break;
- default:
- was_error = 1;
- break;
- }
- if ( was_error ) {
- SDL_SetError("Unknown %d-bit PCM data format",
- SDL_SwapLE16(format->bitspersample));
- goto done;
- }
- spec->channels = (Uint8)SDL_SwapLE16(format->channels);
- spec->samples = 4096; /* Good default buffer size */
+ /* Read the audio data format chunk */
+ chunk.data = NULL;
+ do {
+ if (chunk.data != NULL) {
+ SDL_free(chunk.data);
+ chunk.data = NULL;
+ }
+ lenread = ReadChunk(src, &chunk);
+ if (lenread < 0) {
+ was_error = 1;
+ goto done;
+ }
+ /* 2 Uint32's for chunk header+len, plus the lenread */
+ headerDiff += lenread + 2 * sizeof(Uint32);
+ } while ((chunk.magic == FACT) || (chunk.magic == LIST));
- /* Read the audio data chunk */
- *audio_buf = NULL;
- do {
- if ( *audio_buf != NULL ) {
- SDL_free(*audio_buf);
- *audio_buf = NULL;
- }
- lenread = ReadChunk(src, &chunk);
- if ( lenread < 0 ) {
- was_error = 1;
- goto done;
- }
- *audio_len = lenread;
- *audio_buf = chunk.data;
- if(chunk.magic != DATA) headerDiff += lenread + 2 * sizeof(Uint32);
- } while ( chunk.magic != DATA );
- headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */
+ /* Decode the audio data format */
+ format = (WaveFMT *) chunk.data;
+ if (chunk.magic != FMT) {
+ SDL_SetError("Complex WAVE files not supported");
+ was_error = 1;
+ goto done;
+ }
+ IEEE_float_encoded = MS_ADPCM_encoded = IMA_ADPCM_encoded = 0;
+ switch (SDL_SwapLE16(format->encoding)) {
+ case PCM_CODE:
+ /* We can understand this */
+ break;
+ case IEEE_FLOAT_CODE:
+ IEEE_float_encoded = 1;
+ /* We can understand this */
+ break;
+ case MS_ADPCM_CODE:
+ /* Try to understand this */
+ if (InitMS_ADPCM(format) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ MS_ADPCM_encoded = 1;
+ break;
+ case IMA_ADPCM_CODE:
+ /* Try to understand this */
+ if (InitIMA_ADPCM(format) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ IMA_ADPCM_encoded = 1;
+ break;
+ case MP3_CODE:
+ SDL_SetError("MPEG Layer 3 data not supported",
+ SDL_SwapLE16(format->encoding));
+ was_error = 1;
+ goto done;
+ default:
+ SDL_SetError("Unknown WAVE data format: 0x%.4x",
+ SDL_SwapLE16(format->encoding));
+ was_error = 1;
+ goto done;
+ }
+ SDL_memset(spec, 0, (sizeof *spec));
+ spec->freq = SDL_SwapLE32(format->frequency);
- if ( MS_ADPCM_encoded ) {
- if ( MS_ADPCM_decode(audio_buf, audio_len) < 0 ) {
- was_error = 1;
- goto done;
- }
- }
- if ( IMA_ADPCM_encoded ) {
- if ( IMA_ADPCM_decode(audio_buf, audio_len) < 0 ) {
- was_error = 1;
- goto done;
- }
- }
+ if (IEEE_float_encoded) {
+ if ((SDL_SwapLE16(format->bitspersample)) != 32) {
+ was_error = 1;
+ } else {
+ spec->format = AUDIO_F32;
+ }
+ } else {
+ switch (SDL_SwapLE16(format->bitspersample)) {
+ case 4:
+ if (MS_ADPCM_encoded || IMA_ADPCM_encoded) {
+ spec->format = AUDIO_S16;
+ } else {
+ was_error = 1;
+ }
+ break;
+ case 8:
+ spec->format = AUDIO_U8;
+ break;
+ case 16:
+ spec->format = AUDIO_S16;
+ break;
+ case 32:
+ spec->format = AUDIO_S32;
+ break;
+ default:
+ was_error = 1;
+ break;
+ }
+ }
- /* Don't return a buffer that isn't a multiple of samplesize */
- samplesize = ((spec->format & 0xFF)/8)*spec->channels;
- *audio_len &= ~(samplesize-1);
+ if (was_error) {
+ SDL_SetError("Unknown %d-bit PCM data format",
+ SDL_SwapLE16(format->bitspersample));
+ goto done;
+ }
+ spec->channels = (Uint8) SDL_SwapLE16(format->channels);
+ spec->samples = 4096; /* Good default buffer size */
-done:
- if ( format != NULL ) {
- SDL_free(format);
- }
- if ( src ) {
- if ( freesrc ) {
- SDL_RWclose(src);
- } else {
- /* seek to the end of the file (given by the RIFF chunk) */
- SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR);
- }
- }
- if ( was_error ) {
- spec = NULL;
- }
- return(spec);
+ /* Read the audio data chunk */
+ *audio_buf = NULL;
+ do {
+ if (*audio_buf != NULL) {
+ SDL_free(*audio_buf);
+ *audio_buf = NULL;
+ }
+ lenread = ReadChunk(src, &chunk);
+ if (lenread < 0) {
+ was_error = 1;
+ goto done;
+ }
+ *audio_len = lenread;
+ *audio_buf = chunk.data;
+ if (chunk.magic != DATA)
+ headerDiff += lenread + 2 * sizeof(Uint32);
+ } while (chunk.magic != DATA);
+ headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */
+
+ if (MS_ADPCM_encoded) {
+ if (MS_ADPCM_decode(audio_buf, audio_len) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ }
+ if (IMA_ADPCM_encoded) {
+ if (IMA_ADPCM_decode(audio_buf, audio_len) < 0) {
+ was_error = 1;
+ goto done;
+ }
+ }
+
+ /* Don't return a buffer that isn't a multiple of samplesize */
+ samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels;
+ *audio_len &= ~(samplesize - 1);
+
+ done:
+ if (format != NULL) {
+ SDL_free(format);
+ }
+ if (src) {
+ if (freesrc) {
+ SDL_RWclose(src);
+ } else {
+ /* seek to the end of the file (given by the RIFF chunk) */
+ SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR);
+ }
+ }
+ if (was_error) {
+ spec = NULL;
+ }
+ return (spec);
}
/* Since the WAV memory is allocated in the shared library, it must also
be freed here. (Necessary under Win32, VC++)
*/
-void SDL_FreeWAV(Uint8 *audio_buf)
+void
+SDL_FreeWAV(Uint8 * audio_buf)
{
- if ( audio_buf != NULL ) {
- SDL_free(audio_buf);
- }
+ if (audio_buf != NULL) {
+ SDL_free(audio_buf);
+ }
}
-static int ReadChunk(SDL_RWops *src, Chunk *chunk)
+static int
+ReadChunk(SDL_RWops * src, Chunk * chunk)
{
- chunk->magic = SDL_ReadLE32(src);
- chunk->length = SDL_ReadLE32(src);
- chunk->data = (Uint8 *)SDL_malloc(chunk->length);
- if ( chunk->data == NULL ) {
- SDL_Error(SDL_ENOMEM);
- return(-1);
- }
- if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) {
- SDL_Error(SDL_EFREAD);
- SDL_free(chunk->data);
- chunk->data = NULL;
- return(-1);
- }
- return(chunk->length);
+ chunk->magic = SDL_ReadLE32(src);
+ chunk->length = SDL_ReadLE32(src);
+ chunk->data = (Uint8 *) SDL_malloc(chunk->length);
+ if (chunk->data == NULL) {
+ SDL_Error(SDL_ENOMEM);
+ return (-1);
+ }
+ if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) {
+ SDL_Error(SDL_EFREAD);
+ SDL_free(chunk->data);
+ chunk->data = NULL;
+ return (-1);
+ }
+ return (chunk->length);
}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/SDL_wave.h b/alienblaster/project/jni/sdl/src/audio/SDL_wave.h
index b1ba47f73..3c1f12343 100644
--- a/alienblaster/project/jni/sdl/src/audio/SDL_wave.h
+++ b/alienblaster/project/jni/sdl/src/audio/SDL_wave.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is SDL_free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,37 +26,40 @@
/*******************************************/
/* Define values for Microsoft WAVE format */
/*******************************************/
-#define RIFF 0x46464952 /* "RIFF" */
-#define WAVE 0x45564157 /* "WAVE" */
-#define FACT 0x74636166 /* "fact" */
-#define LIST 0x5453494c /* "LIST" */
-#define FMT 0x20746D66 /* "fmt " */
-#define DATA 0x61746164 /* "data" */
+#define RIFF 0x46464952 /* "RIFF" */
+#define WAVE 0x45564157 /* "WAVE" */
+#define FACT 0x74636166 /* "fact" */
+#define LIST 0x5453494c /* "LIST" */
+#define FMT 0x20746D66 /* "fmt " */
+#define DATA 0x61746164 /* "data" */
#define PCM_CODE 0x0001
#define MS_ADPCM_CODE 0x0002
+#define IEEE_FLOAT_CODE 0x0003
#define IMA_ADPCM_CODE 0x0011
#define MP3_CODE 0x0055
#define WAVE_MONO 1
#define WAVE_STEREO 2
/* Normally, these three chunks come consecutively in a WAVE file */
-typedef struct WaveFMT {
+typedef struct WaveFMT
+{
/* Not saved in the chunk we read:
Uint32 FMTchunk;
Uint32 fmtlen;
*/
- Uint16 encoding;
- Uint16 channels; /* 1 = mono, 2 = stereo */
- Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
- Uint32 byterate; /* Average bytes per second */
- Uint16 blockalign; /* Bytes per sample block */
- Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */
+ Uint16 encoding;
+ Uint16 channels; /* 1 = mono, 2 = stereo */
+ Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
+ Uint32 byterate; /* Average bytes per second */
+ Uint16 blockalign; /* Bytes per sample block */
+ Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */
} WaveFMT;
/* The general chunk found in the WAVE file */
-typedef struct Chunk {
- Uint32 magic;
- Uint32 length;
- Uint8 *data;
+typedef struct Chunk
+{
+ Uint32 magic;
+ Uint32 length;
+ Uint8 *data;
} Chunk;
-
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.c b/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.c
index e3ce98528..f98290502 100644
--- a/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.c
+++ b/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.c
@@ -1,20 +1,20 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
@@ -24,7 +24,9 @@
/* Allow access to a raw mixing buffer */
#include
-#include /* For kill() */
+#include /* For kill() */
+#include
+#include
#include "SDL_timer.h"
#include "SDL_audio.h"
@@ -33,261 +35,248 @@
#include "SDL_alsa_audio.h"
#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
-#include "SDL_name.h"
#include "SDL_loadso.h"
-#else
-#define SDL_NAME(X) X
#endif
-
/* The tag name used by ALSA audio */
#define DRIVER_NAME "alsa"
-/* Audio driver functions */
-static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void ALSA_WaitAudio(_THIS);
-static void ALSA_PlayAudio(_THIS);
-static Uint8 *ALSA_GetAudioBuf(_THIS);
-static void ALSA_CloseAudio(_THIS);
+static int (*ALSA_snd_pcm_open)
+ (snd_pcm_t **, const char *, snd_pcm_stream_t, int);
+static int (*ALSA_snd_pcm_close) (snd_pcm_t * pcm);
+static snd_pcm_sframes_t(*ALSA_snd_pcm_writei)
+ (snd_pcm_t *, const void *, snd_pcm_uframes_t);
+static int (*ALSA_snd_pcm_recover) (snd_pcm_t *, int, int);
+static int (*ALSA_snd_pcm_prepare) (snd_pcm_t *);
+static int (*ALSA_snd_pcm_drain) (snd_pcm_t *);
+static const char *(*ALSA_snd_strerror) (int);
+static size_t(*ALSA_snd_pcm_hw_params_sizeof) (void);
+static size_t(*ALSA_snd_pcm_sw_params_sizeof) (void);
+static void (*ALSA_snd_pcm_hw_params_copy)
+ (snd_pcm_hw_params_t *, const snd_pcm_hw_params_t *);
+static int (*ALSA_snd_pcm_hw_params_any) (snd_pcm_t *, snd_pcm_hw_params_t *);
+static int (*ALSA_snd_pcm_hw_params_set_access)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t);
+static int (*ALSA_snd_pcm_hw_params_set_format)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t);
+static int (*ALSA_snd_pcm_hw_params_set_channels)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int);
+static int (*ALSA_snd_pcm_hw_params_get_channels)
+ (const snd_pcm_hw_params_t *, unsigned int *);
+static int (*ALSA_snd_pcm_hw_params_set_rate_near)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
+static int (*ALSA_snd_pcm_hw_params_set_period_size_near)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
+static int (*ALSA_snd_pcm_hw_params_get_period_size)
+ (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
+static int (*ALSA_snd_pcm_hw_params_set_periods_near)
+ (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
+static int (*ALSA_snd_pcm_hw_params_get_periods)
+ (const snd_pcm_hw_params_t *, unsigned int *, int *);
+static int (*ALSA_snd_pcm_hw_params_set_buffer_size_near)
+ (snd_pcm_t *pcm, snd_pcm_hw_params_t *, snd_pcm_uframes_t *);
+static int (*ALSA_snd_pcm_hw_params_get_buffer_size)
+ (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *);
+static int (*ALSA_snd_pcm_hw_params) (snd_pcm_t *, snd_pcm_hw_params_t *);
+static int (*ALSA_snd_pcm_sw_params_current) (snd_pcm_t *,
+ snd_pcm_sw_params_t *);
+static int (*ALSA_snd_pcm_sw_params_set_start_threshold)
+ (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
+static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *);
+static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int);
+static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int);
+#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof
+#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof
+
#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC;
static void *alsa_handle = NULL;
-static int alsa_loaded = 0;
-static int (*SDL_NAME(snd_pcm_open))(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode);
-static int (*SDL_NAME(snd_pcm_close))(snd_pcm_t *pcm);
-static snd_pcm_sframes_t (*SDL_NAME(snd_pcm_writei))(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
-static int (*SDL_NAME(snd_pcm_recover))(snd_pcm_t *pcm, int err, int silent);
-static int (*SDL_NAME(snd_pcm_prepare))(snd_pcm_t *pcm);
-static int (*SDL_NAME(snd_pcm_drain))(snd_pcm_t *pcm);
-static const char *(*SDL_NAME(snd_strerror))(int errnum);
-static size_t (*SDL_NAME(snd_pcm_hw_params_sizeof))(void);
-static size_t (*SDL_NAME(snd_pcm_sw_params_sizeof))(void);
-static void (*SDL_NAME(snd_pcm_hw_params_copy))(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);
-static int (*SDL_NAME(snd_pcm_hw_params_any))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
-static int (*SDL_NAME(snd_pcm_hw_params_set_access))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access);
-static int (*SDL_NAME(snd_pcm_hw_params_set_format))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
-static int (*SDL_NAME(snd_pcm_hw_params_set_channels))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
-static int (*SDL_NAME(snd_pcm_hw_params_get_channels))(const snd_pcm_hw_params_t *params, unsigned int *val);
-static int (*SDL_NAME(snd_pcm_hw_params_set_rate_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-static int (*SDL_NAME(snd_pcm_hw_params_set_period_size_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
-static int (*SDL_NAME(snd_pcm_hw_params_get_period_size))(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
-static int (*SDL_NAME(snd_pcm_hw_params_set_periods_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-static int (*SDL_NAME(snd_pcm_hw_params_get_periods))(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
-static int (*SDL_NAME(snd_pcm_hw_params_set_buffer_size_near))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
-static int (*SDL_NAME(snd_pcm_hw_params_get_buffer_size))(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
-static int (*SDL_NAME(snd_pcm_hw_params))(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
-/*
-*/
-static int (*SDL_NAME(snd_pcm_sw_params_current))(snd_pcm_t *pcm, snd_pcm_sw_params_t *swparams);
-static int (*SDL_NAME(snd_pcm_sw_params_set_start_threshold))(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
-static int (*SDL_NAME(snd_pcm_sw_params))(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
-static int (*SDL_NAME(snd_pcm_nonblock))(snd_pcm_t *pcm, int nonblock);
-static int (*SDL_NAME(snd_pcm_wait))(snd_pcm_t *pcm, int timeout);
-#define snd_pcm_hw_params_sizeof SDL_NAME(snd_pcm_hw_params_sizeof)
-#define snd_pcm_sw_params_sizeof SDL_NAME(snd_pcm_sw_params_sizeof)
+static int
+load_alsa_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(alsa_handle, fn);
+ if (*addr == NULL) {
+ /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+ return 0;
+ }
-/* cast funcs to char* first, to please GCC's strict aliasing rules. */
-static struct {
- const char *name;
- void **func;
-} alsa_functions[] = {
- { "snd_pcm_open", (void**)(char*)&SDL_NAME(snd_pcm_open) },
- { "snd_pcm_close", (void**)(char*)&SDL_NAME(snd_pcm_close) },
- { "snd_pcm_writei", (void**)(char*)&SDL_NAME(snd_pcm_writei) },
- { "snd_pcm_recover", (void**)(char*)&SDL_NAME(snd_pcm_recover) },
- { "snd_pcm_prepare", (void**)(char*)&SDL_NAME(snd_pcm_prepare) },
- { "snd_pcm_drain", (void**)(char*)&SDL_NAME(snd_pcm_drain) },
- { "snd_strerror", (void**)(char*)&SDL_NAME(snd_strerror) },
- { "snd_pcm_hw_params_sizeof", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_sizeof) },
- { "snd_pcm_sw_params_sizeof", (void**)(char*)&SDL_NAME(snd_pcm_sw_params_sizeof) },
- { "snd_pcm_hw_params_copy", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_copy) },
- { "snd_pcm_hw_params_any", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_any) },
- { "snd_pcm_hw_params_set_access", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_access) },
- { "snd_pcm_hw_params_set_format", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_format) },
- { "snd_pcm_hw_params_set_channels", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_channels) },
- { "snd_pcm_hw_params_get_channels", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_channels) },
- { "snd_pcm_hw_params_set_rate_near", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_rate_near) },
- { "snd_pcm_hw_params_set_period_size_near", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_period_size_near) },
- { "snd_pcm_hw_params_get_period_size", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_period_size) },
- { "snd_pcm_hw_params_set_periods_near", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_periods_near) },
- { "snd_pcm_hw_params_get_periods", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_periods) },
- { "snd_pcm_hw_params_set_buffer_size_near", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_set_buffer_size_near) },
- { "snd_pcm_hw_params_get_buffer_size", (void**)(char*)&SDL_NAME(snd_pcm_hw_params_get_buffer_size) },
- { "snd_pcm_hw_params", (void**)(char*)&SDL_NAME(snd_pcm_hw_params) },
- { "snd_pcm_sw_params_current", (void**)(char*)&SDL_NAME(snd_pcm_sw_params_current) },
- { "snd_pcm_sw_params_set_start_threshold", (void**)(char*)&SDL_NAME(snd_pcm_sw_params_set_start_threshold) },
- { "snd_pcm_sw_params", (void**)(char*)&SDL_NAME(snd_pcm_sw_params) },
- { "snd_pcm_nonblock", (void**)(char*)&SDL_NAME(snd_pcm_nonblock) },
- { "snd_pcm_wait", (void**)(char*)&SDL_NAME(snd_pcm_wait) },
-};
-
-static void UnloadALSALibrary(void) {
- if (alsa_loaded) {
- SDL_UnloadObject(alsa_handle);
- alsa_handle = NULL;
- alsa_loaded = 0;
- }
+ return 1;
}
-static int LoadALSALibrary(void) {
- int i, retval = -1;
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_ALSA_SYM(x) \
+ if (!load_alsa_sym(#x, (void **) (char *) &ALSA_##x)) return -1
+#else
+#define SDL_ALSA_SYM(x) ALSA_##x = x
+#endif
- alsa_handle = SDL_LoadObject(alsa_library);
- if (alsa_handle) {
- alsa_loaded = 1;
- retval = 0;
- for (i = 0; i < SDL_arraysize(alsa_functions); i++) {
- *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);
- if (!*alsa_functions[i].func) {
- retval = -1;
- UnloadALSALibrary();
- break;
- }
- }
- }
- return retval;
+static int
+load_alsa_syms(void)
+{
+ SDL_ALSA_SYM(snd_pcm_open);
+ SDL_ALSA_SYM(snd_pcm_close);
+ SDL_ALSA_SYM(snd_pcm_writei);
+ SDL_ALSA_SYM(snd_pcm_recover);
+ SDL_ALSA_SYM(snd_pcm_prepare);
+ SDL_ALSA_SYM(snd_pcm_drain);
+ SDL_ALSA_SYM(snd_strerror);
+ SDL_ALSA_SYM(snd_pcm_hw_params_sizeof);
+ SDL_ALSA_SYM(snd_pcm_sw_params_sizeof);
+ SDL_ALSA_SYM(snd_pcm_hw_params_copy);
+ SDL_ALSA_SYM(snd_pcm_hw_params_any);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_access);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_format);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_channels);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_channels);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_periods);
+ SDL_ALSA_SYM(snd_pcm_hw_params_set_buffer_size_near);
+ SDL_ALSA_SYM(snd_pcm_hw_params_get_buffer_size);
+ SDL_ALSA_SYM(snd_pcm_hw_params);
+ SDL_ALSA_SYM(snd_pcm_sw_params_current);
+ SDL_ALSA_SYM(snd_pcm_sw_params_set_start_threshold);
+ SDL_ALSA_SYM(snd_pcm_sw_params);
+ SDL_ALSA_SYM(snd_pcm_nonblock);
+ SDL_ALSA_SYM(snd_pcm_wait);
+ return 0;
+}
+
+#undef SDL_ALSA_SYM
+
+#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+
+static void
+UnloadALSALibrary(void)
+{
+ if (alsa_handle != NULL) {
+ SDL_UnloadObject(alsa_handle);
+ alsa_handle = NULL;
+ }
+}
+
+static int
+LoadALSALibrary(void)
+{
+ int retval = 0;
+ if (alsa_handle == NULL) {
+ alsa_handle = SDL_LoadObject(alsa_library);
+ if (alsa_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ } else {
+ retval = load_alsa_syms();
+ if (retval < 0) {
+ UnloadALSALibrary();
+ }
+ }
+ }
+ return retval;
}
#else
-static void UnloadALSALibrary(void) {
- return;
+static void
+UnloadALSALibrary(void)
+{
}
-static int LoadALSALibrary(void) {
- return 0;
+static int
+LoadALSALibrary(void)
+{
+ load_alsa_syms();
+ return 0;
}
#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
-static const char *get_audio_device(int channels)
+static const char *
+get_audio_device(int channels)
{
- const char *device;
-
- device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */
- if ( device == NULL ) {
- switch (channels) {
- case 6:
- device = "plug:surround51";
- break;
- case 4:
- device = "plug:surround40";
- break;
- default:
- device = "default";
- break;
- }
- }
- return device;
+ const char *device;
+
+ device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */
+ if (device == NULL) {
+ switch (channels) {
+ case 6:
+ device = "plug:surround51";
+ break;
+ case 4:
+ device = "plug:surround40";
+ break;
+ default:
+ device = "default";
+ break;
+ }
+ }
+ return device;
}
-/* Audio driver bootstrap functions */
-
-static int Audio_Available(void)
-{
- int available;
- int status;
- snd_pcm_t *handle;
-
- available = 0;
- if (LoadALSALibrary() < 0) {
- return available;
- }
- status = SDL_NAME(snd_pcm_open)(&handle, get_audio_device(2), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
- if ( status >= 0 ) {
- available = 1;
- SDL_NAME(snd_pcm_close)(handle);
- }
- UnloadALSALibrary();
- return(available);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
- UnloadALSALibrary();
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- LoadALSALibrary();
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = ALSA_OpenAudio;
- this->WaitAudio = ALSA_WaitAudio;
- this->PlayAudio = ALSA_PlayAudio;
- this->GetAudioBuf = ALSA_GetAudioBuf;
- this->CloseAudio = ALSA_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap ALSA_bootstrap = {
- DRIVER_NAME, "ALSA PCM audio",
- Audio_Available, Audio_CreateDevice
-};
/* This function waits until it is possible to write a full sound buffer */
-static void ALSA_WaitAudio(_THIS)
+static void
+ALSA_WaitDevice(_THIS)
{
- /* We're in blocking mode, so there's nothing to do here */
+ /* We're in blocking mode, so there's nothing to do here */
}
+/* !!! FIXME: is there a channel swizzler in alsalib instead? */
/*
* http://bugzilla.libsdl.org/show_bug.cgi?id=110
* "For Linux ALSA, this is FL-FR-RL-RR-C-LFE
* and for Windows DirectX [and CoreAudio], this is FL-FR-C-LFE-RL-RR"
*/
#define SWIZ6(T) \
- T *ptr = (T *) mixbuf; \
- const Uint32 count = (this->spec.samples / 6); \
+ T *ptr = (T *) this->hidden->mixbuf; \
Uint32 i; \
- for (i = 0; i < count; i++, ptr += 6) { \
+ for (i = 0; i < this->spec.samples; i++, ptr += 6) { \
T tmp; \
tmp = ptr[2]; ptr[2] = ptr[4]; ptr[4] = tmp; \
tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \
}
-static __inline__ void swizzle_alsa_channels_6_64bit(_THIS) { SWIZ6(Uint64); }
-static __inline__ void swizzle_alsa_channels_6_32bit(_THIS) { SWIZ6(Uint32); }
-static __inline__ void swizzle_alsa_channels_6_16bit(_THIS) { SWIZ6(Uint16); }
-static __inline__ void swizzle_alsa_channels_6_8bit(_THIS) { SWIZ6(Uint8); }
+static __inline__ void
+swizzle_alsa_channels_6_64bit(_THIS)
+{
+ SWIZ6(Uint64);
+}
+
+static __inline__ void
+swizzle_alsa_channels_6_32bit(_THIS)
+{
+ SWIZ6(Uint32);
+}
+
+static __inline__ void
+swizzle_alsa_channels_6_16bit(_THIS)
+{
+ SWIZ6(Uint16);
+}
+
+static __inline__ void
+swizzle_alsa_channels_6_8bit(_THIS)
+{
+ SWIZ6(Uint8);
+}
#undef SWIZ6
/*
- * Called right before feeding this->mixbuf to the hardware. Swizzle channels
- * from Windows/Mac order to the format alsalib will want.
+ * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle
+ * channels from Windows/Mac order to the format alsalib will want.
*/
-static __inline__ void swizzle_alsa_channels(_THIS)
+static __inline__ void
+swizzle_alsa_channels(_THIS)
{
if (this->spec.channels == 6) {
- const Uint16 fmtsize = (this->spec.format & 0xFF); /* bits/channel. */
+ const Uint16 fmtsize = (this->spec.format & 0xFF); /* bits/channel. */
if (fmtsize == 16)
swizzle_alsa_channels_6_16bit(this);
else if (fmtsize == 8)
@@ -302,311 +291,401 @@ static __inline__ void swizzle_alsa_channels(_THIS)
}
-static void ALSA_PlayAudio(_THIS)
+static void
+ALSA_PlayDevice(_THIS)
{
- int status;
- snd_pcm_uframes_t frames_left;
- const Uint8 *sample_buf = (const Uint8 *) mixbuf;
- const int frame_size = (((int) (this->spec.format & 0xFF)) / 8) * this->spec.channels;
+ int status;
+ const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
+ const int frame_size = (((int) (this->spec.format & 0xFF)) / 8) *
+ this->spec.channels;
+ snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
- swizzle_alsa_channels(this);
+ swizzle_alsa_channels(this);
- frames_left = ((snd_pcm_uframes_t) this->spec.samples);
+ while ( frames_left > 0 && this->enabled ) {
+ /* !!! FIXME: This works, but needs more testing before going live */
+ /*ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1);*/
+ status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
+ sample_buf, frames_left);
- while ( frames_left > 0 && this->enabled ) {
- /* This works, but needs more testing before going live */
- /*SDL_NAME(snd_pcm_wait)(pcm_handle, -1);*/
-
- status = SDL_NAME(snd_pcm_writei)(pcm_handle, sample_buf, frames_left);
- if ( status < 0 ) {
- if ( status == -EAGAIN ) {
- /* Apparently snd_pcm_recover() doesn't handle this case - does it assume snd_pcm_wait() above? */
- SDL_Delay(1);
- continue;
- }
- status = SDL_NAME(snd_pcm_recover)(pcm_handle, status, 0);
- if ( status < 0 ) {
- /* Hmm, not much we can do - abort */
- fprintf(stderr, "ALSA write failed (unrecoverable): %s\n", SDL_NAME(snd_strerror)(status));
- this->enabled = 0;
- return;
- }
- continue;
- }
- sample_buf += status * frame_size;
- frames_left -= status;
- }
+ if (status < 0) {
+ if (status == -EAGAIN) {
+ /* Apparently snd_pcm_recover() doesn't handle this case -
+ does it assume snd_pcm_wait() above? */
+ SDL_Delay(1);
+ continue;
+ }
+ status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0);
+ if (status < 0) {
+ /* Hmm, not much we can do - abort */
+ fprintf(stderr, "ALSA write failed (unrecoverable): %s\n",
+ ALSA_snd_strerror(status));
+ this->enabled = 0;
+ return;
+ }
+ continue;
+ }
+ sample_buf += status * frame_size;
+ frames_left -= status;
+ }
}
-static Uint8 *ALSA_GetAudioBuf(_THIS)
+static Uint8 *
+ALSA_GetDeviceBuf(_THIS)
{
- return(mixbuf);
+ return (this->hidden->mixbuf);
}
-static void ALSA_CloseAudio(_THIS)
+static void
+ALSA_CloseDevice(_THIS)
{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( pcm_handle ) {
- SDL_NAME(snd_pcm_drain)(pcm_handle);
- SDL_NAME(snd_pcm_close)(pcm_handle);
- pcm_handle = NULL;
- }
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->pcm_handle) {
+ ALSA_snd_pcm_drain(this->hidden->pcm_handle);
+ ALSA_snd_pcm_close(this->hidden->pcm_handle);
+ this->hidden->pcm_handle = NULL;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
}
-static int ALSA_finalize_hardware(_THIS, SDL_AudioSpec *spec, snd_pcm_hw_params_t *hwparams, int override)
+static int
+ALSA_finalize_hardware(_THIS, snd_pcm_hw_params_t *hwparams, int override)
{
- int status;
- snd_pcm_uframes_t bufsize;
+ int status;
+ snd_pcm_uframes_t bufsize;
- /* "set" the hardware with the desired parameters */
- status = SDL_NAME(snd_pcm_hw_params)(pcm_handle, hwparams);
- if ( status < 0 ) {
- return(-1);
- }
+ /* "set" the hardware with the desired parameters */
+ status = ALSA_snd_pcm_hw_params(this->hidden->pcm_handle, hwparams);
+ if ( status < 0 ) {
+ return(-1);
+ }
- /* Get samples for the actual buffer size */
- status = SDL_NAME(snd_pcm_hw_params_get_buffer_size)(hwparams, &bufsize);
- if ( status < 0 ) {
- return(-1);
- }
- if ( !override && bufsize != spec->samples * 2 ) {
- return(-1);
- }
+ /* Get samples for the actual buffer size */
+ status = ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize);
+ if ( status < 0 ) {
+ return(-1);
+ }
+ if ( !override && bufsize != this->spec.samples * 2 ) {
+ return(-1);
+ }
- /* FIXME: Is this safe to do? */
- spec->samples = bufsize / 2;
+ /* !!! FIXME: Is this safe to do? */
+ this->spec.samples = bufsize / 2;
- /* This is useful for debugging */
- if ( getenv("SDL_AUDIO_ALSA_DEBUG") ) {
- snd_pcm_uframes_t persize = 0;
- unsigned int periods = 0;
+ /* This is useful for debugging */
+ if ( SDL_getenv("SDL_AUDIO_ALSA_DEBUG") ) {
+ snd_pcm_uframes_t persize = 0;
+ unsigned int periods = 0;
- SDL_NAME(snd_pcm_hw_params_get_period_size)(hwparams, &persize, NULL);
- SDL_NAME(snd_pcm_hw_params_get_periods)(hwparams, &periods, NULL);
+ ALSA_snd_pcm_hw_params_get_period_size(hwparams, &persize, NULL);
+ ALSA_snd_pcm_hw_params_get_periods(hwparams, &periods, NULL);
- fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", persize, periods, bufsize);
- }
- return(0);
+ fprintf(stderr,
+ "ALSA: period size = %ld, periods = %u, buffer size = %lu\n",
+ persize, periods, bufsize);
+ }
+
+ return(0);
}
-static int ALSA_set_period_size(_THIS, SDL_AudioSpec *spec, snd_pcm_hw_params_t *params, int override)
+static int
+ALSA_set_period_size(_THIS, snd_pcm_hw_params_t *params, int override)
{
- const char *env;
- int status;
- snd_pcm_hw_params_t *hwparams;
- snd_pcm_uframes_t frames;
- unsigned int periods;
+ const char *env;
+ int status;
+ snd_pcm_hw_params_t *hwparams;
+ snd_pcm_uframes_t frames;
+ unsigned int periods;
- /* Copy the hardware parameters for this setup */
- snd_pcm_hw_params_alloca(&hwparams);
- SDL_NAME(snd_pcm_hw_params_copy)(hwparams, params);
+ /* Copy the hardware parameters for this setup */
+ snd_pcm_hw_params_alloca(&hwparams);
+ ALSA_snd_pcm_hw_params_copy(hwparams, params);
- if ( !override ) {
- env = getenv("SDL_AUDIO_ALSA_SET_PERIOD_SIZE");
- if ( env ) {
- override = SDL_atoi(env);
- if ( override == 0 ) {
- return(-1);
- }
- }
- }
+ if ( !override ) {
+ env = SDL_getenv("SDL_AUDIO_ALSA_SET_PERIOD_SIZE");
+ if ( env ) {
+ override = SDL_atoi(env);
+ if ( override == 0 ) {
+ return(-1);
+ }
+ }
+ }
- frames = spec->samples;
- status = SDL_NAME(snd_pcm_hw_params_set_period_size_near)(pcm_handle, hwparams, &frames, NULL);
- if ( status < 0 ) {
- return(-1);
- }
+ frames = this->spec.samples;
+ status = ALSA_snd_pcm_hw_params_set_period_size_near(
+ this->hidden->pcm_handle, hwparams, &frames, NULL);
+ if ( status < 0 ) {
+ return(-1);
+ }
- periods = 2;
- status = SDL_NAME(snd_pcm_hw_params_set_periods_near)(pcm_handle, hwparams, &periods, NULL);
- if ( status < 0 ) {
- return(-1);
- }
+ periods = 2;
+ status = ALSA_snd_pcm_hw_params_set_periods_near(
+ this->hidden->pcm_handle, hwparams, &periods, NULL);
+ if ( status < 0 ) {
+ return(-1);
+ }
- return ALSA_finalize_hardware(this, spec, hwparams, override);
+ return ALSA_finalize_hardware(this, hwparams, override);
}
-static int ALSA_set_buffer_size(_THIS, SDL_AudioSpec *spec, snd_pcm_hw_params_t *params, int override)
+static int
+ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params, int override)
{
- const char *env;
- int status;
- snd_pcm_hw_params_t *hwparams;
- snd_pcm_uframes_t frames;
+ const char *env;
+ int status;
+ snd_pcm_hw_params_t *hwparams;
+ snd_pcm_uframes_t frames;
- /* Copy the hardware parameters for this setup */
- snd_pcm_hw_params_alloca(&hwparams);
- SDL_NAME(snd_pcm_hw_params_copy)(hwparams, params);
+ /* Copy the hardware parameters for this setup */
+ snd_pcm_hw_params_alloca(&hwparams);
+ ALSA_snd_pcm_hw_params_copy(hwparams, params);
- if ( !override ) {
- env = getenv("SDL_AUDIO_ALSA_SET_BUFFER_SIZE");
- if ( env ) {
- override = SDL_atoi(env);
- if ( override == 0 ) {
- return(-1);
- }
- }
- }
+ if ( !override ) {
+ env = SDL_getenv("SDL_AUDIO_ALSA_SET_BUFFER_SIZE");
+ if ( env ) {
+ override = SDL_atoi(env);
+ if ( override == 0 ) {
+ return(-1);
+ }
+ }
+ }
- frames = spec->samples * 2;
- status = SDL_NAME(snd_pcm_hw_params_set_buffer_size_near)(pcm_handle, hwparams, &frames);
- if ( status < 0 ) {
- return(-1);
- }
+ frames = this->spec.samples * 2;
+ status = ALSA_snd_pcm_hw_params_set_buffer_size_near(
+ this->hidden->pcm_handle, hwparams, &frames);
+ if ( status < 0 ) {
+ return(-1);
+ }
- return ALSA_finalize_hardware(this, spec, hwparams, override);
+ return ALSA_finalize_hardware(this, hwparams, override);
}
-static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec)
+static int
+ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
{
- int status;
- snd_pcm_hw_params_t *hwparams;
- snd_pcm_sw_params_t *swparams;
- snd_pcm_format_t format;
- unsigned int rate;
- unsigned int channels;
- Uint16 test_format;
+ int status = 0;
+ snd_pcm_t *pcm_handle = NULL;
+ snd_pcm_hw_params_t *hwparams = NULL;
+ snd_pcm_sw_params_t *swparams = NULL;
+ snd_pcm_format_t format = 0;
+ SDL_AudioFormat test_format = 0;
+ unsigned int rate = 0;
+ unsigned int channels = 0;
- /* Open the audio device */
- /* Name of device should depend on # channels in spec */
- status = SDL_NAME(snd_pcm_open)(&pcm_handle, get_audio_device(spec->channels), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- if ( status < 0 ) {
- SDL_SetError("Couldn't open audio device: %s", SDL_NAME(snd_strerror)(status));
- return(-1);
- }
+ /* Open the audio device */
+ /* Name of device should depend on # channels in spec */
+ status = ALSA_snd_pcm_open(&pcm_handle,
+ get_audio_device(this->spec.channels),
+ SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
- /* Figure out what the hardware is capable of */
- snd_pcm_hw_params_alloca(&hwparams);
- status = SDL_NAME(snd_pcm_hw_params_any)(pcm_handle, hwparams);
- if ( status < 0 ) {
- SDL_SetError("Couldn't get hardware config: %s", SDL_NAME(snd_strerror)(status));
- ALSA_CloseAudio(this);
- return(-1);
- }
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't open audio device: %s",
+ ALSA_snd_strerror(status));
+ return 0;
+ }
- /* SDL only uses interleaved sample output */
- status = SDL_NAME(snd_pcm_hw_params_set_access)(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
- if ( status < 0 ) {
- SDL_SetError("Couldn't set interleaved access: %s", SDL_NAME(snd_strerror)(status));
- ALSA_CloseAudio(this);
- return(-1);
- }
+ this->hidden->pcm_handle = pcm_handle;
- /* Try for a closest match on audio format */
- status = -1;
- for ( test_format = SDL_FirstAudioFormat(spec->format);
- test_format && (status < 0); ) {
- switch ( test_format ) {
- case AUDIO_U8:
- format = SND_PCM_FORMAT_U8;
- break;
- case AUDIO_S8:
- format = SND_PCM_FORMAT_S8;
- break;
- case AUDIO_S16LSB:
- format = SND_PCM_FORMAT_S16_LE;
- break;
- case AUDIO_S16MSB:
- format = SND_PCM_FORMAT_S16_BE;
- break;
- case AUDIO_U16LSB:
- format = SND_PCM_FORMAT_U16_LE;
- break;
- case AUDIO_U16MSB:
- format = SND_PCM_FORMAT_U16_BE;
- break;
- default:
- format = 0;
- break;
- }
- if ( format != 0 ) {
- status = SDL_NAME(snd_pcm_hw_params_set_format)(pcm_handle, hwparams, format);
- }
- if ( status < 0 ) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if ( status < 0 ) {
- SDL_SetError("Couldn't find any hardware audio formats");
- ALSA_CloseAudio(this);
- return(-1);
- }
- spec->format = test_format;
+ /* Figure out what the hardware is capable of */
+ snd_pcm_hw_params_alloca(&hwparams);
+ status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't get hardware config: %s",
+ ALSA_snd_strerror(status));
+ return 0;
+ }
- /* Set the number of channels */
- status = SDL_NAME(snd_pcm_hw_params_set_channels)(pcm_handle, hwparams, spec->channels);
- channels = spec->channels;
- if ( status < 0 ) {
- status = SDL_NAME(snd_pcm_hw_params_get_channels)(hwparams, &channels);
- if ( status < 0 ) {
- SDL_SetError("Couldn't set audio channels");
- ALSA_CloseAudio(this);
- return(-1);
- }
- spec->channels = channels;
- }
+ /* SDL only uses interleaved sample output */
+ status = ALSA_snd_pcm_hw_params_set_access(pcm_handle, hwparams,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't set interleaved access: %s",
+ ALSA_snd_strerror(status));
+ return 0;
+ }
- /* Set the audio rate */
- rate = spec->freq;
+ /* Try for a closest match on audio format */
+ status = -1;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ test_format && (status < 0);) {
+ status = 0; /* if we can't support a format, it'll become -1. */
+ switch (test_format) {
+ case AUDIO_U8:
+ format = SND_PCM_FORMAT_U8;
+ break;
+ case AUDIO_S8:
+ format = SND_PCM_FORMAT_S8;
+ break;
+ case AUDIO_S16LSB:
+ format = SND_PCM_FORMAT_S16_LE;
+ break;
+ case AUDIO_S16MSB:
+ format = SND_PCM_FORMAT_S16_BE;
+ break;
+ case AUDIO_U16LSB:
+ format = SND_PCM_FORMAT_U16_LE;
+ break;
+ case AUDIO_U16MSB:
+ format = SND_PCM_FORMAT_U16_BE;
+ break;
+ case AUDIO_S32LSB:
+ format = SND_PCM_FORMAT_S32_LE;
+ break;
+ case AUDIO_S32MSB:
+ format = SND_PCM_FORMAT_S32_BE;
+ break;
+ case AUDIO_F32LSB:
+ format = SND_PCM_FORMAT_FLOAT_LE;
+ break;
+ case AUDIO_F32MSB:
+ format = SND_PCM_FORMAT_FLOAT_BE;
+ break;
+ default:
+ status = -1;
+ break;
+ }
+ if (status >= 0) {
+ status = ALSA_snd_pcm_hw_params_set_format(pcm_handle,
+ hwparams, format);
+ }
+ if (status < 0) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
- status = SDL_NAME(snd_pcm_hw_params_set_rate_near)(pcm_handle, hwparams, &rate, NULL);
- if ( status < 0 ) {
- SDL_SetError("Couldn't set audio frequency: %s", SDL_NAME(snd_strerror)(status));
- ALSA_CloseAudio(this);
- return(-1);
- }
- spec->freq = rate;
+ /* Set the number of channels */
+ status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams,
+ this->spec.channels);
+ channels = this->spec.channels;
+ if (status < 0) {
+ status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels);
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't set audio channels");
+ return 0;
+ }
+ this->spec.channels = channels;
+ }
- /* Set the buffer size, in samples */
- if ( ALSA_set_period_size(this, spec, hwparams, 0) < 0 &&
- ALSA_set_buffer_size(this, spec, hwparams, 0) < 0 ) {
- /* Failed to set desired buffer size, do the best you can... */
- if ( ALSA_set_period_size(this, spec, hwparams, 1) < 0 ) {
- SDL_SetError("Couldn't set hardware audio parameters: %s", SDL_NAME(snd_strerror)(status));
- ALSA_CloseAudio(this);
- return(-1);
- }
- }
+ /* Set the audio rate */
+ rate = this->spec.freq;
+ status = ALSA_snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams,
+ &rate, NULL);
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't set audio frequency: %s",
+ ALSA_snd_strerror(status));
+ return 0;
+ }
+ this->spec.freq = rate;
- /* Set the software parameters */
- snd_pcm_sw_params_alloca(&swparams);
- status = SDL_NAME(snd_pcm_sw_params_current)(pcm_handle, swparams);
- if ( status < 0 ) {
- SDL_SetError("Couldn't get software config: %s", SDL_NAME(snd_strerror)(status));
- ALSA_CloseAudio(this);
- return(-1);
- }
- status = SDL_NAME(snd_pcm_sw_params_set_start_threshold)(pcm_handle, swparams, 1);
- if ( status < 0 ) {
- SDL_SetError("Couldn't set start threshold: %s", SDL_NAME(snd_strerror)(status));
- ALSA_CloseAudio(this);
- return(-1);
- }
- status = SDL_NAME(snd_pcm_sw_params)(pcm_handle, swparams);
- if ( status < 0 ) {
- SDL_SetError("Couldn't set software audio parameters: %s", SDL_NAME(snd_strerror)(status));
- ALSA_CloseAudio(this);
- return(-1);
- }
+ /* Set the buffer size, in samples */
+ if ( ALSA_set_period_size(this, hwparams, 0) < 0 &&
+ ALSA_set_buffer_size(this, hwparams, 0) < 0 ) {
+ /* Failed to set desired buffer size, do the best you can... */
+ if ( ALSA_set_period_size(this, hwparams, 1) < 0 ) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status));
+ return(-1);
+ }
+ }
+ /* Set the software parameters */
+ snd_pcm_sw_params_alloca(&swparams);
+ status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams);
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't get software config: %s",
+ ALSA_snd_strerror(status));
+ return 0;
+ }
+ status =
+ ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1);
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("ALSA: Couldn't set start threshold: %s",
+ ALSA_snd_strerror(status));
+ return 0;
+ }
+ status = ALSA_snd_pcm_sw_params(pcm_handle, swparams);
+ if (status < 0) {
+ ALSA_CloseDevice(this);
+ SDL_SetError("Couldn't set software audio parameters: %s",
+ ALSA_snd_strerror(status));
+ return 0;
+ }
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
- /* Allocate mixing buffer */
- mixlen = spec->size;
- mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
- if ( mixbuf == NULL ) {
- ALSA_CloseAudio(this);
- return(-1);
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ ALSA_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
- /* Switch to blocking mode for playback */
- SDL_NAME(snd_pcm_nonblock)(pcm_handle, 0);
+ /* Switch to blocking mode for playback */
+ ALSA_snd_pcm_nonblock(pcm_handle, 0);
- /* We're ready to rock and roll. :-) */
- return(0);
+ /* We're ready to rock and roll. :-) */
+ return 1;
}
+
+static void
+ALSA_Deinitialize(void)
+{
+ UnloadALSALibrary();
+}
+
+static int
+ALSA_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadALSALibrary() < 0) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = ALSA_OpenDevice;
+ impl->WaitDevice = ALSA_WaitDevice;
+ impl->GetDeviceBuf = ALSA_GetDeviceBuf;
+ impl->PlayDevice = ALSA_PlayDevice;
+ impl->CloseDevice = ALSA_CloseDevice;
+ impl->Deinitialize = ALSA_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: Add device enum! */
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap ALSA_bootstrap = {
+ DRIVER_NAME, "ALSA PCM audio", ALSA_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.h b/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.h
index 252f33331..d50e3f76a 100644
--- a/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.h
+++ b/alienblaster/project/jni/sdl/src/audio/alsa/SDL_alsa_audio.h
@@ -1,20 +1,20 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
@@ -28,21 +28,19 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The audio device handle */
- snd_pcm_t *pcm_handle;
+struct SDL_PrivateAudioData
+{
+ /* The audio device handle */
+ snd_pcm_t *pcm_handle;
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
};
-/* Old variable names */
-#define pcm_handle (this->hidden->pcm_handle)
-#define mixbuf (this->hidden->mixbuf)
-#define mixlen (this->hidden->mixlen)
-
#endif /* _ALSA_PCM_audio_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c b/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c
index 09f6f0d2e..f29353919 100644
--- a/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/android/SDL_androidaudio.c
@@ -36,6 +36,8 @@
#include
#include // for memset()
+#if 0 // Disabled for now
+
#define ANDROIDAUD_DRIVER_NAME "android"
/* Audio driver functions */
@@ -339,3 +341,4 @@ extern jint JAVA_EXPORT_NAME(AudioThread_nativeAudioBufferUnlock) ( JNIEnv * env
return 0;
}
+#endif
diff --git a/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.c b/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.c
index 44447a2cd..fa8788a8a 100644
--- a/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -27,12 +27,12 @@
#include
#endif
#include
+#include
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
#include "SDL_artsaudio.h"
#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
@@ -45,304 +45,335 @@
/* The tag name used by artsc audio */
#define ARTS_DRIVER_NAME "arts"
-/* Audio driver functions */
-static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void ARTS_WaitAudio(_THIS);
-static void ARTS_PlayAudio(_THIS);
-static Uint8 *ARTS_GetAudioBuf(_THIS);
-static void ARTS_CloseAudio(_THIS);
-
#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
static void *arts_handle = NULL;
-static int arts_loaded = 0;
-static int (*SDL_NAME(arts_init))(void);
-static void (*SDL_NAME(arts_free))(void);
-static arts_stream_t (*SDL_NAME(arts_play_stream))(int rate, int bits, int channels, const char *name);
-static int (*SDL_NAME(arts_stream_set))(arts_stream_t s, arts_parameter_t param, int value);
-static int (*SDL_NAME(arts_stream_get))(arts_stream_t s, arts_parameter_t param);
-static int (*SDL_NAME(arts_write))(arts_stream_t s, const void *buffer, int count);
-static void (*SDL_NAME(arts_close_stream))(arts_stream_t s);
-static int (*SDL_NAME(arts_suspended))(void);
-static const char *(*SDL_NAME(arts_error_text))(int errorcode);
+/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
+static int (*SDL_NAME(arts_init)) (void);
+static void (*SDL_NAME(arts_free)) (void);
+static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits,
+ int channels,
+ const char *name);
+static int (*SDL_NAME(arts_stream_set)) (arts_stream_t s,
+ arts_parameter_t param, int value);
+static int (*SDL_NAME(arts_stream_get)) (arts_stream_t s,
+ arts_parameter_t param);
+static int (*SDL_NAME(arts_write)) (arts_stream_t s, const void *buffer,
+ int count);
+static void (*SDL_NAME(arts_close_stream)) (arts_stream_t s);
+static int (*SDL_NAME(arts_suspended)) (void);
+static const char *(*SDL_NAME(arts_error_text)) (int errorcode);
-static struct {
- const char *name;
- void **func;
+#define SDL_ARTS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
+static struct
+{
+ const char *name;
+ void **func;
} arts_functions[] = {
- { "arts_init", (void **)&SDL_NAME(arts_init) },
- { "arts_free", (void **)&SDL_NAME(arts_free) },
- { "arts_play_stream", (void **)&SDL_NAME(arts_play_stream) },
- { "arts_stream_set", (void **)&SDL_NAME(arts_stream_set) },
- { "arts_stream_get", (void **)&SDL_NAME(arts_stream_get) },
- { "arts_write", (void **)&SDL_NAME(arts_write) },
- { "arts_close_stream", (void **)&SDL_NAME(arts_close_stream) },
- { "arts_suspended", (void **)&SDL_NAME(arts_suspended) },
- { "arts_error_text", (void **)&SDL_NAME(arts_error_text) },
+/* *INDENT-OFF* */
+ SDL_ARTS_SYM(arts_init),
+ SDL_ARTS_SYM(arts_free),
+ SDL_ARTS_SYM(arts_play_stream),
+ SDL_ARTS_SYM(arts_stream_set),
+ SDL_ARTS_SYM(arts_stream_get),
+ SDL_ARTS_SYM(arts_write),
+ SDL_ARTS_SYM(arts_close_stream),
+ SDL_ARTS_SYM(arts_suspended),
+ SDL_ARTS_SYM(arts_error_text),
+/* *INDENT-ON* */
};
-static void UnloadARTSLibrary()
+#undef SDL_ARTS_SYM
+
+static void
+UnloadARTSLibrary()
{
- if ( arts_loaded ) {
- SDL_UnloadObject(arts_handle);
- arts_handle = NULL;
- arts_loaded = 0;
- }
+ if (arts_handle != NULL) {
+ SDL_UnloadObject(arts_handle);
+ arts_handle = NULL;
+ }
}
-static int LoadARTSLibrary(void)
+static int
+LoadARTSLibrary(void)
{
- int i, retval = -1;
+ int i, retval = -1;
- arts_handle = SDL_LoadObject(arts_library);
- if ( arts_handle ) {
- arts_loaded = 1;
- retval = 0;
- for ( i=0; ihidden);
- SDL_free(device);
- UnloadARTSLibrary();
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- LoadARTSLibrary();
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- stream = 0;
-
- /* Set the function pointers */
- this->OpenAudio = ARTS_OpenAudio;
- this->WaitAudio = ARTS_WaitAudio;
- this->PlayAudio = ARTS_PlayAudio;
- this->GetAudioBuf = ARTS_GetAudioBuf;
- this->CloseAudio = ARTS_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap ARTS_bootstrap = {
- ARTS_DRIVER_NAME, "Analog Realtime Synthesizer",
- Audio_Available, Audio_CreateDevice
-};
-
/* This function waits until it is possible to write a full sound buffer */
-static void ARTS_WaitAudio(_THIS)
+static void
+ARTS_WaitDevice(_THIS)
{
- Sint32 ticks;
+ Sint32 ticks;
- /* Check to see if the thread-parent process is still alive */
- { static int cnt = 0;
- /* Note that this only works with thread implementations
- that use a different process id for each thread.
- */
- if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
- if ( kill(parent, 0) < 0 ) {
- this->enabled = 0;
- }
- }
- }
+ /* Check to see if the thread-parent process is still alive */
+ {
+ static int cnt = 0;
+ /* Note that this only works with thread implementations
+ that use a different process id for each thread.
+ */
+ /* Check every 10 loops */
+ if (this->hidden->parent && (((++cnt) % 10) == 0)) {
+ if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) {
+ this->enabled = 0;
+ }
+ }
+ }
- /* Use timer for general audio synchronization */
- ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS;
- if ( ticks > 0 ) {
- SDL_Delay(ticks);
- }
+ /* Use timer for general audio synchronization */
+ ticks =
+ ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
}
-static void ARTS_PlayAudio(_THIS)
+static void
+ARTS_PlayDevice(_THIS)
{
- int written;
+ /* Write the audio data */
+ int written = SDL_NAME(arts_write) (this->hidden->stream,
+ this->hidden->mixbuf,
+ this->hidden->mixlen);
- /* Write the audio data */
- written = SDL_NAME(arts_write)(stream, mixbuf, mixlen);
-
- /* If timer synchronization is enabled, set the next write frame */
- if ( frame_ticks ) {
- next_frame += frame_ticks;
- }
+ /* If timer synchronization is enabled, set the next write frame */
+ if (this->hidden->frame_ticks) {
+ this->hidden->next_frame += this->hidden->frame_ticks;
+ }
- /* If we couldn't write, assume fatal error for now */
- if ( written < 0 ) {
- this->enabled = 0;
- }
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ this->enabled = 0;
+ }
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
#endif
}
-static Uint8 *ARTS_GetAudioBuf(_THIS)
+static void
+ARTS_WaitDone(_THIS)
{
- return(mixbuf);
+ /* !!! FIXME: camp here until buffer drains... SDL_Delay(???); */
}
-static void ARTS_CloseAudio(_THIS)
+
+static Uint8 *
+ARTS_GetDeviceBuf(_THIS)
{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( stream ) {
- SDL_NAME(arts_close_stream)(stream);
- stream = 0;
- }
- SDL_NAME(arts_free)();
+ return (this->hidden->mixbuf);
}
-static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec)
+
+static void
+ARTS_CloseDevice(_THIS)
{
- int bits, frag_spec;
- Uint16 test_format, format;
- int error_code;
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->stream) {
+ SDL_NAME(arts_close_stream) (this->hidden->stream);
+ this->hidden->stream = 0;
+ }
+ SDL_NAME(arts_free) ();
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
- /* Reset the timer synchronization flag */
- frame_ticks = 0.0;
- mixbuf = NULL;
+static int
+ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ int rc = 0;
+ int bits = 0, frag_spec = 0;
+ SDL_AudioFormat test_format = 0, format = 0;
- /* Try for a closest match on audio format */
- format = 0;
- bits = 0;
- for ( test_format = SDL_FirstAudioFormat(spec->format);
- ! format && test_format; ) {
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
#endif
- switch ( test_format ) {
- case AUDIO_U8:
- bits = 8;
- format = 1;
- break;
- case AUDIO_S16LSB:
- bits = 16;
- format = 1;
- break;
- default:
- format = 0;
- break;
- }
- if ( ! format ) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if ( format == 0 ) {
- SDL_SetError("Couldn't find any hardware audio formats");
- return(-1);
- }
- spec->format = test_format;
+ switch (test_format) {
+ case AUDIO_U8:
+ bits = 8;
+ format = 1;
+ break;
+ case AUDIO_S16LSB:
+ bits = 16;
+ format = 1;
+ break;
+ default:
+ format = 0;
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+ ARTS_CloseDevice(this);
+ SDL_SetError("Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
- error_code = SDL_NAME(arts_init)();
- if ( error_code != 0 ) {
- SDL_SetError("Unable to initialize ARTS: %s", SDL_NAME(arts_error_text)(error_code));
- return(-1);
- }
- if ( ! SDL_NAME(arts_suspended)() ) {
- SDL_SetError("ARTS can not open audio device");
- return(-1);
- }
- stream = SDL_NAME(arts_play_stream)(spec->freq, bits, spec->channels, "SDL");
+ if ((rc = SDL_NAME(arts_init) ()) != 0) {
+ ARTS_CloseDevice(this);
+ SDL_SetError("Unable to initialize ARTS: %s",
+ SDL_NAME(arts_error_text) (rc));
+ return 0;
+ }
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
+ if (!SDL_NAME(arts_suspended) ()) {
+ ARTS_CloseDevice(this);
+ SDL_SetError("ARTS can not open audio device");
+ return 0;
+ }
- /* Determine the power of two of the fragment size */
- for ( frag_spec = 0; (0x01<size; ++frag_spec );
- if ( (0x01<size ) {
- SDL_SetError("Fragment size must be a power of two");
- return(-1);
- }
- frag_spec |= 0x00020000; /* two fragments, for low latency */
+ this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq,
+ bits,
+ this->spec.channels,
+ "SDL");
+
+ /* Play nothing so we have at least one write (server bug workaround). */
+ SDL_NAME(arts_write) (this->hidden->stream, "", 0);
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Determine the power of two of the fragment size */
+ for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec);
+ if ((0x01 << frag_spec) != this->spec.size) {
+ ARTS_CloseDevice(this);
+ SDL_SetError("Fragment size must be a power of two");
+ return 0;
+ }
+ frag_spec |= 0x00020000; /* two fragments, for low latency */
#ifdef ARTS_P_PACKET_SETTINGS
- SDL_NAME(arts_stream_set)(stream, ARTS_P_PACKET_SETTINGS, frag_spec);
+ SDL_NAME(arts_stream_set) (this->hidden->stream,
+ ARTS_P_PACKET_SETTINGS, frag_spec);
#else
- SDL_NAME(arts_stream_set)(stream, ARTS_P_PACKET_SIZE, frag_spec&0xffff);
- SDL_NAME(arts_stream_set)(stream, ARTS_P_PACKET_COUNT, frag_spec>>16);
+ SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_SIZE,
+ frag_spec & 0xffff);
+ SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_COUNT,
+ frag_spec >> 16);
#endif
- spec->size = SDL_NAME(arts_stream_get)(stream, ARTS_P_PACKET_SIZE);
+ this->spec.size = SDL_NAME(arts_stream_get) (this->hidden->stream,
+ ARTS_P_PACKET_SIZE);
- /* Allocate mixing buffer */
- mixlen = spec->size;
- mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
- if ( mixbuf == NULL ) {
- return(-1);
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ ARTS_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
- /* Get the parent process id (we're the parent of the audio thread) */
- parent = getpid();
+ /* Get the parent process id (we're the parent of the audio thread) */
+ this->hidden->parent = getpid();
- /* We're ready to rock and roll. :-) */
- return(0);
+ /* We're ready to rock and roll. :-) */
+ return 1;
}
+
+
+static void
+ARTS_Deinitialize(void)
+{
+ UnloadARTSLibrary();
+}
+
+
+static int
+ARTS_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadARTSLibrary() < 0) {
+ return 0;
+ } else {
+ if (SDL_NAME(arts_init) () != 0) {
+ UnloadARTSLibrary();
+ SDL_SetError("ARTS: arts_init failed (no audio server?)");
+ return 0;
+ }
+
+ /* Play a stream so aRts doesn't crash */
+ if (SDL_NAME(arts_suspended) ()) {
+ arts_stream_t stream;
+ stream = SDL_NAME(arts_play_stream) (44100, 16, 2, "SDL");
+ SDL_NAME(arts_write) (stream, "", 0);
+ SDL_NAME(arts_close_stream) (stream);
+ }
+
+ SDL_NAME(arts_free) ();
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = ARTS_OpenDevice;
+ impl->PlayDevice = ARTS_PlayDevice;
+ impl->WaitDevice = ARTS_WaitDevice;
+ impl->GetDeviceBuf = ARTS_GetDeviceBuf;
+ impl->CloseDevice = ARTS_CloseDevice;
+ impl->WaitDone = ARTS_WaitDone;
+ impl->Deinitialize = ARTS_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap ARTS_bootstrap = {
+ ARTS_DRIVER_NAME, "Analog RealTime Synthesizer", ARTS_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.h b/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.h
index b5ccf3581..ae46dc6cf 100644
--- a/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/arts/SDL_artsaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -28,33 +28,26 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The stream descriptor for the audio device */
- arts_stream_t stream;
+struct SDL_PrivateAudioData
+{
+ /* The stream descriptor for the audio device */
+ arts_stream_t stream;
- /* The parent process id, to detect when application quits */
- pid_t parent;
+ /* The parent process id, to detect when application quits */
+ pid_t parent;
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
- /* Support for audio timing using a timer, in addition to select() */
- float frame_ticks;
- float next_frame;
+ /* Support for audio timing using a timer, in addition to select() */
+ float frame_ticks;
+ float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
-
-/* Old variable names */
-#define stream (this->hidden->stream)
-#define parent (this->hidden->parent)
-#define mixbuf (this->hidden->mixbuf)
-#define mixlen (this->hidden->mixlen)
-#define frame_ticks (this->hidden->frame_ticks)
-#define next_frame (this->hidden->next_frame)
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_artscaudio_h */
-
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.cc b/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.cc
index fc23f01b6..2f04f8d4d 100644
--- a/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.cc
+++ b/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.cc
@@ -27,7 +27,8 @@
#include "../../main/beos/SDL_BeApp.h"
-extern "C" {
+extern "C"
+{
#include "SDL_audio.h"
#include "../SDL_audio_c.h"
@@ -35,191 +36,183 @@ extern "C" {
#include "../../thread/beos/SDL_systhread_c.h"
#include "SDL_beaudio.h"
-
-/* Audio driver functions */
-static int BE_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void BE_WaitAudio(_THIS);
-static void BE_PlayAudio(_THIS);
-static Uint8 *BE_GetAudioBuf(_THIS);
-static void BE_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-
-static int Audio_Available(void)
-{
- return(1);
}
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *device;
-
- /* Initialize all variables that we clean on shutdown */
- device = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( device ) {
- SDL_memset(device, 0, (sizeof *device));
- device->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *device->hidden));
- }
- if ( (device == NULL) || (device->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( device ) {
- SDL_free(device);
- }
- return(0);
- }
- SDL_memset(device->hidden, 0, (sizeof *device->hidden));
-
- /* Set the function pointers */
- device->OpenAudio = BE_OpenAudio;
- device->WaitAudio = BE_WaitAudio;
- device->PlayAudio = BE_PlayAudio;
- device->GetAudioBuf = BE_GetAudioBuf;
- device->CloseAudio = BE_CloseAudio;
-
- device->free = Audio_DeleteDevice;
-
- return device;
-}
-
-AudioBootStrap BAUDIO_bootstrap = {
- "baudio", "BeOS BSoundPlayer",
- Audio_Available, Audio_CreateDevice
-};
+/* !!! FIXME: have the callback call the higher level to avoid code dupe. */
/* The BeOS callback for handling the audio buffer */
-static void FillSound(void *device, void *stream, size_t len,
- const media_raw_audio_format &format)
+static void
+FillSound(void *device, void *stream, size_t len,
+ const media_raw_audio_format & format)
{
- SDL_AudioDevice *audio = (SDL_AudioDevice *)device;
+ SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
- /* Silence the buffer, since it's ours */
- SDL_memset(stream, audio->spec.silence, len);
+ /* Silence the buffer, since it's ours */
+ SDL_memset(stream, audio->spec.silence, len);
- /* Only do soemthing if audio is enabled */
- if ( ! audio->enabled )
- return;
+ /* Only do soemthing if audio is enabled */
+ if (!audio->enabled)
+ return;
- if ( ! audio->paused ) {
- if ( audio->convert.needed ) {
- SDL_mutexP(audio->mixer_lock);
- (*audio->spec.callback)(audio->spec.userdata,
- (Uint8 *)audio->convert.buf,audio->convert.len);
- SDL_mutexV(audio->mixer_lock);
- SDL_ConvertAudio(&audio->convert);
- SDL_memcpy(stream,audio->convert.buf,audio->convert.len_cvt);
- } else {
- SDL_mutexP(audio->mixer_lock);
- (*audio->spec.callback)(audio->spec.userdata,
- (Uint8 *)stream, len);
- SDL_mutexV(audio->mixer_lock);
- }
- }
- return;
+ if (!audio->paused) {
+ if (audio->convert.needed) {
+ SDL_mutexP(audio->mixer_lock);
+ (*audio->spec.callback) (audio->spec.userdata,
+ (Uint8 *) audio->convert.buf,
+ audio->convert.len);
+ SDL_mutexV(audio->mixer_lock);
+ SDL_ConvertAudio(&audio->convert);
+ SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt);
+ } else {
+ SDL_mutexP(audio->mixer_lock);
+ (*audio->spec.callback) (audio->spec.userdata,
+ (Uint8 *) stream, len);
+ SDL_mutexV(audio->mixer_lock);
+ }
+ }
}
-/* Dummy functions -- we don't use thread-based audio */
-void BE_WaitAudio(_THIS)
+static void
+BEOSAUDIO_CloseDevice(_THIS)
{
- return;
-}
-void BE_PlayAudio(_THIS)
-{
- return;
-}
-Uint8 *BE_GetAudioBuf(_THIS)
-{
- return(NULL);
+ if (_this->hidden != NULL) {
+ if (_this->hidden->audio_obj) {
+ _this->hidden->audio_obj->Stop();
+ delete _this->hidden->audio_obj;
+ _this->hidden->audio_obj = NULL;
+ }
+
+ delete _this->hidden;
+ _this->hidden = NULL;
+ }
}
-void BE_CloseAudio(_THIS)
-{
- if ( audio_obj ) {
- audio_obj->Stop();
- delete audio_obj;
- audio_obj = NULL;
- }
-
- /* Quit the Be Application, if there's nothing left to do */
- SDL_QuitBeApp();
-}
-
-int BE_OpenAudio(_THIS, SDL_AudioSpec *spec)
+static int
+BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
{
int valid_datatype = 0;
media_raw_audio_format format;
- Uint16 test_format = SDL_FirstAudioFormat(spec->format);
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(_this->spec.format);
+
+ /* Initialize all variables that we clean on shutdown */
+ _this->hidden = new SDL_PrivateAudioData;
+ if (_this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(_this->hidden, 0, (sizeof *_this->hidden));
/* Parse the audio format and fill the Be raw audio format */
- memset(&format, '\0', sizeof (media_raw_audio_format));
+ SDL_memset(&format, '\0', sizeof(media_raw_audio_format));
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
- format.frame_rate = (float) spec->freq;
- format.channel_count = spec->channels; /* !!! FIXME: support > 2? */
+ format.frame_rate = (float) _this->spec.freq;
+ format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */
while ((!valid_datatype) && (test_format)) {
valid_datatype = 1;
- spec->format = test_format;
+ _this->spec.format = test_format;
switch (test_format) {
- case AUDIO_S8:
- format.format = media_raw_audio_format::B_AUDIO_CHAR;
- break;
+ case AUDIO_S8:
+ format.format = media_raw_audio_format::B_AUDIO_CHAR;
+ break;
- case AUDIO_U8:
- format.format = media_raw_audio_format::B_AUDIO_UCHAR;
- break;
+ case AUDIO_U8:
+ format.format = media_raw_audio_format::B_AUDIO_UCHAR;
+ break;
- case AUDIO_S16LSB:
- format.format = media_raw_audio_format::B_AUDIO_SHORT;
- break;
+ case AUDIO_S16LSB:
+ format.format = media_raw_audio_format::B_AUDIO_SHORT;
+ break;
- case AUDIO_S16MSB:
- format.format = media_raw_audio_format::B_AUDIO_SHORT;
- format.byte_order = B_MEDIA_BIG_ENDIAN;
- break;
+ case AUDIO_S16MSB:
+ format.format = media_raw_audio_format::B_AUDIO_SHORT;
+ format.byte_order = B_MEDIA_BIG_ENDIAN;
+ break;
- default:
- valid_datatype = 0;
- test_format = SDL_NextAudioFormat();
- break;
+ case AUDIO_S32LSB:
+ format.format = media_raw_audio_format::B_AUDIO_INT;
+ break;
+
+ case AUDIO_S32MSB:
+ format.format = media_raw_audio_format::B_AUDIO_INT;
+ format.byte_order = B_MEDIA_BIG_ENDIAN;
+ break;
+
+ case AUDIO_F32LSB:
+ format.format = media_raw_audio_format::B_AUDIO_FLOAT;
+ break;
+
+ case AUDIO_F32MSB:
+ format.format = media_raw_audio_format::B_AUDIO_FLOAT;
+ format.byte_order = B_MEDIA_BIG_ENDIAN;
+ break;
+
+ default:
+ valid_datatype = 0;
+ test_format = SDL_NextAudioFormat();
+ break;
}
}
- if (!valid_datatype) { /* shouldn't happen, but just in case... */
+ format.buffer_size = _this->spec.samples;
+
+ if (!valid_datatype) { /* shouldn't happen, but just in case... */
+ BEOSAUDIO_CloseDevice(_this);
SDL_SetError("Unsupported audio format");
- return (-1);
+ return 0;
}
- /* Initialize the Be Application, if it's not already started */
- if (SDL_InitBeApp() < 0) {
- return (-1);
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&_this->spec);
+
+ /* Subscribe to the audio stream (creates a new thread) */
+ sigset_t omask;
+ SDL_MaskSignals(&omask);
+ _this->hidden->audio_obj = new BSoundPlayer(&format, "SDL Audio",
+ FillSound, NULL, _this);
+ SDL_UnmaskSignals(&omask);
+
+ if (_this->hidden->audio_obj->Start() == B_NO_ERROR) {
+ _this->hidden->audio_obj->SetHasData(true);
+ } else {
+ BEOSAUDIO_CloseDevice(_this);
+ SDL_SetError("Unable to start Be audio");
+ return 0;
}
- format.buffer_size = spec->samples;
-
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
-
- /* Subscribe to the audio stream (creates a new thread) */
- { sigset_t omask;
- SDL_MaskSignals(&omask);
- audio_obj = new BSoundPlayer(&format, "SDL Audio", FillSound,
- NULL, _this);
- SDL_UnmaskSignals(&omask);
- }
- if ( audio_obj->Start() == B_NO_ERROR ) {
- audio_obj->SetHasData(true);
- } else {
- SDL_SetError("Unable to start Be audio");
- return(-1);
- }
-
- /* We're running! */
- return(1);
+ /* We're running! */
+ return 1;
}
-}; /* Extern C */
+static void
+BEOSAUDIO_Deinitialize(void)
+{
+ SDL_QuitBeApp();
+}
+
+static int
+BEOSAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Initialize the Be Application, if it's not already started */
+ if (SDL_InitBeApp() < 0) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = BEOSAUDIO_OpenDevice;
+ impl->CloseDevice = BEOSAUDIO_CloseDevice;
+ impl->Deinitialize = BEOSAUDIO_Deinitialize;
+ impl->ProvidesOwnCallbackThread = 1;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+extern "C"
+{
+ extern AudioBootStrap BEOSAUDIO_bootstrap;
+}
+AudioBootStrap BEOSAUDIO_bootstrap = {
+ "baudio", "BeOS BSoundPlayer", BEOSAUDIO_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.h b/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.h
index 8495cb636..f009ca1ee 100644
--- a/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/baudio/SDL_beaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,19 +21,19 @@
*/
#include "SDL_config.h"
-#ifndef _SDL_lowaudio_h
-#define _SDL_lowaudio_h
+#ifndef _SDL_beaudio_h
+#define _SDL_beaudio_h
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *_this
-struct SDL_PrivateAudioData {
- BSoundPlayer *audio_obj;
+struct SDL_PrivateAudioData
+{
+ BSoundPlayer *audio_obj;
};
-/* Old variable names */
-#define audio_obj (_this->hidden->audio_obj)
+#endif /* _SDL_beaudio_h */
-#endif /* _SDL_lowaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.c b/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.c
index f5db02088..5d5db8a19 100644
--- a/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.c
@@ -1,20 +1,20 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
@@ -61,344 +61,396 @@
/* #define DEBUG_AUDIO_STREAM */
#ifdef USE_BLOCKING_WRITES
-#define OPEN_FLAGS O_WRONLY
+#define OPEN_FLAGS_OUTPUT O_WRONLY
+#define OPEN_FLAGS_INPUT O_RDONLY
#else
-#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK)
+#define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK)
+#define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK)
#endif
-/* Audio driver functions */
-static void OBSD_WaitAudio(_THIS);
-static int OBSD_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void OBSD_PlayAudio(_THIS);
-static Uint8 *OBSD_GetAudioBuf(_THIS);
-static void OBSD_CloseAudio(_THIS);
+/* !!! FIXME: so much cut and paste with dsp/dma drivers... */
+static char **outputDevices = NULL;
+static int outputDeviceCount = 0;
+static char **inputDevices = NULL;
+static int inputDeviceCount = 0;
-#ifdef DEBUG_AUDIO
-static void OBSD_Status(_THIS);
-#endif
-
-/* Audio driver bootstrap functions */
-
-static int
-Audio_Available(void)
+static inline void
+free_device_list(char ***devs, int *count)
{
- int fd;
- int available;
-
- available = 0;
- fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
- if(fd >= 0) {
- available = 1;
- close(fd);
- }
- return(available);
+ SDL_FreeUnixAudioDevices(devs, count);
}
+static inline void
+build_device_list(int iscapture, char ***devs, int *count)
+{
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ free_device_list(devs, count);
+ SDL_EnumUnixAudioDevices(flags, 0, NULL, devs, count);
+}
+
+static inline void
+build_device_lists(void)
+{
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ build_device_list(1, &inputDevices, &inputDeviceCount);
+}
+
+
+static inline void
+free_device_lists(void)
+{
+ free_device_list(&outputDevices, &outputDeviceCount);
+ free_device_list(&inputDevices, &inputDeviceCount);
+}
+
+
static void
-Audio_DeleteDevice(SDL_AudioDevice *device)
+BSDAUDIO_Deinitialize(void)
{
- SDL_free(device->hidden);
- SDL_free(device);
+ free_device_lists();
}
-static SDL_AudioDevice
-*Audio_CreateDevice(int devindex)
+
+static int
+BSDAUDIO_DetectDevices(int iscapture)
{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice*)SDL_malloc(sizeof(SDL_AudioDevice));
- if(this) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden =
- (struct SDL_PrivateAudioData*)SDL_malloc((sizeof *this->hidden));
+ if (iscapture) {
+ build_device_list(1, &inputDevices, &inputDeviceCount);
+ return inputDeviceCount;
+ } else {
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ return outputDeviceCount;
}
- if((this == NULL) || (this->hidden == NULL)) {
- SDL_OutOfMemory();
- if(this) SDL_free(this);
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- audio_fd = -1;
- /* Set the function pointers */
- this->OpenAudio = OBSD_OpenAudio;
- this->WaitAudio = OBSD_WaitAudio;
- this->PlayAudio = OBSD_PlayAudio;
- this->GetAudioBuf = OBSD_GetAudioBuf;
- this->CloseAudio = OBSD_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
+ return 0; /* shouldn't ever hit this. */
+}
+
+static const char *
+BSDAUDIO_GetDeviceName(int index, int iscapture)
+{
+ if ((iscapture) && (index < inputDeviceCount)) {
+ return inputDevices[index];
+ } else if ((!iscapture) && (index < outputDeviceCount)) {
+ return outputDevices[index];
+ }
+
+ SDL_SetError("No such device");
+ return NULL;
+}
+
+
+static void
+BSDAUDIO_Status(_THIS)
+{
+#ifdef DEBUG_AUDIO
+ /* *INDENT-OFF* */
+ audio_info_t info;
+
+ if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) {
+ fprintf(stderr, "AUDIO_GETINFO failed.\n");
+ return;
+ }
+ fprintf(stderr, "\n"
+ "[play/record info]\n"
+ "buffer size : %d bytes\n"
+ "sample rate : %i Hz\n"
+ "channels : %i\n"
+ "precision : %i-bit\n"
+ "encoding : 0x%x\n"
+ "seek : %i\n"
+ "sample count : %i\n"
+ "EOF count : %i\n"
+ "paused : %s\n"
+ "error occured : %s\n"
+ "waiting : %s\n"
+ "active : %s\n"
+ "",
+ info.play.buffer_size,
+ info.play.sample_rate,
+ info.play.channels,
+ info.play.precision,
+ info.play.encoding,
+ info.play.seek,
+ info.play.samples,
+ info.play.eof,
+ info.play.pause ? "yes" : "no",
+ info.play.error ? "yes" : "no",
+ info.play.waiting ? "yes" : "no",
+ info.play.active ? "yes" : "no");
+
+ fprintf(stderr, "\n"
+ "[audio info]\n"
+ "monitor_gain : %i\n"
+ "hw block size : %d bytes\n"
+ "hi watermark : %i\n"
+ "lo watermark : %i\n"
+ "audio mode : %s\n"
+ "",
+ info.monitor_gain,
+ info.blocksize,
+ info.hiwat, info.lowat,
+ (info.mode == AUMODE_PLAY) ? "PLAY"
+ : (info.mode = AUMODE_RECORD) ? "RECORD"
+ : (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL" : "?"));
+ /* *INDENT-ON* */
+#endif /* DEBUG_AUDIO */
}
-AudioBootStrap BSD_AUDIO_bootstrap = {
- BSD_AUDIO_DRIVER_NAME, BSD_AUDIO_DRIVER_DESC,
- Audio_Available, Audio_CreateDevice
-};
/* This function waits until it is possible to write a full sound buffer */
static void
-OBSD_WaitAudio(_THIS)
+BSDAUDIO_WaitDevice(_THIS)
{
-#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */
- /* See if we need to use timed audio synchronization */
- if ( frame_ticks ) {
- /* Use timer for general audio synchronization */
- Sint32 ticks;
+#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */
+ /* See if we need to use timed audio synchronization */
+ if (this->hidden->frame_ticks) {
+ /* Use timer for general audio synchronization */
+ Sint32 ticks;
- ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS;
- if ( ticks > 0 ) {
- SDL_Delay(ticks);
- }
- } else {
- /* Use select() for audio synchronization */
- fd_set fdset;
- struct timeval timeout;
+ ticks =
+ ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) -
+ FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
+ } else {
+ /* Use select() for audio synchronization */
+ fd_set fdset;
+ struct timeval timeout;
- FD_ZERO(&fdset);
- FD_SET(audio_fd, &fdset);
- timeout.tv_sec = 10;
- timeout.tv_usec = 0;
+ FD_ZERO(&fdset);
+ FD_SET(this->hidden->audio_fd, &fdset);
+ timeout.tv_sec = 10;
+ timeout.tv_usec = 0;
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Waiting for audio to get ready\n");
+ fprintf(stderr, "Waiting for audio to get ready\n");
#endif
- if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) {
- const char *message =
- "Audio timeout - buggy audio driver? (disabled)";
- /* In general we should never print to the screen,
- but in this case we have no other way of letting
- the user know what happened.
- */
- fprintf(stderr, "SDL: %s\n", message);
- this->enabled = 0;
- /* Don't try to close - may hang */
- audio_fd = -1;
+ if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout)
+ <= 0) {
+ const char *message =
+ "Audio timeout - buggy audio driver? (disabled)";
+ /* In general we should never print to the screen,
+ but in this case we have no other way of letting
+ the user know what happened.
+ */
+ fprintf(stderr, "SDL: %s\n", message);
+ this->enabled = 0;
+ /* Don't try to close - may hang */
+ this->hidden->audio_fd = -1;
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Done disabling audio\n");
+ fprintf(stderr, "Done disabling audio\n");
#endif
- }
+ }
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Ready!\n");
+ fprintf(stderr, "Ready!\n");
#endif
- }
+ }
#endif /* !USE_BLOCKING_WRITES */
}
static void
-OBSD_PlayAudio(_THIS)
+BSDAUDIO_PlayDevice(_THIS)
{
- int written, p=0;
+ int written, p = 0;
- /* Write the audio data, checking for EAGAIN on broken audio drivers */
- do {
- written = write(audio_fd, &mixbuf[p], mixlen-p);
- if (written>0)
- p += written;
- if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR)
- {
- /* Non recoverable error has occurred. It should be reported!!! */
- perror("audio");
- break;
- }
+ /* Write the audio data, checking for EAGAIN on broken audio drivers */
+ do {
+ written = write(this->hidden->audio_fd,
+ &this->hidden->mixbuf[p], this->hidden->mixlen - p);
- if ( p < written || ((written < 0) && ((errno == 0) || (errno == EAGAIN))) ) {
- SDL_Delay(1); /* Let a little CPU time go by */
- }
- } while ( p < written );
+ if (written > 0)
+ p += written;
+ if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) {
+ /* Non recoverable error has occurred. It should be reported!!! */
+ perror("audio");
+ break;
+ }
- /* If timer synchronization is enabled, set the next write frame */
- if ( frame_ticks ) {
- next_frame += frame_ticks;
- }
+ if (p < written
+ || ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) {
+ SDL_Delay(1); /* Let a little CPU time go by */
+ }
+ } while (p < written);
- /* If we couldn't write, assume fatal error for now */
- if ( written < 0 ) {
- this->enabled = 0;
- }
+ /* If timer synchronization is enabled, set the next write frame */
+ if (this->hidden->frame_ticks) {
+ this->hidden->next_frame += this->hidden->frame_ticks;
+ }
+
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ this->enabled = 0;
+ }
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
#endif
}
-static Uint8
-*OBSD_GetAudioBuf(_THIS)
+static Uint8 *
+BSDAUDIO_GetDeviceBuf(_THIS)
{
- return(mixbuf);
+ return (this->hidden->mixbuf);
}
static void
-OBSD_CloseAudio(_THIS)
+BSDAUDIO_CloseDevice(_THIS)
{
- if(mixbuf != NULL) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if(audio_fd >= 0) {
- close(audio_fd);
- audio_fd = -1;
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->audio_fd >= 0) {
+ close(this->hidden->audio_fd);
+ this->hidden->audio_fd = -1;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
}
}
-#ifdef DEBUG_AUDIO
-void
-OBSD_Status(_THIS)
-{
- audio_info_t info;
-
- if(ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) {
- fprintf(stderr,"AUDIO_GETINFO failed.\n");
- return;
- }
-
- fprintf(stderr,"\n"
-"[play/record info]\n"
-"buffer size : %d bytes\n"
-"sample rate : %i Hz\n"
-"channels : %i\n"
-"precision : %i-bit\n"
-"encoding : 0x%x\n"
-"seek : %i\n"
-"sample count : %i\n"
-"EOF count : %i\n"
-"paused : %s\n"
-"error occured : %s\n"
-"waiting : %s\n"
-"active : %s\n"
-"",
- info.play.buffer_size,
- info.play.sample_rate,
- info.play.channels,
- info.play.precision,
- info.play.encoding,
- info.play.seek,
- info.play.samples,
- info.play.eof,
- info.play.pause ? "yes" : "no",
- info.play.error ? "yes" : "no",
- info.play.waiting ? "yes" : "no",
- info.play.active ? "yes": "no");
-
- fprintf(stderr,"\n"
-"[audio info]\n"
-"monitor_gain : %i\n"
-"hw block size : %d bytes\n"
-"hi watermark : %i\n"
-"lo watermark : %i\n"
-"audio mode : %s\n"
-"",
- info.monitor_gain,
- info.blocksize,
- info.hiwat, info.lowat,
- (info.mode == AUMODE_PLAY) ? "PLAY"
- : (info.mode = AUMODE_RECORD) ? "RECORD"
- : (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL"
- : "?"));
-}
-#endif /* DEBUG_AUDIO */
-
static int
-OBSD_OpenAudio(_THIS, SDL_AudioSpec *spec)
+BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
{
- char audiodev[64];
- Uint16 format;
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ SDL_AudioFormat format = 0;
audio_info_t info;
- AUDIO_INITINFO(&info);
-
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
+ /* We don't care what the devname is...we'll try to open anything. */
+ /* ...but default to first name in the list... */
+ if (devname == NULL) {
+ if (((iscapture) && (inputDeviceCount == 0)) ||
+ ((!iscapture) && (outputDeviceCount == 0))) {
+ SDL_SetError("No such audio device");
+ return 0;
+ }
+ devname = ((iscapture) ? inputDevices[0] : outputDevices[0]);
+ }
-#ifdef USE_TIMER_SYNC
- frame_ticks = 0.0;
-#endif
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
/* Open the audio device */
- audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
- if(audio_fd < 0) {
- SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
- return(-1);
+ this->hidden->audio_fd = open(devname, flags, 0);
+ if (this->hidden->audio_fd < 0) {
+ SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
+ return 0;
}
-
+
+ AUDIO_INITINFO(&info);
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
/* Set to play mode */
info.mode = AUMODE_PLAY;
- if(ioctl(audio_fd, AUDIO_SETINFO, &info) < 0) {
- SDL_SetError("Couldn't put device into play mode");
- return(-1);
- }
-
- mixbuf = NULL;
- AUDIO_INITINFO(&info);
- for (format = SDL_FirstAudioFormat(spec->format);
- format; format = SDL_NextAudioFormat())
- {
- switch(format) {
- case AUDIO_U8:
- info.play.encoding = AUDIO_ENCODING_ULINEAR;
- info.play.precision = 8;
- break;
- case AUDIO_S8:
- info.play.encoding = AUDIO_ENCODING_SLINEAR;
- info.play.precision = 8;
- break;
- case AUDIO_S16LSB:
- info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
- info.play.precision = 16;
- break;
- case AUDIO_S16MSB:
- info.play.encoding = AUDIO_ENCODING_SLINEAR_BE;
- info.play.precision = 16;
- break;
- case AUDIO_U16LSB:
- info.play.encoding = AUDIO_ENCODING_ULINEAR_LE;
- info.play.precision = 16;
- break;
- case AUDIO_U16MSB:
- info.play.encoding = AUDIO_ENCODING_ULINEAR_BE;
- info.play.precision = 16;
- break;
- default:
- continue;
- }
- if (ioctl(audio_fd, AUDIO_SETINFO, &info) == 0)
- break;
+ if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) {
+ BSDAUDIO_CloseDevice(this);
+ SDL_SetError("Couldn't put device into play mode");
+ return 0;
}
- if(!format) {
- SDL_SetError("No supported encoding for 0x%x", spec->format);
- return(-1);
+ AUDIO_INITINFO(&info);
+ for (format = SDL_FirstAudioFormat(this->spec.format);
+ format; format = SDL_NextAudioFormat()) {
+ switch (format) {
+ case AUDIO_U8:
+ info.play.encoding = AUDIO_ENCODING_ULINEAR;
+ info.play.precision = 8;
+ break;
+ case AUDIO_S8:
+ info.play.encoding = AUDIO_ENCODING_SLINEAR;
+ info.play.precision = 8;
+ break;
+ case AUDIO_S16LSB:
+ info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
+ info.play.precision = 16;
+ break;
+ case AUDIO_S16MSB:
+ info.play.encoding = AUDIO_ENCODING_SLINEAR_BE;
+ info.play.precision = 16;
+ break;
+ case AUDIO_U16LSB:
+ info.play.encoding = AUDIO_ENCODING_ULINEAR_LE;
+ info.play.precision = 16;
+ break;
+ case AUDIO_U16MSB:
+ info.play.encoding = AUDIO_ENCODING_ULINEAR_BE;
+ info.play.precision = 16;
+ break;
+ default:
+ continue;
+ }
+
+ if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) {
+ break;
+ }
}
- spec->format = format;
+ if (!format) {
+ BSDAUDIO_CloseDevice(this);
+ SDL_SetError("No supported encoding for 0x%x", this->spec.format);
+ return 0;
+ }
+
+ this->spec.format = format;
AUDIO_INITINFO(&info);
- info.play.channels = spec->channels;
- if (ioctl(audio_fd, AUDIO_SETINFO, &info) == -1)
- spec->channels = 1;
+ info.play.channels = this->spec.channels;
+ if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == -1) {
+ this->spec.channels = 1;
+ }
AUDIO_INITINFO(&info);
- info.play.sample_rate = spec->freq;
- info.blocksize = spec->size;
+ info.play.sample_rate = this->spec.freq;
+ info.blocksize = this->spec.size;
info.hiwat = 5;
info.lowat = 3;
- (void)ioctl(audio_fd, AUDIO_SETINFO, &info);
- (void)ioctl(audio_fd, AUDIO_GETINFO, &info);
- spec->freq = info.play.sample_rate;
+ (void) ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info);
+ (void) ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info);
+ this->spec.freq = info.play.sample_rate;
/* Allocate mixing buffer */
- mixlen = spec->size;
- mixbuf = (Uint8*)SDL_AllocAudioMem(mixlen);
- if(mixbuf == NULL) {
- return(-1);
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ BSDAUDIO_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
}
- SDL_memset(mixbuf, spec->silence, spec->size);
-
- /* Get the parent process id (we're the parent of the audio thread) */
- parent = getpid();
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
-#ifdef DEBUG_AUDIO
- OBSD_Status(this);
-#endif
+ BSDAUDIO_Status(this);
/* We're ready to rock and roll. :-) */
- return(0);
+ return (0);
}
+
+static int
+BSDAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = BSDAUDIO_DetectDevices;
+ impl->GetDeviceName = BSDAUDIO_GetDeviceName;
+ impl->OpenDevice = BSDAUDIO_OpenDevice;
+ impl->PlayDevice = BSDAUDIO_PlayDevice;
+ impl->WaitDevice = BSDAUDIO_WaitDevice;
+ impl->GetDeviceBuf = BSDAUDIO_GetDeviceBuf;
+ impl->CloseDevice = BSDAUDIO_CloseDevice;
+ impl->Deinitialize = BSDAUDIO_Deinitialize;
+
+ build_device_lists();
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap BSD_AUDIO_bootstrap = {
+ BSD_AUDIO_DRIVER_NAME, BSD_AUDIO_DRIVER_DESC, BSDAUDIO_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.h b/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.h
index 3e9580936..298b2e9a9 100644
--- a/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/bsd/SDL_bsdaudio.h
@@ -1,28 +1,28 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
-#ifndef _SDL_openbsdaudio_h
-#define _SDL_openbsdaudio_h
+#ifndef _SDL_bsdaudio_h
+#define _SDL_bsdaudio_h
#include "../SDL_sysaudio.h"
@@ -38,21 +38,15 @@ struct SDL_PrivateAudioData
/* Raw mixing buffer */
Uint8 *mixbuf;
- int mixlen;
+ int mixlen;
/* Support for audio timing using a timer, in addition to select() */
float frame_ticks;
float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
-/* Old variable names */
-#define audio_fd (this->hidden->audio_fd)
-#define parent (this->hidden->parent)
-#define mixbuf (this->hidden->mixbuf)
-#define mixlen (this->hidden->mixlen)
-#define frame_ticks (this->hidden->frame_ticks)
-#define next_frame (this->hidden->next_frame)
+#endif /* _SDL_bsdaudio_h */
-#endif /* _SDL_openbsdaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.c b/alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.c
deleted file mode 100644
index 5ebe437a7..000000000
--- a/alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/* Allow access to a raw mixing buffer */
-
-#include "SDL_timer.h"
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "SDL_dart.h"
-
-// Buffer states:
-#define BUFFER_EMPTY 0
-#define BUFFER_USED 1
-
-typedef struct _tMixBufferDesc {
- int iBufferUsage; // BUFFER_EMPTY or BUFFER_USED
- SDL_AudioDevice *pSDLAudioDevice;
-} tMixBufferDesc, *pMixBufferDesc;
-
-
-//---------------------------------------------------------------------
-// DARTEventFunc
-//
-// This function is called by DART, when an event occures, like end of
-// playback of a buffer, etc...
-//---------------------------------------------------------------------
-LONG APIENTRY DARTEventFunc(ULONG ulStatus,
- PMCI_MIX_BUFFER pBuffer,
- ULONG ulFlags)
-{
- if (ulFlags && MIX_WRITE_COMPLETE)
- { // Playback of buffer completed!
-
- // Get pointer to buffer description
- pMixBufferDesc pBufDesc;
-
- if (pBuffer)
- {
- pBufDesc = (pMixBufferDesc) (*pBuffer).ulUserParm;
-
- if (pBufDesc)
- {
- SDL_AudioDevice *pSDLAudioDevice = pBufDesc->pSDLAudioDevice;
- // Set the buffer to be empty
- pBufDesc->iBufferUsage = BUFFER_EMPTY;
- // And notify DART feeder thread that it will have to work a bit.
- if (pSDLAudioDevice)
- DosPostEventSem(pSDLAudioDevice->hidden->hevAudioBufferPlayed);
- }
- }
- }
- return TRUE;
-}
-
-
-int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- Uint16 test_format = SDL_FirstAudioFormat(spec->format);
- int valid_datatype = 0;
- MCI_AMP_OPEN_PARMS AmpOpenParms;
- MCI_GENERIC_PARMS GenericParms;
- int iDeviceOrd = 0; // Default device to be used
- int bOpenShared = 1; // Try opening it shared
- int iBits = 16; // Default is 16 bits signed
- int iFreq = 44100; // Default is 44KHz
- int iChannels = 2; // Default is 2 channels (Stereo)
- int iNumBufs = 2; // Number of audio buffers: 2
- int iBufSize;
- int iOpenMode;
- int iSilence;
- int rc;
-
- // First thing is to try to open a given DART device!
- SDL_memset(&AmpOpenParms, 0, sizeof(MCI_AMP_OPEN_PARMS));
- // pszDeviceType should contain the device type in low word, and device ordinal in high word!
- AmpOpenParms.pszDeviceType = (PSZ) (MCI_DEVTYPE_AUDIO_AMPMIX | (iDeviceOrd << 16));
-
- iOpenMode = MCI_WAIT | MCI_OPEN_TYPE_ID;
- if (bOpenShared) iOpenMode |= MCI_OPEN_SHAREABLE;
-
- rc = mciSendCommand( 0, MCI_OPEN,
- iOpenMode,
- (PVOID) &AmpOpenParms, 0);
- if (rc!=MCIERR_SUCCESS) // No audio available??
- return (-1);
- // Save the device ID we got from DART!
- // We will use this in the next calls!
- iDeviceOrd = AmpOpenParms.usDeviceID;
-
- // Determine the audio parameters from the AudioSpec
- if (spec->channels > 2)
- spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
-
- while ((!valid_datatype) && (test_format)) {
- spec->format = test_format;
- valid_datatype = 1;
- switch (test_format) {
- case AUDIO_U8:
- // Unsigned 8 bit audio data
- iSilence = 0x80;
- iBits = 8;
- break;
-
- case AUDIO_S16LSB:
- // Signed 16 bit audio data
- iSilence = 0x00;
- iBits = 16;
- break;
-
- default:
- valid_datatype = 0;
- test_format = SDL_NextAudioFormat();
- break;
- }
- }
-
- if (!valid_datatype) { // shouldn't happen, but just in case...
- // Close DART, and exit with error code!
- mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
- SDL_SetError("Unsupported audio format");
- return (-1);
- }
-
- iFreq = spec->freq;
- iChannels = spec->channels;
- /* Update the fragment size as size in bytes */
- SDL_CalculateAudioSpec(spec);
- iBufSize = spec->size;
-
- // Now query this device if it supports the given freq/bits/channels!
- SDL_memset(&(_this->hidden->MixSetupParms), 0, sizeof(MCI_MIXSETUP_PARMS));
- _this->hidden->MixSetupParms.ulBitsPerSample = iBits;
- _this->hidden->MixSetupParms.ulFormatTag = MCI_WAVE_FORMAT_PCM;
- _this->hidden->MixSetupParms.ulSamplesPerSec = iFreq;
- _this->hidden->MixSetupParms.ulChannels = iChannels;
- _this->hidden->MixSetupParms.ulFormatMode = MCI_PLAY;
- _this->hidden->MixSetupParms.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO;
- _this->hidden->MixSetupParms.pmixEvent = DARTEventFunc;
- rc = mciSendCommand (iDeviceOrd, MCI_MIXSETUP,
- MCI_WAIT | MCI_MIXSETUP_QUERYMODE,
- &(_this->hidden->MixSetupParms), 0);
- if (rc!=MCIERR_SUCCESS)
- { // The device cannot handle this format!
- // Close DART, and exit with error code!
- mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
- SDL_SetError("Audio device doesn't support requested audio format");
- return(-1);
- }
- // The device can handle this format, so initialize!
- rc = mciSendCommand(iDeviceOrd, MCI_MIXSETUP,
- MCI_WAIT | MCI_MIXSETUP_INIT,
- &(_this->hidden->MixSetupParms), 0);
- if (rc!=MCIERR_SUCCESS)
- { // The device could not be opened!
- // Close DART, and exit with error code!
- mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
- SDL_SetError("Audio device could not be set up");
- return(-1);
- }
- // Ok, the device is initialized.
- // Now we should allocate buffers. For this, we need a place where
- // the buffer descriptors will be:
- _this->hidden->pMixBuffers = (MCI_MIX_BUFFER *) SDL_malloc(sizeof(MCI_MIX_BUFFER)*iNumBufs);
- if (!(_this->hidden->pMixBuffers))
- { // Not enough memory!
- // Close DART, and exit with error code!
- mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
- SDL_SetError("Not enough memory for audio buffer descriptors");
- return(-1);
- }
- // Now that we have the place for buffer list, we can ask DART for the
- // buffers!
- _this->hidden->BufferParms.ulNumBuffers = iNumBufs; // Number of buffers
- _this->hidden->BufferParms.ulBufferSize = iBufSize; // each with this size
- _this->hidden->BufferParms.pBufList = _this->hidden->pMixBuffers; // getting descriptorts into this list
- // Allocate buffers!
- rc = mciSendCommand(iDeviceOrd, MCI_BUFFER,
- MCI_WAIT | MCI_ALLOCATE_MEMORY,
- &(_this->hidden->BufferParms), 0);
- if ((rc!=MCIERR_SUCCESS) || (iNumBufs != _this->hidden->BufferParms.ulNumBuffers) || (_this->hidden->BufferParms.ulBufferSize==0))
- { // Could not allocate memory!
- // Close DART, and exit with error code!
- SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
- mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
- SDL_SetError("DART could not allocate buffers");
- return(-1);
- }
- // Ok, we have all the buffers allocated, let's mark them!
- {
- int i;
- for (i=0; ihidden->pMixBuffers[i].pBuffer)) || (!pBufferDesc))
- { // Wrong buffer!
- // Close DART, and exit with error code!
- // Free buffer descriptions
- { int j;
- for (j=0; jhidden->pMixBuffers[j].ulUserParm));
- }
- // and cleanup
- mciSendCommand(iDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0);
- SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
- mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
- SDL_SetError("Error at internal buffer check");
- return(-1);
- }
- pBufferDesc->iBufferUsage = BUFFER_EMPTY;
- pBufferDesc->pSDLAudioDevice = _this;
-
- _this->hidden->pMixBuffers[i].ulBufferLength = _this->hidden->BufferParms.ulBufferSize;
- _this->hidden->pMixBuffers[i].ulUserParm = (ULONG) pBufferDesc; // User parameter: Description of buffer
- _this->hidden->pMixBuffers[i].ulFlags = 0; // Some stuff should be flagged here for DART, like end of
- // audio data, but as we will continously send
- // audio data, there will be no end.:)
- SDL_memset(_this->hidden->pMixBuffers[i].pBuffer, iSilence, iBufSize);
- }
- }
- _this->hidden->iNextFreeBuffer = 0;
- _this->hidden->iLastPlayedBuf = -1;
- // Create event semaphore
- if (DosCreateEventSem(NULL, &(_this->hidden->hevAudioBufferPlayed), 0, FALSE)!=NO_ERROR)
- {
- // Could not create event semaphore!
- {
- int i;
- for (i=0; ihidden->pMixBuffers[i].ulUserParm));
- }
- mciSendCommand(iDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0);
- SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
- mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
- SDL_SetError("Could not create event semaphore");
- return(-1);
- }
-
- // Store the new settings in global variables
- _this->hidden->iCurrDeviceOrd = iDeviceOrd;
- _this->hidden->iCurrFreq = iFreq;
- _this->hidden->iCurrBits = iBits;
- _this->hidden->iCurrChannels = iChannels;
- _this->hidden->iCurrNumBufs = iNumBufs;
- _this->hidden->iCurrBufSize = iBufSize;
-
- return (0);
-}
-
-
-
-void DART_ThreadInit(_THIS)
-{
- return;
-}
-
-/* This function waits until it is possible to write a full sound buffer */
-void DART_WaitAudio(_THIS)
-{
- int i;
- pMixBufferDesc pBufDesc;
- ULONG ulPostCount;
-
- DosResetEventSem(_this->hidden->hevAudioBufferPlayed, &ulPostCount);
- // If there is already an empty buffer, then return now!
- for (i=0; i<_this->hidden->iCurrNumBufs; i++)
- {
- pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[i].ulUserParm;
- if (pBufDesc->iBufferUsage == BUFFER_EMPTY)
- return;
- }
- // If there is no empty buffer, wait for one to be empty!
- DosWaitEventSem(_this->hidden->hevAudioBufferPlayed, 1000); // Wait max 1 sec!!! Important!
- return;
-}
-
-void DART_PlayAudio(_THIS)
-{
- int iFreeBuf = _this->hidden->iNextFreeBuffer;
- pMixBufferDesc pBufDesc;
-
- pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf].ulUserParm;
- pBufDesc->iBufferUsage = BUFFER_USED;
- // Send it to DART to be queued
- _this->hidden->MixSetupParms.pmixWrite(_this->hidden->MixSetupParms.ulMixHandle,
- &(_this->hidden->pMixBuffers[iFreeBuf]), 1);
-
- _this->hidden->iLastPlayedBuf = iFreeBuf;
- iFreeBuf = (iFreeBuf+1) % _this->hidden->iCurrNumBufs;
- _this->hidden->iNextFreeBuffer = iFreeBuf;
-}
-
-Uint8 *DART_GetAudioBuf(_THIS)
-{
- int iFreeBuf;
- Uint8 *pResult;
- pMixBufferDesc pBufDesc;
-
- if (_this)
- {
- if (_this->hidden)
- {
- iFreeBuf = _this->hidden->iNextFreeBuffer;
- pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf].ulUserParm;
-
- if (pBufDesc)
- {
- if (pBufDesc->iBufferUsage == BUFFER_EMPTY)
- {
- pResult = _this->hidden->pMixBuffers[iFreeBuf].pBuffer;
- return pResult;
- }
- } else
- printf("[DART_GetAudioBuf] : ERROR! pBufDesc = %p\n", pBufDesc);
- } else
- printf("[DART_GetAudioBuf] : ERROR! _this->hidden = %p\n", _this->hidden);
- } else
- printf("[DART_GetAudioBuf] : ERROR! _this = %p\n", _this);
- return NULL;
-}
-
-void DART_WaitDone(_THIS)
-{
- pMixBufferDesc pBufDesc;
- ULONG ulPostCount;
- APIRET rc;
-
- pBufDesc = (pMixBufferDesc) _this->hidden->pMixBuffers[_this->hidden->iLastPlayedBuf].ulUserParm;
- rc = NO_ERROR;
- while ((pBufDesc->iBufferUsage != BUFFER_EMPTY) && (rc==NO_ERROR))
- {
- DosResetEventSem(_this->hidden->hevAudioBufferPlayed, &ulPostCount);
- rc = DosWaitEventSem(_this->hidden->hevAudioBufferPlayed, 1000); // 1 sec timeout! Important!
- }
-}
-
-void DART_CloseAudio(_THIS)
-{
- MCI_GENERIC_PARMS GenericParms;
- int rc;
-
- // Stop DART playback
- rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_STOP, MCI_WAIT, &GenericParms, 0);
- if (rc!=MCIERR_SUCCESS)
- {
-#ifdef SFX_DEBUG_BUILD
- printf("Could not stop DART playback!\n");
- fflush(stdout);
-#endif
- }
-
- // Close event semaphore
- DosCloseEventSem(_this->hidden->hevAudioBufferPlayed);
-
- // Free memory of buffer descriptions
- {
- int i;
- for (i=0; i<_this->hidden->iCurrNumBufs; i++) SDL_free((void *)(_this->hidden->pMixBuffers[i].ulUserParm));
- }
-
- // Deallocate buffers
- rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, &(_this->hidden->BufferParms), 0);
-
- // Free bufferlist
- SDL_free(_this->hidden->pMixBuffers); _this->hidden->pMixBuffers = NULL;
-
- // Close dart
- rc = mciSendCommand(_this->hidden->iCurrDeviceOrd, MCI_CLOSE, MCI_WAIT, &(GenericParms), 0);
-}
-
-/* Audio driver bootstrap functions */
-
-int Audio_Available(void)
-{
- return(1);
-}
-
-void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this )
- {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) )
- {
- SDL_OutOfMemory();
- if ( this )
- SDL_free(this);
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = DART_OpenAudio;
- this->ThreadInit = DART_ThreadInit;
- this->WaitAudio = DART_WaitAudio;
- this->PlayAudio = DART_PlayAudio;
- this->GetAudioBuf = DART_GetAudioBuf;
- this->WaitDone = DART_WaitDone;
- this->CloseAudio = DART_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap DART_bootstrap = {
- "dart", "OS/2 Direct Audio RouTines (DART)",
- Audio_Available, Audio_CreateDevice
-};
-
diff --git a/alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.h b/alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.h
deleted file mode 100644
index 1f75a35c6..000000000
--- a/alienblaster/project/jni/sdl/src/audio/dart/SDL_dart.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#ifndef _SDL_lowaudio_h
-#define _SDL_lowaudio_h
-
-#define INCL_TYPES
-#define INCL_DOSSEMAPHORES
-#define INCL_DOSRESOURCES
-#define INCL_DOSMISC
-#define INCL_DOSERRORS
-
-#define INCL_OS2MM
-#define INCL_MMIOOS2
-#define INCL_MCIOS2
-#include
-#include // DART stuff and MMIO stuff
-
-#include "../SDL_sysaudio.h"
-
-/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *_this
-
-/* The DirectSound objects */
-struct SDL_PrivateAudioData
-{
- int iCurrDeviceOrd;
- int iCurrFreq;
- int iCurrBits;
- int iCurrChannels;
- int iCurrNumBufs;
- int iCurrBufSize;
-
- int iLastPlayedBuf;
- int iNextFreeBuffer;
-
- MCI_BUFFER_PARMS BufferParms; // Sound buffer parameters
- MCI_MIX_BUFFER *pMixBuffers; // Sound buffers
- MCI_MIXSETUP_PARMS MixSetupParms; // Mixer setup parameters
- HEV hevAudioBufferPlayed; // Event semaphore to indicate that an audio buffer has been played by DART
-};
-
-#endif /* _SDL_lowaudio_h */
diff --git a/alienblaster/project/jni/sdl/src/audio/dc/SDL_dcaudio.c b/alienblaster/project/jni/sdl/src/audio/dc/SDL_dcaudio.c
deleted file mode 100644
index 8a2c7d20f..000000000
--- a/alienblaster/project/jni/sdl/src/audio/dc/SDL_dcaudio.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-
-*/
-#include "SDL_config.h"
-
-/* Output dreamcast aica */
-
-#include "SDL_timer.h"
-#include "SDL_audio.h"
-#include "../SDL_audiomem.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
-#include "SDL_dcaudio.h"
-
-#include "aica.h"
-#include
-
-/* Audio driver functions */
-static int DCAUD_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void DCAUD_WaitAudio(_THIS);
-static void DCAUD_PlayAudio(_THIS);
-static Uint8 *DCAUD_GetAudioBuf(_THIS);
-static void DCAUD_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-static int DCAUD_Available(void)
-{
- return 1;
-}
-
-static void DCAUD_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *DCAUD_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = DCAUD_OpenAudio;
- this->WaitAudio = DCAUD_WaitAudio;
- this->PlayAudio = DCAUD_PlayAudio;
- this->GetAudioBuf = DCAUD_GetAudioBuf;
- this->CloseAudio = DCAUD_CloseAudio;
-
- this->free = DCAUD_DeleteDevice;
-
- spu_init();
-
- return this;
-}
-
-AudioBootStrap DCAUD_bootstrap = {
- "dcaudio", "Dreamcast AICA audio",
- DCAUD_Available, DCAUD_CreateDevice
-};
-
-/* This function waits until it is possible to write a full sound buffer */
-static void DCAUD_WaitAudio(_THIS)
-{
- if (this->hidden->playing) {
- /* wait */
- while(aica_get_pos(0)/this->spec.samples == this->hidden->nextbuf) {
- thd_pass();
- }
- }
-}
-
-#define SPU_RAM_BASE 0xa0800000
-
-static void spu_memload_stereo8(int leftpos,int rightpos,void *src0,size_t size)
-{
- uint8 *src = src0;
- uint32 *left = (uint32*)(leftpos +SPU_RAM_BASE);
- uint32 *right = (uint32*)(rightpos+SPU_RAM_BASE);
- size = (size+7)/8;
- while(size--) {
- unsigned lval,rval;
- lval = *src++;
- rval = *src++;
- lval|= (*src++)<<8;
- rval|= (*src++)<<8;
- lval|= (*src++)<<16;
- rval|= (*src++)<<16;
- lval|= (*src++)<<24;
- rval|= (*src++)<<24;
- g2_write_32(left++,lval);
- g2_write_32(right++,rval);
- g2_fifo_wait();
- }
-}
-
-static void spu_memload_stereo16(int leftpos,int rightpos,void *src0,size_t size)
-{
- uint16 *src = src0;
- uint32 *left = (uint32*)(leftpos +SPU_RAM_BASE);
- uint32 *right = (uint32*)(rightpos+SPU_RAM_BASE);
- size = (size+7)/8;
- while(size--) {
- unsigned lval,rval;
- lval = *src++;
- rval = *src++;
- lval|= (*src++)<<16;
- rval|= (*src++)<<16;
- g2_write_32(left++,lval);
- g2_write_32(right++,rval);
- g2_fifo_wait();
- }
-}
-
-static void DCAUD_PlayAudio(_THIS)
-{
- SDL_AudioSpec *spec = &this->spec;
- unsigned int offset;
-
- if (this->hidden->playing) {
- /* wait */
- while(aica_get_pos(0)/spec->samples == this->hidden->nextbuf) {
- thd_pass();
- }
- }
-
- offset = this->hidden->nextbuf*spec->size;
- this->hidden->nextbuf^=1;
- /* Write the audio data, checking for EAGAIN on broken audio drivers */
- if (spec->channels==1) {
- spu_memload(this->hidden->leftpos+offset,this->hidden->mixbuf,this->hidden->mixlen);
- } else {
- offset/=2;
- if ((this->spec.format&255)==8) {
- spu_memload_stereo8(this->hidden->leftpos+offset,this->hidden->rightpos+offset,this->hidden->mixbuf,this->hidden->mixlen);
- } else {
- spu_memload_stereo16(this->hidden->leftpos+offset,this->hidden->rightpos+offset,this->hidden->mixbuf,this->hidden->mixlen);
- }
- }
-
- if (!this->hidden->playing) {
- int mode;
- this->hidden->playing = 1;
- mode = (spec->format==AUDIO_S8)?SM_8BIT:SM_16BIT;
- if (spec->channels==1) {
- aica_play(0,mode,this->hidden->leftpos,0,spec->samples*2,spec->freq,255,128,1);
- } else {
- aica_play(0,mode,this->hidden->leftpos ,0,spec->samples*2,spec->freq,255,0,1);
- aica_play(1,mode,this->hidden->rightpos,0,spec->samples*2,spec->freq,255,255,1);
- }
- }
-}
-
-static Uint8 *DCAUD_GetAudioBuf(_THIS)
-{
- return(this->hidden->mixbuf);
-}
-
-static void DCAUD_CloseAudio(_THIS)
-{
- aica_stop(0);
- if (this->spec.channels==2) aica_stop(1);
- if ( this->hidden->mixbuf != NULL ) {
- SDL_FreeAudioMem(this->hidden->mixbuf);
- this->hidden->mixbuf = NULL;
- }
-}
-
-static int DCAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- Uint16 test_format = SDL_FirstAudioFormat(spec->format);
- int valid_datatype = 0;
- while ((!valid_datatype) && (test_format)) {
- spec->format = test_format;
- switch (test_format) {
- /* only formats Dreamcast accepts... */
- case AUDIO_S8:
- case AUDIO_S16LSB:
- valid_datatype = 1;
- break;
-
- default:
- test_format = SDL_NextAudioFormat();
- break;
- }
- }
-
- if (!valid_datatype) { /* shouldn't happen, but just in case... */
- SDL_SetError("Unsupported audio format");
- return (-1);
- }
-
- if (spec->channels > 2)
- spec->channels = 2; /* no more than stereo on the Dreamcast. */
-
- /* Update the fragment size as size in bytes */
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate mixing buffer */
- this->hidden->mixlen = spec->size;
- this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
- if ( this->hidden->mixbuf == NULL ) {
- return(-1);
- }
- SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
- this->hidden->leftpos = 0x11000;
- this->hidden->rightpos = 0x11000+spec->size;
- this->hidden->playing = 0;
- this->hidden->nextbuf = 0;
-
- /* We're ready to rock and roll. :-) */
- return(0);
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/dc/aica.c b/alienblaster/project/jni/sdl/src/audio/dc/aica.c
deleted file mode 100644
index b6a1c9364..000000000
--- a/alienblaster/project/jni/sdl/src/audio/dc/aica.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* This file is part of the Dreamcast function library.
- * Please see libdream.c for further details.
- *
- * (c)2000 Dan Potter
- * modify BERO
- */
-#include "aica.h"
-
-#include
-#include
-
-/* #define dc_snd_base ((volatile unsigned char *)0x00800000) */ /* arm side */
-#define dc_snd_base ((volatile unsigned char *)0xa0700000) /* dc side */
-
-/* Some convienence macros */
-#define SNDREGADDR(x) (0xa0700000 + (x))
-#define CHNREGADDR(ch,x) SNDREGADDR(0x80*(ch)+(x))
-
-
-#define SNDREG32(x) (*(volatile unsigned long *)SNDREGADDR(x))
-#define SNDREG8(x) (*(volatile unsigned char *)SNDREGADDR(x))
-#define CHNREG32(ch, x) (*(volatile unsigned long *)CHNREGADDR(ch,x))
-#define CHNREG8(ch, x) (*(volatile unsigned long *)CHNREGADDR(ch,x))
-
-#define G2_LOCK(OLD) \
- do { \
- if (!irq_inside_int()) \
- OLD = irq_disable(); \
- /* suspend any G2 DMA here... */ \
- while((*(volatile unsigned int *)0xa05f688c) & 0x20) \
- ; \
- } while(0)
-
-#define G2_UNLOCK(OLD) \
- do { \
- /* resume any G2 DMA here... */ \
- if (!irq_inside_int()) \
- irq_restore(OLD); \
- } while(0)
-
-
-void aica_init() {
- int i, j, old = 0;
-
- /* Initialize AICA channels */
- G2_LOCK(old);
- SNDREG32(0x2800) = 0x0000;
-
- for (i=0; i<64; i++) {
- for (j=0; j<0x80; j+=4) {
- if ((j&31)==0) g2_fifo_wait();
- CHNREG32(i, j) = 0;
- }
- g2_fifo_wait();
- CHNREG32(i,0) = 0x8000;
- CHNREG32(i,20) = 0x1f;
- }
-
- SNDREG32(0x2800) = 0x000f;
- g2_fifo_wait();
- G2_UNLOCK(old);
-}
-
-/* Translates a volume from linear form to logarithmic form (required by
- the AICA chip */
-/* int logs[] = {
-
-0, 40, 50, 58, 63, 68, 73, 77, 80, 83, 86, 89, 92, 94, 97, 99, 101, 103,
-105, 107, 109, 111, 112, 114, 116, 117, 119, 120, 122, 123, 125, 126, 127,
-129, 130, 131, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145,
-146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159,
-160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 170, 171,
-172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182,
-182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191,
-191, 192, 193, 193, 194, 194, 195, 196, 196, 197, 197, 198, 198, 199, 199,
-200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, 206, 206, 207, 207,
-208, 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215,
-215, 216, 216, 217, 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222,
-222, 222, 223, 223, 224, 224, 225, 225, 225, 226, 226, 227, 227, 228, 228,
-228, 229, 229, 230, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234,
-234, 235, 235, 236, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240,
-240, 241, 241, 241, 242, 242, 243, 243, 243, 244, 244, 244, 245, 245, 245,
-246, 246, 247, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251,
-251, 251, 252, 252, 252, 253, 253, 253, 254, 254, 254, 255
-
-}; */
-
-const static unsigned char logs[] = {
- 0, 15, 22, 27, 31, 35, 39, 42, 45, 47, 50, 52, 55, 57, 59, 61,
- 63, 65, 67, 69, 71, 73, 74, 76, 78, 79, 81, 82, 84, 85, 87, 88,
- 90, 91, 92, 94, 95, 96, 98, 99, 100, 102, 103, 104, 105, 106,
- 108, 109, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 121,
- 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 145, 146,
- 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156,
- 157, 158, 159, 160, 160, 161, 162, 163, 164, 164, 165, 166, 167,
- 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176,
- 177, 178, 178, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185,
- 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194,
- 195, 195, 196, 197, 197, 198, 199, 199, 200, 200, 201, 202, 202,
- 203, 204, 204, 205, 205, 206, 207, 207, 208, 209, 209, 210, 210,
- 211, 212, 212, 213, 213, 214, 215, 215, 216, 216, 217, 217, 218,
- 219, 219, 220, 220, 221, 221, 222, 223, 223, 224, 224, 225, 225,
- 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 232, 232, 233,
- 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 239, 239, 240,
- 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246,
- 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 254, 255
-};
-
-/* For the moment this is going to have to suffice, until we really
- figure out what these mean. */
-#define AICA_PAN(x) ((x)==0x80?(0):((x)<0x80?(0x1f):(0x0f)))
-#define AICA_VOL(x) (0xff - logs[128 + (((x) & 0xff) / 2)])
-//#define AICA_VOL(x) (0xff - logs[x&255])
-
-static inline unsigned AICA_FREQ(unsigned freq) {
- unsigned long freq_lo, freq_base = 5644800;
- int freq_hi = 7;
-
- /* Need to convert frequency to floating point format
- (freq_hi is exponent, freq_lo is mantissa)
- Formula is ferq = 44100*2^freq_hi*(1+freq_lo/1024) */
- while (freq < freq_base && freq_hi > -8) {
- freq_base >>= 1;
- --freq_hi;
- }
- while (freq < freq_base && freq_hi > -8) {
- freq_base >>= 1;
- freq_hi--;
- }
- freq_lo = (freq<<10) / freq_base;
- return (freq_hi << 11) | (freq_lo & 1023);
-}
-
-/* Sets up a sound channel completely. This is generally good if you want
- a quick and dirty way to play notes. If you want a more comprehensive
- set of routines (more like PC wavetable cards) see below.
-
- ch is the channel to play on (0 - 63)
- smpptr is the pointer to the sound data; if you're running off the
- SH4, then this ought to be (ptr - 0xa0800000); otherwise it's just
- ptr. Basically, it's an offset into sound ram.
- mode is one of the mode constants (16 bit, 8 bit, ADPCM)
- nsamp is the number of samples to play (not number of bytes!)
- freq is the sampling rate of the sound
- vol is the volume, 0 to 0xff (0xff is louder)
- pan is a panning constant -- 0 is left, 128 is center, 255 is right.
-
- This routine (and the similar ones) owe a lot to Marcus' sound example --
- I hadn't gotten quite this far into dissecting the individual regs yet. */
-void aica_play(int ch,int mode,unsigned long smpptr,int loopst,int loopend,int freq,int vol,int pan,int loopflag) {
-/* int i;
-*/
- int val;
- int old = 0;
-
- /* Stop the channel (if it's already playing) */
- aica_stop(ch);
- /* doesn't seem to be needed, but it's here just in case */
-/*
- for (i=0; i<256; i++) {
- asm("nop");
- asm("nop");
- asm("nop");
- asm("nop");
- }
-*/
- G2_LOCK(old);
- /* Envelope setup. The first of these is the loop point,
- e.g., where the sample starts over when it loops. The second
- is the loop end. This is the full length of the sample when
- you are not looping, or the loop end point when you are (though
- storing more than that is a waste of memory if you're not doing
- volume enveloping). */
- CHNREG32(ch, 8) = loopst & 0xffff;
- CHNREG32(ch, 12) = loopend & 0xffff;
-
- /* Write resulting values */
- CHNREG32(ch, 24) = AICA_FREQ(freq);
-
- /* Set volume, pan, and some other things that we don't know what
- they do =) */
- CHNREG32(ch, 36) = AICA_PAN(pan) | (0xf<<8);
- /* Convert the incoming volume and pan into hardware values */
- /* Vol starts at zero so we can ramp */
- vol = AICA_VOL(vol);
- CHNREG32(ch, 40) = 0x24 | (vol<<8);
- /* Convert the incoming volume and pan into hardware values */
- /* Vol starts at zero so we can ramp */
-
- /* If we supported volume envelopes (which we don't yet) then
- this value would set that up. The top 4 bits determine the
- envelope speed. f is the fastest, 1 is the slowest, and 0
- seems to be an invalid value and does weird things). The
- default (below) sets it into normal mode (play and terminate/loop).
- CHNREG32(ch, 16) = 0xf010;
- */
- CHNREG32(ch, 16) = 0x1f; /* No volume envelope */
-
-
- /* Set sample format, buffer address, and looping control. If
- 0x0200 mask is set on reg 0, the sample loops infinitely. If
- it's not set, the sample plays once and terminates. We'll
- also set the bits to start playback here. */
- CHNREG32(ch, 4) = smpptr & 0xffff;
- val = 0xc000 | 0x0000 | (mode<<7) | (smpptr >> 16);
- if (loopflag) val|=0x200;
-
- CHNREG32(ch, 0) = val;
-
- G2_UNLOCK(old);
-
- /* Enable playback */
- /* CHNREG32(ch, 0) |= 0xc000; */
- g2_fifo_wait();
-
-#if 0
- for (i=0xff; i>=vol; i--) {
- if ((i&7)==0) g2_fifo_wait();
- CHNREG32(ch, 40) = 0x24 | (i<<8);;
- }
-
- g2_fifo_wait();
-#endif
-}
-
-/* Stop the sound on a given channel */
-void aica_stop(int ch) {
- g2_write_32(CHNREGADDR(ch, 0),(g2_read_32(CHNREGADDR(ch, 0)) & ~0x4000) | 0x8000);
- g2_fifo_wait();
-}
-
-
-/* The rest of these routines can change the channel in mid-stride so you
- can do things like vibrato and panning effects. */
-
-/* Set channel volume */
-void aica_vol(int ch,int vol) {
-// g2_write_8(CHNREGADDR(ch, 41),AICA_VOL(vol));
- g2_write_32(CHNREGADDR(ch, 40),(g2_read_32(CHNREGADDR(ch, 40))&0xffff00ff)|(AICA_VOL(vol)<<8) );
- g2_fifo_wait();
-}
-
-/* Set channel pan */
-void aica_pan(int ch,int pan) {
-// g2_write_8(CHNREGADDR(ch, 36),AICA_PAN(pan));
- g2_write_32(CHNREGADDR(ch, 36),(g2_read_32(CHNREGADDR(ch, 36))&0xffffff00)|(AICA_PAN(pan)) );
- g2_fifo_wait();
-}
-
-/* Set channel frequency */
-void aica_freq(int ch,int freq) {
- g2_write_32(CHNREGADDR(ch, 24),AICA_FREQ(freq));
- g2_fifo_wait();
-}
-
-/* Get channel position */
-int aica_get_pos(int ch) {
-#if 1
- /* Observe channel ch */
- g2_write_32(SNDREGADDR(0x280c),(g2_read_32(SNDREGADDR(0x280c))&0xffff00ff) | (ch<<8));
- g2_fifo_wait();
- /* Update position counters */
- return g2_read_32(SNDREGADDR(0x2814)) & 0xffff;
-#else
- /* Observe channel ch */
- g2_write_8(SNDREGADDR(0x280d),ch);
- /* Update position counters */
- return g2_read_32(SNDREGADDR(0x2814)) & 0xffff;
-#endif
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.c b/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.c
index fd3595c54..4fa89a893 100644
--- a/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,6 @@
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
#include "SDL_diskaudio.h"
/* The tag name used by DISK audio */
@@ -46,141 +45,124 @@
#define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY"
#define DISKDEFAULT_WRITEDELAY 150
-/* Audio driver functions */
-static int DISKAUD_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void DISKAUD_WaitAudio(_THIS);
-static void DISKAUD_PlayAudio(_THIS);
-static Uint8 *DISKAUD_GetAudioBuf(_THIS);
-static void DISKAUD_CloseAudio(_THIS);
-
-static const char *DISKAUD_GetOutputFilename(void)
+static const char *
+DISKAUD_GetOutputFilename(const char *devname)
{
- const char *envr = SDL_getenv(DISKENVR_OUTFILE);
- return((envr != NULL) ? envr : DISKDEFAULT_OUTFILE);
+ if (devname == NULL) {
+ devname = SDL_getenv(DISKENVR_OUTFILE);
+ if (devname == NULL) {
+ devname = DISKDEFAULT_OUTFILE;
+ }
+ }
+ return devname;
}
-/* Audio driver bootstrap functions */
-static int DISKAUD_Available(void)
+/* This function waits until it is possible to write a full sound buffer */
+static void
+DISKAUD_WaitDevice(_THIS)
{
- const char *envr = SDL_getenv("SDL_AUDIODRIVER");
- if (envr && (SDL_strcmp(envr, DISKAUD_DRIVER_NAME) == 0)) {
- return(1);
- }
- return(0);
+ SDL_Delay(this->hidden->write_delay);
}
-static void DISKAUD_DeleteDevice(SDL_AudioDevice *device)
+static void
+DISKAUD_PlayDevice(_THIS)
{
- SDL_free(device->hidden);
- SDL_free(device);
+ size_t written;
+
+ /* Write the audio data */
+ written = SDL_RWwrite(this->hidden->output,
+ this->hidden->mixbuf, 1, this->hidden->mixlen);
+
+ /* If we couldn't write, assume fatal error for now */
+ if (written != this->hidden->mixlen) {
+ this->enabled = 0;
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
}
-static SDL_AudioDevice *DISKAUD_CreateDevice(int devindex)
+static Uint8 *
+DISKAUD_GetDeviceBuf(_THIS)
{
- SDL_AudioDevice *this;
- const char *envr;
+ return (this->hidden->mixbuf);
+}
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+static void
+DISKAUD_CloseDevice(_THIS)
+{
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->output != NULL) {
+ SDL_RWclose(this->hidden->output);
+ this->hidden->output = NULL;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
- envr = SDL_getenv(DISKENVR_WRITEDELAY);
- this->hidden->write_delay = (envr) ? SDL_atoi(envr) : DISKDEFAULT_WRITEDELAY;
+static int
+DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ const char *envr = SDL_getenv(DISKENVR_WRITEDELAY);
+ const char *fname = DISKAUD_GetOutputFilename(devname);
- /* Set the function pointers */
- this->OpenAudio = DISKAUD_OpenAudio;
- this->WaitAudio = DISKAUD_WaitAudio;
- this->PlayAudio = DISKAUD_PlayAudio;
- this->GetAudioBuf = DISKAUD_GetAudioBuf;
- this->CloseAudio = DISKAUD_CloseAudio;
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc(sizeof(*this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, sizeof(*this->hidden));
- this->free = DISKAUD_DeleteDevice;
+ /* Open the audio device */
+ this->hidden->output = SDL_RWFromFile(fname, "wb");
+ if (this->hidden->output == NULL) {
+ DISKAUD_CloseDevice(this);
+ return 0;
+ }
- return this;
+ /* Allocate mixing buffer */
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ DISKAUD_CloseDevice(this);
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->write_delay =
+ (envr) ? SDL_atoi(envr) : DISKDEFAULT_WRITEDELAY;
+
+#if HAVE_STDIO_H
+ fprintf(stderr,
+ "WARNING: You are using the SDL disk writer audio driver!\n"
+ " Writing to file [%s].\n", fname);
+#endif
+
+ /* We're ready to rock and roll. :-) */
+ return 1;
+}
+
+static int
+DISKAUD_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = DISKAUD_OpenDevice;
+ impl->WaitDevice = DISKAUD_WaitDevice;
+ impl->PlayDevice = DISKAUD_PlayDevice;
+ impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
+ impl->CloseDevice = DISKAUD_CloseDevice;
+
+ return 1; /* this audio target is available. */
}
AudioBootStrap DISKAUD_bootstrap = {
- DISKAUD_DRIVER_NAME, "direct-to-disk audio",
- DISKAUD_Available, DISKAUD_CreateDevice
+ DISKAUD_DRIVER_NAME, "direct-to-disk audio", DISKAUD_Init, 1
};
-/* This function waits until it is possible to write a full sound buffer */
-static void DISKAUD_WaitAudio(_THIS)
-{
- SDL_Delay(this->hidden->write_delay);
-}
-
-static void DISKAUD_PlayAudio(_THIS)
-{
- int written;
-
- /* Write the audio data */
- written = SDL_RWwrite(this->hidden->output,
- this->hidden->mixbuf, 1,
- this->hidden->mixlen);
-
- /* If we couldn't write, assume fatal error for now */
- if ( (Uint32)written != this->hidden->mixlen ) {
- this->enabled = 0;
- }
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Wrote %d bytes of audio data\n", written);
-#endif
-}
-
-static Uint8 *DISKAUD_GetAudioBuf(_THIS)
-{
- return(this->hidden->mixbuf);
-}
-
-static void DISKAUD_CloseAudio(_THIS)
-{
- if ( this->hidden->mixbuf != NULL ) {
- SDL_FreeAudioMem(this->hidden->mixbuf);
- this->hidden->mixbuf = NULL;
- }
- if ( this->hidden->output != NULL ) {
- SDL_RWclose(this->hidden->output);
- this->hidden->output = NULL;
- }
-}
-
-static int DISKAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- const char *fname = DISKAUD_GetOutputFilename();
-
- /* Open the audio device */
- this->hidden->output = SDL_RWFromFile(fname, "wb");
- if ( this->hidden->output == NULL ) {
- return(-1);
- }
-
-#if HAVE_STDIO_H
- fprintf(stderr, "WARNING: You are using the SDL disk writer"
- " audio driver!\n Writing to file [%s].\n", fname);
-#endif
-
- /* Allocate mixing buffer */
- this->hidden->mixlen = spec->size;
- this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
- if ( this->hidden->mixbuf == NULL ) {
- return(-1);
- }
- SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
-
- /* We're ready to rock and roll. :-) */
- return(0);
-}
-
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.h b/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.h
index 76f060768..9d0902a49 100644
--- a/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/disk/SDL_diskaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -27,15 +27,17 @@
#include "SDL_rwops.h"
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- SDL_RWops *output;
- Uint8 *mixbuf;
- Uint32 mixlen;
- Uint32 write_delay;
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ SDL_RWops *output;
+ Uint8 *mixbuf;
+ Uint32 mixlen;
+ Uint32 write_delay;
};
#endif /* _SDL_diskaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.c b/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.c
index 6b607ecee..bd2008918 100644
--- a/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,10 +21,12 @@
*/
#include "SDL_config.h"
+/* !!! FIXME: merge this driver with "dsp". */
+
/* Allow access to a raw mixing buffer */
#include
-#include /* For strerror() */
+#include /* For strerror() */
#include
#include
#include
@@ -40,7 +42,7 @@
#include
#else
/* This is recommended by OSS */
-#include
+#include
#endif
#ifndef MAP_FAILED
@@ -57,399 +59,477 @@
#define DMA_DRIVER_NAME "dma"
/* Open the audio device for playback, and don't block if busy */
-#define OPEN_FLAGS (O_RDWR|O_NONBLOCK)
+#define OPEN_FLAGS_INPUT (O_RDWR|O_NONBLOCK)
+#define OPEN_FLAGS_OUTPUT (O_RDWR|O_NONBLOCK)
-/* Audio driver functions */
-static int DMA_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void DMA_WaitAudio(_THIS);
-static void DMA_PlayAudio(_THIS);
-static Uint8 *DMA_GetAudioBuf(_THIS);
-static void DMA_CloseAudio(_THIS);
+static char **outputDevices = NULL;
+static int outputDeviceCount = 0;
+static char **inputDevices = NULL;
+static int inputDeviceCount = 0;
-/* Audio driver bootstrap functions */
-
-static int Audio_Available(void)
+static int
+test_for_mmap(int fd)
{
- int available;
- int fd;
-
- available = 0;
-
- fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
- if ( fd >= 0 ) {
- int caps;
- struct audio_buf_info info;
-
- if ( (ioctl(fd, SNDCTL_DSP_GETCAPS, &caps) == 0) &&
- (caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) &&
- (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == 0) ) {
- available = 1;
- }
- close(fd);
- }
- return(available);
+ int caps = 0;
+ struct audio_buf_info info;
+ if ((ioctl(fd, SNDCTL_DSP_GETCAPS, &caps) == 0) &&
+ (caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) &&
+ (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == 0)) {
+ size_t len = info.fragstotal * info.fragsize;
+ Uint8 *buf = (Uint8 *) mmap(NULL, len, PROT_WRITE, MAP_SHARED, fd, 0);
+ if (buf != MAP_FAILED) {
+ munmap(buf, len);
+ return 1;
+ }
+ }
+ return 0;
}
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
+
+static inline void
+free_device_list(char ***devs, int *count)
{
- SDL_free(device->hidden);
- SDL_free(device);
+ SDL_FreeUnixAudioDevices(devs, count);
}
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
+static inline void
+build_device_list(int iscapture, char ***devs, int *count)
{
- SDL_AudioDevice *this;
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ free_device_list(devs, count);
+ SDL_EnumUnixAudioDevices(flags, 0, test_for_mmap, devs, count);
+}
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- audio_fd = -1;
+static inline void
+build_device_lists(void)
+{
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ build_device_list(1, &inputDevices, &inputDeviceCount);
+}
- /* Set the function pointers */
- this->OpenAudio = DMA_OpenAudio;
- this->WaitAudio = DMA_WaitAudio;
- this->PlayAudio = DMA_PlayAudio;
- this->GetAudioBuf = DMA_GetAudioBuf;
- this->CloseAudio = DMA_CloseAudio;
- this->free = Audio_DeleteDevice;
+static inline void
+free_device_lists(void)
+{
+ free_device_list(&outputDevices, &outputDeviceCount);
+ free_device_list(&inputDevices, &inputDeviceCount);
+}
- return this;
+
+static void
+DMA_Deinitialize(void)
+{
+ free_device_lists();
+}
+
+static int
+DMA_DetectDevices(int iscapture)
+{
+ if (iscapture) {
+ build_device_list(1, &inputDevices, &inputDeviceCount);
+ return inputDeviceCount;
+ } else {
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ return outputDeviceCount;
+ }
+
+ return 0; /* shouldn't ever hit this. */
+}
+
+
+static const char *
+DMA_GetDeviceName(int index, int iscapture)
+{
+ if ((iscapture) && (index < inputDeviceCount)) {
+ return inputDevices[index];
+ } else if ((!iscapture) && (index < outputDeviceCount)) {
+ return outputDevices[index];
+ }
+
+ SDL_SetError("No such device");
+ return NULL;
+}
+
+
+static int
+DMA_ReopenAudio(_THIS, const char *audiodev, int format, int stereo)
+{
+ int frag_spec;
+ int value;
+
+ /* Close and then reopen the audio device */
+ close(audio_fd);
+ audio_fd = open(audiodev, O_RDWR, 0);
+ if (audio_fd < 0) {
+ SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
+ return (-1);
+ }
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Determine the power of two of the fragment size */
+ for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec);
+ if ((0x01 << frag_spec) != this->spec.size) {
+ SDL_SetError("Fragment size must be a power of two");
+ return (-1);
+ }
+
+ /* Set the audio buffering parameters */
+ if (ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0) {
+ SDL_SetError("Couldn't set audio fragment spec");
+ return (-1);
+ }
+
+ /* Set the audio format */
+ value = format;
+ if ((ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || (value != format)) {
+ SDL_SetError("Couldn't set audio format");
+ return (-1);
+ }
+
+ /* Set mono or stereo audio */
+ value = (this->spec.channels > 1);
+ if ((ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo) < 0) ||
+ (value != stereo)) {
+ SDL_SetError("Couldn't set audio channels");
+ return (-1);
+ }
+
+ /* Set the DSP frequency */
+ value = this->spec.freq;
+ if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &value) < 0) {
+ SDL_SetError("Couldn't set audio frequency");
+ return (-1);
+ }
+ this->spec.freq = value;
+
+ /* We successfully re-opened the audio */
+ return (0);
+}
+
+
+static void
+DMA_CloseDevice(_THIS)
+{
+ if (this->hidden != NULL) {
+ if (dma_buf != NULL) {
+ munmap(dma_buf, dma_len);
+ dma_buf = NULL;
+ }
+ if (audio_fd >= 0) {
+ close(audio_fd);
+ audio_fd = -1;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
+
+
+static int
+DMA_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ int format;
+ int stereo;
+ int value;
+ SDL_AudioFormat test_format;
+ struct audio_buf_info info;
+
+ /* We don't care what the devname is...we'll try to open anything. */
+ /* ...but default to first name in the list... */
+ if (devname == NULL) {
+ if (((iscapture) && (inputDeviceCount == 0)) ||
+ ((!iscapture) && (outputDeviceCount == 0))) {
+ SDL_SetError("No such audio device");
+ return 0;
+ }
+ devname = ((iscapture) ? inputDevices[0] : outputDevices[0]);
+ }
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+
+ /* Open the audio device */
+ audio_fd = open(devname, flags, 0);
+ if (audio_fd < 0) {
+ DMA_CloseDevice(this);
+ SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
+ return 0;
+ }
+ dma_buf = NULL;
+ ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
+
+ /* Get a list of supported hardware formats */
+ if (ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) {
+ DMA_CloseDevice(this);
+ SDL_SetError("Couldn't get audio format list");
+ return 0;
+ }
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ if (value & AFMT_U8) {
+ format = AFMT_U8;
+ }
+ break;
+ case AUDIO_S8:
+ if (value & AFMT_S8) {
+ format = AFMT_S8;
+ }
+ break;
+ case AUDIO_S16LSB:
+ if (value & AFMT_S16_LE) {
+ format = AFMT_S16_LE;
+ }
+ break;
+ case AUDIO_S16MSB:
+ if (value & AFMT_S16_BE) {
+ format = AFMT_S16_BE;
+ }
+ break;
+ case AUDIO_U16LSB:
+ if (value & AFMT_U16_LE) {
+ format = AFMT_U16_LE;
+ }
+ break;
+ case AUDIO_U16MSB:
+ if (value & AFMT_U16_BE) {
+ format = AFMT_U16_BE;
+ }
+ break;
+ default:
+ format = 0;
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+ DMA_CloseDevice(this);
+ SDL_SetError("Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
+
+ /* Set the audio format */
+ value = format;
+ if ((ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || (value != format)) {
+ DMA_CloseDevice(this);
+ SDL_SetError("Couldn't set audio format");
+ return 0;
+ }
+
+ /* Set mono or stereo audio (currently only two channels supported) */
+ stereo = (this->spec.channels > 1);
+ ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo);
+ if (stereo) {
+ this->spec.channels = 2;
+ } else {
+ this->spec.channels = 1;
+ }
+
+ /* Because some drivers don't allow setting the buffer size
+ after setting the format, we must re-open the audio device
+ once we know what format and channels are supported
+ */
+ if (DMA_ReopenAudio(this, devname, format, stereo) < 0) {
+ DMA_CloseDevice(this);
+ /* Error is set by DMA_ReopenAudio() */
+ return 0;
+ }
+
+ /* Memory map the audio buffer */
+ if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) < 0) {
+ DMA_CloseDevice(this);
+ SDL_SetError("Couldn't get OSPACE parameters");
+ return 0;
+ }
+ this->spec.size = info.fragsize;
+ this->spec.samples = this->spec.size / ((this->spec.format & 0xFF) / 8);
+ this->spec.samples /= this->spec.channels;
+ num_buffers = info.fragstotal;
+ dma_len = num_buffers * this->spec.size;
+ dma_buf = (Uint8 *) mmap(NULL, dma_len, PROT_WRITE, MAP_SHARED,
+ audio_fd, 0);
+ if (dma_buf == MAP_FAILED) {
+ DMA_CloseDevice(this);
+ SDL_SetError("DMA memory map failed");
+ dma_buf = NULL;
+ return 0;
+ }
+ SDL_memset(dma_buf, this->spec.silence, dma_len);
+
+ /* Check to see if we need to use select() workaround */
+ {
+ char *workaround;
+ workaround = SDL_getenv("SDL_DSP_NOSELECT");
+ if (workaround) {
+ frame_ticks =
+ (float) (this->spec.samples * 1000) / this->spec.freq;
+ next_frame = SDL_GetTicks() + frame_ticks;
+ }
+ }
+
+ /* Trigger audio playback */
+ value = 0;
+ ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value);
+ value = PCM_ENABLE_OUTPUT;
+ if (ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value) < 0) {
+ DMA_CloseDevice(this);
+ SDL_SetError("Couldn't trigger audio output");
+ return 0;
+ }
+
+ /* Get the parent process id (we're the parent of the audio thread) */
+ parent = getpid();
+
+ /* We're ready to rock and roll. :-) */
+ return 1;
+}
+
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+DMA_WaitDevice(_THIS)
+{
+ fd_set fdset;
+
+ /* Check to see if the thread-parent process is still alive */
+ {
+ static int cnt = 0;
+ /* Note that this only works with thread implementations
+ that use a different process id for each thread.
+ */
+ if (parent && (((++cnt) % 10) == 0)) { /* Check every 10 loops */
+ if (kill(parent, 0) < 0 && errno == ESRCH) {
+ this->enabled = 0;
+ }
+ }
+ }
+
+ /* See if we need to use timed audio synchronization */
+ if (frame_ticks) {
+ /* Use timer for general audio synchronization */
+ Sint32 ticks;
+
+ ticks = ((Sint32) (next_frame - SDL_GetTicks())) - FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
+ } else {
+ /* Use select() for audio synchronization */
+ struct timeval timeout;
+ FD_ZERO(&fdset);
+ FD_SET(audio_fd, &fdset);
+ timeout.tv_sec = 10;
+ timeout.tv_usec = 0;
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Waiting for audio to get ready\n");
+#endif
+ if (select(audio_fd + 1, NULL, &fdset, NULL, &timeout) <= 0) {
+ const char *message =
+#ifdef AUDIO_OSPACE_HACK
+ "Audio timeout - buggy audio driver? (trying ospace)";
+#else
+ "Audio timeout - buggy audio driver? (disabled)";
+#endif
+ /* In general we should never print to the screen,
+ but in this case we have no other way of letting
+ the user know what happened.
+ */
+ fprintf(stderr, "SDL: %s\n", message);
+#ifdef AUDIO_OSPACE_HACK
+ /* We may be able to use GET_OSPACE trick */
+ frame_ticks = (float) (this->spec.samples * 1000) /
+ this->spec.freq;
+ next_frame = SDL_GetTicks() + frame_ticks;
+#else
+ this->enabled = 0;
+ /* Don't try to close - may hang */
+ audio_fd = -1;
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Done disabling audio\n");
+#endif
+#endif /* AUDIO_OSPACE_HACK */
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Ready!\n");
+#endif
+ }
+}
+
+static void
+DMA_PlayDevice(_THIS)
+{
+ /* If timer synchronization is enabled, set the next write frame */
+ if (frame_ticks) {
+ next_frame += frame_ticks;
+ }
+ return;
+}
+
+static Uint8 *
+DMA_GetDeviceBuf(_THIS)
+{
+ count_info info;
+ int playing;
+ int filling;
+
+ /* Get number of blocks, looping if we're not using select() */
+ do {
+ if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) < 0) {
+ /* Uh oh... */
+ this->enabled = 0;
+ return (NULL);
+ }
+ } while (frame_ticks && (info.blocks < 1));
+#ifdef DEBUG_AUDIO
+ if (info.blocks > 1) {
+ printf("Warning: audio underflow (%d frags)\n", info.blocks - 1);
+ }
+#endif
+ playing = info.ptr / this->spec.size;
+ filling = (playing + 1) % num_buffers;
+ return (dma_buf + (filling * this->spec.size));
+}
+
+
+static int
+DMA_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = DMA_DetectDevices;
+ impl->GetDeviceName = DMA_GetDeviceName;
+ impl->OpenDevice = DMA_OpenDevice;
+ impl->WaitDevice = DMA_WaitDevice;
+ impl->PlayDevice = DMA_PlayDevice;
+ impl->GetDeviceBuf = DMA_GetDeviceBuf;
+ impl->CloseDevice = DMA_CloseDevice;
+ impl->Deinitialize = DMA_Deinitialize;
+
+ build_device_lists();
+
+ return 1; /* this audio target is available. */
}
AudioBootStrap DMA_bootstrap = {
- DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio",
- Audio_Available, Audio_CreateDevice
+ DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio", DMA_Init, 0
};
-/* This function waits until it is possible to write a full sound buffer */
-static void DMA_WaitAudio(_THIS)
-{
- fd_set fdset;
-
- /* Check to see if the thread-parent process is still alive */
- { static int cnt = 0;
- /* Note that this only works with thread implementations
- that use a different process id for each thread.
- */
- if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
- if ( kill(parent, 0) < 0 ) {
- this->enabled = 0;
- }
- }
- }
-
- /* See if we need to use timed audio synchronization */
- if ( frame_ticks ) {
- /* Use timer for general audio synchronization */
- Sint32 ticks;
-
- ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS;
- if ( ticks > 0 ) {
- SDL_Delay(ticks);
- }
- } else {
- /* Use select() for audio synchronization */
- struct timeval timeout;
- FD_ZERO(&fdset);
- FD_SET(audio_fd, &fdset);
- timeout.tv_sec = 10;
- timeout.tv_usec = 0;
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Waiting for audio to get ready\n");
-#endif
- if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) {
- const char *message =
-#ifdef AUDIO_OSPACE_HACK
- "Audio timeout - buggy audio driver? (trying ospace)";
-#else
- "Audio timeout - buggy audio driver? (disabled)";
-#endif
- /* In general we should never print to the screen,
- but in this case we have no other way of letting
- the user know what happened.
- */
- fprintf(stderr, "SDL: %s\n", message);
-#ifdef AUDIO_OSPACE_HACK
- /* We may be able to use GET_OSPACE trick */
- frame_ticks = (float)(this->spec->samples*1000) /
- this->spec->freq;
- next_frame = SDL_GetTicks()+frame_ticks;
-#else
- this->enabled = 0;
- /* Don't try to close - may hang */
- audio_fd = -1;
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Done disabling audio\n");
-#endif
-#endif /* AUDIO_OSPACE_HACK */
- }
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Ready!\n");
-#endif
- }
-}
-
-static void DMA_PlayAudio(_THIS)
-{
- /* If timer synchronization is enabled, set the next write frame */
- if ( frame_ticks ) {
- next_frame += frame_ticks;
- }
- return;
-}
-
-static Uint8 *DMA_GetAudioBuf(_THIS)
-{
- count_info info;
- int playing;
- int filling;
-
- /* Get number of blocks, looping if we're not using select() */
- do {
- if ( ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) < 0 ) {
- /* Uh oh... */
- this->enabled = 0;
- return(NULL);
- }
- } while ( frame_ticks && (info.blocks < 1) );
-#ifdef DEBUG_AUDIO
- if ( info.blocks > 1 ) {
- printf("Warning: audio underflow (%d frags)\n", info.blocks-1);
- }
-#endif
- playing = info.ptr / this->spec.size;
- filling = (playing + 1)%num_buffers;
- return (dma_buf + (filling * this->spec.size));
-}
-
-static void DMA_CloseAudio(_THIS)
-{
- if ( dma_buf != NULL ) {
- munmap(dma_buf, dma_len);
- dma_buf = NULL;
- }
- if ( audio_fd >= 0 ) {
- close(audio_fd);
- audio_fd = -1;
- }
-}
-
-static int DMA_ReopenAudio(_THIS, const char *audiodev, int format, int stereo,
- SDL_AudioSpec *spec)
-{
- int frag_spec;
- int value;
-
- /* Close and then reopen the audio device */
- close(audio_fd);
- audio_fd = open(audiodev, O_RDWR, 0);
- if ( audio_fd < 0 ) {
- SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
- return(-1);
- }
-
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
-
- /* Determine the power of two of the fragment size */
- for ( frag_spec = 0; (0x01<size; ++frag_spec );
- if ( (0x01<size ) {
- SDL_SetError("Fragment size must be a power of two");
- return(-1);
- }
-
- /* Set the audio buffering parameters */
- if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) {
- SDL_SetError("Couldn't set audio fragment spec");
- return(-1);
- }
-
- /* Set the audio format */
- value = format;
- if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
- (value != format) ) {
- SDL_SetError("Couldn't set audio format");
- return(-1);
- }
-
- /* Set mono or stereo audio */
- value = (spec->channels > 1);
- if ( (ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo) < 0) ||
- (value != stereo) ) {
- SDL_SetError("Couldn't set audio channels");
- return(-1);
- }
-
- /* Set the DSP frequency */
- value = spec->freq;
- if ( ioctl(audio_fd, SNDCTL_DSP_SPEED, &value) < 0 ) {
- SDL_SetError("Couldn't set audio frequency");
- return(-1);
- }
- spec->freq = value;
-
- /* We successfully re-opened the audio */
- return(0);
-}
-
-static int DMA_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- char audiodev[1024];
- int format;
- int stereo;
- int value;
- Uint16 test_format;
- struct audio_buf_info info;
-
- /* Reset the timer synchronization flag */
- frame_ticks = 0.0;
-
- /* Open the audio device */
- audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
- if ( audio_fd < 0 ) {
- SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
- return(-1);
- }
- dma_buf = NULL;
- ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
-
- /* Get a list of supported hardware formats */
- if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) {
- SDL_SetError("Couldn't get audio format list");
- return(-1);
- }
-
- /* Try for a closest match on audio format */
- format = 0;
- for ( test_format = SDL_FirstAudioFormat(spec->format);
- ! format && test_format; ) {
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
-#endif
- switch ( test_format ) {
- case AUDIO_U8:
- if ( value & AFMT_U8 ) {
- format = AFMT_U8;
- }
- break;
- case AUDIO_S8:
- if ( value & AFMT_S8 ) {
- format = AFMT_S8;
- }
- break;
- case AUDIO_S16LSB:
- if ( value & AFMT_S16_LE ) {
- format = AFMT_S16_LE;
- }
- break;
- case AUDIO_S16MSB:
- if ( value & AFMT_S16_BE ) {
- format = AFMT_S16_BE;
- }
- break;
- case AUDIO_U16LSB:
- if ( value & AFMT_U16_LE ) {
- format = AFMT_U16_LE;
- }
- break;
- case AUDIO_U16MSB:
- if ( value & AFMT_U16_BE ) {
- format = AFMT_U16_BE;
- }
- break;
- default:
- format = 0;
- break;
- }
- if ( ! format ) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if ( format == 0 ) {
- SDL_SetError("Couldn't find any hardware audio formats");
- return(-1);
- }
- spec->format = test_format;
-
- /* Set the audio format */
- value = format;
- if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
- (value != format) ) {
- SDL_SetError("Couldn't set audio format");
- return(-1);
- }
-
- /* Set mono or stereo audio (currently only two channels supported) */
- stereo = (spec->channels > 1);
- ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo);
- if ( stereo ) {
- spec->channels = 2;
- } else {
- spec->channels = 1;
- }
-
- /* Because some drivers don't allow setting the buffer size
- after setting the format, we must re-open the audio device
- once we know what format and channels are supported
- */
- if ( DMA_ReopenAudio(this, audiodev, format, stereo, spec) < 0 ) {
- /* Error is set by DMA_ReopenAudio() */
- return(-1);
- }
-
- /* Memory map the audio buffer */
- if ( ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) < 0 ) {
- SDL_SetError("Couldn't get OSPACE parameters");
- return(-1);
- }
- spec->size = info.fragsize;
- spec->samples = spec->size / ((spec->format & 0xFF) / 8);
- spec->samples /= spec->channels;
- num_buffers = info.fragstotal;
- dma_len = num_buffers*spec->size;
- dma_buf = (Uint8 *)mmap(NULL, dma_len, PROT_WRITE, MAP_SHARED,
- audio_fd, 0);
- if ( dma_buf == MAP_FAILED ) {
- SDL_SetError("DMA memory map failed");
- dma_buf = NULL;
- return(-1);
- }
- SDL_memset(dma_buf, spec->silence, dma_len);
-
- /* Check to see if we need to use select() workaround */
- { char *workaround;
- workaround = SDL_getenv("SDL_DSP_NOSELECT");
- if ( workaround ) {
- frame_ticks = (float)(spec->samples*1000)/spec->freq;
- next_frame = SDL_GetTicks()+frame_ticks;
- }
- }
-
- /* Trigger audio playback */
- value = 0;
- ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value);
- value = PCM_ENABLE_OUTPUT;
- if ( ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value) < 0 ) {
- SDL_SetError("Couldn't trigger audio output");
- return(-1);
- }
-
- /* Get the parent process id (we're the parent of the audio thread) */
- parent = getpid();
-
- /* We're ready to rock and roll. :-) */
- return(0);
-}
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.h b/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.h
index 9874072aa..be0e582cc 100644
--- a/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/dma/SDL_dmaaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,33 +21,35 @@
*/
#include "SDL_config.h"
-#ifndef _SDL_dspaudio_h
-#define _SDL_dspaudio_h
+#ifndef _SDL_dmaaudio_h
+#define _SDL_dmaaudio_h
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- int audio_fd;
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
- /* The parent process id, to detect when application quits */
- pid_t parent;
+ /* The parent process id, to detect when application quits */
+ pid_t parent;
- /* Raw mixing buffer */
- Uint8 *dma_buf;
- int dma_len;
- int num_buffers;
+ /* Raw mixing buffer */
+ Uint8 *dma_buf;
+ int dma_len;
+ int num_buffers;
- /* Support for audio timing using a timer, in addition to select() */
- float frame_ticks;
- float next_frame;
+ /* Support for audio timing using a timer, in addition to select() */
+ float frame_ticks;
+ float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
/* Old variable names */
+/* !!! FIXME: remove these. */
#define audio_fd (this->hidden->audio_fd)
#define parent (this->hidden->parent)
#define dma_buf (this->hidden->dma_buf)
@@ -56,4 +58,6 @@ struct SDL_PrivateAudioData {
#define frame_ticks (this->hidden->frame_ticks)
#define next_frame (this->hidden->next_frame)
-#endif /* _SDL_dspaudio_h */
+#endif /* _SDL_dmaaudio_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.c b/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.c
index d17d09b65..bdc9c1bb6 100644
--- a/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,7 @@
Sam Lantinga
slouken@libsdl.org
*/
+#include
#include "SDL_config.h"
/* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */
@@ -31,7 +32,7 @@
#include "SDL_irixaudio.h"
-#ifndef AL_RESOURCE /* as a test whether we use the old IRIX audio libraries */
+#ifndef AL_RESOURCE /* as a test whether we use the old IRIX audio libraries */
#define OLD_IRIX_AUDIO
#define alClosePort(x) ALcloseport(x)
#define alFreeConfig(x) ALfreeconfig(x)
@@ -44,199 +45,194 @@
#define alSetWidth(x,y) ALsetwidth(x,y)
#endif
-/* Audio driver functions */
-static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void AL_WaitAudio(_THIS);
-static void AL_PlayAudio(_THIS);
-static Uint8 *AL_GetAudioBuf(_THIS);
-static void AL_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-
-static int Audio_Available(void)
+void static
+IRIXAUDIO_WaitDevice(_THIS)
{
- return 1;
+ Sint32 timeleft;
+
+ timeleft = this->spec.samples - alGetFillable(this->hidden->audio_port);
+ if (timeleft > 0) {
+ timeleft /= (this->spec.freq / 1000);
+ SDL_Delay((Uint32) timeleft);
+ }
}
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
+static void
+IRIXAUDIO_PlayDevice(_THIS)
{
- SDL_free(device->hidden);
- SDL_free(device);
+ /* Write the audio data out */
+ ALport port = this->hidden->audio_port;
+ Uint8 *mixbuf = this->hidden->mixbuf;
+ if (alWriteFrames(port, mixbuf, this->spec.samples) < 0) {
+ /* Assume fatal error, for now */
+ this->enabled = 0;
+ }
}
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
+static Uint8 *
+IRIXAUDIO_GetDeviceBuf(_THIS)
{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = AL_OpenAudio;
- this->WaitAudio = AL_WaitAudio;
- this->PlayAudio = AL_PlayAudio;
- this->GetAudioBuf = AL_GetAudioBuf;
- this->CloseAudio = AL_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
+ return (this->hidden->mixbuf);
}
-AudioBootStrap DMEDIA_bootstrap = {
- "AL", "IRIX DMedia audio",
- Audio_Available, Audio_CreateDevice
-};
-
-
-void static AL_WaitAudio(_THIS)
+static void
+IRIXAUDIO_CloseDevice(_THIS)
{
- Sint32 timeleft;
-
- timeleft = this->spec.samples - alGetFillable(audio_port);
- if ( timeleft > 0 ) {
- timeleft /= (this->spec.freq/1000);
- SDL_Delay((Uint32)timeleft);
- }
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->audio_port != NULL) {
+ alClosePort(this->hidden->audio_port);
+ this->hidden->audio_port = NULL;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
}
-static void AL_PlayAudio(_THIS)
+static int
+IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
{
- /* Write the audio data out */
- if ( alWriteFrames(audio_port, mixbuf, this->spec.samples) < 0 ) {
- /* Assume fatal error, for now */
- this->enabled = 0;
- }
-}
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ long width = 0;
+ long fmt = 0;
+ int valid = 0;
-static Uint8 *AL_GetAudioBuf(_THIS)
-{
- return(mixbuf);
-}
+ /* !!! FIXME: Handle multiple devices and capture? */
-static void AL_CloseAudio(_THIS)
-{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( audio_port != NULL ) {
- alClosePort(audio_port);
- audio_port = NULL;
- }
-}
-
-static int AL_OpenAudio(_THIS, SDL_AudioSpec * spec)
-{
- Uint16 test_format = SDL_FirstAudioFormat(spec->format);
- long width = 0;
- long fmt = 0;
- int valid = 0;
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
#ifdef OLD_IRIX_AUDIO
- {
- long audio_param[2];
- audio_param[0] = AL_OUTPUT_RATE;
- audio_param[1] = spec->freq;
- valid = (ALsetparams(AL_DEFAULT_DEVICE, audio_param, 2) < 0);
- }
+ {
+ long audio_param[2];
+ audio_param[0] = AL_OUTPUT_RATE;
+ audio_param[1] = this->spec.freq;
+ valid = (ALsetparams(AL_DEFAULT_DEVICE, audio_param, 2) < 0);
+ }
#else
- {
- ALpv audio_param;
- audio_param.param = AL_RATE;
- audio_param.value.i = spec->freq;
- valid = (alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0);
- }
+ {
+ ALpv audio_param;
+ audio_param.param = AL_RATE;
+ audio_param.value.i = this->spec.freq;
+ valid = (alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0);
+ }
#endif
- while ((!valid) && (test_format)) {
- valid = 1;
- spec->format = test_format;
+ while ((!valid) && (test_format)) {
+ valid = 1;
+ this->spec.format = test_format;
- switch (test_format) {
- case AUDIO_S8:
- width = AL_SAMPLE_8;
- fmt = AL_SAMPFMT_TWOSCOMP;
- break;
+ switch (test_format) {
+ case AUDIO_S8:
+ width = AL_SAMPLE_8;
+ fmt = AL_SAMPFMT_TWOSCOMP;
+ break;
- case AUDIO_S16SYS:
- width = AL_SAMPLE_16;
- fmt = AL_SAMPFMT_TWOSCOMP;
- break;
+ case AUDIO_S16SYS:
+ width = AL_SAMPLE_16;
+ fmt = AL_SAMPFMT_TWOSCOMP;
+ break;
- default:
- valid = 0;
- test_format = SDL_NextAudioFormat();
- break;
- }
+ case AUDIO_F32SYS:
+ width = 0; /* not used here... */
+ fmt = AL_SAMPFMT_FLOAT;
+ break;
- if (valid) {
- ALconfig audio_config = alNewConfig();
- valid = 0;
- if (audio_config) {
- if (alSetChannels(audio_config, spec->channels) < 0) {
- if (spec->channels > 2) { /* can't handle > stereo? */
- spec->channels = 2; /* try again below. */
- }
- }
+ /* Docs say there is int24, but not int32.... */
- if ((alSetSampFmt(audio_config, fmt) >= 0) &&
- ((!width) || (alSetWidth(audio_config, width) >= 0)) &&
- (alSetQueueSize(audio_config, spec->samples * 2) >= 0) &&
- (alSetChannels(audio_config, spec->channels) >= 0)) {
+ default:
+ valid = 0;
+ test_format = SDL_NextAudioFormat();
+ break;
+ }
- audio_port = alOpenPort("SDL audio", "w", audio_config);
- if (audio_port == NULL) {
- /* docs say AL_BAD_CHANNELS happens here, too. */
- int err = oserror();
- if (err == AL_BAD_CHANNELS) {
- spec->channels = 2;
- alSetChannels(audio_config, spec->channels);
- audio_port = alOpenPort("SDL audio", "w",
- audio_config);
- }
- }
+ if (valid) {
+ ALconfig audio_config = alNewConfig();
+ valid = 0;
+ if (audio_config) {
+ if (alSetChannels(audio_config, this->spec.channels) < 0) {
+ if (this->spec.channels > 2) { /* can't handle > stereo? */
+ this->spec.channels = 2; /* try again below. */
+ }
+ }
- if (audio_port != NULL) {
- valid = 1;
- }
- }
+ if ((alSetSampFmt(audio_config, fmt) >= 0) &&
+ ((!width) || (alSetWidth(audio_config, width) >= 0)) &&
+ (alSetQueueSize(audio_config, this->spec.samples * 2) >=
+ 0)
+ && (alSetChannels(audio_config, this->spec.channels) >=
+ 0)) {
- alFreeConfig(audio_config);
- }
- }
- }
+ this->hidden->audio_port = alOpenPort("SDL audio", "w",
+ audio_config);
+ if (this->hidden->audio_port == NULL) {
+ /* docs say AL_BAD_CHANNELS happens here, too. */
+ int err = oserror();
+ if (err == AL_BAD_CHANNELS) {
+ this->spec.channels = 2;
+ alSetChannels(audio_config, this->spec.channels);
+ this->hidden->audio_port =
+ alOpenPort("SDL audio", "w", audio_config);
+ }
+ }
- if (!valid) {
- SDL_SetError("Unsupported audio format");
- return (-1);
- }
+ if (this->hidden->audio_port != NULL) {
+ valid = 1;
+ }
+ }
- /* Update the fragment size as size in bytes */
- SDL_CalculateAudioSpec(spec);
+ alFreeConfig(audio_config);
+ }
+ }
+ }
- /* Allocate mixing buffer */
- mixbuf = (Uint8 *) SDL_AllocAudioMem(spec->size);
- if (mixbuf == NULL) {
- SDL_OutOfMemory();
- return (-1);
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
+ if (!valid) {
+ IRIXAUDIO_CloseDevice(this);
+ SDL_SetError("Unsupported audio format");
+ return 0;
+ }
- /* We're ready to rock and roll. :-) */
- return (0);
+ /* Update the fragment size as size in bytes */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->spec.size);
+ if (this->hidden->mixbuf == NULL) {
+ IRIXAUDIO_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /* We're ready to rock and roll. :-) */
+ return 1;
}
+static int
+IRIXAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = DSP_OpenDevice;
+ impl->PlayDevice = DSP_PlayDevice;
+ impl->WaitDevice = DSP_WaitDevice;
+ impl->GetDeviceBuf = DSP_GetDeviceBuf;
+ impl->CloseDevice = DSP_CloseDevice;
+ impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: not true, I think. */
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap IRIXAUDIO_bootstrap = {
+ "AL", "IRIX DMedia audio", IRIXAUDIO_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.h b/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.h
index f8bc43a23..adfb99f23 100644
--- a/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/dmedia/SDL_irixaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,8 @@
*/
#include "SDL_config.h"
-#ifndef _SDL_lowaudio_h
-#define _SDL_lowaudio_h
+#ifndef _SDL_irixaudio_h
+#define _SDL_irixaudio_h
#include
@@ -31,15 +31,12 @@
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The handle for the audio device */
- ALport audio_port;
-
- Uint8 *mixbuf; /* The app mixing buffer */
+struct SDL_PrivateAudioData
+{
+ ALport audio_port; /* The handle for the audio device */
+ Uint8 *mixbuf; /* The app mixing buffer */
};
-/* Old variable names */
-#define audio_port (this->hidden->audio_port)
-#define mixbuf (this->hidden->mixbuf)
+#endif /* _SDL_irixaudio_h */
-#endif /* _SDL_lowaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.c b/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.c
index 91a145379..e5440b074 100644
--- a/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,8 +26,8 @@
/* Allow access to a raw mixing buffer */
-#include /* For perror() */
-#include /* For strerror() */
+#include /* For perror() */
+#include /* For strerror() */
#include
#include
#include
@@ -41,7 +41,7 @@
#include
#else
/* This is recommended by OSS */
-#include
+#include
#endif
#include "SDL_timer.h"
@@ -55,286 +55,339 @@
#define DSP_DRIVER_NAME "dsp"
/* Open the audio device for playback, and don't block if busy */
-#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK)
+#define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK)
+#define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK)
-/* Audio driver functions */
-static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void DSP_WaitAudio(_THIS);
-static void DSP_PlayAudio(_THIS);
-static Uint8 *DSP_GetAudioBuf(_THIS);
-static void DSP_CloseAudio(_THIS);
+static char **outputDevices = NULL;
+static int outputDeviceCount = 0;
+static char **inputDevices = NULL;
+static int inputDeviceCount = 0;
-/* Audio driver bootstrap functions */
-
-static int Audio_Available(void)
+static inline void
+free_device_list(char ***devs, int *count)
{
- int fd;
- int available;
-
- available = 0;
- fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
- if ( fd >= 0 ) {
- available = 1;
- close(fd);
- }
- return(available);
+ SDL_FreeUnixAudioDevices(devs, count);
}
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
+static inline void
+build_device_list(int iscapture, char ***devs, int *count)
{
- SDL_free(device->hidden);
- SDL_free(device);
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ free_device_list(devs, count);
+ SDL_EnumUnixAudioDevices(flags, 0, NULL, devs, count);
}
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
+static inline void
+build_device_lists(void)
{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- audio_fd = -1;
-
- /* Set the function pointers */
- this->OpenAudio = DSP_OpenAudio;
- this->WaitAudio = DSP_WaitAudio;
- this->PlayAudio = DSP_PlayAudio;
- this->GetAudioBuf = DSP_GetAudioBuf;
- this->CloseAudio = DSP_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ build_device_list(1, &inputDevices, &inputDeviceCount);
}
-AudioBootStrap DSP_bootstrap = {
- DSP_DRIVER_NAME, "OSS /dev/dsp standard audio",
- Audio_Available, Audio_CreateDevice
-};
-/* This function waits until it is possible to write a full sound buffer */
-static void DSP_WaitAudio(_THIS)
+static inline void
+free_device_lists(void)
{
- /* Not needed at all since OSS handles waiting automagically */
+ free_device_list(&outputDevices, &outputDeviceCount);
+ free_device_list(&inputDevices, &inputDeviceCount);
}
-static void DSP_PlayAudio(_THIS)
-{
- if (write(audio_fd, mixbuf, mixlen)==-1)
- {
- perror("Audio write");
- this->enabled = 0;
- }
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Wrote %d bytes of audio data\n", mixlen);
-#endif
+static void
+DSP_Deinitialize(void)
+{
+ free_device_lists();
}
-static Uint8 *DSP_GetAudioBuf(_THIS)
+
+static int
+DSP_DetectDevices(int iscapture)
{
- return(mixbuf);
+ if (iscapture) {
+ build_device_list(1, &inputDevices, &inputDeviceCount);
+ return inputDeviceCount;
+ } else {
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ return outputDeviceCount;
+ }
+
+ return 0; /* shouldn't ever hit this. */
}
-static void DSP_CloseAudio(_THIS)
+static const char *
+DSP_GetDeviceName(int index, int iscapture)
{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( audio_fd >= 0 ) {
- close(audio_fd);
- audio_fd = -1;
- }
+ if ((iscapture) && (index < inputDeviceCount)) {
+ return inputDevices[index];
+ } else if ((!iscapture) && (index < outputDeviceCount)) {
+ return outputDevices[index];
+ }
+
+ SDL_SetError("No such device");
+ return NULL;
}
-static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
+
+static void
+DSP_CloseDevice(_THIS)
{
- char audiodev[1024];
- int format;
- int value;
- int frag_spec;
- Uint16 test_format;
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->audio_fd >= 0) {
+ close(this->hidden->audio_fd);
+ this->hidden->audio_fd = -1;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
+
+
+static int
+DSP_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
+ int format;
+ int value;
+ int frag_spec;
+ SDL_AudioFormat test_format;
+
+ /* We don't care what the devname is...we'll try to open anything. */
+ /* ...but default to first name in the list... */
+ if (devname == NULL) {
+ if (((iscapture) && (inputDeviceCount == 0)) ||
+ ((!iscapture) && (outputDeviceCount == 0))) {
+ SDL_SetError("No such audio device");
+ return 0;
+ }
+ devname = ((iscapture) ? inputDevices[0] : outputDevices[0]);
+ }
/* Make sure fragment size stays a power of 2, or OSS fails. */
/* I don't know which of these are actually legal values, though... */
- if (spec->channels > 8)
- spec->channels = 8;
- else if (spec->channels > 4)
- spec->channels = 4;
- else if (spec->channels > 2)
- spec->channels = 2;
+ if (this->spec.channels > 8)
+ this->spec.channels = 8;
+ else if (this->spec.channels > 4)
+ this->spec.channels = 4;
+ else if (this->spec.channels > 2)
+ this->spec.channels = 2;
- /* Open the audio device */
- audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
- if ( audio_fd < 0 ) {
- SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
- return(-1);
- }
- mixbuf = NULL;
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- /* Make the file descriptor use blocking writes with fcntl() */
- { long flags;
- flags = fcntl(audio_fd, F_GETFL);
- flags &= ~O_NONBLOCK;
- if ( fcntl(audio_fd, F_SETFL, flags) < 0 ) {
- SDL_SetError("Couldn't set audio blocking mode");
- DSP_CloseAudio(this);
- return(-1);
- }
- }
+ /* Open the audio device */
+ this->hidden->audio_fd = open(devname, flags, 0);
+ if (this->hidden->audio_fd < 0) {
+ DSP_CloseDevice(this);
+ SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
+ return 0;
+ }
+ this->hidden->mixbuf = NULL;
- /* Get a list of supported hardware formats */
- if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) {
- perror("SNDCTL_DSP_GETFMTS");
- SDL_SetError("Couldn't get audio format list");
- DSP_CloseAudio(this);
- return(-1);
- }
+ /* Make the file descriptor use blocking writes with fcntl() */
+ {
+ long ctlflags;
+ ctlflags = fcntl(this->hidden->audio_fd, F_GETFL);
+ ctlflags &= ~O_NONBLOCK;
+ if (fcntl(this->hidden->audio_fd, F_SETFL, ctlflags) < 0) {
+ DSP_CloseDevice(this);
+ SDL_SetError("Couldn't set audio blocking mode");
+ return 0;
+ }
+ }
- /* Try for a closest match on audio format */
- format = 0;
- for ( test_format = SDL_FirstAudioFormat(spec->format);
- ! format && test_format; ) {
+ /* Get a list of supported hardware formats */
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) {
+ perror("SNDCTL_DSP_GETFMTS");
+ DSP_CloseDevice(this);
+ SDL_SetError("Couldn't get audio format list");
+ return 0;
+ }
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
#endif
- switch ( test_format ) {
- case AUDIO_U8:
- if ( value & AFMT_U8 ) {
- format = AFMT_U8;
- }
- break;
- case AUDIO_S16LSB:
- if ( value & AFMT_S16_LE ) {
- format = AFMT_S16_LE;
- }
- break;
- case AUDIO_S16MSB:
- if ( value & AFMT_S16_BE ) {
- format = AFMT_S16_BE;
- }
- break;
+ switch (test_format) {
+ case AUDIO_U8:
+ if (value & AFMT_U8) {
+ format = AFMT_U8;
+ }
+ break;
+ case AUDIO_S16LSB:
+ if (value & AFMT_S16_LE) {
+ format = AFMT_S16_LE;
+ }
+ break;
+ case AUDIO_S16MSB:
+ if (value & AFMT_S16_BE) {
+ format = AFMT_S16_BE;
+ }
+ break;
#if 0
/*
* These formats are not used by any real life systems so they are not
* needed here.
*/
- case AUDIO_S8:
- if ( value & AFMT_S8 ) {
- format = AFMT_S8;
- }
- break;
- case AUDIO_U16LSB:
- if ( value & AFMT_U16_LE ) {
- format = AFMT_U16_LE;
- }
- break;
- case AUDIO_U16MSB:
- if ( value & AFMT_U16_BE ) {
- format = AFMT_U16_BE;
- }
- break;
+ case AUDIO_S8:
+ if (value & AFMT_S8) {
+ format = AFMT_S8;
+ }
+ break;
+ case AUDIO_U16LSB:
+ if (value & AFMT_U16_LE) {
+ format = AFMT_U16_LE;
+ }
+ break;
+ case AUDIO_U16MSB:
+ if (value & AFMT_U16_BE) {
+ format = AFMT_U16_BE;
+ }
+ break;
#endif
- default:
- format = 0;
- break;
- }
- if ( ! format ) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if ( format == 0 ) {
- SDL_SetError("Couldn't find any hardware audio formats");
- DSP_CloseAudio(this);
- return(-1);
- }
- spec->format = test_format;
+ default:
+ format = 0;
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+ DSP_CloseDevice(this);
+ SDL_SetError("Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
- /* Set the audio format */
- value = format;
- if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
- (value != format) ) {
- perror("SNDCTL_DSP_SETFMT");
- SDL_SetError("Couldn't set audio format");
- DSP_CloseAudio(this);
- return(-1);
- }
+ /* Set the audio format */
+ value = format;
+ if ((ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
+ (value != format)) {
+ perror("SNDCTL_DSP_SETFMT");
+ DSP_CloseDevice(this);
+ SDL_SetError("Couldn't set audio format");
+ return 0;
+ }
- /* Set the number of channels of output */
- value = spec->channels;
- if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) {
- perror("SNDCTL_DSP_CHANNELS");
- SDL_SetError("Cannot set the number of channels");
- DSP_CloseAudio(this);
- return(-1);
- }
- spec->channels = value;
+ /* Set the number of channels of output */
+ value = this->spec.channels;
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0) {
+ perror("SNDCTL_DSP_CHANNELS");
+ DSP_CloseDevice(this);
+ SDL_SetError("Cannot set the number of channels");
+ return 0;
+ }
+ this->spec.channels = value;
- /* Set the DSP frequency */
- value = spec->freq;
- if ( ioctl(audio_fd, SNDCTL_DSP_SPEED, &value) < 0 ) {
- perror("SNDCTL_DSP_SPEED");
- SDL_SetError("Couldn't set audio frequency");
- DSP_CloseAudio(this);
- return(-1);
- }
- spec->freq = value;
+ /* Set the DSP frequency */
+ value = this->spec.freq;
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 0) {
+ perror("SNDCTL_DSP_SPEED");
+ DSP_CloseDevice(this);
+ SDL_SetError("Couldn't set audio frequency");
+ return 0;
+ }
+ this->spec.freq = value;
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
- /* Determine the power of two of the fragment size */
- for ( frag_spec = 0; (0x01U<size; ++frag_spec );
- if ( (0x01U<size ) {
- SDL_SetError("Fragment size must be a power of two");
- DSP_CloseAudio(this);
- return(-1);
- }
- frag_spec |= 0x00020000; /* two fragments, for low latency */
+ /* Determine the power of two of the fragment size */
+ for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec);
+ if ((0x01U << frag_spec) != this->spec.size) {
+ DSP_CloseDevice(this);
+ SDL_SetError("Fragment size must be a power of two");
+ return 0;
+ }
+ frag_spec |= 0x00020000; /* two fragments, for low latency */
- /* Set the audio buffering parameters */
+ /* Set the audio buffering parameters */
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Requesting %d fragments of size %d\n",
- (frag_spec >> 16), 1<<(frag_spec&0xFFFF));
+ fprintf(stderr, "Requesting %d fragments of size %d\n",
+ (frag_spec >> 16), 1 << (frag_spec & 0xFFFF));
#endif
- if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) {
- perror("SNDCTL_DSP_SETFRAGMENT");
- }
+ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0) {
+ perror("SNDCTL_DSP_SETFRAGMENT");
+ }
#ifdef DEBUG_AUDIO
- { audio_buf_info info;
- ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info);
- fprintf(stderr, "fragments = %d\n", info.fragments);
- fprintf(stderr, "fragstotal = %d\n", info.fragstotal);
- fprintf(stderr, "fragsize = %d\n", info.fragsize);
- fprintf(stderr, "bytes = %d\n", info.bytes);
- }
+ {
+ audio_buf_info info;
+ ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETOSPACE, &info);
+ fprintf(stderr, "fragments = %d\n", info.fragments);
+ fprintf(stderr, "fragstotal = %d\n", info.fragstotal);
+ fprintf(stderr, "fragsize = %d\n", info.fragsize);
+ fprintf(stderr, "bytes = %d\n", info.bytes);
+ }
#endif
- /* Allocate mixing buffer */
- mixlen = spec->size;
- mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
- if ( mixbuf == NULL ) {
- DSP_CloseAudio(this);
- return(-1);
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ DSP_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
- /* Get the parent process id (we're the parent of the audio thread) */
- parent = getpid();
-
- /* We're ready to rock and roll. :-) */
- return(0);
+ /* We're ready to rock and roll. :-) */
+ return 1;
}
+
+
+static void
+DSP_PlayDevice(_THIS)
+{
+ const Uint8 *mixbuf = this->hidden->mixbuf;
+ const int mixlen = this->hidden->mixlen;
+ if (write(this->hidden->audio_fd, mixbuf, mixlen) == -1) {
+ perror("Audio write");
+ this->enabled = 0;
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", mixlen);
+#endif
+}
+
+static Uint8 *
+DSP_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+static int
+DSP_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = DSP_DetectDevices;
+ impl->GetDeviceName = DSP_GetDeviceName;
+ impl->OpenDevice = DSP_OpenDevice;
+ impl->PlayDevice = DSP_PlayDevice;
+ impl->GetDeviceBuf = DSP_GetDeviceBuf;
+ impl->CloseDevice = DSP_CloseDevice;
+ impl->Deinitialize = DSP_Deinitialize;
+
+ build_device_lists();
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap DSP_bootstrap = {
+ DSP_DRIVER_NAME, "OSS /dev/dsp standard audio", DSP_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.h b/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.h
index 26d8d2e9b..c9495e6ce 100644
--- a/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/dsp/SDL_dspaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,28 +26,19 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- int audio_fd;
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
- /* The parent process id, to detect when application quits */
- pid_t parent;
-
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
-
-/* Old variable names */
-#define audio_fd (this->hidden->audio_fd)
-#define parent (this->hidden->parent)
-#define mixbuf (this->hidden->mixbuf)
-#define mixlen (this->hidden->mixlen)
-#define frame_ticks (this->hidden->frame_ticks)
-#define next_frame (this->hidden->next_frame)
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_dspaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.c b/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.c
index 9567d9602..749818cc4 100644
--- a/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -25,132 +25,27 @@
/* Output audio to nowhere... */
-#include "SDL_rwops.h"
-#include "SDL_timer.h"
#include "SDL_audio.h"
-#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
#include "SDL_dummyaudio.h"
-/* The tag name used by DUMMY audio */
-#define DUMMYAUD_DRIVER_NAME "dummy"
-
-/* Audio driver functions */
-static int DUMMYAUD_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void DUMMYAUD_WaitAudio(_THIS);
-static void DUMMYAUD_PlayAudio(_THIS);
-static Uint8 *DUMMYAUD_GetAudioBuf(_THIS);
-static void DUMMYAUD_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-static int DUMMYAUD_Available(void)
+static int
+DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
- const char *envr = SDL_getenv("SDL_AUDIODRIVER");
- if (envr && (SDL_strcmp(envr, DUMMYAUD_DRIVER_NAME) == 0)) {
- return(1);
- }
- return(0);
+ return 1; /* always succeeds. */
}
-static void DUMMYAUD_DeleteDevice(SDL_AudioDevice *device)
+static int
+DUMMYAUD_Init(SDL_AudioDriverImpl * impl)
{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *DUMMYAUD_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = DUMMYAUD_OpenAudio;
- this->WaitAudio = DUMMYAUD_WaitAudio;
- this->PlayAudio = DUMMYAUD_PlayAudio;
- this->GetAudioBuf = DUMMYAUD_GetAudioBuf;
- this->CloseAudio = DUMMYAUD_CloseAudio;
-
- this->free = DUMMYAUD_DeleteDevice;
-
- return this;
+ /* Set the function pointers */
+ impl->OpenDevice = DUMMYAUD_OpenDevice;
+ impl->OnlyHasDefaultOutputDevice = 1;
+ return 1; /* this audio target is available. */
}
AudioBootStrap DUMMYAUD_bootstrap = {
- DUMMYAUD_DRIVER_NAME, "SDL dummy audio driver",
- DUMMYAUD_Available, DUMMYAUD_CreateDevice
+ "dummy", "SDL dummy audio driver", DUMMYAUD_Init, 1
};
-/* This function waits until it is possible to write a full sound buffer */
-static void DUMMYAUD_WaitAudio(_THIS)
-{
- /* Don't block on first calls to simulate initial fragment filling. */
- if (this->hidden->initial_calls)
- this->hidden->initial_calls--;
- else
- SDL_Delay(this->hidden->write_delay);
-}
-
-static void DUMMYAUD_PlayAudio(_THIS)
-{
- /* no-op...this is a null driver. */
-}
-
-static Uint8 *DUMMYAUD_GetAudioBuf(_THIS)
-{
- return(this->hidden->mixbuf);
-}
-
-static void DUMMYAUD_CloseAudio(_THIS)
-{
- if ( this->hidden->mixbuf != NULL ) {
- SDL_FreeAudioMem(this->hidden->mixbuf);
- this->hidden->mixbuf = NULL;
- }
-}
-
-static int DUMMYAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- float bytes_per_sec = 0.0f;
-
- /* Allocate mixing buffer */
- this->hidden->mixlen = spec->size;
- this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
- if ( this->hidden->mixbuf == NULL ) {
- return(-1);
- }
- SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
-
- bytes_per_sec = (float) (((spec->format & 0xFF) / 8) *
- spec->channels * spec->freq);
-
- /*
- * We try to make this request more audio at the correct rate for
- * a given audio spec, so timing stays fairly faithful.
- * Also, we have it not block at all for the first two calls, so
- * it seems like we're filling two audio fragments right out of the
- * gate, like other SDL drivers tend to do.
- */
- this->hidden->initial_calls = 2;
- this->hidden->write_delay =
- (Uint32) ((((float) spec->size) / bytes_per_sec) * 1000.0f);
-
- /* We're ready to rock and roll. :-) */
- return(0);
-}
-
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.h b/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.h
index e233e2ac5..2d438be2b 100644
--- a/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/dummy/SDL_dummyaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,15 +26,17 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- Uint8 *mixbuf;
- Uint32 mixlen;
- Uint32 write_delay;
- Uint32 initial_calls;
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ Uint8 *mixbuf;
+ Uint32 mixlen;
+ Uint32 write_delay;
+ Uint32 initial_calls;
};
#endif /* _SDL_dummyaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.c b/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.c
index 5514bafbe..25287170a 100644
--- a/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -33,7 +33,6 @@
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
#include "SDL_esdaudio.h"
#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
@@ -46,278 +45,308 @@
/* The tag name used by ESD audio */
#define ESD_DRIVER_NAME "esd"
-/* Audio driver functions */
-static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void ESD_WaitAudio(_THIS);
-static void ESD_PlayAudio(_THIS);
-static Uint8 *ESD_GetAudioBuf(_THIS);
-static void ESD_CloseAudio(_THIS);
-
#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC;
static void *esd_handle = NULL;
-static int esd_loaded = 0;
-static int (*SDL_NAME(esd_open_sound))( const char *host );
-static int (*SDL_NAME(esd_close))( int esd );
-static int (*SDL_NAME(esd_play_stream))( esd_format_t format, int rate,
- const char *host, const char *name );
-static struct {
- const char *name;
- void **func;
-} esd_functions[] = {
- { "esd_open_sound", (void **)&SDL_NAME(esd_open_sound) },
- { "esd_close", (void **)&SDL_NAME(esd_close) },
- { "esd_play_stream", (void **)&SDL_NAME(esd_play_stream) },
+static int (*SDL_NAME(esd_open_sound)) (const char *host);
+static int (*SDL_NAME(esd_close)) (int esd);
+static int (*SDL_NAME(esd_play_stream)) (esd_format_t format, int rate,
+ const char *host, const char *name);
+
+#define SDL_ESD_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
+static struct
+{
+ const char *name;
+ void **func;
+} const esd_functions[] = {
+ SDL_ESD_SYM(esd_open_sound),
+ SDL_ESD_SYM(esd_close), SDL_ESD_SYM(esd_play_stream),
};
-static void UnloadESDLibrary()
+#undef SDL_ESD_SYM
+
+static void
+UnloadESDLibrary()
{
- if ( esd_loaded ) {
- SDL_UnloadObject(esd_handle);
- esd_handle = NULL;
- esd_loaded = 0;
- }
+ if (esd_handle != NULL) {
+ SDL_UnloadObject(esd_handle);
+ esd_handle = NULL;
+ }
}
-static int LoadESDLibrary(void)
+static int
+LoadESDLibrary(void)
{
- int i, retval = -1;
+ int i, retval = -1;
- esd_handle = SDL_LoadObject(esd_library);
- if ( esd_handle ) {
- esd_loaded = 1;
- retval = 0;
- for ( i=0; i= 0 ) {
- available = 1;
- SDL_NAME(esd_close)(connection);
- }
- UnloadESDLibrary();
- return(available);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
- UnloadESDLibrary();
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- LoadESDLibrary();
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- audio_fd = -1;
-
- /* Set the function pointers */
- this->OpenAudio = ESD_OpenAudio;
- this->WaitAudio = ESD_WaitAudio;
- this->PlayAudio = ESD_PlayAudio;
- this->GetAudioBuf = ESD_GetAudioBuf;
- this->CloseAudio = ESD_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap ESD_bootstrap = {
- ESD_DRIVER_NAME, "Enlightened Sound Daemon",
- Audio_Available, Audio_CreateDevice
-};
/* This function waits until it is possible to write a full sound buffer */
-static void ESD_WaitAudio(_THIS)
+static void
+ESD_WaitDevice(_THIS)
{
- Sint32 ticks;
+ Sint32 ticks;
- /* Check to see if the thread-parent process is still alive */
- { static int cnt = 0;
- /* Note that this only works with thread implementations
- that use a different process id for each thread.
- */
- if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
- if ( kill(parent, 0) < 0 ) {
- this->enabled = 0;
- }
- }
- }
+ /* Check to see if the thread-parent process is still alive */
+ {
+ static int cnt = 0;
+ /* Note that this only works with thread implementations
+ that use a different process id for each thread.
+ */
+ /* Check every 10 loops */
+ if (this->hidden->parent && (((++cnt) % 10) == 0)) {
+ if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) {
+ this->enabled = 0;
+ }
+ }
+ }
- /* Use timer for general audio synchronization */
- ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS;
- if ( ticks > 0 ) {
- SDL_Delay(ticks);
- }
+ /* Use timer for general audio synchronization */
+ ticks =
+ ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
+ }
}
-static void ESD_PlayAudio(_THIS)
+static void
+ESD_PlayDevice(_THIS)
{
- int written;
+ int written = 0;
- /* Write the audio data, checking for EAGAIN on broken audio drivers */
- do {
- written = write(audio_fd, mixbuf, mixlen);
- if ( (written < 0) && ((errno == 0) || (errno == EAGAIN)) ) {
- SDL_Delay(1); /* Let a little CPU time go by */
- }
- } while ( (written < 0) &&
- ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)) );
+ /* Write the audio data, checking for EAGAIN on broken audio drivers */
+ do {
+ written = write(this->hidden->audio_fd,
+ this->hidden->mixbuf, this->hidden->mixlen);
+ if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
+ SDL_Delay(1); /* Let a little CPU time go by */
+ }
+ } while ((written < 0) &&
+ ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
- /* Set the next write frame */
- next_frame += frame_ticks;
+ /* Set the next write frame */
+ this->hidden->next_frame += this->hidden->frame_ticks;
- /* If we couldn't write, assume fatal error for now */
- if ( written < 0 ) {
- this->enabled = 0;
- }
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ this->enabled = 0;
+ }
}
-static Uint8 *ESD_GetAudioBuf(_THIS)
+static Uint8 *
+ESD_GetDeviceBuf(_THIS)
{
- return(mixbuf);
+ return (this->hidden->mixbuf);
}
-static void ESD_CloseAudio(_THIS)
+static void
+ESD_CloseDevice(_THIS)
{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( audio_fd >= 0 ) {
- SDL_NAME(esd_close)(audio_fd);
- audio_fd = -1;
- }
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->audio_fd >= 0) {
+ SDL_NAME(esd_close) (this->hidden->audio_fd);
+ this->hidden->audio_fd = -1;
+ }
+
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
}
/* Try to get the name of the program */
-static char *get_progname(void)
+static char *
+get_progname(void)
{
- char *progname = NULL;
+ char *progname = NULL;
#ifdef __LINUX__
- FILE *fp;
- static char temp[BUFSIZ];
+ FILE *fp;
+ static char temp[BUFSIZ];
- SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid());
- fp = fopen(temp, "r");
- if ( fp != NULL ) {
- if ( fgets(temp, sizeof(temp)-1, fp) ) {
- progname = SDL_strrchr(temp, '/');
- if ( progname == NULL ) {
- progname = temp;
- } else {
- progname = progname+1;
- }
- }
- fclose(fp);
- }
+ SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid());
+ fp = fopen(temp, "r");
+ if (fp != NULL) {
+ if (fgets(temp, sizeof(temp) - 1, fp)) {
+ progname = SDL_strrchr(temp, '/');
+ if (progname == NULL) {
+ progname = temp;
+ } else {
+ progname = progname + 1;
+ }
+ }
+ fclose(fp);
+ }
#endif
- return(progname);
+ return (progname);
}
-static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec)
+
+static int
+ESD_OpenDevice(_THIS, const char *devname, int iscapture)
{
- esd_format_t format;
+ esd_format_t format = (ESD_STREAM | ESD_PLAY);
+ SDL_AudioFormat test_format = 0;
+ int found = 0;
- /* Convert audio spec to the ESD audio format */
- format = (ESD_STREAM | ESD_PLAY);
- switch ( spec->format & 0xFF ) {
- case 8:
- format |= ESD_BITS8;
- break;
- case 16:
- format |= ESD_BITS16;
- break;
- default:
- SDL_SetError("Unsupported ESD audio format");
- return(-1);
- }
- if ( spec->channels == 1 ) {
- format |= ESD_MONO;
- } else {
- format |= ESD_STEREO;
- }
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+ this->hidden->audio_fd = -1;
+
+ /* Convert audio spec to the ESD audio format */
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !found && test_format; test_format = SDL_NextAudioFormat()) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ found = 1;
+ switch (test_format) {
+ case AUDIO_U8:
+ format |= ESD_BITS8;
+ break;
+ case AUDIO_S16SYS:
+ format |= ESD_BITS16;
+ break;
+ default:
+ found = 0;
+ break;
+ }
+ }
+
+ if (!found) {
+ ESD_CloseDevice(this);
+ SDL_SetError("Couldn't find any hardware audio formats");
+ return 0;
+ }
+
+ if (this->spec.channels == 1) {
+ format |= ESD_MONO;
+ } else {
+ format |= ESD_STEREO;
+ }
#if 0
- spec->samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */
+ this->spec.samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */
#endif
- /* Open a connection to the ESD audio server */
- audio_fd = SDL_NAME(esd_play_stream)(format, spec->freq, NULL, get_progname());
- if ( audio_fd < 0 ) {
- SDL_SetError("Couldn't open ESD connection");
- return(-1);
- }
+ /* Open a connection to the ESD audio server */
+ this->hidden->audio_fd =
+ SDL_NAME(esd_play_stream) (format, this->spec.freq, NULL,
+ get_progname());
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
- frame_ticks = (float)(spec->samples*1000)/spec->freq;
- next_frame = SDL_GetTicks()+frame_ticks;
+ if (this->hidden->audio_fd < 0) {
+ ESD_CloseDevice(this);
+ SDL_SetError("Couldn't open ESD connection");
+ return 0;
+ }
- /* Allocate mixing buffer */
- mixlen = spec->size;
- mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
- if ( mixbuf == NULL ) {
- return(-1);
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+ this->hidden->frame_ticks =
+ (float) (this->spec.samples * 1000) / this->spec.freq;
+ this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks;
- /* Get the parent process id (we're the parent of the audio thread) */
- parent = getpid();
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ ESD_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
- /* We're ready to rock and roll. :-) */
- return(0);
+ /* Get the parent process id (we're the parent of the audio thread) */
+ this->hidden->parent = getpid();
+
+ /* We're ready to rock and roll. :-) */
+ return 1;
}
+
+static void
+ESD_Deinitialize(void)
+{
+ UnloadESDLibrary();
+}
+
+static int
+ESD_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadESDLibrary() < 0) {
+ return 0;
+ } else {
+ int connection = 0;
+
+ /* Don't start ESD if it's not running */
+ SDL_setenv("ESD_NO_SPAWN", "1", 0);
+
+ connection = SDL_NAME(esd_open_sound) (NULL);
+ if (connection < 0) {
+ UnloadESDLibrary();
+ SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
+ return 0;
+ }
+ SDL_NAME(esd_close) (connection);
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = ESD_OpenDevice;
+ impl->PlayDevice = ESD_PlayDevice;
+ impl->WaitDevice = ESD_WaitDevice;
+ impl->GetDeviceBuf = ESD_GetDeviceBuf;
+ impl->CloseDevice = ESD_CloseDevice;
+ impl->Deinitialize = ESD_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap ESD_bootstrap = {
+ ESD_DRIVER_NAME, "Enlightened Sound Daemon", ESD_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.h b/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.h
index 9f8d32578..8794ba376 100644
--- a/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/esd/SDL_esdaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,32 +26,26 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- int audio_fd;
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
- /* The parent process id, to detect when application quits */
- pid_t parent;
+ /* The parent process id, to detect when application quits */
+ pid_t parent;
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
- /* Support for audio timing using a timer */
- float frame_ticks;
- float next_frame;
+ /* Support for audio timing using a timer */
+ float frame_ticks;
+ float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
-
-/* Old variable names */
-#define audio_fd (this->hidden->audio_fd)
-#define parent (this->hidden->parent)
-#define mixbuf (this->hidden->mixbuf)
-#define mixlen (this->hidden->mixlen)
-#define frame_ticks (this->hidden->frame_ticks)
-#define next_frame (this->hidden->next_frame)
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_esdaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.c b/alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.c
new file mode 100644
index 000000000..a0341d595
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.c
@@ -0,0 +1,351 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+/* Allow access to a raw mixing buffer */
+
+#ifdef HAVE_SIGNAL_H
+#include
+#endif
+#include
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "SDL_fsaudio.h"
+
+#include
+
+//#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so"
+
+#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+#else
+#define SDL_NAME(X) X
+#endif
+
+#if (FUSIONSOUND_MAJOR_VERSION == 1) && (FUSIONSOUND_MINOR_VERSION < 1)
+typedef DFBResult DirectResult;
+#endif
+
+/* The tag name used by fusionsoundc audio */
+#define SDL_FS_DRIVER_NAME "fusionsound"
+/* Buffers to use - more than 2 gives a lot of latency */
+#define FUSION_BUFFERS (2)
+
+#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+
+static const char *fs_library = SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC;
+static void *fs_handle = NULL;
+
+static DirectResult (*SDL_NAME(FusionSoundInit)) (int *argc, char *(*argv[]));
+static DirectResult (*SDL_NAME(FusionSoundCreate)) (IFusionSound **
+ ret_interface);
+
+#define SDL_FS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
+static struct
+{
+ const char *name;
+ void **func;
+} fs_functions[] = {
+/* *INDENT-OFF* */
+ SDL_FS_SYM(FusionSoundInit),
+ SDL_FS_SYM(FusionSoundCreate),
+/* *INDENT-ON* */
+};
+
+#undef SDL_FS_SYM
+
+static void
+UnloadFusionSoundLibrary()
+{
+ if (fs_handle != NULL) {
+ SDL_UnloadObject(fs_handle);
+ fs_handle = NULL;
+ }
+}
+
+static int
+LoadFusionSoundLibrary(void)
+{
+ int i, retval = -1;
+
+ if (fs_handle == NULL) {
+ fs_handle = SDL_LoadObject(fs_library);
+ if (fs_handle != NULL) {
+ retval = 0;
+ for (i = 0; i < SDL_arraysize(fs_functions); ++i) {
+ *fs_functions[i].func =
+ SDL_LoadFunction(fs_handle, fs_functions[i].name);
+ if (!*fs_functions[i].func) {
+ retval = -1;
+ UnloadFusionSoundLibrary();
+ break;
+ }
+ }
+ }
+ }
+
+ return retval;
+}
+
+#else
+
+static void
+UnloadFusionSoundLibrary()
+{
+ return;
+}
+
+static int
+LoadFusionSoundLibrary(void)
+{
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+SDL_FS_WaitDevice(_THIS)
+{
+ this->hidden->stream->Wait(this->hidden->stream,
+ this->hidden->mixsamples);
+}
+
+static void
+SDL_FS_PlayDevice(_THIS)
+{
+ DirectResult ret;
+
+ ret = this->hidden->stream->Write(this->hidden->stream,
+ this->hidden->mixbuf,
+ this->hidden->mixsamples);
+ /* If we couldn't write, assume fatal error for now */
+ if (ret) {
+ this->enabled = 0;
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen);
+#endif
+}
+
+static void
+SDL_FS_WaitDone(_THIS)
+{
+ this->hidden->stream->Wait(this->hidden->stream,
+ this->hidden->mixsamples * FUSION_BUFFERS);
+}
+
+
+static Uint8 *
+SDL_FS_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+
+static void
+SDL_FS_CloseDevice(_THIS)
+{
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->stream) {
+ this->hidden->stream->Release(this->hidden->stream);
+ this->hidden->stream = NULL;
+ }
+ if (this->hidden->fs) {
+ this->hidden->fs->Release(this->hidden->fs);
+ this->hidden->fs = NULL;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
+
+
+static int
+SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ int bytes;
+ SDL_AudioFormat test_format = 0, format = 0;
+ FSSampleFormat fs_format;
+ FSStreamDescription desc;
+ DirectResult ret;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ fs_format = FSSF_U8;
+ bytes = 1;
+ format = 1;
+ break;
+ case AUDIO_S16SYS:
+ fs_format = FSSF_S16;
+ bytes = 2;
+ format = 1;
+ break;
+ case AUDIO_S32SYS:
+ fs_format = FSSF_S32;
+ bytes = 4;
+ format = 1;
+ break;
+ case AUDIO_F32SYS:
+ fs_format = FSSF_FLOAT;
+ bytes = 4;
+ format = 1;
+ break;
+ default:
+ format = 0;
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+
+ if (format == 0) {
+ SDL_FS_CloseDevice(this);
+ SDL_SetError("Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
+
+ /* Retrieve the main sound interface. */
+ ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs);
+ if (ret) {
+ SDL_FS_CloseDevice(this);
+ SDL_SetError("Unable to initialize FusionSound: %d", ret);
+ return 0;
+ }
+
+ this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels;
+
+ /* Fill stream description. */
+ desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE |
+ FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT | FSSDF_PREBUFFER;
+ desc.samplerate = this->spec.freq;
+ desc.buffersize = this->spec.size * FUSION_BUFFERS;
+ desc.channels = this->spec.channels;
+ desc.prebuffer = 10;
+ desc.sampleformat = fs_format;
+
+ ret =
+ this->hidden->fs->CreateStream(this->hidden->fs, &desc,
+ &this->hidden->stream);
+ if (ret) {
+ SDL_FS_CloseDevice(this);
+ SDL_SetError("Unable to create FusionSoundStream: %d", ret);
+ return 0;
+ }
+
+ /* See what we got */
+ desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE |
+ FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT;
+ ret = this->hidden->stream->GetDescription(this->hidden->stream, &desc);
+
+ this->spec.freq = desc.samplerate;
+ this->spec.size =
+ desc.buffersize / FUSION_BUFFERS * bytes * desc.channels;
+ this->spec.channels = desc.channels;
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ SDL_FS_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /* We're ready to rock and roll. :-) */
+ return 1;
+}
+
+
+static void
+SDL_FS_Deinitialize(void)
+{
+ UnloadFusionSoundLibrary();
+}
+
+
+static int
+SDL_FS_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadFusionSoundLibrary() < 0) {
+ return 0;
+ } else {
+ DirectResult ret;
+
+ ret = SDL_NAME(FusionSoundInit) (NULL, NULL);
+ if (ret) {
+ UnloadFusionSoundLibrary();
+ SDL_SetError
+ ("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)",
+ ret);
+ return 0;
+ }
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = SDL_FS_OpenDevice;
+ impl->PlayDevice = SDL_FS_PlayDevice;
+ impl->WaitDevice = SDL_FS_WaitDevice;
+ impl->GetDeviceBuf = SDL_FS_GetDeviceBuf;
+ impl->CloseDevice = SDL_FS_CloseDevice;
+ impl->WaitDone = SDL_FS_WaitDone;
+ impl->Deinitialize = SDL_FS_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap FUSIONSOUND_bootstrap = {
+ SDL_FS_DRIVER_NAME, "FusionSound", SDL_FS_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.h b/alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.h
new file mode 100644
index 000000000..1186071d2
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/audio/fusionsound/SDL_fsaudio.h
@@ -0,0 +1,50 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_fsaudio_h
+#define _SDL_fsaudio_h
+
+#include
+
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
+
+struct SDL_PrivateAudioData
+{
+ /* Interface */
+ IFusionSound *fs;
+
+ /* The stream interface for the audio device */
+ IFusionSoundStream *stream;
+
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+ int mixsamples;
+
+};
+
+#endif /* _SDL_fsaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/iphoneos/SDL_coreaudio_iphone.c b/alienblaster/project/jni/sdl/src/audio/iphoneos/SDL_coreaudio_iphone.c
new file mode 100644
index 000000000..b8a32d4d9
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/audio/iphoneos/SDL_coreaudio_iphone.c
@@ -0,0 +1,340 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include
+
+#include "SDL_audio.h"
+#include "../SDL_audio_c.h"
+#include "../SDL_sysaudio.h"
+#include "SDL_coreaudio_iphone.h"
+
+#define DEBUG_COREAUDIO 0
+
+static void
+COREAUDIO_Deinitialize(void)
+{
+}
+
+/* The CoreAudio callback */
+static OSStatus
+outputCallback(void *inRefCon,
+ AudioUnitRenderActionFlags * ioActionFlags,
+ const AudioTimeStamp * inTimeStamp,
+ UInt32 inBusNumber, UInt32 inNumberFrames,
+ AudioBufferList * ioDataList)
+{
+ SDL_AudioDevice *this = (SDL_AudioDevice *) inRefCon;
+ AudioBuffer *ioData = &ioDataList->mBuffers[0];
+ UInt32 remaining, len;
+ void *ptr;
+
+ /* Is there ever more than one buffer, and what do you do with it? */
+ if (ioDataList->mNumberBuffers != 1) {
+ return noErr;
+ }
+
+ /* Only do anything if audio is enabled and not paused */
+ if (!this->enabled || this->paused) {
+ SDL_memset(ioData->mData, this->spec.silence, ioData->mDataByteSize);
+ return 0;
+ }
+
+ /* No SDL conversion should be needed here, ever, since we accept
+ any input format in OpenAudio, and leave the conversion to CoreAudio.
+ */
+ /*
+ assert(!this->convert.needed);
+ assert(this->spec.channels == ioData->mNumberChannels);
+ */
+
+ remaining = ioData->mDataByteSize;
+ ptr = ioData->mData;
+ while (remaining > 0) {
+ if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
+ /* Generate the data */
+ SDL_memset(this->hidden->buffer, this->spec.silence,
+ this->hidden->bufferSize);
+ SDL_mutexP(this->mixer_lock);
+ (*this->spec.callback) (this->spec.userdata, this->hidden->buffer,
+ this->hidden->bufferSize);
+ SDL_mutexV(this->mixer_lock);
+ this->hidden->bufferOffset = 0;
+ }
+
+ len = this->hidden->bufferSize - this->hidden->bufferOffset;
+ if (len > remaining)
+ len = remaining;
+ SDL_memcpy(ptr,
+ (char *) this->hidden->buffer + this->hidden->bufferOffset,
+ len);
+ ptr = (char *) ptr + len;
+ remaining -= len;
+ this->hidden->bufferOffset += len;
+ }
+
+ return 0;
+}
+
+static OSStatus
+inputCallback(void *inRefCon,
+ AudioUnitRenderActionFlags * ioActionFlags,
+ const AudioTimeStamp * inTimeStamp,
+ UInt32 inBusNumber, UInt32 inNumberFrames,
+ AudioBufferList * ioData)
+{
+ //err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer);
+ // !!! FIXME: write me!
+ return noErr;
+}
+
+
+static void
+COREAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden != NULL) {
+ if (this->hidden->audioUnitOpened) {
+ OSStatus result = noErr;
+ AURenderCallbackStruct callback;
+ const AudioUnitElement output_bus = 0;
+ const AudioUnitElement input_bus = 1;
+ const int iscapture = this->iscapture;
+ const AudioUnitElement bus =
+ ((iscapture) ? input_bus : output_bus);
+ const AudioUnitScope scope =
+ ((iscapture) ? kAudioUnitScope_Output :
+ kAudioUnitScope_Input);
+
+ /* stop processing the audio unit */
+ result = AudioOutputUnitStop(this->hidden->audioUnit);
+
+ /* Remove the input callback */
+ SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct));
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioUnitProperty_SetRenderCallback,
+ scope, bus, &callback,
+ sizeof(callback));
+
+ //CloseComponent(this->hidden->audioUnit);
+ this->hidden->audioUnitOpened = 0;
+ }
+ SDL_free(this->hidden->buffer);
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
+
+
+#define CHECK_RESULT(msg) \
+ if (result != noErr) { \
+ COREAUDIO_CloseDevice(this); \
+ SDL_SetError("CoreAudio error (%s): %d", msg, result); \
+ return 0; \
+ }
+
+static int
+prepare_audiounit(_THIS, const char *devname, int iscapture,
+ const AudioStreamBasicDescription * strdesc)
+{
+ OSStatus result = noErr;
+ AURenderCallbackStruct callback;
+ AudioComponentDescription desc;
+ AudioComponent comp = NULL;
+
+ UInt32 enableIO = 0;
+ const AudioUnitElement output_bus = 0;
+ const AudioUnitElement input_bus = 1;
+ const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
+ const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output :
+ kAudioUnitScope_Input);
+
+ SDL_memset(&desc, '\0', sizeof(AudioComponentDescription));
+ desc.componentType = kAudioUnitType_Output;
+ desc.componentSubType = kAudioUnitSubType_RemoteIO;
+ desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+
+ comp = AudioComponentFindNext(NULL, &desc);
+ if (comp == NULL) {
+ SDL_SetError("Couldn't find requested CoreAudio component");
+ return 0;
+ }
+
+ /* Open & initialize the audio unit */
+ /*
+ AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6
+ We can't use OpenAComponent on iPhone because it is not present
+ */
+ result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit);
+ CHECK_RESULT("AudioComponentInstanceNew");
+
+ this->hidden->audioUnitOpened = 1;
+
+ // !!! FIXME: this is wrong?
+ enableIO = ((iscapture) ? 1 : 0);
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Input, input_bus,
+ &enableIO, sizeof(enableIO));
+ CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_EnableIO input)");
+
+ // !!! FIXME: this is wrong?
+ enableIO = ((iscapture) ? 0 : 1);
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Output, output_bus,
+ &enableIO, sizeof(enableIO));
+ CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_EnableIO output)");
+
+ /*result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global, 0,
+ &this->hidden->deviceID,
+ sizeof(AudioDeviceID));
+
+ CHECK_RESULT("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)"); */
+
+ /* Set the data format of the audio unit. */
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ scope, bus, strdesc, sizeof(*strdesc));
+ CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)");
+
+ /* Set the audio callback */
+ SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct));
+ callback.inputProc = ((iscapture) ? inputCallback : outputCallback);
+ callback.inputProcRefCon = this;
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioUnitProperty_SetRenderCallback,
+ scope, bus, &callback, sizeof(callback));
+ CHECK_RESULT
+ ("AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback)");
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate a sample buffer */
+ this->hidden->bufferOffset = this->hidden->bufferSize = this->spec.size;
+ this->hidden->buffer = SDL_malloc(this->hidden->bufferSize);
+
+ result = AudioUnitInitialize(this->hidden->audioUnit);
+ CHECK_RESULT("AudioUnitInitialize");
+
+ /* Finally, start processing of the audio unit */
+ result = AudioOutputUnitStart(this->hidden->audioUnit);
+ CHECK_RESULT("AudioOutputUnitStart");
+ /* We're running! */
+ return 1;
+}
+
+static int
+COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ AudioStreamBasicDescription strdesc;
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ int valid_datatype = 0;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return (0);
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+
+ /* Setup a AudioStreamBasicDescription with the requested format */
+ SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription));
+ strdesc.mFormatID = kAudioFormatLinearPCM;
+ strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
+ strdesc.mChannelsPerFrame = this->spec.channels;
+ strdesc.mSampleRate = this->spec.freq;
+ strdesc.mFramesPerPacket = 1;
+
+ while ((!valid_datatype) && (test_format)) {
+ this->spec.format = test_format;
+ /* Just a list of valid SDL formats, so people don't pass junk here. */
+ switch (test_format) {
+ case AUDIO_U8:
+ case AUDIO_S8:
+ case AUDIO_U16LSB:
+ case AUDIO_S16LSB:
+ case AUDIO_U16MSB:
+ case AUDIO_S16MSB:
+ case AUDIO_S32LSB:
+ case AUDIO_S32MSB:
+ case AUDIO_F32LSB:
+ case AUDIO_F32MSB:
+ valid_datatype = 1;
+ strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format);
+ if (SDL_AUDIO_ISBIGENDIAN(this->spec.format))
+ strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
+
+ if (SDL_AUDIO_ISFLOAT(this->spec.format))
+ strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
+ else if (SDL_AUDIO_ISSIGNED(this->spec.format))
+ strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
+ break;
+ }
+ }
+
+ if (!valid_datatype) { /* shouldn't happen, but just in case... */
+ COREAUDIO_CloseDevice(this);
+ SDL_SetError("Unsupported audio format");
+ return 0;
+ }
+
+ strdesc.mBytesPerFrame =
+ strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
+ strdesc.mBytesPerPacket =
+ strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
+
+ if (!prepare_audiounit(this, devname, iscapture, &strdesc)) {
+ COREAUDIO_CloseDevice(this);
+ return 0; /* prepare_audiounit() will call SDL_SetError()... */
+ }
+
+ return 1; /* good to go. */
+}
+
+static int
+COREAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = COREAUDIO_OpenDevice;
+ impl->CloseDevice = COREAUDIO_CloseDevice;
+ impl->Deinitialize = COREAUDIO_Deinitialize;
+ impl->ProvidesOwnCallbackThread = 1;
+
+ /* added for iPhone */
+ impl->OnlyHasDefaultInputDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = 1;
+ impl->HasCaptureSupport = 0; /* still needs to be written */
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap COREAUDIOIPHONE_bootstrap = {
+ "coreaudio-iphoneos", "SDL CoreAudio (iPhone OS) audio driver",
+ COREAUDIO_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/dc/SDL_dcaudio.h b/alienblaster/project/jni/sdl/src/audio/iphoneos/SDL_coreaudio_iphone.h
similarity index 70%
rename from alienblaster/project/jni/sdl/src/audio/dc/SDL_dcaudio.h
rename to alienblaster/project/jni/sdl/src/audio/iphoneos/SDL_coreaudio_iphone.h
index 4a7c7cd00..5b935ff98 100644
--- a/alienblaster/project/jni/sdl/src/audio/dc/SDL_dcaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/iphoneos/SDL_coreaudio_iphone.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,21 +21,23 @@
*/
#include "SDL_config.h"
-#ifndef _SDL_dcaudio_h
-#define _SDL_dcaudio_h
+#ifndef _SDL_coreaudio_h
+#define _SDL_coreaudio_h
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- Uint8 *mixbuf;
- Uint32 mixlen;
- int playing;
- int leftpos,rightpos;
- int nextbuf;
+struct SDL_PrivateAudioData
+{
+ AudioUnit audioUnit;
+ int audioUnitOpened;
+ void *buffer;
+ UInt32 bufferOffset;
+ UInt32 bufferSize;
+ // AudioDeviceID deviceID;
};
-#endif /* _SDL_dcaudio_h */
+#endif /* _SDL_coreaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.c b/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.c
index 5842e9018..7d453a9cd 100644
--- a/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -33,94 +33,246 @@
#include "../SDL_sysaudio.h"
#include "SDL_coreaudio.h"
+#define DEBUG_COREAUDIO 0
-/* Audio driver functions */
-
-static int Core_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Core_WaitAudio(_THIS);
-static void Core_PlayAudio(_THIS);
-static Uint8 *Core_GetAudioBuf(_THIS);
-static void Core_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-
-static int Audio_Available(void)
+typedef struct COREAUDIO_DeviceList
{
- return(1);
-}
+ AudioDeviceID id;
+ const char *name;
+} COREAUDIO_DeviceList;
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
+static COREAUDIO_DeviceList *inputDevices = NULL;
+static int inputDeviceCount = 0;
+static COREAUDIO_DeviceList *outputDevices = NULL;
+static int outputDeviceCount = 0;
+
+static void
+free_device_list(COREAUDIO_DeviceList ** devices, int *devCount)
{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
+ if (*devices) {
+ int i = *devCount;
+ while (i--)
+ SDL_free((void *) (*devices)[i].name);
+ SDL_free(*devices);
+ *devices = NULL;
}
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
+ *devCount = 0;
+}
+
+
+static void
+build_device_list(int iscapture, COREAUDIO_DeviceList ** devices,
+ int *devCount)
+{
+ Boolean outWritable = 0;
+ OSStatus result = noErr;
+ UInt32 size = 0;
+ AudioDeviceID *devs = NULL;
+ UInt32 i = 0;
+ UInt32 max = 0;
+
+ free_device_list(devices, devCount);
+
+ result = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices,
+ &size, &outWritable);
+
+ if (result != kAudioHardwareNoError)
+ return;
+
+ devs = (AudioDeviceID *) alloca(size);
+ if (devs == NULL)
+ return;
+
+ max = size / sizeof(AudioDeviceID);
+ *devices = (COREAUDIO_DeviceList *) SDL_malloc(max * sizeof(**devices));
+ if (*devices == NULL)
+ return;
+
+ result = AudioHardwareGetProperty(kAudioHardwarePropertyDevices,
+ &size, devs);
+ if (result != kAudioHardwareNoError)
+ return;
+
+ for (i = 0; i < max; i++) {
+ CFStringRef cfstr = NULL;
+ char *ptr = NULL;
+ AudioDeviceID dev = devs[i];
+ AudioBufferList *buflist = NULL;
+ int usable = 0;
+ CFIndex len = 0;
+
+ result = AudioDeviceGetPropertyInfo(dev, 0, iscapture,
+ kAudioDevicePropertyStreamConfiguration,
+ &size, &outWritable);
+ if (result != noErr)
+ continue;
+
+ buflist = (AudioBufferList *) SDL_malloc(size);
+ if (buflist == NULL)
+ continue;
+
+ result = AudioDeviceGetProperty(dev, 0, iscapture,
+ kAudioDevicePropertyStreamConfiguration,
+ &size, buflist);
+
+ if (result == noErr) {
+ UInt32 j;
+ for (j = 0; j < buflist->mNumberBuffers; j++) {
+ if (buflist->mBuffers[j].mNumberChannels > 0) {
+ usable = 1;
+ break;
+ }
+ }
+ }
+
+ SDL_free(buflist);
+
+ if (!usable)
+ continue;
+
+ size = sizeof(CFStringRef);
+ result = AudioDeviceGetProperty(dev, 0, iscapture,
+ kAudioDevicePropertyDeviceNameCFString,
+ &size, &cfstr);
+
+ if (result != kAudioHardwareNoError)
+ continue;
+
+ len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr),
+ kCFStringEncodingUTF8);
+
+ ptr = (char *) SDL_malloc(len + 1);
+ usable = ((ptr != NULL) &&
+ (CFStringGetCString
+ (cfstr, ptr, len + 1, kCFStringEncodingUTF8)));
+
+ CFRelease(cfstr);
+
+ if (usable) {
+ len = strlen(ptr);
+ /* Some devices have whitespace at the end...trim it. */
+ while ((len > 0) && (ptr[len - 1] == ' ')) {
+ len--;
+ }
+ usable = (len > 0);
+ }
+
+ if (!usable) {
+ SDL_free(ptr);
+ } else {
+ ptr[len] = '\0';
+
+#if DEBUG_COREAUDIO
+ printf("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n",
+ ((iscapture) ? "capture" : "output"),
+ (int) *devCount, ptr, (int) dev);
+#endif
+
+ (*devices)[*devCount].id = dev;
+ (*devices)[*devCount].name = ptr;
+ (*devCount)++;
}
- return(0);
}
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = Core_OpenAudio;
- this->WaitAudio = Core_WaitAudio;
- this->PlayAudio = Core_PlayAudio;
- this->GetAudioBuf = Core_GetAudioBuf;
- this->CloseAudio = Core_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
}
-AudioBootStrap COREAUDIO_bootstrap = {
- "coreaudio", "Mac OS X CoreAudio",
- Audio_Available, Audio_CreateDevice
-};
+static inline void
+build_device_lists(void)
+{
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ build_device_list(1, &inputDevices, &inputDeviceCount);
+}
+
+
+static inline void
+free_device_lists(void)
+{
+ free_device_list(&outputDevices, &outputDeviceCount);
+ free_device_list(&inputDevices, &inputDeviceCount);
+}
+
+
+static int
+find_device_id(const char *devname, int iscapture, AudioDeviceID * id)
+{
+ int i = ((iscapture) ? inputDeviceCount : outputDeviceCount);
+ COREAUDIO_DeviceList *devs = ((iscapture) ? inputDevices : outputDevices);
+ while (i--) {
+ if (SDL_strcmp(devname, devs->name) == 0) {
+ *id = devs->id;
+ return 1;
+ }
+ devs++;
+ }
+
+ return 0;
+}
+
+
+static int
+COREAUDIO_DetectDevices(int iscapture)
+{
+ if (iscapture) {
+ build_device_list(1, &inputDevices, &inputDeviceCount);
+ return inputDeviceCount;
+ } else {
+ build_device_list(0, &outputDevices, &outputDeviceCount);
+ return outputDeviceCount;
+ }
+
+ return 0; /* shouldn't ever hit this. */
+}
+
+
+static const char *
+COREAUDIO_GetDeviceName(int index, int iscapture)
+{
+ if ((iscapture) && (index < inputDeviceCount)) {
+ return inputDevices[index].name;
+ } else if ((!iscapture) && (index < outputDeviceCount)) {
+ return outputDevices[index].name;
+ }
+
+ SDL_SetError("No such device");
+ return NULL;
+}
+
+
+static void
+COREAUDIO_Deinitialize(void)
+{
+ free_device_lists();
+}
+
/* The CoreAudio callback */
-static OSStatus audioCallback (void *inRefCon,
- AudioUnitRenderActionFlags *ioActionFlags,
- const AudioTimeStamp *inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames,
- AudioBufferList *ioData)
+static OSStatus
+outputCallback(void *inRefCon,
+ AudioUnitRenderActionFlags * ioActionFlags,
+ const AudioTimeStamp * inTimeStamp,
+ UInt32 inBusNumber, UInt32 inNumberFrames,
+ AudioBufferList * ioData)
{
- SDL_AudioDevice *this = (SDL_AudioDevice *)inRefCon;
- UInt32 remaining, len;
+ SDL_AudioDevice *this = (SDL_AudioDevice *) inRefCon;
AudioBuffer *abuf;
+ UInt32 remaining, len;
void *ptr;
UInt32 i;
/* Only do anything if audio is enabled and not paused */
- if ( ! this->enabled || this->paused ) {
+ if (!this->enabled || this->paused) {
for (i = 0; i < ioData->mNumberBuffers; i++) {
abuf = &ioData->mBuffers[i];
SDL_memset(abuf->mData, this->spec.silence, abuf->mDataByteSize);
}
return 0;
}
-
+
/* No SDL conversion should be needed here, ever, since we accept
any input format in OpenAudio, and leave the conversion to CoreAudio.
*/
/*
- assert(!this->convert.needed);
- assert(this->spec.channels == ioData->mNumberChannels);
+ assert(!this->convert.needed);
+ assert(this->spec.channels == ioData->mNumberChannels);
*/
for (i = 0; i < ioData->mNumberBuffers; i++) {
@@ -128,164 +280,305 @@ static OSStatus audioCallback (void *inRefCon,
remaining = abuf->mDataByteSize;
ptr = abuf->mData;
while (remaining > 0) {
- if (bufferOffset >= bufferSize) {
+ if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
/* Generate the data */
- SDL_memset(buffer, this->spec.silence, bufferSize);
+ SDL_memset(this->hidden->buffer, this->spec.silence,
+ this->hidden->bufferSize);
SDL_mutexP(this->mixer_lock);
(*this->spec.callback)(this->spec.userdata,
- buffer, bufferSize);
+ this->hidden->buffer, this->hidden->bufferSize);
SDL_mutexV(this->mixer_lock);
- bufferOffset = 0;
+ this->hidden->bufferOffset = 0;
}
-
- len = bufferSize - bufferOffset;
+
+ len = this->hidden->bufferSize - this->hidden->bufferOffset;
if (len > remaining)
len = remaining;
- SDL_memcpy(ptr, (char *)buffer + bufferOffset, len);
+ SDL_memcpy(ptr, (char *)this->hidden->buffer +
+ this->hidden->bufferOffset, len);
ptr = (char *)ptr + len;
remaining -= len;
- bufferOffset += len;
+ this->hidden->bufferOffset += len;
}
}
return 0;
}
-/* Dummy functions -- we don't use thread-based audio */
-void Core_WaitAudio(_THIS)
+static OSStatus
+inputCallback(void *inRefCon,
+ AudioUnitRenderActionFlags * ioActionFlags,
+ const AudioTimeStamp * inTimeStamp,
+ UInt32 inBusNumber, UInt32 inNumberFrames,
+ AudioBufferList * ioData)
{
- return;
+ //err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer);
+ // !!! FIXME: write me!
+ return noErr;
}
-void Core_PlayAudio(_THIS)
-{
- return;
-}
-Uint8 *Core_GetAudioBuf(_THIS)
+static void
+COREAUDIO_CloseDevice(_THIS)
{
- return(NULL);
-}
+ if (this->hidden != NULL) {
+ if (this->hidden->audioUnitOpened) {
+ OSStatus result = noErr;
+ AURenderCallbackStruct callback;
+ const AudioUnitElement output_bus = 0;
+ const AudioUnitElement input_bus = 1;
+ const int iscapture = this->iscapture;
+ const AudioUnitElement bus =
+ ((iscapture) ? input_bus : output_bus);
+ const AudioUnitScope scope =
+ ((iscapture) ? kAudioUnitScope_Output :
+ kAudioUnitScope_Input);
-void Core_CloseAudio(_THIS)
-{
- OSStatus result;
- struct AURenderCallbackStruct callback;
+ /* stop processing the audio unit */
+ result = AudioOutputUnitStop(this->hidden->audioUnit);
- /* stop processing the audio unit */
- result = AudioOutputUnitStop (outputAudioUnit);
- if (result != noErr) {
- SDL_SetError("Core_CloseAudio: AudioOutputUnitStop");
- return;
+ /* Remove the input callback */
+ SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct));
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioUnitProperty_SetRenderCallback,
+ scope, bus, &callback,
+ sizeof(callback));
+
+ CloseComponent(this->hidden->audioUnit);
+ this->hidden->audioUnitOpened = 0;
+ }
+ SDL_free(this->hidden->buffer);
+ SDL_free(this->hidden);
+ this->hidden = NULL;
}
-
- /* Remove the input callback */
- callback.inputProc = 0;
- callback.inputProcRefCon = 0;
- result = AudioUnitSetProperty (outputAudioUnit,
- kAudioUnitProperty_SetRenderCallback,
- kAudioUnitScope_Input,
- 0,
- &callback,
- sizeof(callback));
- if (result != noErr) {
- SDL_SetError("Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback)");
- return;
- }
-
- result = CloseComponent(outputAudioUnit);
- if (result != noErr) {
- SDL_SetError("Core_CloseAudio: CloseComponent");
- return;
- }
-
- SDL_free(buffer);
}
+
#define CHECK_RESULT(msg) \
if (result != noErr) { \
- SDL_SetError("Failed to start CoreAudio: " msg); \
- return -1; \
+ COREAUDIO_CloseDevice(this); \
+ SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
+ return 0; \
}
+static int
+find_device_by_name(_THIS, const char *devname, int iscapture)
+{
+ AudioDeviceID devid = 0;
+ OSStatus result = noErr;
+ UInt32 size = 0;
+ UInt32 alive = 0;
+ pid_t pid = 0;
-int Core_OpenAudio(_THIS, SDL_AudioSpec *spec)
+ if (devname == NULL) {
+ size = sizeof(AudioDeviceID);
+ const AudioHardwarePropertyID propid =
+ ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice :
+ kAudioHardwarePropertyDefaultOutputDevice);
+
+ result = AudioHardwareGetProperty(propid, &size, &devid);
+ CHECK_RESULT("AudioHardwareGetProperty (default device)");
+ } else {
+ if (!find_device_id(devname, iscapture, &devid)) {
+ SDL_SetError("CoreAudio: No such audio device.");
+ return 0;
+ }
+ }
+
+ size = sizeof(alive);
+ result = AudioDeviceGetProperty(devid, 0, iscapture,
+ kAudioDevicePropertyDeviceIsAlive,
+ &size, &alive);
+ CHECK_RESULT
+ ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)");
+
+ if (!alive) {
+ SDL_SetError("CoreAudio: requested device exists, but isn't alive.");
+ return 0;
+ }
+
+ size = sizeof(pid);
+ result = AudioDeviceGetProperty(devid, 0, iscapture,
+ kAudioDevicePropertyHogMode, &size, &pid);
+
+ /* some devices don't support this property, so errors are fine here. */
+ if ((result == noErr) && (pid != -1)) {
+ SDL_SetError("CoreAudio: requested device is being hogged.");
+ return 0;
+ }
+
+ this->hidden->deviceID = devid;
+ return 1;
+}
+
+
+static int
+prepare_audiounit(_THIS, const char *devname, int iscapture,
+ const AudioStreamBasicDescription * strdesc)
{
OSStatus result = noErr;
- Component comp;
+ AURenderCallbackStruct callback;
ComponentDescription desc;
- struct AURenderCallbackStruct callback;
- AudioStreamBasicDescription requestedDesc;
+ Component comp = NULL;
+ const AudioUnitElement output_bus = 0;
+ const AudioUnitElement input_bus = 1;
+ const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
+ const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output :
+ kAudioUnitScope_Input);
- /* Setup a AudioStreamBasicDescription with the requested format */
- requestedDesc.mFormatID = kAudioFormatLinearPCM;
- requestedDesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
- requestedDesc.mChannelsPerFrame = spec->channels;
- requestedDesc.mSampleRate = spec->freq;
-
- requestedDesc.mBitsPerChannel = spec->format & 0xFF;
- if (spec->format & 0x8000)
- requestedDesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
- if (spec->format & 0x1000)
- requestedDesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
+ if (!find_device_by_name(this, devname, iscapture)) {
+ SDL_SetError("Couldn't find requested CoreAudio device");
+ return 0;
+ }
- requestedDesc.mFramesPerPacket = 1;
- requestedDesc.mBytesPerFrame = requestedDesc.mBitsPerChannel * requestedDesc.mChannelsPerFrame / 8;
- requestedDesc.mBytesPerPacket = requestedDesc.mBytesPerFrame * requestedDesc.mFramesPerPacket;
-
-
- /* Locate the default output audio unit */
+ SDL_memset(&desc, '\0', sizeof(ComponentDescription));
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
- desc.componentFlags = 0;
- desc.componentFlagsMask = 0;
-
- comp = FindNextComponent (NULL, &desc);
- if (comp == NULL) {
- SDL_SetError ("Failed to start CoreAudio: FindNextComponent returned NULL");
- return -1;
- }
-
- /* Open & initialize the default output audio unit */
- result = OpenAComponent (comp, &outputAudioUnit);
- CHECK_RESULT("OpenAComponent")
- result = AudioUnitInitialize (outputAudioUnit);
- CHECK_RESULT("AudioUnitInitialize")
-
- /* Set the input format of the audio unit. */
- result = AudioUnitSetProperty (outputAudioUnit,
- kAudioUnitProperty_StreamFormat,
- kAudioUnitScope_Input,
- 0,
- &requestedDesc,
- sizeof (requestedDesc));
- CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)")
+ comp = FindNextComponent(NULL, &desc);
+ if (comp == NULL) {
+ SDL_SetError("Couldn't find requested CoreAudio component");
+ return 0;
+ }
+
+ /* Open & initialize the audio unit */
+ result = OpenAComponent(comp, &this->hidden->audioUnit);
+ CHECK_RESULT("OpenAComponent");
+
+ this->hidden->audioUnitOpened = 1;
+
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global, 0,
+ &this->hidden->deviceID,
+ sizeof(AudioDeviceID));
+ CHECK_RESULT
+ ("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)");
+
+ /* Set the data format of the audio unit. */
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ scope, bus, strdesc, sizeof(*strdesc));
+ CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)");
/* Set the audio callback */
- callback.inputProc = audioCallback;
+ SDL_memset(&callback, '\0', sizeof(AURenderCallbackStruct));
+ callback.inputProc = ((iscapture) ? inputCallback : outputCallback);
callback.inputProcRefCon = this;
- result = AudioUnitSetProperty (outputAudioUnit,
- kAudioUnitProperty_SetRenderCallback,
- kAudioUnitScope_Input,
- 0,
- &callback,
- sizeof(callback));
- CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback)")
+ result = AudioUnitSetProperty(this->hidden->audioUnit,
+ kAudioUnitProperty_SetRenderCallback,
+ scope, bus, &callback, sizeof(callback));
+ CHECK_RESULT
+ ("AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback)");
/* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
-
+ SDL_CalculateAudioSpec(&this->spec);
+
/* Allocate a sample buffer */
- bufferOffset = bufferSize = this->spec.size;
- buffer = SDL_malloc(bufferSize);
+ this->hidden->bufferOffset = this->hidden->bufferSize = this->spec.size;
+ this->hidden->buffer = SDL_malloc(this->hidden->bufferSize);
+
+ result = AudioUnitInitialize(this->hidden->audioUnit);
+ CHECK_RESULT("AudioUnitInitialize");
/* Finally, start processing of the audio unit */
- result = AudioOutputUnitStart (outputAudioUnit);
- CHECK_RESULT("AudioOutputUnitStart")
-
+ result = AudioOutputUnitStart(this->hidden->audioUnit);
+ CHECK_RESULT("AudioOutputUnitStart");
/* We're running! */
- return(1);
+ return 1;
}
+
+
+static int
+COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ AudioStreamBasicDescription strdesc;
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ int valid_datatype = 0;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return (0);
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+
+ /* Setup a AudioStreamBasicDescription with the requested format */
+ SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription));
+ strdesc.mFormatID = kAudioFormatLinearPCM;
+ strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
+ strdesc.mChannelsPerFrame = this->spec.channels;
+ strdesc.mSampleRate = this->spec.freq;
+ strdesc.mFramesPerPacket = 1;
+
+ while ((!valid_datatype) && (test_format)) {
+ this->spec.format = test_format;
+ /* Just a list of valid SDL formats, so people don't pass junk here. */
+ switch (test_format) {
+ case AUDIO_U8:
+ case AUDIO_S8:
+ case AUDIO_U16LSB:
+ case AUDIO_S16LSB:
+ case AUDIO_U16MSB:
+ case AUDIO_S16MSB:
+ case AUDIO_S32LSB:
+ case AUDIO_S32MSB:
+ case AUDIO_F32LSB:
+ case AUDIO_F32MSB:
+ valid_datatype = 1;
+ strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format);
+ if (SDL_AUDIO_ISBIGENDIAN(this->spec.format))
+ strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
+
+ if (SDL_AUDIO_ISFLOAT(this->spec.format))
+ strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
+ else if (SDL_AUDIO_ISSIGNED(this->spec.format))
+ strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
+ break;
+ }
+ }
+
+ if (!valid_datatype) { /* shouldn't happen, but just in case... */
+ COREAUDIO_CloseDevice(this);
+ SDL_SetError("Unsupported audio format");
+ return 0;
+ }
+
+ strdesc.mBytesPerFrame =
+ strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
+ strdesc.mBytesPerPacket =
+ strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
+
+ if (!prepare_audiounit(this, devname, iscapture, &strdesc)) {
+ COREAUDIO_CloseDevice(this);
+ return 0; /* prepare_audiounit() will call SDL_SetError()... */
+ }
+
+ return 1; /* good to go. */
+}
+
+static int
+COREAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->DetectDevices = COREAUDIO_DetectDevices;
+ impl->GetDeviceName = COREAUDIO_GetDeviceName;
+ impl->OpenDevice = COREAUDIO_OpenDevice;
+ impl->CloseDevice = COREAUDIO_CloseDevice;
+ impl->Deinitialize = COREAUDIO_Deinitialize;
+ impl->ProvidesOwnCallbackThread = 1;
+
+ build_device_lists(); /* do an initial check for devices... */
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap COREAUDIO_bootstrap = {
+ "coreaudio", "Mac OS X CoreAudio", COREAUDIO_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.h b/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.h
index cf7485611..fe3743815 100644
--- a/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/macosx/SDL_coreaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,20 +26,18 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- AudioUnit outputAudioUnit;
- void *buffer;
- UInt32 bufferOffset;
- UInt32 bufferSize;
+struct SDL_PrivateAudioData
+{
+ AudioUnit audioUnit;
+ int audioUnitOpened;
+ void *buffer;
+ UInt32 bufferOffset;
+ UInt32 bufferSize;
+ AudioDeviceID deviceID;
};
-/* Old variable names */
-#define outputAudioUnit (this->hidden->outputAudioUnit)
-#define buffer (this->hidden->buffer)
-#define bufferOffset (this->hidden->bufferOffset)
-#define bufferSize (this->hidden->bufferSize)
-
#endif /* _SDL_coreaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.c b/alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.c
deleted file mode 100644
index 2a29be281..000000000
--- a/alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#if defined(__APPLE__) && defined(__MACH__)
-# include
-#elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335)
-# include
-#else
-# include /* SoundManager interface */
-# include
-# include
-#endif
-
-#if !defined(NewSndCallBackUPP) && (UNIVERSAL_INTERFACES_VERSION < 0x0335)
-#if !defined(NewSndCallBackProc) /* avoid circular redefinition... */
-#define NewSndCallBackUPP NewSndCallBackProc
-#endif
-#if !defined(NewSndCallBackUPP)
-#define NewSndCallBackUPP NewSndCallBackProc
-#endif
-#endif
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_sysaudio.h"
-#include "SDL_romaudio.h"
-
-/* Audio driver functions */
-
-static void Mac_CloseAudio(_THIS);
-static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Mac_LockAudio(_THIS);
-static void Mac_UnlockAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-
-
-static int Audio_Available(void)
-{
- return(1);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = Mac_OpenAudio;
- this->CloseAudio = Mac_CloseAudio;
- this->LockAudio = Mac_LockAudio;
- this->UnlockAudio = Mac_UnlockAudio;
- this->free = Audio_DeleteDevice;
-
-#ifdef __MACOSX__ /* Mac OS X uses threaded audio, so normal thread code is okay */
- this->LockAudio = NULL;
- this->UnlockAudio = NULL;
-#endif
- return this;
-}
-
-AudioBootStrap SNDMGR_bootstrap = {
- "sndmgr", "MacOS SoundManager 3.0",
- Audio_Available, Audio_CreateDevice
-};
-
-#if defined(TARGET_API_MAC_CARBON) || defined(USE_RYANS_SOUNDCODE)
-/* This works correctly on Mac OS X */
-
-#pragma options align=power
-
-static volatile SInt32 audio_is_locked = 0;
-static volatile SInt32 need_to_mix = 0;
-
-static UInt8 *buffer[2];
-static volatile UInt32 running = 0;
-static CmpSoundHeader header;
-static volatile Uint32 fill_me = 0;
-
-static void mix_buffer(SDL_AudioDevice *audio, UInt8 *buffer)
-{
- if ( ! audio->paused ) {
-#ifdef __MACOSX__
- SDL_mutexP(audio->mixer_lock);
-#endif
- if ( audio->convert.needed ) {
- audio->spec.callback(audio->spec.userdata,
- (Uint8 *)audio->convert.buf,audio->convert.len);
- SDL_ConvertAudio(&audio->convert);
- if ( audio->convert.len_cvt != audio->spec.size ) {
- /* Uh oh... probably crashes here */;
- }
- SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
- } else {
- audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size);
- }
-#ifdef __MACOSX__
- SDL_mutexV(audio->mixer_lock);
-#endif
- }
-
- DecrementAtomic((SInt32 *) &need_to_mix);
-}
-
-static void Mac_LockAudio(_THIS)
-{
- IncrementAtomic((SInt32 *) &audio_is_locked);
-}
-
-static void Mac_UnlockAudio(_THIS)
-{
- SInt32 oldval;
-
- oldval = DecrementAtomic((SInt32 *) &audio_is_locked);
- if ( oldval != 1 ) /* != 1 means audio is still locked. */
- return;
-
- /* Did we miss the chance to mix in an interrupt? Do it now. */
- if ( BitAndAtomic (0xFFFFFFFF, (UInt32 *) &need_to_mix) ) {
- /*
- * Note that this could be a problem if you missed an interrupt
- * while the audio was locked, and get preempted by a second
- * interrupt here, but that means you locked for way too long anyhow.
- */
- mix_buffer (this, buffer[fill_me]);
- }
-}
-
-static void callBackProc (SndChannel *chan, SndCommand *cmd_passed ) {
- UInt32 play_me;
- SndCommand cmd;
- SDL_AudioDevice *audio = (SDL_AudioDevice *)chan->userInfo;
-
- IncrementAtomic((SInt32 *) &need_to_mix);
-
- fill_me = cmd_passed->param2; /* buffer that has just finished playing, so fill it */
- play_me = ! fill_me; /* filled buffer to play _now_ */
-
- if ( ! audio->enabled ) {
- return;
- }
-
- /* queue previously mixed buffer for playback. */
- header.samplePtr = (Ptr)buffer[play_me];
- cmd.cmd = bufferCmd;
- cmd.param1 = 0;
- cmd.param2 = (long)&header;
- SndDoCommand (chan, &cmd, 0);
-
- memset (buffer[fill_me], 0, audio->spec.size);
-
- /*
- * if audio device isn't locked, mix the next buffer to be queued in
- * the memory block that just finished playing.
- */
- if ( ! BitAndAtomic(0xFFFFFFFF, (UInt32 *) &audio_is_locked) ) {
- mix_buffer (audio, buffer[fill_me]);
- }
-
- /* set this callback to run again when current buffer drains. */
- if ( running ) {
- cmd.cmd = callBackCmd;
- cmd.param1 = 0;
- cmd.param2 = play_me;
-
- SndDoCommand (chan, &cmd, 0);
- }
-}
-
-static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) {
-
- SndCallBackUPP callback;
- int sample_bits;
- int i;
- long initOptions;
-
- /* Very few conversions are required, but... */
- switch (spec->format) {
- case AUDIO_S8:
- spec->format = AUDIO_U8;
- break;
- case AUDIO_U16LSB:
- spec->format = AUDIO_S16LSB;
- break;
- case AUDIO_U16MSB:
- spec->format = AUDIO_S16MSB;
- break;
- }
- SDL_CalculateAudioSpec(spec);
-
- /* initialize bufferCmd header */
- memset (&header, 0, sizeof(header));
- callback = (SndCallBackUPP) NewSndCallBackUPP (callBackProc);
- sample_bits = spec->size / spec->samples / spec->channels * 8;
-
-#ifdef DEBUG_AUDIO
- fprintf(stderr,
- "Audio format 0x%x, channels = %d, sample_bits = %d, frequency = %d\n",
- spec->format, spec->channels, sample_bits, spec->freq);
-#endif /* DEBUG_AUDIO */
-
- header.numChannels = spec->channels;
- header.sampleSize = sample_bits;
- header.sampleRate = spec->freq << 16;
- header.numFrames = spec->samples;
- header.encode = cmpSH;
-
- /* Note that we install the 16bitLittleEndian Converter if needed. */
- if ( spec->format == 0x8010 ) {
- header.compressionID = fixedCompression;
- header.format = k16BitLittleEndianFormat;
- }
-
- /* allocate 2 buffers */
- for (i=0; i<2; i++) {
- buffer[i] = (UInt8*)malloc (sizeof(UInt8) * spec->size);
- if (buffer[i] == NULL) {
- SDL_OutOfMemory();
- return (-1);
- }
- memset (buffer[i], 0, spec->size);
- }
-
- /* Create the sound manager channel */
- channel = (SndChannelPtr)SDL_malloc(sizeof(*channel));
- if ( channel == NULL ) {
- SDL_OutOfMemory();
- return(-1);
- }
- if ( spec->channels >= 2 ) {
- initOptions = initStereo;
- } else {
- initOptions = initMono;
- }
- channel->userInfo = (long)this;
- channel->qLength = 128;
- if ( SndNewChannel(&channel, sampledSynth, initOptions, callback) != noErr ) {
- SDL_SetError("Unable to create audio channel");
- SDL_free(channel);
- channel = NULL;
- return(-1);
- }
-
- /* start playback */
- {
- SndCommand cmd;
- cmd.cmd = callBackCmd;
- cmd.param2 = 0;
- running = 1;
- SndDoCommand (channel, &cmd, 0);
- }
-
- return 1;
-}
-
-static void Mac_CloseAudio(_THIS) {
-
- int i;
-
- running = 0;
-
- if (channel) {
- SndDisposeChannel (channel, true);
- channel = NULL;
- }
-
- for ( i=0; i<2; ++i ) {
- if ( buffer[i] ) {
- SDL_free(buffer[i]);
- buffer[i] = NULL;
- }
- }
-}
-
-#else /* !TARGET_API_MAC_CARBON && !USE_RYANS_SOUNDCODE */
-
-static void Mac_LockAudio(_THIS)
-{
- /* no-op. */
-}
-
-static void Mac_UnlockAudio(_THIS)
-{
- /* no-op. */
-}
-
-
-/* This function is called by Sound Manager when it has exhausted one of
- the buffers, so we'll zero it to silence and fill it with audio if
- we're not paused.
-*/
-static pascal
-void sndDoubleBackProc (SndChannelPtr chan, SndDoubleBufferPtr newbuf)
-{
- SDL_AudioDevice *audio = (SDL_AudioDevice *)newbuf->dbUserInfo[0];
-
- /* If audio is quitting, don't do anything */
- if ( ! audio->enabled ) {
- return;
- }
- memset (newbuf->dbSoundData, 0, audio->spec.size);
- newbuf->dbNumFrames = audio->spec.samples;
- if ( ! audio->paused ) {
- if ( audio->convert.needed ) {
- audio->spec.callback(audio->spec.userdata,
- (Uint8 *)audio->convert.buf,audio->convert.len);
- SDL_ConvertAudio(&audio->convert);
-#if 0
- if ( audio->convert.len_cvt != audio->spec.size ) {
- /* Uh oh... probably crashes here */;
- }
-#endif
- SDL_memcpy(newbuf->dbSoundData, audio->convert.buf,
- audio->convert.len_cvt);
- } else {
- audio->spec.callback(audio->spec.userdata,
- (Uint8 *)newbuf->dbSoundData, audio->spec.size);
- }
- }
- newbuf->dbFlags |= dbBufferReady;
-}
-
-static int DoubleBufferAudio_Available(void)
-{
- int available;
- NumVersion sndversion;
- long response;
-
- available = 0;
- sndversion = SndSoundManagerVersion();
- if ( sndversion.majorRev >= 3 ) {
- if ( Gestalt(gestaltSoundAttr, &response) == noErr ) {
- if ( (response & (1 << gestaltSndPlayDoubleBuffer)) ) {
- available = 1;
- }
- }
- } else {
- if ( Gestalt(gestaltSoundAttr, &response) == noErr ) {
- if ( (response & (1 << gestaltHasASC)) ) {
- available = 1;
- }
- }
- }
- return(available);
-}
-
-static void Mac_CloseAudio(_THIS)
-{
- int i;
-
- if ( channel != NULL ) {
- /* Clean up the audio channel */
- SndDisposeChannel(channel, true);
- channel = NULL;
- }
- for ( i=0; i<2; ++i ) {
- if ( audio_buf[i] ) {
- SDL_free(audio_buf[i]);
- audio_buf[i] = NULL;
- }
- }
-}
-
-static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- SndDoubleBufferHeader2 audio_dbh;
- int i;
- long initOptions;
- int sample_bits;
- SndDoubleBackUPP doubleBackProc;
-
- /* Check to make sure double-buffered audio is available */
- if ( ! DoubleBufferAudio_Available() ) {
- SDL_SetError("Sound manager doesn't support double-buffering");
- return(-1);
- }
-
- /* Very few conversions are required, but... */
- switch (spec->format) {
- case AUDIO_S8:
- spec->format = AUDIO_U8;
- break;
- case AUDIO_U16LSB:
- spec->format = AUDIO_S16LSB;
- break;
- case AUDIO_U16MSB:
- spec->format = AUDIO_S16MSB;
- break;
- }
- SDL_CalculateAudioSpec(spec);
-
- /* initialize the double-back header */
- SDL_memset(&audio_dbh, 0, sizeof(audio_dbh));
- doubleBackProc = NewSndDoubleBackProc (sndDoubleBackProc);
- sample_bits = spec->size / spec->samples / spec->channels * 8;
-
- audio_dbh.dbhNumChannels = spec->channels;
- audio_dbh.dbhSampleSize = sample_bits;
- audio_dbh.dbhCompressionID = 0;
- audio_dbh.dbhPacketSize = 0;
- audio_dbh.dbhSampleRate = spec->freq << 16;
- audio_dbh.dbhDoubleBack = doubleBackProc;
- audio_dbh.dbhFormat = 0;
-
- /* Note that we install the 16bitLittleEndian Converter if needed. */
- if ( spec->format == 0x8010 ) {
- audio_dbh.dbhCompressionID = fixedCompression;
- audio_dbh.dbhFormat = k16BitLittleEndianFormat;
- }
-
- /* allocate the 2 double-back buffers */
- for ( i=0; i<2; ++i ) {
- audio_buf[i] = SDL_calloc(1, sizeof(SndDoubleBuffer)+spec->size);
- if ( audio_buf[i] == NULL ) {
- SDL_OutOfMemory();
- return(-1);
- }
- audio_buf[i]->dbNumFrames = spec->samples;
- audio_buf[i]->dbFlags = dbBufferReady;
- audio_buf[i]->dbUserInfo[0] = (long)this;
- audio_dbh.dbhBufferPtr[i] = audio_buf[i];
- }
-
- /* Create the sound manager channel */
- channel = (SndChannelPtr)SDL_malloc(sizeof(*channel));
- if ( channel == NULL ) {
- SDL_OutOfMemory();
- return(-1);
- }
- if ( spec->channels >= 2 ) {
- initOptions = initStereo;
- } else {
- initOptions = initMono;
- }
- channel->userInfo = 0;
- channel->qLength = 128;
- if ( SndNewChannel(&channel, sampledSynth, initOptions, 0L) != noErr ) {
- SDL_SetError("Unable to create audio channel");
- SDL_free(channel);
- channel = NULL;
- return(-1);
- }
-
- /* Start playback */
- if ( SndPlayDoubleBuffer(channel, (SndDoubleBufferHeaderPtr)&audio_dbh)
- != noErr ) {
- SDL_SetError("Unable to play double buffered audio");
- return(-1);
- }
-
- return 1;
-}
-
-#endif /* TARGET_API_MAC_CARBON || USE_RYANS_SOUNDCODE */
-
diff --git a/alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.h b/alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.h
deleted file mode 100644
index 2a892f428..000000000
--- a/alienblaster/project/jni/sdl/src/audio/macrom/SDL_romaudio.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#ifndef _SDL_romaudio_h
-#define _SDL_romaudio_h
-
-#include "../SDL_sysaudio.h"
-
-/* This is Ryan's improved MacOS sound code, with locking support */
-#define USE_RYANS_SOUNDCODE
-
-/* Hidden "this" pointer for the video functions */
-#define _THIS SDL_AudioDevice *this
-
-struct SDL_PrivateAudioData {
- /* Sound manager audio channel */
- SndChannelPtr channel;
-#if defined(TARGET_API_MAC_CARBON) || defined(USE_RYANS_SOUNDCODE)
- /* FIXME: Add Ryan's static data here */
-#else
- /* Double buffering variables */
- SndDoubleBufferPtr audio_buf[2];
-#endif
-};
-
-/* Old variable names */
-#define channel (this->hidden->channel)
-#define audio_buf (this->hidden->audio_buf)
-
-#endif /* _SDL_romaudio_h */
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.c b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.c
deleted file mode 100644
index 221c8eb8c..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- Audio interrupt variables and callback function
-
- Patrice Mandin
-*/
-
-#include
-
-#include
-#include
-#include
-#include
-
-#include "SDL_audio.h"
-#include "SDL_mintaudio.h"
-#include "SDL_mintaudio_stfa.h"
-
-/* The audio device */
-
-SDL_AudioDevice *SDL_MintAudio_device;
-Uint8 *SDL_MintAudio_audiobuf[2]; /* Pointers to buffers */
-unsigned long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */
-volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
-volatile unsigned short SDL_MintAudio_mutex;
-volatile unsigned long SDL_MintAudio_clocktics;
-cookie_stfa_t *SDL_MintAudio_stfa;
-unsigned short SDL_MintAudio_hasfpu;
-
-/* MiNT thread variables */
-SDL_bool SDL_MintAudio_mint_present;
-SDL_bool SDL_MintAudio_quit_thread;
-SDL_bool SDL_MintAudio_thread_finished;
-long SDL_MintAudio_thread_pid;
-
-/* The callback function, called by each driver whenever needed */
-
-void SDL_MintAudio_Callback(void)
-{
- Uint8 *buffer;
- SDL_AudioDevice *audio = SDL_MintAudio_device;
-
- buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
- SDL_memset(buffer, audio->spec.silence, audio->spec.size);
-
- if (audio->paused)
- return;
-
- if (audio->convert.needed) {
- int silence;
-
- if ( audio->convert.src_format == AUDIO_U8 ) {
- silence = 0x80;
- } else {
- silence = 0;
- }
- SDL_memset(audio->convert.buf, silence, audio->convert.len);
- audio->spec.callback(audio->spec.userdata,
- (Uint8 *)audio->convert.buf,audio->convert.len);
- SDL_ConvertAudio(&audio->convert);
- SDL_memcpy(buffer, audio->convert.buf, audio->convert.len_cvt);
- } else {
- audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size);
- }
-}
-
-/* Add a new frequency/clock/predivisor to the current list */
-void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
- Uint32 prediv, int gpio_bits)
-{
- int i, p;
-
- if (MINTAUDIO_freqcount==MINTAUDIO_maxfreqs) {
- return;
- }
-
- /* Search where to insert the frequency (highest first) */
- for (p=0; p MINTAUDIO_frequencies[p].frequency) {
- break;
- }
- }
-
- /* Put all following ones farer */
- if (MINTAUDIO_freqcount>0) {
- for (i=MINTAUDIO_freqcount; i>p; i--) {
- SDL_memcpy(&MINTAUDIO_frequencies[i], &MINTAUDIO_frequencies[i-1], sizeof(mint_frequency_t));
- }
- }
-
- /* And insert new one */
- MINTAUDIO_frequencies[p].frequency = frequency;
- MINTAUDIO_frequencies[p].masterclock = clock;
- MINTAUDIO_frequencies[p].predivisor = prediv;
- MINTAUDIO_frequencies[p].gpio_bits = gpio_bits;
-
- MINTAUDIO_freqcount++;
-}
-
-/* Search for the nearest frequency */
-int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq)
-{
- int i;
-
- /* Only 1 freq ? */
- if (MINTAUDIO_freqcount==1) {
- return 0;
- }
-
- /* Check the array */
- for (i=0; i= ((MINTAUDIO_frequencies[i].frequency+
- MINTAUDIO_frequencies[i+1].frequency)>>1)) {
- return i;
- }
- }
-
- /* Not in the array, give the latest */
- return MINTAUDIO_freqcount-1;
-}
-
-/* Check if FPU is present */
-void SDL_MintAudio_CheckFpu(void)
-{
- unsigned long cookie_fpu;
-
- SDL_MintAudio_hasfpu = 0;
- if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) {
- return;
- }
- switch ((cookie_fpu>>16)&0xfffe) {
- case 2:
- case 4:
- case 6:
- case 8:
- case 16:
- SDL_MintAudio_hasfpu = 1;
- break;
- }
-}
-
-/* The thread function, used under MiNT with xbios */
-int SDL_MintAudio_Thread(long param)
-{
- SndBufPtr pointers;
- SDL_bool buffers_filled[2] = {SDL_FALSE, SDL_FALSE};
-
- SDL_MintAudio_thread_finished = SDL_FALSE;
- while (!SDL_MintAudio_quit_thread) {
- if (Buffptr(&pointers)!=0)
- continue;
-
- if (( (unsigned long)pointers.play>=(unsigned long)SDL_MintAudio_audiobuf[0])
- && ( (unsigned long)pointers.play<=(unsigned long)SDL_MintAudio_audiobuf[1]))
- {
- /* DMA is reading buffer #0, setup buffer #1 if not already done */
- if (!buffers_filled[1]) {
- SDL_MintAudio_numbuf = 1;
- SDL_MintAudio_Callback();
- Setbuffer(0, SDL_MintAudio_audiobuf[1], SDL_MintAudio_audiobuf[1] + SDL_MintAudio_audiosize);
- buffers_filled[1]=SDL_TRUE;
- buffers_filled[0]=SDL_FALSE;
- }
- } else {
- /* DMA is reading buffer #1, setup buffer #0 if not already done */
- if (!buffers_filled[0]) {
- SDL_MintAudio_numbuf = 0;
- SDL_MintAudio_Callback();
- Setbuffer(0, SDL_MintAudio_audiobuf[0], SDL_MintAudio_audiobuf[0] + SDL_MintAudio_audiosize);
- buffers_filled[0]=SDL_TRUE;
- buffers_filled[1]=SDL_FALSE;
- }
- }
-
- usleep(100);
- }
- SDL_MintAudio_thread_finished = SDL_TRUE;
- return 0;
-}
-
-void SDL_MintAudio_WaitThread(void)
-{
- if (!SDL_MintAudio_mint_present)
- return;
-
- if (SDL_MintAudio_thread_finished)
- return;
-
- SDL_MintAudio_quit_thread = SDL_TRUE;
- while (!SDL_MintAudio_thread_finished) {
- Syield();
- }
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.h b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.h
deleted file mode 100644
index 859e7bad9..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- MiNT audio driver
-
- Patrice Mandin
-*/
-
-#ifndef _SDL_mintaudio_h
-#define _SDL_mintaudio_h
-
-#include "../SDL_sysaudio.h"
-#include "SDL_mintaudio_stfa.h"
-
-/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
-
-/* 16 predivisors with 3 clocks max. */
-#define MINTAUDIO_maxfreqs (16*3)
-
-typedef struct {
- Uint32 frequency;
- Uint32 masterclock;
- Uint32 predivisor;
- int gpio_bits; /* in case of external clock */
-} mint_frequency_t;
-
-struct SDL_PrivateAudioData {
- mint_frequency_t frequencies[MINTAUDIO_maxfreqs];
- int freq_count; /* Number of frequencies in the array */
- int numfreq; /* Number of selected frequency */
-};
-
-/* Old variable names */
-
-#define MINTAUDIO_frequencies (this->hidden->frequencies)
-#define MINTAUDIO_freqcount (this->hidden->freq_count)
-#define MINTAUDIO_numfreq (this->hidden->numfreq)
-
-/* _MCH cookie (values>>16) */
-enum {
- MCH_ST=0,
- MCH_STE,
- MCH_TT,
- MCH_F30,
- MCH_CLONE,
- MCH_ARANYM
-};
-
-/* Master clocks for replay frequencies */
-#define MASTERCLOCK_STE 8010666 /* Not sure of this one */
-#define MASTERCLOCK_TT 16107953 /* Not sure of this one */
-#define MASTERCLOCK_FALCON1 25175000
-#define MASTERCLOCK_FALCON2 32000000 /* Only usable for DSP56K */
-#define MASTERCLOCK_FALCONEXT -1 /* Clock on DSP56K port, unknown */
-#define MASTERCLOCK_44K 22579200 /* Standard clock for 44.1 Khz */
-#define MASTERCLOCK_48K 24576000 /* Standard clock for 48 Khz */
-
-/* Master clock predivisors */
-#define MASTERPREDIV_STE 160
-#define MASTERPREDIV_TT 320
-#define MASTERPREDIV_FALCON 256
-#define MASTERPREDIV_MILAN 256
-
-/* MFP 68901 interrupt sources */
-#ifndef MFP_PARALLEL
-enum {
- MFP_PARALLEL=0,
- MFP_DCD,
- MFP_CTS,
- MFP_BITBLT,
- MFP_TIMERD,
- MFP_BAUDRATE=MFP_TIMERD,
- MFP_TIMERC,
- MFP_200HZ=MFP_TIMERC,
- MFP_ACIA,
- MFP_DISK,
- MFP_TIMERB,
- MFP_HBLANK=MFP_TIMERB,
- MFP_TERR,
- MFP_TBE,
- MFP_RERR,
- MFP_RBF,
- MFP_TIMERA,
- MFP_DMASOUND=MFP_TIMERA,
- MFP_RING,
- MFP_MONODETECT
-};
-#endif
-
-/* Xbtimer() timers */
-#ifndef XB_TIMERA
-enum {
- XB_TIMERA=0,
- XB_TIMERB,
- XB_TIMERC,
- XB_TIMERD
-};
-#endif
-
-/* Variables */
-extern SDL_AudioDevice *SDL_MintAudio_device;
-extern Uint8 *SDL_MintAudio_audiobuf[2]; /* Pointers to buffers */
-extern unsigned long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */
-extern volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
-extern volatile unsigned short SDL_MintAudio_mutex;
-extern cookie_stfa_t *SDL_MintAudio_stfa;
-extern volatile unsigned long SDL_MintAudio_clocktics;
-extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */
-
-/* MiNT thread variables */
-extern SDL_bool SDL_MintAudio_mint_present;
-extern SDL_bool SDL_MintAudio_quit_thread;
-extern SDL_bool SDL_MintAudio_thread_finished;
-extern long SDL_MintAudio_thread_pid;
-
-/* Functions */
-void SDL_MintAudio_Callback(void);
-void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
- Uint32 prediv, int gpio_bits);
-int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq);
-void SDL_MintAudio_CheckFpu(void);
-
-/* MiNT thread functions */
-int SDL_MintAudio_Thread(long param);
-void SDL_MintAudio_WaitThread(void);
-
-/* ASM interrupt functions */
-void SDL_MintAudio_GsxbInterrupt(void);
-void SDL_MintAudio_EmptyGsxbInterrupt(void);
-void SDL_MintAudio_XbiosInterruptMeasureClock(void);
-void SDL_MintAudio_XbiosInterrupt(void);
-void SDL_MintAudio_Dma8Interrupt(void);
-void SDL_MintAudio_StfaInterrupt(void);
-
-#endif /* _SDL_mintaudio_h */
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.c b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.c
deleted file mode 100644
index 94be6a5a7..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- MiNT audio driver
- using DMA 8bits (hardware access)
-
- Patrice Mandin
-*/
-
-/* Mint includes */
-#include
-#include
-#include
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_sysaudio.h"
-
-#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
-
-#include "SDL_mintaudio.h"
-#include "SDL_mintaudio_dma8.h"
-
-/*--- Defines ---*/
-
-#define MINT_AUDIO_DRIVER_NAME "mint_dma8"
-
-/* Debug print info */
-#define DEBUG_NAME "audio:dma8: "
-#if 0
-#define DEBUG_PRINT(what) \
- { \
- printf what; \
- }
-#else
-#define DEBUG_PRINT(what)
-#endif
-
-/*--- Static variables ---*/
-
-static unsigned long cookie_snd, cookie_mch;
-
-/*--- Audio driver functions ---*/
-
-static void Mint_CloseAudio(_THIS);
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_LockAudio(_THIS);
-static void Mint_UnlockAudio(_THIS);
-
-/* To check/init hardware audio */
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
-
-/*--- Audio driver bootstrap functions ---*/
-
-static int Audio_Available(void)
-{
- const char *envr = SDL_getenv("SDL_AUDIODRIVER");
-
- /* Check if user asked a different audio driver */
- if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
- DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
- return 0;
- }
-
- /* Cookie _MCH present ? if not, assume ST machine */
- if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
- cookie_mch = MCH_ST;
- }
-
- /* Cookie _SND present ? if not, assume ST machine */
- if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
- cookie_snd = SND_PSG;
- }
-
- /* Check if we have 8 bits audio */
- if ((cookie_snd & SND_8BIT)==0) {
- DEBUG_PRINT((DEBUG_NAME "no 8 bits sound\n"));
- return(0);
- }
-
- /* Check if audio is lockable */
- if (cookie_snd & SND_16BIT) {
- if (Locksnd()!=1) {
- DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n"));
- return(0);
- }
-
- Unlocksnd();
- }
-
- DEBUG_PRINT((DEBUG_NAME "8 bits audio available!\n"));
- return(1);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = Mint_OpenAudio;
- this->CloseAudio = Mint_CloseAudio;
- this->LockAudio = Mint_LockAudio;
- this->UnlockAudio = Mint_UnlockAudio;
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap MINTAUDIO_DMA8_bootstrap = {
- MINT_AUDIO_DRIVER_NAME, "MiNT DMA 8 bits audio driver",
- Audio_Available, Audio_CreateDevice
-};
-
-static void Mint_LockAudio(_THIS)
-{
- void *oldpile;
-
- /* Stop replay */
- oldpile=(void *)Super(0);
- DMAAUDIO_IO.control=0;
- Super(oldpile);
-}
-
-static void Mint_UnlockAudio(_THIS)
-{
- void *oldpile;
-
- /* Restart replay */
- oldpile=(void *)Super(0);
- DMAAUDIO_IO.control=3;
- Super(oldpile);
-}
-
-static void Mint_CloseAudio(_THIS)
-{
- void *oldpile;
-
- /* Stop replay */
- oldpile=(void *)Super(0);
- DMAAUDIO_IO.control=0;
- Super(oldpile);
-
- DEBUG_PRINT((DEBUG_NAME "closeaudio: replay stopped\n"));
-
- /* Disable interrupt */
- Jdisint(MFP_DMASOUND);
-
- DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n"));
-
- /* Wait if currently playing sound */
- while (SDL_MintAudio_mutex != 0) {
- }
-
- DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n"));
-
- /* Clear buffers */
- if (SDL_MintAudio_audiobuf[0]) {
- Mfree(SDL_MintAudio_audiobuf[0]);
- SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
- }
-
- DEBUG_PRINT((DEBUG_NAME "closeaudio: buffers freed\n"));
-}
-
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
-{
- int i, masterprediv, sfreq;
- unsigned long masterclock;
-
- DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- if (spec->channels > 2)
- spec->channels = 2;
-
- /* Check formats available */
- spec->format = AUDIO_S8;
-
- /* Calculate and select the closest frequency */
- sfreq=0;
- masterclock=MASTERCLOCK_STE;
- masterprediv=MASTERPREDIV_STE;
- switch(cookie_mch>>16) {
-/*
- case MCH_STE:
- masterclock=MASTERCLOCK_STE;
- masterprediv=MASTERPREDIV_STE;
- break;
-*/
- case MCH_TT:
- masterclock=MASTERCLOCK_TT;
- masterprediv=MASTERPREDIV_TT;
- break;
- case MCH_F30:
- case MCH_ARANYM:
- masterclock=MASTERCLOCK_FALCON1;
- masterprediv=MASTERPREDIV_FALCON;
- sfreq=1;
- break;
- }
-
- MINTAUDIO_freqcount=0;
- for (i=sfreq;i<4;i++) {
- SDL_MintAudio_AddFrequency(this, masterclock/(masterprediv*(1<freq);
- spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
-
- DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- return 0;
-}
-
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec)
-{
- void *oldpile;
- unsigned long buffer;
- unsigned char mode;
-
- /* Set replay tracks */
- if (cookie_snd & SND_16BIT) {
- Settracks(0,0);
- Setmontracks(0);
- }
-
- oldpile=(void *)Super(0);
-
- /* Stop currently playing sound */
- DMAAUDIO_IO.control=0;
-
- /* Set buffer */
- buffer = (unsigned long) SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
- DMAAUDIO_IO.start_high = (buffer>>16) & 255;
- DMAAUDIO_IO.start_mid = (buffer>>8) & 255;
- DMAAUDIO_IO.start_low = buffer & 255;
-
- buffer += SDL_MintAudio_audiosize;
- DMAAUDIO_IO.end_high = (buffer>>16) & 255;
- DMAAUDIO_IO.end_mid = (buffer>>8) & 255;
- DMAAUDIO_IO.end_low = buffer & 255;
-
- mode = 3-MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
- if (spec->channels==1) {
- mode |= 1<<7;
- }
- DMAAUDIO_IO.sound_ctrl = mode;
-
- /* Set interrupt */
- Jdisint(MFP_DMASOUND);
- Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
- Jenabint(MFP_DMASOUND);
-
- if (cookie_snd & SND_16BIT) {
- if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
- }
- }
-
- /* Go */
- DMAAUDIO_IO.control = 3; /* playback + repeat */
-
- Super(oldpile);
-}
-
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- SDL_MintAudio_device = this;
-
- /* Check audio capabilities */
- if (Mint_CheckAudio(this, spec)==-1) {
- return -1;
- }
-
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate memory for audio buffers in DMA-able RAM */
- DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
-
- SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
- if (SDL_MintAudio_audiobuf[0]==NULL) {
- SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
- return (-1);
- }
- SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
- SDL_MintAudio_numbuf=0;
- SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
- SDL_MintAudio_audiosize = spec->size;
- SDL_MintAudio_mutex = 0;
-
- DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
- DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
-
- SDL_MintAudio_CheckFpu();
-
- /* Setup audio hardware */
- Mint_InitAudio(this, spec);
-
- return(1); /* We don't use threaded audio */
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.h b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.h
deleted file mode 100644
index 9ae010b75..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_dma8.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- DMA 8bits and Falcon Codec audio definitions
-
- Patrice Mandin, Didier Méquignon
-*/
-
-#ifndef _SDL_mintaudio_dma8_h
-#define _SDL_mintaudio_dma8_h
-
-#define DMAAUDIO_IO_BASE (0xffff8900)
-struct DMAAUDIO_IO_S {
- unsigned char int_ctrl;
- unsigned char control;
-
- unsigned char dummy1;
- unsigned char start_high;
- unsigned char dummy2;
- unsigned char start_mid;
- unsigned char dummy3;
- unsigned char start_low;
-
- unsigned char dummy4;
- unsigned char cur_high;
- unsigned char dummy5;
- unsigned char cur_mid;
- unsigned char dummy6;
- unsigned char cur_low;
-
- unsigned char dummy7;
- unsigned char end_high;
- unsigned char dummy8;
- unsigned char end_mid;
- unsigned char dummy9;
- unsigned char end_low;
-
- unsigned char dummy10[12];
-
- unsigned char track_ctrl; /* CODEC only */
- unsigned char sound_ctrl;
- unsigned short sound_data;
- unsigned short sound_mask;
-
- unsigned char dummy11[10];
-
- unsigned short dev_ctrl;
- unsigned short dest_ctrl;
- unsigned short sync_div;
- unsigned char track_rec;
- unsigned char adderin_input;
- unsigned char channel_input;
- unsigned char channel_amplification;
- unsigned char channel_reduction;
-
- unsigned char dummy12[6];
-
- unsigned char data_direction;
- unsigned char dummy13;
- unsigned char dev_data;
-};
-#define DMAAUDIO_IO ((*(volatile struct DMAAUDIO_IO_S *)DMAAUDIO_IO_BASE))
-
-#endif /* _SDL_mintaudio_dma8_h */
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.c b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.c
deleted file mode 100644
index 58ddc9f9d..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- MiNT audio driver
- using XBIOS functions (GSXB compatible driver)
-
- Patrice Mandin
-*/
-
-/* Mint includes */
-#include
-#include
-#include
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_sysaudio.h"
-
-#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
-
-#include "SDL_mintaudio.h"
-#include "SDL_mintaudio_gsxb.h"
-
-/*--- Defines ---*/
-
-#define MINT_AUDIO_DRIVER_NAME "mint_gsxb"
-
-/* Debug print info */
-#define DEBUG_NAME "audio:gsxb: "
-#if 0
-#define DEBUG_PRINT(what) \
- { \
- printf what; \
- }
-#else
-#define DEBUG_PRINT(what)
-#endif
-
-/*--- Static variables ---*/
-
-static unsigned long cookie_snd, cookie_gsxb;
-
-/*--- Audio driver functions ---*/
-
-static void Mint_CloseAudio(_THIS);
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_LockAudio(_THIS);
-static void Mint_UnlockAudio(_THIS);
-
-/* To check/init hardware audio */
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
-
-/* GSXB callbacks */
-static void Mint_GsxbInterrupt(void);
-static void Mint_GsxbNullInterrupt(void);
-
-/*--- Audio driver bootstrap functions ---*/
-
-static int Audio_Available(void)
-{
- const char *envr = SDL_getenv("SDL_AUDIODRIVER");
-
- /* Check if user asked a different audio driver */
- if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
- DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
- return(0);
- }
-
- /* Cookie _SND present ? if not, assume ST machine */
- if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
- cookie_snd = SND_PSG;
- }
-
- /* Check if we have 16 bits audio */
- if ((cookie_snd & SND_16BIT)==0) {
- DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n"));
- return(0);
- }
-
- /* Cookie GSXB present ? */
- cookie_gsxb = (Getcookie(C_GSXB, &cookie_gsxb) == C_FOUND);
-
- /* Is it GSXB ? */
- if (((cookie_snd & SND_GSXB)==0) || (cookie_gsxb==0)) {
- DEBUG_PRINT((DEBUG_NAME "no GSXB audio\n"));
- return(0);
- }
-
- /* Check if audio is lockable */
- if (Locksnd()!=1) {
- DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n"));
- return(0);
- }
-
- Unlocksnd();
-
- DEBUG_PRINT((DEBUG_NAME "GSXB audio available!\n"));
- return(1);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = Mint_OpenAudio;
- this->CloseAudio = Mint_CloseAudio;
- this->LockAudio = Mint_LockAudio;
- this->UnlockAudio = Mint_UnlockAudio;
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap MINTAUDIO_GSXB_bootstrap = {
- MINT_AUDIO_DRIVER_NAME, "MiNT GSXB audio driver",
- Audio_Available, Audio_CreateDevice
-};
-
-static void Mint_LockAudio(_THIS)
-{
- /* Stop replay */
- Buffoper(0);
-}
-
-static void Mint_UnlockAudio(_THIS)
-{
- /* Restart replay */
- Buffoper(SB_PLA_ENA|SB_PLA_RPT);
-}
-
-static void Mint_CloseAudio(_THIS)
-{
- /* Stop replay */
- Buffoper(0);
-
- /* Uninstall interrupt */
- if (NSetinterrupt(2, SI_NONE, Mint_GsxbNullInterrupt)<0) {
- DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed in close\n"));
- }
-
- /* Wait if currently playing sound */
- while (SDL_MintAudio_mutex != 0) {
- }
-
- /* Clear buffers */
- if (SDL_MintAudio_audiobuf[0]) {
- Mfree(SDL_MintAudio_audiobuf[0]);
- SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
- }
-
- /* Unlock sound system */
- Unlocksnd();
-}
-
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
-{
- long snd_format;
- int i, resolution, format_signed, format_bigendian;
- Uint16 test_format = SDL_FirstAudioFormat(spec->format);
- int valid_datatype = 0;
-
- resolution = spec->format & 0x00ff;
- format_signed = ((spec->format & 0x8000)!=0);
- format_bigendian = ((spec->format & 0x1000)!=0);
-
- DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- if (spec->channels > 2) {
- spec->channels = 2; /* no more than stereo! */
- }
-
- while ((!valid_datatype) && (test_format)) {
- /* Check formats available */
- snd_format = Sndstatus(SND_QUERYFORMATS);
- spec->format = test_format;
- resolution = spec->format & 0xff;
- format_signed = (spec->format & (1<<15));
- format_bigendian = (spec->format & (1<<12));
- switch (test_format) {
- case AUDIO_U8:
- case AUDIO_S8:
- if (snd_format & SND_FORMAT8) {
- valid_datatype = 1;
- snd_format = Sndstatus(SND_QUERY8BIT);
- }
- break;
-
- case AUDIO_U16LSB:
- case AUDIO_S16LSB:
- case AUDIO_U16MSB:
- case AUDIO_S16MSB:
- if (snd_format & SND_FORMAT16) {
- valid_datatype = 1;
- snd_format = Sndstatus(SND_QUERY16BIT);
- }
- break;
-
- default:
- test_format = SDL_NextAudioFormat();
- break;
- }
- }
-
- if (!valid_datatype) {
- SDL_SetError("Unsupported audio format");
- return (-1);
- }
-
- /* Check signed/unsigned format */
- if (format_signed) {
- if (snd_format & SND_FORMATSIGNED) {
- /* Ok */
- } else if (snd_format & SND_FORMATUNSIGNED) {
- /* Give unsigned format */
- spec->format = spec->format & (~0x8000);
- }
- } else {
- if (snd_format & SND_FORMATUNSIGNED) {
- /* Ok */
- } else if (snd_format & SND_FORMATSIGNED) {
- /* Give signed format */
- spec->format |= 0x8000;
- }
- }
-
- if (format_bigendian) {
- if (snd_format & SND_FORMATBIGENDIAN) {
- /* Ok */
- } else if (snd_format & SND_FORMATLITTLEENDIAN) {
- /* Give little endian format */
- spec->format = spec->format & (~0x1000);
- }
- } else {
- if (snd_format & SND_FORMATLITTLEENDIAN) {
- /* Ok */
- } else if (snd_format & SND_FORMATBIGENDIAN) {
- /* Give big endian format */
- spec->format |= 0x1000;
- }
- }
-
- /* Calculate and select the closest frequency */
- MINTAUDIO_freqcount=0;
- for (i=1;i<4;i++) {
- SDL_MintAudio_AddFrequency(this,
- MASTERCLOCK_44K/(MASTERPREDIV_MILAN*(1<freq);
- spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
-
- DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- return 0;
-}
-
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec)
-{
- int channels_mode, prediv;
- void *buffer;
-
- /* Stop currently playing sound */
- Buffoper(0);
-
- /* Set replay tracks */
- Settracks(0,0);
- Setmontracks(0);
-
- /* Select replay format */
- switch (spec->format & 0xff) {
- case 8:
- if (spec->channels==2) {
- channels_mode=STEREO8;
- } else {
- channels_mode=MONO8;
- }
- break;
- case 16:
- if (spec->channels==2) {
- channels_mode=STEREO16;
- } else {
- channels_mode=MONO16;
- }
- break;
- default:
- channels_mode=STEREO16;
- break;
- }
- if (Setmode(channels_mode)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
- }
-
- prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
- Devconnect(DMAPLAY, DAC, CLKEXT, prediv, 1);
-
- /* Set buffer */
- buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
- if (Setbuffer(0, buffer, buffer + spec->size)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
- }
-
- /* Install interrupt */
- if (NSetinterrupt(2, SI_PLAY, Mint_GsxbInterrupt)<0) {
- DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed\n"));
- }
-
- /* Go */
- Buffoper(SB_PLA_ENA|SB_PLA_RPT);
- DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
-}
-
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- /* Lock sound system */
- if (Locksnd()!=1) {
- SDL_SetError("Mint_OpenAudio: Audio system already in use");
- return(-1);
- }
-
- SDL_MintAudio_device = this;
-
- /* Check audio capabilities */
- if (Mint_CheckAudio(this, spec)==-1) {
- return -1;
- }
-
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate memory for audio buffers in DMA-able RAM */
- DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
-
- SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
- if (SDL_MintAudio_audiobuf[0]==NULL) {
- SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
- return (-1);
- }
- SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
- SDL_MintAudio_numbuf=0;
- SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
- SDL_MintAudio_audiosize = spec->size;
- SDL_MintAudio_mutex = 0;
-
- DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
- DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
-
- SDL_MintAudio_CheckFpu();
-
- /* Setup audio hardware */
- Mint_InitAudio(this, spec);
-
- return(1); /* We don't use threaded audio */
-}
-
-static void Mint_GsxbInterrupt(void)
-{
- Uint8 *newbuf;
-
- if (SDL_MintAudio_mutex)
- return;
-
- SDL_MintAudio_mutex=1;
-
- SDL_MintAudio_numbuf ^= 1;
- SDL_MintAudio_Callback();
- newbuf = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
- Setbuffer(0, newbuf, newbuf + SDL_MintAudio_audiosize);
-
- SDL_MintAudio_mutex=0;
-}
-
-static void Mint_GsxbNullInterrupt(void)
-{
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.h b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.h
deleted file mode 100644
index 7c382882a..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_gsxb.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- * GSXB audio definitions
- *
- * Patrice Mandin
- */
-
-#ifndef _SDL_mintaudio_gsxb_h
-#define _SDL_mintaudio_gsxb_h
-
-#include /* for trap_14_xxx macros */
-
-/* GSXB Cookie */
-
-#define C_GSXB 0x47535842L
-
-/* Bit 5 in cookie _SND */
-
-#define SND_GSXB (1<<5)
-
-/* NSoundcmd modes */
-
-#define SETRATE 7 /* Set sample rate */
-#define SET8BITFORMAT 8 /* 8 bits format */
-#define SET16BITFORMAT 9 /* 16 bits format */
-#define SET24BITFORMAT 10 /* 24 bits format */
-#define SET32BITFORMAT 11 /* 32 bits format */
-#define LTATTEN_MASTER 12 /* Attenuation */
-#define RTATTEN_MASTER 13
-#define LTATTEN_MICIN 14
-#define RTATTEN_MICIN 15
-#define LTATTEN_FMGEN 16
-#define RTATTEN_FMGEN 17
-#define LTATTEN_LINEIN 18
-#define RTATTEN_LINEIN 19
-#define LTATTEN_CDIN 20
-#define RTATTEN_CDIN 21
-#define LTATTEN_VIDIN 22
-#define RTATTEN_VIDIN 23
-#define LTATTEN_AUXIN 24
-#define RTATTEN_AUXIN 25
-
-/* Setmode modes */
-
-#define MONO16 3
-#define STEREO24 4
-#define STEREO32 5
-#define MONO24 6
-#define MONO32 7
-
-/* Sndstatus modes */
-
-#define SND_QUERYFORMATS 2
-#define SND_QUERYMIXERS 3
-#define SND_QUERYSOURCES 4
-#define SND_QUERYDUPLEX 5
-#define SND_QUERY8BIT 8
-#define SND_QUERY16BIT 9
-#define SND_QUERY24BIT 10
-#define SND_QUERY32BIT 11
-
-#define SND_FORMAT8 (1<<0)
-#define SND_FORMAT16 (1<<1)
-#define SND_FORMAT24 (1<<2)
-#define SND_FORMAT32 (1<<3)
-
-#define SND_FORMATSIGNED (1<<0)
-#define SND_FORMATUNSIGNED (1<<1)
-#define SND_FORMATBIGENDIAN (1<<2)
-#define SND_FORMATLITTLEENDIAN (1<<3)
-
-/* Devconnect prescalers */
-
-#define CLK_44K 1
-#define CLK_22K 3
-#define CLK_11K 7
-
-/* Extra xbios functions */
-
-#define NSoundcmd(mode,data,data2) \
- (long)trap_14_wwl((short)130,(short)(mode),(short)(data),(long)(data2))
-#define NSetinterrupt(src_inter,cause,inth_addr) \
- (long)trap_14_wwwl((short)135,(short)(src_inter),(short)(cause), \
- (long)(inth_addr))
-
-#endif /* _SDL_mintaudio_gsxb_h */
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_it.S b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_it.S
deleted file mode 100644
index f2d36e80d..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_it.S
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/*
- Audio interrupts
-
- Patrice Mandin, Didier Méquignon
- */
-
- .text
-
- .globl _SDL_MintAudio_Callback
-
- .globl _SDL_MintAudio_XbiosInterrupt
- .globl _SDL_MintAudio_XbiosInterruptMeasureClock
- .globl _SDL_MintAudio_Dma8Interrupt
- .globl _SDL_MintAudio_StfaInterrupt
-
- .globl _SDL_MintAudio_mutex
- .globl _SDL_MintAudio_audiobuf
- .globl _SDL_MintAudio_numbuf
- .globl _SDL_MintAudio_audiosize
- .globl _SDL_MintAudio_clocktics
- .globl _SDL_MintAudio_hasfpu
-
- .globl _SDL_MintAudio_stfa
-
-/*
- How it works:
- - Audio is playing buffer #0 (resp. #1)
- - We must calculate a sample in buffer #1 (resp. #0)
- so we first call the callback to do it
- - Then we swap the buffers
-*/
-
-#define savptr 0x4a2
-#define savamt 0x46
-
-/*--- Xbios interrupt vector to measure Falcon external clock ---*/
-
-_SDL_MintAudio_XbiosInterruptMeasureClock: /* 1 mS */
-
- btst #0,0xFFFF8901:w /* state DMA sound */
- beqs SDL_MintAudio_EndIntMeasure
- addql #1,_SDL_MintAudio_clocktics
-SDL_MintAudio_EndIntMeasure:
- bclr #5,0xFFFFFA0F:w /* Clear service bit */
- rte
-
-/*--- Xbios interrupt vector ---*/
-
-_SDL_MintAudio_XbiosInterrupt:
-
- /* Reenable interrupts, so other interrupts can work */
- movew #0x2300,sr
-
- /* Clear service bit, so other MFP interrupts can work */
- bclr #5,0xfffffa0f:w
-
- /* Check if we are not already running */
- tstw _SDL_MintAudio_mutex
- bne SDL_MintAudio_XbiosEnd
- notw _SDL_MintAudio_mutex
-
- /* Swap buffers */
- eorw #1,_SDL_MintAudio_numbuf
-
- moveml d0-d7/a0-a6,sp@-
-
- /* Save FPU if needed */
- tstw _SDL_MintAudio_hasfpu
- beqs SDL_MintAudio_Xbios_nofpu1
- .chip 68060
- fsave sp@-
- fmoveml fpcr/fpsr/fpiar,sp@-
- fmovemx fp0-fp7,sp@-
- .chip 68000
-SDL_MintAudio_Xbios_nofpu1:
-
- /* Callback */
- jsr _SDL_MintAudio_Callback
-
- /* Restore FPU if needed */
- tstw _SDL_MintAudio_hasfpu
- beqs SDL_MintAudio_Xbios_nofpu2
- .chip 68060
- fmovemx sp@+,fp0-fp7
- fmoveml sp@+,fpcr/fpsr/fpiar
- frestore sp@+
- .chip 68000
-SDL_MintAudio_Xbios_nofpu2:
-
- /* Reserve space for registers */
- subl #savamt,savptr
-
- /* Set new buffer */
-
- moveq #0,d0
- movel _SDL_MintAudio_audiosize,d1
-
- movew _SDL_MintAudio_numbuf,d0
- lsll #2,d0
- lea _SDL_MintAudio_audiobuf,a0
- movel a0@(d0:l),a1
-
- lea a1@(d1:l),a2
-
- movel a2,sp@-
- movel a1,sp@-
- clrw sp@-
- movew #131,sp@-
- trap #14
- lea sp@(12),sp
-
- /* Restore registers space */
- addl #savamt,savptr
-
- moveml sp@+,d0-d7/a0-a6
-
- clrw _SDL_MintAudio_mutex
-SDL_MintAudio_XbiosEnd:
- rte
-
-/*--- DMA 8 bits interrupt vector ---*/
-
-_SDL_MintAudio_Dma8Interrupt:
-
- /* Reenable interrupts, so other interrupts can work */
- movew #0x2300,sr
-
- /* Clear service bit, so other MFP interrupts can work */
- bclr #5,0xfffffa0f:w
-
- /* Check if we are not already running */
- tstw _SDL_MintAudio_mutex
- bne SDL_MintAudio_Dma8End
- notw _SDL_MintAudio_mutex
-
- /* Swap buffers */
- eorw #1,_SDL_MintAudio_numbuf
-
- moveml d0-d1/a0-a1,sp@-
-
- /* Save FPU if needed */
- tstw _SDL_MintAudio_hasfpu
- beqs SDL_MintAudio_Dma8_nofpu1
- .chip 68060
- fsave sp@-
- fmoveml fpcr/fpsr/fpiar,sp@-
- fmovemx fp0-fp7,sp@-
- .chip 68000
-SDL_MintAudio_Dma8_nofpu1:
-
- /* Callback */
- jsr _SDL_MintAudio_Callback
-
- /* Restore FPU if needed */
- tstw _SDL_MintAudio_hasfpu
- beqs SDL_MintAudio_Dma8_nofpu2
- .chip 68060
- fmovemx sp@+,fp0-fp7
- fmoveml sp@+,fpcr/fpsr/fpiar
- frestore sp@+
- .chip 68000
-SDL_MintAudio_Dma8_nofpu2:
-
- /* Set new buffer */
-
- moveq #0,d0
-
- movew _SDL_MintAudio_numbuf,d0
- lslw #2,d0
- lea _SDL_MintAudio_audiobuf,a0
- movel a0@(d0:w),d1
-
- /* Modify DMA addresses */
- lea 0xffff8900:w,a0
-
- moveb d1,a0@(0x07) /* Start address */
- rorl #8,d1
- moveb d1,a0@(0x05)
- rorl #8,d1
- moveb d1,a0@(0x03)
- swap d1
-
- addl _SDL_MintAudio_audiosize,d1
-
- moveb d1,a0@(0x13) /* End address */
- rorl #8,d1
- moveb d1,a0@(0x11)
- rorl #8,d1
- moveb d1,a0@(0x0f)
-
- moveml sp@+,d0-d1/a0-a1
-
- clrw _SDL_MintAudio_mutex
-SDL_MintAudio_Dma8End:
- rte
-
-/*--- STFA interrupt vector ---*/
-
-STFA_SOUND_START = 6
-STFA_SOUND_END = STFA_SOUND_START+8
-
-_SDL_MintAudio_StfaInterrupt:
-
- /* Reenable interrupts, so other interrupts can work */
- movew #0x2300,sr
-
- /* Check if we are not already running */
- tstw _SDL_MintAudio_mutex
- bnes SDL_MintAudio_StfaEnd
- notw _SDL_MintAudio_mutex
-
- /* Swap buffers */
- eorw #1,_SDL_MintAudio_numbuf
-
- moveml d0-d7/a0-a6,sp@-
-
- /* Save FPU if needed */
- tstw _SDL_MintAudio_hasfpu
- beqs SDL_MintAudio_Stfa_nofpu1
- .chip 68060
- fsave sp@-
- fmoveml fpcr/fpsr/fpiar,sp@-
- fmovemx fp0-fp7,sp@-
- .chip 68000
-SDL_MintAudio_Stfa_nofpu1:
-
- /* Callback */
- jsr _SDL_MintAudio_Callback
-
- /* Restore FPU if needed */
- tstw _SDL_MintAudio_hasfpu
- beqs SDL_MintAudio_Stfa_nofpu2
- .chip 68060
- fmovemx sp@+,fp0-fp7
- fmoveml sp@+,fpcr/fpsr/fpiar
- frestore sp@+
- .chip 68000
-SDL_MintAudio_Stfa_nofpu2:
-
- /* Set new buffer */
-
- moveq #0,d0
- movel _SDL_MintAudio_stfa,a1
-
- movew _SDL_MintAudio_numbuf,d0
- lslw #2,d0
- lea _SDL_MintAudio_audiobuf,a0
- movel a0@(d0:w),d1
-
- /* Modify STFA replay buffers */
- movel d1,a1@(STFA_SOUND_START)
- addl _SDL_MintAudio_audiosize,d1
- movel d1,a1@(STFA_SOUND_END)
-
- moveml sp@+,d0-d7/a0-a6
-
- clrw _SDL_MintAudio_mutex
-SDL_MintAudio_StfaEnd:
- rte
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.c b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.c
deleted file mode 100644
index 93769025f..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- MiNT audio driver
- using XBIOS functions (MacSound compatible driver)
-
- Patrice Mandin
-*/
-
-#include
-
-/* Mint includes */
-#include
-#include
-#include
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_sysaudio.h"
-
-#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
-
-#include "SDL_mintaudio.h"
-#include "SDL_mintaudio_mcsn.h"
-
-/*--- Defines ---*/
-
-#define MINT_AUDIO_DRIVER_NAME "mint_mcsn"
-
-/* Debug print info */
-#define DEBUG_NAME "audio:mcsn: "
-#if 0
-#define DEBUG_PRINT(what) \
- { \
- printf what; \
- }
-#else
-#define DEBUG_PRINT(what)
-#endif
-
-/*--- Static variables ---*/
-
-static unsigned long cookie_snd, cookie_mch;
-static cookie_mcsn_t *cookie_mcsn;
-
-/*--- Audio driver functions ---*/
-
-static void Mint_CloseAudio(_THIS);
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_LockAudio(_THIS);
-static void Mint_UnlockAudio(_THIS);
-
-/* To check/init hardware audio */
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
-
-/*--- Audio driver bootstrap functions ---*/
-
-static int Audio_Available(void)
-{
- unsigned long dummy;
- const char *envr = SDL_getenv("SDL_AUDIODRIVER");
-
- SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
-
- /* We can't use XBIOS in interrupt with Magic, don't know about thread */
- if (Getcookie(C_MagX, &dummy) == C_FOUND) {
- return(0);
- }
-
- /* Check if user asked a different audio driver */
- if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
- DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
- return(0);
- }
-
- /* Cookie _MCH present ? if not, assume ST machine */
- if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
- cookie_mch = MCH_ST;
- }
-
- /* Cookie _SND present ? if not, assume ST machine */
- if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
- cookie_snd = SND_PSG;
- }
-
- /* Check if we have 16 bits audio */
- if ((cookie_snd & SND_16BIT)==0) {
- DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n"));
- return(0);
- }
-
- /* Cookie MCSN present ? */
- if (Getcookie(C_McSn, (long *) &cookie_mcsn) != C_FOUND) {
- DEBUG_PRINT((DEBUG_NAME "no MCSN audio\n"));
- return(0);
- }
-
- /* Check if interrupt at end of replay */
- if (cookie_mcsn->pint == 0) {
- DEBUG_PRINT((DEBUG_NAME "no interrupt at end of replay\n"));
- return(0);
- }
-
- /* Check if audio is lockable */
- if (Locksnd()!=1) {
- DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n"));
- return(0);
- }
-
- Unlocksnd();
-
- DEBUG_PRINT((DEBUG_NAME "MCSN audio available!\n"));
- return(1);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = Mint_OpenAudio;
- this->CloseAudio = Mint_CloseAudio;
- this->LockAudio = Mint_LockAudio;
- this->UnlockAudio = Mint_UnlockAudio;
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap MINTAUDIO_MCSN_bootstrap = {
- MINT_AUDIO_DRIVER_NAME, "MiNT MCSN audio driver",
- Audio_Available, Audio_CreateDevice
-};
-
-static void Mint_LockAudio(_THIS)
-{
- /* Stop replay */
- Buffoper(0);
-}
-
-static void Mint_UnlockAudio(_THIS)
-{
- /* Restart replay */
- Buffoper(SB_PLA_ENA|SB_PLA_RPT);
-}
-
-static void Mint_CloseAudio(_THIS)
-{
- /* Stop replay */
- SDL_MintAudio_WaitThread();
- Buffoper(0);
-
- if (!SDL_MintAudio_mint_present) {
- /* Uninstall interrupt */
- Jdisint(MFP_DMASOUND);
- }
-
- /* Wait if currently playing sound */
- while (SDL_MintAudio_mutex != 0) {
- }
-
- /* Clear buffers */
- if (SDL_MintAudio_audiobuf[0]) {
- Mfree(SDL_MintAudio_audiobuf[0]);
- SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
- }
-
- /* Unlock sound system */
- Unlocksnd();
-}
-
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
-{
- int i;
- unsigned long masterclock, masterprediv;
-
- DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- if (spec->channels > 2) {
- spec->channels = 2; /* no more than stereo! */
- }
-
- /* Check formats available */
- MINTAUDIO_freqcount=0;
- switch(cookie_mcsn->play) {
- case MCSN_ST:
- spec->channels=1;
- spec->format=8; /* FIXME: is it signed or unsigned ? */
- SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1);
- break;
- case MCSN_TT: /* Also STE, Mega STE */
- spec->format=AUDIO_S8;
- masterclock=MASTERCLOCK_STE;
- masterprediv=MASTERPREDIV_STE;
- if ((cookie_mch>>16)==MCH_TT) {
- masterclock=MASTERCLOCK_TT;
- masterprediv=MASTERPREDIV_TT;
- }
- for (i=0; i<4; i++) {
- SDL_MintAudio_AddFrequency(this, masterclock/(masterprediv*(1<res1 != 0) {
- for (i=1; i<4; i++) {
- SDL_MintAudio_AddFrequency(this, (cookie_mcsn->res1)/(MASTERPREDIV_FALCON*(1<format |= 0x8000; /* Audio is always signed */
- if ((spec->format & 0x00ff)==16) {
- spec->format |= 0x1000; /* Audio is always big endian */
- spec->channels=2; /* 16 bits always stereo */
- }
- break;
- }
-
-#if 0
- for (i=0; ifreq);
- spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
-
- DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- return 0;
-}
-
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec)
-{
- int channels_mode, prediv, dmaclock;
- void *buffer;
-
- /* Stop currently playing sound */
- SDL_MintAudio_quit_thread = SDL_FALSE;
- SDL_MintAudio_thread_finished = SDL_TRUE;
- SDL_MintAudio_WaitThread();
- Buffoper(0);
-
- /* Set replay tracks */
- Settracks(0,0);
- Setmontracks(0);
-
- /* Select replay format */
- channels_mode=STEREO16;
- switch (spec->format & 0xff) {
- case 8:
- if (spec->channels==2) {
- channels_mode=STEREO8;
- } else {
- channels_mode=MONO8;
- }
- break;
- }
- if (Setmode(channels_mode)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
- }
-
- dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock;
- prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
- switch(cookie_mcsn->play) {
- case MCSN_TT:
- Devconnect(DMAPLAY, DAC, CLK25M, CLKOLD, 1);
- Soundcmd(SETPRESCALE, prediv);
- DEBUG_PRINT((DEBUG_NAME "STE/TT prescaler selected\n"));
- break;
- case MCSN_FALCON:
- Devconnect(DMAPLAY, DAC, dmaclock, prediv, 1);
- DEBUG_PRINT((DEBUG_NAME "Falcon prescaler selected\n"));
- break;
- }
-
- /* Set buffer */
- buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
- if (Setbuffer(0, buffer, buffer + spec->size)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
- }
-
- if (SDL_MintAudio_mint_present) {
- SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0);
- } else {
- /* Install interrupt */
- Jdisint(MFP_DMASOUND);
- Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);
- Jenabint(MFP_DMASOUND);
-
- if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
- }
- }
-
- /* Go */
- Buffoper(SB_PLA_ENA|SB_PLA_RPT);
- DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
-}
-
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- /* Lock sound system */
- if (Locksnd()!=1) {
- SDL_SetError("Mint_OpenAudio: Audio system already in use");
- return(-1);
- }
-
- SDL_MintAudio_device = this;
-
- /* Check audio capabilities */
- if (Mint_CheckAudio(this, spec)==-1) {
- return -1;
- }
-
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate memory for audio buffers in DMA-able RAM */
- DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
-
- SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
- if (SDL_MintAudio_audiobuf[0]==NULL) {
- SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
- return (-1);
- }
- SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
- SDL_MintAudio_numbuf=0;
- SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
- SDL_MintAudio_audiosize = spec->size;
- SDL_MintAudio_mutex = 0;
-
- DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
- DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
-
- SDL_MintAudio_CheckFpu();
-
- /* Setup audio hardware */
- Mint_InitAudio(this, spec);
-
- return(1); /* We don't use SDL threaded audio */
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.h b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.h
deleted file mode 100644
index 18fd59cd7..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_mcsn.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- MCSN control structure
-
- Patrice Mandin
-*/
-
-#ifndef _SDL_mintaudio_mcsh_h
-#define _SDL_mintaudio_mcsh_h
-
-typedef struct {
- unsigned short version; /* Version */
- unsigned short size; /* Size of structure */
-
- unsigned short play; /* Replay capability */
- unsigned short record; /* Record capability */
- unsigned short dsp; /* DSP56K present */
- unsigned short pint; /* Interrupt at end of replay */
- unsigned short rint; /* Interrupt at end of record */
-
- unsigned long res1; /* Frequency of external clock */
- unsigned long res2;
- unsigned long res3;
- unsigned long res4;
-} cookie_mcsn_t __attribute__((packed));
-
-enum {
- MCSN_ST=0,
- MCSN_TT,
- MCSN_STE=MCSN_TT,
- MCSN_FALCON,
- MCSN_MAC=MCSN_FALCON
-};
-
-#define SETSMPFREQ 7 /* Set sample frequency */
-
-#endif /* _SDL_mintaudio_mcsh_h */
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.c b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.c
deleted file mode 100644
index 6940f80c6..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- MiNT audio driver
- using XBIOS functions (STFA driver)
-
- Patrice Mandin
-*/
-
-/* Mint includes */
-#include
-#include
-#include
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_sysaudio.h"
-
-#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
-
-#include "SDL_mintaudio.h"
-#include "SDL_mintaudio_stfa.h"
-
-/*--- Defines ---*/
-
-#define MINT_AUDIO_DRIVER_NAME "mint_stfa"
-
-/* Debug print info */
-#define DEBUG_NAME "audio:stfa: "
-#if 0
-#define DEBUG_PRINT(what) \
- { \
- printf what; \
- }
-#else
-#define DEBUG_PRINT(what)
-#endif
-
-/*--- Static variables ---*/
-
-static unsigned long cookie_snd, cookie_mch;
-static cookie_stfa_t *cookie_stfa;
-
-static const int freqs[16]={
- 4995, 6269, 7493, 8192,
- 9830, 10971, 12538, 14985,
- 16384, 19819, 21943, 24576,
- 30720, 32336, 43885, 49152
-};
-
-/*--- Audio driver functions ---*/
-
-static void Mint_CloseAudio(_THIS);
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_LockAudio(_THIS);
-static void Mint_UnlockAudio(_THIS);
-
-/* To check/init hardware audio */
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
-
-/*--- Audio driver bootstrap functions ---*/
-
-static int Audio_Available(void)
-{
- const char *envr = SDL_getenv("SDL_AUDIODRIVER");
-
- /* Check if user asked a different audio driver */
- if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
- DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
- return(0);
- }
-
- /* Cookie _MCH present ? if not, assume ST machine */
- if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
- cookie_mch = MCH_ST;
- }
-
- /* Cookie _SND present ? if not, assume ST machine */
- if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
- cookie_snd = SND_PSG;
- }
-
- /* Cookie STFA present ? */
- if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) {
- DEBUG_PRINT((DEBUG_NAME "no STFA audio\n"));
- return(0);
- }
-
- SDL_MintAudio_stfa = cookie_stfa;
-
- DEBUG_PRINT((DEBUG_NAME "STFA audio available!\n"));
- return(1);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = Mint_OpenAudio;
- this->CloseAudio = Mint_CloseAudio;
- this->LockAudio = Mint_LockAudio;
- this->UnlockAudio = Mint_UnlockAudio;
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap MINTAUDIO_STFA_bootstrap = {
- MINT_AUDIO_DRIVER_NAME, "MiNT STFA audio driver",
- Audio_Available, Audio_CreateDevice
-};
-
-static void Mint_LockAudio(_THIS)
-{
- void *oldpile;
-
- /* Stop replay */
- oldpile=(void *)Super(0);
- cookie_stfa->sound_enable=STFA_PLAY_DISABLE;
- Super(oldpile);
-}
-
-static void Mint_UnlockAudio(_THIS)
-{
- void *oldpile;
-
- /* Restart replay */
- oldpile=(void *)Super(0);
- cookie_stfa->sound_enable=STFA_PLAY_ENABLE|STFA_PLAY_REPEAT;
- Super(oldpile);
-}
-
-static void Mint_CloseAudio(_THIS)
-{
- void *oldpile;
-
- /* Stop replay */
- oldpile=(void *)Super(0);
- cookie_stfa->sound_enable=STFA_PLAY_DISABLE;
- Super(oldpile);
-
- /* Wait if currently playing sound */
- while (SDL_MintAudio_mutex != 0) {
- }
-
- /* Clear buffers */
- if (SDL_MintAudio_audiobuf[0]) {
- Mfree(SDL_MintAudio_audiobuf[0]);
- SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
- }
-}
-
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
-{
- int i;
-
- DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- if (spec->channels > 2) {
- spec->channels = 2; /* no more than stereo! */
- }
-
- /* Check formats available */
- MINTAUDIO_freqcount=0;
- for (i=0;i<16;i++) {
- SDL_MintAudio_AddFrequency(this, freqs[i], 0, i, -1);
- }
-
-#if 1
- for (i=0; ifreq);
- spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
-
- DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- return 0;
-}
-
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec)
-{
- void *buffer;
- void *oldpile;
-
- buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
-
- oldpile=(void *)Super(0);
-
- /* Stop replay */
- cookie_stfa->sound_enable=STFA_PLAY_DISABLE;
-
- /* Select replay format */
- cookie_stfa->sound_control = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
- if ((spec->format & 0xff)==8) {
- cookie_stfa->sound_control |= STFA_FORMAT_8BIT;
- } else {
- cookie_stfa->sound_control |= STFA_FORMAT_16BIT;
- }
- if (spec->channels==2) {
- cookie_stfa->sound_control |= STFA_FORMAT_STEREO;
- } else {
- cookie_stfa->sound_control |= STFA_FORMAT_MONO;
- }
- if ((spec->format & 0x8000)!=0) {
- cookie_stfa->sound_control |= STFA_FORMAT_SIGNED;
- } else {
- cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED;
- }
- if ((spec->format & 0x1000)!=0) {
- cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN;
- } else {
- cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN;
- }
-
- /* Set buffer */
- cookie_stfa->sound_start = (unsigned long) buffer;
- cookie_stfa->sound_end = (unsigned long) (buffer + spec->size);
-
- /* Set interrupt */
- cookie_stfa->stfa_it = SDL_MintAudio_StfaInterrupt;
-
- /* Restart replay */
- cookie_stfa->sound_enable=STFA_PLAY_ENABLE|STFA_PLAY_REPEAT;
-
- Super(oldpile);
-
- DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
-}
-
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- SDL_MintAudio_device = this;
-
- /* Check audio capabilities */
- if (Mint_CheckAudio(this, spec)==-1) {
- return -1;
- }
-
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate memory for audio buffers in DMA-able RAM */
- DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
-
- SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
- if (SDL_MintAudio_audiobuf[0]==NULL) {
- SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
- return (-1);
- }
- SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
- SDL_MintAudio_numbuf=0;
- SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
- SDL_MintAudio_audiosize = spec->size;
- SDL_MintAudio_mutex = 0;
-
- DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
- DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
-
- SDL_MintAudio_CheckFpu();
-
- /* Setup audio hardware */
- Mint_InitAudio(this, spec);
-
- return(1); /* We don't use threaded audio */
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.h b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.h
deleted file mode 100644
index 006fa751c..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_stfa.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- STFA control structure
-
- Patrice Mandin
-*/
-
-#ifndef _SDL_mintaudio_stfa_h
-#define _SDL_mintaudio_stfa_h
-
-/*--- Defines ---*/
-
-#define C_STFA 0x53544641L /* Sound treiber für atari (seb/The removers) */
-
-#define STFA_PLAY_ENABLE (1<<0)
-#define STFA_PLAY_DISABLE (0<<0)
-#define STFA_PLAY_REPEAT (1<<1)
-#define STFA_PLAY_SINGLE (0<<1)
-
-#define STFA_FORMAT_SIGNED (1<<15)
-#define STFA_FORMAT_UNSIGNED (0<<15)
-#define STFA_FORMAT_STEREO (1<<14)
-#define STFA_FORMAT_MONO (0<<14)
-#define STFA_FORMAT_16BIT (1<<13)
-#define STFA_FORMAT_8BIT (0<<13)
-#define STFA_FORMAT_LITENDIAN (1<<9)
-#define STFA_FORMAT_BIGENDIAN (0<<9)
-#define STFA_FORMAT_FREQ_MASK 0x0f
-enum {
- STFA_FORMAT_F4995=0,
- STFA_FORMAT_F6269,
- STFA_FORMAT_F7493,
- STFA_FORMAT_F8192,
-
- STFA_FORMAT_F9830,
- STFA_FORMAT_F10971,
- STFA_FORMAT_F12538,
- STFA_FORMAT_F14985,
-
- STFA_FORMAT_F16384,
- STFA_FORMAT_F19819,
- STFA_FORMAT_F21943,
- STFA_FORMAT_F24576,
-
- STFA_FORMAT_F30720,
- STFA_FORMAT_F32336,
- STFA_FORMAT_F43885,
- STFA_FORMAT_F49152
-};
-
-/*--- Types ---*/
-
-typedef struct {
- unsigned short sound_enable;
- unsigned short sound_control;
- unsigned short sound_output;
- unsigned long sound_start;
- unsigned long sound_current;
- unsigned long sound_end;
- unsigned short version;
- void *old_vbl;
- void *old_timera;
- unsigned long old_mfp_status;
- void *new_vbl;
- void *drivers_list;
- void *play_stop;
- unsigned short frequency;
- void *set_frequency;
-
- unsigned short frequency_threshold;
- unsigned short *custom_freq_table;
- unsigned short stfa_on_off;
- void *new_drivers_list;
- unsigned long old_bit_2_of_cookie_snd;
- void (*stfa_it)(void);
-} cookie_stfa_t __attribute__((packed));
-
-#endif /* _SDL_mintaudio_stfa_h */
diff --git a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_xbios.c b/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_xbios.c
deleted file mode 100644
index 0ad6a2031..000000000
--- a/alienblaster/project/jni/sdl/src/audio/mint/SDL_mintaudio_xbios.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/*
- MiNT audio driver
- using XBIOS functions (Falcon)
-
- Patrice Mandin, Didier Méquignon
-*/
-
-#include
-#include
-
-/* Mint includes */
-#include
-#include
-#include
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_sysaudio.h"
-
-#include "../../video/ataricommon/SDL_atarimxalloc_c.h"
-
-#include "SDL_mintaudio.h"
-#include "SDL_mintaudio_dma8.h"
-
-/*--- Defines ---*/
-
-#define MINT_AUDIO_DRIVER_NAME "mint_xbios"
-
-/* Debug print info */
-#define DEBUG_NAME "audio:xbios: "
-#if 0
-#define DEBUG_PRINT(what) \
- { \
- printf what; \
- }
-#else
-#define DEBUG_PRINT(what)
-#endif
-
-/*--- Static variables ---*/
-
-static unsigned long cookie_snd;
-
-/*--- Audio driver functions ---*/
-
-static void Mint_CloseAudio(_THIS);
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_LockAudio(_THIS);
-static void Mint_UnlockAudio(_THIS);
-
-/* To check/init hardware audio */
-static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
-
-/*--- Audio driver bootstrap functions ---*/
-
-static int Audio_Available(void)
-{
- unsigned long dummy;
- const char *envr = SDL_getenv("SDL_AUDIODRIVER");
-
- /*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);*/
- SDL_MintAudio_mint_present = SDL_FALSE;
-
- /* We can't use XBIOS in interrupt with Magic, don't know about thread */
- /*if (Getcookie(C_MagX, &dummy) == C_FOUND) {
- return(0);
- }*/
-
- /* Check if user asked a different audio driver */
- if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME)!=0)) {
- DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
- return(0);
- }
-
- /* Cookie _SND present ? if not, assume ST machine */
- if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
- cookie_snd = SND_PSG;
- }
-
- /* Check if we have 16 bits audio */
- if ((cookie_snd & SND_16BIT)==0) {
- DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n"));
- return(0);
- }
-
- /* Check if audio is lockable */
- if (Locksnd()!=1) {
- DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n"));
- return(0);
- }
-
- Unlocksnd();
-
- DEBUG_PRINT((DEBUG_NAME "XBIOS audio available!\n"));
- return(1);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = Mint_OpenAudio;
- this->CloseAudio = Mint_CloseAudio;
- this->LockAudio = Mint_LockAudio;
- this->UnlockAudio = Mint_UnlockAudio;
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap MINTAUDIO_XBIOS_bootstrap = {
- MINT_AUDIO_DRIVER_NAME, "MiNT XBIOS audio driver",
- Audio_Available, Audio_CreateDevice
-};
-
-static void Mint_LockAudio(_THIS)
-{
- /* Stop replay */
- Buffoper(0);
-}
-
-static void Mint_UnlockAudio(_THIS)
-{
- /* Restart replay */
- Buffoper(SB_PLA_ENA|SB_PLA_RPT);
-}
-
-static void Mint_CloseAudio(_THIS)
-{
- /* Stop replay */
- SDL_MintAudio_WaitThread();
- Buffoper(0);
-
- if (!SDL_MintAudio_mint_present) {
- /* Uninstall interrupt */
- Jdisint(MFP_DMASOUND);
- }
-
- /* Wait if currently playing sound */
- while (SDL_MintAudio_mutex != 0) {
- }
-
- /* Clear buffers */
- if (SDL_MintAudio_audiobuf[0]) {
- Mfree(SDL_MintAudio_audiobuf[0]);
- SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
- }
-
- /* Unlock sound system */
- Unlocksnd();
-}
-
-/* Falcon XBIOS implementation of Devconnect() is buggy with external clock */
-static void Devconnect2(int src, int dst, int sclk, int pre)
-{
- static const unsigned short MASK1[3] = { 0, 0x6000, 0 };
- static const unsigned short MASK2[4] = { 0xFFF0, 0xFF8F, 0xF0FF, 0x0FFF };
- static const unsigned short INDEX1[4] = { 1, 3, 5, 7 };
- static const unsigned short INDEX2[4] = { 0, 2, 4, 6 };
- unsigned short sync_div,dev_ctrl,dest_ctrl;
- void *oldstack;
-
- if (dst==0) {
- return;
- }
-
- oldstack=(void *)Super(0);
-
- dev_ctrl = DMAAUDIO_IO.dev_ctrl;
- dest_ctrl = DMAAUDIO_IO.dest_ctrl;
- dev_ctrl &= MASK2[src];
-
- if (src==ADC) {
- dev_ctrl |= MASK1[sclk];
- } else {
- dev_ctrl |= (INDEX1[sclk] << (src<<4));
- }
-
- if (dst & DMAREC) {
- dest_ctrl &= 0xFFF0;
- dest_ctrl |= INDEX1[src];
- }
-
- if (dst & DSPRECV) {
- dest_ctrl &= 0xFF8F;
- dest_ctrl |= (INDEX1[src]<<4);
- }
-
- if (dst & EXTOUT) {
- dest_ctrl &= 0xF0FF;
- dest_ctrl |= (INDEX1[src]<<8);
- }
-
- if (dst & DAC) {
- dev_ctrl &= 0x0FFF;
- dev_ctrl |= MASK1[sclk];
- dest_ctrl &= 0x0FFF;
- dest_ctrl |= (INDEX2[src]<<12);
- }
-
- sync_div = DMAAUDIO_IO.sync_div;
- if (sclk==CLKEXT) {
- pre<<=8;
- sync_div &= 0xF0FF;
- } else {
- sync_div &= 0xFFF0;
- }
- sync_div |= pre;
-
- DMAAUDIO_IO.dev_ctrl = dev_ctrl;
- DMAAUDIO_IO.dest_ctrl = dest_ctrl;
- DMAAUDIO_IO.sync_div = sync_div;
-
- Super(oldstack);
-}
-
-static void Mint_CheckExternalClock(_THIS)
-{
-#define SIZE_BUF_CLOCK_MEASURE (44100/10)
-
- unsigned long cookie_snd;
- char *buffer;
- int i, j;
-
- /* DSP present with its GPIO port ? */
- if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
- return;
- }
- if ((cookie_snd & SND_DSP)==0) {
- return;
- }
-
- buffer = Atari_SysMalloc(SIZE_BUF_CLOCK_MEASURE, MX_STRAM);
- if (buffer==NULL) {
- DEBUG_PRINT((DEBUG_NAME "Not enough memory for the measure\n"));
- return;
- }
- SDL_memset(buffer, 0, SIZE_BUF_CLOCK_MEASURE);
-
- Buffoper(0);
- Settracks(0,0);
- Setmontracks(0);
- Setmode(MONO8);
- Jdisint(MFP_TIMERA);
-
- for (i=0; i<2; i++) {
- Gpio(GPIO_SET,7); /* DSP port gpio outputs */
- Gpio(GPIO_WRITE,2+i); /* 22.5792/24.576 MHz for 44.1/48KHz */
- Devconnect2(DMAPLAY, DAC, CLKEXT, CLK50K); /* Matrix and clock source */
- Setbuffer(0, buffer, buffer + SIZE_BUF_CLOCK_MEASURE); /* Set buffer */
- Xbtimer(XB_TIMERA, 5, 38, SDL_MintAudio_XbiosInterruptMeasureClock); /* delay mode timer A, prediv /64, 1KHz */
- Jenabint(MFP_TIMERA);
- SDL_MintAudio_clocktics = 0;
- Buffoper(SB_PLA_ENA);
- usleep(110000);
-
- if((Buffoper(-1) & 1)==0) {
- if (SDL_MintAudio_clocktics) {
- unsigned long khz;
-
- khz = ((SIZE_BUF_CLOCK_MEASURE/SDL_MintAudio_clocktics) +1) & 0xFFFFFFFE;
- DEBUG_PRINT((DEBUG_NAME "measure %d: freq=%lu KHz\n", i+1, khz));
-
- if(khz==44) {
- for (j=1; j<4; j++) {
- SDL_MintAudio_AddFrequency(this, MASTERCLOCK_44K/(MASTERPREDIV_FALCON*(1<format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- if (spec->channels > 2) {
- spec->channels = 2; /* no more than stereo! */
- }
-
- spec->format |= 0x8000; /* Audio is always signed */
- if ((spec->format & 0x00ff)==16) {
- spec->format |= 0x1000; /* Audio is always big endian */
- spec->channels=2; /* 16 bits always stereo */
- }
-
- MINTAUDIO_freqcount=0;
-
- /* Add external clocks if present */
- Mint_CheckExternalClock(this);
-
- /* Standard clocks */
- for (i=1;i<12;i++) {
- /* Remove unusable Falcon codec predivisors */
- if ((i==6) || (i==8) || (i==10)) {
- continue;
- }
- SDL_MintAudio_AddFrequency(this, MASTERCLOCK_FALCON1/(MASTERPREDIV_FALCON*(i+1)), MASTERCLOCK_FALCON1, i, -1);
- }
-
-#if 1
- for (i=0; ifreq);
- spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
-
- DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
- DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
- DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
- DEBUG_PRINT(("channels=%d, ", spec->channels));
- DEBUG_PRINT(("freq=%d\n", spec->freq));
-
- return 0;
-}
-
-static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec)
-{
- int channels_mode, dmaclock, prediv;
- void *buffer;
-
- /* Stop currently playing sound */
- SDL_MintAudio_quit_thread = SDL_FALSE;
- SDL_MintAudio_thread_finished = SDL_TRUE;
- SDL_MintAudio_WaitThread();
- Buffoper(0);
-
- /* Set replay tracks */
- Settracks(0,0);
- Setmontracks(0);
-
- /* Select replay format */
- channels_mode=STEREO16;
- switch (spec->format & 0xff) {
- case 8:
- if (spec->channels==2) {
- channels_mode=STEREO8;
- } else {
- channels_mode=MONO8;
- }
- break;
- }
- if (Setmode(channels_mode)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
- }
-
- dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock;
- prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
- if (MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits != -1) {
- Gpio(GPIO_SET,7); /* DSP port gpio outputs */
- Gpio(GPIO_WRITE, MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits);
- Devconnect2(DMAPLAY, DAC|EXTOUT, CLKEXT, prediv);
- } else {
- Devconnect2(DMAPLAY, DAC, CLK25M, prediv);
- }
-
- /* Set buffer */
- buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
- if (Setbuffer(0, buffer, buffer + spec->size)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
- }
-
- if (SDL_MintAudio_mint_present) {
- SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0);
- } else {
- /* Install interrupt */
- Jdisint(MFP_DMASOUND);
- /*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);*/
- Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
- Jenabint(MFP_DMASOUND);
-
- if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) {
- DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
- }
- }
-
- /* Go */
- Buffoper(SB_PLA_ENA|SB_PLA_RPT);
- DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
-}
-
-static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- /* Lock sound system */
- if (Locksnd()!=1) {
- SDL_SetError("Mint_OpenAudio: Audio system already in use");
- return(-1);
- }
-
- SDL_MintAudio_device = this;
-
- /* Check audio capabilities */
- if (Mint_CheckAudio(this, spec)==-1) {
- return -1;
- }
-
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate memory for audio buffers in DMA-able RAM */
- DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
-
- SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
- if (SDL_MintAudio_audiobuf[0]==NULL) {
- SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
- return (-1);
- }
- SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size ;
- SDL_MintAudio_numbuf=0;
- SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size *2);
- SDL_MintAudio_audiosize = spec->size;
- SDL_MintAudio_mutex = 0;
-
- DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
- DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
-
- SDL_MintAudio_CheckFpu();
-
- /* Setup audio hardware */
- Mint_InitAudio(this, spec);
-
- return(1); /* We don't use SDL threaded audio */
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.c b/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.c
index 365f5ff53..9eb55d8dc 100644
--- a/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.c
@@ -1,20 +1,20 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
@@ -31,234 +31,230 @@
static BOOL inUse[NUM_BUFFERS];
-/* Audio driver functions */
-static int MME_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void MME_WaitAudio(_THIS);
-static Uint8 *MME_GetAudioBuf(_THIS);
-static void MME_PlayAudio(_THIS);
-static void MME_WaitDone(_THIS);
-static void MME_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-static int Audio_Available(void)
-{
- return(1);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- if ( device ) {
- if ( device->hidden ) {
- SDL_free(device->hidden);
- device->hidden = NULL;
- }
- SDL_free(device);
- device = NULL;
- }
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
-/* Initialize all variables that we clean on shutdown */
- this = SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- /* Set the function pointers */
- this->OpenAudio = MME_OpenAudio;
- this->WaitAudio = MME_WaitAudio;
- this->PlayAudio = MME_PlayAudio;
- this->GetAudioBuf = MME_GetAudioBuf;
- this->WaitDone = MME_WaitDone;
- this->CloseAudio = MME_CloseAudio;
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap MMEAUDIO_bootstrap = {
- "waveout", "Tru64 MME WaveOut",
- Audio_Available, Audio_CreateDevice
-};
-
-static void SetMMerror(char *function, MMRESULT code)
+static void
+SetMMerror(char *function, MMRESULT code)
{
int len;
char errbuf[MAXERRORLENGTH];
SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
len = SDL_strlen(errbuf);
- waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len);
- SDL_SetError("%s",errbuf);
+ waveOutGetErrorText(code, errbuf + len, MAXERRORLENGTH - len);
+ SDL_SetError("%s", errbuf);
}
-static void CALLBACK MME_CALLBACK(HWAVEOUT hwo,
- UINT uMsg,
- DWORD dwInstance,
- LPARAM dwParam1,
- LPARAM dwParam2)
+static void CALLBACK
+MME_Callback(HWAVEOUT hwo,
+ UINT uMsg, DWORD dwInstance, LPARAM dwParam1, LPARAM dwParam2)
{
WAVEHDR *wp = (WAVEHDR *) dwParam1;
- if ( uMsg == WOM_DONE )
- inUse[wp->dwUser] = FALSE;
+ if (uMsg == WOM_DONE)
+ inUse[wp->dwUser] = FALSE;
}
-static int MME_OpenAudio(_THIS, SDL_AudioSpec *spec)
+static int
+MME_OpenDevice(_THIS, const char *devname, int iscapture)
{
+ int valid_format = 0;
MMRESULT result;
+ Uint8 *mixbuf = NULL;
int i;
- mixbuf = NULL;
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
/* Set basic WAVE format parameters */
- shm = mmeAllocMem(sizeof(*shm));
- if ( shm == NULL ) {
- SDL_SetError("Out of memory: shm");
- return(-1);
+ this->hidden->shm = mmeAllocMem(sizeof(*this->hidden->shm));
+ if (this->hidden->shm == NULL) {
+ MME_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
}
- shm->sound = 0;
- shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM;
+
+ SDL_memset(this->hidden->shm, '\0', sizeof(*this->hidden->shm));
+ this->hidden->shm->sound = 0;
+ this->hidden->shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM;
/* Determine the audio parameters from the AudioSpec */
- switch ( spec->format & 0xFF ) {
- case 8:
- /* Unsigned 8 bit audio data */
- spec->format = AUDIO_U8;
- shm->wFmt.wBitsPerSample = 8;
- break;
- case 16:
- /* Signed 16 bit audio data */
- spec->format = AUDIO_S16;
- shm->wFmt.wBitsPerSample = 16;
- break;
- default:
- SDL_SetError("Unsupported audio format");
- return(-1);
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !valid_format && test_format;) {
+ valid_format = 1;
+ switch (test_format) {
+ case AUDIO_U8:
+ case AUDIO_S16:
+ case AUDIO_S32:
+ break;
+ default:
+ valid_format = 0;
+ test_format = SDL_NextAudioFormat();
+ }
}
- shm->wFmt.wf.nChannels = spec->channels;
- shm->wFmt.wf.nSamplesPerSec = spec->freq;
- shm->wFmt.wf.nBlockAlign =
- shm->wFmt.wf.nChannels * shm->wFmt.wBitsPerSample / 8;
- shm->wFmt.wf.nAvgBytesPerSec =
- shm->wFmt.wf.nSamplesPerSec * shm->wFmt.wf.nBlockAlign;
+ if (!valid_format) {
+ MME_CloseDevice(this);
+ SDL_SetError("Unsupported audio format");
+ return 0;
+ }
+
+ this->spec.format = test_format;
+ this->hidden->shm->wFmt.wBitsPerSample = SDL_AUDIO_BITSIZE(test_format);
+
+ /* !!! FIXME: Can this handle more than stereo? */
+ this->hidden->shm->wFmt.wf.nChannels = this->spec.channels;
+ this->hidden->shm->wFmt.wf.nSamplesPerSec = this->spec.freq;
+ this->hidden->shm->wFmt.wf.nBlockAlign =
+ this->hidden->shm->wFmt.wf.nChannels *
+ this->hidden->shm->wFmt.wBitsPerSample / 8;
+ this->hidden->shm->wFmt.wf.nAvgBytesPerSec =
+ this->hidden->shm->wFmt.wf.nSamplesPerSec *
+ this->hidden->shm->wFmt.wf.nBlockAlign;
/* Check the buffer size -- minimum of 1/4 second (word aligned) */
- if ( spec->samples < (spec->freq/4) )
- spec->samples = ((spec->freq/4)+3)&~3;
+ if (this->spec.samples < (this->spec.freq / 4))
+ this->spec.samples = ((this->spec.freq / 4) + 3) & ~3;
/* Update the fragment size as size in bytes */
- SDL_CalculateAudioSpec(spec);
+ SDL_CalculateAudioSpec(&this->spec);
/* Open the audio device */
- result = waveOutOpen(&(shm->sound),
- WAVE_MAPPER,
- &(shm->wFmt.wf),
- MME_CALLBACK,
- NULL,
- (CALLBACK_FUNCTION|WAVE_OPEN_SHAREABLE));
- if ( result != MMSYSERR_NOERROR ) {
- SetMMerror("waveOutOpen()", result);
- return(-1);
+ result = waveOutOpen(&(this->hidden->shm->sound),
+ WAVE_MAPPER,
+ &(this->hidden->shm->wFmt.wf),
+ MME_Callback,
+ NULL, (CALLBACK_FUNCTION | WAVE_OPEN_SHAREABLE));
+ if (result != MMSYSERR_NOERROR) {
+ MME_CloseDevice(this);
+ SetMMerror("waveOutOpen()", result);
+ return 0;
}
/* Create the sound buffers */
- mixbuf = (Uint8 *)mmeAllocBuffer(NUM_BUFFERS * (spec->size));
- if ( mixbuf == NULL ) {
- SDL_SetError("Out of memory: mixbuf");
- return(-1);
+ mixbuf = (Uint8 *) mmeAllocBuffer(NUM_BUFFERS * (this->spec.size));
+ if (mixbuf == NULL) {
+ MME_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
}
+ this->hidden->mixbuf = mixbuf;
for (i = 0; i < NUM_BUFFERS; i++) {
- shm->wHdr[i].lpData = &mixbuf[i * (spec->size)];
- shm->wHdr[i].dwBufferLength = spec->size;
- shm->wHdr[i].dwFlags = 0;
- shm->wHdr[i].dwUser = i;
- shm->wHdr[i].dwLoops = 0; /* loop control counter */
- shm->wHdr[i].lpNext = NULL; /* reserved for driver */
- shm->wHdr[i].reserved = 0;
- inUse[i] = FALSE;
+ this->hidden->shm->wHdr[i].lpData = &mixbuf[i * (this->spec.size)];
+ this->hidden->shm->wHdr[i].dwBufferLength = this->spec.size;
+ this->hidden->shm->wHdr[i].dwFlags = 0;
+ this->hidden->shm->wHdr[i].dwUser = i;
+ this->hidden->shm->wHdr[i].dwLoops = 0; /* loop control counter */
+ this->hidden->shm->wHdr[i].lpNext = NULL; /* reserved for driver */
+ this->hidden->shm->wHdr[i].reserved = 0;
+ inUse[i] = FALSE;
}
- next_buffer = 0;
- return 0;
+ this->hidden->next_buffer = 0;
+
+ return 1;
}
-static void MME_WaitAudio(_THIS)
+static void
+MME_WaitDevice(_THIS)
{
- while ( inUse[next_buffer] ) {
- mmeWaitForCallbacks();
- mmeProcessCallbacks();
+ while (inUse[this->hidden->next_buffer]) {
+ mmeWaitForCallbacks();
+ mmeProcessCallbacks();
}
}
-static Uint8 *MME_GetAudioBuf(_THIS)
+static Uint8 *
+MME_GetDeviceBuf(_THIS)
{
- Uint8 *retval;
-
- inUse[next_buffer] = TRUE;
- retval = (Uint8 *)(shm->wHdr[next_buffer].lpData);
- return retval;
+ void *retval = this->hidden->shm->wHdr[this->hidden->next_buffer].lpData;
+ inUse[this->hidden->next_buffer] = TRUE;
+ return (Uint8 *) retval;
}
-static void MME_PlayAudio(_THIS)
+static void
+MME_PlayDevice(_THIS)
{
/* Queue it up */
- waveOutWrite(shm->sound, &(shm->wHdr[next_buffer]), sizeof(WAVEHDR));
- next_buffer = (next_buffer+1)%NUM_BUFFERS;
+ waveOutWrite(this->hidden->shm->sound,
+ &(this->hidden->shm->wHdr[this->hidden->next_buffer]),
+ sizeof(WAVEHDR));
+ this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
}
-static void MME_WaitDone(_THIS)
+static void
+MME_WaitDone(_THIS)
{
MMRESULT result;
int i;
- if ( shm->sound ) {
- for (i = 0; i < NUM_BUFFERS; i++)
- while ( inUse[i] ) {
- mmeWaitForCallbacks();
- mmeProcessCallbacks();
- }
- result = waveOutReset(shm->sound);
- if ( result != MMSYSERR_NOERROR )
- SetMMerror("waveOutReset()", result);
- mmeProcessCallbacks();
+ if (this->hidden->shm->sound) {
+ for (i = 0; i < NUM_BUFFERS; i++)
+ while (inUse[i]) {
+ mmeWaitForCallbacks();
+ mmeProcessCallbacks();
+ }
+ result = waveOutReset(this->hidden->shm->sound);
+ if (result != MMSYSERR_NOERROR)
+ SetMMerror("waveOutReset()", result);
+ mmeProcessCallbacks();
}
}
-static void MME_CloseAudio(_THIS)
+static void
+MME_CloseDevice(_THIS)
{
- MMRESULT result;
+ if (this->hidden != NULL) {
+ MMRESULT result;
- if ( mixbuf ) {
- result = mmeFreeBuffer(mixbuf);
- if (result != MMSYSERR_NOERROR )
- SetMMerror("mmeFreeBuffer", result);
- mixbuf = NULL;
- }
+ if (this->hidden->mixbuf) {
+ result = mmeFreeBuffer(this->hidden->mixbuf);
+ if (result != MMSYSERR_NOERROR)
+ SetMMerror("mmeFreeBuffer", result);
+ this->hidden->mixbuf = NULL;
+ }
- if ( shm ) {
- if ( shm->sound ) {
- result = waveOutClose(shm->sound);
- if (result != MMSYSERR_NOERROR )
- SetMMerror("waveOutClose()", result);
- mmeProcessCallbacks();
- }
- result = mmeFreeMem(shm);
- if (result != MMSYSERR_NOERROR )
- SetMMerror("mmeFreeMem()", result);
- shm = NULL;
+ if (this->hidden->shm) {
+ if (this->hidden->shm->sound) {
+ result = waveOutClose(this->hidden->shm->sound);
+ if (result != MMSYSERR_NOERROR)
+ SetMMerror("waveOutClose()", result);
+ mmeProcessCallbacks();
+ }
+ result = mmeFreeMem(this->hidden->shm);
+ if (result != MMSYSERR_NOERROR)
+ SetMMerror("mmeFreeMem()", result);
+ this->hidden->shm = NULL;
+ }
+
+ SDL_free(this->hidden);
+ this->hidden = NULL;
}
}
+static int
+MME_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = MME_OpenDevice;
+ impl->WaitDevice = MME_WaitDevice;
+ impl->WaitDone = MME_WaitDone;
+ impl->PlayDevice = MME_PlayDevice;
+ impl->GetDeviceBuf = MME_GetDeviceBuf;
+ impl->CloseDevice = MME_CloseDevice;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+/* !!! FIXME: Windows "windib" driver is called waveout, too */
+AudioBootStrap MMEAUDIO_bootstrap = {
+ "waveout", "Tru64 MME WaveOut", MME_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.h b/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.h
index 41f3b3050..e8f07bd3d 100644
--- a/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/mme/SDL_mmeaudio.h
@@ -1,20 +1,20 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
@@ -23,29 +23,29 @@
/* Allow access to a raw mixing buffer */
-#ifndef _SDL_lowaudio_h
-#define _SDL_lowaudio_h
+#ifndef _SDL_mmeaudio_h
+#define _SDL_mmeaudio_h
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define NUM_BUFFERS 2
-struct SharedMem {
+struct SharedMem
+{
HWAVEOUT sound;
WAVEHDR wHdr[NUM_BUFFERS];
PCMWAVEFORMAT wFmt;
};
-struct SDL_PrivateAudioData {
- Uint8 *mixbuf; /* The raw allocated mixing buffer */
+struct SDL_PrivateAudioData
+{
+ Uint8 *mixbuf; /* The raw allocated mixing buffer */
struct SharedMem *shm;
int next_buffer;
};
-#define shm (this->hidden->shm)
-#define mixbuf (this->hidden->mixbuf)
-#define next_buffer (this->hidden->next_buffer)
-/* Old variable names */
-#endif /* _SDL_lowaudio_h */
+#endif /* _SDL_mmeaudio_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.c b/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.c
index 677eb17fb..a9b134842 100644
--- a/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -32,20 +32,17 @@
#include "SDL_timer.h"
#include "SDL_audio.h"
+#include "SDL_loadso.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
#include "SDL_nasaudio.h"
-#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
-#include "SDL_loadso.h"
-#endif
-
-/* The tag name used by artsc audio */
+/* The tag name used by nas audio */
#define NAS_DRIVER_NAME "nas"
static struct SDL_PrivateAudioData *this2 = NULL;
+
static void (*NAS_AuCloseServer) (AuServer *);
static void (*NAS_AuNextEvent) (AuServer *, AuBool, AuEvent *);
static AuBool(*NAS_AuDispatchEvent) (AuServer *, AuEvent *);
@@ -152,272 +149,260 @@ LoadNASLibrary(void)
#endif /* SDL_AUDIO_DRIVER_NAS_DYNAMIC */
-
-/* Audio driver functions */
-static int NAS_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void NAS_WaitAudio(_THIS);
-static void NAS_PlayAudio(_THIS);
-static Uint8 *NAS_GetAudioBuf(_THIS);
-static void NAS_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-
-static int Audio_Available(void)
-{
- if (LoadNASLibrary() == 0) {
- AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
- if (!aud) {
- UnloadNASLibrary();
- return 0;
- }
- NAS_AuCloseServer(aud);
- UnloadNASLibrary();
- return 1;
- }
- return 0;
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- UnloadNASLibrary();
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- if (LoadNASLibrary() < 0) {
- return NULL;
- }
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return NULL;
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = NAS_OpenAudio;
- this->WaitAudio = NAS_WaitAudio;
- this->PlayAudio = NAS_PlayAudio;
- this->GetAudioBuf = NAS_GetAudioBuf;
- this->CloseAudio = NAS_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap NAS_bootstrap = {
- NAS_DRIVER_NAME, "Network Audio System",
- Audio_Available, Audio_CreateDevice
-};
-
/* This function waits until it is possible to write a full sound buffer */
-static void NAS_WaitAudio(_THIS)
+static void
+NAS_WaitDevice(_THIS)
{
- while ( this->hidden->buf_free < this->hidden->mixlen ) {
- AuEvent ev;
- NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
- NAS_AuDispatchEvent(this->hidden->aud, &ev);
- }
+ while (this->hidden->buf_free < this->hidden->mixlen) {
+ AuEvent ev;
+ NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
+ NAS_AuDispatchEvent(this->hidden->aud, &ev);
+ }
}
-static void NAS_PlayAudio(_THIS)
+static void
+NAS_PlayDevice(_THIS)
{
- while (this->hidden->mixlen > this->hidden->buf_free) { /* We think the buffer is full? Yikes! Ask the server for events,
- in the hope that some of them is LowWater events telling us more
- of the buffer is free now than what we think. */
- AuEvent ev;
- NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
- NAS_AuDispatchEvent(this->hidden->aud, &ev);
- }
- this->hidden->buf_free -= this->hidden->mixlen;
+ while (this->hidden->mixlen > this->hidden->buf_free) {
+ /*
+ * We think the buffer is full? Yikes! Ask the server for events,
+ * in the hope that some of them is LowWater events telling us more
+ * of the buffer is free now than what we think.
+ */
+ AuEvent ev;
+ NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
+ NAS_AuDispatchEvent(this->hidden->aud, &ev);
+ }
+ this->hidden->buf_free -= this->hidden->mixlen;
- /* Write the audio data */
- NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0, this->hidden->mixlen, this->hidden->mixbuf, AuFalse, NULL);
+ /* Write the audio data */
+ NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0,
+ this->hidden->mixlen, this->hidden->mixbuf, AuFalse,
+ NULL);
+
+ this->hidden->written += this->hidden->mixlen;
- this->hidden->written += this->hidden->mixlen;
-
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen);
+ fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen);
#endif
}
-static Uint8 *NAS_GetAudioBuf(_THIS)
+static Uint8 *
+NAS_GetDeviceBuf(_THIS)
{
- return(this->hidden->mixbuf);
+ return (this->hidden->mixbuf);
}
-static void NAS_CloseAudio(_THIS)
+static void
+NAS_CloseDevice(_THIS)
{
- if ( this->hidden->mixbuf != NULL ) {
- SDL_FreeAudioMem(this->hidden->mixbuf);
- this->hidden->mixbuf = NULL;
- }
- if ( this->hidden->aud ) {
- NAS_AuCloseServer(this->hidden->aud);
- this->hidden->aud = 0;
- }
-}
-
-static unsigned char sdlformat_to_auformat(unsigned int fmt)
-{
- switch (fmt)
- {
- case AUDIO_U8:
- return AuFormatLinearUnsigned8;
- case AUDIO_S8:
- return AuFormatLinearSigned8;
- case AUDIO_U16LSB:
- return AuFormatLinearUnsigned16LSB;
- case AUDIO_U16MSB:
- return AuFormatLinearUnsigned16MSB;
- case AUDIO_S16LSB:
- return AuFormatLinearSigned16LSB;
- case AUDIO_S16MSB:
- return AuFormatLinearSigned16MSB;
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->aud) {
+ NAS_AuCloseServer(this->hidden->aud);
+ this->hidden->aud = 0;
+ }
+ SDL_free(this->hidden);
+ this2 = this->hidden = NULL;
}
- return AuNone;
+}
+
+static unsigned char
+sdlformat_to_auformat(unsigned int fmt)
+{
+ switch (fmt) {
+ case AUDIO_U8:
+ return AuFormatLinearUnsigned8;
+ case AUDIO_S8:
+ return AuFormatLinearSigned8;
+ case AUDIO_U16LSB:
+ return AuFormatLinearUnsigned16LSB;
+ case AUDIO_U16MSB:
+ return AuFormatLinearUnsigned16MSB;
+ case AUDIO_S16LSB:
+ return AuFormatLinearSigned16LSB;
+ case AUDIO_S16MSB:
+ return AuFormatLinearSigned16MSB;
+ }
+ return AuNone;
}
static AuBool
-event_handler(AuServer* aud, AuEvent* ev, AuEventHandlerRec* hnd)
+event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd)
{
- switch (ev->type) {
- case AuEventTypeElementNotify: {
- AuElementNotifyEvent* event = (AuElementNotifyEvent *)ev;
+ switch (ev->type) {
+ case AuEventTypeElementNotify:
+ {
+ AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
- switch (event->kind) {
- case AuElementNotifyKindLowWater:
- if (this2->buf_free >= 0) {
- this2->really += event->num_bytes;
- gettimeofday(&this2->last_tv, 0);
- this2->buf_free += event->num_bytes;
- } else {
- this2->buf_free = event->num_bytes;
- }
- break;
- case AuElementNotifyKindState:
- switch (event->cur_state) {
- case AuStatePause:
- if (event->reason != AuReasonUser) {
- if (this2->buf_free >= 0) {
- this2->really += event->num_bytes;
- gettimeofday(&this2->last_tv, 0);
- this2->buf_free += event->num_bytes;
- } else {
- this2->buf_free = event->num_bytes;
- }
- }
- break;
- }
- }
- }
- }
- return AuTrue;
+ switch (event->kind) {
+ case AuElementNotifyKindLowWater:
+ if (this2->buf_free >= 0) {
+ this2->really += event->num_bytes;
+ gettimeofday(&this2->last_tv, 0);
+ this2->buf_free += event->num_bytes;
+ } else {
+ this2->buf_free = event->num_bytes;
+ }
+ break;
+ case AuElementNotifyKindState:
+ switch (event->cur_state) {
+ case AuStatePause:
+ if (event->reason != AuReasonUser) {
+ if (this2->buf_free >= 0) {
+ this2->really += event->num_bytes;
+ gettimeofday(&this2->last_tv, 0);
+ this2->buf_free += event->num_bytes;
+ } else {
+ this2->buf_free = event->num_bytes;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ return AuTrue;
}
static AuDeviceID
find_device(_THIS, int nch)
{
/* These "Au" things are all macros, not functions... */
- int i;
- for (i = 0; i < AuServerNumDevices(this->hidden->aud); i++) {
- if ((AuDeviceKind(AuServerDevice(this->hidden->aud, i)) ==
- AuComponentKindPhysicalOutput) &&
- AuDeviceNumTracks(AuServerDevice(this->hidden->aud, i)) == nch) {
- return AuDeviceIdentifier(AuServerDevice(this->hidden->aud, i));
- }
- }
- return AuNone;
+ int i;
+ for (i = 0; i < AuServerNumDevices(this->hidden->aud); i++) {
+ if ((AuDeviceKind(AuServerDevice(this->hidden->aud, i)) ==
+ AuComponentKindPhysicalOutput) &&
+ AuDeviceNumTracks(AuServerDevice(this->hidden->aud, i)) == nch) {
+ return AuDeviceIdentifier(AuServerDevice(this->hidden->aud, i));
+ }
+ }
+ return AuNone;
}
-static int NAS_OpenAudio(_THIS, SDL_AudioSpec *spec)
+static int
+NAS_OpenDevice(_THIS, const char *devname, int iscapture)
{
- AuElement elms[3];
- int buffer_size;
- Uint16 test_format, format;
+ AuElement elms[3];
+ int buffer_size;
+ SDL_AudioFormat test_format, format;
- this->hidden->mixbuf = NULL;
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- /* Try for a closest match on audio format */
- format = 0;
- for ( test_format = SDL_FirstAudioFormat(spec->format);
- ! format && test_format; ) {
- format = sdlformat_to_auformat(test_format);
+ /* Try for a closest match on audio format */
+ format = 0;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+ format = sdlformat_to_auformat(test_format);
+ if (format == AuNone) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+ NAS_CloseDevice(this);
+ SDL_SetError("NAS: Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
- if (format == AuNone) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if ( format == 0 ) {
- SDL_SetError("Couldn't find any hardware audio formats");
- return(-1);
- }
- spec->format = test_format;
+ this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
+ if (this->hidden->aud == 0) {
+ NAS_CloseDevice(this);
+ SDL_SetError("NAS: Couldn't open connection to NAS server");
+ return 0;
+ }
- this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
- if (this->hidden->aud == 0)
- {
- SDL_SetError("Couldn't open connection to NAS server");
- return (-1);
- }
-
- this->hidden->dev = find_device(this, spec->channels);
- if ((this->hidden->dev == AuNone) || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, NULL)))) {
- NAS_AuCloseServer(this->hidden->aud);
- this->hidden->aud = 0;
- SDL_SetError("Couldn't find a fitting playback device on NAS server");
- return (-1);
- }
-
- buffer_size = spec->freq;
- if (buffer_size < 4096)
- buffer_size = 4096;
+ this->hidden->dev = find_device(this, this->spec.channels);
+ if ((this->hidden->dev == AuNone)
+ || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) {
+ NAS_CloseDevice(this);
+ SDL_SetError("NAS: Couldn't find a fitting device on NAS server");
+ return 0;
+ }
- if (buffer_size > 32768)
- buffer_size = 32768; /* So that the buffer won't get unmanageably big. */
+ buffer_size = this->spec.freq;
+ if (buffer_size < 4096)
+ buffer_size = 4096;
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
+ if (buffer_size > 32768)
+ buffer_size = 32768; /* So that the buffer won't get unmanageably big. */
- this2 = this->hidden;
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
- /* These "Au" things without a NAS_ prefix are macros, not functions... */
- AuMakeElementImportClient(elms, spec->freq, format, spec->channels, AuTrue,
- buffer_size, buffer_size / 4, 0, NULL);
- AuMakeElementExportDevice(elms+1, 0, this->hidden->dev, spec->freq,
- AuUnlimitedSamples, 0, NULL);
- NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, 2, elms, NULL);
- NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, this->hidden->flow,
- event_handler, (AuPointer) NULL);
+ this2 = this->hidden;
- NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL);
+ AuMakeElementImportClient(elms, this->spec.freq, format,
+ this->spec.channels, AuTrue, buffer_size,
+ buffer_size / 4, 0, NULL);
+ AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq,
+ AuUnlimitedSamples, 0, NULL);
+ NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, 2, elms,
+ NULL);
+ NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0,
+ this->hidden->flow, event_handler,
+ (AuPointer) NULL);
- /* Allocate mixing buffer */
- this->hidden->mixlen = spec->size;
- this->hidden->mixbuf = (Uint8 *)SDL_AllocAudioMem(this->hidden->mixlen);
- if ( this->hidden->mixbuf == NULL ) {
- return(-1);
- }
- SDL_memset(this->hidden->mixbuf, spec->silence, spec->size);
+ NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL);
- /* Get the parent process id (we're the parent of the audio thread) */
- this->hidden->parent = getpid();
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ NAS_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
- /* We're ready to rock and roll. :-) */
- return(0);
+ /* We're ready to rock and roll. :-) */
+ return 1;
}
+
+static void
+NAS_Deinitialize(void)
+{
+ UnloadNASLibrary();
+}
+
+static int
+NAS_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadNASLibrary() < 0) {
+ return 0;
+ } else {
+ AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
+ if (aud == NULL) {
+ SDL_SetError("NAS: AuOpenServer() failed (no audio server?)");
+ return 0;
+ }
+ NAS_AuCloseServer(aud);
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = NAS_OpenDevice;
+ impl->PlayDevice = NAS_PlayDevice;
+ impl->WaitDevice = NAS_WaitDevice;
+ impl->GetDeviceBuf = NAS_GetDeviceBuf;
+ impl->CloseDevice = NAS_CloseDevice;
+ impl->Deinitialize = NAS_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: is this true? */
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap NAS_bootstrap = {
+ NAS_DRIVER_NAME, "Network Audio System", NAS_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.h b/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.h
index 1cd04f85d..960402741 100644
--- a/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/nas/SDL_nasaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -37,26 +37,25 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- AuServer* aud;
- AuFlowID flow;
- AuDeviceID dev;
-
- /* The parent process id, to detect when application quits */
- pid_t parent;
+struct SDL_PrivateAudioData
+{
+ AuServer *aud;
+ AuFlowID flow;
+ AuDeviceID dev;
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
- int written;
- int really;
- int bps;
- struct timeval last_tv;
- int buf_free;
+ int written;
+ int really;
+ int bps;
+ struct timeval last_tv;
+ int buf_free;
};
#endif /* _SDL_nasaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.c b/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.c
index ad68d8c9f..672bdc0e0 100644
--- a/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,318 +18,113 @@
Sam Lantinga
slouken@libsdl.org
+
+ This file written by Ryan C. Gordon (icculus@icculus.org)
*/
#include "SDL_config.h"
-/* Allow access to a raw mixing buffer */
+/* Output audio to NDS */
+
#include
-#include "SDL.h"
-#include "SDL_endian.h"
-#include "SDL_timer.h"
+
#include "SDL_audio.h"
-#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
#include "SDL_ndsaudio.h"
-#include "soundcommon.h"
-
-/* Audio driver functions */
-static int NDS_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void NDS_WaitAudio(_THIS);
-static void NDS_PlayAudio(_THIS);
-static Uint8 *NDS_GetAudioBuf(_THIS);
-static void NDS_CloseAudio(_THIS);
-
-/* Audio driver bootstrap functions */
-
-u32 framecounter = 0,soundoffset = 0;
-static SDL_AudioDevice *sdl_nds_audiodevice;
-
-//void SoundMixCallback(void *stream,u32 size)
-//{
-// //printf("SoundMixCallback\n");
-//
-// Uint8 *buffer;
-//
-// buffer = sdl_nds_audiodevice->hidden->mixbuf;
-// memset(buffer, sdl_nds_audiodevice->spec.silence, size);
-//
-// if (!sdl_nds_audiodevice->paused){
-//
-//
-// //if (sdl_nds_audiodevice->convert.needed) {
-// // int silence;
-//
-// // if (sdl_nds_audiodevice->convert.src_format == AUDIO_U8 ) {
-// // silence = 0x80;
-// // } else {
-// // silence = 0;
-// // }
-// // memset(sdl_nds_audiodevice->convert.buf, silence, sdl_nds_audiodevice->convert.len);
-// // sdl_nds_audiodevice->spec.callback(sdl_nds_audiodevice->spec.userdata,
-// // (Uint8 *)sdl_nds_audiodevice->convert.buf,sdl_nds_audiodevice->convert.len);
-// // SDL_ConvertAudio(&sdl_nds_audiodevice->convert);
-// // memcpy(buffer, sdl_nds_audiodevice->convert.buf, sdl_nds_audiodevice->convert.len_cvt);
-// //} else
-// {
-// sdl_nds_audiodevice->spec.callback(sdl_nds_audiodevice->spec.userdata, buffer, size);
-// //memcpy((Sint16 *)stream,buffer, size);
-// }
-//
-// }
-//
-// if(soundsystem->format == 8)
-// {
-// int i;
-// s32 *buffer32 = (s32 *)buffer;
-// s32 *stream32 = (s32 *)stream;
-// for(i=0;i buffer 16bit
-// //if (buffer[i] &0x80)
-// //((Sint16*)stream)[i] = 0xff00 | buffer[i];
-// ((Sint16*)stream)[i] = (buffer[i] - 128) << 8;
-//
-// //else
-// // ((Sint16*)stream)[i] = buffer[i];
-// }
-// //register signed char *pSrc =buffer;
-// //register short *pDest =stream;
-// //int x;
-// // for (x=size; x>0; x--)
-// // {
-// // register short temp = (((short)*pSrc)-128)<<8;
-// // pSrc++;
-// // *pDest++ = temp;
-// // }
-//
-// //memcpy((Sint16 *)stream,buffer, size);
-// }
-//}
-
-void SoundMixCallback(void *stream,u32 len)
+static int
+NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
- SDL_AudioDevice *audio = (SDL_AudioDevice *)sdl_nds_audiodevice;
+ SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
+ int valid_datatype = 0;
- /* Silence the buffer, since it's ours */
- SDL_memset(stream, audio->spec.silence, len);
+ this->hidden = SDL_malloc(sizeof(*(this->hidden)));
+ if (!this->hidden) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- /* Only do soemthing if audio is enabled */
- if ( ! audio->enabled )
- return;
+ while ((!valid_datatype) && (test_format)) {
+ this->spec.format = test_format;
+ switch (test_format) {
+ case AUDIO_S8:
+ /*case AUDIO_S16LSB: */
+ valid_datatype = 1;
+ break;
+ default:
+ test_format = SDL_NextAudioFormat();
+ break;
+ }
+ }
- if ( ! audio->paused ) {
- if ( audio->convert.needed ) {
- //fprintf(stderr,"converting audio\n");
- SDL_mutexP(audio->mixer_lock);
- (*audio->spec.callback)(audio->spec.userdata,
- (Uint8 *)audio->convert.buf,audio->convert.len);
- SDL_mutexV(audio->mixer_lock);
- SDL_ConvertAudio(&audio->convert);
- SDL_memcpy(stream,audio->convert.buf,audio->convert.len_cvt);
- } else {
- SDL_mutexP(audio->mixer_lock);
- (*audio->spec.callback)(audio->spec.userdata,
- (Uint8 *)stream, len);
- SDL_mutexV(audio->mixer_lock);
- }
- }
- return;
-}
-void MixSound(void)
-{
- int remain;
+ /* set the generic sound parameters */
+ setGenericSound(22050, /* sample rate */
+ 127, /* volume */
+ 64, /* panning/balance */
+ 0); /* sound format */
- if(soundsystem->format == 8)
- {
- if((soundsystem->soundcursor + soundsystem->numsamples) > soundsystem->buffersize)
- {
- SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor],soundsystem->buffersize - soundsystem->soundcursor);
- remain = soundsystem->numsamples - (soundsystem->buffersize - soundsystem->soundcursor);
- SoundMixCallback(soundsystem->mixbuffer,remain);
- }
- else
- {
- SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor],soundsystem->numsamples);
- }
- }
- else
- {
- if((soundsystem->soundcursor + soundsystem->numsamples) > (soundsystem->buffersize >> 1))
- {
- SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor << 1],(soundsystem->buffersize >> 1) - soundsystem->soundcursor);
- remain = soundsystem->numsamples - ((soundsystem->buffersize >> 1) - soundsystem->soundcursor);
- SoundMixCallback(soundsystem->mixbuffer,remain);
- }
- else
- {
- SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor << 1],soundsystem->numsamples);
- }
- }
+ return 1;
}
-void InterruptHandler(void)
+static void
+NDSAUD_PlayDevice(_THIS)
{
- framecounter++;
-}
-void FiFoHandler(void)
-{
- u32 command;
- while ( !(REG_IPC_FIFO_CR & (IPC_FIFO_RECV_EMPTY)) )
- {
- command = REG_IPC_FIFO_RX;
+ TransferSoundData *sound = SDL_malloc(sizeof(TransferSoundData));
+ if (!sound) {
+ SDL_OutOfMemory();
+ }
- switch(command)
- {
- case FIFO_NONE:
- break;
- case UPDATEON_ARM9:
- REG_IME = 0;
- MixSound();
- REG_IME = 1;
- SendCommandToArm7(MIXCOMPLETE_ONARM9);
- break;
- }
- }
+ playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);
+#if 0
+// sound->data = this->hidden->mixbuf;/* pointer to raw audio data */
+// sound->len = this->hidden->mixlen; /* size of raw data pointed to above */
+// sound->rate = 22050; /* sample rate = 22050Hz */
+// sound->vol = 127; /* volume [0..127] for [min..max] */
+// sound->pan = 64; /* balance [0..127] for [left..right] */
+// sound->format = 0; /* 0 for 16-bit, 1 for 8-bit */
+// playSound(sound);
+#endif
}
-
-
-
-static int Audio_Available(void)
+static Uint8 *
+NDSAUD_GetDeviceBuf(_THIS)
{
- return(1);
+ return this->hidden->mixbuf; /* is this right? */
}
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
+static void
+NDSAUD_WaitDevice(_THIS)
{
+ /* stub */
}
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
+static void
+NDSAUD_CloseDevice(_THIS)
{
-
- SDL_AudioDevice *this;
+ /* stub */
+}
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+static int
+NDSAUD_Init(SDL_AudioDriverImpl * impl)
+{
+ /* Set the function pointers */
+ impl->OpenDevice = NDSAUD_OpenDevice;
+ impl->PlayDevice = NDSAUD_PlayDevice;
+ impl->WaitDevice = NDSAUD_WaitDevice;
+ impl->GetDeviceBuf = NDSAUD_GetDeviceBuf;
+ impl->CloseDevice = NDSAUD_CloseDevice;
- /* Set the function pointers */
- this->OpenAudio = NDS_OpenAudio;
- this->WaitAudio = NDS_WaitAudio;
- this->PlayAudio = NDS_PlayAudio;
- this->GetAudioBuf = NDS_GetAudioBuf;
- this->CloseAudio = NDS_CloseAudio;
+ /* and the capabilities */
+ impl->HasCaptureSupport = 1;
+ impl->OnlyHasDefaultOutputDevice = 1;
+ impl->OnlyHasDefaultInputDevice = 1;
- this->free = Audio_DeleteDevice;
-//fprintf(stderr,"Audio_CreateDevice\n");
- return this;
+ return 1; /* this audio target is available. */
}
AudioBootStrap NDSAUD_bootstrap = {
- "nds", "NDS audio",
- Audio_Available, Audio_CreateDevice
+ "nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1? */
};
-
-void static NDS_WaitAudio(_THIS)
-{
- //printf("NDS_WaitAudio\n");
-}
-
-static void NDS_PlayAudio(_THIS)
-{
- //printf("playing audio\n");
- if (this->paused)
- return;
-
-}
-
-static Uint8 *NDS_GetAudioBuf(_THIS)
-{
- return NULL;//(this->hidden->mixbuf);
-}
-
-static void NDS_CloseAudio(_THIS)
-{
-/* if ( this->hidden->mixbuf != NULL ) {
- SDL_FreeAudioMem(this->hidden->mixbuf);
- this->hidden->mixbuf = NULL;
- }*/
-}
-
-static int NDS_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- //printf("NDS_OpenAudio\n");
- int format = 0;
- //switch(spec->format&0xff) {
- //case 8: spec->format = AUDIO_S8;format=8; break;
- //case 16: spec->format = AUDIO_S16LSB;format=16; break;
- //default:
- // SDL_SetError("Unsupported audio format");
- // return(-1);
- //}
- switch (spec->format&~0x1000) {
- case AUDIO_S8:
- /* Signed 8-bit audio supported */
- format=8;
- break;
- case AUDIO_U8:
- spec->format ^= 0x80;format=8;
- break;
- case AUDIO_U16:
- /* Unsigned 16-bit audio unsupported, convert to S16 */
- spec->format ^=0x8000;format=16;
- case AUDIO_S16:
- /* Signed 16-bit audio supported */
- format=16;
- break;
- }
- /* Update the fragment size as size in bytes */
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate mixing buffer */
- //this->hidden->mixlen = spec->size;
- //this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
- //if ( this->hidden->mixbuf == NULL ) {
- // SDL_SetError("Out of Memory");
- // return(-1);
- //}
-
- SDL_NDSAudio_mutex = 0;
- sdl_nds_audiodevice=this;
-
- irqInit();
- irqSet(IRQ_VBLANK,&InterruptHandler);
- irqSet(IRQ_FIFO_NOT_EMPTY,&FiFoHandler);
- irqEnable(IRQ_FIFO_NOT_EMPTY);
-
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR | IPC_FIFO_RECV_IRQ;
-
-
-
- SoundSystemInit(spec->freq,spec->size,0,format);
- SoundStartMixer();
-
-
- return(1);
-}
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.h b/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.h
index 56e030953..a9cf83660 100644
--- a/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/nds/SDL_ndsaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,20 +21,24 @@
*/
#include "SDL_config.h"
-#ifndef _SDL_lowaudio_h
-#define _SDL_lowaudio_h
+#ifndef _SDL_ndsaudio_h
+#define _SDL_ndsaudio_h
#include "../SDL_sysaudio.h"
+#include
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- //Uint8 *mixbuf;
- //Uint32 mixlen;
-};
-unsigned short SDL_NDSAudio_mutex=0;
-
+struct SDL_PrivateAudioData
+{
+ TransferSoundData *sound;
+ /* The file descriptor for the audio device */
+ Uint8 *mixbuf;
+ Uint32 mixlen;
+ Uint32 write_delay;
+ Uint32 initial_calls;
+};
-#endif /* _SDL_lowaudio_h */
+#endif /* _SDL_ndsaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/nds/sound9.c b/alienblaster/project/jni/sdl/src/audio/nds/sound9.c
deleted file mode 100644
index aa427ae41..000000000
--- a/alienblaster/project/jni/sdl/src/audio/nds/sound9.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-#include "SDL_stdinc.h"
-
-#include "soundcommon.h"
-
-void SoundSystemInit(u32 rate,u32 buffersize,u8 channel,u8 format)
-{
- soundsystem->rate = rate;
-
- if(format == 8)
- soundsystem->buffersize = buffersize;
- else if(format == 16)
- soundsystem->buffersize = buffersize * sizeof(short);
-
- soundsystem->mixbuffer = (s8*)SDL_malloc(soundsystem->buffersize);
- //soundsystem->soundbuffer = soundsystem->mixbuffer;
- soundsystem->format = format;
- soundsystem->channel = channel;
- soundsystem->prevtimer = 0;
- soundsystem->soundcursor = 0;
- soundsystem->numsamples = 0;
- soundsystem->period = 0x1000000 / rate;
- soundsystem->cmd = INIT;
-}
-
-void SoundStartMixer(void)
-{
- soundsystem->cmd |= MIX;
-}
-
-void SendCommandToArm7(u32 command)
-{
- while (REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL);
- if (REG_IPC_FIFO_CR & IPC_FIFO_ERROR)
- {
- REG_IPC_FIFO_CR |= IPC_FIFO_SEND_CLEAR;
- }
-
- REG_IPC_FIFO_TX = command;
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/nds/soundcommon.h b/alienblaster/project/jni/sdl/src/audio/nds/soundcommon.h
deleted file mode 100644
index 81827dfe1..000000000
--- a/alienblaster/project/jni/sdl/src/audio/nds/soundcommon.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#ifndef __SOUNDCOMMON_H
-#define __SOUNDCOMMON_H
-
-#include
-
-#define CLOCK (1 << 25)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum
-{
- NONE = 0,
- INIT = 1,
- MIX = 2,
- MIXING = 4,
- STOP = 8
-}CommandType;
-
-typedef enum
-{
- FIFO_NONE = 0,
- UPDATEON_ARM9 = 1,
- MIXCOMPLETE_ONARM9 = 2,
-}FifoType;
-
-typedef struct
-{
- s8 *mixbuffer;//,*soundbuffer;
- u32 rate;
- u32 buffersize;
- u32 cmd;
- u8 channel,format;
- u32 soundcursor,numsamples;
- s32 prevtimer;
- s16 period;
-}S_SoundSystem;
-
-#define soundsystem ((S_SoundSystem*)((u32)(IPC)+sizeof(TransferRegion)))
-
-#ifdef ARM9
-extern void SoundSystemInit(u32 rate,u32 buffersize,u8 channel,u8 format);
-extern void SoundStartMixer(void);
-extern void SendCommandToArm7(u32 command);
-#else
-extern void SoundVBlankIrq(void);
-extern void SoundSwapAndMix(void);
-extern void SoundSetTimer(int period);
-extern void SoundFifoHandler(void);
-extern void SendCommandToArm9(u32 command);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.c b/alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.c
deleted file mode 100644
index 612787c65..000000000
--- a/alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "SDL_timer.h"
-#include "SDL_audio.h"
-#include "../SDL_audiomem.h"
-#include "../SDL_audio_c.h"
-#include "SDL_nto_audio.h"
-
-/* The tag name used by NTO audio */
-#define DRIVER_NAME "qsa-nto"
-
-/* default channel communication parameters */
-#define DEFAULT_CPARAMS_RATE 22050
-#define DEFAULT_CPARAMS_VOICES 1
-/* FIXME: need to add in the near future flexible logic with frag_size and frags count */
-#define DEFAULT_CPARAMS_FRAG_SIZE 4096
-#define DEFAULT_CPARAMS_FRAGS_MIN 1
-#define DEFAULT_CPARAMS_FRAGS_MAX 1
-
-/* Open the audio device for playback, and don't block if busy */
-#define OPEN_FLAGS SND_PCM_OPEN_PLAYBACK
-
-#define QSA_NO_WORKAROUNDS 0x00000000
-#define QSA_MMAP_WORKAROUND 0x00000001
-
-struct BuggyCards
-{
- char* cardname;
- unsigned long bugtype;
-};
-
-#define QSA_WA_CARDS 3
-
-struct BuggyCards buggycards[QSA_WA_CARDS]=
-{
- {"Sound Blaster Live!", QSA_MMAP_WORKAROUND},
- {"Vortex 8820", QSA_MMAP_WORKAROUND},
- {"Vortex 8830", QSA_MMAP_WORKAROUND},
-};
-
-/* Audio driver functions */
-static void NTO_ThreadInit(_THIS);
-static int NTO_OpenAudio(_THIS, SDL_AudioSpec* spec);
-static void NTO_WaitAudio(_THIS);
-static void NTO_PlayAudio(_THIS);
-static Uint8* NTO_GetAudioBuf(_THIS);
-static void NTO_CloseAudio(_THIS);
-
-/* card names check to apply the workarounds */
-static int NTO_CheckBuggyCards(_THIS, unsigned long checkfor)
-{
- char scardname[33];
- int it;
-
- if (snd_card_get_name(cardno, scardname, 32)<0)
- {
- return 0;
- }
-
- for (it=0; itchannel = SND_PCM_CHANNEL_PLAYBACK;
- cpars->mode = SND_PCM_MODE_BLOCK;
- cpars->start_mode = SND_PCM_START_DATA;
- cpars->stop_mode = SND_PCM_STOP_STOP;
- cpars->format.format = SND_PCM_SFMT_S16_LE;
- cpars->format.interleave = 1;
- cpars->format.rate = DEFAULT_CPARAMS_RATE;
- cpars->format.voices = DEFAULT_CPARAMS_VOICES;
- cpars->buf.block.frag_size = DEFAULT_CPARAMS_FRAG_SIZE;
- cpars->buf.block.frags_min = DEFAULT_CPARAMS_FRAGS_MIN;
- cpars->buf.block.frags_max = DEFAULT_CPARAMS_FRAGS_MAX;
-}
-
-static int NTO_AudioAvailable(void)
-{
- /* See if we can open a nonblocking channel.
- Return value '1' means we can.
- Return value '0' means we cannot. */
-
- int available;
- int rval;
- snd_pcm_t* handle;
-
- available = 0;
- handle = NULL;
-
- rval = snd_pcm_open_preferred(&handle, NULL, NULL, OPEN_FLAGS);
-
- if (rval >= 0)
- {
- available = 1;
-
- if ((rval = snd_pcm_close(handle)) < 0)
- {
- SDL_SetError("NTO_AudioAvailable(): snd_pcm_close failed: %s\n", snd_strerror(rval));
- available = 0;
- }
- }
- else
- {
- SDL_SetError("NTO_AudioAvailable(): there are no available audio devices.\n");
- }
-
- return (available);
-}
-
-static void NTO_DeleteAudioDevice(SDL_AudioDevice *device)
-{
- if ((device)&&(device->hidden))
- {
- SDL_free(device->hidden);
- }
- if (device)
- {
- SDL_free(device);
- }
-}
-
-static SDL_AudioDevice* NTO_CreateAudioDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if (this)
- {
- SDL_memset(this, 0, sizeof(SDL_AudioDevice));
- this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(struct SDL_PrivateAudioData));
- }
- if ((this == NULL) || (this->hidden == NULL))
- {
- SDL_OutOfMemory();
- if (this)
- {
- SDL_free(this);
- }
- return (0);
- }
- SDL_memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData));
- audio_handle = NULL;
-
- /* Set the function pointers */
- this->ThreadInit = NTO_ThreadInit;
- this->OpenAudio = NTO_OpenAudio;
- this->WaitAudio = NTO_WaitAudio;
- this->PlayAudio = NTO_PlayAudio;
- this->GetAudioBuf = NTO_GetAudioBuf;
- this->CloseAudio = NTO_CloseAudio;
-
- this->free = NTO_DeleteAudioDevice;
-
- return this;
-}
-
-AudioBootStrap QNXNTOAUDIO_bootstrap =
-{
- DRIVER_NAME, "QNX6 QSA-NTO Audio",
- NTO_AudioAvailable,
- NTO_CreateAudioDevice
-};
-
-/* This function waits until it is possible to write a full sound buffer */
-static void NTO_WaitAudio(_THIS)
-{
- fd_set wfds;
- int selectret;
-
- FD_ZERO(&wfds);
- FD_SET(audio_fd, &wfds);
-
- do {
- selectret=select(audio_fd + 1, NULL, &wfds, NULL, NULL);
- switch (selectret)
- {
- case -1:
- case 0: SDL_SetError("NTO_WaitAudio(): select() failed: %s\n", strerror(errno));
- return;
- default: if (FD_ISSET(audio_fd, &wfds))
- {
- return;
- }
- break;
- }
- } while(1);
-}
-
-static void NTO_PlayAudio(_THIS)
-{
- int written, rval;
- int towrite;
- void* pcmbuffer;
-
- if (!this->enabled)
- {
- return;
- }
-
- towrite = this->spec.size;
- pcmbuffer = pcm_buf;
-
- /* Write the audio data, checking for EAGAIN (buffer full) and underrun */
- do {
- written = snd_pcm_plugin_write(audio_handle, pcm_buf, towrite);
- if (written != towrite)
- {
- if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
- {
- /* Let a little CPU time go by and try to write again */
- SDL_Delay(1);
- /* if we wrote some data */
- towrite -= written;
- pcmbuffer += written * this->spec.channels;
- continue;
- }
- else
- {
- if ((errno == EINVAL) || (errno == EIO))
- {
- SDL_memset(&cstatus, 0, sizeof(cstatus));
- cstatus.channel = SND_PCM_CHANNEL_PLAYBACK;
- if ((rval = snd_pcm_plugin_status(audio_handle, &cstatus)) < 0)
- {
- SDL_SetError("NTO_PlayAudio(): snd_pcm_plugin_status failed: %s\n", snd_strerror(rval));
- return;
- }
- if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) || (cstatus.status == SND_PCM_STATUS_READY))
- {
- if ((rval = snd_pcm_plugin_prepare(audio_handle, SND_PCM_CHANNEL_PLAYBACK)) < 0)
- {
- SDL_SetError("NTO_PlayAudio(): snd_pcm_plugin_prepare failed: %s\n", snd_strerror(rval));
- return;
- }
- }
- continue;
- }
- else
- {
- return;
- }
- }
- }
- else
- {
- /* we wrote all remaining data */
- towrite -= written;
- pcmbuffer += written * this->spec.channels;
- }
- } while ((towrite > 0) && (this->enabled));
-
- /* If we couldn't write, assume fatal error for now */
- if (towrite != 0)
- {
- this->enabled = 0;
- }
-
- return;
-}
-
-static Uint8* NTO_GetAudioBuf(_THIS)
-{
- return pcm_buf;
-}
-
-static void NTO_CloseAudio(_THIS)
-{
- int rval;
-
- this->enabled = 0;
-
- if (audio_handle != NULL)
- {
- if ((rval = snd_pcm_plugin_flush(audio_handle, SND_PCM_CHANNEL_PLAYBACK)) < 0)
- {
- SDL_SetError("NTO_CloseAudio(): snd_pcm_plugin_flush failed: %s\n", snd_strerror(rval));
- return;
- }
- if ((rval = snd_pcm_close(audio_handle)) < 0)
- {
- SDL_SetError("NTO_CloseAudio(): snd_pcm_close failed: %s\n",snd_strerror(rval));
- return;
- }
- audio_handle = NULL;
- }
-}
-
-static int NTO_OpenAudio(_THIS, SDL_AudioSpec* spec)
-{
- int rval;
- int format;
- Uint16 test_format;
- int found;
-
- audio_handle = NULL;
- this->enabled = 0;
-
- if (pcm_buf != NULL)
- {
- SDL_FreeAudioMem(pcm_buf);
- pcm_buf = NULL;
- }
-
- /* initialize channel transfer parameters to default */
- NTO_InitAudioParams(&cparams);
-
- /* Open the audio device */
- rval = snd_pcm_open_preferred(&audio_handle, &cardno, &deviceno, OPEN_FLAGS);
- if (rval < 0)
- {
- SDL_SetError("NTO_OpenAudio(): snd_pcm_open failed: %s\n", snd_strerror(rval));
- return (-1);
- }
-
- if (!NTO_CheckBuggyCards(this, QSA_MMAP_WORKAROUND))
- {
- /* enable count status parameter */
- if ((rval = snd_pcm_plugin_set_disable(audio_handle, PLUGIN_DISABLE_MMAP)) < 0)
- {
- SDL_SetError("snd_pcm_plugin_set_disable failed: %s\n", snd_strerror(rval));
- return (-1);
- }
- }
-
- /* Try for a closest match on audio format */
- format = 0;
- /* can't use format as SND_PCM_SFMT_U8 = 0 in nto */
- found = 0;
-
- for (test_format=SDL_FirstAudioFormat(spec->format); !found ;)
- {
- /* if match found set format to equivalent ALSA format */
- switch (test_format)
- {
- case AUDIO_U8:
- format = SND_PCM_SFMT_U8;
- found = 1;
- break;
- case AUDIO_S8:
- format = SND_PCM_SFMT_S8;
- found = 1;
- break;
- case AUDIO_S16LSB:
- format = SND_PCM_SFMT_S16_LE;
- found = 1;
- break;
- case AUDIO_S16MSB:
- format = SND_PCM_SFMT_S16_BE;
- found = 1;
- break;
- case AUDIO_U16LSB:
- format = SND_PCM_SFMT_U16_LE;
- found = 1;
- break;
- case AUDIO_U16MSB:
- format = SND_PCM_SFMT_U16_BE;
- found = 1;
- break;
- default:
- break;
- }
-
- if (!found)
- {
- test_format = SDL_NextAudioFormat();
- }
- }
-
- /* assumes test_format not 0 on success */
- if (test_format == 0)
- {
- SDL_SetError("NTO_OpenAudio(): Couldn't find any hardware audio formats");
- return (-1);
- }
-
- spec->format = test_format;
-
- /* Set the audio format */
- cparams.format.format = format;
-
- /* Set mono or stereo audio (currently only two channels supported) */
- cparams.format.voices = spec->channels;
-
- /* Set rate */
- cparams.format.rate = spec->freq;
-
- /* Setup the transfer parameters according to cparams */
- rval = snd_pcm_plugin_params(audio_handle, &cparams);
- if (rval < 0)
- {
- SDL_SetError("NTO_OpenAudio(): snd_pcm_channel_params failed: %s\n", snd_strerror(rval));
- return (-1);
- }
-
- /* Make sure channel is setup right one last time */
- SDL_memset(&csetup, 0x00, sizeof(csetup));
- csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
- if (snd_pcm_plugin_setup(audio_handle, &csetup) < 0)
- {
- SDL_SetError("NTO_OpenAudio(): Unable to setup playback channel\n");
- return -1;
- }
-
-
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(spec);
-
- pcm_len = spec->size;
-
- if (pcm_len==0)
- {
- pcm_len = csetup.buf.block.frag_size * spec->channels * (snd_pcm_format_width(format)/8);
- }
-
- /* Allocate memory to the audio buffer and initialize with silence (Note that
- buffer size must be a multiple of fragment size, so find closest multiple)
- */
- pcm_buf = (Uint8*)SDL_AllocAudioMem(pcm_len);
- if (pcm_buf == NULL)
- {
- SDL_SetError("NTO_OpenAudio(): pcm buffer allocation failed\n");
- return (-1);
- }
- SDL_memset(pcm_buf, spec->silence, pcm_len);
-
- /* get the file descriptor */
- if ((audio_fd = snd_pcm_file_descriptor(audio_handle, SND_PCM_CHANNEL_PLAYBACK)) < 0)
- {
- SDL_SetError("NTO_OpenAudio(): snd_pcm_file_descriptor failed with error code: %s\n", snd_strerror(rval));
- return (-1);
- }
-
- /* Trigger audio playback */
- rval = snd_pcm_plugin_prepare(audio_handle, SND_PCM_CHANNEL_PLAYBACK);
- if (rval < 0)
- {
- SDL_SetError("snd_pcm_plugin_prepare failed: %s\n", snd_strerror(rval));
- return (-1);
- }
-
- this->enabled = 1;
-
- /* Get the parent process id (we're the parent of the audio thread) */
- parent = getpid();
-
- /* We're really ready to rock and roll. :-) */
- return (0);
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.h b/alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.h
deleted file mode 100644
index cae92255f..000000000
--- a/alienblaster/project/jni/sdl/src/audio/nto/SDL_nto_audio.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#ifndef __SDL_NTO_AUDIO_H__
-#define __SDL_NTO_AUDIO_H__
-
-#include
-
-#include "../SDL_sysaudio.h"
-
-/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
-
-struct SDL_PrivateAudioData
-{
- /* The audio device handle */
- int cardno;
- int deviceno;
- snd_pcm_t* audio_handle;
-
- /* The audio file descriptor */
- int audio_fd;
-
- /* The parent process id, to detect when application quits */
- pid_t parent;
-
- /* Raw mixing buffer */
- Uint8* pcm_buf;
- Uint32 pcm_len;
-
- /* QSA parameters */
- snd_pcm_channel_status_t cstatus;
- snd_pcm_channel_params_t cparams;
- snd_pcm_channel_setup_t csetup;
-};
-
-#define cardno (this->hidden->cardno)
-#define deviceno (this->hidden->deviceno)
-#define audio_handle (this->hidden->audio_handle)
-#define audio_fd (this->hidden->audio_fd)
-#define parent (this->hidden->parent)
-#define pcm_buf (this->hidden->pcm_buf)
-#define pcm_len (this->hidden->pcm_len)
-#define cstatus (this->hidden->cstatus)
-#define cparams (this->hidden->cparams)
-#define csetup (this->hidden->csetup)
-
-#endif /* __SDL_NTO_AUDIO_H__ */
diff --git a/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.c b/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.c
index 6795e1e78..cd05ddf21 100644
--- a/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.c
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -30,16 +30,17 @@
#include
#include
#include
+#include
#include
#include "SDL_timer.h"
#include "SDL_audio.h"
+#include "SDL_stdinc.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
#include "SDL_paudio.h"
-#define DEBUG_AUDIO 1
+#define DEBUG_AUDIO 0
/* A conflict within AIX 4.3.3 headers and probably others as well.
* I guess nobody ever uses audio... Shame over AIX header files. */
@@ -48,134 +49,142 @@
#include
/* The tag name used by paud audio */
-#define Paud_DRIVER_NAME "paud"
+#define PAUDIO_DRIVER_NAME "paud"
/* Open the audio device for playback, and don't block if busy */
/* #define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) */
#define OPEN_FLAGS O_WRONLY
-/* Audio driver functions */
-static int Paud_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void Paud_WaitAudio(_THIS);
-static void Paud_PlayAudio(_THIS);
-static Uint8 *Paud_GetAudioBuf(_THIS);
-static void Paud_CloseAudio(_THIS);
+/* Get the name of the audio device we use for output */
-/* Audio driver bootstrap functions */
+#ifndef _PATH_DEV_DSP
+#define _PATH_DEV_DSP "/dev/%caud%c/%c"
+#endif
-static int Audio_Available(void)
-{
- int fd;
- int available;
-
- available = 0;
- fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
- if ( fd >= 0 ) {
- available = 1;
- close(fd);
- }
- return(available);
-}
-
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- audio_fd = -1;
-
- /* Set the function pointers */
- this->OpenAudio = Paud_OpenAudio;
- this->WaitAudio = Paud_WaitAudio;
- this->PlayAudio = Paud_PlayAudio;
- this->GetAudioBuf = Paud_GetAudioBuf;
- this->CloseAudio = Paud_CloseAudio;
-
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap Paud_bootstrap = {
- Paud_DRIVER_NAME, "AIX Paudio",
- Audio_Available, Audio_CreateDevice
+static char devsettings[][3] = {
+ {'p', '0', '1'}, {'p', '0', '2'}, {'p', '0', '3'}, {'p', '0', '4'},
+ {'p', '1', '1'}, {'p', '1', '2'}, {'p', '1', '3'}, {'p', '1', '4'},
+ {'p', '2', '1'}, {'p', '2', '2'}, {'p', '2', '3'}, {'p', '2', '4'},
+ {'p', '3', '1'}, {'p', '3', '2'}, {'p', '3', '3'}, {'p', '3', '4'},
+ {'b', '0', '1'}, {'b', '0', '2'}, {'b', '0', '3'}, {'b', '0', '4'},
+ {'b', '1', '1'}, {'b', '1', '2'}, {'b', '1', '3'}, {'b', '1', '4'},
+ {'b', '2', '1'}, {'b', '2', '2'}, {'b', '2', '3'}, {'b', '2', '4'},
+ {'b', '3', '1'}, {'b', '3', '2'}, {'b', '3', '3'}, {'b', '3', '4'},
+ {'\0', '\0', '\0'}
};
+static int
+OpenUserDefinedDevice(char *path, int maxlen, int flags)
+{
+ const char *audiodev;
+ int fd;
+
+ /* Figure out what our audio device is */
+ if ((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) {
+ audiodev = SDL_getenv("AUDIODEV");
+ }
+ if (audiodev == NULL) {
+ return -1;
+ }
+ fd = open(audiodev, flags, 0);
+ if (path != NULL) {
+ SDL_strlcpy(path, audiodev, maxlen);
+ path[maxlen - 1] = '\0';
+ }
+ return fd;
+}
+
+static int
+OpenAudioPath(char *path, int maxlen, int flags, int classic)
+{
+ struct stat sb;
+ int cycle = 0;
+ int fd = OpenUserDefinedDevice(path, maxlen, flags);
+
+ if (fd != -1) {
+ return fd;
+ }
+
+ /* !!! FIXME: do we really need a table here? */
+ while (devsettings[cycle][0] != '\0') {
+ char audiopath[1024];
+ SDL_snprintf(audiopath, SDL_arraysize(audiopath),
+ _PATH_DEV_DSP,
+ devsettings[cycle][0],
+ devsettings[cycle][1], devsettings[cycle][2]);
+
+ if (stat(audiopath, &sb) == 0) {
+ fd = open(audiopath, flags, 0);
+ if (fd > 0) {
+ if (path != NULL) {
+ SDL_strlcpy(path, audiopath, maxlen);
+ }
+ return fd;
+ }
+ }
+ }
+ return -1;
+}
+
/* This function waits until it is possible to write a full sound buffer */
-static void Paud_WaitAudio(_THIS)
+static void
+PAUDIO_WaitDevice(_THIS)
{
fd_set fdset;
/* See if we need to use timed audio synchronization */
- if ( frame_ticks ) {
+ if (this->hidden->frame_ticks) {
/* Use timer for general audio synchronization */
Sint32 ticks;
- ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS;
- if ( ticks > 0 ) {
- SDL_Delay(ticks);
+ ticks =
+ ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) -
+ FUDGE_TICKS;
+ if (ticks > 0) {
+ SDL_Delay(ticks);
}
} else {
- audio_buffer paud_bufinfo;
+ audio_buffer paud_bufinfo;
/* Use select() for audio synchronization */
struct timeval timeout;
FD_ZERO(&fdset);
- FD_SET(audio_fd, &fdset);
+ FD_SET(this->hidden->audio_fd, &fdset);
- if ( ioctl(audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0 ) {
+ if (ioctl(this->hidden->audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
#ifdef DEBUG_AUDIO
fprintf(stderr, "Couldn't get audio buffer information\n");
#endif
- timeout.tv_sec = 10;
+ timeout.tv_sec = 10;
timeout.tv_usec = 0;
} else {
- long ms_in_buf = paud_bufinfo.write_buf_time;
- timeout.tv_sec = ms_in_buf/1000;
- ms_in_buf = ms_in_buf - timeout.tv_sec*1000;
- timeout.tv_usec = ms_in_buf*1000;
+ long ms_in_buf = paud_bufinfo.write_buf_time;
+ timeout.tv_sec = ms_in_buf / 1000;
+ ms_in_buf = ms_in_buf - timeout.tv_sec * 1000;
+ timeout.tv_usec = ms_in_buf * 1000;
#ifdef DEBUG_AUDIO
- fprintf( stderr,
- "Waiting for write_buf_time=%ld,%ld\n",
- timeout.tv_sec,
- timeout.tv_usec );
+ fprintf(stderr,
+ "Waiting for write_buf_time=%ld,%ld\n",
+ timeout.tv_sec, timeout.tv_usec);
#endif
- }
+ }
#ifdef DEBUG_AUDIO
fprintf(stderr, "Waiting for audio to get ready\n");
#endif
- if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) {
- const char *message = "Audio timeout - buggy audio driver? (disabled)";
+ if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout)
+ <= 0) {
+ const char *message =
+ "Audio timeout - buggy audio driver? (disabled)";
/*
- * In general we should never print to the screen,
+ * In general we should never print to the screen,
* but in this case we have no other way of letting
* the user know what happened.
*/
fprintf(stderr, "SDL: %s - %s\n", strerror(errno), message);
this->enabled = 0;
/* Don't try to close - may hang */
- audio_fd = -1;
+ this->hidden->audio_fd = -1;
#ifdef DEBUG_AUDIO
fprintf(stderr, "Done disabling audio\n");
#endif
@@ -186,326 +195,360 @@ static void Paud_WaitAudio(_THIS)
}
}
-static void Paud_PlayAudio(_THIS)
+static void
+PAUDIO_PlayDevice(_THIS)
{
- int written;
+ int written = 0;
+ const Uint8 *mixbuf = this->hidden->mixbuf;
+ const size_t mixlen = this->hidden->mixlen;
- /* Write the audio data, checking for EAGAIN on broken audio drivers */
- do {
- written = write(audio_fd, mixbuf, mixlen);
- if ( (written < 0) && ((errno == 0) || (errno == EAGAIN)) ) {
- SDL_Delay(1); /* Let a little CPU time go by */
- }
- } while ( (written < 0) &&
- ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)) );
-
- /* If timer synchronization is enabled, set the next write frame */
- if ( frame_ticks ) {
- next_frame += frame_ticks;
- }
-
- /* If we couldn't write, assume fatal error for now */
- if ( written < 0 ) {
- this->enabled = 0;
- }
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Wrote %d bytes of audio data\n", written);
-#endif
-}
-
-static Uint8 *Paud_GetAudioBuf(_THIS)
-{
- return mixbuf;
-}
-
-static void Paud_CloseAudio(_THIS)
-{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( audio_fd >= 0 ) {
- close(audio_fd);
- audio_fd = -1;
- }
-}
-
-static int Paud_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- char audiodev[1024];
- int format;
- int bytes_per_sample;
- Uint16 test_format;
- audio_init paud_init;
- audio_buffer paud_bufinfo;
- audio_status paud_status;
- audio_control paud_control;
- audio_change paud_change;
-
- /* Reset the timer synchronization flag */
- frame_ticks = 0.0;
-
- /* Open the audio device */
- audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
- if ( audio_fd < 0 ) {
- SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
- return -1;
- }
-
- /*
- * We can't set the buffer size - just ask the device for the maximum
- * that we can have.
- */
- if ( ioctl(audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0 ) {
- SDL_SetError("Couldn't get audio buffer information");
- return -1;
- }
-
- mixbuf = NULL;
-
- if ( spec->channels > 1 )
- spec->channels = 2;
- else
- spec->channels = 1;
-
- /*
- * Fields in the audio_init structure:
- *
- * Ignored by us:
- *
- * paud.loadpath[LOAD_PATH]; * DSP code to load, MWave chip only?
- * paud.slot_number; * slot number of the adapter
- * paud.device_id; * adapter identification number
- *
- * Input:
- *
- * paud.srate; * the sampling rate in Hz
- * paud.bits_per_sample; * 8, 16, 32, ...
- * paud.bsize; * block size for this rate
- * paud.mode; * ADPCM, PCM, MU_LAW, A_LAW, SOURCE_MIX
- * paud.channels; * 1=mono, 2=stereo
- * paud.flags; * FIXED - fixed length data
- * * LEFT_ALIGNED, RIGHT_ALIGNED (var len only)
- * * TWOS_COMPLEMENT - 2's complement data
- * * SIGNED - signed? comment seems wrong in sys/audio.h
- * * BIG_ENDIAN
- * paud.operation; * PLAY, RECORD
- *
- * Output:
- *
- * paud.flags; * PITCH - pitch is supported
- * * INPUT - input is supported
- * * OUTPUT - output is supported
- * * MONITOR - monitor is supported
- * * VOLUME - volume is supported
- * * VOLUME_DELAY - volume delay is supported
- * * BALANCE - balance is supported
- * * BALANCE_DELAY - balance delay is supported
- * * TREBLE - treble control is supported
- * * BASS - bass control is supported
- * * BESTFIT_PROVIDED - best fit returned
- * * LOAD_CODE - DSP load needed
- * paud.rc; * NO_PLAY - DSP code can't do play requests
- * * NO_RECORD - DSP code can't do record requests
- * * INVALID_REQUEST - request was invalid
- * * CONFLICT - conflict with open's flags
- * * OVERLOADED - out of DSP MIPS or memory
- * paud.position_resolution; * smallest increment for position
- */
-
- paud_init.srate = spec->freq;
- paud_init.mode = PCM;
- paud_init.operation = PLAY;
- paud_init.channels = spec->channels;
-
- /* Try for a closest match on audio format */
- format = 0;
- for ( test_format = SDL_FirstAudioFormat(spec->format);
- ! format && test_format; ) {
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
-#endif
- switch ( test_format ) {
- case AUDIO_U8:
- bytes_per_sample = 1;
- paud_init.bits_per_sample = 8;
- paud_init.flags = TWOS_COMPLEMENT | FIXED;
- format = 1;
- break;
- case AUDIO_S8:
- bytes_per_sample = 1;
- paud_init.bits_per_sample = 8;
- paud_init.flags = SIGNED |
- TWOS_COMPLEMENT | FIXED;
- format = 1;
- break;
- case AUDIO_S16LSB:
- bytes_per_sample = 2;
- paud_init.bits_per_sample = 16;
- paud_init.flags = SIGNED |
- TWOS_COMPLEMENT | FIXED;
- format = 1;
- break;
- case AUDIO_S16MSB:
- bytes_per_sample = 2;
- paud_init.bits_per_sample = 16;
- paud_init.flags = BIG_ENDIAN |
- SIGNED |
- TWOS_COMPLEMENT | FIXED;
- format = 1;
- break;
- case AUDIO_U16LSB:
- bytes_per_sample = 2;
- paud_init.bits_per_sample = 16;
- paud_init.flags = TWOS_COMPLEMENT | FIXED;
- format = 1;
- break;
- case AUDIO_U16MSB:
- bytes_per_sample = 2;
- paud_init.bits_per_sample = 16;
- paud_init.flags = BIG_ENDIAN |
- TWOS_COMPLEMENT | FIXED;
- format = 1;
- break;
- default:
- break;
- }
- if ( ! format ) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if ( format == 0 ) {
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Couldn't find any hardware audio formats\n");
-#endif
- SDL_SetError("Couldn't find any hardware audio formats");
- return -1;
- }
- spec->format = test_format;
-
- /*
- * We know the buffer size and the max number of subsequent writes
- * that can be pending. If more than one can pend, allow the application
- * to do something like double buffering between our write buffer and
- * the device's own buffer that we are filling with write() anyway.
- *
- * We calculate spec->samples like this because SDL_CalculateAudioSpec()
- * will give put paud_bufinfo.write_buf_cap (or paud_bufinfo.write_buf_cap/2)
- * into spec->size in return.
- */
- if ( paud_bufinfo.request_buf_cap == 1 )
- {
- spec->samples = paud_bufinfo.write_buf_cap
- / bytes_per_sample
- / spec->channels;
- }
- else
- {
- spec->samples = paud_bufinfo.write_buf_cap
- / bytes_per_sample
- / spec->channels
- / 2;
- }
- paud_init.bsize = bytes_per_sample * spec->channels;
-
- SDL_CalculateAudioSpec(spec);
-
- /*
- * The AIX paud device init can't modify the values of the audio_init
- * structure that we pass to it. So we don't need any recalculation
- * of this stuff and no reinit call as in linux dsp and dma code.
- *
- * /dev/paud supports all of the encoding formats, so we don't need
- * to do anything like reopening the device, either.
- */
- if ( ioctl(audio_fd, AUDIO_INIT, &paud_init) < 0 ) {
- switch ( paud_init.rc )
- {
- case 1 :
- SDL_SetError("Couldn't set audio format: DSP can't do play requests");
- return -1;
- break;
- case 2 :
- SDL_SetError("Couldn't set audio format: DSP can't do record requests");
- return -1;
- break;
- case 4 :
- SDL_SetError("Couldn't set audio format: request was invalid");
- return -1;
- break;
- case 5 :
- SDL_SetError("Couldn't set audio format: conflict with open's flags");
- return -1;
- break;
- case 6 :
- SDL_SetError("Couldn't set audio format: out of DSP MIPS or memory");
- return -1;
- break;
- default :
- SDL_SetError("Couldn't set audio format: not documented in sys/audio.h");
- return -1;
- break;
- }
- }
-
- /* Allocate mixing buffer */
- mixlen = spec->size;
- mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
- if ( mixbuf == NULL ) {
- return -1;
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
-
- /*
- * Set some paramters: full volume, first speaker that we can find.
- * Ignore the other settings for now.
- */
- paud_change.input = AUDIO_IGNORE; /* the new input source */
- paud_change.output = OUTPUT_1; /* EXTERNAL_SPEAKER,INTERNAL_SPEAKER,OUTPUT_1 */
- paud_change.monitor = AUDIO_IGNORE; /* the new monitor state */
- paud_change.volume = 0x7fffffff; /* volume level [0-0x7fffffff] */
- paud_change.volume_delay = AUDIO_IGNORE; /* the new volume delay */
- paud_change.balance = 0x3fffffff; /* the new balance */
- paud_change.balance_delay = AUDIO_IGNORE; /* the new balance delay */
- paud_change.treble = AUDIO_IGNORE; /* the new treble state */
- paud_change.bass = AUDIO_IGNORE; /* the new bass state */
- paud_change.pitch = AUDIO_IGNORE; /* the new pitch state */
-
- paud_control.ioctl_request = AUDIO_CHANGE;
- paud_control.request_info = (char*)&paud_change;
- if ( ioctl(audio_fd, AUDIO_CONTROL, &paud_control) < 0 ) {
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Can't change audio display settings\n" );
-#endif
- }
-
- /*
- * Tell the device to expect data. Actual start will wait for
- * the first write() call.
- */
- paud_control.ioctl_request = AUDIO_START;
- paud_control.position = 0;
- if ( ioctl(audio_fd, AUDIO_CONTROL, &paud_control) < 0 ) {
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Can't start audio play\n" );
-#endif
- SDL_SetError("Can't start audio play");
- return -1;
- }
-
- /* Check to see if we need to use select() workaround */
- { char *workaround;
- workaround = SDL_getenv("SDL_DSP_NOSELECT");
- if ( workaround ) {
- frame_ticks = (float)(spec->samples*1000)/spec->freq;
- next_frame = SDL_GetTicks()+frame_ticks;
- }
+ /* Write the audio data, checking for EAGAIN on broken audio drivers */
+ do {
+ written = write(this->hidden->audio_fd, mixbuf, mixlen);
+ if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
+ SDL_Delay(1); /* Let a little CPU time go by */
}
+ } while ((written < 0) &&
+ ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
- /* Get the parent process id (we're the parent of the audio thread) */
- parent = getpid();
+ /* If timer synchronization is enabled, set the next write frame */
+ if (this->hidden->frame_ticks) {
+ this->hidden->next_frame += this->hidden->frame_ticks;
+ }
- /* We're ready to rock and roll. :-) */
- return 0;
+ /* If we couldn't write, assume fatal error for now */
+ if (written < 0) {
+ this->enabled = 0;
+ }
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Wrote %d bytes of audio data\n", written);
+#endif
}
+static Uint8 *
+PAUDIO_GetDeviceBuf(_THIS)
+{
+ return this->hidden->mixbuf;
+}
+
+static void
+PAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->audio_fd >= 0) {
+ close(this->hidden->audio_fd);
+ this->hidden->audio_fd = -1;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
+
+static int
+PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ const char *workaround = SDL_getenv("SDL_DSP_NOSELECT");
+ char audiodev[1024];
+ const char *err = NULL;
+ int format;
+ int bytes_per_sample;
+ SDL_AudioFormat test_format;
+ audio_init paud_init;
+ audio_buffer paud_bufinfo;
+ audio_status paud_status;
+ audio_control paud_control;
+ audio_change paud_change;
+ int fd = -1;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+
+ /* Open the audio device */
+ fd = OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
+ this->hidden->audio_fd = fd;
+ if (fd < 0) {
+ PAUDIO_CloseDevice(this);
+ SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
+ return 0;
+ }
+
+ /*
+ * We can't set the buffer size - just ask the device for the maximum
+ * that we can have.
+ */
+ if (ioctl(fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
+ PAUDIO_CloseDevice(this);
+ SDL_SetError("Couldn't get audio buffer information");
+ return 0;
+ }
+
+ if (this->spec.channels > 1)
+ this->spec.channels = 2;
+ else
+ this->spec.channels = 1;
+
+ /*
+ * Fields in the audio_init structure:
+ *
+ * Ignored by us:
+ *
+ * paud.loadpath[LOAD_PATH]; * DSP code to load, MWave chip only?
+ * paud.slot_number; * slot number of the adapter
+ * paud.device_id; * adapter identification number
+ *
+ * Input:
+ *
+ * paud.srate; * the sampling rate in Hz
+ * paud.bits_per_sample; * 8, 16, 32, ...
+ * paud.bsize; * block size for this rate
+ * paud.mode; * ADPCM, PCM, MU_LAW, A_LAW, SOURCE_MIX
+ * paud.channels; * 1=mono, 2=stereo
+ * paud.flags; * FIXED - fixed length data
+ * * LEFT_ALIGNED, RIGHT_ALIGNED (var len only)
+ * * TWOS_COMPLEMENT - 2's complement data
+ * * SIGNED - signed? comment seems wrong in sys/audio.h
+ * * BIG_ENDIAN
+ * paud.operation; * PLAY, RECORD
+ *
+ * Output:
+ *
+ * paud.flags; * PITCH - pitch is supported
+ * * INPUT - input is supported
+ * * OUTPUT - output is supported
+ * * MONITOR - monitor is supported
+ * * VOLUME - volume is supported
+ * * VOLUME_DELAY - volume delay is supported
+ * * BALANCE - balance is supported
+ * * BALANCE_DELAY - balance delay is supported
+ * * TREBLE - treble control is supported
+ * * BASS - bass control is supported
+ * * BESTFIT_PROVIDED - best fit returned
+ * * LOAD_CODE - DSP load needed
+ * paud.rc; * NO_PLAY - DSP code can't do play requests
+ * * NO_RECORD - DSP code can't do record requests
+ * * INVALID_REQUEST - request was invalid
+ * * CONFLICT - conflict with open's flags
+ * * OVERLOADED - out of DSP MIPS or memory
+ * paud.position_resolution; * smallest increment for position
+ */
+
+ paud_init.srate = this->spec.freq;
+ paud_init.mode = PCM;
+ paud_init.operation = PLAY;
+ paud_init.channels = this->spec.channels;
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ !format && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ bytes_per_sample = 1;
+ paud_init.bits_per_sample = 8;
+ paud_init.flags = TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_S8:
+ bytes_per_sample = 1;
+ paud_init.bits_per_sample = 8;
+ paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_S16LSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_S16MSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = BIG_ENDIAN | SIGNED | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_U16LSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ case AUDIO_U16MSB:
+ bytes_per_sample = 2;
+ paud_init.bits_per_sample = 16;
+ paud_init.flags = BIG_ENDIAN | TWOS_COMPLEMENT | FIXED;
+ format = 1;
+ break;
+ default:
+ break;
+ }
+ if (!format) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (format == 0) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Couldn't find any hardware audio formats\n");
+#endif
+ PAUDIO_CloseDevice(this);
+ SDL_SetError("Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
+
+ /*
+ * We know the buffer size and the max number of subsequent writes
+ * that can be pending. If more than one can pend, allow the application
+ * to do something like double buffering between our write buffer and
+ * the device's own buffer that we are filling with write() anyway.
+ *
+ * We calculate this->spec.samples like this because
+ * SDL_CalculateAudioSpec() will give put paud_bufinfo.write_buf_cap
+ * (or paud_bufinfo.write_buf_cap/2) into this->spec.size in return.
+ */
+ if (paud_bufinfo.request_buf_cap == 1) {
+ this->spec.samples = paud_bufinfo.write_buf_cap
+ / bytes_per_sample / this->spec.channels;
+ } else {
+ this->spec.samples = paud_bufinfo.write_buf_cap
+ / bytes_per_sample / this->spec.channels / 2;
+ }
+ paud_init.bsize = bytes_per_sample * this->spec.channels;
+
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /*
+ * The AIX paud device init can't modify the values of the audio_init
+ * structure that we pass to it. So we don't need any recalculation
+ * of this stuff and no reinit call as in linux dsp and dma code.
+ *
+ * /dev/paud supports all of the encoding formats, so we don't need
+ * to do anything like reopening the device, either.
+ */
+ if (ioctl(fd, AUDIO_INIT, &paud_init) < 0) {
+ switch (paud_init.rc) {
+ case 1:
+ err = "Couldn't set audio format: DSP can't do play requests";
+ break;
+ case 2:
+ err = "Couldn't set audio format: DSP can't do record requests";
+ break;
+ case 4:
+ err = "Couldn't set audio format: request was invalid";
+ break;
+ case 5:
+ err = "Couldn't set audio format: conflict with open's flags";
+ break;
+ case 6:
+ err = "Couldn't set audio format: out of DSP MIPS or memory";
+ break;
+ default:
+ err = "Couldn't set audio format: not documented in sys/audio.h";
+ break;
+ }
+ }
+
+ if (err != NULL) {
+ PAUDIO_CloseDevice(this);
+ SDL_SetError("Paudio: %s", err);
+ return 0;
+ }
+
+ /* Allocate mixing buffer */
+ this->hidden->mixlen = this->spec.size;
+ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
+ if (this->hidden->mixbuf == NULL) {
+ PAUDIO_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
+
+ /*
+ * Set some paramters: full volume, first speaker that we can find.
+ * Ignore the other settings for now.
+ */
+ paud_change.input = AUDIO_IGNORE; /* the new input source */
+ paud_change.output = OUTPUT_1; /* EXTERNAL_SPEAKER,INTERNAL_SPEAKER,OUTPUT_1 */
+ paud_change.monitor = AUDIO_IGNORE; /* the new monitor state */
+ paud_change.volume = 0x7fffffff; /* volume level [0-0x7fffffff] */
+ paud_change.volume_delay = AUDIO_IGNORE; /* the new volume delay */
+ paud_change.balance = 0x3fffffff; /* the new balance */
+ paud_change.balance_delay = AUDIO_IGNORE; /* the new balance delay */
+ paud_change.treble = AUDIO_IGNORE; /* the new treble state */
+ paud_change.bass = AUDIO_IGNORE; /* the new bass state */
+ paud_change.pitch = AUDIO_IGNORE; /* the new pitch state */
+
+ paud_control.ioctl_request = AUDIO_CHANGE;
+ paud_control.request_info = (char *) &paud_change;
+ if (ioctl(fd, AUDIO_CONTROL, &paud_control) < 0) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Can't change audio display settings\n");
+#endif
+ }
+
+ /*
+ * Tell the device to expect data. Actual start will wait for
+ * the first write() call.
+ */
+ paud_control.ioctl_request = AUDIO_START;
+ paud_control.position = 0;
+ if (ioctl(fd, AUDIO_CONTROL, &paud_control) < 0) {
+ PAUDIO_CloseDevice(this);
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Can't start audio play\n");
+#endif
+ SDL_SetError("Can't start audio play");
+ return 0;
+ }
+
+ /* Check to see if we need to use select() workaround */
+ if (workaround != NULL) {
+ this->hidden->frame_ticks = (float) (this->spec.samples * 1000) /
+ this->spec.freq;
+ this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks;
+ }
+
+ /* We're ready to rock and roll. :-) */
+ return 1;
+}
+
+static int
+PAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ /* !!! FIXME: not right for device enum? */
+ int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
+ if (fd < 0) {
+ SDL_SetError("PAUDIO: Couldn't open audio device");
+ return 0;
+ }
+ close(fd);
+
+ /* Set the function pointers */
+ impl->OpenDevice = DSP_OpenDevice;
+ impl->PlayDevice = DSP_PlayDevice;
+ impl->PlayDevice = DSP_WaitDevice;
+ impl->GetDeviceBuf = DSP_GetDeviceBuf;
+ impl->CloseDevice = DSP_CloseDevice;
+ impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap PAUDIO_bootstrap = {
+ PAUDIO_DRIVER_NAME, "AIX Paudio", PAUDIO_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.h b/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.h
index 6e10bbbcc..2dc5de624 100644
--- a/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/paudio/SDL_paudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -26,32 +26,23 @@
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- int audio_fd;
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
- /* The parent process id, to detect when application quits */
- pid_t parent;
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
-
- /* Support for audio timing using a timer, in addition to select() */
- float frame_ticks;
- float next_frame;
+ /* Support for audio timing using a timer, in addition to select() */
+ float frame_ticks;
+ float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
-
-/* Old variable names */
-#define audio_fd (this->hidden->audio_fd)
-#define parent (this->hidden->parent)
-#define mixbuf (this->hidden->mixbuf)
-#define mixlen (this->hidden->mixlen)
-#define frame_ticks (this->hidden->frame_ticks)
-#define next_frame (this->hidden->next_frame)
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_paudaudio_h */
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.c b/alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.c
deleted file mode 100644
index 21e51cd53..000000000
--- a/alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Stéphan Kochen
- stephan@kochen.nl
-
- Based on parts of the ALSA and ESounD output drivers.
-*/
-#include "SDL_config.h"
-
-/* Allow access to an PulseAudio network stream mixing buffer */
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "SDL_timer.h"
-#include "SDL_audio.h"
-#include "../SDL_audiomem.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_audiodev_c.h"
-#include "SDL_pulseaudio.h"
-
-#ifdef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
-#include "SDL_name.h"
-#include "SDL_loadso.h"
-#else
-#define SDL_NAME(X) X
-#endif
-
-/* The tag name used by the driver */
-#define PULSE_DRIVER_NAME "pulse"
-
-/* Audio driver functions */
-static int PULSE_OpenAudio(_THIS, SDL_AudioSpec *spec);
-static void PULSE_WaitAudio(_THIS);
-static void PULSE_PlayAudio(_THIS);
-static Uint8 *PULSE_GetAudioBuf(_THIS);
-static void PULSE_CloseAudio(_THIS);
-static void PULSE_WaitDone(_THIS);
-
-#ifdef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
-
-static const char *pulse_library = SDL_AUDIO_DRIVER_PULSE_DYNAMIC;
-static void *pulse_handle = NULL;
-static int pulse_loaded = 0;
-
-static pa_simple* (*SDL_NAME(pa_simple_new))(
- const char *server,
- const char *name,
- pa_stream_direction_t dir,
- const char *dev,
- const char *stream_name,
- const pa_sample_spec *ss,
- const pa_channel_map *map,
- const pa_buffer_attr *attr,
- int *error
-);
-static void (*SDL_NAME(pa_simple_free))(pa_simple *s);
-
-static pa_channel_map* (*SDL_NAME(pa_channel_map_init_auto))(
- pa_channel_map *m,
- unsigned channels,
- pa_channel_map_def_t def
-);
-
-pa_mainloop * (*SDL_NAME(pa_mainloop_new))(void);
-pa_mainloop_api * (*SDL_NAME(pa_mainloop_get_api))(pa_mainloop *m);
-int (*SDL_NAME(pa_mainloop_iterate))(pa_mainloop *m, int block, int *retval);
-void (*SDL_NAME(pa_mainloop_free))(pa_mainloop *m);
-
-pa_operation_state_t (*SDL_NAME(pa_operation_get_state))(pa_operation *o);
-void (*SDL_NAME(pa_operation_cancel))(pa_operation *o);
-void (*SDL_NAME(pa_operation_unref))(pa_operation *o);
-
-pa_context * (*SDL_NAME(pa_context_new))(
- pa_mainloop_api *m, const char *name);
-int (*SDL_NAME(pa_context_connect))(
- pa_context *c, const char *server,
- pa_context_flags_t flags, const pa_spawn_api *api);
-pa_context_state_t (*SDL_NAME(pa_context_get_state))(pa_context *c);
-void (*SDL_NAME(pa_context_disconnect))(pa_context *c);
-void (*SDL_NAME(pa_context_unref))(pa_context *c);
-
-pa_stream * (*SDL_NAME(pa_stream_new))(pa_context *c,
- const char *name, const pa_sample_spec *ss, const pa_channel_map *map);
-int (*SDL_NAME(pa_stream_connect_playback))(pa_stream *s, const char *dev,
- const pa_buffer_attr *attr, pa_stream_flags_t flags,
- pa_cvolume *volume, pa_stream *sync_stream);
-pa_stream_state_t (*SDL_NAME(pa_stream_get_state))(pa_stream *s);
-size_t (*SDL_NAME(pa_stream_writable_size))(pa_stream *s);
-int (*SDL_NAME(pa_stream_write))(pa_stream *s, const void *data, size_t nbytes,
- pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
-pa_operation * (*SDL_NAME(pa_stream_drain))(pa_stream *s,
- pa_stream_success_cb_t cb, void *userdata);
-int (*SDL_NAME(pa_stream_disconnect))(pa_stream *s);
-void (*SDL_NAME(pa_stream_unref))(pa_stream *s);
-
-static struct {
- const char *name;
- void **func;
-} pulse_functions[] = {
- { "pa_simple_new",
- (void **)&SDL_NAME(pa_simple_new) },
- { "pa_simple_free",
- (void **)&SDL_NAME(pa_simple_free) },
- { "pa_channel_map_init_auto",
- (void **)&SDL_NAME(pa_channel_map_init_auto) },
- { "pa_mainloop_new",
- (void **)&SDL_NAME(pa_mainloop_new) },
- { "pa_mainloop_get_api",
- (void **)&SDL_NAME(pa_mainloop_get_api) },
- { "pa_mainloop_iterate",
- (void **)&SDL_NAME(pa_mainloop_iterate) },
- { "pa_mainloop_free",
- (void **)&SDL_NAME(pa_mainloop_free) },
- { "pa_operation_get_state",
- (void **)&SDL_NAME(pa_operation_get_state) },
- { "pa_operation_cancel",
- (void **)&SDL_NAME(pa_operation_cancel) },
- { "pa_operation_unref",
- (void **)&SDL_NAME(pa_operation_unref) },
- { "pa_context_new",
- (void **)&SDL_NAME(pa_context_new) },
- { "pa_context_connect",
- (void **)&SDL_NAME(pa_context_connect) },
- { "pa_context_get_state",
- (void **)&SDL_NAME(pa_context_get_state) },
- { "pa_context_disconnect",
- (void **)&SDL_NAME(pa_context_disconnect) },
- { "pa_context_unref",
- (void **)&SDL_NAME(pa_context_unref) },
- { "pa_stream_new",
- (void **)&SDL_NAME(pa_stream_new) },
- { "pa_stream_connect_playback",
- (void **)&SDL_NAME(pa_stream_connect_playback) },
- { "pa_stream_get_state",
- (void **)&SDL_NAME(pa_stream_get_state) },
- { "pa_stream_writable_size",
- (void **)&SDL_NAME(pa_stream_writable_size) },
- { "pa_stream_write",
- (void **)&SDL_NAME(pa_stream_write) },
- { "pa_stream_drain",
- (void **)&SDL_NAME(pa_stream_drain) },
- { "pa_stream_disconnect",
- (void **)&SDL_NAME(pa_stream_disconnect) },
- { "pa_stream_unref",
- (void **)&SDL_NAME(pa_stream_unref) },
-};
-
-static void UnloadPulseLibrary()
-{
- if ( pulse_loaded ) {
- SDL_UnloadObject(pulse_handle);
- pulse_handle = NULL;
- pulse_loaded = 0;
- }
-}
-
-static int LoadPulseLibrary(void)
-{
- int i, retval = -1;
-
- pulse_handle = SDL_LoadObject(pulse_library);
- if ( pulse_handle ) {
- pulse_loaded = 1;
- retval = 0;
- for ( i=0; ihidden);
- SDL_free(device);
- UnloadPulseLibrary();
-}
-
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
-{
- SDL_AudioDevice *this;
-
- /* Initialize all variables that we clean on shutdown */
- LoadPulseLibrary();
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Set the function pointers */
- this->OpenAudio = PULSE_OpenAudio;
- this->WaitAudio = PULSE_WaitAudio;
- this->PlayAudio = PULSE_PlayAudio;
- this->GetAudioBuf = PULSE_GetAudioBuf;
- this->CloseAudio = PULSE_CloseAudio;
- this->WaitDone = PULSE_WaitDone;
-
- this->free = Audio_DeleteDevice;
-
- return this;
-}
-
-AudioBootStrap PULSE_bootstrap = {
- PULSE_DRIVER_NAME, "PulseAudio",
- Audio_Available, Audio_CreateDevice
-};
-
-/* This function waits until it is possible to write a full sound buffer */
-static void PULSE_WaitAudio(_THIS)
-{
- int size;
- while(1) {
- if (SDL_NAME(pa_context_get_state)(context) != PA_CONTEXT_READY ||
- SDL_NAME(pa_stream_get_state)(stream) != PA_STREAM_READY ||
- SDL_NAME(pa_mainloop_iterate)(mainloop, 1, NULL) < 0) {
- this->enabled = 0;
- return;
- }
- size = SDL_NAME(pa_stream_writable_size)(stream);
- if (size >= mixlen)
- return;
- }
-}
-
-static void PULSE_PlayAudio(_THIS)
-{
- /* Write the audio data */
- if (SDL_NAME(pa_stream_write)(stream, mixbuf, mixlen, NULL, 0LL, PA_SEEK_RELATIVE) < 0)
- this->enabled = 0;
-}
-
-static Uint8 *PULSE_GetAudioBuf(_THIS)
-{
- return(mixbuf);
-}
-
-static void PULSE_CloseAudio(_THIS)
-{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( stream != NULL ) {
- SDL_NAME(pa_stream_disconnect)(stream);
- SDL_NAME(pa_stream_unref)(stream);
- stream = NULL;
- }
- if (context != NULL) {
- SDL_NAME(pa_context_disconnect)(context);
- SDL_NAME(pa_context_unref)(context);
- context = NULL;
- }
- if (mainloop != NULL) {
- SDL_NAME(pa_mainloop_free)(mainloop);
- mainloop = NULL;
- }
-}
-
-/* Try to get the name of the program */
-static char *get_progname(void)
-{
-#ifdef __LINUX__
- char *progname = NULL;
- FILE *fp;
- static char temp[BUFSIZ];
-
- SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid());
- fp = fopen(temp, "r");
- if ( fp != NULL ) {
- if ( fgets(temp, sizeof(temp)-1, fp) ) {
- progname = SDL_strrchr(temp, '/');
- if ( progname == NULL ) {
- progname = temp;
- } else {
- progname = progname+1;
- }
- }
- fclose(fp);
- }
- return(progname);
-#elif defined(__NetBSD__)
- return getprogname();
-#else
- return("unknown");
-#endif
-}
-
-static void stream_drain_complete(pa_stream *s, int success, void *userdata) {
-}
-
-static void PULSE_WaitDone(_THIS)
-{
- pa_operation *o;
-
- o = SDL_NAME(pa_stream_drain)(stream, stream_drain_complete, NULL);
- if (!o)
- return;
-
- while (SDL_NAME(pa_operation_get_state)(o) != PA_OPERATION_DONE) {
- if (SDL_NAME(pa_context_get_state)(context) != PA_CONTEXT_READY ||
- SDL_NAME(pa_stream_get_state)(stream) != PA_STREAM_READY ||
- SDL_NAME(pa_mainloop_iterate)(mainloop, 1, NULL) < 0) {
- SDL_NAME(pa_operation_cancel)(o);
- break;
- }
- }
- SDL_NAME(pa_operation_unref)(o);
-}
-
-static int PULSE_OpenAudio(_THIS, SDL_AudioSpec *spec)
-{
- int state;
- Uint16 test_format;
- pa_sample_spec paspec;
- pa_buffer_attr paattr;
- pa_channel_map pacmap;
- pa_stream_flags_t flags = 0;
-
- paspec.format = PA_SAMPLE_INVALID;
- for ( test_format = SDL_FirstAudioFormat(spec->format); test_format; ) {
- switch ( test_format ) {
- case AUDIO_U8:
- paspec.format = PA_SAMPLE_U8;
- break;
- case AUDIO_S16LSB:
- paspec.format = PA_SAMPLE_S16LE;
- break;
- case AUDIO_S16MSB:
- paspec.format = PA_SAMPLE_S16BE;
- break;
- }
- if ( paspec.format != PA_SAMPLE_INVALID )
- break;
- }
- if (paspec.format == PA_SAMPLE_INVALID ) {
- SDL_SetError("Couldn't find any suitable audio formats");
- return(-1);
- }
- spec->format = test_format;
-
- paspec.channels = spec->channels;
- paspec.rate = spec->freq;
-
- /* Calculate the final parameters for this audio specification */
-#ifdef PA_STREAM_ADJUST_LATENCY
- spec->samples /= 2; /* Mix in smaller chunck to avoid underruns */
-#endif
- SDL_CalculateAudioSpec(spec);
-
- /* Allocate mixing buffer */
- mixlen = spec->size;
- mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
- if ( mixbuf == NULL ) {
- return(-1);
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
-
- /* Reduced prebuffering compared to the defaults. */
-#ifdef PA_STREAM_ADJUST_LATENCY
- paattr.tlength = mixlen * 4; /* 2x original requested bufsize */
- paattr.prebuf = -1;
- paattr.maxlength = -1;
- paattr.minreq = mixlen; /* -1 can lead to pa_stream_writable_size()
- >= mixlen never becoming true */
- flags = PA_STREAM_ADJUST_LATENCY;
-#else
- paattr.tlength = mixlen*2;
- paattr.prebuf = mixlen*2;
- paattr.maxlength = mixlen*2;
- paattr.minreq = mixlen;
-#endif
-
- /* The SDL ALSA output hints us that we use Windows' channel mapping */
- /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
- SDL_NAME(pa_channel_map_init_auto)(
- &pacmap, spec->channels, PA_CHANNEL_MAP_WAVEEX);
-
- /* Set up a new main loop */
- if (!(mainloop = SDL_NAME(pa_mainloop_new)())) {
- PULSE_CloseAudio(this);
- SDL_SetError("pa_mainloop_new() failed");
- return(-1);
- }
-
- mainloop_api = SDL_NAME(pa_mainloop_get_api)(mainloop);
- if (!(context = SDL_NAME(pa_context_new)(mainloop_api, get_progname()))) {
- PULSE_CloseAudio(this);
- SDL_SetError("pa_context_new() failed");
- return(-1);
- }
-
- /* Connect to the PulseAudio server */
- if (SDL_NAME(pa_context_connect)(context, NULL, 0, NULL) < 0) {
- PULSE_CloseAudio(this);
- SDL_SetError("Could not setup connection to PulseAudio");
- return(-1);
- }
-
- do {
- if (SDL_NAME(pa_mainloop_iterate)(mainloop, 1, NULL) < 0) {
- PULSE_CloseAudio(this);
- SDL_SetError("pa_mainloop_iterate() failed");
- return(-1);
- }
- state = SDL_NAME(pa_context_get_state)(context);
- if (!PA_CONTEXT_IS_GOOD(state)) {
- PULSE_CloseAudio(this);
- SDL_SetError("Could not connect to PulseAudio");
- return(-1);
- }
- } while (state != PA_CONTEXT_READY);
-
- stream = SDL_NAME(pa_stream_new)(
- context,
- "Simple DirectMedia Layer", /* stream description */
- &paspec, /* sample format spec */
- &pacmap /* channel map */
- );
- if ( stream == NULL ) {
- PULSE_CloseAudio(this);
- SDL_SetError("Could not setup PulseAudio stream");
- return(-1);
- }
-
- if (SDL_NAME(pa_stream_connect_playback)(stream, NULL, &paattr, flags,
- NULL, NULL) < 0) {
- PULSE_CloseAudio(this);
- SDL_SetError("Could not connect PulseAudio stream");
- return(-1);
- }
-
- do {
- if (SDL_NAME(pa_mainloop_iterate)(mainloop, 1, NULL) < 0) {
- PULSE_CloseAudio(this);
- SDL_SetError("pa_mainloop_iterate() failed");
- return(-1);
- }
- state = SDL_NAME(pa_stream_get_state)(stream);
- if (!PA_STREAM_IS_GOOD(state)) {
- PULSE_CloseAudio(this);
- SDL_SetError("Could not create to PulseAudio stream");
- return(-1);
- }
- } while (state != PA_STREAM_READY);
-
- return(0);
-}
diff --git a/alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.h b/alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.h
deleted file mode 100644
index 27d27c6bf..000000000
--- a/alienblaster/project/jni/sdl/src/audio/pulse/SDL_pulseaudio.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Stéphan Kochen
- stephan@kochen.nl
-
- Based on parts of the ALSA and ESounD output drivers.
-*/
-#include "SDL_config.h"
-
-#ifndef _SDL_pulseaudio_h
-#define _SDL_pulseaudio_h
-
-#include "../SDL_sysaudio.h"
-
-/* Hidden "this" pointer for the video functions */
-#define _THIS SDL_AudioDevice *this
-
-struct SDL_PrivateAudioData {
- pa_mainloop *mainloop;
- pa_mainloop_api *mainloop_api;
- pa_context *context;
- pa_stream *stream;
-
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
-};
-
-#if (PA_API_VERSION < 12)
-/** Return non-zero if the passed state is one of the connected states */
-static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
- return
- x == PA_CONTEXT_CONNECTING ||
- x == PA_CONTEXT_AUTHORIZING ||
- x == PA_CONTEXT_SETTING_NAME ||
- x == PA_CONTEXT_READY;
-}
-/** Return non-zero if the passed state is one of the connected states */
-static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
- return
- x == PA_STREAM_CREATING ||
- x == PA_STREAM_READY;
-}
-#endif /* pulseaudio <= 0.9.10 */
-
-/* Old variable names */
-#define mainloop (this->hidden->mainloop)
-#define mainloop_api (this->hidden->mainloop_api)
-#define context (this->hidden->context)
-#define stream (this->hidden->stream)
-#define mixbuf (this->hidden->mixbuf)
-#define mixlen (this->hidden->mixlen)
-
-#endif /* _SDL_pulseaudio_h */
-
diff --git a/alienblaster/project/jni/sdl/src/audio/pulseaudio/SDL_pulseaudio.c b/alienblaster/project/jni/sdl/src/audio/pulseaudio/SDL_pulseaudio.c
new file mode 100644
index 000000000..63bd030d7
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -0,0 +1,540 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/*
+ The PulseAudio target for SDL 1.3 is based on the 1.3 arts target, with
+ the appropriate parts replaced with the 1.2 PulseAudio target code. This
+ was the cleanest way to move it to 1.3. The 1.2 target was written by
+ Stéphan Kochen: stephan .a.t. kochen.nl
+*/
+
+#include "SDL_config.h"
+
+/* Allow access to a raw mixing buffer */
+
+#ifdef HAVE_SIGNAL_H
+#include
+#endif
+#include
+#include
+#include
+#include
+#include
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "SDL_pulseaudio.h"
+#include "SDL_loadso.h"
+
+/* The tag name used by pulse audio */
+#define PULSEAUDIO_DRIVER_NAME "pulseaudio"
+
+#if (PA_API_VERSION < 12)
+/** Return non-zero if the passed state is one of the connected states */
+static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
+ return
+ x == PA_CONTEXT_CONNECTING ||
+ x == PA_CONTEXT_AUTHORIZING ||
+ x == PA_CONTEXT_SETTING_NAME ||
+ x == PA_CONTEXT_READY;
+}
+/** Return non-zero if the passed state is one of the connected states */
+static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
+ return
+ x == PA_STREAM_CREATING ||
+ x == PA_STREAM_READY;
+}
+#endif /* pulseaudio <= 0.9.10 */
+
+
+static pa_simple *(*PULSEAUDIO_pa_simple_new) (const char *, const char *,
+ pa_stream_direction_t, const char *, const char *, const pa_sample_spec *,
+ const pa_channel_map *, const pa_buffer_attr *, int *);
+static void (*PULSEAUDIO_pa_simple_free) (pa_simple *);
+static pa_channel_map *(*PULSEAUDIO_pa_channel_map_init_auto) (
+ pa_channel_map *, unsigned, pa_channel_map_def_t);
+static const char * (*PULSEAUDIO_pa_strerror) (int);
+static pa_mainloop * (*PULSEAUDIO_pa_mainloop_new) (void);
+static pa_mainloop_api * (*PULSEAUDIO_pa_mainloop_get_api) (pa_mainloop *);
+static int (*PULSEAUDIO_pa_mainloop_iterate) (pa_mainloop *, int, int *);
+static void (*PULSEAUDIO_pa_mainloop_free) (pa_mainloop *);
+
+static pa_operation_state_t (*PULSEAUDIO_pa_operation_get_state) (
+ pa_operation *);
+static void (*PULSEAUDIO_pa_operation_cancel) (pa_operation *);
+static void (*PULSEAUDIO_pa_operation_unref) (pa_operation *);
+
+static pa_context * (*PULSEAUDIO_pa_context_new) (pa_mainloop_api *,
+ const char *);
+static int (*PULSEAUDIO_pa_context_connect) (pa_context *, const char *,
+ pa_context_flags_t, const pa_spawn_api *);
+static pa_context_state_t (*PULSEAUDIO_pa_context_get_state) (pa_context *);
+static void (*PULSEAUDIO_pa_context_disconnect) (pa_context *);
+static void (*PULSEAUDIO_pa_context_unref) (pa_context *);
+
+static pa_stream * (*PULSEAUDIO_pa_stream_new) (pa_context *, const char *,
+ const pa_sample_spec *, const pa_channel_map *);
+static int (*PULSEAUDIO_pa_stream_connect_playback) (pa_stream *, const char *,
+ const pa_buffer_attr *, pa_stream_flags_t, pa_cvolume *, pa_stream *);
+static pa_stream_state_t (*PULSEAUDIO_pa_stream_get_state) (pa_stream *);
+static size_t (*PULSEAUDIO_pa_stream_writable_size) (pa_stream *);
+static int (*PULSEAUDIO_pa_stream_write) (pa_stream *, const void *, size_t,
+ pa_free_cb_t, int64_t, pa_seek_mode_t);
+static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *,
+ pa_stream_success_cb_t, void *);
+static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *);
+static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *);
+
+static int load_pulseaudio_syms(void);
+
+
+#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
+
+static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC;
+static void *pulseaudio_handle = NULL;
+
+static int
+load_pulseaudio_sym(const char *fn, void **addr)
+{
+ *addr = SDL_LoadFunction(pulseaudio_handle, fn);
+ if (*addr == NULL) {
+ /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
+ return 0;
+ }
+
+ return 1;
+}
+
+/* cast funcs to char* first, to please GCC's strict aliasing rules. */
+#define SDL_PULSEAUDIO_SYM(x) \
+ if (!load_pulseaudio_sym(#x, (void **) (char *) &PULSEAUDIO_##x)) return -1
+
+static void
+UnloadPulseAudioLibrary(void)
+{
+ if (pulseaudio_handle != NULL) {
+ SDL_UnloadObject(pulseaudio_handle);
+ pulseaudio_handle = NULL;
+ }
+}
+
+static int
+LoadPulseAudioLibrary(void)
+{
+ int retval = 0;
+ if (pulseaudio_handle == NULL) {
+ pulseaudio_handle = SDL_LoadObject(pulseaudio_library);
+ if (pulseaudio_handle == NULL) {
+ retval = -1;
+ /* Don't call SDL_SetError(): SDL_LoadObject already did. */
+ } else {
+ retval = load_pulseaudio_syms();
+ if (retval < 0) {
+ UnloadPulseAudioLibrary();
+ }
+ }
+ }
+ return retval;
+}
+
+#else
+
+#define SDL_PULSEAUDIO_SYM(x) PULSEAUDIO_##x = x
+
+static void
+UnloadPulseAudioLibrary(void)
+{
+}
+
+static int
+LoadPulseAudioLibrary(void)
+{
+ load_pulseaudio_syms();
+ return 0;
+}
+
+#endif /* SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */
+
+
+static int
+load_pulseaudio_syms(void)
+{
+ SDL_PULSEAUDIO_SYM(pa_simple_new);
+ SDL_PULSEAUDIO_SYM(pa_simple_free);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_new);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_get_api);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_iterate);
+ SDL_PULSEAUDIO_SYM(pa_mainloop_free);
+ SDL_PULSEAUDIO_SYM(pa_operation_get_state);
+ SDL_PULSEAUDIO_SYM(pa_operation_cancel);
+ SDL_PULSEAUDIO_SYM(pa_operation_unref);
+ SDL_PULSEAUDIO_SYM(pa_context_new);
+ SDL_PULSEAUDIO_SYM(pa_context_connect);
+ SDL_PULSEAUDIO_SYM(pa_context_get_state);
+ SDL_PULSEAUDIO_SYM(pa_context_disconnect);
+ SDL_PULSEAUDIO_SYM(pa_context_unref);
+ SDL_PULSEAUDIO_SYM(pa_stream_new);
+ SDL_PULSEAUDIO_SYM(pa_stream_connect_playback);
+ SDL_PULSEAUDIO_SYM(pa_stream_get_state);
+ SDL_PULSEAUDIO_SYM(pa_stream_writable_size);
+ SDL_PULSEAUDIO_SYM(pa_stream_write);
+ SDL_PULSEAUDIO_SYM(pa_stream_drain);
+ SDL_PULSEAUDIO_SYM(pa_stream_disconnect);
+ SDL_PULSEAUDIO_SYM(pa_stream_unref);
+ SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto);
+ SDL_PULSEAUDIO_SYM(pa_strerror);
+ return 0;
+}
+
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+PULSEAUDIO_WaitDevice(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+
+ while(1) {
+ if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY ||
+ PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY ||
+ PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ this->enabled = 0;
+ return;
+ }
+ if (PULSEAUDIO_pa_stream_writable_size(h->stream) >= h->mixlen) {
+ return;
+ }
+ }
+}
+
+static void
+PULSEAUDIO_PlayDevice(_THIS)
+{
+ /* Write the audio data */
+ struct SDL_PrivateAudioData *h = this->hidden;
+ if (PULSEAUDIO_pa_stream_write(h->stream, h->mixbuf, h->mixlen, NULL, 0LL,
+ PA_SEEK_RELATIVE) < 0) {
+ this->enabled = 0;
+ }
+}
+
+static void
+stream_drain_complete(pa_stream *s, int success, void *userdata)
+{
+ /* no-op for pa_stream_drain() to use for callback. */
+}
+
+static void
+PULSEAUDIO_WaitDone(_THIS)
+{
+ struct SDL_PrivateAudioData *h = this->hidden;
+ pa_operation *o;
+
+ o = PULSEAUDIO_pa_stream_drain(h->stream, stream_drain_complete, NULL);
+ if (!o) {
+ return;
+ }
+
+ while (PULSEAUDIO_pa_operation_get_state(o) != PA_OPERATION_DONE) {
+ if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY ||
+ PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY ||
+ PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ PULSEAUDIO_pa_operation_cancel(o);
+ break;
+ }
+ }
+
+ PULSEAUDIO_pa_operation_unref(o);
+}
+
+
+
+static Uint8 *
+PULSEAUDIO_GetDeviceBuf(_THIS)
+{
+ return (this->hidden->mixbuf);
+}
+
+
+static void
+PULSEAUDIO_CloseDevice(_THIS)
+{
+ if (this->hidden != NULL) {
+ if (this->hidden->mixbuf != NULL) {
+ SDL_FreeAudioMem(this->hidden->mixbuf);
+ this->hidden->mixbuf = NULL;
+ }
+ if (this->hidden->stream) {
+ PULSEAUDIO_pa_stream_disconnect(this->hidden->stream);
+ PULSEAUDIO_pa_stream_unref(this->hidden->stream);
+ this->hidden->stream = NULL;
+ }
+ if (this->hidden->context != NULL) {
+ PULSEAUDIO_pa_context_disconnect(this->hidden->context);
+ PULSEAUDIO_pa_context_unref(this->hidden->context);
+ this->hidden->context = NULL;
+ }
+ if (this->hidden->mainloop != NULL) {
+ PULSEAUDIO_pa_mainloop_free(this->hidden->mainloop);
+ this->hidden->mainloop = NULL;
+ }
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
+
+
+/* !!! FIXME: this could probably be expanded. */
+/* Try to get the name of the program */
+static char *
+get_progname(void)
+{
+#ifdef __LINUX__
+ char *progname = NULL;
+ FILE *fp;
+ static char temp[BUFSIZ];
+
+ SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid());
+ fp = fopen(temp, "r");
+ if (fp != NULL) {
+ if (fgets(temp, sizeof(temp) - 1, fp)) {
+ progname = SDL_strrchr(temp, '/');
+ if (progname == NULL) {
+ progname = temp;
+ } else {
+ progname = progname + 1;
+ }
+ }
+ fclose(fp);
+ }
+ return(progname);
+#elif defined(__NetBSD__)
+ return getprogname();
+#else
+ return("unknown");
+#endif
+}
+
+
+static int
+PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ struct SDL_PrivateAudioData *h = NULL;
+ Uint16 test_format = 0;
+ pa_sample_spec paspec;
+ pa_buffer_attr paattr;
+ pa_channel_map pacmap;
+ pa_stream_flags_t flags = 0;
+ int state = 0;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+ h = this->hidden;
+
+ paspec.format = PA_SAMPLE_INVALID;
+
+ /* Try for a closest match on audio format */
+ for (test_format = SDL_FirstAudioFormat(this->spec.format);
+ (paspec.format == PA_SAMPLE_INVALID) && test_format;) {
+#ifdef DEBUG_AUDIO
+ fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
+#endif
+ switch (test_format) {
+ case AUDIO_U8:
+ paspec.format = PA_SAMPLE_U8;
+ break;
+ case AUDIO_S16LSB:
+ paspec.format = PA_SAMPLE_S16LE;
+ break;
+ case AUDIO_S16MSB:
+ paspec.format = PA_SAMPLE_S16BE;
+ break;
+ default:
+ paspec.format = PA_SAMPLE_INVALID;
+ break;
+ }
+ if (paspec.format == PA_SAMPLE_INVALID) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+ if (paspec.format == PA_SAMPLE_INVALID) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("Couldn't find any hardware audio formats");
+ return 0;
+ }
+ this->spec.format = test_format;
+
+ /* Calculate the final parameters for this audio specification */
+#ifdef PA_STREAM_ADJUST_LATENCY
+ this->spec.samples /= 2; /* Mix in smaller chunck to avoid underruns */
+#endif
+ SDL_CalculateAudioSpec(&this->spec);
+
+ /* Allocate mixing buffer */
+ h->mixlen = this->spec.size;
+ h->mixbuf = (Uint8 *) SDL_AllocAudioMem(h->mixlen);
+ if (h->mixbuf == NULL) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(h->mixbuf, this->spec.silence, this->spec.size);
+
+ paspec.channels = this->spec.channels;
+ paspec.rate = this->spec.freq;
+
+ /* Reduced prebuffering compared to the defaults. */
+#ifdef PA_STREAM_ADJUST_LATENCY
+ /* 2x original requested bufsize */
+ paattr.tlength = h->mixlen * 4;
+ paattr.prebuf = -1;
+ paattr.maxlength = -1;
+ /* -1 can lead to pa_stream_writable_size() >= mixlen never being true */
+ paattr.minreq = h->mixlen;
+ flags = PA_STREAM_ADJUST_LATENCY;
+#else
+ paattr.tlength = h->mixlen*2;
+ paattr.prebuf = h->mixlen*2;
+ paattr.maxlength = h->mixlen*2;
+ paattr.minreq = h->mixlen;
+#endif
+
+ /* The SDL ALSA output hints us that we use Windows' channel mapping */
+ /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
+ PULSEAUDIO_pa_channel_map_init_auto(&pacmap, this->spec.channels,
+ PA_CHANNEL_MAP_WAVEEX);
+
+ /* Set up a new main loop */
+ if (!(h->mainloop = PULSEAUDIO_pa_mainloop_new())) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("pa_mainloop_new() failed");
+ return 0;
+ }
+
+ h->mainloop_api = PULSEAUDIO_pa_mainloop_get_api(h->mainloop);
+ h->context = PULSEAUDIO_pa_context_new(h->mainloop_api, get_progname());
+ if (!h->context) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("pa_context_new() failed");
+ return 0;
+ }
+
+ /* Connect to the PulseAudio server */
+ if (PULSEAUDIO_pa_context_connect(h->context, NULL, 0, NULL) < 0) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("Could not setup connection to PulseAudio");
+ return 0;
+ }
+
+ do {
+ if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("pa_mainloop_iterate() failed");
+ return 0;
+ }
+ state = PULSEAUDIO_pa_context_get_state(h->context);
+ if (!PA_CONTEXT_IS_GOOD(state)) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("Could not connect to PulseAudio");
+ return 0;
+ }
+ } while (state != PA_CONTEXT_READY);
+
+ h->stream = PULSEAUDIO_pa_stream_new(
+ h->context,
+ "Simple DirectMedia Layer", /* stream description */
+ &paspec, /* sample format spec */
+ &pacmap /* channel map */
+ );
+
+ if (h->stream == NULL) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("Could not set up PulseAudio stream");
+ return 0;
+ }
+
+ if (PULSEAUDIO_pa_stream_connect_playback(h->stream, NULL, &paattr, flags,
+ NULL, NULL) < 0) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("Could not connect PulseAudio stream");
+ return 0;
+ }
+
+ do {
+ if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("pa_mainloop_iterate() failed");
+ return 0;
+ }
+ state = PULSEAUDIO_pa_stream_get_state(h->stream);
+ if (!PA_STREAM_IS_GOOD(state)) {
+ PULSEAUDIO_CloseDevice(this);
+ SDL_SetError("Could not create to PulseAudio stream");
+ return 0;
+ }
+ } while (state != PA_STREAM_READY);
+
+ /* We're ready to rock and roll. :-) */
+ return 1;
+}
+
+
+static void
+PULSEAUDIO_Deinitialize(void)
+{
+ UnloadPulseAudioLibrary();
+}
+
+
+static int
+PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
+{
+ if (LoadPulseAudioLibrary() < 0) {
+ return 0;
+ }
+
+ /* Set the function pointers */
+ impl->OpenDevice = PULSEAUDIO_OpenDevice;
+ impl->PlayDevice = PULSEAUDIO_PlayDevice;
+ impl->WaitDevice = PULSEAUDIO_WaitDevice;
+ impl->GetDeviceBuf = PULSEAUDIO_GetDeviceBuf;
+ impl->CloseDevice = PULSEAUDIO_CloseDevice;
+ impl->WaitDone = PULSEAUDIO_WaitDone;
+ impl->Deinitialize = PULSEAUDIO_Deinitialize;
+ impl->OnlyHasDefaultOutputDevice = 1;
+
+ return 1; /* this audio target is available. */
+}
+
+
+AudioBootStrap PULSEAUDIO_bootstrap = {
+ PULSEAUDIO_DRIVER_NAME, "PulseAudio", PULSEAUDIO_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarimxalloc.c b/alienblaster/project/jni/sdl/src/audio/pulseaudio/SDL_pulseaudio.h
similarity index 61%
rename from alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarimxalloc.c
rename to alienblaster/project/jni/sdl/src/audio/pulseaudio/SDL_pulseaudio.h
index aca73fa2c..b429b8af0 100644
--- a/alienblaster/project/jni/sdl/src/video/ataricommon/SDL_atarimxalloc.c
+++ b/alienblaster/project/jni/sdl/src/audio/pulseaudio/SDL_pulseaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,32 +21,29 @@
*/
#include "SDL_config.h"
-/*
- * Memory allocation
- *
- * Patrice Mandin
- */
+#ifndef _SDL_pulseaudio_h
+#define _SDL_pulseaudio_h
-#include
+#include
-#include "SDL_stdinc.h"
+#include "../SDL_sysaudio.h"
-/*--- Variables ---*/
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice *this
-static int atari_mxalloc_avail=-1;
-
-/*--- Functions ---*/
-
-void *Atari_SysMalloc(Uint32 size, Uint16 alloc_type)
+struct SDL_PrivateAudioData
{
- /* Test if Mxalloc() available */
- if (atari_mxalloc_avail<0) {
- atari_mxalloc_avail = ((Sversion()&0xFF)>=0x01) | (Sversion()>=0x1900);
- }
+ /* pulseaudio structures */
+ pa_mainloop *mainloop;
+ pa_mainloop_api *mainloop_api;
+ pa_context *context;
+ pa_stream *stream;
- if (atari_mxalloc_avail) {
- return (void *) Mxalloc(size, alloc_type);
- } else { \
- return (void *) Malloc(size);
- }
-}
+ /* Raw mixing buffer */
+ Uint8 *mixbuf;
+ int mixlen;
+};
+
+#endif /* _SDL_pulseaudio_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/qsa/SDL_qsa_audio.c b/alienblaster/project/jni/sdl/src/audio/qsa/SDL_qsa_audio.c
new file mode 100644
index 000000000..6d7362594
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/audio/qsa/SDL_qsa_audio.c
@@ -0,0 +1,893 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2010 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+#include "SDL_config.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "SDL_timer.h"
+#include "SDL_audio.h"
+#include "../SDL_audiomem.h"
+#include "../SDL_audio_c.h"
+#include "SDL_qsa_audio.h"
+
+/* The tag name used by QSA audio framework */
+#define DRIVER_NAME "qsa"
+
+/* default channel communication parameters */
+#define DEFAULT_CPARAMS_RATE 44100
+#define DEFAULT_CPARAMS_VOICES 1
+
+#define DEFAULT_CPARAMS_FRAG_SIZE 4096
+#define DEFAULT_CPARAMS_FRAGS_MIN 1
+#define DEFAULT_CPARAMS_FRAGS_MAX 1
+
+#define QSA_NO_WORKAROUNDS 0x00000000
+#define QSA_MMAP_WORKAROUND 0x00000001
+
+struct BuggyCards
+{
+ char *cardname;
+ unsigned long bugtype;
+};
+
+#define QSA_WA_CARDS 3
+#define QSA_MAX_CARD_NAME_LENGTH 33
+
+struct BuggyCards buggycards[QSA_WA_CARDS] = {
+ {"Sound Blaster Live!", QSA_MMAP_WORKAROUND},
+ {"Vortex 8820", QSA_MMAP_WORKAROUND},
+ {"Vortex 8830", QSA_MMAP_WORKAROUND},
+};
+
+/* List of found devices */
+#define QSA_MAX_DEVICES 32
+#define QSA_MAX_NAME_LENGTH 81+16 /* Hardcoded in QSA, can't be changed */
+
+typedef struct _QSA_Device
+{
+ char name[QSA_MAX_NAME_LENGTH]; /* Long audio device name for SDL */
+ int cardno;
+ int deviceno;
+} QSA_Device;
+
+QSA_Device qsa_playback_device[QSA_MAX_DEVICES];
+uint32_t qsa_playback_devices;
+
+QSA_Device qsa_capture_device[QSA_MAX_DEVICES];
+uint32_t qsa_capture_devices;
+
+static inline void
+QSA_SetError(const char *fn, int status)
+{
+ SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
+}
+
+/* card names check to apply the workarounds */
+static int
+QSA_CheckBuggyCards(_THIS, unsigned long checkfor)
+{
+ char scardname[QSA_MAX_CARD_NAME_LENGTH];
+ int it;
+
+ if (snd_card_get_name
+ (this->hidden->cardno, scardname, QSA_MAX_CARD_NAME_LENGTH - 1) < 0) {
+ return 0;
+ }
+
+ for (it = 0; it < QSA_WA_CARDS; it++) {
+ if (SDL_strcmp(buggycards[it].cardname, scardname) == 0) {
+ if (buggycards[it].bugtype == checkfor) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static void
+QSA_ThreadInit(_THIS)
+{
+ struct sched_param param;
+ int status;
+
+ /* Increase default 10 priority to 25 to avoid jerky sound */
+ status = SchedGet(0, 0, ¶m);
+ param.sched_priority = param.sched_curpriority + 15;
+ status = SchedSet(0, 0, SCHED_NOCHANGE, ¶m);
+}
+
+/* PCM channel parameters initialize function */
+static void
+QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
+{
+ SDL_memset(cpars, 0, sizeof(snd_pcm_channel_params_t));
+
+ cpars->channel = SND_PCM_CHANNEL_PLAYBACK;
+ cpars->mode = SND_PCM_MODE_BLOCK;
+ cpars->start_mode = SND_PCM_START_DATA;
+ cpars->stop_mode = SND_PCM_STOP_STOP;
+ cpars->format.format = SND_PCM_SFMT_S16_LE;
+ cpars->format.interleave = 1;
+ cpars->format.rate = DEFAULT_CPARAMS_RATE;
+ cpars->format.voices = DEFAULT_CPARAMS_VOICES;
+ cpars->buf.block.frag_size = DEFAULT_CPARAMS_FRAG_SIZE;
+ cpars->buf.block.frags_min = DEFAULT_CPARAMS_FRAGS_MIN;
+ cpars->buf.block.frags_max = DEFAULT_CPARAMS_FRAGS_MAX;
+}
+
+/* This function waits until it is possible to write a full sound buffer */
+static void
+QSA_WaitDevice(_THIS)
+{
+ fd_set wfds;
+ fd_set rfds;
+ int selectret;
+ struct timeval timeout;
+
+ if (!this->hidden->iscapture) {
+ FD_ZERO(&wfds);
+ FD_SET(this->hidden->audio_fd, &wfds);
+ } else {
+ FD_ZERO(&rfds);
+ FD_SET(this->hidden->audio_fd, &rfds);
+ }
+
+ do {
+ /* Setup timeout for playing one fragment equal to 2 seconds */
+ /* If timeout occured than something wrong with hardware or driver */
+ /* For example, Vortex 8820 audio driver stucks on second DAC because */
+ /* it doesn't exist ! */
+ timeout.tv_sec = 2;
+ timeout.tv_usec = 0;
+ this->hidden->timeout_on_wait = 0;
+
+ if (!this->hidden->iscapture) {
+ selectret =
+ select(this->hidden->audio_fd + 1, NULL, &wfds, NULL,
+ &timeout);
+ } else {
+ selectret =
+ select(this->hidden->audio_fd + 1, &rfds, NULL, NULL,
+ &timeout);
+ }
+
+ switch (selectret) {
+ case -1:
+ {
+ SDL_SetError("QSA: select() failed: %s\n", strerror(errno));
+ return;
+ }
+ break;
+ case 0:
+ {
+ SDL_SetError("QSA: timeout on buffer waiting occured\n");
+ this->hidden->timeout_on_wait = 1;
+ return;
+ }
+ break;
+ default:
+ {
+ if (!this->hidden->iscapture) {
+ if (FD_ISSET(this->hidden->audio_fd, &wfds)) {
+ return;
+ }
+ } else {
+ if (FD_ISSET(this->hidden->audio_fd, &rfds)) {
+ return;
+ }
+ }
+ }
+ break;
+ }
+ } while (1);
+}
+
+static void
+QSA_PlayDevice(_THIS)
+{
+ snd_pcm_channel_status_t cstatus;
+ int written;
+ int status;
+ int towrite;
+ void *pcmbuffer;
+
+ if ((!this->enabled) || (!this->hidden)) {
+ return;
+ }
+
+ towrite = this->spec.size;
+ pcmbuffer = this->hidden->pcm_buf;
+
+ /* Write the audio data, checking for EAGAIN (buffer full) and underrun */
+ do {
+ written =
+ snd_pcm_plugin_write(this->hidden->audio_handle, pcmbuffer,
+ towrite);
+ if (written != towrite) {
+ /* Check if samples playback got stuck somewhere in hardware or in */
+ /* the audio device driver */
+ if ((errno == EAGAIN) && (written == 0)) {
+ if (this->hidden->timeout_on_wait != 0) {
+ SDL_SetError("QSA: buffer playback timeout\n");
+ return;
+ }
+ }
+
+ /* Check for errors or conditions */
+ if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
+ /* Let a little CPU time go by and try to write again */
+ SDL_Delay(1);
+
+ /* if we wrote some data */
+ towrite -= written;
+ pcmbuffer += written * this->spec.channels;
+ continue;
+ } else {
+ if ((errno == EINVAL) || (errno == EIO)) {
+ SDL_memset(&cstatus, 0, sizeof(cstatus));
+ if (!this->hidden->iscapture) {
+ cstatus.channel = SND_PCM_CHANNEL_PLAYBACK;
+ } else {
+ cstatus.channel = SND_PCM_CHANNEL_CAPTURE;
+ }
+
+ status =
+ snd_pcm_plugin_status(this->hidden->audio_handle,
+ &cstatus);
+ if (status < 0) {
+ QSA_SetError("snd_pcm_plugin_status", status);
+ return;
+ }
+
+ if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) ||
+ (cstatus.status == SND_PCM_STATUS_READY)) {
+ if (!this->hidden->iscapture) {
+ status =
+ snd_pcm_plugin_prepare(this->hidden->
+ audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ status =
+ snd_pcm_plugin_prepare(this->hidden->
+ audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+ if (status < 0) {
+ QSA_SetError("snd_pcm_plugin_prepare", status);
+ return;
+ }
+ }
+ continue;
+ } else {
+ return;
+ }
+ }
+ } else {
+ /* we wrote all remaining data */
+ towrite -= written;
+ pcmbuffer += written * this->spec.channels;
+ }
+ } while ((towrite > 0) && (this->enabled));
+
+ /* If we couldn't write, assume fatal error for now */
+ if (towrite != 0) {
+ this->enabled = 0;
+ }
+}
+
+static Uint8 *
+QSA_GetDeviceBuf(_THIS)
+{
+ return this->hidden->pcm_buf;
+}
+
+static void
+QSA_CloseDevice(_THIS)
+{
+ if (this->hidden != NULL) {
+ if (this->hidden->audio_handle != NULL) {
+ if (!this->hidden->iscapture) {
+ /* Finish playing available samples */
+ snd_pcm_plugin_flush(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ /* Cancel unread samples during capture */
+ snd_pcm_plugin_flush(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+ snd_pcm_close(this->hidden->audio_handle);
+ this->hidden->audio_handle = NULL;
+ }
+
+ if (this->hidden->pcm_buf != NULL) {
+ SDL_FreeAudioMem(this->hidden->pcm_buf);
+ this->hidden->pcm_buf = NULL;
+ }
+
+ SDL_free(this->hidden);
+ this->hidden = NULL;
+ }
+}
+
+static int
+QSA_OpenDevice(_THIS, const char *devname, int iscapture)
+{
+ int status = 0;
+ int format = 0;
+ SDL_AudioFormat test_format = 0;
+ int found = 0;
+ snd_pcm_channel_setup_t csetup;
+ snd_pcm_channel_params_t cparams;
+
+ /* Initialize all variables that we clean on shutdown */
+ this->hidden =
+ (struct SDL_PrivateAudioData *) SDL_calloc(1,
+ (sizeof
+ (struct
+ SDL_PrivateAudioData)));
+ if (this->hidden == NULL) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData));
+
+ /* Initialize channel transfer parameters to default */
+ QSA_InitAudioParams(&cparams);
+
+ /* Initialize channel direction: capture or playback */
+ this->hidden->iscapture = iscapture;
+
+ /* Find deviceid and cardid by device name for playback */
+ if ((!this->hidden->iscapture) && (devname != NULL)) {
+ uint32_t device;
+ int32_t status;
+
+ /* Search in the playback devices */
+ device = 0;
+ do {
+ status = SDL_strcmp(qsa_playback_device[device].name, devname);
+ if (status == 0) {
+ /* Found requested device */
+ this->hidden->deviceno = qsa_playback_device[device].deviceno;
+ this->hidden->cardno = qsa_playback_device[device].cardno;
+ break;
+ }
+ device++;
+ if (device >= qsa_playback_devices) {
+ QSA_CloseDevice(this);
+ SDL_SetError("No such playback device");
+ return 0;
+ }
+ } while (1);
+ }
+
+ /* Find deviceid and cardid by device name for capture */
+ if ((this->hidden->iscapture) && (devname != NULL)) {
+ /* Search in the capture devices */
+ uint32_t device;
+ int32_t status;
+
+ /* Searching in the playback devices */
+ device = 0;
+ do {
+ status = SDL_strcmp(qsa_capture_device[device].name, devname);
+ if (status == 0) {
+ /* Found requested device */
+ this->hidden->deviceno = qsa_capture_device[device].deviceno;
+ this->hidden->cardno = qsa_capture_device[device].cardno;
+ break;
+ }
+ device++;
+ if (device >= qsa_capture_devices) {
+ QSA_CloseDevice(this);
+ SDL_SetError("No such capture device");
+ return 0;
+ }
+ } while (1);
+ }
+
+ /* Check if SDL requested default audio device */
+ if (devname == NULL) {
+ /* Open system default audio device */
+ if (!this->hidden->iscapture) {
+ status = snd_pcm_open_preferred(&this->hidden->audio_handle,
+ &this->hidden->cardno,
+ &this->hidden->deviceno,
+ SND_PCM_OPEN_PLAYBACK);
+ } else {
+ status = snd_pcm_open_preferred(&this->hidden->audio_handle,
+ &this->hidden->cardno,
+ &this->hidden->deviceno,
+ SND_PCM_OPEN_CAPTURE);
+ }
+ } else {
+ /* Open requested audio device */
+ if (!this->hidden->iscapture) {
+ status =
+ snd_pcm_open(&this->hidden->audio_handle,
+ this->hidden->cardno, this->hidden->deviceno,
+ SND_PCM_OPEN_PLAYBACK);
+ } else {
+ status =
+ snd_pcm_open(&this->hidden->audio_handle,
+ this->hidden->cardno, this->hidden->deviceno,
+ SND_PCM_OPEN_CAPTURE);
+ }
+ }
+
+ /* Check if requested device is opened */
+ if (status < 0) {
+ this->hidden->audio_handle = NULL;
+ QSA_CloseDevice(this);
+ QSA_SetError("snd_pcm_open", status);
+ return 0;
+ }
+
+ if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) {
+ /* Disable QSA MMAP plugin for buggy audio drivers */
+ status =
+ snd_pcm_plugin_set_disable(this->hidden->audio_handle,
+ PLUGIN_DISABLE_MMAP);
+ if (status < 0) {
+ QSA_CloseDevice(this);
+ QSA_SetError("snd_pcm_plugin_set_disable", status);
+ return 0;
+ }
+ }
+
+ /* Try for a closest match on audio format */
+ format = 0;
+ /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */
+ found = 0;
+
+ for (test_format = SDL_FirstAudioFormat(this->spec.format); !found;) {
+ /* if match found set format to equivalent QSA format */
+ switch (test_format) {
+ case AUDIO_U8:
+ {
+ format = SND_PCM_SFMT_U8;
+ found = 1;
+ }
+ break;
+ case AUDIO_S8:
+ {
+ format = SND_PCM_SFMT_S8;
+ found = 1;
+ }
+ break;
+ case AUDIO_S16LSB:
+ {
+ format = SND_PCM_SFMT_S16_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_S16MSB:
+ {
+ format = SND_PCM_SFMT_S16_BE;
+ found = 1;
+ }
+ break;
+ case AUDIO_U16LSB:
+ {
+ format = SND_PCM_SFMT_U16_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_U16MSB:
+ {
+ format = SND_PCM_SFMT_U16_BE;
+ found = 1;
+ }
+ break;
+ case AUDIO_S32LSB:
+ {
+ format = SND_PCM_SFMT_S32_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_S32MSB:
+ {
+ format = SND_PCM_SFMT_S32_BE;
+ found = 1;
+ }
+ break;
+ case AUDIO_F32LSB:
+ {
+ format = SND_PCM_SFMT_FLOAT_LE;
+ found = 1;
+ }
+ break;
+ case AUDIO_F32MSB:
+ {
+ format = SND_PCM_SFMT_FLOAT_BE;
+ found = 1;
+ }
+ break;
+ default:
+ {
+ break;
+ }
+ }
+
+ if (!found) {
+ test_format = SDL_NextAudioFormat();
+ }
+ }
+
+ /* assumes test_format not 0 on success */
+ if (test_format == 0) {
+ QSA_CloseDevice(this);
+ SDL_SetError("QSA: Couldn't find any hardware audio formats");
+ return 0;
+ }
+
+ this->spec.format = test_format;
+
+ /* Set the audio format */
+ cparams.format.format = format;
+
+ /* Set mono/stereo/4ch/6ch/8ch audio */
+ cparams.format.voices = this->spec.channels;
+
+ /* Set rate */
+ cparams.format.rate = this->spec.freq;
+
+ /* Setup the transfer parameters according to cparams */
+ status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams);
+ if (status < 0) {
+ QSA_CloseDevice(this);
+ QSA_SetError("snd_pcm_channel_params", status);
+ return 0;
+ }
+
+ /* Make sure channel is setup right one last time */
+ SDL_memset(&csetup, '\0', sizeof(csetup));
+ if (!this->hidden->iscapture) {
+ csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
+ } else {
+ csetup.channel = SND_PCM_CHANNEL_CAPTURE;
+ }
+
+ /* Setup an audio channel */
+ if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) {
+ QSA_CloseDevice(this);
+ SDL_SetError("QSA: Unable to setup channel\n");
+ return 0;
+ }
+
+ /* Calculate the final parameters for this audio specification */
+ SDL_CalculateAudioSpec(&this->spec);
+
+ this->hidden->pcm_len = this->spec.size;
+
+ if (this->hidden->pcm_len == 0) {
+ this->hidden->pcm_len =
+ csetup.buf.block.frag_size * this->spec.channels *
+ (snd_pcm_format_width(format) / 8);
+ }
+
+ /*
+ * Allocate memory to the audio buffer and initialize with silence
+ * (Note that buffer size must be a multiple of fragment size, so find
+ * closest multiple)
+ */
+ this->hidden->pcm_buf =
+ (Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len);
+ if (this->hidden->pcm_buf == NULL) {
+ QSA_CloseDevice(this);
+ SDL_OutOfMemory();
+ return 0;
+ }
+ SDL_memset(this->hidden->pcm_buf, this->spec.silence,
+ this->hidden->pcm_len);
+
+ /* get the file descriptor */
+ if (!this->hidden->iscapture) {
+ this->hidden->audio_fd =
+ snd_pcm_file_descriptor(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ this->hidden->audio_fd =
+ snd_pcm_file_descriptor(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+
+ if (this->hidden->audio_fd < 0) {
+ QSA_CloseDevice(this);
+ QSA_SetError("snd_pcm_file_descriptor", status);
+ return 0;
+ }
+
+ /* Prepare an audio channel */
+ if (!this->hidden->iscapture) {
+ /* Prepare audio playback */
+ status =
+ snd_pcm_plugin_prepare(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ } else {
+ /* Prepare audio capture */
+ status =
+ snd_pcm_plugin_prepare(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+
+ if (status < 0) {
+ QSA_CloseDevice(this);
+ QSA_SetError("snd_pcm_plugin_prepare", status);
+ return 0;
+ }
+
+ /* We're really ready to rock and roll. :-) */
+ return 1;
+}
+
+int
+QSA_DetectDevices(int iscapture)
+{
+ uint32_t it;
+ uint32_t cards;
+ uint32_t devices;
+ int32_t status;
+
+ /* Detect amount of available devices */
+ /* this value can be changed in the runtime */
+ cards = snd_cards();
+
+ /* If io-audio manager is not running we will get 0 as number */
+ /* of available audio devices */
+ if (cards == 0) {
+ /* We have no any available audio devices */
+ return 0;
+ }
+
+ /* Find requested devices by type */
+ if (!iscapture) {
+ /* Playback devices enumeration requested */
+ for (it = 0; it < cards; it++) {
+ devices = 0;
+ do {
+ status =
+ snd_card_get_longname(it,
+ qsa_playback_device
+ [qsa_playback_devices].name,
+ QSA_MAX_NAME_LENGTH);
+ if (status == EOK) {
+ snd_pcm_t *handle;
+
+ /* Add device number to device name */
+ sprintf(qsa_playback_device[qsa_playback_devices].name +
+ SDL_strlen(qsa_playback_device
+ [qsa_playback_devices].name), " d%d",
+ devices);
+
+ /* Store associated card number id */
+ qsa_playback_device[qsa_playback_devices].cardno = it;
+
+ /* Check if this device id could play anything */
+ status =
+ snd_pcm_open(&handle, it, devices,
+ SND_PCM_OPEN_PLAYBACK);
+ if (status == EOK) {
+ qsa_playback_device[qsa_playback_devices].deviceno =
+ devices;
+ status = snd_pcm_close(handle);
+ if (status == EOK) {
+ qsa_playback_devices++;
+ }
+ } else {
+ /* Check if we got end of devices list */
+ if (status == -ENOENT) {
+ break;
+ }
+ }
+ } else {
+ break;
+ }
+
+ /* Check if we reached maximum devices count */
+ if (qsa_playback_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ devices++;
+ } while (1);
+
+ /* Check if we reached maximum devices count */
+ if (qsa_playback_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ }
+ } else {
+ /* Capture devices enumeration requested */
+ for (it = 0; it < cards; it++) {
+ devices = 0;
+ do {
+ status =
+ snd_card_get_longname(it,
+ qsa_capture_device
+ [qsa_capture_devices].name,
+ QSA_MAX_NAME_LENGTH);
+ if (status == EOK) {
+ snd_pcm_t *handle;
+
+ /* Add device number to device name */
+ sprintf(qsa_capture_device[qsa_capture_devices].name +
+ SDL_strlen(qsa_capture_device
+ [qsa_capture_devices].name), " d%d",
+ devices);
+
+ /* Store associated card number id */
+ qsa_capture_device[qsa_capture_devices].cardno = it;
+
+ /* Check if this device id could play anything */
+ status =
+ snd_pcm_open(&handle, it, devices,
+ SND_PCM_OPEN_CAPTURE);
+ if (status == EOK) {
+ qsa_capture_device[qsa_capture_devices].deviceno =
+ devices;
+ status = snd_pcm_close(handle);
+ if (status == EOK) {
+ qsa_capture_devices++;
+ }
+ } else {
+ /* Check if we got end of devices list */
+ if (status == -ENOENT) {
+ break;
+ }
+ }
+
+ /* Check if we reached maximum devices count */
+ if (qsa_capture_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ } else {
+ break;
+ }
+ devices++;
+ } while (1);
+
+ /* Check if we reached maximum devices count */
+ if (qsa_capture_devices >= QSA_MAX_DEVICES) {
+ break;
+ }
+ }
+ }
+
+ /* Return amount of available playback or capture devices */
+ if (!iscapture) {
+ return qsa_playback_devices;
+ } else {
+ return qsa_capture_devices;
+ }
+}
+
+const char *
+QSA_GetDeviceName(int index, int iscapture)
+{
+ if (!iscapture) {
+ if (index >= qsa_playback_devices) {
+ return "No such playback device";
+ }
+
+ return qsa_playback_device[index].name;
+ } else {
+ if (index >= qsa_capture_devices) {
+ return "No such capture device";
+ }
+
+ return qsa_capture_device[index].name;
+ }
+}
+
+void
+QSA_WaitDone(_THIS)
+{
+ if (!this->hidden->iscapture) {
+ if (this->hidden->audio_handle != NULL) {
+ /* Wait till last fragment is played and stop channel */
+ snd_pcm_plugin_flush(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_PLAYBACK);
+ }
+ } else {
+ if (this->hidden->audio_handle != NULL) {
+ /* Discard all unread data and stop channel */
+ snd_pcm_plugin_flush(this->hidden->audio_handle,
+ SND_PCM_CHANNEL_CAPTURE);
+ }
+ }
+}
+
+void
+QSA_Deinitialize(void)
+{
+ /* Clear devices array on shutdown */
+ SDL_memset(qsa_playback_device, 0x00,
+ sizeof(QSA_Device) * QSA_MAX_DEVICES);
+ SDL_memset(qsa_capture_device, 0x00,
+ sizeof(QSA_Device) * QSA_MAX_DEVICES);
+ qsa_playback_devices = 0;
+ qsa_capture_devices = 0;
+}
+
+static int
+QSA_Init(SDL_AudioDriverImpl * impl)
+{
+ snd_pcm_t *handle = NULL;
+ int32_t status = 0;
+
+ /* Clear devices array */
+ SDL_memset(qsa_playback_device, 0x00,
+ sizeof(QSA_Device) * QSA_MAX_DEVICES);
+ SDL_memset(qsa_capture_device, 0x00,
+ sizeof(QSA_Device) * QSA_MAX_DEVICES);
+ qsa_playback_devices = 0;
+ qsa_capture_devices = 0;
+
+ /* Set function pointers */
+ /* DeviceLock and DeviceUnlock functions are used default, */
+ /* provided by SDL, which uses pthread_mutex for lock/unlock */
+ impl->DetectDevices = QSA_DetectDevices;
+ impl->GetDeviceName = QSA_GetDeviceName;
+ impl->OpenDevice = QSA_OpenDevice;
+ impl->ThreadInit = QSA_ThreadInit;
+ impl->WaitDevice = QSA_WaitDevice;
+ impl->PlayDevice = QSA_PlayDevice;
+ impl->GetDeviceBuf = QSA_GetDeviceBuf;
+ impl->CloseDevice = QSA_CloseDevice;
+ impl->WaitDone = QSA_WaitDone;
+ impl->Deinitialize = QSA_Deinitialize;
+ impl->LockDevice = NULL;
+ impl->UnlockDevice = NULL;
+
+ impl->OnlyHasDefaultOutputDevice = 0;
+ impl->ProvidesOwnCallbackThread = 0;
+ impl->SkipMixerLock = 0;
+ impl->HasCaptureSupport = 1;
+ impl->OnlyHasDefaultOutputDevice = 0;
+ impl->OnlyHasDefaultInputDevice = 0;
+
+ /* Check if io-audio manager is running or not */
+ status = snd_cards();
+ if (status == 0) {
+ /* if no, return immediately */
+ return 1;
+ }
+
+ return 1; /* this audio target is available. */
+}
+
+AudioBootStrap QSAAUDIO_bootstrap = {
+ DRIVER_NAME, "QNX QSA Audio", QSA_Init, 0
+};
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsmouse_c.h b/alienblaster/project/jni/sdl/src/audio/qsa/SDL_qsa_audio.h
similarity index 56%
rename from alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsmouse_c.h
rename to alienblaster/project/jni/sdl/src/audio/qsa/SDL_qsa_audio.h
index 1608bd970..228565f29 100644
--- a/alienblaster/project/jni/sdl/src/video/ps2gs/SDL_gsmouse_c.h
+++ b/alienblaster/project/jni/sdl/src/audio/qsa/SDL_qsa_audio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,19 +19,40 @@
Sam Lantinga
slouken@libsdl.org
*/
+
#include "SDL_config.h"
-#include "SDL_gsvideo.h"
+#ifndef __SDL_QSA_AUDIO_H__
+#define __SDL_QSA_AUDIO_H__
-/* This is the maximum size of the cursor sprite */
-#define CURSOR_W 32
-#define CURSOR_H 32
-#define CURSOR_W_POW 5 /* 32 = 2^5 */
-#define CURSOR_H_POW 5 /* 32 = 2^5 */
+#include
-/* Functions to be exported */
-extern void GS_FreeWMCursor(_THIS, WMcursor *cursor);
-extern WMcursor *GS_CreateWMCursor(_THIS,
- Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
-extern void GS_MoveWMCursor(_THIS, int x, int y);
-extern int GS_ShowWMCursor(_THIS, WMcursor *cursor);
+#include "../SDL_sysaudio.h"
+
+/* Hidden "this" pointer for the audio functions */
+#define _THIS SDL_AudioDevice* this
+
+struct SDL_PrivateAudioData
+{
+ /* SDL capture state */
+ int iscapture;
+
+ /* The audio device handle */
+ int cardno;
+ int deviceno;
+ snd_pcm_t *audio_handle;
+
+ /* The audio file descriptor */
+ int audio_fd;
+
+ /* Select timeout status */
+ uint32_t timeout_on_wait;
+
+ /* Raw mixing buffer */
+ Uint8 *pcm_buf;
+ Uint32 pcm_len;
+};
+
+#endif /* __SDL_QSA_AUDIO_H__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/sdlgenaudiocvt.pl b/alienblaster/project/jni/sdl/src/audio/sdlgenaudiocvt.pl
new file mode 100755
index 000000000..98f9f0d8d
--- /dev/null
+++ b/alienblaster/project/jni/sdl/src/audio/sdlgenaudiocvt.pl
@@ -0,0 +1,758 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+
+my @audiotypes = qw(
+ U8
+ S8
+ U16LSB
+ S16LSB
+ U16MSB
+ S16MSB
+ S32LSB
+ S32MSB
+ F32LSB
+ F32MSB
+);
+
+my @channels = ( 1, 2, 4, 6, 8 );
+my %funcs;
+my $custom_converters = 0;
+
+
+sub getTypeConvertHashId {
+ my ($from, $to) = @_;
+ return "TYPECONVERTER $from/$to";
+}
+
+
+sub getResamplerHashId {
+ my ($from, $channels, $upsample, $multiple) = @_;
+ return "RESAMPLER $from/$channels/$upsample/$multiple";
+}
+
+
+sub outputHeader {
+ print < 8) {
+ $code = "SDL_Swap${BEorLE}${size}($val)";
+ } else {
+ $code = $val;
+ }
+
+ if (($signed) and (!$float)) {
+ $code = "((Sint${size}) $code)";
+ }
+ }
+
+ return "${code}";
+}
+
+
+sub maxIntVal {
+ my $size = shift;
+ if ($size == 8) {
+ return 0x7F;
+ } elsif ($size == 16) {
+ return 0x7FFF;
+ } elsif ($size == 32) {
+ return 0x7FFFFFFF;
+ }
+
+ die("bug in script.\n");
+}
+
+sub getFloatToIntMult {
+ my $size = shift;
+ my $val = maxIntVal($size) . '.0';
+ $val .= 'f' if ($size < 32);
+ return $val;
+}
+
+sub getIntToFloatDivBy {
+ my $size = shift;
+ return 'DIVBY' . maxIntVal($size);
+}
+
+sub getSignFlipVal {
+ my $size = shift;
+ if ($size == 8) {
+ return '0x80';
+ } elsif ($size == 16) {
+ return '0x8000';
+ } elsif ($size == 32) {
+ return '0x80000000';
+ }
+
+ die("bug in script.\n");
+}
+
+sub buildCvtFunc {
+ my ($from, $to) = @_;
+ my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from);
+ my ($tsigned, $tfloat, $tsize, $tendian, $tctype) = splittype($to);
+ my $diffs = 0;
+ $diffs++ if ($fsize != $tsize);
+ $diffs++ if ($fsigned != $tsigned);
+ $diffs++ if ($ffloat != $tfloat);
+ $diffs++ if ($fendian ne $tendian);
+
+ return if ($diffs == 0);
+
+ my $hashid = getTypeConvertHashId($from, $to);
+ if (1) { # !!! FIXME: if ($diffs > 1) {
+ my $sym = "SDL_Convert_${from}_to_${to}";
+ $funcs{$hashid} = $sym;
+ $custom_converters++;
+
+ # Always unsigned for ints, for possible byteswaps.
+ my $srctype = (($ffloat) ? 'float' : "Uint${fsize}");
+
+ print <buf + cvt->len_cvt)) - 1;
+ dst = (($tctype *) (cvt->buf + cvt->len_cvt * $mult)) - 1;
+ for (i = cvt->len_cvt / sizeof ($srctype); i; --i, --src, --dst) {
+EOF
+ } else {
+ print <buf;
+ dst = ($tctype *) cvt->buf;
+ for (i = cvt->len_cvt / sizeof ($srctype); i; --i, ++src, ++dst) {
+EOF
+ }
+
+ # Have to convert to/from float/int.
+ # !!! FIXME: cast through double for int32<->float?
+ my $code = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, '*src');
+ if ($ffloat != $tfloat) {
+ if ($ffloat) {
+ my $mult = getFloatToIntMult($tsize);
+ if (!$tsigned) { # bump from -1.0f/1.0f to 0.0f/2.0f
+ $code = "($code + 1.0f)";
+ }
+ $code = "(($tctype) ($code * $mult))";
+ } else {
+ # $divby will be the reciprocal, to avoid pipeline stalls
+ # from floating point division...so multiply it.
+ my $divby = getIntToFloatDivBy($fsize);
+ $code = "(((float) $code) * $divby)";
+ if (!$fsigned) { # bump from 0.0f/2.0f to -1.0f/1.0f.
+ $code = "($code - 1.0f)";
+ }
+ }
+ } else {
+ # All integer conversions here.
+ if ($fsigned != $tsigned) {
+ my $signflipval = getSignFlipVal($fsize);
+ $code = "(($code) ^ $signflipval)";
+ }
+
+ my $shiftval = abs($fsize - $tsize);
+ if ($fsize < $tsize) {
+ $code = "((($tctype) $code) << $shiftval)";
+ } elsif ($fsize > $tsize) {
+ $code = "(($tctype) ($code >> $shiftval))";
+ }
+ }
+
+ my $swap = getSwapFunc($tsize, $tsigned, $tfloat, $tendian, 'val');
+
+ print < $tsize) {
+ my $divby = $fsize / $tsize;
+ print(" cvt->len_cvt /= $divby;\n");
+ } elsif ($fsize < $tsize) {
+ my $mult = $tsize / $fsize;
+ print(" cvt->len_cvt *= $mult;\n");
+ }
+
+ print <filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, AUDIO_$to);
+ }
+}
+
+EOF
+
+ } else {
+ if ($fsigned != $tsigned) {
+ $funcs{$hashid} = 'SDL_ConvertSigned';
+ } elsif ($ffloat != $tfloat) {
+ $funcs{$hashid} = 'SDL_ConvertFloat';
+ } elsif ($fsize != $tsize) {
+ $funcs{$hashid} = 'SDL_ConvertSize';
+ } elsif ($fendian ne $tendian) {
+ $funcs{$hashid} = 'SDL_ConvertEndian';
+ } else {
+ die("error in script.\n");
+ }
+ }
+}
+
+
+sub buildTypeConverters {
+ print "#if !NO_CONVERTERS\n\n";
+ foreach (@audiotypes) {
+ my $from = $_;
+ foreach (@audiotypes) {
+ my $to = $_;
+ buildCvtFunc($from, $to);
+ }
+ }
+ print "#endif /* !NO_CONVERTERS */\n\n\n";
+
+ print "const SDL_AudioTypeFilters sdl_audio_type_filters[] =\n{\n";
+ print "#if !NO_CONVERTERS\n";
+ foreach (@audiotypes) {
+ my $from = $_;
+ foreach (@audiotypes) {
+ my $to = $_;
+ if ($from ne $to) {
+ my $hashid = getTypeConvertHashId($from, $to);
+ my $sym = $funcs{$hashid};
+ print(" { AUDIO_$from, AUDIO_$to, $sym },\n");
+ }
+ }
+ }
+ print "#endif /* !NO_CONVERTERS */\n";
+
+ print(" { 0, 0, NULL }\n");
+ print "};\n\n\n";
+}
+
+sub getBiggerCtype {
+ my ($isfloat, $size) = @_;
+
+ if ($isfloat) {
+ if ($size == 32) {
+ return 'double';
+ }
+ die("bug in script.\n");
+ }
+
+ if ($size == 8) {
+ return 'Sint16';
+ } elsif ($size == 16) {
+ return 'Sint32'
+ } elsif ($size == 32) {
+ return 'Sint64'
+ }
+
+ die("bug in script.\n");
+}
+
+
+# These handle arbitrary resamples...44100Hz to 48000Hz, for example.
+# Man, this code is skanky.
+sub buildArbitraryResampleFunc {
+ # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc().
+ my ($from, $channels, $upsample) = @_;
+ my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from);
+
+ my $bigger = getBiggerCtype($ffloat, $fsize);
+ my $interp = ($ffloat) ? '* 0.5' : '>> 1';
+
+ my $resample = ($upsample) ? 'Upsample' : 'Downsample';
+ my $hashid = getResamplerHashId($from, $channels, $upsample, 0);
+ my $sym = "SDL_${resample}_${from}_${channels}c";
+ $funcs{$hashid} = $sym;
+ $custom_converters++;
+
+ my $fudge = $fsize * $channels * 2; # !!! FIXME
+ my $eps_adjust = ($upsample) ? 'dstsize' : 'srcsize';
+ my $incr = '';
+ my $incr2 = '';
+
+
+ # !!! FIXME: DEBUG_CONVERT should report frequencies.
+ print <rate_incr);
+#endif
+
+ const int srcsize = cvt->len_cvt - $fudge;
+ const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+ register int eps = 0;
+EOF
+
+ # Upsampling (growing the buffer) needs to work backwards, since we
+ # overwrite the buffer as we go.
+ if ($upsample) {
+ print <buf + dstsize)) - $channels;
+ const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
+ const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
+EOF
+ } else {
+ print <buf;
+ const $fctype *src = ($fctype *) cvt->buf;
+ const $fctype *target = (const $fctype *) (cvt->buf + dstsize);
+EOF
+ }
+
+ for (my $i = 0; $i < $channels; $i++) {
+ my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
+ my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]");
+ print <= dstsize) {
+ $incr2;
+EOF
+ } else { # downsample.
+ $incr = ($channels == 1) ? 'src++' : "src += $channels";
+ print <= srcsize) {
+EOF
+ for (my $i = 0; $i < $channels; $i++) {
+ my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "sample${i}");
+ print <len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+EOF
+
+}
+
+# These handle clean resamples...doubling and quadrupling the sample rate, etc.
+sub buildMultipleResampleFunc {
+ # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc().
+ my ($from, $channels, $upsample, $multiple) = @_;
+ my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from);
+
+ my $bigger = getBiggerCtype($ffloat, $fsize);
+ my $interp = ($ffloat) ? '* 0.5' : '>> 1';
+ my $interp2 = ($ffloat) ? '* 0.25' : '>> 2';
+ my $mult3 = ($ffloat) ? '3.0' : '3';
+ my $lencvtop = ($upsample) ? '*' : '/';
+
+ my $resample = ($upsample) ? 'Upsample' : 'Downsample';
+ my $hashid = getResamplerHashId($from, $channels, $upsample, $multiple);
+ my $sym = "SDL_${resample}_${from}_${channels}c_x${multiple}";
+ $funcs{$hashid} = $sym;
+ $custom_converters++;
+
+ # !!! FIXME: DEBUG_CONVERT should report frequencies.
+ print <len_cvt;
+ const int dstsize = cvt->len_cvt $lencvtop $multiple;
+EOF
+
+ my $endcomparison = '!=';
+
+ # Upsampling (growing the buffer) needs to work backwards, since we
+ # overwrite the buffer as we go.
+ if ($upsample) {
+ $endcomparison = '>'; # dst > target
+ print <buf + dstsize)) - $channels;
+ const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
+ const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
+EOF
+ } else {
+ $endcomparison = '<'; # dst < target
+ print <buf;
+ const $fctype *src = ($fctype *) cvt->buf;
+ const $fctype *target = (const $fctype *) (cvt->buf + dstsize);
+EOF
+ }
+
+ for (my $i = 0; $i < $channels; $i++) {
+ my $idx = ($upsample) ? (($channels - $i) - 1) : $i;
+ my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]");
+ print <= 0; $i--) {
+ my $dsti = $i + $channels;
+ print <= 0; $i--) {
+ my $dsti = $i;
+ print <= 0; $i--) {
+ my $dsti = $i + ($channels * 3);
+ print <= 0; $i--) {
+ my $dsti = $i + ($channels * 2);
+ print <= 0; $i--) {
+ my $dsti = $i + ($channels * 1);
+ print <= 0; $i--) {
+ my $dsti = $i + ($channels * 0);
+ print <len_cvt = dstsize;
+ if (cvt->filters[++cvt->filter_index]) {
+ cvt->filters[cvt->filter_index] (cvt, format);
+ }
+}
+
+EOF
+
+}
+
+sub buildResamplers {
+ print "#if !NO_RESAMPLERS\n\n";
+ foreach (@audiotypes) {
+ my $from = $_;
+ foreach (@channels) {
+ my $channel = $_;
+ buildArbitraryResampleFunc($from, $channel, 1);
+ buildArbitraryResampleFunc($from, $channel, 0);
+ }
+ }
+
+ print "\n#if !LESS_RESAMPLERS\n\n";
+ foreach (@audiotypes) {
+ my $from = $_;
+ foreach (@channels) {
+ my $channel = $_;
+ for (my $multiple = 2; $multiple <= 4; $multiple += 2) {
+ buildMultipleResampleFunc($from, $channel, 1, $multiple);
+ buildMultipleResampleFunc($from, $channel, 0, $multiple);
+ }
+ }
+ }
+
+ print "#endif /* !LESS_RESAMPLERS */\n";
+ print "#endif /* !NO_RESAMPLERS */\n\n\n";
+
+ print "const SDL_AudioRateFilters sdl_audio_rate_filters[] =\n{\n";
+ print "#if !NO_RESAMPLERS\n";
+ foreach (@audiotypes) {
+ my $from = $_;
+ foreach (@channels) {
+ my $channel = $_;
+ for (my $upsample = 0; $upsample <= 1; $upsample++) {
+ my $hashid = getResamplerHashId($from, $channel, $upsample, 0);
+ my $sym = $funcs{$hashid};
+ print(" { AUDIO_$from, $channel, $upsample, 0, $sym },\n");
+ }
+ }
+ }
+
+ print "#if !LESS_RESAMPLERS\n";
+ foreach (@audiotypes) {
+ my $from = $_;
+ foreach (@channels) {
+ my $channel = $_;
+ for (my $multiple = 2; $multiple <= 4; $multiple += 2) {
+ for (my $upsample = 0; $upsample <= 1; $upsample++) {
+ my $hashid = getResamplerHashId($from, $channel, $upsample, $multiple);
+ my $sym = $funcs{$hashid};
+ print(" { AUDIO_$from, $channel, $upsample, $multiple, $sym },\n");
+ }
+ }
+ }
+ }
+
+ print "#endif /* !LESS_RESAMPLERS */\n";
+ print "#endif /* !NO_RESAMPLERS */\n";
+ print(" { 0, 0, 0, 0, NULL }\n");
+ print "};\n\n";
+}
+
+
+# mainline ...
+
+outputHeader();
+buildTypeConverters();
+buildResamplers();
+outputFooter();
+
+exit 0;
+
+# end of sdlgenaudiocvt.pl ...
+
diff --git a/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.c b/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.c
index 4a57c68f6..399eece9b 100644
--- a/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.c
+++ b/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.c
@@ -1,6 +1,11 @@
+/* I'm gambling no one uses this audio backend...we'll see who emails. :) */
+#error this code has not been updated for SDL 1.3.
+#error if no one emails icculus at icculus.org and tells him that this
+#error code is needed, this audio backend will eventually be removed from SDL.
+
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -48,7 +53,7 @@
#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK)
/* Audio driver functions */
-static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec);
+static int DSP_OpenAudio(_THIS, SDL_AudioSpec * spec);
static void DSP_WaitAudio(_THIS);
static void DSP_PlayAudio(_THIS);
static Uint8 *DSP_GetAudioBuf(_THIS);
@@ -58,325 +63,339 @@ static Uint8 snd2au(int sample);
/* Audio driver bootstrap functions */
-static int Audio_Available(void)
+static int
+Audio_Available(void)
{
- int fd;
- int available;
+ int fd;
+ int available;
- available = 0;
- fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 1);
- if ( fd >= 0 ) {
- available = 1;
- close(fd);
- }
- return(available);
+ available = 0;
+ fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 1);
+ if (fd >= 0) {
+ available = 1;
+ close(fd);
+ }
+ return (available);
}
-static void Audio_DeleteDevice(SDL_AudioDevice *device)
+static void
+Audio_DeleteDevice(SDL_AudioDevice * device)
{
- SDL_free(device->hidden);
- SDL_free(device);
+ SDL_free(device->hidden);
+ SDL_free(device);
}
-static SDL_AudioDevice *Audio_CreateDevice(int devindex)
+static SDL_AudioDevice *
+Audio_CreateDevice(int devindex)
{
- SDL_AudioDevice *this;
+ SDL_AudioDevice *this;
- /* Initialize all variables that we clean on shutdown */
- this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
- if ( this ) {
- SDL_memset(this, 0, (sizeof *this));
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- }
- if ( (this == NULL) || (this->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( this ) {
- SDL_free(this);
- }
- return(0);
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
- audio_fd = -1;
+ /* Initialize all variables that we clean on shutdown */
+ this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
+ if (this) {
+ SDL_memset(this, 0, (sizeof *this));
+ this->hidden = (struct SDL_PrivateAudioData *)
+ SDL_malloc((sizeof *this->hidden));
+ }
+ if ((this == NULL) || (this->hidden == NULL)) {
+ SDL_OutOfMemory();
+ if (this) {
+ SDL_free(this);
+ }
+ return (0);
+ }
+ SDL_memset(this->hidden, 0, (sizeof *this->hidden));
+ audio_fd = -1;
- /* Set the function pointers */
- this->OpenAudio = DSP_OpenAudio;
- this->WaitAudio = DSP_WaitAudio;
- this->PlayAudio = DSP_PlayAudio;
- this->GetAudioBuf = DSP_GetAudioBuf;
- this->CloseAudio = DSP_CloseAudio;
+ /* Set the function pointers */
+ this->OpenAudio = DSP_OpenAudio;
+ this->WaitAudio = DSP_WaitAudio;
+ this->PlayAudio = DSP_PlayAudio;
+ this->GetAudioBuf = DSP_GetAudioBuf;
+ this->CloseAudio = DSP_CloseAudio;
- this->free = Audio_DeleteDevice;
+ this->free = Audio_DeleteDevice;
- return this;
+ return this;
}
AudioBootStrap SUNAUDIO_bootstrap = {
- "audio", "UNIX /dev/audio interface",
- Audio_Available, Audio_CreateDevice
+ "audio", "UNIX /dev/audio interface",
+ Audio_Available, Audio_CreateDevice, 0
};
#ifdef DEBUG_AUDIO
-void CheckUnderflow(_THIS)
+void
+CheckUnderflow(_THIS)
{
#ifdef AUDIO_GETINFO
- audio_info_t info;
- int left;
+ audio_info_t info;
+ int left;
- ioctl(audio_fd, AUDIO_GETINFO, &info);
- left = (written - info.play.samples);
- if ( written && (left == 0) ) {
- fprintf(stderr, "audio underflow!\n");
- }
+ ioctl(audio_fd, AUDIO_GETINFO, &info);
+ left = (written - info.play.samples);
+ if (written && (left == 0)) {
+ fprintf(stderr, "audio underflow!\n");
+ }
#endif
}
#endif
-void DSP_WaitAudio(_THIS)
+void
+DSP_WaitAudio(_THIS)
{
#ifdef AUDIO_GETINFO
-#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
- audio_info_t info;
- Sint32 left;
+#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
+ audio_info_t info;
+ Sint32 left;
- ioctl(audio_fd, AUDIO_GETINFO, &info);
- left = (written - info.play.samples);
- if ( left > fragsize ) {
- Sint32 sleepy;
+ ioctl(audio_fd, AUDIO_GETINFO, &info);
+ left = (written - info.play.samples);
+ if (left > fragsize) {
+ Sint32 sleepy;
- sleepy = ((left - fragsize)/frequency);
- sleepy -= SLEEP_FUDGE;
- if ( sleepy > 0 ) {
- SDL_Delay(sleepy);
- }
- }
+ sleepy = ((left - fragsize) / frequency);
+ sleepy -= SLEEP_FUDGE;
+ if (sleepy > 0) {
+ SDL_Delay(sleepy);
+ }
+ }
#else
- fd_set fdset;
+ fd_set fdset;
- FD_ZERO(&fdset);
- FD_SET(audio_fd, &fdset);
- select(audio_fd+1, NULL, &fdset, NULL, NULL);
+ FD_ZERO(&fdset);
+ FD_SET(audio_fd, &fdset);
+ select(audio_fd + 1, NULL, &fdset, NULL, NULL);
#endif
}
-void DSP_PlayAudio(_THIS)
+void
+DSP_PlayAudio(_THIS)
{
- /* Write the audio data */
- if ( ulaw_only ) {
- /* Assuming that this->spec.freq >= 8000 Hz */
- int accum, incr, pos;
- Uint8 *aubuf;
+ /* Write the audio data */
+ if (ulaw_only) {
+ /* Assuming that this->spec.freq >= 8000 Hz */
+ int accum, incr, pos;
+ Uint8 *aubuf;
- accum = 0;
- incr = this->spec.freq/8;
- aubuf = ulaw_buf;
- switch (audio_fmt & 0xFF) {
- case 8: {
- Uint8 *sndbuf;
+ accum = 0;
+ incr = this->spec.freq / 8;
+ aubuf = ulaw_buf;
+ switch (audio_fmt & 0xFF) {
+ case 8:
+ {
+ Uint8 *sndbuf;
- sndbuf = mixbuf;
- for ( pos=0; pos < fragsize; ++pos ) {
- *aubuf = snd2au((0x80-*sndbuf)*64);
- accum += incr;
- while ( accum > 0 ) {
- accum -= 1000;
- sndbuf += 1;
- }
- aubuf += 1;
- }
- }
- break;
- case 16: {
- Sint16 *sndbuf;
+ sndbuf = mixbuf;
+ for (pos = 0; pos < fragsize; ++pos) {
+ *aubuf = snd2au((0x80 - *sndbuf) * 64);
+ accum += incr;
+ while (accum > 0) {
+ accum -= 1000;
+ sndbuf += 1;
+ }
+ aubuf += 1;
+ }
+ }
+ break;
+ case 16:
+ {
+ Sint16 *sndbuf;
- sndbuf = (Sint16 *)mixbuf;
- for ( pos=0; pos < fragsize; ++pos ) {
- *aubuf = snd2au(*sndbuf/4);
- accum += incr;
- while ( accum > 0 ) {
- accum -= 1000;
- sndbuf += 1;
- }
- aubuf += 1;
- }
- }
- break;
- }
+ sndbuf = (Sint16 *) mixbuf;
+ for (pos = 0; pos < fragsize; ++pos) {
+ *aubuf = snd2au(*sndbuf / 4);
+ accum += incr;
+ while (accum > 0) {
+ accum -= 1000;
+ sndbuf += 1;
+ }
+ aubuf += 1;
+ }
+ }
+ break;
+ }
#ifdef DEBUG_AUDIO
- CheckUnderflow(this);
+ CheckUnderflow(this);
#endif
- if ( write(audio_fd, ulaw_buf, fragsize) < 0 ) {
- /* Assume fatal error, for now */
- this->enabled = 0;
- }
- written += fragsize;
- } else {
+ if (write(audio_fd, ulaw_buf, fragsize) < 0) {
+ /* Assume fatal error, for now */
+ this->enabled = 0;
+ }
+ written += fragsize;
+ } else {
#ifdef DEBUG_AUDIO
- CheckUnderflow(this);
+ CheckUnderflow(this);
#endif
- if ( write(audio_fd, mixbuf, this->spec.size) < 0 ) {
- /* Assume fatal error, for now */
- this->enabled = 0;
- }
- written += fragsize;
- }
+ if (write(audio_fd, mixbuf, this->spec.size) < 0) {
+ /* Assume fatal error, for now */
+ this->enabled = 0;
+ }
+ written += fragsize;
+ }
}
-Uint8 *DSP_GetAudioBuf(_THIS)
+Uint8 *
+DSP_GetAudioBuf(_THIS)
{
- return(mixbuf);
+ return (mixbuf);
}
-void DSP_CloseAudio(_THIS)
+void
+DSP_CloseAudio(_THIS)
{
- if ( mixbuf != NULL ) {
- SDL_FreeAudioMem(mixbuf);
- mixbuf = NULL;
- }
- if ( ulaw_buf != NULL ) {
- SDL_free(ulaw_buf);
- ulaw_buf = NULL;
- }
- close(audio_fd);
+ if (mixbuf != NULL) {
+ SDL_FreeAudioMem(mixbuf);
+ mixbuf = NULL;
+ }
+ if (ulaw_buf != NULL) {
+ SDL_free(ulaw_buf);
+ ulaw_buf = NULL;
+ }
+ close(audio_fd);
}
-int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
+int
+DSP_OpenAudio(_THIS, SDL_AudioSpec * spec)
{
- char audiodev[1024];
+ char audiodev[1024];
#ifdef AUDIO_SETINFO
- int enc;
+ int enc;
#endif
- int desired_freq = spec->freq;
+ int desired_freq = spec->freq;
- /* Initialize our freeable variables, in case we fail*/
- audio_fd = -1;
- mixbuf = NULL;
- ulaw_buf = NULL;
+ /* Initialize our freeable variables, in case we fail */
+ audio_fd = -1;
+ mixbuf = NULL;
+ ulaw_buf = NULL;
- /* Determine the audio parameters from the AudioSpec */
- switch ( spec->format & 0xFF ) {
+ /* Determine the audio parameters from the AudioSpec */
+ switch (SDL_AUDIO_BITSIZE(spec->format)) {
- case 8: { /* Unsigned 8 bit audio data */
- spec->format = AUDIO_U8;
+ case 8:
+ { /* Unsigned 8 bit audio data */
+ spec->format = AUDIO_U8;
#ifdef AUDIO_SETINFO
- enc = AUDIO_ENCODING_LINEAR8;
+ enc = AUDIO_ENCODING_LINEAR8;
#endif
- }
- break;
+ }
+ break;
- case 16: { /* Signed 16 bit audio data */
- spec->format = AUDIO_S16SYS;
+ case 16:
+ { /* Signed 16 bit audio data */
+ spec->format = AUDIO_S16SYS;
#ifdef AUDIO_SETINFO
- enc = AUDIO_ENCODING_LINEAR;
+ enc = AUDIO_ENCODING_LINEAR;
#endif
- }
- break;
+ }
+ break;
- default: {
- SDL_SetError("Unsupported audio format");
- return(-1);
- }
- }
- audio_fmt = spec->format;
+ default:
+ {
+ /* !!! FIXME: fallback to conversion on unsupported types! */
+ SDL_SetError("Unsupported audio format");
+ return (-1);
+ }
+ }
+ audio_fmt = spec->format;
- /* Open the audio device */
- audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 1);
- if ( audio_fd < 0 ) {
- SDL_SetError("Couldn't open %s: %s", audiodev,
- strerror(errno));
- return(-1);
- }
+ /* Open the audio device */
+ audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 1);
+ if (audio_fd < 0) {
+ SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
+ return (-1);
+ }
- ulaw_only = 0; /* modern Suns do support linear audio */
+ ulaw_only = 0; /* modern Suns do support linear audio */
#ifdef AUDIO_SETINFO
- for(;;) {
- audio_info_t info;
- AUDIO_INITINFO(&info); /* init all fields to "no change" */
+ for (;;) {
+ audio_info_t info;
+ AUDIO_INITINFO(&info); /* init all fields to "no change" */
- /* Try to set the requested settings */
- info.play.sample_rate = spec->freq;
- info.play.channels = spec->channels;
- info.play.precision = (enc == AUDIO_ENCODING_ULAW)
- ? 8 : spec->format & 0xff;
- info.play.encoding = enc;
- if( ioctl(audio_fd, AUDIO_SETINFO, &info) == 0 ) {
+ /* Try to set the requested settings */
+ info.play.sample_rate = spec->freq;
+ info.play.channels = spec->channels;
+ info.play.precision = (enc == AUDIO_ENCODING_ULAW)
+ ? 8 : spec->format & 0xff;
+ info.play.encoding = enc;
+ if (ioctl(audio_fd, AUDIO_SETINFO, &info) == 0) {
- /* Check to be sure we got what we wanted */
- if(ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) {
- SDL_SetError("Error getting audio parameters: %s",
- strerror(errno));
- return -1;
- }
- if(info.play.encoding == enc
- && info.play.precision == (spec->format & 0xff)
- && info.play.channels == spec->channels) {
- /* Yow! All seems to be well! */
- spec->freq = info.play.sample_rate;
- break;
- }
- }
+ /* Check to be sure we got what we wanted */
+ if (ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) {
+ SDL_SetError("Error getting audio parameters: %s",
+ strerror(errno));
+ return -1;
+ }
+ if (info.play.encoding == enc
+ && info.play.precision == (spec->format & 0xff)
+ && info.play.channels == spec->channels) {
+ /* Yow! All seems to be well! */
+ spec->freq = info.play.sample_rate;
+ break;
+ }
+ }
- switch(enc) {
- case AUDIO_ENCODING_LINEAR8:
- /* unsigned 8bit apparently not supported here */
- enc = AUDIO_ENCODING_LINEAR;
- spec->format = AUDIO_S16SYS;
- break; /* try again */
+ switch (enc) {
+ case AUDIO_ENCODING_LINEAR8:
+ /* unsigned 8bit apparently not supported here */
+ enc = AUDIO_ENCODING_LINEAR;
+ spec->format = AUDIO_S16SYS;
+ break; /* try again */
- case AUDIO_ENCODING_LINEAR:
- /* linear 16bit didn't work either, resort to µ-law */
- enc = AUDIO_ENCODING_ULAW;
- spec->channels = 1;
- spec->freq = 8000;
- spec->format = AUDIO_U8;
- ulaw_only = 1;
- break;
+ case AUDIO_ENCODING_LINEAR:
+ /* linear 16bit didn't work either, resort to µ-law */
+ enc = AUDIO_ENCODING_ULAW;
+ spec->channels = 1;
+ spec->freq = 8000;
+ spec->format = AUDIO_U8;
+ ulaw_only = 1;
+ break;
- default:
- /* oh well... */
- SDL_SetError("Error setting audio parameters: %s",
- strerror(errno));
- return -1;
- }
- }
+ default:
+ /* oh well... */
+ SDL_SetError("Error setting audio parameters: %s",
+ strerror(errno));
+ return -1;
+ }
+ }
#endif /* AUDIO_SETINFO */
- written = 0;
+ written = 0;
- /* We can actually convert on-the-fly to U-Law */
- if ( ulaw_only ) {
- spec->freq = desired_freq;
- fragsize = (spec->samples*1000)/(spec->freq/8);
- frequency = 8;
- ulaw_buf = (Uint8 *)SDL_malloc(fragsize);
- if ( ulaw_buf == NULL ) {
- SDL_OutOfMemory();
- return(-1);
- }
- spec->channels = 1;
- } else {
- fragsize = spec->samples;
- frequency = spec->freq/1000;
- }
+ /* We can actually convert on-the-fly to U-Law */
+ if (ulaw_only) {
+ spec->freq = desired_freq;
+ fragsize = (spec->samples * 1000) / (spec->freq / 8);
+ frequency = 8;
+ ulaw_buf = (Uint8 *) SDL_malloc(fragsize);
+ if (ulaw_buf == NULL) {
+ SDL_OutOfMemory();
+ return (-1);
+ }
+ spec->channels = 1;
+ } else {
+ fragsize = spec->samples;
+ frequency = spec->freq / 1000;
+ }
#ifdef DEBUG_AUDIO
- fprintf(stderr, "Audio device %s U-Law only\n",
- ulaw_only ? "is" : "is not");
- fprintf(stderr, "format=0x%x chan=%d freq=%d\n",
- spec->format, spec->channels, spec->freq);
+ fprintf(stderr, "Audio device %s U-Law only\n",
+ ulaw_only ? "is" : "is not");
+ fprintf(stderr, "format=0x%x chan=%d freq=%d\n",
+ spec->format, spec->channels, spec->freq);
#endif
- /* Update the fragment size as size in bytes */
- SDL_CalculateAudioSpec(spec);
+ /* Update the fragment size as size in bytes */
+ SDL_CalculateAudioSpec(spec);
- /* Allocate mixing buffer */
- mixbuf = (Uint8 *)SDL_AllocAudioMem(spec->size);
- if ( mixbuf == NULL ) {
- SDL_OutOfMemory();
- return(-1);
- }
- SDL_memset(mixbuf, spec->silence, spec->size);
+ /* Allocate mixing buffer */
+ mixbuf = (Uint8 *) SDL_AllocAudioMem(spec->size);
+ if (mixbuf == NULL) {
+ SDL_OutOfMemory();
+ return (-1);
+ }
+ SDL_memset(mixbuf, spec->silence, spec->size);
- /* We're ready to rock and roll. :-) */
- return(0);
+ /* We're ready to rock and roll. :-) */
+ return (0);
}
/************************************************************************/
@@ -397,36 +416,39 @@ int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
/* provided "as is" without express or implied warranty. */
/************************************************************************/
-static Uint8 snd2au(int sample)
+static Uint8
+snd2au(int sample)
{
- int mask;
+ int mask;
- if (sample < 0) {
- sample = -sample;
- mask = 0x7f;
- } else {
- mask = 0xff;
- }
+ if (sample < 0) {
+ sample = -sample;
+ mask = 0x7f;
+ } else {
+ mask = 0xff;
+ }
- if (sample < 32) {
- sample = 0xF0 | (15 - sample / 2);
- } else if (sample < 96) {
- sample = 0xE0 | (15 - (sample - 32) / 4);
- } else if (sample < 224) {
- sample = 0xD0 | (15 - (sample - 96) / 8);
- } else if (sample < 480) {
- sample = 0xC0 | (15 - (sample - 224) / 16);
- } else if (sample < 992) {
- sample = 0xB0 | (15 - (sample - 480) / 32);
- } else if (sample < 2016) {
- sample = 0xA0 | (15 - (sample - 992) / 64);
- } else if (sample < 4064) {
- sample = 0x90 | (15 - (sample - 2016) / 128);
- } else if (sample < 8160) {
- sample = 0x80 | (15 - (sample - 4064) / 256);
- } else {
- sample = 0x80;
- }
- return (mask & sample);
+ if (sample < 32) {
+ sample = 0xF0 | (15 - sample / 2);
+ } else if (sample < 96) {
+ sample = 0xE0 | (15 - (sample - 32) / 4);
+ } else if (sample < 224) {
+ sample = 0xD0 | (15 - (sample - 96) / 8);
+ } else if (sample < 480) {
+ sample = 0xC0 | (15 - (sample - 224) / 16);
+ } else if (sample < 992) {
+ sample = 0xB0 | (15 - (sample - 480) / 32);
+ } else if (sample < 2016) {
+ sample = 0xA0 | (15 - (sample - 992) / 64);
+ } else if (sample < 4064) {
+ sample = 0x90 | (15 - (sample - 2016) / 128);
+ } else if (sample < 8160) {
+ sample = 0x80 | (15 - (sample - 4064) / 256);
+ } else {
+ sample = 0x80;
+ }
+ return (mask & sample);
}
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.h b/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.h
index 480bd4eb9..652a8a5c1 100644
--- a/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.h
+++ b/alienblaster/project/jni/sdl/src/audio/sun/SDL_sunaudio.h
@@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
+ Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,25 +21,26 @@
*/
#include "SDL_config.h"
-#ifndef _SDL_lowaudio_h
-#define _SDL_lowaudio_h
+#ifndef _SDL_sunaudio_h
+#define _SDL_sunaudio_h
#include "../SDL_sysaudio.h"
-/* Hidden "this" pointer for the video functions */
+/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
-struct SDL_PrivateAudioData {
- /* The file descriptor for the audio device */
- int audio_fd;
+struct SDL_PrivateAudioData
+{
+ /* The file descriptor for the audio device */
+ int audio_fd;
- Uint16 audio_fmt; /* The app audio format */
- Uint8 *mixbuf; /* The app mixing buffer */
- int ulaw_only; /* Flag -- does hardware only output U-law? */
- Uint8 *ulaw_buf; /* The U-law mixing buffer */
- Sint32 written; /* The number of samples written */
- int fragsize; /* The audio fragment size in samples */
- int frequency; /* The audio frequency in KHz */
+ SDL_AudioFormat audio_fmt; /* The app audio format */
+ Uint8 *mixbuf; /* The app mixing buffer */
+ int ulaw_only; /* Flag -- does hardware only output U-law? */
+ Uint8 *ulaw_buf; /* The U-law mixing buffer */
+ Sint32 written; /* The number of samples written */
+ int fragsize; /* The audio fragment size in samples */
+ int frequency; /* The audio frequency in KHz */
};
/* Old variable names */
@@ -52,4 +53,6 @@ struct SDL_PrivateAudioData {
#define fragsize (this->hidden->fragsize)
#define frequency (this->hidden->frequency)
-#endif /* _SDL_lowaudio_h */
+#endif /* _SDL_sunaudio_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/alienblaster/project/jni/sdl/src/audio/symbian/SDL_epocaudio.cpp b/alienblaster/project/jni/sdl/src/audio/symbian/SDL_epocaudio.cpp
deleted file mode 100644
index 304083a77..000000000
--- a/alienblaster/project/jni/sdl/src/audio/symbian/SDL_epocaudio.cpp
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2009 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@devolution.com
-*/
-
-/*
- SDL_epocaudio.cpp
- Epoc based SDL audio driver implementation
-
- Markus Mertama
-*/
-
-#ifdef SAVE_RCSID
-static char rcsid =
- "@(#) $Id: SDL_epocaudio.c,v 0.0.0.0 2001/06/19 17:19:56 hercules Exp $";
-#endif
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include