Cleaned up whitespace for the 2.0.0 release
authorSam Lantinga <slouken@libsdl.org>
Tue, 21 May 2013 21:21:23 -0700
changeset 61787116a42526e
parent 616 7ead8213dfb0
child 618 2906d3207f34
Cleaned up whitespace for the 2.0.0 release
SDL_mixer.h
VisualC/resource.h
Xcode/playmus/SDLMain.m
Xcode/playwave/SDLMain.m
dynamic_flac.c
dynamic_flac.h
dynamic_fluidsynth.c
dynamic_fluidsynth.h
dynamic_mod.c
dynamic_mod.h
dynamic_mp3.c
dynamic_mp3.h
dynamic_ogg.c
dynamic_ogg.h
effect_position.c
effect_stereoreverse.c
effects_internal.c
fluidsynth.c
fluidsynth.h
load_aiff.c
load_aiff.h
load_flac.c
load_flac.h
load_ogg.c
load_voc.c
mixer.c
music_cmd.c
music_cmd.h
music_flac.c
music_flac.h
music_mad.c
music_mad.h
music_mod.c
music_modplug.c
music_modplug.h
music_ogg.c
music_ogg.h
native_midi/native_midi_common.c
native_midi/native_midi_common.h
native_midi/native_midi_haiku.cpp
native_midi/native_midi_mac.c
native_midi/native_midi_macosx.c
native_midi/native_midi_win32.c
playmus.c
playwave.c
wavestream.c
wavestream.h
     1.1 --- a/SDL_mixer.h	Tue May 21 21:09:26 2013 -0700
     1.2 +++ b/SDL_mixer.h	Tue May 21 21:21:23 2013 -0700
     1.3 @@ -38,25 +38,25 @@
     1.4  
     1.5  /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
     1.6  */
     1.7 -#define SDL_MIXER_MAJOR_VERSION	2
     1.8 -#define SDL_MIXER_MINOR_VERSION	0
     1.9 +#define SDL_MIXER_MAJOR_VERSION 2
    1.10 +#define SDL_MIXER_MINOR_VERSION 0
    1.11  #define SDL_MIXER_PATCHLEVEL    0
    1.12  
    1.13  /* This macro can be used to fill a version structure with the compile-time
    1.14   * version of the SDL_mixer library.
    1.15   */
    1.16 -#define SDL_MIXER_VERSION(X)						\
    1.17 -{									\
    1.18 -	(X)->major = SDL_MIXER_MAJOR_VERSION;				\
    1.19 -	(X)->minor = SDL_MIXER_MINOR_VERSION;				\
    1.20 -	(X)->patch = SDL_MIXER_PATCHLEVEL;				\
    1.21 +#define SDL_MIXER_VERSION(X)                        \
    1.22 +{                                                   \
    1.23 +    (X)->major = SDL_MIXER_MAJOR_VERSION;           \
    1.24 +    (X)->minor = SDL_MIXER_MINOR_VERSION;           \
    1.25 +    (X)->patch = SDL_MIXER_PATCHLEVEL;              \
    1.26  }
    1.27  
    1.28  /* Backwards compatibility */
    1.29 -#define MIX_MAJOR_VERSION	SDL_MIXER_MAJOR_VERSION
    1.30 -#define MIX_MINOR_VERSION	SDL_MIXER_MINOR_VERSION
    1.31 -#define MIX_PATCHLEVEL		SDL_MIXER_PATCHLEVEL
    1.32 -#define MIX_VERSION(X)		SDL_MIXER_VERSION(X)
    1.33 +#define MIX_MAJOR_VERSION   SDL_MIXER_MAJOR_VERSION
    1.34 +#define MIX_MINOR_VERSION   SDL_MIXER_MINOR_VERSION
    1.35 +#define MIX_PATCHLEVEL      SDL_MIXER_PATCHLEVEL
    1.36 +#define MIX_VERSION(X)      SDL_MIXER_VERSION(X)
    1.37  
    1.38  /* This function gets the version of the dynamically linked SDL_mixer library.
    1.39     it should NOT be used to fill a version structure, instead you should
    1.40 @@ -85,53 +85,52 @@
    1.41  
    1.42  /* The default mixer has 8 simultaneous mixing channels */
    1.43  #ifndef MIX_CHANNELS
    1.44 -#define MIX_CHANNELS	8
    1.45 +#define MIX_CHANNELS    8
    1.46  #endif
    1.47  
    1.48  /* Good default values for a PC soundcard */
    1.49 -#define MIX_DEFAULT_FREQUENCY	22050
    1.50 +#define MIX_DEFAULT_FREQUENCY   22050
    1.51  #if SDL_BYTEORDER == SDL_LIL_ENDIAN
    1.52 -#define MIX_DEFAULT_FORMAT	AUDIO_S16LSB
    1.53 +#define MIX_DEFAULT_FORMAT  AUDIO_S16LSB
    1.54  #else
    1.55 -#define MIX_DEFAULT_FORMAT	AUDIO_S16MSB
    1.56 +#define MIX_DEFAULT_FORMAT  AUDIO_S16MSB
    1.57  #endif
    1.58 -#define MIX_DEFAULT_CHANNELS	2
    1.59 -#define MIX_MAX_VOLUME		128	/* Volume of a chunk */
    1.60 +#define MIX_DEFAULT_CHANNELS    2
    1.61 +#define MIX_MAX_VOLUME          128 /* Volume of a chunk */
    1.62  
    1.63  /* The internal format for an audio chunk */
    1.64  typedef struct Mix_Chunk {
    1.65 -	int allocated;
    1.66 -	Uint8 *abuf;
    1.67 -	Uint32 alen;
    1.68 -	Uint8 volume;		/* Per-sample volume, 0-128 */
    1.69 +    int allocated;
    1.70 +    Uint8 *abuf;
    1.71 +    Uint32 alen;
    1.72 +    Uint8 volume;       /* Per-sample volume, 0-128 */
    1.73  } Mix_Chunk;
    1.74  
    1.75  /* The different fading types supported */
    1.76  typedef enum {
    1.77 -	MIX_NO_FADING,
    1.78 -	MIX_FADING_OUT,
    1.79 -	MIX_FADING_IN
    1.80 +    MIX_NO_FADING,
    1.81 +    MIX_FADING_OUT,
    1.82 +    MIX_FADING_IN
    1.83  } Mix_Fading;
    1.84  
    1.85  typedef enum {
    1.86 -	MUS_NONE,
    1.87 -	MUS_CMD,
    1.88 -	MUS_WAV,
    1.89 -	MUS_MOD,
    1.90 -	MUS_MID,
    1.91 -	MUS_OGG,
    1.92 -	MUS_MP3,
    1.93 -	MUS_MP3_MAD,
    1.94 -	MUS_FLAC,
    1.95 -	MUS_MODPLUG
    1.96 +    MUS_NONE,
    1.97 +    MUS_CMD,
    1.98 +    MUS_WAV,
    1.99 +    MUS_MOD,
   1.100 +    MUS_MID,
   1.101 +    MUS_OGG,
   1.102 +    MUS_MP3,
   1.103 +    MUS_MP3_MAD,
   1.104 +    MUS_FLAC,
   1.105 +    MUS_MODPLUG
   1.106  } Mix_MusicType;
   1.107  
   1.108  /* The internal format for a music chunk interpreted via mikmod */
   1.109  typedef struct _Mix_Music Mix_Music;
   1.110  
   1.111  /* Open the mixer with a certain audio format */
   1.112 -extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels,
   1.113 -							int chunksize);
   1.114 +extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize);
   1.115  
   1.116  /* Dynamically change the number of channels managed by the mixer.
   1.117     If decreasing the number of channels, the upper channels are
   1.118 @@ -147,7 +146,7 @@
   1.119  
   1.120  /* Load a wave file or a music (.mod .s3m .it .xm) file */
   1.121  extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc);
   1.122 -#define Mix_LoadWAV(file)	Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
   1.123 +#define Mix_LoadWAV(file)   Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
   1.124  extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file);
   1.125  
   1.126  /* Load a music file from an SDL_RWop object (Ogg and MikMod specific currently)
   1.127 @@ -200,14 +199,12 @@
   1.128     This can be used to provide real-time visual display of the audio stream
   1.129     or add a custom mixer filter for the stream data.
   1.130  */
   1.131 -extern DECLSPEC void SDLCALL Mix_SetPostMix(void (*mix_func)
   1.132 -                             (void *udata, Uint8 *stream, int len), void *arg);
   1.133 +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (*mix_func)(void *udata, Uint8 *stream, int len), void *arg);
   1.134  
   1.135  /* Add your own music player or additional mixer function.
   1.136     If 'mix_func' is NULL, the default music player is re-enabled.
   1.137   */
   1.138 -extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func)
   1.139 -                          (void *udata, Uint8 *stream, int len), void *arg);
   1.140 +extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func)(void *udata, Uint8 *stream, int len), void *arg);
   1.141  
   1.142  /* Add your own callback when the music has finished playing.
   1.143     This callback is only called if the music finishes naturally.
   1.144 @@ -219,9 +216,9 @@
   1.145  
   1.146  /*
   1.147   * Add your own callback when a channel has finished playing. NULL
   1.148 - *  to disable callback. The callback may be called from the mixer's audio 
   1.149 + *  to disable callback. The callback may be called from the mixer's audio
   1.150   *  callback or it could be called as a result of Mix_HaltChannel(), etc.
   1.151 - *  do not call SDL_LockAudio() from this callback; you will either be 
   1.152 + *  do not call SDL_LockAudio() from this callback; you will either be
   1.153   *  inside the audio callback, or SDL_mixer will explicitly lock the audio
   1.154   *  before calling your callback.
   1.155   */
   1.156 @@ -302,15 +299,14 @@
   1.157   *
   1.158   * After all these effects have finished processing, the callback registered
   1.159   *  through Mix_SetPostMix() runs, and then the stream goes to the audio
   1.160 - *  device. 
   1.161 + *  device.
   1.162   *
   1.163   * DO NOT EVER call SDL_LockAudio() from your callback function!
   1.164   *
   1.165   * returns zero if error (no such channel), nonzero if added.
   1.166   *  Error messages can be retrieved from Mix_GetError().
   1.167   */
   1.168 -extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f,
   1.169 -					Mix_EffectDone_t d, void *arg);
   1.170 +extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, Mix_EffectDone_t d, void *arg);
   1.171  
   1.172  
   1.173  /* You may not need to call this explicitly, unless you need to stop an
   1.174 @@ -590,7 +586,7 @@
   1.175  /* Set the current position in the music stream.
   1.176     This returns 0 if successful, or -1 if it failed or isn't implemented.
   1.177     This function is only implemented for MOD music formats (set pattern
   1.178 -   order number) and for OGG, FLAC, MP3_MAD, and MODPLUG music (set 
   1.179 +   order number) and for OGG, FLAC, MP3_MAD, and MODPLUG music (set
   1.180     position in seconds), at the moment.
   1.181  */
   1.182  extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position);
   1.183 @@ -622,8 +618,8 @@
   1.184  extern DECLSPEC void SDLCALL Mix_CloseAudio(void);
   1.185  
   1.186  /* We'll use SDL for reporting errors */
   1.187 -#define Mix_SetError	SDL_SetError
   1.188 -#define Mix_GetError	SDL_GetError
   1.189 +#define Mix_SetError    SDL_SetError
   1.190 +#define Mix_GetError    SDL_GetError
   1.191  
   1.192  /* Ends C function definitions when using C++ */
   1.193  #ifdef __cplusplus
     2.1 --- a/VisualC/resource.h	Tue May 21 21:09:26 2013 -0700
     2.2 +++ b/VisualC/resource.h	Tue May 21 21:21:23 2013 -0700
     2.3 @@ -1,15 +1,15 @@
     2.4 -//{{NO_DEPENDENCIES}}
     2.5 -// Microsoft Developer Studio generated include file.
     2.6 -// Used by Version.rc
     2.7 -//
     2.8 -
     2.9 -// Next default values for new objects
    2.10 -// 
    2.11 -#ifdef APSTUDIO_INVOKED
    2.12 -#ifndef APSTUDIO_READONLY_SYMBOLS
    2.13 -#define _APS_NEXT_RESOURCE_VALUE        101
    2.14 -#define _APS_NEXT_COMMAND_VALUE         40001
    2.15 -#define _APS_NEXT_CONTROL_VALUE         1000
    2.16 -#define _APS_NEXT_SYMED_VALUE           101
    2.17 -#endif
    2.18 -#endif
    2.19 +//{{NO_DEPENDENCIES}}
    2.20 +// Microsoft Developer Studio generated include file.
    2.21 +// Used by Version.rc
    2.22 +//
    2.23 +
    2.24 +// Next default values for new objects
    2.25 +//
    2.26 +#ifdef APSTUDIO_INVOKED
    2.27 +#ifndef APSTUDIO_READONLY_SYMBOLS
    2.28 +#define _APS_NEXT_RESOURCE_VALUE        101
    2.29 +#define _APS_NEXT_COMMAND_VALUE         40001
    2.30 +#define _APS_NEXT_CONTROL_VALUE         1000
    2.31 +#define _APS_NEXT_SYMED_VALUE           101
    2.32 +#endif
    2.33 +#endif
     3.1 --- a/Xcode/playmus/SDLMain.m	Tue May 21 21:09:26 2013 -0700
     3.2 +++ b/Xcode/playmus/SDLMain.m	Tue May 21 21:21:23 2013 -0700
     3.3 @@ -18,21 +18,21 @@
     3.4  @end
     3.5  
     3.6  /* Use this flag to determine whether we use SDLMain.nib or not */
     3.7 -#define		SDL_USE_NIB_FILE	0
     3.8 +#define     SDL_USE_NIB_FILE    0
     3.9  
    3.10  /* Use this flag to determine whether we use CPS (docking) or not */
    3.11 -#define		SDL_USE_CPS		1
    3.12 +#define     SDL_USE_CPS     1
    3.13  #ifdef SDL_USE_CPS
    3.14  /* Portions of CPS.h */
    3.15  typedef struct CPSProcessSerNum
    3.16  {
    3.17 -	UInt32		lo;
    3.18 -	UInt32		hi;
    3.19 +    UInt32      lo;
    3.20 +    UInt32      hi;
    3.21  } CPSProcessSerNum;
    3.22  
    3.23 -extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
    3.24 -extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    3.25 -extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);
    3.26 +extern OSErr    CPSGetCurrentProcess( CPSProcessSerNum *psn);
    3.27 +extern OSErr    CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    3.28 +extern OSErr    CPSSetFrontProcess( CPSProcessSerNum *psn);
    3.29  
    3.30  #endif /* SDL_USE_CPS */
    3.31  
    3.32 @@ -50,7 +50,7 @@
    3.33      dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
    3.34      if (dict)
    3.35          appName = [dict objectForKey: @"CFBundleName"];
    3.36 -    
    3.37 +
    3.38      if (![appName length])
    3.39          appName = [[NSProcessInfo processInfo] processName];
    3.40  
    3.41 @@ -131,10 +131,10 @@
    3.42      NSMenuItem *menuItem;
    3.43      NSString *title;
    3.44      NSString *appName;
    3.45 -    
    3.46 +
    3.47      appName = getApplicationName();
    3.48      appleMenu = [[NSMenu alloc] initWithTitle:@""];
    3.49 -    
    3.50 +
    3.51      /* Add menu items */
    3.52      title = [@"About " stringByAppendingString:appName];
    3.53      [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
    3.54 @@ -154,7 +154,7 @@
    3.55      title = [@"Quit " stringByAppendingString:appName];
    3.56      [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
    3.57  
    3.58 -    
    3.59 +
    3.60      /* Put menu into the menubar */
    3.61      menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
    3.62      [menuItem setSubmenu:appleMenu];
    3.63 @@ -176,17 +176,17 @@
    3.64      NSMenuItem  *menuItem;
    3.65  
    3.66      windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
    3.67 -    
    3.68 +
    3.69      /* "Minimize" item */
    3.70      menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
    3.71      [windowMenu addItem:menuItem];
    3.72      [menuItem release];
    3.73 -    
    3.74 +
    3.75      /* Put menu into the menubar */
    3.76      windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
    3.77      [windowMenuItem setSubmenu:windowMenu];
    3.78      [[NSApp mainMenu] addItem:windowMenuItem];
    3.79 -    
    3.80 +
    3.81      /* Tell the application object that this is now the window menu */
    3.82      [NSApp setWindowsMenu:windowMenu];
    3.83  
    3.84 @@ -198,12 +198,12 @@
    3.85  /* Replacement for NSApplicationMain */
    3.86  static void CustomApplicationMain (int argc, char **argv)
    3.87  {
    3.88 -    NSAutoreleasePool	*pool = [[NSAutoreleasePool alloc] init];
    3.89 -    SDLMain				*sdlMain;
    3.90 +    NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
    3.91 +    SDLMain             *sdlMain;
    3.92  
    3.93      /* Ensure the application object is initialised */
    3.94      [SDLApplication sharedApplication];
    3.95 -    
    3.96 +
    3.97  #ifdef SDL_USE_CPS
    3.98      {
    3.99          CPSProcessSerNum PSN;
   3.100 @@ -223,10 +223,10 @@
   3.101      /* Create SDLMain and make it the app delegate */
   3.102      sdlMain = [[SDLMain alloc] init];
   3.103      [NSApp setDelegate:sdlMain];
   3.104 -    
   3.105 +
   3.106      /* Start the main event loop */
   3.107      [NSApp run];
   3.108 -    
   3.109 +
   3.110      [sdlMain release];
   3.111      [pool release];
   3.112  }
   3.113 @@ -319,27 +319,27 @@
   3.114  
   3.115      bufferSize = selfLen + aStringLen - aRange.length;
   3.116      buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
   3.117 -    
   3.118 +
   3.119      /* Get first part into buffer */
   3.120      localRange.location = 0;
   3.121      localRange.length = aRange.location;
   3.122      [self getCharacters:buffer range:localRange];
   3.123 -    
   3.124 +
   3.125      /* Get middle part into buffer */
   3.126      localRange.location = 0;
   3.127      localRange.length = aStringLen;
   3.128      [aString getCharacters:(buffer+aRange.location) range:localRange];
   3.129 -     
   3.130 +
   3.131      /* Get last part into buffer */
   3.132      localRange.location = aRange.location + aRange.length;
   3.133      localRange.length = selfLen - localRange.location;
   3.134      [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
   3.135 -    
   3.136 +
   3.137      /* Build output string */
   3.138      result = [NSString stringWithCharacters:buffer length:bufferSize];
   3.139 -    
   3.140 +
   3.141      NSDeallocateMemoryPages(buffer, bufferSize);
   3.142 -    
   3.143 +
   3.144      return result;
   3.145  }
   3.146  
     4.1 --- a/Xcode/playwave/SDLMain.m	Tue May 21 21:09:26 2013 -0700
     4.2 +++ b/Xcode/playwave/SDLMain.m	Tue May 21 21:21:23 2013 -0700
     4.3 @@ -18,21 +18,21 @@
     4.4  @end
     4.5  
     4.6  /* Use this flag to determine whether we use SDLMain.nib or not */
     4.7 -#define		SDL_USE_NIB_FILE	0
     4.8 +#define     SDL_USE_NIB_FILE    0
     4.9  
    4.10  /* Use this flag to determine whether we use CPS (docking) or not */
    4.11 -#define		SDL_USE_CPS		1
    4.12 +#define     SDL_USE_CPS     1
    4.13  #ifdef SDL_USE_CPS
    4.14  /* Portions of CPS.h */
    4.15  typedef struct CPSProcessSerNum
    4.16  {
    4.17 -	UInt32		lo;
    4.18 -	UInt32		hi;
    4.19 +    UInt32      lo;
    4.20 +    UInt32      hi;
    4.21  } CPSProcessSerNum;
    4.22  
    4.23 -extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
    4.24 -extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    4.25 -extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);
    4.26 +extern OSErr    CPSGetCurrentProcess( CPSProcessSerNum *psn);
    4.27 +extern OSErr    CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    4.28 +extern OSErr    CPSSetFrontProcess( CPSProcessSerNum *psn);
    4.29  
    4.30  #endif /* SDL_USE_CPS */
    4.31  
    4.32 @@ -50,7 +50,7 @@
    4.33      dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
    4.34      if (dict)
    4.35          appName = [dict objectForKey: @"CFBundleName"];
    4.36 -    
    4.37 +
    4.38      if (![appName length])
    4.39          appName = [[NSProcessInfo processInfo] processName];
    4.40  
    4.41 @@ -131,10 +131,10 @@
    4.42      NSMenuItem *menuItem;
    4.43      NSString *title;
    4.44      NSString *appName;
    4.45 -    
    4.46 +
    4.47      appName = getApplicationName();
    4.48      appleMenu = [[NSMenu alloc] initWithTitle:@""];
    4.49 -    
    4.50 +
    4.51      /* Add menu items */
    4.52      title = [@"About " stringByAppendingString:appName];
    4.53      [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
    4.54 @@ -154,7 +154,7 @@
    4.55      title = [@"Quit " stringByAppendingString:appName];
    4.56      [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
    4.57  
    4.58 -    
    4.59 +
    4.60      /* Put menu into the menubar */
    4.61      menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
    4.62      [menuItem setSubmenu:appleMenu];
    4.63 @@ -176,17 +176,17 @@
    4.64      NSMenuItem  *menuItem;
    4.65  
    4.66      windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
    4.67 -    
    4.68 +
    4.69      /* "Minimize" item */
    4.70      menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
    4.71      [windowMenu addItem:menuItem];
    4.72      [menuItem release];
    4.73 -    
    4.74 +
    4.75      /* Put menu into the menubar */
    4.76      windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
    4.77      [windowMenuItem setSubmenu:windowMenu];
    4.78      [[NSApp mainMenu] addItem:windowMenuItem];
    4.79 -    
    4.80 +
    4.81      /* Tell the application object that this is now the window menu */
    4.82      [NSApp setWindowsMenu:windowMenu];
    4.83  
    4.84 @@ -198,12 +198,12 @@
    4.85  /* Replacement for NSApplicationMain */
    4.86  static void CustomApplicationMain (int argc, char **argv)
    4.87  {
    4.88 -    NSAutoreleasePool	*pool = [[NSAutoreleasePool alloc] init];
    4.89 -    SDLMain				*sdlMain;
    4.90 +    NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
    4.91 +    SDLMain             *sdlMain;
    4.92  
    4.93      /* Ensure the application object is initialised */
    4.94      [SDLApplication sharedApplication];
    4.95 -    
    4.96 +
    4.97  #ifdef SDL_USE_CPS
    4.98      {
    4.99          CPSProcessSerNum PSN;
   4.100 @@ -223,10 +223,10 @@
   4.101      /* Create SDLMain and make it the app delegate */
   4.102      sdlMain = [[SDLMain alloc] init];
   4.103      [NSApp setDelegate:sdlMain];
   4.104 -    
   4.105 +
   4.106      /* Start the main event loop */
   4.107      [NSApp run];
   4.108 -    
   4.109 +
   4.110      [sdlMain release];
   4.111      [pool release];
   4.112  }
   4.113 @@ -319,27 +319,27 @@
   4.114  
   4.115      bufferSize = selfLen + aStringLen - aRange.length;
   4.116      buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
   4.117 -    
   4.118 +
   4.119      /* Get first part into buffer */
   4.120      localRange.location = 0;
   4.121      localRange.length = aRange.location;
   4.122      [self getCharacters:buffer range:localRange];
   4.123 -    
   4.124 +
   4.125      /* Get middle part into buffer */
   4.126      localRange.location = 0;
   4.127      localRange.length = aStringLen;
   4.128      [aString getCharacters:(buffer+aRange.location) range:localRange];
   4.129 -     
   4.130 +
   4.131      /* Get last part into buffer */
   4.132      localRange.location = aRange.location + aRange.length;
   4.133      localRange.length = selfLen - localRange.location;
   4.134      [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
   4.135 -    
   4.136 +
   4.137      /* Build output string */
   4.138      result = [NSString stringWithCharacters:buffer length:bufferSize];
   4.139 -    
   4.140 +
   4.141      NSDeallocateMemoryPages(buffer, bufferSize);
   4.142 -    
   4.143 +
   4.144      return result;
   4.145  }
   4.146  
     5.1 --- a/dynamic_flac.c	Tue May 21 21:09:26 2013 -0700
     5.2 +++ b/dynamic_flac.c	Tue May 21 21:21:23 2013 -0700
     5.3 @@ -19,7 +19,7 @@
     5.4    3. This notice may not be removed or altered from any source distribution.
     5.5  
     5.6    Implementation of the dynamic loading functionality for libFLAC.
     5.7 -	~ Austen Dicken (admin@cvpcs.org)
     5.8 +    ~ Austen Dicken (admin@cvpcs.org)
     5.9  */
    5.10  
    5.11  #ifdef FLAC_MUSIC
    5.12 @@ -29,148 +29,148 @@
    5.13  #include "dynamic_flac.h"
    5.14  
    5.15  flac_loader flac = {
    5.16 -	0, NULL
    5.17 +    0, NULL
    5.18  };
    5.19  
    5.20  #ifdef FLAC_DYNAMIC
    5.21  int Mix_InitFLAC()
    5.22  {
    5.23 -	if ( flac.loaded == 0 ) {
    5.24 -		flac.handle = SDL_LoadObject(FLAC_DYNAMIC);
    5.25 -		if ( flac.handle == NULL ) {
    5.26 -			return -1;
    5.27 -		}
    5.28 -		flac.FLAC__stream_decoder_new =
    5.29 -			(FLAC__StreamDecoder *(*)())
    5.30 -			SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_new");
    5.31 -		if ( flac.FLAC__stream_decoder_new == NULL ) {
    5.32 -			SDL_UnloadObject(flac.handle);
    5.33 -			return -1;
    5.34 -		}
    5.35 -		flac.FLAC__stream_decoder_delete =
    5.36 -			(void (*)(FLAC__StreamDecoder *))
    5.37 -			SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_delete");
    5.38 -		if ( flac.FLAC__stream_decoder_delete == NULL ) {
    5.39 -			SDL_UnloadObject(flac.handle);
    5.40 -			return -1;
    5.41 -		}
    5.42 -		flac.FLAC__stream_decoder_init_stream =
    5.43 -			(FLAC__StreamDecoderInitStatus (*)(
    5.44 -						FLAC__StreamDecoder *,
    5.45 -						FLAC__StreamDecoderReadCallback,
    5.46 -						FLAC__StreamDecoderSeekCallback,
    5.47 -						FLAC__StreamDecoderTellCallback,
    5.48 -						FLAC__StreamDecoderLengthCallback,
    5.49 -						FLAC__StreamDecoderEofCallback,
    5.50 -						FLAC__StreamDecoderWriteCallback,
    5.51 -						FLAC__StreamDecoderMetadataCallback,
    5.52 -						FLAC__StreamDecoderErrorCallback,
    5.53 -						void *))
    5.54 -			SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_init_stream");
    5.55 -		if ( flac.FLAC__stream_decoder_init_stream == NULL ) {
    5.56 -			SDL_UnloadObject(flac.handle);
    5.57 -			return -1;
    5.58 -		}
    5.59 -		flac.FLAC__stream_decoder_finish =
    5.60 -			(FLAC__bool (*)(FLAC__StreamDecoder *))
    5.61 -			SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_finish");
    5.62 -		if ( flac.FLAC__stream_decoder_finish == NULL ) {
    5.63 -			SDL_UnloadObject(flac.handle);
    5.64 -			return -1;
    5.65 -		}
    5.66 -		flac.FLAC__stream_decoder_flush =
    5.67 -			(FLAC__bool (*)(FLAC__StreamDecoder *))
    5.68 -			SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_flush");
    5.69 -		if ( flac.FLAC__stream_decoder_flush == NULL ) {
    5.70 -			SDL_UnloadObject(flac.handle);
    5.71 -			return -1;
    5.72 -		}
    5.73 -		flac.FLAC__stream_decoder_process_single =
    5.74 -			(FLAC__bool (*)(FLAC__StreamDecoder *))
    5.75 -			SDL_LoadFunction(flac.handle,
    5.76 -						"FLAC__stream_decoder_process_single");
    5.77 -		if ( flac.FLAC__stream_decoder_process_single == NULL ) {
    5.78 -			SDL_UnloadObject(flac.handle);
    5.79 -			return -1;
    5.80 -		}
    5.81 -		flac.FLAC__stream_decoder_process_until_end_of_metadata =
    5.82 -			(FLAC__bool (*)(FLAC__StreamDecoder *))
    5.83 -			SDL_LoadFunction(flac.handle,
    5.84 -						"FLAC__stream_decoder_process_until_end_of_metadata");
    5.85 -		if ( flac.FLAC__stream_decoder_process_until_end_of_metadata == NULL ) {
    5.86 -			SDL_UnloadObject(flac.handle);
    5.87 -			return -1;
    5.88 -		}
    5.89 -		flac.FLAC__stream_decoder_process_until_end_of_stream =
    5.90 -			(FLAC__bool (*)(FLAC__StreamDecoder *))
    5.91 -			SDL_LoadFunction(flac.handle,
    5.92 -						"FLAC__stream_decoder_process_until_end_of_stream");
    5.93 -		if ( flac.FLAC__stream_decoder_process_until_end_of_stream == NULL ) {
    5.94 -			SDL_UnloadObject(flac.handle);
    5.95 -			return -1;
    5.96 -		}
    5.97 -		flac.FLAC__stream_decoder_seek_absolute =
    5.98 -			(FLAC__bool (*)(FLAC__StreamDecoder *, FLAC__uint64))
    5.99 -			SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_seek_absolute");
   5.100 -		if ( flac.FLAC__stream_decoder_seek_absolute == NULL ) {
   5.101 -			SDL_UnloadObject(flac.handle);
   5.102 -			return -1;
   5.103 -		}
   5.104 -		flac.FLAC__stream_decoder_get_state =
   5.105 -			(FLAC__StreamDecoderState (*)(const FLAC__StreamDecoder *decoder))
   5.106 -			SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_get_state");
   5.107 -		if ( flac.FLAC__stream_decoder_get_state == NULL ) {
   5.108 -			SDL_UnloadObject(flac.handle);
   5.109 -			return -1;
   5.110 -		}
   5.111 -	}
   5.112 -	++flac.loaded;
   5.113 +    if ( flac.loaded == 0 ) {
   5.114 +        flac.handle = SDL_LoadObject(FLAC_DYNAMIC);
   5.115 +        if ( flac.handle == NULL ) {
   5.116 +            return -1;
   5.117 +        }
   5.118 +        flac.FLAC__stream_decoder_new =
   5.119 +            (FLAC__StreamDecoder *(*)())
   5.120 +            SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_new");
   5.121 +        if ( flac.FLAC__stream_decoder_new == NULL ) {
   5.122 +            SDL_UnloadObject(flac.handle);
   5.123 +            return -1;
   5.124 +        }
   5.125 +        flac.FLAC__stream_decoder_delete =
   5.126 +            (void (*)(FLAC__StreamDecoder *))
   5.127 +            SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_delete");
   5.128 +        if ( flac.FLAC__stream_decoder_delete == NULL ) {
   5.129 +            SDL_UnloadObject(flac.handle);
   5.130 +            return -1;
   5.131 +        }
   5.132 +        flac.FLAC__stream_decoder_init_stream =
   5.133 +            (FLAC__StreamDecoderInitStatus (*)(
   5.134 +                        FLAC__StreamDecoder *,
   5.135 +                        FLAC__StreamDecoderReadCallback,
   5.136 +                        FLAC__StreamDecoderSeekCallback,
   5.137 +                        FLAC__StreamDecoderTellCallback,
   5.138 +                        FLAC__StreamDecoderLengthCallback,
   5.139 +                        FLAC__StreamDecoderEofCallback,
   5.140 +                        FLAC__StreamDecoderWriteCallback,
   5.141 +                        FLAC__StreamDecoderMetadataCallback,
   5.142 +                        FLAC__StreamDecoderErrorCallback,
   5.143 +                        void *))
   5.144 +            SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_init_stream");
   5.145 +        if ( flac.FLAC__stream_decoder_init_stream == NULL ) {
   5.146 +            SDL_UnloadObject(flac.handle);
   5.147 +            return -1;
   5.148 +        }
   5.149 +        flac.FLAC__stream_decoder_finish =
   5.150 +            (FLAC__bool (*)(FLAC__StreamDecoder *))
   5.151 +            SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_finish");
   5.152 +        if ( flac.FLAC__stream_decoder_finish == NULL ) {
   5.153 +            SDL_UnloadObject(flac.handle);
   5.154 +            return -1;
   5.155 +        }
   5.156 +        flac.FLAC__stream_decoder_flush =
   5.157 +            (FLAC__bool (*)(FLAC__StreamDecoder *))
   5.158 +            SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_flush");
   5.159 +        if ( flac.FLAC__stream_decoder_flush == NULL ) {
   5.160 +            SDL_UnloadObject(flac.handle);
   5.161 +            return -1;
   5.162 +        }
   5.163 +        flac.FLAC__stream_decoder_process_single =
   5.164 +            (FLAC__bool (*)(FLAC__StreamDecoder *))
   5.165 +            SDL_LoadFunction(flac.handle,
   5.166 +                        "FLAC__stream_decoder_process_single");
   5.167 +        if ( flac.FLAC__stream_decoder_process_single == NULL ) {
   5.168 +            SDL_UnloadObject(flac.handle);
   5.169 +            return -1;
   5.170 +        }
   5.171 +        flac.FLAC__stream_decoder_process_until_end_of_metadata =
   5.172 +            (FLAC__bool (*)(FLAC__StreamDecoder *))
   5.173 +            SDL_LoadFunction(flac.handle,
   5.174 +                        "FLAC__stream_decoder_process_until_end_of_metadata");
   5.175 +        if ( flac.FLAC__stream_decoder_process_until_end_of_metadata == NULL ) {
   5.176 +            SDL_UnloadObject(flac.handle);
   5.177 +            return -1;
   5.178 +        }
   5.179 +        flac.FLAC__stream_decoder_process_until_end_of_stream =
   5.180 +            (FLAC__bool (*)(FLAC__StreamDecoder *))
   5.181 +            SDL_LoadFunction(flac.handle,
   5.182 +                        "FLAC__stream_decoder_process_until_end_of_stream");
   5.183 +        if ( flac.FLAC__stream_decoder_process_until_end_of_stream == NULL ) {
   5.184 +            SDL_UnloadObject(flac.handle);
   5.185 +            return -1;
   5.186 +        }
   5.187 +        flac.FLAC__stream_decoder_seek_absolute =
   5.188 +            (FLAC__bool (*)(FLAC__StreamDecoder *, FLAC__uint64))
   5.189 +            SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_seek_absolute");
   5.190 +        if ( flac.FLAC__stream_decoder_seek_absolute == NULL ) {
   5.191 +            SDL_UnloadObject(flac.handle);
   5.192 +            return -1;
   5.193 +        }
   5.194 +        flac.FLAC__stream_decoder_get_state =
   5.195 +            (FLAC__StreamDecoderState (*)(const FLAC__StreamDecoder *decoder))
   5.196 +            SDL_LoadFunction(flac.handle, "FLAC__stream_decoder_get_state");
   5.197 +        if ( flac.FLAC__stream_decoder_get_state == NULL ) {
   5.198 +            SDL_UnloadObject(flac.handle);
   5.199 +            return -1;
   5.200 +        }
   5.201 +    }
   5.202 +    ++flac.loaded;
   5.203  
   5.204 -	return 0;
   5.205 +    return 0;
   5.206  }
   5.207  void Mix_QuitFLAC()
   5.208  {
   5.209 -	if ( flac.loaded == 0 ) {
   5.210 -		return;
   5.211 -	}
   5.212 -	if ( flac.loaded == 1 ) {
   5.213 -		SDL_UnloadObject(flac.handle);
   5.214 -	}
   5.215 -	--flac.loaded;
   5.216 +    if ( flac.loaded == 0 ) {
   5.217 +        return;
   5.218 +    }
   5.219 +    if ( flac.loaded == 1 ) {
   5.220 +        SDL_UnloadObject(flac.handle);
   5.221 +    }
   5.222 +    --flac.loaded;
   5.223  }
   5.224  #else
   5.225  int Mix_InitFLAC()
   5.226  {
   5.227 -	if ( flac.loaded == 0 ) {
   5.228 -		flac.FLAC__stream_decoder_new = FLAC__stream_decoder_new;
   5.229 -		flac.FLAC__stream_decoder_delete = FLAC__stream_decoder_delete;
   5.230 -		flac.FLAC__stream_decoder_init_stream =
   5.231 -							FLAC__stream_decoder_init_stream;
   5.232 -		flac.FLAC__stream_decoder_finish = FLAC__stream_decoder_finish;
   5.233 -		flac.FLAC__stream_decoder_flush = FLAC__stream_decoder_flush;
   5.234 -		flac.FLAC__stream_decoder_process_single =
   5.235 -							FLAC__stream_decoder_process_single;
   5.236 -		flac.FLAC__stream_decoder_process_until_end_of_metadata =
   5.237 -							FLAC__stream_decoder_process_until_end_of_metadata;
   5.238 -		flac.FLAC__stream_decoder_process_until_end_of_stream =
   5.239 -							FLAC__stream_decoder_process_until_end_of_stream;
   5.240 -		flac.FLAC__stream_decoder_seek_absolute =
   5.241 -							FLAC__stream_decoder_seek_absolute;
   5.242 -		flac.FLAC__stream_decoder_get_state =
   5.243 -							FLAC__stream_decoder_get_state;
   5.244 -	}
   5.245 -	++flac.loaded;
   5.246 +    if ( flac.loaded == 0 ) {
   5.247 +        flac.FLAC__stream_decoder_new = FLAC__stream_decoder_new;
   5.248 +        flac.FLAC__stream_decoder_delete = FLAC__stream_decoder_delete;
   5.249 +        flac.FLAC__stream_decoder_init_stream =
   5.250 +                            FLAC__stream_decoder_init_stream;
   5.251 +        flac.FLAC__stream_decoder_finish = FLAC__stream_decoder_finish;
   5.252 +        flac.FLAC__stream_decoder_flush = FLAC__stream_decoder_flush;
   5.253 +        flac.FLAC__stream_decoder_process_single =
   5.254 +                            FLAC__stream_decoder_process_single;
   5.255 +        flac.FLAC__stream_decoder_process_until_end_of_metadata =
   5.256 +                            FLAC__stream_decoder_process_until_end_of_metadata;
   5.257 +        flac.FLAC__stream_decoder_process_until_end_of_stream =
   5.258 +                            FLAC__stream_decoder_process_until_end_of_stream;
   5.259 +        flac.FLAC__stream_decoder_seek_absolute =
   5.260 +                            FLAC__stream_decoder_seek_absolute;
   5.261 +        flac.FLAC__stream_decoder_get_state =
   5.262 +                            FLAC__stream_decoder_get_state;
   5.263 +    }
   5.264 +    ++flac.loaded;
   5.265  
   5.266 -	return 0;
   5.267 +    return 0;
   5.268  }
   5.269  void Mix_QuitFLAC()
   5.270  {
   5.271 -	if ( flac.loaded == 0 ) {
   5.272 -		return;
   5.273 -	}
   5.274 -	if ( flac.loaded == 1 ) {
   5.275 -	}
   5.276 -	--flac.loaded;
   5.277 +    if ( flac.loaded == 0 ) {
   5.278 +        return;
   5.279 +    }
   5.280 +    if ( flac.loaded == 1 ) {
   5.281 +    }
   5.282 +    --flac.loaded;
   5.283  }
   5.284  #endif /* FLAC_DYNAMIC */
   5.285  
     6.1 --- a/dynamic_flac.h	Tue May 21 21:09:26 2013 -0700
     6.2 +++ b/dynamic_flac.h	Tue May 21 21:21:23 2013 -0700
     6.3 @@ -20,7 +20,7 @@
     6.4  
     6.5    The following file defines all of the functions/objects used to dynamically
     6.6    link to the libFLAC library.
     6.7 -  	~ Austen Dicken (admin@cvpcs.org)
     6.8 +    ~ Austen Dicken (admin@cvpcs.org)
     6.9  */
    6.10  
    6.11  #ifdef FLAC_MUSIC
    6.12 @@ -28,34 +28,34 @@
    6.13  #include <FLAC/stream_decoder.h>
    6.14  
    6.15  typedef struct {
    6.16 -	int loaded;
    6.17 -	void *handle;
    6.18 -	FLAC__StreamDecoder *(*FLAC__stream_decoder_new)();
    6.19 -	void (*FLAC__stream_decoder_delete)(FLAC__StreamDecoder *decoder);
    6.20 -	FLAC__StreamDecoderInitStatus (*FLAC__stream_decoder_init_stream)(
    6.21 -						FLAC__StreamDecoder *decoder,
    6.22 -						FLAC__StreamDecoderReadCallback read_callback,
    6.23 -						FLAC__StreamDecoderSeekCallback seek_callback,
    6.24 -						FLAC__StreamDecoderTellCallback tell_callback,
    6.25 -						FLAC__StreamDecoderLengthCallback length_callback,
    6.26 -						FLAC__StreamDecoderEofCallback eof_callback,
    6.27 -						FLAC__StreamDecoderWriteCallback write_callback,
    6.28 -						FLAC__StreamDecoderMetadataCallback metadata_callback,
    6.29 -						FLAC__StreamDecoderErrorCallback error_callback,
    6.30 -						void *client_data);
    6.31 -	FLAC__bool (*FLAC__stream_decoder_finish)(FLAC__StreamDecoder *decoder);
    6.32 -	FLAC__bool (*FLAC__stream_decoder_flush)(FLAC__StreamDecoder *decoder);
    6.33 -	FLAC__bool (*FLAC__stream_decoder_process_single)(
    6.34 -						FLAC__StreamDecoder *decoder);
    6.35 -	FLAC__bool (*FLAC__stream_decoder_process_until_end_of_metadata)(
    6.36 -						FLAC__StreamDecoder *decoder);
    6.37 -	FLAC__bool (*FLAC__stream_decoder_process_until_end_of_stream)(
    6.38 -						FLAC__StreamDecoder *decoder);
    6.39 -	FLAC__bool (*FLAC__stream_decoder_seek_absolute)(
    6.40 -						FLAC__StreamDecoder *decoder,
    6.41 -						FLAC__uint64 sample);
    6.42 -	FLAC__StreamDecoderState (*FLAC__stream_decoder_get_state)(
    6.43 -						const FLAC__StreamDecoder *decoder);
    6.44 +    int loaded;
    6.45 +    void *handle;
    6.46 +    FLAC__StreamDecoder *(*FLAC__stream_decoder_new)();
    6.47 +    void (*FLAC__stream_decoder_delete)(FLAC__StreamDecoder *decoder);
    6.48 +    FLAC__StreamDecoderInitStatus (*FLAC__stream_decoder_init_stream)(
    6.49 +                        FLAC__StreamDecoder *decoder,
    6.50 +                        FLAC__StreamDecoderReadCallback read_callback,
    6.51 +                        FLAC__StreamDecoderSeekCallback seek_callback,
    6.52 +                        FLAC__StreamDecoderTellCallback tell_callback,
    6.53 +                        FLAC__StreamDecoderLengthCallback length_callback,
    6.54 +                        FLAC__StreamDecoderEofCallback eof_callback,
    6.55 +                        FLAC__StreamDecoderWriteCallback write_callback,
    6.56 +                        FLAC__StreamDecoderMetadataCallback metadata_callback,
    6.57 +                        FLAC__StreamDecoderErrorCallback error_callback,
    6.58 +                        void *client_data);
    6.59 +    FLAC__bool (*FLAC__stream_decoder_finish)(FLAC__StreamDecoder *decoder);
    6.60 +    FLAC__bool (*FLAC__stream_decoder_flush)(FLAC__StreamDecoder *decoder);
    6.61 +    FLAC__bool (*FLAC__stream_decoder_process_single)(
    6.62 +                        FLAC__StreamDecoder *decoder);
    6.63 +    FLAC__bool (*FLAC__stream_decoder_process_until_end_of_metadata)(
    6.64 +                        FLAC__StreamDecoder *decoder);
    6.65 +    FLAC__bool (*FLAC__stream_decoder_process_until_end_of_stream)(
    6.66 +                        FLAC__StreamDecoder *decoder);
    6.67 +    FLAC__bool (*FLAC__stream_decoder_seek_absolute)(
    6.68 +                        FLAC__StreamDecoder *decoder,
    6.69 +                        FLAC__uint64 sample);
    6.70 +    FLAC__StreamDecoderState (*FLAC__stream_decoder_get_state)(
    6.71 +                        const FLAC__StreamDecoder *decoder);
    6.72  } flac_loader;
    6.73  
    6.74  extern flac_loader flac;
     7.1 --- a/dynamic_fluidsynth.c	Tue May 21 21:09:26 2013 -0700
     7.2 +++ b/dynamic_fluidsynth.c	Tue May 21 21:21:23 2013 -0700
     7.3 @@ -28,60 +28,60 @@
     7.4  #include "dynamic_fluidsynth.h"
     7.5  
     7.6  fluidsynth_loader fluidsynth = {
     7.7 -	0, NULL
     7.8 +    0, NULL
     7.9  };
    7.10  
    7.11  #ifdef FLUIDSYNTH_DYNAMIC
    7.12  #define FLUIDSYNTH_LOADER(FUNC, SIG) \
    7.13 -	fluidsynth.FUNC = (SIG) SDL_LoadFunction(fluidsynth.handle, #FUNC); \
    7.14 -	if (fluidsynth.FUNC == NULL) { SDL_UnloadObject(fluidsynth.handle); return -1; }
    7.15 +    fluidsynth.FUNC = (SIG) SDL_LoadFunction(fluidsynth.handle, #FUNC); \
    7.16 +    if (fluidsynth.FUNC == NULL) { SDL_UnloadObject(fluidsynth.handle); return -1; }
    7.17  #else
    7.18  #define FLUIDSYNTH_LOADER(FUNC, SIG) \
    7.19 -	fluidsynth.FUNC = FUNC;
    7.20 +    fluidsynth.FUNC = FUNC;
    7.21  #endif
    7.22  
    7.23  int Mix_InitFluidSynth()
    7.24  {
    7.25 -	if ( fluidsynth.loaded == 0 ) {
    7.26 +    if ( fluidsynth.loaded == 0 ) {
    7.27  #ifdef FLUIDSYNTH_DYNAMIC
    7.28 -		fluidsynth.handle = SDL_LoadObject(FLUIDSYNTH_DYNAMIC);
    7.29 -		if ( fluidsynth.handle == NULL ) return -1;
    7.30 +        fluidsynth.handle = SDL_LoadObject(FLUIDSYNTH_DYNAMIC);
    7.31 +        if ( fluidsynth.handle == NULL ) return -1;
    7.32  #endif
    7.33  
    7.34 -		FLUIDSYNTH_LOADER(delete_fluid_player, int (*)(fluid_player_t*));
    7.35 -		FLUIDSYNTH_LOADER(delete_fluid_settings, void (*)(fluid_settings_t*));
    7.36 -		FLUIDSYNTH_LOADER(delete_fluid_synth, int (*)(fluid_synth_t*));
    7.37 -		FLUIDSYNTH_LOADER(fluid_player_add, int (*)(fluid_player_t*, const char*));
    7.38 -		FLUIDSYNTH_LOADER(fluid_player_add_mem, int (*)(fluid_player_t*, const void*, size_t));
    7.39 -		FLUIDSYNTH_LOADER(fluid_player_get_status, int (*)(fluid_player_t*));
    7.40 -		FLUIDSYNTH_LOADER(fluid_player_play, int (*)(fluid_player_t*));
    7.41 -		FLUIDSYNTH_LOADER(fluid_player_set_loop, int (*)(fluid_player_t*, int));
    7.42 -		FLUIDSYNTH_LOADER(fluid_player_stop, int (*)(fluid_player_t*));
    7.43 -		FLUIDSYNTH_LOADER(fluid_settings_setnum, int (*)(fluid_settings_t*, const char*, double));
    7.44 -		FLUIDSYNTH_LOADER(fluid_synth_get_settings, fluid_settings_t* (*)(fluid_synth_t*));
    7.45 -		FLUIDSYNTH_LOADER(fluid_synth_set_gain, void (*)(fluid_synth_t*, float));
    7.46 -		FLUIDSYNTH_LOADER(fluid_synth_sfload, int(*)(fluid_synth_t*, const char*, int));
    7.47 -		FLUIDSYNTH_LOADER(fluid_synth_write_s16, int(*)(fluid_synth_t*, int, void*, int, int, void*, int, int));
    7.48 -		FLUIDSYNTH_LOADER(new_fluid_player, fluid_player_t* (*)(fluid_synth_t*));
    7.49 -		FLUIDSYNTH_LOADER(new_fluid_settings, fluid_settings_t* (*)(void));
    7.50 -		FLUIDSYNTH_LOADER(new_fluid_synth, fluid_synth_t* (*)(fluid_settings_t*));
    7.51 -	}
    7.52 -	++fluidsynth.loaded;
    7.53 +        FLUIDSYNTH_LOADER(delete_fluid_player, int (*)(fluid_player_t*));
    7.54 +        FLUIDSYNTH_LOADER(delete_fluid_settings, void (*)(fluid_settings_t*));
    7.55 +        FLUIDSYNTH_LOADER(delete_fluid_synth, int (*)(fluid_synth_t*));
    7.56 +        FLUIDSYNTH_LOADER(fluid_player_add, int (*)(fluid_player_t*, const char*));
    7.57 +        FLUIDSYNTH_LOADER(fluid_player_add_mem, int (*)(fluid_player_t*, const void*, size_t));
    7.58 +        FLUIDSYNTH_LOADER(fluid_player_get_status, int (*)(fluid_player_t*));
    7.59 +        FLUIDSYNTH_LOADER(fluid_player_play, int (*)(fluid_player_t*));
    7.60 +        FLUIDSYNTH_LOADER(fluid_player_set_loop, int (*)(fluid_player_t*, int));
    7.61 +        FLUIDSYNTH_LOADER(fluid_player_stop, int (*)(fluid_player_t*));
    7.62 +        FLUIDSYNTH_LOADER(fluid_settings_setnum, int (*)(fluid_settings_t*, const char*, double));
    7.63 +        FLUIDSYNTH_LOADER(fluid_synth_get_settings, fluid_settings_t* (*)(fluid_synth_t*));
    7.64 +        FLUIDSYNTH_LOADER(fluid_synth_set_gain, void (*)(fluid_synth_t*, float));
    7.65 +        FLUIDSYNTH_LOADER(fluid_synth_sfload, int(*)(fluid_synth_t*, const char*, int));
    7.66 +        FLUIDSYNTH_LOADER(fluid_synth_write_s16, int(*)(fluid_synth_t*, int, void*, int, int, void*, int, int));
    7.67 +        FLUIDSYNTH_LOADER(new_fluid_player, fluid_player_t* (*)(fluid_synth_t*));
    7.68 +        FLUIDSYNTH_LOADER(new_fluid_settings, fluid_settings_t* (*)(void));
    7.69 +        FLUIDSYNTH_LOADER(new_fluid_synth, fluid_synth_t* (*)(fluid_settings_t*));
    7.70 +    }
    7.71 +    ++fluidsynth.loaded;
    7.72  
    7.73 -	return 0;
    7.74 +    return 0;
    7.75  }
    7.76  
    7.77  void Mix_QuitFluidSynth()
    7.78  {
    7.79 -	if ( fluidsynth.loaded == 0 ) {
    7.80 -		return;
    7.81 -	}
    7.82 -	if ( fluidsynth.loaded == 1 ) {
    7.83 +    if ( fluidsynth.loaded == 0 ) {
    7.84 +        return;
    7.85 +    }
    7.86 +    if ( fluidsynth.loaded == 1 ) {
    7.87  #ifdef FLUIDSYNTH_DYNAMIC
    7.88 -		SDL_UnloadObject(fluidsynth.handle);
    7.89 +        SDL_UnloadObject(fluidsynth.handle);
    7.90  #endif
    7.91 -	}
    7.92 -	--fluidsynth.loaded;
    7.93 +    }
    7.94 +    --fluidsynth.loaded;
    7.95  }
    7.96  
    7.97  #endif /* USE_FLUIDSYNTH_MIDI */
     8.1 --- a/dynamic_fluidsynth.h	Tue May 21 21:09:26 2013 -0700
     8.2 +++ b/dynamic_fluidsynth.h	Tue May 21 21:21:23 2013 -0700
     8.3 @@ -27,26 +27,26 @@
     8.4  #include <fluidsynth.h>
     8.5  
     8.6  typedef struct {
     8.7 -	int loaded;
     8.8 -	void *handle;
     8.9 +    int loaded;
    8.10 +    void *handle;
    8.11  
    8.12 -	int (*delete_fluid_player)(fluid_player_t*);
    8.13 -	void (*delete_fluid_settings)(fluid_settings_t*);
    8.14 -	int (*delete_fluid_synth)(fluid_synth_t*);
    8.15 -	int (*fluid_player_add)(fluid_player_t*, const char*);
    8.16 -	int (*fluid_player_add_mem)(fluid_player_t*, const void*, size_t);
    8.17 -	int (*fluid_player_get_status)(fluid_player_t*);
    8.18 -	int (*fluid_player_play)(fluid_player_t*);
    8.19 -	int (*fluid_player_set_loop)(fluid_player_t*, int);
    8.20 -	int (*fluid_player_stop)(fluid_player_t*);
    8.21 -	int (*fluid_settings_setnum)(fluid_settings_t*, const char*, double);
    8.22 -	fluid_settings_t* (*fluid_synth_get_settings)(fluid_synth_t*);
    8.23 -	void (*fluid_synth_set_gain)(fluid_synth_t*, float);
    8.24 -	int (*fluid_synth_sfload)(fluid_synth_t*, const char*, int);
    8.25 -	int (*fluid_synth_write_s16)(fluid_synth_t*, int, void*, int, int, void*, int, int);
    8.26 -	fluid_player_t* (*new_fluid_player)(fluid_synth_t*);
    8.27 -	fluid_settings_t* (*new_fluid_settings)(void);
    8.28 -	fluid_synth_t* (*new_fluid_synth)(fluid_settings_t*);
    8.29 +    int (*delete_fluid_player)(fluid_player_t*);
    8.30 +    void (*delete_fluid_settings)(fluid_settings_t*);
    8.31 +    int (*delete_fluid_synth)(fluid_synth_t*);
    8.32 +    int (*fluid_player_add)(fluid_player_t*, const char*);
    8.33 +    int (*fluid_player_add_mem)(fluid_player_t*, const void*, size_t);
    8.34 +    int (*fluid_player_get_status)(fluid_player_t*);
    8.35 +    int (*fluid_player_play)(fluid_player_t*);
    8.36 +    int (*fluid_player_set_loop)(fluid_player_t*, int);
    8.37 +    int (*fluid_player_stop)(fluid_player_t*);
    8.38 +    int (*fluid_settings_setnum)(fluid_settings_t*, const char*, double);
    8.39 +    fluid_settings_t* (*fluid_synth_get_settings)(fluid_synth_t*);
    8.40 +    void (*fluid_synth_set_gain)(fluid_synth_t*, float);
    8.41 +    int (*fluid_synth_sfload)(fluid_synth_t*, const char*, int);
    8.42 +    int (*fluid_synth_write_s16)(fluid_synth_t*, int, void*, int, int, void*, int, int);
    8.43 +    fluid_player_t* (*new_fluid_player)(fluid_synth_t*);
    8.44 +    fluid_settings_t* (*new_fluid_settings)(void);
    8.45 +    fluid_synth_t* (*new_fluid_synth)(fluid_settings_t*);
    8.46  } fluidsynth_loader;
    8.47  
    8.48  extern fluidsynth_loader fluidsynth;
     9.1 --- a/dynamic_mod.c	Tue May 21 21:09:26 2013 -0700
     9.2 +++ b/dynamic_mod.c	Tue May 21 21:21:23 2013 -0700
     9.3 @@ -26,261 +26,261 @@
     9.4  #include "dynamic_mod.h"
     9.5  
     9.6  mikmod_loader mikmod = {
     9.7 -	0, NULL
     9.8 +    0, NULL
     9.9  };
    9.10  
    9.11  #ifdef MOD_DYNAMIC
    9.12  int Mix_InitMOD()
    9.13  {
    9.14 -	if ( mikmod.loaded == 0 ) {
    9.15 -		mikmod.handle = SDL_LoadObject(MOD_DYNAMIC);
    9.16 -		if ( mikmod.handle == NULL ) {
    9.17 -			return -1;
    9.18 -		}
    9.19 -		mikmod.MikMod_Exit =
    9.20 -			(void (*)(void))
    9.21 -			SDL_LoadFunction(mikmod.handle, "MikMod_Exit");
    9.22 -		if ( mikmod.MikMod_Exit == NULL ) {
    9.23 -			SDL_UnloadObject(mikmod.handle);
    9.24 -			return -1;
    9.25 -		}
    9.26 -		mikmod.MikMod_InfoDriver =
    9.27 -			(CHAR* (*)(void))
    9.28 -			SDL_LoadFunction(mikmod.handle, "MikMod_InfoDriver");
    9.29 -		if ( mikmod.MikMod_InfoDriver == NULL ) {
    9.30 -			SDL_UnloadObject(mikmod.handle);
    9.31 -			return -1;
    9.32 -		}
    9.33 -		mikmod.MikMod_InfoLoader =
    9.34 -			(CHAR* (*)(void))
    9.35 -			SDL_LoadFunction(mikmod.handle, "MikMod_InfoLoader");
    9.36 -		if ( mikmod.MikMod_InfoLoader == NULL ) {
    9.37 -			SDL_UnloadObject(mikmod.handle);
    9.38 -			return -1;
    9.39 -		}
    9.40 -		mikmod.MikMod_Init =
    9.41 -			(BOOL (*)(CHAR*))
    9.42 -			SDL_LoadFunction(mikmod.handle, "MikMod_Init");
    9.43 -		if ( mikmod.MikMod_Init == NULL ) {
    9.44 -			SDL_UnloadObject(mikmod.handle);
    9.45 -			return -1;
    9.46 -		}
    9.47 -		mikmod.MikMod_RegisterAllLoaders =
    9.48 -			(void (*)(void))
    9.49 -			SDL_LoadFunction(mikmod.handle, "MikMod_RegisterAllLoaders");
    9.50 -		if ( mikmod.MikMod_RegisterAllLoaders == NULL ) {
    9.51 -			SDL_UnloadObject(mikmod.handle);
    9.52 -			return -1;
    9.53 -		}
    9.54 -		mikmod.MikMod_RegisterDriver =
    9.55 -			(void (*)(struct MDRIVER*))
    9.56 -			SDL_LoadFunction(mikmod.handle, "MikMod_RegisterDriver");
    9.57 -		if ( mikmod.MikMod_RegisterDriver == NULL ) {
    9.58 -			SDL_UnloadObject(mikmod.handle);
    9.59 -			return -1;
    9.60 -		}
    9.61 -		mikmod.MikMod_errno =
    9.62 -			(int*)
    9.63 -			SDL_LoadFunction(mikmod.handle, "MikMod_errno");
    9.64 -		if ( mikmod.MikMod_errno == NULL ) {
    9.65 -			SDL_UnloadObject(mikmod.handle);
    9.66 -			return -1;
    9.67 -		}
    9.68 -		mikmod.MikMod_strerror =
    9.69 -			(char* (*)(int))
    9.70 -			SDL_LoadFunction(mikmod.handle, "MikMod_strerror");
    9.71 -		if ( mikmod.MikMod_strerror == NULL ) {
    9.72 -			SDL_UnloadObject(mikmod.handle);
    9.73 -			return -1;
    9.74 -		}
    9.75 -		mikmod.MikMod_free =
    9.76 -			(void (*)(void*))
    9.77 -			SDL_LoadFunction(mikmod.handle, "MikMod_free");
    9.78 -		if ( mikmod.MikMod_free == NULL ) {
    9.79 -			/* libmikmod 3.1 and earlier doesn't have it */
    9.80 -			mikmod.MikMod_free = free;
    9.81 -		}
    9.82 -		mikmod.Player_Active =
    9.83 -			(BOOL (*)(void))
    9.84 -			SDL_LoadFunction(mikmod.handle, "Player_Active");
    9.85 -		if ( mikmod.Player_Active == NULL ) {
    9.86 -			SDL_UnloadObject(mikmod.handle);
    9.87 -			return -1;
    9.88 -		}
    9.89 -		mikmod.Player_Free =
    9.90 -			(void (*)(MODULE*))
    9.91 -			SDL_LoadFunction(mikmod.handle, "Player_Free");
    9.92 -		if ( mikmod.Player_Free == NULL ) {
    9.93 -			SDL_UnloadObject(mikmod.handle);
    9.94 -			return -1;
    9.95 -		}
    9.96 -		mikmod.Player_LoadGeneric =
    9.97 -			(MODULE* (*)(MREADER*,int,BOOL))
    9.98 -			SDL_LoadFunction(mikmod.handle, "Player_LoadGeneric");
    9.99 -		if ( mikmod.Player_LoadGeneric == NULL ) {
   9.100 -			SDL_UnloadObject(mikmod.handle);
   9.101 -			return -1;
   9.102 -		}
   9.103 -		mikmod.Player_SetPosition =
   9.104 -			(void (*)(UWORD))
   9.105 -			SDL_LoadFunction(mikmod.handle, "Player_SetPosition");
   9.106 -		if ( mikmod.Player_SetPosition == NULL ) {
   9.107 -			SDL_UnloadObject(mikmod.handle);
   9.108 -			return -1;
   9.109 -		}
   9.110 -		mikmod.Player_SetVolume =
   9.111 -			(void (*)(SWORD))
   9.112 -			SDL_LoadFunction(mikmod.handle, "Player_SetVolume");
   9.113 -		if ( mikmod.Player_SetVolume == NULL ) {
   9.114 -			SDL_UnloadObject(mikmod.handle);
   9.115 -			return -1;
   9.116 -		}
   9.117 -		mikmod.Player_Start =
   9.118 -			(void (*)(MODULE*))
   9.119 -			SDL_LoadFunction(mikmod.handle, "Player_Start");
   9.120 -		if ( mikmod.Player_Start == NULL ) {
   9.121 -			SDL_UnloadObject(mikmod.handle);
   9.122 -			return -1;
   9.123 -		}
   9.124 -		mikmod.Player_Stop =
   9.125 -			(void (*)(void))
   9.126 -			SDL_LoadFunction(mikmod.handle, "Player_Stop");
   9.127 -		if ( mikmod.Player_Stop == NULL ) {
   9.128 -			SDL_UnloadObject(mikmod.handle);
   9.129 -			return -1;
   9.130 -		}
   9.131 -		mikmod.VC_WriteBytes =
   9.132 -			(ULONG (*)(SBYTE*,ULONG))
   9.133 -			SDL_LoadFunction(mikmod.handle, "VC_WriteBytes");
   9.134 -		if ( mikmod.VC_WriteBytes == NULL ) {
   9.135 -			SDL_UnloadObject(mikmod.handle);
   9.136 -			return -1;
   9.137 -		}
   9.138 -		mikmod.drv_nos =
   9.139 -			(MDRIVER*)
   9.140 -			SDL_LoadFunction(mikmod.handle, "drv_nos");
   9.141 -		if ( mikmod.drv_nos == NULL ) {
   9.142 -			SDL_UnloadObject(mikmod.handle);
   9.143 -			return -1;
   9.144 -		}
   9.145 -		mikmod.md_device =
   9.146 -			(UWORD*)
   9.147 -			SDL_LoadFunction(mikmod.handle, "md_device");
   9.148 -		if ( mikmod.md_device == NULL ) {
   9.149 -			SDL_UnloadObject(mikmod.handle);
   9.150 -			return -1;
   9.151 -		}
   9.152 -		mikmod.md_mixfreq =
   9.153 -			(UWORD*)
   9.154 -			SDL_LoadFunction(mikmod.handle, "md_mixfreq");
   9.155 -		if ( mikmod.md_mixfreq == NULL ) {
   9.156 -			SDL_UnloadObject(mikmod.handle);
   9.157 -			return -1;
   9.158 -		}
   9.159 -		mikmod.md_mode =
   9.160 -			(UWORD*)
   9.161 -			SDL_LoadFunction(mikmod.handle, "md_mode");
   9.162 -		if ( mikmod.md_mode == NULL ) {
   9.163 -			SDL_UnloadObject(mikmod.handle);
   9.164 -			return -1;
   9.165 -		}
   9.166 -		mikmod.md_musicvolume =
   9.167 -			(UBYTE*)
   9.168 -			SDL_LoadFunction(mikmod.handle, "md_musicvolume");
   9.169 -		if ( mikmod.md_musicvolume == NULL ) {
   9.170 -			SDL_UnloadObject(mikmod.handle);
   9.171 -			return -1;
   9.172 -		}
   9.173 -		mikmod.md_pansep =
   9.174 -			(UBYTE*)
   9.175 -			SDL_LoadFunction(mikmod.handle, "md_pansep");
   9.176 -		if ( mikmod.md_pansep == NULL ) {
   9.177 -			SDL_UnloadObject(mikmod.handle);
   9.178 -			return -1;
   9.179 -		}
   9.180 -		mikmod.md_reverb =
   9.181 -			(UBYTE*)
   9.182 -			SDL_LoadFunction(mikmod.handle, "md_reverb");
   9.183 -		if ( mikmod.md_reverb == NULL ) {
   9.184 -			SDL_UnloadObject(mikmod.handle);
   9.185 -			return -1;
   9.186 -		}
   9.187 -		mikmod.md_sndfxvolume =
   9.188 -			(UBYTE*)
   9.189 -			SDL_LoadFunction(mikmod.handle, "md_sndfxvolume");
   9.190 -		if ( mikmod.md_sndfxvolume == NULL ) {
   9.191 -			SDL_UnloadObject(mikmod.handle);
   9.192 -			return -1;
   9.193 -		}
   9.194 -		mikmod.md_volume =
   9.195 -			(UBYTE*)
   9.196 -			SDL_LoadFunction(mikmod.handle, "md_volume");
   9.197 -		if ( mikmod.md_volume == NULL ) {
   9.198 -			SDL_UnloadObject(mikmod.handle);
   9.199 -			return -1;
   9.200 -		}
   9.201 -	}
   9.202 -	++mikmod.loaded;
   9.203 +    if ( mikmod.loaded == 0 ) {
   9.204 +        mikmod.handle = SDL_LoadObject(MOD_DYNAMIC);
   9.205 +        if ( mikmod.handle == NULL ) {
   9.206 +            return -1;
   9.207 +        }
   9.208 +        mikmod.MikMod_Exit =
   9.209 +            (void (*)(void))
   9.210 +            SDL_LoadFunction(mikmod.handle, "MikMod_Exit");
   9.211 +        if ( mikmod.MikMod_Exit == NULL ) {
   9.212 +            SDL_UnloadObject(mikmod.handle);
   9.213 +            return -1;
   9.214 +        }
   9.215 +        mikmod.MikMod_InfoDriver =
   9.216 +            (CHAR* (*)(void))
   9.217 +            SDL_LoadFunction(mikmod.handle, "MikMod_InfoDriver");
   9.218 +        if ( mikmod.MikMod_InfoDriver == NULL ) {
   9.219 +            SDL_UnloadObject(mikmod.handle);
   9.220 +            return -1;
   9.221 +        }
   9.222 +        mikmod.MikMod_InfoLoader =
   9.223 +            (CHAR* (*)(void))
   9.224 +            SDL_LoadFunction(mikmod.handle, "MikMod_InfoLoader");
   9.225 +        if ( mikmod.MikMod_InfoLoader == NULL ) {
   9.226 +            SDL_UnloadObject(mikmod.handle);
   9.227 +            return -1;
   9.228 +        }
   9.229 +        mikmod.MikMod_Init =
   9.230 +            (BOOL (*)(CHAR*))
   9.231 +            SDL_LoadFunction(mikmod.handle, "MikMod_Init");
   9.232 +        if ( mikmod.MikMod_Init == NULL ) {
   9.233 +            SDL_UnloadObject(mikmod.handle);
   9.234 +            return -1;
   9.235 +        }
   9.236 +        mikmod.MikMod_RegisterAllLoaders =
   9.237 +            (void (*)(void))
   9.238 +            SDL_LoadFunction(mikmod.handle, "MikMod_RegisterAllLoaders");
   9.239 +        if ( mikmod.MikMod_RegisterAllLoaders == NULL ) {
   9.240 +            SDL_UnloadObject(mikmod.handle);
   9.241 +            return -1;
   9.242 +        }
   9.243 +        mikmod.MikMod_RegisterDriver =
   9.244 +            (void (*)(struct MDRIVER*))
   9.245 +            SDL_LoadFunction(mikmod.handle, "MikMod_RegisterDriver");
   9.246 +        if ( mikmod.MikMod_RegisterDriver == NULL ) {
   9.247 +            SDL_UnloadObject(mikmod.handle);
   9.248 +            return -1;
   9.249 +        }
   9.250 +        mikmod.MikMod_errno =
   9.251 +            (int*)
   9.252 +            SDL_LoadFunction(mikmod.handle, "MikMod_errno");
   9.253 +        if ( mikmod.MikMod_errno == NULL ) {
   9.254 +            SDL_UnloadObject(mikmod.handle);
   9.255 +            return -1;
   9.256 +        }
   9.257 +        mikmod.MikMod_strerror =
   9.258 +            (char* (*)(int))
   9.259 +            SDL_LoadFunction(mikmod.handle, "MikMod_strerror");
   9.260 +        if ( mikmod.MikMod_strerror == NULL ) {
   9.261 +            SDL_UnloadObject(mikmod.handle);
   9.262 +            return -1;
   9.263 +        }
   9.264 +        mikmod.MikMod_free =
   9.265 +            (void (*)(void*))
   9.266 +            SDL_LoadFunction(mikmod.handle, "MikMod_free");
   9.267 +        if ( mikmod.MikMod_free == NULL ) {
   9.268 +            /* libmikmod 3.1 and earlier doesn't have it */
   9.269 +            mikmod.MikMod_free = free;
   9.270 +        }
   9.271 +        mikmod.Player_Active =
   9.272 +            (BOOL (*)(void))
   9.273 +            SDL_LoadFunction(mikmod.handle, "Player_Active");
   9.274 +        if ( mikmod.Player_Active == NULL ) {
   9.275 +            SDL_UnloadObject(mikmod.handle);
   9.276 +            return -1;
   9.277 +        }
   9.278 +        mikmod.Player_Free =
   9.279 +            (void (*)(MODULE*))
   9.280 +            SDL_LoadFunction(mikmod.handle, "Player_Free");
   9.281 +        if ( mikmod.Player_Free == NULL ) {
   9.282 +            SDL_UnloadObject(mikmod.handle);
   9.283 +            return -1;
   9.284 +        }
   9.285 +        mikmod.Player_LoadGeneric =
   9.286 +            (MODULE* (*)(MREADER*,int,BOOL))
   9.287 +            SDL_LoadFunction(mikmod.handle, "Player_LoadGeneric");
   9.288 +        if ( mikmod.Player_LoadGeneric == NULL ) {
   9.289 +            SDL_UnloadObject(mikmod.handle);
   9.290 +            return -1;
   9.291 +        }
   9.292 +        mikmod.Player_SetPosition =
   9.293 +            (void (*)(UWORD))
   9.294 +            SDL_LoadFunction(mikmod.handle, "Player_SetPosition");
   9.295 +        if ( mikmod.Player_SetPosition == NULL ) {
   9.296 +            SDL_UnloadObject(mikmod.handle);
   9.297 +            return -1;
   9.298 +        }
   9.299 +        mikmod.Player_SetVolume =
   9.300 +            (void (*)(SWORD))
   9.301 +            SDL_LoadFunction(mikmod.handle, "Player_SetVolume");
   9.302 +        if ( mikmod.Player_SetVolume == NULL ) {
   9.303 +            SDL_UnloadObject(mikmod.handle);
   9.304 +            return -1;
   9.305 +        }
   9.306 +        mikmod.Player_Start =
   9.307 +            (void (*)(MODULE*))
   9.308 +            SDL_LoadFunction(mikmod.handle, "Player_Start");
   9.309 +        if ( mikmod.Player_Start == NULL ) {
   9.310 +            SDL_UnloadObject(mikmod.handle);
   9.311 +            return -1;
   9.312 +        }
   9.313 +        mikmod.Player_Stop =
   9.314 +            (void (*)(void))
   9.315 +            SDL_LoadFunction(mikmod.handle, "Player_Stop");
   9.316 +        if ( mikmod.Player_Stop == NULL ) {
   9.317 +            SDL_UnloadObject(mikmod.handle);
   9.318 +            return -1;
   9.319 +        }
   9.320 +        mikmod.VC_WriteBytes =
   9.321 +            (ULONG (*)(SBYTE*,ULONG))
   9.322 +            SDL_LoadFunction(mikmod.handle, "VC_WriteBytes");
   9.323 +        if ( mikmod.VC_WriteBytes == NULL ) {
   9.324 +            SDL_UnloadObject(mikmod.handle);
   9.325 +            return -1;
   9.326 +        }
   9.327 +        mikmod.drv_nos =
   9.328 +            (MDRIVER*)
   9.329 +            SDL_LoadFunction(mikmod.handle, "drv_nos");
   9.330 +        if ( mikmod.drv_nos == NULL ) {
   9.331 +            SDL_UnloadObject(mikmod.handle);
   9.332 +            return -1;
   9.333 +        }
   9.334 +        mikmod.md_device =
   9.335 +            (UWORD*)
   9.336 +            SDL_LoadFunction(mikmod.handle, "md_device");
   9.337 +        if ( mikmod.md_device == NULL ) {
   9.338 +            SDL_UnloadObject(mikmod.handle);
   9.339 +            return -1;
   9.340 +        }
   9.341 +        mikmod.md_mixfreq =
   9.342 +            (UWORD*)
   9.343 +            SDL_LoadFunction(mikmod.handle, "md_mixfreq");
   9.344 +        if ( mikmod.md_mixfreq == NULL ) {
   9.345 +            SDL_UnloadObject(mikmod.handle);
   9.346 +            return -1;
   9.347 +        }
   9.348 +        mikmod.md_mode =
   9.349 +            (UWORD*)
   9.350 +            SDL_LoadFunction(mikmod.handle, "md_mode");
   9.351 +        if ( mikmod.md_mode == NULL ) {
   9.352 +            SDL_UnloadObject(mikmod.handle);
   9.353 +            return -1;
   9.354 +        }
   9.355 +        mikmod.md_musicvolume =
   9.356 +            (UBYTE*)
   9.357 +            SDL_LoadFunction(mikmod.handle, "md_musicvolume");
   9.358 +        if ( mikmod.md_musicvolume == NULL ) {
   9.359 +            SDL_UnloadObject(mikmod.handle);
   9.360 +            return -1;
   9.361 +        }
   9.362 +        mikmod.md_pansep =
   9.363 +            (UBYTE*)
   9.364 +            SDL_LoadFunction(mikmod.handle, "md_pansep");
   9.365 +        if ( mikmod.md_pansep == NULL ) {
   9.366 +            SDL_UnloadObject(mikmod.handle);
   9.367 +            return -1;
   9.368 +        }
   9.369 +        mikmod.md_reverb =
   9.370 +            (UBYTE*)
   9.371 +            SDL_LoadFunction(mikmod.handle, "md_reverb");
   9.372 +        if ( mikmod.md_reverb == NULL ) {
   9.373 +            SDL_UnloadObject(mikmod.handle);
   9.374 +            return -1;
   9.375 +        }
   9.376 +        mikmod.md_sndfxvolume =
   9.377 +            (UBYTE*)
   9.378 +            SDL_LoadFunction(mikmod.handle, "md_sndfxvolume");
   9.379 +        if ( mikmod.md_sndfxvolume == NULL ) {
   9.380 +            SDL_UnloadObject(mikmod.handle);
   9.381 +            return -1;
   9.382 +        }
   9.383 +        mikmod.md_volume =
   9.384 +            (UBYTE*)
   9.385 +            SDL_LoadFunction(mikmod.handle, "md_volume");
   9.386 +        if ( mikmod.md_volume == NULL ) {
   9.387 +            SDL_UnloadObject(mikmod.handle);
   9.388 +            return -1;
   9.389 +        }
   9.390 +    }
   9.391 +    ++mikmod.loaded;
   9.392  
   9.393 -	return 0;
   9.394 +    return 0;
   9.395  }
   9.396  void Mix_QuitMOD()
   9.397  {
   9.398 -	if ( mikmod.loaded == 0 ) {
   9.399 -		return;
   9.400 -	}
   9.401 -	if ( mikmod.loaded == 1 ) {
   9.402 -		SDL_UnloadObject(mikmod.handle);
   9.403 -	}
   9.404 -	--mikmod.loaded;
   9.405 +    if ( mikmod.loaded == 0 ) {
   9.406 +        return;
   9.407 +    }
   9.408 +    if ( mikmod.loaded == 1 ) {
   9.409 +        SDL_UnloadObject(mikmod.handle);
   9.410 +    }
   9.411 +    --mikmod.loaded;
   9.412  }
   9.413  #else
   9.414  int Mix_InitMOD()
   9.415  {
   9.416 -	if ( mikmod.loaded == 0 ) {
   9.417 -		mikmod.MikMod_Exit = MikMod_Exit;
   9.418 -		mikmod.MikMod_InfoDriver = MikMod_InfoDriver;
   9.419 -		mikmod.MikMod_InfoLoader = MikMod_InfoLoader;
   9.420 -		mikmod.MikMod_Init = MikMod_Init;
   9.421 -		mikmod.MikMod_RegisterAllLoaders = MikMod_RegisterAllLoaders;
   9.422 -		mikmod.MikMod_RegisterDriver = MikMod_RegisterDriver;
   9.423 -		mikmod.MikMod_errno = &MikMod_errno;
   9.424 -		mikmod.MikMod_strerror = MikMod_strerror;
   9.425 +    if ( mikmod.loaded == 0 ) {
   9.426 +        mikmod.MikMod_Exit = MikMod_Exit;
   9.427 +        mikmod.MikMod_InfoDriver = MikMod_InfoDriver;
   9.428 +        mikmod.MikMod_InfoLoader = MikMod_InfoLoader;
   9.429 +        mikmod.MikMod_Init = MikMod_Init;
   9.430 +        mikmod.MikMod_RegisterAllLoaders = MikMod_RegisterAllLoaders;
   9.431 +        mikmod.MikMod_RegisterDriver = MikMod_RegisterDriver;
   9.432 +        mikmod.MikMod_errno = &MikMod_errno;
   9.433 +        mikmod.MikMod_strerror = MikMod_strerror;
   9.434  #if LIBMIKMOD_VERSION < ((3<<16)|(2<<8))
   9.435 -		mikmod.MikMod_free = free;
   9.436 +        mikmod.MikMod_free = free;
   9.437  #else
   9.438 -		mikmod.MikMod_free = MikMod_free;
   9.439 +        mikmod.MikMod_free = MikMod_free;
   9.440  #endif
   9.441 -		mikmod.Player_Active = Player_Active;
   9.442 -		mikmod.Player_Free = Player_Free;
   9.443 -		mikmod.Player_LoadGeneric = Player_LoadGeneric;
   9.444 -		mikmod.Player_SetPosition = Player_SetPosition;
   9.445 -		mikmod.Player_SetVolume = Player_SetVolume;
   9.446 -		mikmod.Player_Start = Player_Start;
   9.447 -		mikmod.Player_Stop = Player_Stop;
   9.448 -		mikmod.VC_WriteBytes = VC_WriteBytes;
   9.449 -		mikmod.drv_nos = &drv_nos;
   9.450 -		mikmod.md_device = &md_device;
   9.451 -		mikmod.md_mixfreq = &md_mixfreq;
   9.452 -		mikmod.md_mode = &md_mode;
   9.453 -		mikmod.md_musicvolume = &md_musicvolume;
   9.454 -		mikmod.md_pansep = &md_pansep;
   9.455 -		mikmod.md_reverb = &md_reverb;
   9.456 -		mikmod.md_sndfxvolume = &md_sndfxvolume;
   9.457 -		mikmod.md_volume = &md_volume;
   9.458 -	}
   9.459 -	++mikmod.loaded;
   9.460 +        mikmod.Player_Active = Player_Active;
   9.461 +        mikmod.Player_Free = Player_Free;
   9.462 +        mikmod.Player_LoadGeneric = Player_LoadGeneric;
   9.463 +        mikmod.Player_SetPosition = Player_SetPosition;
   9.464 +        mikmod.Player_SetVolume = Player_SetVolume;
   9.465 +        mikmod.Player_Start = Player_Start;
   9.466 +        mikmod.Player_Stop = Player_Stop;
   9.467 +        mikmod.VC_WriteBytes = VC_WriteBytes;
   9.468 +        mikmod.drv_nos = &drv_nos;
   9.469 +        mikmod.md_device = &md_device;
   9.470 +        mikmod.md_mixfreq = &md_mixfreq;
   9.471 +        mikmod.md_mode = &md_mode;
   9.472 +        mikmod.md_musicvolume = &md_musicvolume;
   9.473 +        mikmod.md_pansep = &md_pansep;
   9.474 +        mikmod.md_reverb = &md_reverb;
   9.475 +        mikmod.md_sndfxvolume = &md_sndfxvolume;
   9.476 +        mikmod.md_volume = &md_volume;
   9.477 +    }
   9.478 +    ++mikmod.loaded;
   9.479  
   9.480 -	return 0;
   9.481 +    return 0;
   9.482  }
   9.483  void Mix_QuitMOD()
   9.484  {
   9.485 -	if ( mikmod.loaded == 0 ) {
   9.486 -		return;
   9.487 -	}
   9.488 -	if ( mikmod.loaded == 1 ) {
   9.489 -	}
   9.490 -	--mikmod.loaded;
   9.491 +    if ( mikmod.loaded == 0 ) {
   9.492 +        return;
   9.493 +    }
   9.494 +    if ( mikmod.loaded == 1 ) {
   9.495 +    }
   9.496 +    --mikmod.loaded;
   9.497  }
   9.498  #endif /* MOD_DYNAMIC */
   9.499  
    10.1 --- a/dynamic_mod.h	Tue May 21 21:09:26 2013 -0700
    10.2 +++ b/dynamic_mod.h	Tue May 21 21:21:23 2013 -0700
    10.3 @@ -24,35 +24,35 @@
    10.4  #include "mikmod.h"
    10.5  
    10.6  typedef struct {
    10.7 -	int loaded;
    10.8 -	void *handle;
    10.9 +    int loaded;
   10.10 +    void *handle;
   10.11  
   10.12 -	void (*MikMod_Exit)(void);
   10.13 -	CHAR* (*MikMod_InfoDriver)(void);
   10.14 -	CHAR* (*MikMod_InfoLoader)(void);
   10.15 -	BOOL (*MikMod_Init)(CHAR*);
   10.16 -	void (*MikMod_RegisterAllLoaders)(void);
   10.17 -	void (*MikMod_RegisterDriver)(struct MDRIVER*);
   10.18 -	int* MikMod_errno;
   10.19 -	char* (*MikMod_strerror)(int);
   10.20 -	void (*MikMod_free)(void*);
   10.21 -	BOOL (*Player_Active)(void);
   10.22 -	void (*Player_Free)(MODULE*);
   10.23 -	MODULE* (*Player_LoadGeneric)(MREADER*,int,BOOL);
   10.24 -	void (*Player_SetPosition)(UWORD);
   10.25 -	void (*Player_SetVolume)(SWORD);
   10.26 -	void (*Player_Start)(MODULE*);
   10.27 -	void (*Player_Stop)(void);
   10.28 -	ULONG (*VC_WriteBytes)(SBYTE*,ULONG);
   10.29 -	struct MDRIVER* drv_nos;
   10.30 -	UWORD* md_device;
   10.31 -	UWORD* md_mixfreq;
   10.32 -	UWORD* md_mode;
   10.33 -	UBYTE* md_musicvolume;
   10.34 -	UBYTE* md_pansep;
   10.35 -	UBYTE* md_reverb;
   10.36 -	UBYTE* md_sndfxvolume;
   10.37 -	UBYTE* md_volume;
   10.38 +    void (*MikMod_Exit)(void);
   10.39 +    CHAR* (*MikMod_InfoDriver)(void);
   10.40 +    CHAR* (*MikMod_InfoLoader)(void);
   10.41 +    BOOL (*MikMod_Init)(CHAR*);
   10.42 +    void (*MikMod_RegisterAllLoaders)(void);
   10.43 +    void (*MikMod_RegisterDriver)(struct MDRIVER*);
   10.44 +    int* MikMod_errno;
   10.45 +    char* (*MikMod_strerror)(int);
   10.46 +    void (*MikMod_free)(void*);
   10.47 +    BOOL (*Player_Active)(void);
   10.48 +    void (*Player_Free)(MODULE*);
   10.49 +    MODULE* (*Player_LoadGeneric)(MREADER*,int,BOOL);
   10.50 +    void (*Player_SetPosition)(UWORD);
   10.51 +    void (*Player_SetVolume)(SWORD);
   10.52 +    void (*Player_Start)(MODULE*);
   10.53 +    void (*Player_Stop)(void);
   10.54 +    ULONG (*VC_WriteBytes)(SBYTE*,ULONG);
   10.55 +    struct MDRIVER* drv_nos;
   10.56 +    UWORD* md_device;
   10.57 +    UWORD* md_mixfreq;
   10.58 +    UWORD* md_mode;
   10.59 +    UBYTE* md_musicvolume;
   10.60 +    UBYTE* md_pansep;
   10.61 +    UBYTE* md_reverb;
   10.62 +    UBYTE* md_sndfxvolume;
   10.63 +    UBYTE* md_volume;
   10.64  } mikmod_loader;
   10.65  
   10.66  extern mikmod_loader mikmod;
    11.1 --- a/dynamic_mp3.c	Tue May 21 21:09:26 2013 -0700
    11.2 +++ b/dynamic_mp3.c	Tue May 21 21:21:23 2013 -0700
    11.3 @@ -26,145 +26,145 @@
    11.4  #include "dynamic_mp3.h"
    11.5  
    11.6  smpeg_loader smpeg = {
    11.7 -	0, NULL
    11.8 +    0, NULL
    11.9  };
   11.10  
   11.11  #ifdef MP3_DYNAMIC
   11.12  int Mix_InitMP3()
   11.13  {
   11.14 -	if ( smpeg.loaded == 0 ) {
   11.15 -		smpeg.handle = SDL_LoadObject(MP3_DYNAMIC);
   11.16 -		if ( smpeg.handle == NULL ) {
   11.17 -			return -1;
   11.18 -		}
   11.19 -		smpeg.SMPEG_actualSpec =
   11.20 -			(void (*)( SMPEG *, SDL_AudioSpec * ))
   11.21 -			SDL_LoadFunction(smpeg.handle, "SMPEG_actualSpec");
   11.22 -		if ( smpeg.SMPEG_actualSpec == NULL ) {
   11.23 -			SDL_UnloadObject(smpeg.handle);
   11.24 -			return -1;
   11.25 -		}
   11.26 -		smpeg.SMPEG_delete =
   11.27 -			(void (*)( SMPEG* ))
   11.28 -			SDL_LoadFunction(smpeg.handle, "SMPEG_delete");
   11.29 -		if ( smpeg.SMPEG_delete == NULL ) {
   11.30 -			SDL_UnloadObject(smpeg.handle);
   11.31 -			return -1;
   11.32 -		}
   11.33 -		smpeg.SMPEG_enableaudio =
   11.34 -			(void (*)( SMPEG*, int ))
   11.35 -			SDL_LoadFunction(smpeg.handle, "SMPEG_enableaudio");
   11.36 -		if ( smpeg.SMPEG_enableaudio == NULL ) {
   11.37 -			SDL_UnloadObject(smpeg.handle);
   11.38 -			return -1;
   11.39 -		}
   11.40 -		smpeg.SMPEG_enablevideo =
   11.41 -			(void (*)( SMPEG*, int ))
   11.42 -			SDL_LoadFunction(smpeg.handle, "SMPEG_enablevideo");
   11.43 -		if ( smpeg.SMPEG_enablevideo == NULL ) {
   11.44 -			SDL_UnloadObject(smpeg.handle);
   11.45 -			return -1;
   11.46 -		}
   11.47 -		smpeg.SMPEG_new_rwops =
   11.48 -			(SMPEG* (*)(SDL_RWops *, SMPEG_Info*, int))
   11.49 -			SDL_LoadFunction(smpeg.handle, "SMPEG_new_rwops");
   11.50 -		if ( smpeg.SMPEG_new_rwops == NULL ) {
   11.51 -			SDL_UnloadObject(smpeg.handle);
   11.52 -			return -1;
   11.53 -		}
   11.54 -		smpeg.SMPEG_play =
   11.55 -			(void (*)( SMPEG* ))
   11.56 -			SDL_LoadFunction(smpeg.handle, "SMPEG_play");
   11.57 -		if ( smpeg.SMPEG_play == NULL ) {
   11.58 -			SDL_UnloadObject(smpeg.handle);
   11.59 -			return -1;
   11.60 -		}
   11.61 -		smpeg.SMPEG_playAudio =
   11.62 -			(int (*)( SMPEG *, Uint8 *, int ))
   11.63 -			SDL_LoadFunction(smpeg.handle, "SMPEG_playAudio");
   11.64 -		if ( smpeg.SMPEG_playAudio == NULL ) {
   11.65 -			SDL_UnloadObject(smpeg.handle);
   11.66 -			return -1;
   11.67 -		}
   11.68 -		smpeg.SMPEG_rewind =
   11.69 -			(void (*)( SMPEG* ))
   11.70 -			SDL_LoadFunction(smpeg.handle, "SMPEG_rewind");
   11.71 -		if ( smpeg.SMPEG_rewind == NULL ) {
   11.72 -			SDL_UnloadObject(smpeg.handle);
   11.73 -			return -1;
   11.74 -		}
   11.75 -		smpeg.SMPEG_setvolume =
   11.76 -			(void (*)( SMPEG*, int ))
   11.77 -			SDL_LoadFunction(smpeg.handle, "SMPEG_setvolume");
   11.78 -		if ( smpeg.SMPEG_setvolume == NULL ) {
   11.79 -			SDL_UnloadObject(smpeg.handle);
   11.80 -			return -1;
   11.81 -		}
   11.82 -		smpeg.SMPEG_skip =
   11.83 -			(void (*)( SMPEG*, float ))
   11.84 -			SDL_LoadFunction(smpeg.handle, "SMPEG_skip");
   11.85 -		if ( smpeg.SMPEG_skip == NULL ) {
   11.86 -			SDL_UnloadObject(smpeg.handle);
   11.87 -			return -1;
   11.88 -		}
   11.89 -		smpeg.SMPEG_status =
   11.90 -			(SMPEGstatus (*)( SMPEG* ))
   11.91 -			SDL_LoadFunction(smpeg.handle, "SMPEG_status");
   11.92 -		if ( smpeg.SMPEG_status == NULL ) {
   11.93 -			SDL_UnloadObject(smpeg.handle);
   11.94 -			return -1;
   11.95 -		}
   11.96 -		smpeg.SMPEG_stop =
   11.97 -			(void (*)( SMPEG* ))
   11.98 -			SDL_LoadFunction(smpeg.handle, "SMPEG_stop");
   11.99 -		if ( smpeg.SMPEG_stop == NULL ) {
  11.100 -			SDL_UnloadObject(smpeg.handle);
  11.101 -			return -1;
  11.102 -		}
  11.103 -	}
  11.104 -	++smpeg.loaded;
  11.105 +    if ( smpeg.loaded == 0 ) {
  11.106 +        smpeg.handle = SDL_LoadObject(MP3_DYNAMIC);
  11.107 +        if ( smpeg.handle == NULL ) {
  11.108 +            return -1;
  11.109 +        }
  11.110 +        smpeg.SMPEG_actualSpec =
  11.111 +            (void (*)( SMPEG *, SDL_AudioSpec * ))
  11.112 +            SDL_LoadFunction(smpeg.handle, "SMPEG_actualSpec");
  11.113 +        if ( smpeg.SMPEG_actualSpec == NULL ) {
  11.114 +            SDL_UnloadObject(smpeg.handle);
  11.115 +            return -1;
  11.116 +        }
  11.117 +        smpeg.SMPEG_delete =
  11.118 +            (void (*)( SMPEG* ))
  11.119 +            SDL_LoadFunction(smpeg.handle, "SMPEG_delete");
  11.120 +        if ( smpeg.SMPEG_delete == NULL ) {
  11.121 +            SDL_UnloadObject(smpeg.handle);
  11.122 +            return -1;
  11.123 +        }
  11.124 +        smpeg.SMPEG_enableaudio =
  11.125 +            (void (*)( SMPEG*, int ))
  11.126 +            SDL_LoadFunction(smpeg.handle, "SMPEG_enableaudio");
  11.127 +        if ( smpeg.SMPEG_enableaudio == NULL ) {
  11.128 +            SDL_UnloadObject(smpeg.handle);
  11.129 +            return -1;
  11.130 +        }
  11.131 +        smpeg.SMPEG_enablevideo =
  11.132 +            (void (*)( SMPEG*, int ))
  11.133 +            SDL_LoadFunction(smpeg.handle, "SMPEG_enablevideo");
  11.134 +        if ( smpeg.SMPEG_enablevideo == NULL ) {
  11.135 +            SDL_UnloadObject(smpeg.handle);
  11.136 +            return -1;
  11.137 +        }
  11.138 +        smpeg.SMPEG_new_rwops =
  11.139 +            (SMPEG* (*)(SDL_RWops *, SMPEG_Info*, int))
  11.140 +            SDL_LoadFunction(smpeg.handle, "SMPEG_new_rwops");
  11.141 +        if ( smpeg.SMPEG_new_rwops == NULL ) {
  11.142 +            SDL_UnloadObject(smpeg.handle);
  11.143 +            return -1;
  11.144 +        }
  11.145 +        smpeg.SMPEG_play =
  11.146 +            (void (*)( SMPEG* ))
  11.147 +            SDL_LoadFunction(smpeg.handle, "SMPEG_play");
  11.148 +        if ( smpeg.SMPEG_play == NULL ) {
  11.149 +            SDL_UnloadObject(smpeg.handle);
  11.150 +            return -1;
  11.151 +        }
  11.152 +        smpeg.SMPEG_playAudio =
  11.153 +            (int (*)( SMPEG *, Uint8 *, int ))
  11.154 +            SDL_LoadFunction(smpeg.handle, "SMPEG_playAudio");
  11.155 +        if ( smpeg.SMPEG_playAudio == NULL ) {
  11.156 +            SDL_UnloadObject(smpeg.handle);
  11.157 +            return -1;
  11.158 +        }
  11.159 +        smpeg.SMPEG_rewind =
  11.160 +            (void (*)( SMPEG* ))
  11.161 +            SDL_LoadFunction(smpeg.handle, "SMPEG_rewind");
  11.162 +        if ( smpeg.SMPEG_rewind == NULL ) {
  11.163 +            SDL_UnloadObject(smpeg.handle);
  11.164 +            return -1;
  11.165 +        }
  11.166 +        smpeg.SMPEG_setvolume =
  11.167 +            (void (*)( SMPEG*, int ))
  11.168 +            SDL_LoadFunction(smpeg.handle, "SMPEG_setvolume");
  11.169 +        if ( smpeg.SMPEG_setvolume == NULL ) {
  11.170 +            SDL_UnloadObject(smpeg.handle);
  11.171 +            return -1;
  11.172 +        }
  11.173 +        smpeg.SMPEG_skip =
  11.174 +            (void (*)( SMPEG*, float ))
  11.175 +            SDL_LoadFunction(smpeg.handle, "SMPEG_skip");
  11.176 +        if ( smpeg.SMPEG_skip == NULL ) {
  11.177 +            SDL_UnloadObject(smpeg.handle);
  11.178 +            return -1;
  11.179 +        }
  11.180 +        smpeg.SMPEG_status =
  11.181 +            (SMPEGstatus (*)( SMPEG* ))
  11.182 +            SDL_LoadFunction(smpeg.handle, "SMPEG_status");
  11.183 +        if ( smpeg.SMPEG_status == NULL ) {
  11.184 +            SDL_UnloadObject(smpeg.handle);
  11.185 +            return -1;
  11.186 +        }
  11.187 +        smpeg.SMPEG_stop =
  11.188 +            (void (*)( SMPEG* ))
  11.189 +            SDL_LoadFunction(smpeg.handle, "SMPEG_stop");
  11.190 +        if ( smpeg.SMPEG_stop == NULL ) {
  11.191 +            SDL_UnloadObject(smpeg.handle);
  11.192 +            return -1;
  11.193 +        }
  11.194 +    }
  11.195 +    ++smpeg.loaded;
  11.196  
  11.197 -	return 0;
  11.198 +    return 0;
  11.199  }
  11.200  void Mix_QuitMP3()
  11.201  {
  11.202 -	if ( smpeg.loaded == 0 ) {
  11.203 -		return;
  11.204 -	}
  11.205 -	if ( smpeg.loaded == 1 ) {
  11.206 -		SDL_UnloadObject(smpeg.handle);
  11.207 -	}
  11.208 -	--smpeg.loaded;
  11.209 +    if ( smpeg.loaded == 0 ) {
  11.210 +        return;
  11.211 +    }
  11.212 +    if ( smpeg.loaded == 1 ) {
  11.213 +        SDL_UnloadObject(smpeg.handle);
  11.214 +    }
  11.215 +    --smpeg.loaded;
  11.216  }
  11.217  #else
  11.218  int Mix_InitMP3()
  11.219  {
  11.220 -	if ( smpeg.loaded == 0 ) {
  11.221 -		smpeg.SMPEG_actualSpec = SMPEG_actualSpec;
  11.222 -		smpeg.SMPEG_delete = SMPEG_delete;
  11.223 -		smpeg.SMPEG_enableaudio = SMPEG_enableaudio;
  11.224 -		smpeg.SMPEG_enablevideo = SMPEG_enablevideo;
  11.225 -		smpeg.SMPEG_new_rwops = SMPEG_new_rwops;
  11.226 -		smpeg.SMPEG_play = SMPEG_play;
  11.227 -		smpeg.SMPEG_playAudio = SMPEG_playAudio;
  11.228 -		smpeg.SMPEG_rewind = SMPEG_rewind;
  11.229 -		smpeg.SMPEG_setvolume = SMPEG_setvolume;
  11.230 -		smpeg.SMPEG_skip = SMPEG_skip;
  11.231 -		smpeg.SMPEG_status = SMPEG_status;
  11.232 -		smpeg.SMPEG_stop = SMPEG_stop;
  11.233 -	}
  11.234 -	++smpeg.loaded;
  11.235 +    if ( smpeg.loaded == 0 ) {
  11.236 +        smpeg.SMPEG_actualSpec = SMPEG_actualSpec;
  11.237 +        smpeg.SMPEG_delete = SMPEG_delete;
  11.238 +        smpeg.SMPEG_enableaudio = SMPEG_enableaudio;
  11.239 +        smpeg.SMPEG_enablevideo = SMPEG_enablevideo;
  11.240 +        smpeg.SMPEG_new_rwops = SMPEG_new_rwops;
  11.241 +        smpeg.SMPEG_play = SMPEG_play;
  11.242 +        smpeg.SMPEG_playAudio = SMPEG_playAudio;
  11.243 +        smpeg.SMPEG_rewind = SMPEG_rewind;
  11.244 +        smpeg.SMPEG_setvolume = SMPEG_setvolume;
  11.245 +        smpeg.SMPEG_skip = SMPEG_skip;
  11.246 +        smpeg.SMPEG_status = SMPEG_status;
  11.247 +        smpeg.SMPEG_stop = SMPEG_stop;
  11.248 +    }
  11.249 +    ++smpeg.loaded;
  11.250  
  11.251 -	return 0;
  11.252 +    return 0;
  11.253  }
  11.254  void Mix_QuitMP3()
  11.255  {
  11.256 -	if ( smpeg.loaded == 0 ) {
  11.257 -		return;
  11.258 -	}
  11.259 -	if ( smpeg.loaded == 1 ) {
  11.260 -	}
  11.261 -	--smpeg.loaded;
  11.262 +    if ( smpeg.loaded == 0 ) {
  11.263 +        return;
  11.264 +    }
  11.265 +    if ( smpeg.loaded == 1 ) {
  11.266 +    }
  11.267 +    --smpeg.loaded;
  11.268  }
  11.269  #endif /* MP3_DYNAMIC */
  11.270  
    12.1 --- a/dynamic_mp3.h	Tue May 21 21:09:26 2013 -0700
    12.2 +++ b/dynamic_mp3.h	Tue May 21 21:21:23 2013 -0700
    12.3 @@ -23,20 +23,20 @@
    12.4  #include "smpeg.h"
    12.5  
    12.6  typedef struct {
    12.7 -	int loaded;
    12.8 -	void *handle;
    12.9 -	void (*SMPEG_actualSpec)( SMPEG *mpeg, SDL_AudioSpec *spec );
   12.10 -	void (*SMPEG_delete)( SMPEG* mpeg );
   12.11 -	void (*SMPEG_enableaudio)( SMPEG* mpeg, int enable );
   12.12 -	void (*SMPEG_enablevideo)( SMPEG* mpeg, int enable );
   12.13 -	SMPEG* (*SMPEG_new_rwops)(SDL_RWops *src, SMPEG_Info* info, int sdl_audio);
   12.14 -	void (*SMPEG_play)( SMPEG* mpeg );
   12.15 -	int (*SMPEG_playAudio)( SMPEG *mpeg, Uint8 *stream, int len );
   12.16 -	void (*SMPEG_rewind)( SMPEG* mpeg );
   12.17 -	void (*SMPEG_setvolume)( SMPEG* mpeg, int volume );
   12.18 -	void (*SMPEG_skip)( SMPEG* mpeg, float seconds );
   12.19 -	SMPEGstatus (*SMPEG_status)( SMPEG* mpeg );
   12.20 -	void (*SMPEG_stop)( SMPEG* mpeg );
   12.21 +    int loaded;
   12.22 +    void *handle;
   12.23 +    void (*SMPEG_actualSpec)( SMPEG *mpeg, SDL_AudioSpec *spec );
   12.24 +    void (*SMPEG_delete)( SMPEG* mpeg );
   12.25 +    void (*SMPEG_enableaudio)( SMPEG* mpeg, int enable );
   12.26 +    void (*SMPEG_enablevideo)( SMPEG* mpeg, int enable );
   12.27 +    SMPEG* (*SMPEG_new_rwops)(SDL_RWops *src, SMPEG_Info* info, int sdl_audio);
   12.28 +    void (*SMPEG_play)( SMPEG* mpeg );
   12.29 +    int (*SMPEG_playAudio)( SMPEG *mpeg, Uint8 *stream, int len );
   12.30 +    void (*SMPEG_rewind)( SMPEG* mpeg );
   12.31 +    void (*SMPEG_setvolume)( SMPEG* mpeg, int volume );
   12.32 +    void (*SMPEG_skip)( SMPEG* mpeg, float seconds );
   12.33 +    SMPEGstatus (*SMPEG_status)( SMPEG* mpeg );
   12.34 +    void (*SMPEG_stop)( SMPEG* mpeg );
   12.35  } smpeg_loader;
   12.36  
   12.37  extern smpeg_loader smpeg;
    13.1 --- a/dynamic_ogg.c	Tue May 21 21:09:26 2013 -0700
    13.2 +++ b/dynamic_ogg.c	Tue May 21 21:21:23 2013 -0700
    13.3 @@ -26,105 +26,105 @@
    13.4  #include "dynamic_ogg.h"
    13.5  
    13.6  vorbis_loader vorbis = {
    13.7 -	0, NULL
    13.8 +    0, NULL
    13.9  };
   13.10  
   13.11  #ifdef OGG_DYNAMIC
   13.12  int Mix_InitOgg()
   13.13  {
   13.14 -	if ( vorbis.loaded == 0 ) {
   13.15 -		vorbis.handle = SDL_LoadObject(OGG_DYNAMIC);
   13.16 -		if ( vorbis.handle == NULL ) {
   13.17 -			return -1;
   13.18 -		}
   13.19 -		vorbis.ov_clear =
   13.20 -			(int (*)(OggVorbis_File *))
   13.21 -			SDL_LoadFunction(vorbis.handle, "ov_clear");
   13.22 -		if ( vorbis.ov_clear == NULL ) {
   13.23 -			SDL_UnloadObject(vorbis.handle);
   13.24 -			return -1;
   13.25 -		}
   13.26 -		vorbis.ov_info =
   13.27 -			(vorbis_info *(*)(OggVorbis_File *,int))
   13.28 -			SDL_LoadFunction(vorbis.handle, "ov_info");
   13.29 -		if ( vorbis.ov_info == NULL ) {
   13.30 -			SDL_UnloadObject(vorbis.handle);
   13.31 -			return -1;
   13.32 -		}
   13.33 -		vorbis.ov_open_callbacks =
   13.34 -			(int (*)(void *, OggVorbis_File *, char *, long, ov_callbacks))
   13.35 -			SDL_LoadFunction(vorbis.handle, "ov_open_callbacks");
   13.36 -		if ( vorbis.ov_open_callbacks == NULL ) {
   13.37 -			SDL_UnloadObject(vorbis.handle);
   13.38 -			return -1;
   13.39 -		}
   13.40 -		vorbis.ov_pcm_total =
   13.41 -			(ogg_int64_t (*)(OggVorbis_File *,int))
   13.42 -			SDL_LoadFunction(vorbis.handle, "ov_pcm_total");
   13.43 -		if ( vorbis.ov_pcm_total == NULL ) {
   13.44 -			SDL_UnloadObject(vorbis.handle);
   13.45 -			return -1;
   13.46 -		}
   13.47 -		vorbis.ov_read =
   13.48 +    if ( vorbis.loaded == 0 ) {
   13.49 +        vorbis.handle = SDL_LoadObject(OGG_DYNAMIC);
   13.50 +        if ( vorbis.handle == NULL ) {
   13.51 +            return -1;
   13.52 +        }
   13.53 +        vorbis.ov_clear =
   13.54 +            (int (*)(OggVorbis_File *))
   13.55 +            SDL_LoadFunction(vorbis.handle, "ov_clear");
   13.56 +        if ( vorbis.ov_clear == NULL ) {
   13.57 +            SDL_UnloadObject(vorbis.handle);
   13.58 +            return -1;
   13.59 +        }
   13.60 +        vorbis.ov_info =
   13.61 +            (vorbis_info *(*)(OggVorbis_File *,int))
   13.62 +            SDL_LoadFunction(vorbis.handle, "ov_info");
   13.63 +        if ( vorbis.ov_info == NULL ) {
   13.64 +            SDL_UnloadObject(vorbis.handle);
   13.65 +            return -1;
   13.66 +        }
   13.67 +        vorbis.ov_open_callbacks =
   13.68 +            (int (*)(void *, OggVorbis_File *, char *, long, ov_callbacks))
   13.69 +            SDL_LoadFunction(vorbis.handle, "ov_open_callbacks");
   13.70 +        if ( vorbis.ov_open_callbacks == NULL ) {
   13.71 +            SDL_UnloadObject(vorbis.handle);
   13.72 +            return -1;
   13.73 +        }
   13.74 +        vorbis.ov_pcm_total =
   13.75 +            (ogg_int64_t (*)(OggVorbis_File *,int))
   13.76 +            SDL_LoadFunction(vorbis.handle, "ov_pcm_total");
   13.77 +        if ( vorbis.ov_pcm_total == NULL ) {
   13.78 +            SDL_UnloadObject(vorbis.handle);
   13.79 +            return -1;
   13.80 +        }
   13.81 +        vorbis.ov_read =
   13.82  #ifdef OGG_USE_TREMOR
   13.83 -			(long (*)(OggVorbis_File *,char *,int,int *))
   13.84 +            (long (*)(OggVorbis_File *,char *,int,int *))
   13.85  #else
   13.86 -			(long (*)(OggVorbis_File *,char *,int,int,int,int,int *))
   13.87 +            (long (*)(OggVorbis_File *,char *,int,int,int,int,int *))
   13.88  #endif
   13.89 -			SDL_LoadFunction(vorbis.handle, "ov_read");
   13.90 -		if ( vorbis.ov_read == NULL ) {
   13.91 -			SDL_UnloadObject(vorbis.handle);
   13.92 -			return -1;
   13.93 -		}
   13.94 -		vorbis.ov_time_seek =
   13.95 +            SDL_LoadFunction(vorbis.handle, "ov_read");
   13.96 +        if ( vorbis.ov_read == NULL ) {
   13.97 +            SDL_UnloadObject(vorbis.handle);
   13.98 +            return -1;
   13.99 +        }
  13.100 +        vorbis.ov_time_seek =
  13.101  #ifdef OGG_USE_TREMOR
  13.102 -			(long (*)(OggVorbis_File *,ogg_int64_t))
  13.103 +            (long (*)(OggVorbis_File *,ogg_int64_t))
  13.104  #else
  13.105 -			(int (*)(OggVorbis_File *,double))
  13.106 +            (int (*)(OggVorbis_File *,double))
  13.107  #endif
  13.108 -			SDL_LoadFunction(vorbis.handle, "ov_time_seek");
  13.109 -		if ( vorbis.ov_time_seek == NULL ) {
  13.110 -			SDL_UnloadObject(vorbis.handle);
  13.111 -			return -1;
  13.112 -		}
  13.113 -	}
  13.114 -	++vorbis.loaded;
  13.115 +            SDL_LoadFunction(vorbis.handle, "ov_time_seek");
  13.116 +        if ( vorbis.ov_time_seek == NULL ) {
  13.117 +            SDL_UnloadObject(vorbis.handle);
  13.118 +            return -1;
  13.119 +        }
  13.120 +    }
  13.121 +    ++vorbis.loaded;
  13.122  
  13.123 -	return 0;
  13.124 +    return 0;
  13.125  }
  13.126  void Mix_QuitOgg()
  13.127  {
  13.128 -	if ( vorbis.loaded == 0 ) {
  13.129 -		return;
  13.130 -	}
  13.131 -	if ( vorbis.loaded == 1 ) {
  13.132 -		SDL_UnloadObject(vorbis.handle);
  13.133 -	}
  13.134 -	--vorbis.loaded;
  13.135 +    if ( vorbis.loaded == 0 ) {
  13.136 +        return;
  13.137 +    }
  13.138 +    if ( vorbis.loaded == 1 ) {
  13.139 +        SDL_UnloadObject(vorbis.handle);
  13.140 +    }
  13.141 +    --vorbis.loaded;
  13.142  }
  13.143  #else
  13.144  int Mix_InitOgg()
  13.145  {
  13.146 -	if ( vorbis.loaded == 0 ) {
  13.147 -		vorbis.ov_clear = ov_clear;
  13.148 -		vorbis.ov_info = ov_info;
  13.149 -		vorbis.ov_open_callbacks = ov_open_callbacks;
  13.150 -		vorbis.ov_pcm_total = ov_pcm_total;
  13.151 -		vorbis.ov_read = ov_read;
  13.152 -		vorbis.ov_time_seek = ov_time_seek;
  13.153 -	}
  13.154 -	++vorbis.loaded;
  13.155 +    if ( vorbis.loaded == 0 ) {
  13.156 +        vorbis.ov_clear = ov_clear;
  13.157 +        vorbis.ov_info = ov_info;
  13.158 +        vorbis.ov_open_callbacks = ov_open_callbacks;
  13.159 +        vorbis.ov_pcm_total = ov_pcm_total;
  13.160 +        vorbis.ov_read = ov_read;
  13.161 +        vorbis.ov_time_seek = ov_time_seek;
  13.162 +    }
  13.163 +    ++vorbis.loaded;
  13.164  
  13.165 -	return 0;
  13.166 +    return 0;
  13.167  }
  13.168  void Mix_QuitOgg()
  13.169  {
  13.170 -	if ( vorbis.loaded == 0 ) {
  13.171 -		return;
  13.172 -	}
  13.173 -	if ( vorbis.loaded == 1 ) {
  13.174 -	}
  13.175 -	--vorbis.loaded;
  13.176 +    if ( vorbis.loaded == 0 ) {
  13.177 +        return;
  13.178 +    }
  13.179 +    if ( vorbis.loaded == 1 ) {
  13.180 +    }
  13.181 +    --vorbis.loaded;
  13.182  }
  13.183  #endif /* OGG_DYNAMIC */
  13.184  
    14.1 --- a/dynamic_ogg.h	Tue May 21 21:09:26 2013 -0700
    14.2 +++ b/dynamic_ogg.h	Tue May 21 21:21:23 2013 -0700
    14.3 @@ -27,21 +27,21 @@
    14.4  #endif
    14.5  
    14.6  typedef struct {
    14.7 -	int loaded;
    14.8 -	void *handle;
    14.9 -	int (*ov_clear)(OggVorbis_File *vf);
   14.10 -	vorbis_info *(*ov_info)(OggVorbis_File *vf,int link);
   14.11 -	int (*ov_open_callbacks)(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks);
   14.12 -	ogg_int64_t (*ov_pcm_total)(OggVorbis_File *vf,int i);
   14.13 +    int loaded;
   14.14 +    void *handle;
   14.15 +    int (*ov_clear)(OggVorbis_File *vf);
   14.16 +    vorbis_info *(*ov_info)(OggVorbis_File *vf,int link);
   14.17 +    int (*ov_open_callbacks)(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks);
   14.18 +    ogg_int64_t (*ov_pcm_total)(OggVorbis_File *vf,int i);
   14.19  #ifdef OGG_USE_TREMOR
   14.20 -	long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int *bitstream);
   14.21 +    long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int *bitstream);
   14.22  #else
   14.23 -	long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream);
   14.24 +    long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream);
   14.25  #endif
   14.26  #ifdef OGG_USE_TREMOR
   14.27 -	int (*ov_time_seek)(OggVorbis_File *vf,ogg_int64_t pos);
   14.28 +    int (*ov_time_seek)(OggVorbis_File *vf,ogg_int64_t pos);
   14.29  #else
   14.30 -	int (*ov_time_seek)(OggVorbis_File *vf,double pos);
   14.31 +    int (*ov_time_seek)(OggVorbis_File *vf,double pos);
   14.32  #endif
   14.33  } vorbis_loader;
   14.34  
    15.1 --- a/effect_position.c	Tue May 21 21:09:26 2013 -0700
    15.2 +++ b/effect_position.c	Tue May 21 21:21:23 2013 -0700
    15.3 @@ -42,7 +42,7 @@
    15.4      #include <unistd.h>
    15.5      struct timeval tv1;
    15.6      struct timeval tv2;
    15.7 -    
    15.8 +
    15.9      gettimeofday(&tv1, NULL);
   15.10  
   15.11          ... do your thing here ...
   15.12 @@ -134,19 +134,19 @@
   15.13      if (args->room_angle == 180)
   15.14      for (i = 0; i < len; i += sizeof (Uint8) * 2) {
   15.15          /* must adjust the sample so that 0 is the center */
   15.16 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.17 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.18              * args->right_f) * args->distance_f) + 128);
   15.19          ptr++;
   15.20 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.21 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.22              * args->left_f) * args->distance_f) + 128);
   15.23          ptr++;
   15.24      }
   15.25      else for (i = 0; i < len; i += sizeof (Uint8) * 2) {
   15.26          /* must adjust the sample so that 0 is the center */
   15.27 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.28 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.29              * args->left_f) * args->distance_f) + 128);
   15.30          ptr++;
   15.31 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.32 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.33              * args->right_f) * args->distance_f) + 128);
   15.34          ptr++;
   15.35      }
   15.36 @@ -171,64 +171,64 @@
   15.37      if (args->room_angle == 0)
   15.38      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
   15.39          /* must adjust the sample so that 0 is the center */
   15.40 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.41 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.42              * args->left_f) * args->distance_f) + 128);
   15.43          ptr++;
   15.44 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.45 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.46              * args->right_f) * args->distance_f) + 128);
   15.47          ptr++;
   15.48 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.49 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.50              * args->left_rear_f) * args->distance_f) + 128);
   15.51          ptr++;
   15.52 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.53 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.54              * args->right_rear_f) * args->distance_f) + 128);
   15.55          ptr++;
   15.56      }
   15.57      else if (args->room_angle == 90)
   15.58      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
   15.59          /* must adjust the sample so that 0 is the center */
   15.60 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.61 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.62              * args->right_f) * args->distance_f) + 128);
   15.63          ptr++;
   15.64 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.65 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.66              * args->right_rear_f) * args->distance_f) + 128);
   15.67          ptr++;
   15.68 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.69 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.70              * args->left_f) * args->distance_f) + 128);
   15.71          ptr++;
   15.72 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.73 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.74              * args->left_rear_f) * args->distance_f) + 128);
   15.75          ptr++;
   15.76      }
   15.77      else if (args->room_angle == 180)
   15.78      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
   15.79          /* must adjust the sample so that 0 is the center */
   15.80 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.81 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.82              * args->right_rear_f) * args->distance_f) + 128);
   15.83          ptr++;
   15.84 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.85 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.86              * args->left_rear_f) * args->distance_f) + 128);
   15.87          ptr++;
   15.88 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.89 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.90              * args->right_f) * args->distance_f) + 128);
   15.91          ptr++;
   15.92 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
   15.93 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
   15.94              * args->left_f) * args->distance_f) + 128);
   15.95          ptr++;
   15.96      }
   15.97      else if (args->room_angle == 270)
   15.98      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
   15.99          /* must adjust the sample so that 0 is the center */
  15.100 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.101 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.102              * args->left_rear_f) * args->distance_f) + 128);
  15.103          ptr++;
  15.104 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.105 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.106              * args->left_f) * args->distance_f) + 128);
  15.107          ptr++;
  15.108 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.109 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.110              * args->right_rear_f) * args->distance_f) + 128);
  15.111          ptr++;
  15.112 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.113 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.114              * args->right_f) * args->distance_f) + 128);
  15.115          ptr++;
  15.116      }
  15.117 @@ -255,94 +255,94 @@
  15.118      if (args->room_angle == 0)
  15.119      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
  15.120          /* must adjust the sample so that 0 is the center */
  15.121 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.122 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.123              * args->left_f) * args->distance_f) + 128);
  15.124          ptr++;
  15.125 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.126 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.127              * args->right_f) * args->distance_f) + 128);
  15.128          ptr++;
  15.129 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.130 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.131              * args->left_rear_f) * args->distance_f) + 128);
  15.132          ptr++;
  15.133 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.134 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.135              * args->right_rear_f) * args->distance_f) + 128);
  15.136          ptr++;
  15.137 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.138 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.139              * args->center_f) * args->distance_f) + 128);
  15.140          ptr++;
  15.141 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.142 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.143              * args->lfe_f) * args->distance_f) + 128);
  15.144          ptr++;
  15.145      }
  15.146      else if (args->room_angle == 90)
  15.147      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
  15.148          /* must adjust the sample so that 0 is the center */
  15.149 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.150 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.151              * args->right_f) * args->distance_f) + 128);
  15.152          ptr++;
  15.153 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.154 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.155              * args->right_rear_f) * args->distance_f) + 128);
  15.156          ptr++;
  15.157 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.158 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.159              * args->left_f) * args->distance_f) + 128);
  15.160          ptr++;
  15.161 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.162 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.163              * args->left_rear_f) * args->distance_f) + 128);
  15.164          ptr++;
  15.165 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.166 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.167              * args->right_rear_f) * args->distance_f/2) + 128)
  15.168 -            + (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.169 +            + (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.170              * args->right_f) * args->distance_f/2) + 128);
  15.171          ptr++;
  15.172 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.173 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.174              * args->lfe_f) * args->distance_f) + 128);
  15.175          ptr++;
  15.176      }
  15.177      else if (args->room_angle == 180)
  15.178      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
  15.179          /* must adjust the sample so that 0 is the center */
  15.180 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.181 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.182              * args->right_rear_f) * args->distance_f) + 128);
  15.183          ptr++;
  15.184 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.185 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.186              * args->left_rear_f) * args->distance_f) + 128);
  15.187          ptr++;
  15.188 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.189 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.190              * args->right_f) * args->distance_f) + 128);
  15.191          ptr++;
  15.192 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.193 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.194              * args->left_f) * args->distance_f) + 128);
  15.195          ptr++;
  15.196 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.197 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.198              * args->right_rear_f) * args->distance_f/2) + 128)
  15.199 -            + (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.200 +            + (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.201              * args->left_rear_f) * args->distance_f/2) + 128);
  15.202          ptr++;
  15.203 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.204 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.205              * args->lfe_f) * args->distance_f) + 128);
  15.206          ptr++;
  15.207      }
  15.208      else if (args->room_angle == 270)
  15.209      for (i = 0; i < len; i += sizeof (Uint8) * 6) {
  15.210          /* must adjust the sample so that 0 is the center */
  15.211 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.212 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.213              * args->left_rear_f) * args->distance_f) + 128);
  15.214          ptr++;
  15.215 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.216 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.217              * args->left_f) * args->distance_f) + 128);
  15.218          ptr++;
  15.219 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.220 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.221              * args->right_rear_f) * args->distance_f) + 128);
  15.222          ptr++;
  15.223 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.224 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.225              * args->right_f) * args->distance_f) + 128);
  15.226          ptr++;
  15.227 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.228 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.229              * args->left_f) * args->distance_f/2) + 128)
  15.230 -            + (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.231 +            + (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.232              * args->left_rear_f) * args->distance_f/2) + 128);
  15.233          ptr++;
  15.234 -        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) 
  15.235 +        *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
  15.236              * args->lfe_f) * args->distance_f) + 128);
  15.237          ptr++;
  15.238      }
  15.239 @@ -368,9 +368,9 @@
  15.240      Uint8 *d = ((Uint8 *) _Eff_volume_table) + (256 * args->distance_u8);
  15.241  
  15.242      if (args->room_angle == 180) {
  15.243 -	    Uint8 *temp = l;
  15.244 -	    l = r;
  15.245 -	    r = temp;
  15.246 +        Uint8 *temp = l;
  15.247 +        l = r;
  15.248 +        r = temp;
  15.249      }
  15.250          /*
  15.251           * if there's only a mono channnel, then l[] and r[] are always
  15.252 @@ -462,25 +462,25 @@
  15.253          *ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
  15.254          *ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
  15.255          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
  15.256 -	break;
  15.257 +    break;
  15.258         case 90:
  15.259          *ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
  15.260          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
  15.261          *ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
  15.262          *ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
  15.263 -	break;
  15.264 +    break;
  15.265         case 180:
  15.266          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
  15.267          *ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
  15.268          *ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
  15.269          *ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
  15.270 -	break;
  15.271 +    break;
  15.272         case 270:
  15.273          *ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
  15.274          *ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
  15.275          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
  15.276          *ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
  15.277 -	break;
  15.278 +    break;
  15.279        }
  15.280      }
  15.281  }
  15.282 @@ -510,7 +510,7 @@
  15.283          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
  15.284          *ptr = (Sint8)((((float) *ptr) * args->center_f) * args->distance_f); ptr++;
  15.285          *ptr = (Sint8)((((float) *ptr) * args->lfe_f) * args->distance_f); ptr++;
  15.286 -	break;
  15.287 +    break;
  15.288         case 90:
  15.289          *ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
  15.290          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
  15.291 @@ -519,7 +519,7 @@
  15.292          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f / 2)
  15.293             + (Sint8)((((float) *ptr) * args->right_f) * args->distance_f / 2); ptr++;
  15.294          *ptr = (Sint8)((((float) *ptr) * args->lfe_f) * args->distance_f); ptr++;
  15.295 -	break;
  15.296 +    break;
  15.297         case 180:
  15.298          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
  15.299          *ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
  15.300 @@ -528,7 +528,7 @@
  15.301          *ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f / 2)
  15.302             + (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f / 2); ptr++;
  15.303          *ptr = (Sint8)((((float) *ptr) * args->lfe_f) * args->distance_f); ptr++;
  15.304 -	break;
  15.305 +    break;
  15.306         case 270:
  15.307          *ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
  15.308          *ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
  15.309 @@ -537,7 +537,7 @@
  15.310          *ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f / 2)
  15.311             + (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f / 2); ptr++;
  15.312          *ptr = (Sint8)((((float) *ptr) * args->lfe_f) * args->distance_f); ptr++;
  15.313 -	break;
  15.314 +    break;
  15.315        }
  15.316      }
  15.317  }
  15.318 @@ -562,9 +562,9 @@
  15.319      Sint8 *d = ((Sint8 *) _Eff_volume_table) + (256 * args->distance_u8);
  15.320  
  15.321      if (args->room_angle == 180) {
  15.322 -	    Sint8 *temp = l;
  15.323 -	    l = r;
  15.324 -	    r = temp;
  15.325 +        Sint8 *temp = l;
  15.326 +        l = r;
  15.327 +        r = temp;
  15.328      }
  15.329  
  15.330  
  15.331 @@ -610,20 +610,20 @@
  15.332      for (i = 0; i < len; i += sizeof (Uint16) * 2) {
  15.333          Sint16 sampl = (Sint16) (SDL_SwapLE16(*(ptr+0)) - 32768);
  15.334          Sint16 sampr = (Sint16) (SDL_SwapLE16(*(ptr+1)) - 32768);
  15.335 -        
  15.336 +
  15.337          Uint16 swapl = (Uint16) ((Sint16) (((float) sampl * args->left_f)
  15.338                                      * args->distance_f) + 32768);
  15.339          Uint16 swapr = (Uint16) ((Sint16) (((float) sampr * args->right_f)
  15.340                                      * args->distance_f) + 32768);
  15.341  
  15.342 -	if (args->room_angle == 180) {
  15.343 -        	*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.344 -        	*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.345 -	}
  15.346 -	else {
  15.347 -        	*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.348 -        	*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.349 -	}
  15.350 +    if (args->room_angle == 180) {
  15.351 +            *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.352 +            *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.353 +    }
  15.354 +    else {
  15.355 +            *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.356 +            *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.357 +    }
  15.358      }
  15.359  }
  15.360  static void _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata)
  15.361 @@ -637,7 +637,7 @@
  15.362          Sint16 sampr = (Sint16) (SDL_SwapLE16(*(ptr+1)) - 32768);
  15.363          Sint16 samplr = (Sint16) (SDL_SwapLE16(*(ptr+2)) - 32768);
  15.364          Sint16 samprr = (Sint16) (SDL_SwapLE16(*(ptr+3)) - 32768);
  15.365 -        
  15.366 +
  15.367          Uint16 swapl = (Uint16) ((Sint16) (((float) sampl * args->left_f)
  15.368                                      * args->distance_f) + 32768);
  15.369          Uint16 swapr = (Uint16) ((Sint16) (((float) sampr * args->right_f)
  15.370 @@ -647,32 +647,32 @@
  15.371          Uint16 swaprr = (Uint16) ((Sint16) (((float) samprr * args->right_rear_f)
  15.372                                      * args->distance_f) + 32768);
  15.373  
  15.374 -	switch (args->room_angle) {
  15.375 -		case 0:
  15.376 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.377 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.378 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.379 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.380 -			break;
  15.381 -		case 90:
  15.382 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.383 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.384 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.385 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.386 -			break;
  15.387 -		case 180:
  15.388 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.389 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.390 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.391 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.392 -			break;
  15.393 -		case 270:
  15.394 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.395 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.396 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.397 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.398 -			break;
  15.399 -	}
  15.400 +    switch (args->room_angle) {
  15.401 +        case 0:
  15.402 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.403 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.404 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.405 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.406 +            break;
  15.407 +        case 90:
  15.408 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.409 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.410 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.411 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.412 +            break;
  15.413 +        case 180:
  15.414 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.415 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.416 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.417 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.418 +            break;
  15.419 +        case 270:
  15.420 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.421 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.422 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.423 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.424 +            break;
  15.425 +    }
  15.426      }
  15.427  }
  15.428  static void _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata)
  15.429 @@ -702,40 +702,40 @@
  15.430          Uint16 swapwf = (Uint16) ((Sint16) (((float) sampwf * args->lfe_f)
  15.431                                      * args->distance_f) + 32768);
  15.432  
  15.433 -	switch (args->room_angle) {
  15.434 -		case 0:
  15.435 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.436 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.437 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.438 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.439 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapce);
  15.440 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.441 -			break;
  15.442 -		case 90:
  15.443 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.444 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.445 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.446 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.447 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr)/2 + (Uint16) SDL_SwapLE16(swaprr)/2;
  15.448 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.449 -			break;
  15.450 -		case 180:
  15.451 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.452 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.453 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.454 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.455 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr)/2 + (Uint16) SDL_SwapLE16(swaplr)/2;
  15.456 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.457 -			break;
  15.458 -		case 270:
  15.459 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.460 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.461 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.462 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.463 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapl)/2 + (Uint16) SDL_SwapLE16(swaplr)/2;
  15.464 -        		*(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.465 -			break;
  15.466 -	}
  15.467 +    switch (args->room_angle) {
  15.468 +        case 0:
  15.469 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.470 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.471 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.472 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.473 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapce);
  15.474 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.475 +            break;
  15.476 +        case 90:
  15.477 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.478 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.479 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.480 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.481 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr)/2 + (Uint16) SDL_SwapLE16(swaprr)/2;
  15.482 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.483 +            break;
  15.484 +        case 180:
  15.485 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.486 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.487 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.488 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.489 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr)/2 + (Uint16) SDL_SwapLE16(swaplr)/2;
  15.490 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.491 +            break;
  15.492 +        case 270:
  15.493 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaplr);
  15.494 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl);
  15.495 +                *(ptr++) = (Uint16) SDL_SwapLE16(swaprr);
  15.496 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapr);
  15.497 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapl)/2 + (Uint16) SDL_SwapLE16(swaplr)/2;
  15.498 +                *(ptr++) = (Uint16) SDL_SwapLE16(swapwf);
  15.499 +            break;
  15.500 +    }
  15.501      }
  15.502  }
  15.503  
  15.504 @@ -748,8 +748,8 @@
  15.505  
  15.506  #if 0
  15.507      if (len % (sizeof(Sint16) * 2)) {
  15.508 -	    fprintf(stderr,"Not an even number of frames! len=%d\n", len);
  15.509 -	    return;
  15.510 +        fprintf(stderr,"Not an even number of frames! len=%d\n", len);
  15.511 +        return;
  15.512      }
  15.513  #endif
  15.514  
  15.515 @@ -758,14 +758,14 @@
  15.516                                      args->left_f) * args->distance_f);
  15.517          Sint16 swapr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+1))) *
  15.518                                      args->right_f) * args->distance_f);
  15.519 -	if (args->room_angle == 180) {
  15.520 -        	*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.521 -        	*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.522 -	}
  15.523 -	else {
  15.524 -        	*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.525 -        	*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.526 -	}
  15.527 +    if (args->room_angle == 180) {
  15.528 +            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.529 +            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.530 +    }
  15.531 +    else {
  15.532 +            *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.533 +            *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.534 +    }
  15.535      }
  15.536  }
  15.537  static void _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata)
  15.538 @@ -784,32 +784,32 @@
  15.539                                      args->left_rear_f) * args->distance_f);
  15.540          Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+2))) *
  15.541                                      args->right_rear_f) * args->distance_f);
  15.542 -	switch (args->room_angle) {
  15.543 -		case 0:
  15.544 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.545 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.546 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.547 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.548 -			break;
  15.549 -		case 90:
  15.550 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.551 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.552 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.553 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.554 -			break;
  15.555 -		case 180:
  15.556 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.557 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.558 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.559 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.560 -			break;
  15.561 -		case 270:
  15.562 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.563 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.564 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.565 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.566 -			break;
  15.567 -	}
  15.568 +    switch (args->room_angle) {
  15.569 +        case 0:
  15.570 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.571 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.572 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.573 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.574 +            break;
  15.575 +        case 90:
  15.576 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.577 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.578 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.579 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.580 +            break;
  15.581 +        case 180:
  15.582 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.583 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.584 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.585 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.586 +            break;
  15.587 +        case 270:
  15.588 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.589 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.590 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.591 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.592 +            break;
  15.593 +    }
  15.594      }
  15.595  }
  15.596  
  15.597 @@ -833,40 +833,40 @@
  15.598                                      args->center_f) * args->distance_f);
  15.599          Sint16 swapwf = (Sint16) ((((float) (Sint16) SDL_SwapLE16(*(ptr+5))) *
  15.600                                      args->lfe_f) * args->distance_f);
  15.601 -	switch (args->room_angle) {
  15.602 -		case 0:
  15.603 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.604 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.605 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.606 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.607 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapce);
  15.608 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.609 -			break;
  15.610 -		case 90:
  15.611 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.612 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.613 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.614 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.615 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr)/2 + (Sint16) SDL_SwapLE16(swaprr)/2;
  15.616 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.617 -			break;
  15.618 -		case 180:
  15.619 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.620 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.621 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.622 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.623 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr)/2 + (Sint16) SDL_SwapLE16(swaplr)/2;
  15.624 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.625 -			break;
  15.626 -		case 270:
  15.627 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.628 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.629 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.630 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.631 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapl)/2 + (Sint16) SDL_SwapLE16(swaplr)/2;
  15.632 -        		*(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.633 -			break;
  15.634 -	}
  15.635 +    switch (args->room_angle) {
  15.636 +        case 0:
  15.637 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.638 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.639 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.640 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.641 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapce);
  15.642 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.643 +            break;
  15.644 +        case 90:
  15.645 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.646 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.647 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.648 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.649 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr)/2 + (Sint16) SDL_SwapLE16(swaprr)/2;
  15.650 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.651 +            break;
  15.652 +        case 180:
  15.653 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.654 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.655 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.656 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.657 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr)/2 + (Sint16) SDL_SwapLE16(swaplr)/2;
  15.658 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.659 +            break;
  15.660 +        case 270:
  15.661 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaplr);
  15.662 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl);
  15.663 +                *(ptr++) = (Sint16) SDL_SwapLE16(swaprr);
  15.664 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapr);
  15.665 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapl)/2 + (Sint16) SDL_SwapLE16(swaplr)/2;
  15.666 +                *(ptr++) = (Sint16) SDL_SwapLE16(swapwf);
  15.667 +            break;
  15.668 +    }
  15.669      }
  15.670  }
  15.671  
  15.672 @@ -880,20 +880,20 @@
  15.673      for (i = 0; i < len; i += sizeof (Sint16) * 2) {
  15.674          Sint16 sampl = (Sint16) (SDL_SwapBE16(*(ptr+0)) - 32768);
  15.675          Sint16 sampr = (Sint16) (SDL_SwapBE16(*(ptr+1)) - 32768);
  15.676 -        
  15.677 +
  15.678          Uint16 swapl = (Uint16) ((Sint16) (((float) sampl * args->left_f)
  15.679                                      * args->distance_f) + 32768);
  15.680          Uint16 swapr = (Uint16) ((Sint16) (((float) sampr * args->right_f)
  15.681                                      * args->distance_f) + 32768);
  15.682  
  15.683 -	if (args->room_angle == 180) {
  15.684 -        	*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.685 -        	*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.686 -	}
  15.687 -	else {
  15.688 -        	*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.689 -        	*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.690 -	}
  15.691 +    if (args->room_angle == 180) {
  15.692 +            *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.693 +            *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.694 +    }
  15.695 +    else {
  15.696 +            *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.697 +            *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.698 +    }
  15.699      }
  15.700  }
  15.701  static void _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata)
  15.702 @@ -908,7 +908,7 @@
  15.703          Sint16 sampr = (Sint16) (SDL_SwapBE16(*(ptr+1)) - 32768);
  15.704          Sint16 samplr = (Sint16) (SDL_SwapBE16(*(ptr+2)) - 32768);
  15.705          Sint16 samprr = (Sint16) (SDL_SwapBE16(*(ptr+3)) - 32768);
  15.706 -        
  15.707 +
  15.708          Uint16 swapl = (Uint16) ((Sint16) (((float) sampl * args->left_f)
  15.709                                      * args->distance_f) + 32768);
  15.710          Uint16 swapr = (Uint16) ((Sint16) (((float) sampr * args->right_f)
  15.711 @@ -918,32 +918,32 @@
  15.712          Uint16 swaprr = (Uint16) ((Sint16) (((float) samprr * args->right_rear_f)
  15.713                                      * args->distance_f) + 32768);
  15.714  
  15.715 -	switch (args->room_angle) {
  15.716 -		case 0:
  15.717 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.718 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.719 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.720 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.721 -			break;
  15.722 -		case 90:
  15.723 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.724 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.725 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.726 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.727 -			break;
  15.728 -		case 180:
  15.729 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.730 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.731 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.732 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.733 -			break;
  15.734 -		case 270:
  15.735 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.736 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.737 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.738 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.739 -			break;
  15.740 -	}
  15.741 +    switch (args->room_angle) {
  15.742 +        case 0:
  15.743 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.744 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.745 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.746 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.747 +            break;
  15.748 +        case 90:
  15.749 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.750 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.751 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.752 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.753 +            break;
  15.754 +        case 180:
  15.755 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.756 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.757 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.758 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.759 +            break;
  15.760 +        case 270:
  15.761 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.762 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.763 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.764 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.765 +            break;
  15.766 +    }
  15.767      }
  15.768  }
  15.769  static void _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata)
  15.770 @@ -960,7 +960,7 @@
  15.771          Sint16 samprr = (Sint16) (SDL_SwapBE16(*(ptr+3)) - 32768);
  15.772          Sint16 sampce = (Sint16) (SDL_SwapBE16(*(ptr+4)) - 32768);
  15.773          Sint16 sampwf = (Sint16) (SDL_SwapBE16(*(ptr+5)) - 32768);
  15.774 -        
  15.775 +
  15.776          Uint16 swapl = (Uint16) ((Sint16) (((float) sampl * args->left_f)
  15.777                                      * args->distance_f) + 32768);
  15.778          Uint16 swapr = (Uint16) ((Sint16) (((float) sampr * args->right_f)
  15.779 @@ -974,40 +974,40 @@
  15.780          Uint16 swapwf = (Uint16) ((Sint16) (((float) sampwf * args->lfe_f)
  15.781                                      * args->distance_f) + 32768);
  15.782  
  15.783 -	switch (args->room_angle) {
  15.784 -		case 0:
  15.785 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.786 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.787 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.788 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.789 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapce);
  15.790 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.791 -			break;
  15.792 -		case 90:
  15.793 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.794 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.795 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.796 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.797 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr)/2 + (Uint16) SDL_SwapBE16(swaprr)/2;
  15.798 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.799 -			break;
  15.800 -		case 180:
  15.801 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.802 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.803 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.804 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.805 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr)/2 + (Uint16) SDL_SwapBE16(swaplr)/2;
  15.806 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.807 -			break;
  15.808 -		case 270:
  15.809 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.810 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.811 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.812 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.813 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapl)/2 + (Uint16) SDL_SwapBE16(swaplr)/2;
  15.814 -        		*(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.815 -			break;
  15.816 -	}
  15.817 +    switch (args->room_angle) {
  15.818 +        case 0:
  15.819 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.820 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.821 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.822 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.823 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapce);
  15.824 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.825 +            break;
  15.826 +        case 90:
  15.827 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.828 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.829 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.830 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.831 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr)/2 + (Uint16) SDL_SwapBE16(swaprr)/2;
  15.832 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.833 +            break;
  15.834 +        case 180:
  15.835 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.836 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.837 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.838 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.839 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr)/2 + (Uint16) SDL_SwapBE16(swaplr)/2;
  15.840 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.841 +            break;
  15.842 +        case 270:
  15.843 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaplr);
  15.844 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl);
  15.845 +                *(ptr++) = (Uint16) SDL_SwapBE16(swaprr);
  15.846 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapr);
  15.847 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapl)/2 + (Uint16) SDL_SwapBE16(swaplr)/2;
  15.848 +                *(ptr++) = (Uint16) SDL_SwapBE16(swapwf);
  15.849 +            break;
  15.850 +    }
  15.851      }
  15.852  }
  15.853  
  15.854 @@ -1043,32 +1043,32 @@
  15.855                                      args->left_rear_f) * args->distance_f);
  15.856          Sint16 swaprr = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+3))) *
  15.857                                      args->right_rear_f) * args->distance_f);
  15.858 -	switch (args->room_angle) {
  15.859 -		case 0:
  15.860 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.861 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.862 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.863 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.864 -			break;
  15.865 -		case 90:
  15.866 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.867 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.868 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.869 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.870 -			break;
  15.871 -		case 180:
  15.872 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.873 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.874 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.875 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.876 -			break;
  15.877 -		case 270:
  15.878 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.879 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.880 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.881 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.882 -			break;
  15.883 -	}
  15.884 +    switch (args->room_angle) {
  15.885 +        case 0:
  15.886 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.887 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.888 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.889 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.890 +            break;
  15.891 +        case 90:
  15.892 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.893 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.894 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.895 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.896 +            break;
  15.897 +        case 180:
  15.898 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.899 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.900 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.901 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.902 +            break;
  15.903 +        case 270:
  15.904 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.905 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.906 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.907 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.908 +            break;
  15.909 +    }
  15.910      }
  15.911  }
  15.912  static void _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata)
  15.913 @@ -1092,40 +1092,40 @@
  15.914          Sint16 swapwf = (Sint16) ((((float) (Sint16) SDL_SwapBE16(*(ptr+5))) *
  15.915                                      args->lfe_f) * args->distance_f);
  15.916  
  15.917 -	switch (args->room_angle) {
  15.918 -		case 0:
  15.919 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.920 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.921 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.922 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.923 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapce);
  15.924 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.925 -			break;
  15.926 -		case 90:
  15.927 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.928 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.929 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.930 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.931 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr)/2 + (Sint16) SDL_SwapBE16(swaprr)/2;
  15.932 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.933 -			break;
  15.934 -		case 180:
  15.935 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.936 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.937 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.938 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.939 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr)/2 + (Sint16) SDL_SwapBE16(swaplr)/2;
  15.940 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.941 -			break;
  15.942 -		case 270:
  15.943 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.944 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.945 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.946 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.947 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapl)/2 + (Sint16) SDL_SwapBE16(swaplr)/2;
  15.948 -        		*(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.949 -			break;
  15.950 -	}
  15.951 +    switch (args->room_angle) {
  15.952 +        case 0:
  15.953 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.954 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.955 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.956 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.957 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapce);
  15.958 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.959 +            break;
  15.960 +        case 90:
  15.961 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.962 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.963 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.964 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.965 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr)/2 + (Sint16) SDL_SwapBE16(swaprr)/2;
  15.966 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.967 +            break;
  15.968 +        case 180:
  15.969 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.970 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.971 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.972 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.973 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr)/2 + (Sint16) SDL_SwapBE16(swaplr)/2;
  15.974 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.975 +            break;
  15.976 +        case 270:
  15.977 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaplr);
  15.978 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl);
  15.979 +                *(ptr++) = (Sint16) SDL_SwapBE16(swaprr);
  15.980 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
  15.981 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapl)/2 + (Sint16) SDL_SwapBE16(swaplr)/2;
  15.982 +                *(ptr++) = (Sint16) SDL_SwapBE16(swapwf);
  15.983 +            break;
  15.984 +    }
  15.985      }
  15.986  }
  15.987  
  15.988 @@ -1192,95 +1192,95 @@
  15.989  
  15.990      switch (format) {
  15.991          case AUDIO_U8:
  15.992 -	    switch (channels) {
  15.993 -		    case 1:
  15.994 -		    case 2:
  15.995 -            		f = (_Eff_build_volume_table_u8()) ? _Eff_position_table_u8 :
  15.996 -                                                 		_Eff_position_u8;
  15.997 -	    		break;
  15.998 -	    	    case 4:
  15.999 +        switch (channels) {
 15.1000 +            case 1:
 15.1001 +            case 2:
 15.1002 +                    f = (_Eff_build_volume_table_u8()) ? _Eff_position_table_u8 :
 15.1003 +                                                        _Eff_position_u8;
 15.1004 +                break;
 15.1005 +                case 4:
 15.1006                          f = _Eff_position_u8_c4;
 15.1007 -	    		break;
 15.1008 -	    	    case 6:
 15.1009 +                break;
 15.1010 +                case 6:
 15.1011                          f = _Eff_position_u8_c6;
 15.1012 -	    		break;
 15.1013 -	    }
 15.1014 +                break;
 15.1015 +        }
 15.1016              break;
 15.1017  
 15.1018          case AUDIO_S8:
 15.1019 -	    switch (channels) {
 15.1020 -		    case 1:
 15.1021 -		    case 2:
 15.1022 -            		f = (_Eff_build_volume_table_s8()) ? _Eff_position_table_s8 :
 15.1023 -                                                 		_Eff_position_s8;
 15.1024 -	    		break;
 15.1025 -	    	    case 4:
 15.1026 +        switch (channels) {
 15.1027 +            case 1:
 15.1028 +            case 2:
 15.1029 +                    f = (_Eff_build_volume_table_s8()) ? _Eff_position_table_s8 :
 15.1030 +                                                        _Eff_position_s8;
 15.1031 +                break;
 15.1032 +                case 4:
 15.1033                          f = _Eff_position_s8_c4;
 15.1034 -	    		break;
 15.1035 -	    	    case 6:
 15.1036 +                break;
 15.1037 +                case 6:
 15.1038                          f = _Eff_position_s8_c6;
 15.1039 -	    		break;
 15.1040 -	    }
 15.1041 +                break;
 15.1042 +        }
 15.1043              break;
 15.1044  
 15.1045          case AUDIO_U16LSB:
 15.1046 -	    switch (channels) {
 15.1047 -		    case 1:
 15.1048 -		    case 2:
 15.1049 -            		f = _Eff_position_u16lsb;
 15.1050 -	    		break;
 15.1051 -	    	    case 4:
 15.1052 -            		f = _Eff_position_u16lsb_c4;
 15.1053 -	    		break;
 15.1054 -	    	    case 6:
 15.1055 -            		f = _Eff_position_u16lsb_c6;
 15.1056 -	    		break;
 15.1057 -	    }
 15.1058 +        switch (channels) {
 15.1059 +            case 1:
 15.1060 +            case 2:
 15.1061 +                    f = _Eff_position_u16lsb;
 15.1062 +                break;
 15.1063 +                case 4:
 15.1064 +                    f = _Eff_position_u16lsb_c4;
 15.1065 +                break;
 15.1066 +                case 6:
 15.1067 +                    f = _Eff_position_u16lsb_c6;
 15.1068 +                break;
 15.1069 +        }
 15.1070              break;
 15.1071  
 15.1072          case AUDIO_S16LSB:
 15.1073 -	    switch (channels) {
 15.1074 -		    case 1:
 15.1075 -		    case 2:
 15.1076 -            		f = _Eff_position_s16lsb;
 15.1077 -	    		break;
 15.1078 -	    	    case 4:
 15.1079 -            		f = _Eff_position_s16lsb_c4;
 15.1080 -	    		break;
 15.1081 -	    	    case 6:
 15.1082 -            		f = _Eff_position_s16lsb_c6;
 15.1083 -	    		break;
 15.1084 -	    }
 15.1085 +        switch (channels) {
 15.1086 +            case 1:
 15.1087 +            case 2:
 15.1088 +                    f = _Eff_position_s16lsb;
 15.1089 +                break;
 15.1090 +                case 4:
 15.1091 +                    f = _Eff_position_s16lsb_c4;
 15.1092 +                break;
 15.1093 +                case 6:
 15.1094 +                    f = _Eff_position_s16lsb_c6;
 15.1095 +                break;
 15.1096 +        }
 15.1097              break;
 15.1098  
 15.1099          case AUDIO_U16MSB:
 15.1100 -	    switch (channels) {
 15.1101 -		    case 1:
 15.1102 -		    case 2:
 15.1103 -            		f = _Eff_position_u16msb;
 15.1104 -	    		break;
 15.1105 -	    	    case 4:
 15.1106 -            		f = _Eff_position_u16msb_c4;
 15.1107 -	    		break;
 15.1108 -	    	    case 6:
 15.1109 -            		f = _Eff_position_u16msb_c6;
 15.1110 -	    		break;
 15.1111 -	    }
 15.1112 +        switch (channels) {
 15.1113 +            case 1:
 15.1114 +            case 2:
 15.1115 +                    f = _Eff_position_u16msb;
 15.1116 +                break;
 15.1117 +                case 4:
 15.1118 +                    f = _Eff_position_u16msb_c4;
 15.1119 +                break;
 15.1120 +                case 6:
 15.1121 +                    f = _Eff_position_u16msb_c6;
 15.1122 +                break;
 15.1123 +        }
 15.1124              break;
 15.1125  
 15.1126          case AUDIO_S16MSB:
 15.1127 -	    switch (channels) {
 15.1128 -		    case 1:
 15.1129 -		    case 2:
 15.1130 -            		f = _Eff_position_s16msb;
 15.1131 -	    		break;
 15.1132 -	    	    case 4:
 15.1133 -            		f = _Eff_position_s16msb_c4;
 15.1134 -	    		break;
 15.1135 -	    	    case 6:
 15.1136 -            		f = _Eff_position_s16msb_c6;
 15.1137 -	    		break;
 15.1138 -	    }
 15.1139 +        switch (channels) {
 15.1140 +            case 1:
 15.1141 +            case 2:
 15.1142 +                    f = _Eff_position_s16msb;
 15.1143 +                break;
 15.1144 +                case 4:
 15.1145 +                    f = _Eff_position_s16msb_c4;
 15.1146 +                break;
 15.1147 +                case 6:
 15.1148 +                    f = _Eff_position_s16msb_c6;
 15.1149 +                break;
 15.1150 +        }
 15.1151              break;
 15.1152  
 15.1153          default:
 15.1154 @@ -1388,34 +1388,34 @@
 15.1155      if (center < 0) center = 0; if (center > 255) center = 255;
 15.1156  
 15.1157      if (room_angle == 90) {
 15.1158 -    	speaker_amplitude[0] = (Uint8)left_rear;
 15.1159 -    	speaker_amplitude[1] = (Uint8)left;
 15.1160 -    	speaker_amplitude[2] = (Uint8)right_rear;
 15.1161 -    	speaker_amplitude[3] = (Uint8)right;
 15.1162 +        speaker_amplitude[0] = (Uint8)left_rear;
 15.1163 +        speaker_amplitude[1] = (Uint8)left;
 15.1164 +        speaker_amplitude[2] = (Uint8)right_rear;
 15.1165 +        speaker_amplitude[3] = (Uint8)right;
 15.1166      }
 15.1167      else if (room_angle == 180) {
 15.1168 -	if (channels == 2) {
 15.1169 -    	    speaker_amplitude[0] = (Uint8)right;
 15.1170 -    	    speaker_amplitude[1] = (Uint8)left;
 15.1171 -	}
 15.1172 -	else {
 15.1173 -    	    speaker_amplitude[0] = (Uint8)right_rear;
 15.1174 -    	    speaker_amplitude[1] = (Uint8)left_rear;
 15.1175 -    	    speaker_amplitude[2] = (Uint8)right;
 15.1176 -    	    speaker_amplitude[3] = (Uint8)left;
 15.1177 -	}
 15.1178 +    if (channels == 2) {
 15.1179 +            speaker_amplitude[0] = (Uint8)right;
 15.1180 +            speaker_amplitude[1] = (Uint8)left;
 15.1181 +    }
 15.1182 +    else {
 15.1183 +            speaker_amplitude[0] = (Uint8)right_rear;
 15.1184 +            speaker_amplitude[1] = (Uint8)left_rear;
 15.1185 +            speaker_amplitude[2] = (Uint8)right;
 15.1186 +            speaker_amplitude[3] = (Uint8)left;
 15.1187 +    }
 15.1188      }
 15.1189      else if (room_angle == 270) {
 15.1190 -    	speaker_amplitude[0] = (Uint8)right;
 15.1191 -    	speaker_amplitude[1] = (Uint8)right_rear;
 15.1192 -    	speaker_amplitude[2] = (Uint8)left;
 15.1193 -    	speaker_amplitude[3] = (Uint8)left_rear;
 15.1194 +        speaker_amplitude[0] = (Uint8)right;
 15.1195 +        speaker_amplitude[1] = (Uint8)right_rear;
 15.1196 +        speaker_amplitude[2] = (Uint8)left;
 15.1197 +        speaker_amplitude[3] = (Uint8)left_rear;
 15.1198      }
 15.1199      else {
 15.1200 -    	speaker_amplitude[0] = (Uint8)left;
 15.1201 -    	speaker_amplitude[1] = (Uint8)right;
 15.1202 -    	speaker_amplitude[2] = (Uint8)left_rear;
 15.1203 -    	speaker_amplitude[3] = (Uint8)right_rear;
 15.1204 +        speaker_amplitude[0] = (Uint8)left;
 15.1205 +        speaker_amplitude[1] = (Uint8)right;
 15.1206 +        speaker_amplitude[2] = (Uint8)left_rear;
 15.1207 +        speaker_amplitude[3] = (Uint8)right_rear;
 15.1208      }
 15.1209      speaker_amplitude[4] = (Uint8)center;
 15.1210      speaker_amplitude[5] = 255;
 15.1211 @@ -1438,13 +1438,13 @@
 15.1212  
 15.1213      if (channels > 2) {
 15.1214          /* left = right = 255 => angle = 0, to unregister effect as when channels = 2 */
 15.1215 -    	/* left = 255 =>  angle = -90;  left = 0 => angle = +89 */
 15.1216 +        /* left = 255 =>  angle = -90;  left = 0 => angle = +89 */
 15.1217          int angle = 0;
 15.1218          if ((left != 255) || (right != 255)) {
 15.1219 -	    angle = (int)left;
 15.1220 -    	    angle = 127 - angle;
 15.1221 -	    angle = -angle;
 15.1222 -    	    angle = angle * 90 / 128; /* Make it larger for more effect? */
 15.1223 +        angle = (int)left;
 15.1224 +            angle = 127 - angle;
 15.1225 +        angle = -angle;
 15.1226 +            angle = angle * 90 / 128; /* Make it larger for more effect? */
 15.1227          }
 15.1228          return( Mix_SetPosition(channel, angle, 0) );
 15.1229      }
 15.1230 @@ -1571,18 +1571,18 @@
 15.1231  
 15.1232      if (channels == 2)
 15.1233      {
 15.1234 -	if (angle > 180)
 15.1235 -		room_angle = 180; /* exchange left and right channels */
 15.1236 -	else room_angle = 0;
 15.1237 +    if (angle > 180)
 15.1238 +        room_angle = 180; /* exchange left and right channels */
 15.1239 +    else room_angle = 0;
 15.1240      }
 15.1241  
 15.1242      if (channels == 4 || channels == 6)
 15.1243      {
 15.1244 -	if (angle > 315) room_angle = 0;
 15.1245 -	else if (angle > 225) room_angle = 270;
 15.1246 -	else if (angle > 135) room_angle = 180;
 15.1247 -	else if (angle > 45) room_angle = 90;
 15.1248 -	else room_angle = 0;
 15.1249 +    if (angle > 315) room_angle = 0;
 15.1250 +    else if (angle > 225) room_angle = 270;
 15.1251 +    else if (angle > 135) room_angle = 180;
 15.1252 +    else if (angle > 45) room_angle = 90;
 15.1253 +    else room_angle = 0;
 15.1254      }
 15.1255  
 15.1256  
    16.1 --- a/effect_stereoreverse.c	Tue May 21 21:09:26 2013 -0700
    16.2 +++ b/effect_stereoreverse.c	Tue May 21 21:21:23 2013 -0700
    16.3 @@ -40,7 +40,7 @@
    16.4      #include <unistd.h>
    16.5      struct timeval tv1;
    16.6      struct timeval tv2;
    16.7 -    
    16.8 +
    16.9      gettimeofday(&tv1, NULL);
   16.10  
   16.11          ... do your thing here ...
    17.1 --- a/effects_internal.c	Tue May 21 21:09:26 2013 -0700
    17.2 +++ b/effects_internal.c	Tue May 21 21:21:23 2013 -0700
    17.3 @@ -78,7 +78,7 @@
    17.4              _Eff_volume_table = (void *) rc;
    17.5              for (volume = 0; volume < 256; volume++) {
    17.6                  for (sample = -128; sample < 128; sample ++) {
    17.7 -                    *rc = (Uint8)(((float) sample) * ((float) volume / 255.0)) 
    17.8 +                    *rc = (Uint8)(((float) sample) * ((float) volume / 255.0))
    17.9                          + 128;
   17.10                      rc++;
   17.11                  }
    18.1 --- a/fluidsynth.c	Tue May 21 21:09:26 2013 -0700
    18.2 +++ b/fluidsynth.c	Tue May 21 21:21:23 2013 -0700
    18.3 @@ -36,187 +36,187 @@
    18.4  
    18.5  int fluidsynth_check_soundfont(const char *path, void *data)
    18.6  {
    18.7 -	FILE *file = fopen(path, "r");
    18.8 +    FILE *file = fopen(path, "r");
    18.9  
   18.10 -	if (file) {
   18.11 -		fclose(file);
   18.12 -		return 1;
   18.13 -	} else {
   18.14 -		Mix_SetError("Failed to access the SoundFont %s", path);
   18.15 -		return 0;
   18.16 -	}
   18.17 +    if (file) {
   18.18 +        fclose(file);
   18.19 +        return 1;
   18.20 +    } else {
   18.21 +        Mix_SetError("Failed to access the SoundFont %s", path);
   18.22 +        return 0;
   18.23 +    }
   18.24  }
   18.25  
   18.26  int fluidsynth_load_soundfont(const char *path, void *data)
   18.27  {
   18.28 -	/* If this fails, it's too late to try Timidity so pray that at least one works. */
   18.29 -	fluidsynth.fluid_synth_sfload((fluid_synth_t*) data, path, 1);
   18.30 -	return 1;
   18.31 +    /* If this fails, it's too late to try Timidity so pray that at least one works. */
   18.32 +    fluidsynth.fluid_synth_sfload((fluid_synth_t*) data, path, 1);
   18.33 +    return 1;
   18.34  }
   18.35  
   18.36  int fluidsynth_init(SDL_AudioSpec *mixer)
   18.37  {
   18.38 -	if (!Mix_EachSoundFont(fluidsynth_check_soundfont, NULL))
   18.39 -		return -1;
   18.40 +    if (!Mix_EachSoundFont(fluidsynth_check_soundfont, NULL))
   18.41 +        return -1;
   18.42  
   18.43 -	format = mixer->format;
   18.44 -	channels = mixer->channels;
   18.45 -	freq = mixer->freq;
   18.46 +    format = mixer->format;
   18.47 +    channels = mixer->channels;
   18.48 +    freq = mixer->freq;
   18.49  
   18.50 -	return 0;
   18.51 +    return 0;
   18.52  }
   18.53  
   18.54  static FluidSynthMidiSong *fluidsynth_loadsong_common(int (*function)(FluidSynthMidiSong*, void*), void *data)
   18.55  {
   18.56 -	FluidSynthMidiSong *song;
   18.57 -	fluid_settings_t *settings = NULL;
   18.58 +    FluidSynthMidiSong *song;
   18.59 +    fluid_settings_t *settings = NULL;
   18.60  
   18.61 -	if (!Mix_Init(MIX_INIT_FLUIDSYNTH)) {
   18.62 -		return NULL;
   18.63 -	}
   18.64 +    if (!Mix_Init(MIX_INIT_FLUIDSYNTH)) {
   18.65 +        return NULL;
   18.66 +    }
   18.67  
   18.68 -	if ((song = SDL_malloc(sizeof(FluidSynthMidiSong)))) {
   18.69 -		memset(song, 0, sizeof(FluidSynthMidiSong));
   18.70 +    if ((song = SDL_malloc(sizeof(FluidSynthMidiSong)))) {
   18.71 +        memset(song, 0, sizeof(FluidSynthMidiSong));
   18.72  
   18.73 -		if (SDL_BuildAudioCVT(&song->convert, AUDIO_S16, 2, freq, format, channels, freq) >= 0) {
   18.74 -			if ((settings = fluidsynth.new_fluid_settings())) {
   18.75 -				fluidsynth.fluid_settings_setnum(settings, "synth.sample-rate", (double) freq);
   18.76 +        if (SDL_BuildAudioCVT(&song->convert, AUDIO_S16, 2, freq, format, channels, freq) >= 0) {
   18.77 +            if ((settings = fluidsynth.new_fluid_settings())) {
   18.78 +                fluidsynth.fluid_settings_setnum(settings, "synth.sample-rate", (double) freq);
   18.79  
   18.80 -				if ((song->synth = fluidsynth.new_fluid_synth(settings))) {
   18.81 -					if (Mix_EachSoundFont(fluidsynth_load_soundfont, (void*) song->synth)) {
   18.82 -						if ((song->player = fluidsynth.new_fluid_player(song->synth))) {
   18.83 -							if (function(song, data)) return song;
   18.84 -							fluidsynth.delete_fluid_player(song->player);
   18.85 -						} else {
   18.86 -							Mix_SetError("Failed to create FluidSynth player");
   18.87 -						}
   18.88 -					}
   18.89 -					fluidsynth.delete_fluid_synth(song->synth);
   18.90 -				} else {
   18.91 -					Mix_SetError("Failed to create FluidSynth synthesizer");
   18.92 -				}
   18.93 -				fluidsynth.delete_fluid_settings(settings);
   18.94 -			} else {
   18.95 -				Mix_SetError("Failed to create FluidSynth settings");
   18.96 -			}
   18.97 -		} else {
   18.98 -			Mix_SetError("Failed to set up audio conversion");
   18.99 -		}
  18.100 -		SDL_free(song);
  18.101 -	} else {
  18.102 -		Mix_SetError("Insufficient memory for song");
  18.103 -	}
  18.104 -	return NULL;
  18.105 +                if ((song->synth = fluidsynth.new_fluid_synth(settings))) {
  18.106 +                    if (Mix_EachSoundFont(fluidsynth_load_soundfont, (void*) song->synth)) {
  18.107 +                        if ((song->player = fluidsynth.new_fluid_player(song->synth))) {
  18.108 +                            if (function(song, data)) return song;
  18.109 +                            fluidsynth.delete_fluid_player(song->player);
  18.110 +                        } else {
  18.111 +                            Mix_SetError("Failed to create FluidSynth player");
  18.112 +                        }
  18.113 +                    }
  18.114 +                    fluidsynth.delete_fluid_synth(song->synth);
  18.115 +                } else {
  18.116 +                    Mix_SetError("Failed to create FluidSynth synthesizer");
  18.117 +                }
  18.118 +                fluidsynth.delete_fluid_settings(settings);
  18.119 +            } else {
  18.120 +                Mix_SetError("Failed to create FluidSynth settings");
  18.121 +            }
  18.122 +        } else {
  18.123 +            Mix_SetError("Failed to set up audio conversion");
  18.124 +        }
  18.125 +        SDL_free(song);
  18.126 +    } else {
  18.127 +        Mix_SetError("Insufficient memory for song");
  18.128 +    }
  18.129 +    return NULL;
  18.130  }
  18.131  
  18.132  static int fluidsynth_loadsong_RW_internal(FluidSynthMidiSong *song, void *data)
  18.133  {
  18.134 -	off_t offset;
  18.135 -	size_t size;
  18.136 -	char *buffer;
  18.137 -	SDL_RWops *rw = (SDL_RWops*) data;
  18.138 +    off_t offset;
  18.139 +    size_t size;
  18.140 +    char *buffer;
  18.141 +    SDL_RWops *rw = (SDL_RWops*) data;
  18.142  
  18.143 -	offset = SDL_RWtell(rw);
  18.144 -	SDL_RWseek(rw, 0, RW_SEEK_END);
  18.145 -	size = SDL_RWtell(rw) - offset;
  18.146 -	SDL_RWseek(rw, offset, RW_SEEK_SET);
  18.147 +    offset = SDL_RWtell(rw);
  18.148 +    SDL_RWseek(rw, 0, RW_SEEK_END);
  18.149 +    size = SDL_RWtell(rw) - offset;
  18.150 +    SDL_RWseek(rw, offset, RW_SEEK_SET);
  18.151  
  18.152 -	if ((buffer = (char*) SDL_malloc(size))) {
  18.153 -		if(SDL_RWread(rw, buffer, size, 1) == 1) {
  18.154 -			if (fluidsynth.fluid_player_add_mem(song->player, buffer, size) == FLUID_OK) {
  18.155 -				return 1;
  18.156 -			} else {
  18.157 -				Mix_SetError("FluidSynth failed to load in-memory song");
  18.158 -			}
  18.159 -		} else {
  18.160 -			Mix_SetError("Failed to read in-memory song");
  18.161 -		}
  18.162 -		SDL_free(buffer);
  18.163 -	} else {
  18.164 -		Mix_SetError("Insufficient memory for song");
  18.165 -	}
  18.166 -	return 0;
  18.167 +    if ((buffer = (char*) SDL_malloc(size))) {
  18.168 +        if(SDL_RWread(rw, buffer, size, 1) == 1) {
  18.169 +            if (fluidsynth.fluid_player_add_mem(song->player, buffer, size) == FLUID_OK) {
  18.170 +                return 1;
  18.171 +            } else {
  18.172 +                Mix_SetError("FluidSynth failed to load in-memory song");
  18.173 +            }
  18.174 +        } else {
  18.175 +            Mix_SetError("Failed to read in-memory song");
  18.176 +        }
  18.177 +        SDL_free(buffer);
  18.178 +    } else {
  18.179 +        Mix_SetError("Insufficient memory for song");
  18.180 +    }
  18.181 +    return 0;
  18.182  }
  18.183  
  18.184  FluidSynthMidiSong *fluidsynth_loadsong_RW(SDL_RWops *rw, int freerw)
  18.185  {
  18.186 -	FluidSynthMidiSong *song;
  18.187 +    FluidSynthMidiSong *song;
  18.188  
  18.189 -	song = fluidsynth_loadsong_common(fluidsynth_loadsong_RW_internal, (void*) rw);
  18.190 -	if (freerw) {
  18.191 -		SDL_RWclose(rw);
  18.192 -	}
  18.193 -	return song;
  18.194 +    song = fluidsynth_loadsong_common(fluidsynth_loadsong_RW_internal, (void*) rw);
  18.195 +    if (freerw) {
  18.196 +        SDL_RWclose(rw);
  18.197 +    }
  18.198 +    return song;
  18.199  }
  18.200  
  18.201  void fluidsynth_freesong(FluidSynthMidiSong *song)
  18.202  {
  18.203 -	if (!song) return;
  18.204 -	fluidsynth.delete_fluid_player(song->player);
  18.205 -	fluidsynth.delete_fluid_settings(fluidsynth.fluid_synth_get_settings(song->synth));
  18.206 -	fluidsynth.delete_fluid_synth(song->synth);
  18.207 -	SDL_free(song);
  18.208 +    if (!song) return;
  18.209 +    fluidsynth.delete_fluid_player(song->player);
  18.210 +    fluidsynth.delete_fluid_settings(fluidsynth.fluid_synth_get_settings(song->synth));
  18.211 +    fluidsynth.delete_fluid_synth(song->synth);
  18.212 +    SDL_free(song);
  18.213  }
  18.214  
  18.215  void fluidsynth_start(FluidSynthMidiSong *song)
  18.216  {
  18.217 -	fluidsynth.fluid_player_set_loop(song->player, 1);
  18.218 -	fluidsynth.fluid_player_play(song->player);
  18.219 +    fluidsynth.fluid_player_set_loop(song->player, 1);
  18.220 +    fluidsynth.fluid_player_play(song->player);
  18.221  }
  18.222  
  18.223  void fluidsynth_stop(FluidSynthMidiSong *song)
  18.224  {
  18.225 -	fluidsynth.fluid_player_stop(song->player);
  18.226 +    fluidsynth.fluid_player_stop(song->player);
  18.227  }
  18.228  
  18.229  int fluidsynth_active(FluidSynthMidiSong *song)
  18.230  {
  18.231 -	return fluidsynth.fluid_player_get_status(song->player) == FLUID_PLAYER_PLAYING ? 1 : 0;
  18.232 +    return fluidsynth.fluid_player_get_status(song->player) == FLUID_PLAYER_PLAYING ? 1 : 0;
  18.233  }
  18.234  
  18.235  void fluidsynth_setvolume(FluidSynthMidiSong *song, int volume)
  18.236  {
  18.237 -	/* FluidSynth's default is 0.2. Make 1.2 the maximum. */
  18.238 -	fluidsynth.fluid_synth_set_gain(song->synth, (float) (volume * 1.2 / MIX_MAX_VOLUME));
  18.239 +    /* FluidSynth's default is 0.2. Make 1.2 the maximum. */
  18.240 +    fluidsynth.fluid_synth_set_gain(song->synth, (float) (volume * 1.2 / MIX_MAX_VOLUME));
  18.241  }
  18.242  
  18.243  int fluidsynth_playsome(FluidSynthMidiSong *song, void *dest, int dest_len)
  18.244  {
  18.245 -	int result = -1;
  18.246 -	int frames = dest_len / channels / ((format & 0xFF) / 8);
  18.247 -	int src_len = frames * 4; /* 16-bit stereo */
  18.248 -	void *src = dest;
  18.249 +    int result = -1;
  18.250 +    int frames = dest_len / channels / ((format & 0xFF) / 8);
  18.251 +    int src_len = frames * 4; /* 16-bit stereo */
  18.252 +    void *src = dest;
  18.253  
  18.254 -	if (dest_len < src_len) {
  18.255 -		if (!(src = SDL_malloc(src_len))) {
  18.256 -			Mix_SetError("Insufficient memory for audio conversion");
  18.257 -			return result;
  18.258 -		}
  18.259 -	}
  18.260 +    if (dest_len < src_len) {
  18.261 +        if (!(src = SDL_malloc(src_len))) {
  18.262 +            Mix_SetError("Insufficient memory for audio conversion");
  18.263 +            return result;
  18.264 +        }
  18.265 +    }
  18.266  
  18.267 -	if (fluidsynth.fluid_synth_write_s16(song->synth, frames, src, 0, 2, src, 1, 2) != FLUID_OK) {
  18.268 -		Mix_SetError("Error generating FluidSynth audio");
  18.269 -		goto finish;
  18.270 -	}
  18.271 +    if (fluidsynth.fluid_synth_write_s16(song->synth, frames, src, 0, 2, src, 1, 2) != FLUID_OK) {
  18.272 +        Mix_SetError("Error generating FluidSynth audio");
  18.273 +        goto finish;
  18.274 +    }
  18.275  
  18.276 -	song->convert.buf = src;
  18.277 -	song->convert.len = src_len;
  18.278 +    song->convert.buf = src;
  18.279 +    song->convert.len = src_len;
  18.280  
  18.281 -	if (SDL_ConvertAudio(&song->convert) < 0) {
  18.282 -		Mix_SetError("Error during audio conversion");
  18.283 -		goto finish;
  18.284 -	}
  18.285 +    if (SDL_ConvertAudio(&song->convert) < 0) {
  18.286 +        Mix_SetError("Error during audio conversion");
  18.287 +        goto finish;
  18.288 +    }
  18.289  
  18.290 -	if (src != dest)
  18.291 -		memcpy(dest, src, dest_len);
  18.292 +    if (src != dest)
  18.293 +        memcpy(dest, src, dest_len);
  18.294  
  18.295 -	result = 0;
  18.296 +    result = 0;
  18.297  
  18.298  finish:
  18.299 -	if (src != dest)
  18.300 -		SDL_free(src);
  18.301 +    if (src != dest)
  18.302 +        SDL_free(src);
  18.303  
  18.304 -	return result;
  18.305 +    return result;
  18.306  }
  18.307  
  18.308  #endif /* USE_FLUIDSYNTH_MIDI */
    19.1 --- a/fluidsynth.h	Tue May 21 21:09:26 2013 -0700
    19.2 +++ b/fluidsynth.h	Tue May 21 21:21:23 2013 -0700
    19.3 @@ -32,9 +32,9 @@
    19.4  #include <SDL_audio.h>
    19.5  
    19.6  typedef struct {
    19.7 -	SDL_AudioCVT convert;
    19.8 -	fluid_synth_t *synth;
    19.9 -	fluid_player_t* player;
   19.10 +    SDL_AudioCVT convert;
   19.11 +    fluid_synth_t *synth;
   19.12 +    fluid_player_t* player;
   19.13  } FluidSynthMidiSong;
   19.14  
   19.15  int fluidsynth_init(SDL_AudioSpec *mixer);
    20.1 --- a/load_aiff.c	Tue May 21 21:09:26 2013 -0700
    20.2 +++ b/load_aiff.c	Tue May 21 21:21:23 2013 -0700
    20.3 @@ -40,15 +40,15 @@
    20.4  /*********************************************/
    20.5  /* Define values for AIFF (IFF audio) format */
    20.6  /*********************************************/
    20.7 -#define FORM		0x4d524f46		/* "FORM" */
    20.8 +#define FORM        0x4d524f46      /* "FORM" */
    20.9  
   20.10 -#define AIFF		0x46464941		/* "AIFF" */
   20.11 -#define SSND		0x444e5353		/* "SSND" */
   20.12 -#define COMM		0x4d4d4f43		/* "COMM" */
   20.13 +#define AIFF        0x46464941      /* "AIFF" */
   20.14 +#define SSND        0x444e5353      /* "SSND" */
   20.15 +#define COMM        0x4d4d4f43      /* "COMM" */
   20.16  
   20.17 -#define _8SVX		0x58565338		/* "8SVX" */
   20.18 -#define VHDR		0x52444856		/* "VHDR" */
   20.19 -#define BODY		0x59444F42		/* "BODY" */
   20.20 +#define _8SVX       0x58565338      /* "8SVX" */
   20.21 +#define VHDR        0x52444856      /* "VHDR" */
   20.22 +#define BODY        0x59444F42      /* "BODY" */
   20.23  
   20.24  /* This function was taken from libsndfile. I don't pretend to fully
   20.25   * understand it.
   20.26 @@ -56,195 +56,195 @@
   20.27  
   20.28  static Uint32 SANE_to_Uint32 (Uint8 *sanebuf)
   20.29  {
   20.30 -	/* Is the frequency outside of what we can represent with Uint32? */
   20.31 -	if ( (sanebuf[0] & 0x80) || (sanebuf[0] <= 0x3F) || (sanebuf[0] > 0x40)
   20.32 -		|| (sanebuf[0] == 0x40 && sanebuf[1] > 0x1C) )
   20.33 -		return 0;
   20.34 +    /* Is the frequency outside of what we can represent with Uint32? */
   20.35 +    if ( (sanebuf[0] & 0x80) || (sanebuf[0] <= 0x3F) || (sanebuf[0] > 0x40)
   20.36 +        || (sanebuf[0] == 0x40 && sanebuf[1] > 0x1C) )
   20.37 +        return 0;
   20.38  
   20.39 -	return ((sanebuf[2] << 23) | (sanebuf[3] << 15) | (sanebuf[4] << 7)
   20.40 -		| (sanebuf[5] >> 1)) >> (29 - sanebuf[1]);
   20.41 +    return ((sanebuf[2] << 23) | (sanebuf[3] << 15) | (sanebuf[4] << 7)
   20.42 +        | (sanebuf[5] >> 1)) >> (29 - sanebuf[1]);
   20.43  }
   20.44  
   20.45  /* This function is based on SDL_LoadWAV_RW(). */
   20.46  
   20.47  SDL_AudioSpec *Mix_LoadAIFF_RW (SDL_RWops *src, int freesrc,
   20.48 -	SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
   20.49 +    SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
   20.50  {
   20.51 -	int was_error;
   20.52 -	int found_SSND;
   20.53 -	int found_COMM;
   20.54 -	int found_VHDR;
   20.55 -	int found_BODY;
   20.56 -	long start = 0;
   20.57 +    int was_error;
   20.58 +    int found_SSND;
   20.59 +    int found_COMM;
   20.60 +    int found_VHDR;
   20.61 +    int found_BODY;
   20.62 +    long start = 0;
   20.63  
   20.64 -	Uint32 chunk_type;
   20.65 -	Uint32 chunk_length;
   20.66 -	long next_chunk;
   20.67 +    Uint32 chunk_type;
   20.68 +    Uint32 chunk_length;
   20.69 +    long next_chunk;
   20.70  
   20.71 -	/* AIFF magic header */
   20.72 -	Uint32 FORMchunk;
   20.73 -	Uint32 AIFFmagic;
   20.74 +    /* AIFF magic header */
   20.75 +    Uint32 FORMchunk;
   20.76 +    Uint32 AIFFmagic;
   20.77  
   20.78 -	/* SSND chunk */
   20.79 -	Uint32 offset;
   20.80 -	Uint32 blocksize;
   20.81 +    /* SSND chunk */
   20.82 +    Uint32 offset;
   20.83 +    Uint32 blocksize;
   20.84  
   20.85 -	/* COMM format chunk */
   20.86 -	Uint16 channels = 0;
   20.87 -	Uint32 numsamples = 0;
   20.88 -	Uint16 samplesize = 0;
   20.89 -	Uint8 sane_freq[10];
   20.90 -	Uint32 frequency = 0;
   20.91 +    /* COMM format chunk */
   20.92 +    Uint16 channels = 0;
   20.93 +    Uint32 numsamples = 0;
   20.94 +    Uint16 samplesize = 0;
   20.95 +    Uint8 sane_freq[10];
   20.96 +    Uint32 frequency = 0;
   20.97  
   20.98 -	/* Make sure we are passed a valid data source */
   20.99 -	was_error = 0;
  20.100 -	if ( src == NULL ) {
  20.101 -		was_error = 1;
  20.102 -		goto done;
  20.103 -	}
  20.104 +    /* Make sure we are passed a valid data source */
  20.105 +    was_error = 0;
  20.106 +    if ( src == NULL ) {
  20.107 +        was_error = 1;
  20.108 +        goto done;
  20.109 +    }
  20.110  
  20.111 -	FORMchunk	= SDL_ReadLE32(src);
  20.112 -	chunk_length	= SDL_ReadBE32(src);
  20.113 -	if ( chunk_length == AIFF ) { /* The FORMchunk has already been read */
  20.114 -		AIFFmagic    = chunk_length;
  20.115 -		chunk_length = FORMchunk;
  20.116 -		FORMchunk    = FORM;
  20.117 -	} else {
  20.118 -		AIFFmagic    = SDL_ReadLE32(src);
  20.119 -	}
  20.120 -	if ( (FORMchunk != FORM) || ( (AIFFmagic != AIFF) && (AIFFmagic != _8SVX) ) ) {
  20.121 -		SDL_SetError("Unrecognized file type (not AIFF nor 8SVX)");
  20.122 -		was_error = 1;
  20.123 -		goto done;
  20.124 -	}
  20.125 +    FORMchunk   = SDL_ReadLE32(src);
  20.126 +    chunk_length    = SDL_ReadBE32(src);
  20.127 +    if ( chunk_length == AIFF ) { /* The FORMchunk has already been read */
  20.128 +        AIFFmagic    = chunk_length;
  20.129 +        chunk_length = FORMchunk;
  20.130 +        FORMchunk    = FORM;
  20.131 +    } else {
  20.132 +        AIFFmagic    = SDL_ReadLE32(src);
  20.133 +    }
  20.134 +    if ( (FORMchunk != FORM) || ( (AIFFmagic != AIFF) && (AIFFmagic != _8SVX) ) ) {
  20.135 +        SDL_SetError("Unrecognized file type (not AIFF nor 8SVX)");
  20.136 +        was_error = 1;
  20.137 +        goto done;
  20.138 +    }
  20.139  
  20.140 -	/* TODO: Better santity-checking. */
  20.141 +    /* TODO: Better santity-checking. */
  20.142  
  20.143 -	found_SSND = 0;
  20.144 -	found_COMM = 0;
  20.145 -	found_VHDR = 0;
  20.146 -	found_BODY = 0;
  20.147 +    found_SSND = 0;
  20.148 +    found_COMM = 0;
  20.149 +    found_VHDR = 0;
  20.150 +    found_BODY = 0;
  20.151  
  20.152 -	do {
  20.153 -		chunk_type	= SDL_ReadLE32(src);
  20.154 -		chunk_length	= SDL_ReadBE32(src);
  20.155 -		next_chunk	= SDL_RWtell(src) + chunk_length;
  20.156 -		/* Paranoia to avoid infinite loops */
  20.157 -		if (chunk_length == 0)
  20.158 -			break;
  20.159 +    do {
  20.160 +        chunk_type  = SDL_ReadLE32(src);
  20.161 +        chunk_length    = SDL_ReadBE32(src);
  20.162 +        next_chunk  = SDL_RWtell(src) + chunk_length;
  20.163 +        /* Paranoia to avoid infinite loops */
  20.164 +        if (chunk_length == 0)
  20.165 +            break;
  20.166  
  20.167 -		switch (chunk_type) {
  20.168 -			case SSND:
  20.169 -				found_SSND	= 1;
  20.170 -				offset		= SDL_ReadBE32(src);
  20.171 -				blocksize	= SDL_ReadBE32(src);
  20.172 -				start		= SDL_RWtell(src) + offset;
  20.173 -				break;
  20.174 +        switch (chunk_type) {
  20.175 +            case SSND:
  20.176 +                found_SSND  = 1;
  20.177 +                offset      = SDL_ReadBE32(src);
  20.178 +                blocksize   = SDL_ReadBE32(src);
  20.179 +                start       = SDL_RWtell(src) + offset;
  20.180 +                break;
  20.181  
  20.182 -			case COMM:
  20.183 -				found_COMM	= 1;
  20.184 -				channels	= SDL_ReadBE16(src);
  20.185 -				numsamples	= SDL_ReadBE32(src);
  20.186 -				samplesize	= SDL_ReadBE16(src);
  20.187 -				SDL_RWread(src, sane_freq, sizeof(sane_freq), 1);
  20.188 -				frequency	= SANE_to_Uint32(sane_freq);
  20.189 -				if (frequency == 0) {
  20.190 -					SDL_SetError("Bad AIFF sample frequency");
  20.191 -					was_error = 1;
  20.192 -					goto done;
  20.193 -				}
  20.194 -				break;
  20.195 +            case COMM:
  20.196 +                found_COMM  = 1;
  20.197 +                channels    = SDL_ReadBE16(src);
  20.198 +                numsamples  = SDL_ReadBE32(src);
  20.199 +                samplesize  = SDL_ReadBE16(src);
  20.200 +                SDL_RWread(src, sane_freq, sizeof(sane_freq), 1);
  20.201 +                frequency   = SANE_to_Uint32(sane_freq);
  20.202 +                if (frequency == 0) {
  20.203 +                    SDL_SetError("Bad AIFF sample frequency");
  20.204 +                    was_error = 1;
  20.205 +                    goto done;
  20.206 +                }
  20.207 +                break;
  20.208  
  20.209 -			case VHDR:
  20.210 -				found_VHDR	= 1;
  20.211 -				SDL_ReadBE32(src);
  20.212 -				SDL_ReadBE32(src);
  20.213 -				SDL_ReadBE32(src);
  20.214 -				frequency = SDL_ReadBE16(src);
  20.215 -				channels = 1;
  20.216 -				samplesize = 8;
  20.217 -				break;
  20.218 +            case VHDR:
  20.219 +                found_VHDR  = 1;
  20.220 +                SDL_ReadBE32(src);
  20.221 +                SDL_ReadBE32(src);
  20.222 +                SDL_ReadBE32(src);
  20.223 +                frequency = SDL_ReadBE16(src);
  20.224 +                channels = 1;
  20.225 +                samplesize = 8;
  20.226 +                break;
  20.227  
  20.228 -			case BODY:
  20.229 -				found_BODY	= 1;
  20.230 -				numsamples	= chunk_length;
  20.231 -				start		= SDL_RWtell(src);
  20.232 -				break;
  20.233 +            case BODY:
  20.234 +                found_BODY  = 1;
  20.235 +                numsamples  = chunk_length;
  20.236 +                start       = SDL_RWtell(src);
  20.237 +                break;
  20.238  
  20.239 -			default:
  20.240 -				break;
  20.241 -		}
  20.242 -		/* a 0 pad byte can be stored for any odd-length chunk */
  20.243 -		if (chunk_length&1)
  20.244 -			next_chunk++;
  20.245 -	} while ( ( ( (AIFFmagic == AIFF) && ( !found_SSND || !found_COMM ) )
  20.246 -		  || ( (AIFFmagic == _8SVX ) && ( !found_VHDR || !found_BODY ) ) )
  20.247 -		  && SDL_RWseek(src, next_chunk, RW_SEEK_SET) != 1 );
  20.248 +            default:
  20.249 +                break;
  20.250 +        }
  20.251 +        /* a 0 pad byte can be stored for any odd-length chunk */
  20.252 +        if (chunk_length&1)
  20.253 +            next_chunk++;
  20.254 +    } while ( ( ( (AIFFmagic == AIFF) && ( !found_SSND || !found_COMM ) )
  20.255 +          || ( (AIFFmagic == _8SVX ) && ( !found_VHDR || !found_BODY ) ) )
  20.256 +          && SDL_RWseek(src, next_chunk, RW_SEEK_SET) != 1 );
  20.257  
  20.258 -	if ( (AIFFmagic == AIFF) && !found_SSND ) {
  20.259 -		SDL_SetError("Bad AIFF (no SSND chunk)");
  20.260 -		was_error = 1;
  20.261 -		goto done;
  20.262 -	}
  20.263 +    if ( (AIFFmagic == AIFF) && !found_SSND ) {
  20.264 +        SDL_SetError("Bad AIFF (no SSND chunk)");
  20.265 +        was_error = 1;
  20.266 +        goto done;
  20.267 +    }
  20.268  
  20.269 -	if ( (AIFFmagic == AIFF) && !found_COMM ) {
  20.270 -		SDL_SetError("Bad AIFF (no COMM chunk)");
  20.271 -		was_error = 1;
  20.272 -		goto done;
  20.273 -	}
  20.274 +    if ( (AIFFmagic == AIFF) && !found_COMM ) {
  20.275 +        SDL_SetError("Bad AIFF (no COMM chunk)");
  20.276 +        was_error = 1;
  20.277 +        goto done;
  20.278 +    }
  20.279  
  20.280 -	if ( (AIFFmagic == _8SVX) && !found_VHDR ) {
  20.281 -		SDL_SetError("Bad 8SVX (no VHDR chunk)");
  20.282 -		was_error = 1;
  20.283 -		goto done;
  20.284 -	}
  20.285 +    if ( (AIFFmagic == _8SVX) && !found_VHDR ) {
  20.286 +        SDL_SetError("Bad 8SVX (no VHDR chunk)");
  20.287 +        was_error = 1;
  20.288 +        goto done;
  20.289 +    }
  20.290  
  20.291 -	if ( (AIFFmagic == _8SVX) && !found_BODY ) {
  20.292 -		SDL_SetError("Bad 8SVX (no BODY chunk)");
  20.293 -		was_error = 1;
  20.294 -		goto done;
  20.295 -	}
  20.296 +    if ( (AIFFmagic == _8SVX) && !found_BODY ) {
  20.297 +        SDL_SetError("Bad 8SVX (no BODY chunk)");
  20.298 +        was_error = 1;
  20.299 +        goto done;
  20.300 +    }
  20.301  
  20.302 -	/* Decode the audio data format */
  20.303 -	memset(spec, 0, sizeof(*spec));
  20.304 -	spec->freq = frequency;
  20.305 -	switch (samplesize) {
  20.306 -		case 8:
  20.307 -			spec->format = AUDIO_S8;
  20.308 -			break;
  20.309 -		case 16:
  20.310 -			spec->format = AUDIO_S16MSB;
  20.311 -			break;
  20.312 -		default:
  20.313 -			SDL_SetError("Unsupported AIFF samplesize");
  20.314 -			was_error = 1;
  20.315 -			goto done;
  20.316 -	}
  20.317 -	spec->channels = (Uint8) channels;
  20.318 -	spec->samples = 4096;		/* Good default buffer size */
  20.319 +    /* Decode the audio data format */
  20.320 +    memset(spec, 0, sizeof(*spec));
  20.321 +    spec->freq = frequency;
  20.322 +    switch (samplesize) {
  20.323 +        case 8:
  20.324 +            spec->format = AUDIO_S8;
  20.325 +            break;
  20.326 +        case 16:
  20.327 +            spec->format = AUDIO_S16MSB;
  20.328 +            break;
  20.329 +        default:
  20.330 +            SDL_SetError("Unsupported AIFF samplesize");
  20.331 +            was_error = 1;
  20.332 +            goto done;
  20.333 +    }
  20.334 +    spec->channels = (Uint8) channels;
  20.335 +    spec->samples = 4096;       /* Good default buffer size */
  20.336  
  20.337 -	*audio_len = channels * numsamples * (samplesize / 8);
  20.338 -	*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
  20.339 -	if ( *audio_buf == NULL ) {
  20.340 -		SDL_SetError("Out of memory");
  20.341 -		return(NULL);
  20.342 -	}
  20.343 -	SDL_RWseek(src, start, RW_SEEK_SET);
  20.344 -	if ( SDL_RWread(src, *audio_buf, *audio_len, 1) != 1 ) {
  20.345 -		SDL_SetError("Unable to read audio data");
  20.346 -		return(NULL);
  20.347 -	}
  20.348 +    *audio_len = channels * numsamples * (samplesize / 8);
  20.349 +    *audio_buf = (Uint8 *)SDL_malloc(*audio_len);
  20.350 +    if ( *audio_buf == NULL ) {
  20.351 +        SDL_SetError("Out of memory");
  20.352 +        return(NULL);
  20.353 +    }
  20.354 +    SDL_RWseek(src, start, RW_SEEK_SET);
  20.355 +    if ( SDL_RWread(src, *audio_buf, *audio_len, 1) != 1 ) {
  20.356 +        SDL_SetError("Unable to read audio data");
  20.357 +        return(NULL);
  20.358 +    }
  20.359  
  20.360 -	/* Don't return a buffer that isn't a multiple of samplesize */
  20.361 -	*audio_len &= ~((samplesize / 8) - 1);
  20.362 +    /* Don't return a buffer that isn't a multiple of samplesize */
  20.363 +    *audio_len &= ~((samplesize / 8) - 1);
  20.364  
  20.365  done:
  20.366 -	if ( freesrc && src ) {
  20.367 -		SDL_RWclose(src);
  20.368 -	}
  20.369 -	if ( was_error ) {
  20.370 -		spec = NULL;
  20.371 -	}
  20.372 -	return(spec);
  20.373 +    if ( freesrc && src ) {
  20.374 +        SDL_RWclose(src);
  20.375 +    }
  20.376 +    if ( was_error ) {
  20.377 +        spec = NULL;
  20.378 +    }
  20.379 +    return(spec);
  20.380  }
  20.381  
    21.1 --- a/load_aiff.h	Tue May 21 21:09:26 2013 -0700
    21.2 +++ b/load_aiff.h	Tue May 21 21:21:23 2013 -0700
    21.3 @@ -28,4 +28,4 @@
    21.4  
    21.5  /* Don't call this directly; use Mix_LoadWAV_RW() for now. */
    21.6  SDL_AudioSpec *Mix_LoadAIFF_RW (SDL_RWops *src, int freesrc,
    21.7 -	SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
    21.8 +    SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
    22.1 --- a/load_flac.c	Tue May 21 21:09:26 2013 -0700
    22.2 +++ b/load_flac.c	Tue May 21 21:21:23 2013 -0700
    22.3 @@ -19,7 +19,7 @@
    22.4    3. This notice may not be removed or altered from any source distribution.
    22.5  
    22.6    This is the source needed to decode a FLAC into a waveform.
    22.7 -  	~ Austen Dicken (admin@cvpcs.org).
    22.8 +    ~ Austen Dicken (admin@cvpcs.org).
    22.9  */
   22.10  
   22.11  #ifdef FLAC_MUSIC
   22.12 @@ -39,299 +39,299 @@
   22.13  #include <FLAC/stream_decoder.h>
   22.14  
   22.15  typedef struct {
   22.16 -	SDL_RWops* sdl_src;
   22.17 -	SDL_AudioSpec* sdl_spec;
   22.18 -	Uint8** sdl_audio_buf;
   22.19 -	Uint32* sdl_audio_len;
   22.20 -	int sdl_audio_read;
   22.21 -	FLAC__uint64 flac_total_samples;
   22.22 -	unsigned flac_bps;
   22.23 +    SDL_RWops* sdl_src;
   22.24 +    SDL_AudioSpec* sdl_spec;
   22.25 +    Uint8** sdl_audio_buf;
   22.26 +    Uint32* sdl_audio_len;
   22.27 +    int sdl_audio_read;
   22.28 +    FLAC__uint64 flac_total_samples;
   22.29 +    unsigned flac_bps;
   22.30  } FLAC_SDL_Data;
   22.31  
   22.32  static FLAC__StreamDecoderReadStatus flac_read_load_cb(
   22.33 -									const FLAC__StreamDecoder *decoder,
   22.34 -									FLAC__byte buffer[],
   22.35 -									size_t *bytes,
   22.36 -									void *client_data)
   22.37 +                                    const FLAC__StreamDecoder *decoder,
   22.38 +                                    FLAC__byte buffer[],
   22.39 +                                    size_t *bytes,
   22.40 +                                    void *client_data)
   22.41  {
   22.42 -	// make sure there is something to be reading
   22.43 -	if (*bytes > 0) {
   22.44 -		FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
   22.45 +    // make sure there is something to be reading
   22.46 +    if (*bytes > 0) {
   22.47 +        FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
   22.48  
   22.49 -		*bytes = SDL_RWread (data->sdl_src, buffer, sizeof (FLAC__byte),
   22.50 -								*bytes);
   22.51 +        *bytes = SDL_RWread (data->sdl_src, buffer, sizeof (FLAC__byte),
   22.52 +                                *bytes);
   22.53  
   22.54 -		if (*bytes == 0) { // error or no data was read (EOF)
   22.55 -			return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
   22.56 -		}
   22.57 -		else { // data was read, continue
   22.58 -			return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
   22.59 -		}
   22.60 -	}
   22.61 -	else {
   22.62 -		return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   22.63 -	}
   22.64 +        if (*bytes == 0) { // error or no data was read (EOF)
   22.65 +            return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
   22.66 +        }
   22.67 +        else { // data was read, continue
   22.68 +            return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
   22.69 +        }
   22.70 +    }
   22.71 +    else {
   22.72 +        return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   22.73 +    }
   22.74  }
   22.75  
   22.76  static FLAC__StreamDecoderSeekStatus flac_seek_load_cb(
   22.77 -									const FLAC__StreamDecoder *decoder,
   22.78 -									FLAC__uint64 absolute_byte_offset,
   22.79 -									void *client_data)
   22.80 +                                    const FLAC__StreamDecoder *decoder,
   22.81 +                                    FLAC__uint64 absolute_byte_offset,
   22.82 +                                    void *client_data)
   22.83  {
   22.84 -	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
   22.85 +    FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
   22.86  
   22.87 -	if (SDL_RWseek (data->sdl_src, absolute_byte_offset, RW_SEEK_SET) < 0) {
   22.88 -		return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
   22.89 -	}
   22.90 -	else {
   22.91 -		return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
   22.92 -	}
   22.93 +    if (SDL_RWseek (data->sdl_src, absolute_byte_offset, RW_SEEK_SET) < 0) {
   22.94 +        return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
   22.95 +    }
   22.96 +    else {
   22.97 +        return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
   22.98 +    }
   22.99  }
  22.100  
  22.101  static FLAC__StreamDecoderTellStatus flac_tell_load_cb(
  22.102 -									const FLAC__StreamDecoder *decoder,
  22.103 -									FLAC__uint64 *absolute_byte_offset,
  22.104 -									void *client_data)
  22.105 +                                    const FLAC__StreamDecoder *decoder,
  22.106 +                                    FLAC__uint64 *absolute_byte_offset,
  22.107 +                                    void *client_data)
  22.108  {
  22.109 -	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.110 +    FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.111  
  22.112 -	int pos = SDL_RWtell (data->sdl_src);
  22.113 +    int pos = SDL_RWtell (data->sdl_src);
  22.114  
  22.115 -	if (pos < 0) {
  22.116 -		return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
  22.117 -	}
  22.118 -	else {
  22.119 -		*absolute_byte_offset = (FLAC__uint64)pos;
  22.120 -		return FLAC__STREAM_DECODER_TELL_STATUS_OK;
  22.121 -	}
  22.122 +    if (pos < 0) {
  22.123 +        return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
  22.124 +    }
  22.125 +    else {
  22.126 +        *absolute_byte_offset = (FLAC__uint64)pos;
  22.127 +        return FLAC__STREAM_DECODER_TELL_STATUS_OK;
  22.128 +    }
  22.129  }
  22.130  
  22.131  static FLAC__StreamDecoderLengthStatus flac_length_load_cb(
  22.132 -									const FLAC__StreamDecoder *decoder,
  22.133 -									FLAC__uint64 *stream_length,
  22.134 -									void *client_data)
  22.135 +                                    const FLAC__StreamDecoder *decoder,
  22.136 +                                    FLAC__uint64 *stream_length,
  22.137 +                                    void *client_data)
  22.138  {
  22.139 -	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.140 +    FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.141  
  22.142 -	int pos = SDL_RWtell (data->sdl_src);
  22.143 -	int length = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END);
  22.144 +    int pos = SDL_RWtell (data->sdl_src);
  22.145 +    int length = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END);
  22.146  
  22.147 -	if (SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET) != pos || length < 0) {
  22.148 -		/* there was an error attempting to return the stream to the original
  22.149 -		 * position, or the length was invalid. */
  22.150 -		return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
  22.151 -	}
  22.152 -	else {
  22.153 -		*stream_length = (FLAC__uint64)length;
  22.154 -		return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
  22.155 -	}
  22.156 +    if (SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET) != pos || length < 0) {
  22.157 +        /* there was an error attempting to return the stream to the original
  22.158 +         * position, or the length was invalid. */
  22.159 +        return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
  22.160 +    }
  22.161 +    else {
  22.162 +        *stream_length = (FLAC__uint64)length;
  22.163 +        return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
  22.164 +    }
  22.165  }
  22.166  
  22.167  static FLAC__bool flac_eof_load_cb(const FLAC__StreamDecoder *decoder,
  22.168 -									void *client_data)
  22.169 +                                    void *client_data)
  22.170  {
  22.171 -	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.172 +    FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.173  
  22.174 -	int pos = SDL_RWtell (data->sdl_src);
  22.175 -	int end = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END);
  22.176 +    int pos = SDL_RWtell (data->sdl_src);
  22.177 +    int end = SDL_RWseek (data->sdl_src, 0, RW_SEEK_END);
  22.178  
  22.179 -	// was the original position equal to the end (a.k.a. the seek didn't move)?
  22.180 -	if (pos == end) {
  22.181 -		// must be EOF
  22.182 -		return true;
  22.183 -	}
  22.184 -	else {
  22.185 -		// not EOF, return to the original position
  22.186 -		SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET);
  22.187 +    // was the original position equal to the end (a.k.a. the seek didn't move)?
  22.188 +    if (pos == end) {
  22.189 +        // must be EOF
  22.190 +        return true;
  22.191 +    }
  22.192 +    else {
  22.193 +        // not EOF, return to the original position
  22.194 +        SDL_RWseek (data->sdl_src, pos, RW_SEEK_SET);
  22.195  
  22.196 -		return false;
  22.197 -	}
  22.198 +        return false;
  22.199 +    }
  22.200  }
  22.201  
  22.202  static FLAC__StreamDecoderWriteStatus flac_write_load_cb(
  22.203 -									const FLAC__StreamDecoder *decoder,
  22.204 -									const FLAC__Frame *frame,
  22.205 -									const FLAC__int32 *const buffer[],
  22.206 -									void *client_data)
  22.207 +                                    const FLAC__StreamDecoder *decoder,
  22.208 +                                    const FLAC__Frame *frame,
  22.209 +                                    const FLAC__int32 *const buffer[],
  22.210 +                                    void *client_data)
  22.211  {
  22.212 -	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.213 -	size_t i;
  22.214 -	Uint8 *buf;
  22.215 +    FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.216 +    size_t i;
  22.217 +    Uint8 *buf;
  22.218  
  22.219 -	if (data->flac_total_samples == 0) {
  22.220 -		SDL_SetError ("Given FLAC file does not specify its sample count.");
  22.221 -		return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  22.222 -	}
  22.223 +    if (data->flac_total_samples == 0) {
  22.224 +        SDL_SetError ("Given FLAC file does not specify its sample count.");
  22.225 +        return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  22.226 +    }
  22.227  
  22.228 -	if (data->sdl_spec->channels != 2 || data->flac_bps != 16) {
  22.229 -		SDL_SetError ("Current FLAC support is only for 16 bit Stereo files.");
  22.230 -		return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  22.231 -	}
  22.232 +    if (data->sdl_spec->channels != 2 || data->flac_bps != 16) {
  22.233 +        SDL_SetError ("Current FLAC support is only for 16 bit Stereo files.");
  22.234 +        return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  22.235 +    }
  22.236  
  22.237 -	// check if it is the first audio frame so we can initialize the output
  22.238 -	// buffer
  22.239 -	if (frame->header.number.sample_number == 0) {
  22.240 -		*(data->sdl_audio_len) = data->sdl_spec->size;
  22.241 -		data->sdl_audio_read = 0;
  22.242 -    	*(data->sdl_audio_buf) = SDL_malloc (*(data->sdl_audio_len));
  22.243 +    // check if it is the first audio frame so we can initialize the output
  22.244 +    // buffer
  22.245 +    if (frame->header.number.sample_number == 0) {
  22.246 +        *(data->sdl_audio_len) = data->sdl_spec->size;
  22.247 +        data->sdl_audio_read = 0;
  22.248 +        *(data->sdl_audio_buf) = SDL_malloc (*(data->sdl_audio_len));
  22.249  
  22.250 -    	if (*(data->sdl_audio_buf) == NULL) {
  22.251 -    		SDL_SetError
  22.252 -					("Unable to allocate memory to store the FLAC stream.");
  22.253 -    		return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  22.254 -    	}
  22.255 -	}
  22.256 +        if (*(data->sdl_audio_buf) == NULL) {
  22.257 +            SDL_SetError
  22.258 +                    ("Unable to allocate memory to store the FLAC stream.");
  22.259 +            return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  22.260 +        }
  22.261 +    }
  22.262  
  22.263 -	buf = *(data->sdl_audio_buf);
  22.264 +    buf = *(data->sdl_audio_buf);
  22.265  
  22.266 -	for (i = 0; i < frame->header.blocksize; i++) {
  22.267 -		FLAC__int16 i16;
  22.268 -		FLAC__uint16 ui16;
  22.269 +    for (i = 0; i < frame->header.blocksize; i++) {
  22.270 +        FLAC__int16 i16;
  22.271 +        FLAC__uint16 ui16;
  22.272  
  22.273 -		i16 = (FLAC__int16)buffer[0][i];
  22.274 -		ui16 = (FLAC__uint16)i16;
  22.275 +        i16 = (FLAC__int16)buffer[0][i];
  22.276 +        ui16 = (FLAC__uint16)i16;
  22.277  
  22.278 -		*(buf + (data->sdl_audio_read++)) = (char)(ui16);
  22.279 -		*(buf + (data->sdl_audio_read++)) = (char)(ui16 >> 8);
  22.280 +        *(buf + (data->sdl_audio_read++)) = (char)(ui16);
  22.281 +        *(buf + (data->sdl_audio_read++)) = (char)(ui16 >> 8);
  22.282  
  22.283 -		i16 = (FLAC__int16)buffer[1][i];
  22.284 -		ui16 = (FLAC__uint16)i16;
  22.285 +        i16 = (FLAC__int16)buffer[1][i];
  22.286 +        ui16 = (FLAC__uint16)i16;
  22.287  
  22.288 -		*(buf + (data->sdl_audio_read++)) = (char)(ui16);
  22.289 -		*(buf + (data->sdl_audio_read++)) = (char)(ui16 >> 8);
  22.290 -	}
  22.291 +        *(buf + (data->sdl_audio_read++)) = (char)(ui16);
  22.292 +        *(buf + (data->sdl_audio_read++)) = (char)(ui16 >> 8);
  22.293 +    }
  22.294  
  22.295 -	return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
  22.296 +    return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
  22.297  }
  22.298  
  22.299  static void flac_metadata_load_cb(
  22.300 -					const FLAC__StreamDecoder *decoder,
  22.301 -					const FLAC__StreamMetadata *metadata,
  22.302 -					void *client_data)
  22.303 +                    const FLAC__StreamDecoder *decoder,
  22.304 +                    const FLAC__StreamMetadata *metadata,
  22.305 +                    void *client_data)
  22.306  {
  22.307 -	FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.308 -	FLAC__uint64 total_samples;
  22.309 -	unsigned bps;
  22.310 +    FLAC_SDL_Data *data = (FLAC_SDL_Data *)client_data;
  22.311 +    FLAC__uint64 total_samples;
  22.312 +    unsigned bps;
  22.313  
  22.314 -	if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
  22.315 -		// save the metadata right now for use later on
  22.316 -		*(data->sdl_audio_buf) = NULL;
  22.317 -		*(data->sdl_audio_len) = 0;
  22.318 -		memset (data->sdl_spec, '\0', sizeof (SDL_AudioSpec));
  22.319 +    if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
  22.320 +        // save the metadata right now for use later on
  22.321 +        *(data->sdl_audio_buf) = NULL;
  22.322 +        *(data->sdl_audio_len) = 0;
  22.323 +        memset (data->sdl_spec, '\0', sizeof (SDL_AudioSpec));
  22.324  
  22.325 -		data->sdl_spec->format = AUDIO_S16;
  22.326 -		data->sdl_spec->freq = (int)(metadata->data.stream_info.sample_rate);
  22.327 -		data->sdl_spec->channels = (Uint8)(metadata->data.stream_info.channels);
  22.328 -		data->sdl_spec->samples = 8192; /* buffer size */
  22.329 +        data->sdl_spec->format = AUDIO_S16;
  22.330 +        data->sdl_spec->freq = (int)(metadata->data.stream_info.sample_rate);
  22.331 +        data->sdl_spec->channels = (Uint8)(metadata->data.stream_info.channels);
  22.332 +        data->sdl_spec->samples = 8192; /* buffer size */
  22.333  
  22.334 -		total_samples = metadata->data.stream_info.total_samples;
  22.335 -		bps = metadata->data.stream_info.bits_per_sample;
  22.336 +        total_samples = metadata->data.stream_info.total_samples;
  22.337 +        bps = metadata->data.stream_info.bits_per_sample;
  22.338  
  22.339 -		data->sdl_spec->size = total_samples * data->sdl_spec->channels *
  22.340 -								(bps / 8);
  22.341 -		data->flac_total_samples = total_samples;
  22.342 -		data->flac_bps = bps;
  22.343 -	}
  22.344 +        data->sdl_spec->size = total_samples * data->sdl_spec->channels *
  22.345 +                                (bps / 8);
  22.346 +        data->flac_total_samples = total_samples;
  22.347 +        data->flac_bps = bps;
  22.348 +    }
  22.349  }
  22.350  
  22.351  static void flac_error_load_cb(
  22.352 -				const FLAC__StreamDecoder *decoder,
  22.353 -				FLAC__StreamDecoderErrorStatus status,
  22.354 -				void *client_data)
  22.355 +                const FLAC__StreamDecoder *decoder,
  22.356 +                FLAC__StreamDecoderErrorStatus status,
  22.357 +                void *client_data)
  22.358  {
  22.359 -	// print an SDL error based on the error status
  22.360 -	switch (status) {
  22.361 -		case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
  22.362 -			SDL_SetError ("Error processing the FLAC file [LOST_SYNC].");
  22.363 -		break;
  22.364 -		case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
  22.365 -			SDL_SetError ("Error processing the FLAC file [BAD_HEADER].");
  22.366 -		break;
  22.367 -		case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
  22.368 -			SDL_SetError ("Error processing the FLAC file [CRC_MISMATCH].");
  22.369 -		break;
  22.370 -		case FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM:
  22.371 -			SDL_SetError ("Error processing the FLAC file [UNPARSEABLE].");
  22.372 -		break;
  22.373 -		default:
  22.374 -			SDL_SetError ("Error processing the FLAC file [UNKNOWN].");
  22.375 -		break;
  22.376 -	}
  22.377 +    // print an SDL error based on the error status
  22.378 +    switch (status) {
  22.379 +        case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
  22.380 +            SDL_SetError ("Error processing the FLAC file [LOST_SYNC].");
  22.381 +        break;
  22.382 +        case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
  22.383 +            SDL_SetError ("Error processing the FLAC file [BAD_HEADER].");
  22.384 +        break;
  22.385 +        case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
  22.386 +            SDL_SetError ("Error processing the FLAC file [CRC_MISMATCH].");
  22.387 +        break;
  22.388 +        case FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM:
  22.389 +            SDL_SetError ("Error processing the FLAC file [UNPARSEABLE].");
  22.390 +        break;
  22.391 +        default:
  22.392 +            SDL_SetError ("Error processing the FLAC file [UNKNOWN].");
  22.393 +        break;
  22.394 +    }
  22.395  }
  22.396  
  22.397  /* don't call this directly; use Mix_LoadWAV_RW() for now. */
  22.398  SDL_AudioSpec *Mix_LoadFLAC_RW (SDL_RWops *src, int freesrc,
  22.399          SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
  22.400  {
  22.401 -	FLAC__StreamDecoder *decoder = 0;
  22.402 -	FLAC__StreamDecoderInitStatus init_status;
  22.403 -	int was_error = 1;
  22.404 -	int was_init = 0;
  22.405 -	Uint32 samplesize;
  22.406 +    FLAC__StreamDecoder *decoder = 0;
  22.407 +    FLAC__StreamDecoderInitStatus init_status;
  22.408 +    int was_error = 1;
  22.409 +    int was_init = 0;
  22.410 +    Uint32 samplesize;
  22.411  
  22.412 -	// create the client data passing information
  22.413 -	FLAC_SDL_Data* client_data;
  22.414 -	client_data = (FLAC_SDL_Data *)SDL_malloc (sizeof (FLAC_SDL_Data));
  22.415 +    // create the client data passing information
  22.416 +    FLAC_SDL_Data* client_data;
  22.417 +    client_data = (FLAC_SDL_Data *)SDL_malloc (sizeof (FLAC_SDL_Data));
  22.418  
  22.419 -	if ((!src) || (!audio_buf) || (!audio_len))   /* sanity checks. */
  22.420 -		goto done;
  22.421 +    if ((!src) || (!audio_buf) || (!audio_len))   /* sanity checks. */
  22.422 +        goto done;
  22.423  
  22.424 -	if (!Mix_Init(MIX_INIT_FLAC))
  22.425 -		goto done;
  22.426 +    if (!Mix_Init(MIX_INIT_FLAC))
  22.427 +        goto done;
  22.428  
  22.429 -	if ((decoder = flac.FLAC__stream_decoder_new ()) == NULL) {
  22.430 -		SDL_SetError ("Unable to allocate FLAC decoder.");
  22.431 -		goto done;
  22.432 -	}
  22.433 +    if ((decoder = flac.FLAC__stream_decoder_new ()) == NULL) {
  22.434 +        SDL_SetError ("Unable to allocate FLAC decoder.");
  22.435 +        goto done;
  22.436 +    }
  22.437  
  22.438 -	init_status = flac.FLAC__stream_decoder_init_stream (decoder,
  22.439 -								flac_read_load_cb, flac_seek_load_cb,
  22.440 -								flac_tell_load_cb, flac_length_load_cb,
  22.441 -								flac_eof_load_cb, flac_write_load_cb,
  22.442 -								flac_metadata_load_cb, flac_error_load_cb,
  22.443 -								client_data);
  22.444 +    init_status = flac.FLAC__stream_decoder_init_stream (decoder,
  22.445 +                                flac_read_load_cb, flac_seek_load_cb,
  22.446 +                                flac_tell_load_cb, flac_length_load_cb,
  22.447 +                                flac_eof_load_cb, flac_write_load_cb,
  22.448 +                                flac_metadata_load_cb, flac_error_load_cb,
  22.449 +                                client_data);
  22.450  
  22.451 -	if (init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
  22.452 -		SDL_SetError ("Unable to initialize FLAC stream decoder.");
  22.453 -		goto done;
  22.454 -	}
  22.455 +    if (init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
  22.456 +        SDL_SetError ("Unable to initialize FLAC stream decoder.");
  22.457 +        goto done;
  22.458 +    }
  22.459  
  22.460 -	was_init = 1;
  22.461 +    was_init = 1;
  22.462  
  22.463 -	client_data->sdl_src = src;
  22.464 -	client_data->sdl_spec = spec;
  22.465 -	client_data->sdl_audio_buf = audio_buf;
  22.466 -	client_data->sdl_audio_len = audio_len;
  22.467 +    client_data->sdl_src = src;
  22.468 +    client_data->sdl_spec = spec;
  22.469 +    client_data->sdl_audio_buf = audio_buf;
  22.470 +    client_data->sdl_audio_len = audio_len;
  22.471  
  22.472 -	if (!flac.FLAC__stream_decoder_process_until_end_of_stream (decoder)) {
  22.473 -		SDL_SetError ("Unable to process FLAC file.");
  22.474 -		goto done;
  22.475 -	}
  22.476 +    if (!flac.FLAC__stream_decoder_process_until_end_of_stream (decoder)) {
  22.477 +        SDL_SetError ("Unable to process FLAC file.");
  22.478 +        goto done;
  22.479 +    }
  22.480  
  22.481 -	was_error = 0;
  22.482 +    was_error = 0;
  22.483  
  22.484 -	/* Don't return a buffer that isn't a multiple of samplesize */
  22.485 -	samplesize = ((spec->format & 0xFF) / 8) * spec->channels;
  22.486 -	*audio_len &= ~(samplesize - 1);
  22.487 +    /* Don't return a buffer that isn't a multiple of samplesize */
  22.488 +    samplesize = ((spec->format & 0xFF) / 8) * spec->channels;
  22.489 +    *audio_len &= ~(samplesize - 1);
  22.490  
  22.491  done:
  22.492 -	if (was_init && decoder) {
  22.493 -		flac.FLAC__stream_decoder_finish (decoder);
  22.494 -	}
  22.495 +    if (was_init && decoder) {
  22.496 +        flac.FLAC__stream_decoder_finish (decoder);
  22.497 +    }
  22.498  
  22.499 -	if (decoder) {
  22.500 -		flac.FLAC__stream_decoder_delete (decoder);
  22.501 -	}
  22.502 +    if (decoder) {
  22.503 +        flac.FLAC__stream_decoder_delete (decoder);
  22.504 +    }
  22.505  
  22.506 -	if (src) {
  22.507 -		if (freesrc)
  22.508 -			SDL_RWclose (src);
  22.509 -		else
  22.510 -			SDL_RWseek (src, 0, RW_SEEK_SET);
  22.511 -	}
  22.512 +    if (src) {
  22.513 +        if (freesrc)
  22.514 +            SDL_RWclose (src);
  22.515 +        else
  22.516 +            SDL_RWseek (src, 0, RW_SEEK_SET);
  22.517 +    }
  22.518  
  22.519 -	if (was_error)
  22.520 -		spec = NULL;
  22.521 +    if (was_error)
  22.522 +        spec = NULL;
  22.523  
  22.524      return spec;
  22.525  }
    23.1 --- a/load_flac.h	Tue May 21 21:09:26 2013 -0700
    23.2 +++ b/load_flac.h	Tue May 21 21:21:23 2013 -0700
    23.3 @@ -19,7 +19,7 @@
    23.4    3. This notice may not be removed or altered from any source distribution.
    23.5  
    23.6    This is the source needed to decode a FLAC into a waveform.
    23.7 -  	~ Austen Dicken (admin@cvpcs.org).
    23.8 +    ~ Austen Dicken (admin@cvpcs.org).
    23.9  */
   23.10  
   23.11  /* $Id: $ */
   23.12 @@ -27,5 +27,5 @@
   23.13  #ifdef FLAC_MUSIC
   23.14  /* Don't call this directly; use Mix_LoadWAV_RW() for now. */
   23.15  SDL_AudioSpec *Mix_LoadFLAC_RW (SDL_RWops *src, int freesrc,
   23.16 -		SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
   23.17 +        SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
   23.18  #endif
    24.1 --- a/load_ogg.c	Tue May 21 21:09:26 2013 -0700
    24.2 +++ b/load_ogg.c	Tue May 21 21:21:23 2013 -0700
    24.3 @@ -78,7 +78,7 @@
    24.4      int read, to_read;
    24.5      int must_close = 1;
    24.6      int was_error = 1;
    24.7 -    
    24.8 +
    24.9      if ( (!src) || (!audio_buf) || (!audio_len) )   /* sanity checks. */
   24.10          goto done;
   24.11  
   24.12 @@ -88,7 +88,7 @@
   24.13      callbacks.read_func = sdl_read_func;
   24.14      callbacks.seek_func = sdl_seek_func;
   24.15      callbacks.tell_func = sdl_tell_func;
   24.16 -    callbacks.close_func = freesrc ? 
   24.17 +    callbacks.close_func = freesrc ?
   24.18                             sdl_close_func_freesrc : sdl_close_func_nofreesrc;
   24.19  
   24.20      if (vorbis.ov_open_callbacks(src, &vf, NULL, 0, callbacks) != 0)
   24.21 @@ -98,9 +98,9 @@
   24.22      }
   24.23  
   24.24      must_close = 0;
   24.25 -    
   24.26 +
   24.27      info = vorbis.ov_info(&vf, -1);
   24.28 -    
   24.29 +
   24.30      *audio_buf = NULL;
   24.31      *audio_len = 0;
   24.32      memset(spec, '\0', sizeof (SDL_AudioSpec));
   24.33 @@ -109,7 +109,7 @@
   24.34      spec->channels = info->channels;
   24.35      spec->freq = info->rate;
   24.36      spec->samples = 4096; /* buffer size */
   24.37 -    
   24.38 +
   24.39      samples = (long)vorbis.ov_pcm_total(&vf, -1);
   24.40  
   24.41      *audio_len = spec->size = samples * spec->channels * 2;
   24.42 @@ -121,17 +121,17 @@
   24.43      to_read = *audio_len;
   24.44  #ifdef OGG_USE_TREMOR
   24.45      for (read = vorbis.ov_read(&vf, (char *)buf, to_read, &bitstream);
   24.46 -	 read > 0;
   24.47 -	 read = vorbis.ov_read(&vf, (char *)buf, to_read, &bitstream))
   24.48 +     read > 0;
   24.49 +     read = vorbis.ov_read(&vf, (char *)buf, to_read, &bitstream))
   24.50  #else
   24.51      for (read = vorbis.ov_read(&vf, (char *)buf, to_read, 0/*LE*/, 2/*16bit*/, 1/*signed*/, &bitstream);
   24.52           read > 0;
   24.53           read = vorbis.ov_read(&vf, (char *)buf, to_read, 0, 2, 1, &bitstream))
   24.54 -#endif	 
   24.55 +#endif
   24.56      {
   24.57          if (read == OV_HOLE || read == OV_EBADLINK)
   24.58              break; /* error */
   24.59 -        
   24.60 +
   24.61          to_read -= read;
   24.62          buf += read;
   24.63      }
    25.1 --- a/load_voc.c	Tue May 21 21:09:26 2013 -0700
    25.2 +++ b/load_voc.c	Tue May 21 21:21:23 2013 -0700
    25.3 @@ -44,48 +44,48 @@
    25.4  
    25.5  /* Private data for VOC file */
    25.6  typedef struct vocstuff {
    25.7 -	Uint32	rest;			/* bytes remaining in current block */
    25.8 -	Uint32	rate;			/* rate code (byte) of this chunk */
    25.9 -	int 	silent;		/* sound or silence? */
   25.10 -	Uint32	srate;			/* rate code (byte) of silence */
   25.11 -	Uint32	blockseek;		/* start of current output block */
   25.12 -	Uint32	samples;		/* number of samples output */
   25.13 -	Uint32	size;		/* word length of data */
   25.14 -	Uint8 	channels;	/* number of sound channels */
   25.15 -	int     has_extended;       /* Has an extended block been read? */
   25.16 +    Uint32  rest;           /* bytes remaining in current block */
   25.17 +    Uint32  rate;           /* rate code (byte) of this chunk */
   25.18 +    int     silent;         /* sound or silence? */
   25.19 +    Uint32  srate;          /* rate code (byte) of silence */
   25.20 +    Uint32  blockseek;      /* start of current output block */
   25.21 +    Uint32  samples;        /* number of samples output */
   25.22 +    Uint32  size;           /* word length of data */
   25.23 +    Uint8   channels;       /* number of sound channels */
   25.24 +    int     has_extended;   /* Has an extended block been read? */
   25.25  } vs_t;
   25.26  
   25.27 -/* Size field */ 
   25.28 +/* Size field */
   25.29  /* SJB: note that the 1st 3 are sometimes used as sizeof(type) */
   25.30 -#define	ST_SIZE_BYTE	1
   25.31 -#define ST_SIZE_8BIT	1
   25.32 -#define	ST_SIZE_WORD	2
   25.33 -#define ST_SIZE_16BIT	2
   25.34 -#define	ST_SIZE_DWORD	4
   25.35 -#define ST_SIZE_32BIT	4
   25.36 -#define	ST_SIZE_FLOAT	5
   25.37 -#define ST_SIZE_DOUBLE	6
   25.38 -#define ST_SIZE_IEEE	7	/* IEEE 80-bit floats. */
   25.39 +#define ST_SIZE_BYTE    1
   25.40 +#define ST_SIZE_8BIT    1
   25.41 +#define ST_SIZE_WORD    2
   25.42 +#define ST_SIZE_16BIT   2
   25.43 +#define ST_SIZE_DWORD   4
   25.44 +#define ST_SIZE_32BIT   4
   25.45 +#define ST_SIZE_FLOAT   5
   25.46 +#define ST_SIZE_DOUBLE  6
   25.47 +#define ST_SIZE_IEEE    7   /* IEEE 80-bit floats. */
   25.48  
   25.49  /* Style field */
   25.50 -#define ST_ENCODING_UNSIGNED	1 /* unsigned linear: Sound Blaster */
   25.51 -#define ST_ENCODING_SIGN2	2 /* signed linear 2's comp: Mac */
   25.52 -#define	ST_ENCODING_ULAW	3 /* U-law signed logs: US telephony, SPARC */
   25.53 -#define ST_ENCODING_ALAW	4 /* A-law signed logs: non-US telephony */
   25.54 -#define ST_ENCODING_ADPCM	5 /* Compressed PCM */
   25.55 -#define ST_ENCODING_IMA_ADPCM	6 /* Compressed PCM */
   25.56 -#define ST_ENCODING_GSM		7 /* GSM 6.10 33-byte frame lossy compression */
   25.57 +#define ST_ENCODING_UNSIGNED    1 /* unsigned linear: Sound Blaster */
   25.58 +#define ST_ENCODING_SIGN2       2 /* signed linear 2's comp: Mac */
   25.59 +#define ST_ENCODING_ULAW        3 /* U-law signed logs: US telephony, SPARC */
   25.60 +#define ST_ENCODING_ALAW        4 /* A-law signed logs: non-US telephony */
   25.61 +#define ST_ENCODING_ADPCM       5 /* Compressed PCM */
   25.62 +#define ST_ENCODING_IMA_ADPCM   6 /* Compressed PCM */
   25.63 +#define ST_ENCODING_GSM         7 /* GSM 6.10 33-byte frame lossy compression */
   25.64  
   25.65 -#define	VOC_TERM	0
   25.66 -#define	VOC_DATA	1
   25.67 -#define	VOC_CONT	2
   25.68 -#define	VOC_SILENCE	3
   25.69 -#define	VOC_MARKER	4
   25.70 -#define	VOC_TEXT	5
   25.71 -#define	VOC_LOOP	6
   25.72 -#define	VOC_LOOPEND	7
   25.73 +#define VOC_TERM        0
   25.74 +#define VOC_DATA        1
   25.75 +#define VOC_CONT        2
   25.76 +#define VOC_SILENCE     3
   25.77 +#define VOC_MARKER      4
   25.78 +#define VOC_TEXT        5
   25.79 +#define VOC_LOOP        6
   25.80 +#define VOC_LOOPEND     7
   25.81  #define VOC_EXTENDED    8
   25.82 -#define VOC_DATA_16	9
   25.83 +#define VOC_DATA_16     9
   25.84  
   25.85  
   25.86  static int voc_check_header(SDL_RWops *src)
   25.87 @@ -140,7 +140,7 @@
   25.88  
   25.89          if (SDL_RWread(src, bits24, sizeof (bits24), 1) != 1)
   25.90              return 1;  /* assume that's the end of the file. */
   25.91 -        
   25.92 +
   25.93          /* Size is an 24-bit value. Ugh. */
   25.94          sblen = ( (bits24[0]) | (bits24[1] << 8) | (bits24[2] << 16) );
   25.95  
    26.1 --- a/mixer.c	Tue May 21 21:09:26 2013 -0700
    26.2 +++ b/mixer.c	Tue May 21 21:21:23 2013 -0700
    26.3 @@ -43,40 +43,40 @@
    26.4  #include "effects_internal.h"
    26.5  
    26.6  /* Magic numbers for various audio file formats */
    26.7 -#define RIFF		0x46464952		/* "RIFF" */
    26.8 -#define WAVE		0x45564157		/* "WAVE" */
    26.9 -#define FORM		0x4d524f46		/* "FORM" */
   26.10 -#define OGGS		0x5367674f		/* "OggS" */
   26.11 -#define CREA		0x61657243		/* "Crea" */
   26.12 -#define FLAC		0x43614C66		/* "fLaC" */
   26.13 +#define RIFF        0x46464952      /* "RIFF" */
   26.14 +#define WAVE        0x45564157      /* "WAVE" */
   26.15 +#define FORM        0x4d524f46      /* "FORM" */
   26.16 +#define OGGS        0x5367674f      /* "OggS" */
   26.17 +#define CREA        0x61657243      /* "Crea" */
   26.18 +#define FLAC        0x43614C66      /* "fLaC" */
   26.19  
   26.20  static int audio_opened = 0;
   26.21  static SDL_AudioSpec mixer;
   26.22  
   26.23  typedef struct _Mix_effectinfo
   26.24  {
   26.25 -	Mix_EffectFunc_t callback;
   26.26 -	Mix_EffectDone_t done_callback;
   26.27 -	void *udata;
   26.28 -	struct _Mix_effectinfo *next;
   26.29 +    Mix_EffectFunc_t callback;
   26.30 +    Mix_EffectDone_t done_callback;
   26.31 +    void *udata;
   26.32 +    struct _Mix_effectinfo *next;
   26.33  } effect_info;
   26.34  
   26.35  static struct _Mix_Channel {
   26.36 -	Mix_Chunk *chunk;
   26.37 -	int playing;
   26.38 -	int paused;
   26.39 -	Uint8 *samples;
   26.40 -	int volume;
   26.41 -	int looping;
   26.42 -	int tag;
   26.43 -	Uint32 expire;
   26.44 -	Uint32 start_time;
   26.45 -	Mix_Fading fading;
   26.46 -	int fade_volume;
   26.47 -	int fade_volume_reset;
   26.48 -	Uint32 fade_length;
   26.49 -	Uint32 ticks_fade;
   26.50 -	effect_info *effects;
   26.51 +    Mix_Chunk *chunk;
   26.52 +    int playing;
   26.53 +    int paused;
   26.54 +    Uint8 *samples;
   26.55 +    int volume;
   26.56 +    int looping;
   26.57 +    int tag;
   26.58 +    Uint32 expire;
   26.59 +    Uint32 start_time;
   26.60 +    Mix_Fading fading;
   26.61 +    int fade_volume;
   26.62 +    int fade_volume_reset;
   26.63 +    Uint32 fade_length;
   26.64 +    Uint32 ticks_fade;
   26.65 +    effect_info *effects;
   26.66  } *mix_channel = NULL;
   26.67  
   26.68  static effect_info *posteffects = NULL;
   26.69 @@ -113,124 +113,124 @@
   26.70  
   26.71  int Mix_GetNumChunkDecoders(void)
   26.72  {
   26.73 -	return(num_decoders);
   26.74 +    return(num_decoders);
   26.75  }
   26.76  
   26.77  const char *Mix_GetChunkDecoder(int index)
   26.78  {
   26.79 -	if ((index < 0) || (index >= num_decoders)) {
   26.80 -		return NULL;
   26.81 -	}
   26.82 -	return(chunk_decoders[index]);
   26.83 +    if ((index < 0) || (index >= num_decoders)) {
   26.84 +        return NULL;
   26.85 +    }
   26.86 +    return(chunk_decoders[index]);
   26.87  }
   26.88  
   26.89  static void add_chunk_decoder(const char *decoder)
   26.90  {
   26.91 -	void *ptr = SDL_realloc(chunk_decoders, (num_decoders + 1) * sizeof (const char **));
   26.92 -	if (ptr == NULL) {
   26.93 -		return;  /* oh well, go on without it. */
   26.94 -	}
   26.95 -	chunk_decoders = (const char **) ptr;
   26.96 -	chunk_decoders[num_decoders++] = decoder;
   26.97 +    void *ptr = SDL_realloc(chunk_decoders, (num_decoders + 1) * sizeof (const char **));
   26.98 +    if (ptr == NULL) {
   26.99 +        return;  /* oh well, go on without it. */
  26.100 +    }
  26.101 +    chunk_decoders = (const char **) ptr;
  26.102 +    chunk_decoders[num_decoders++] = decoder;
  26.103  }
  26.104  
  26.105  /* rcg06192001 get linked library's version. */
  26.106  const SDL_version *Mix_Linked_Version(void)
  26.107  {
  26.108 -	static SDL_version linked_version;
  26.109 -	SDL_MIXER_VERSION(&linked_version);
  26.110 -	return(&linked_version);
  26.111 +    static SDL_version linked_version;
  26.112 +    SDL_MIXER_VERSION(&linked_version);
  26.113 +    return(&linked_version);
  26.114  }
  26.115  
  26.116  static int initialized = 0;
  26.117  
  26.118  int Mix_Init(int flags)
  26.119  {
  26.120 -	int result = 0;
  26.121 +    int result = 0;
  26.122  
  26.123 -	if (flags & MIX_INIT_FLUIDSYNTH) {
  26.124 +    if (flags & MIX_INIT_FLUIDSYNTH) {
  26.125  #ifdef USE_FLUIDSYNTH_MIDI
  26.126 -		if ((initialized & MIX_INIT_FLUIDSYNTH) || Mix_InitFluidSynth() == 0) {
  26.127 -			result |= MIX_INIT_FLUIDSYNTH;
  26.128 -		}
  26.129 +        if ((initialized & MIX_INIT_FLUIDSYNTH) || Mix_InitFluidSynth() == 0) {
  26.130 +            result |= MIX_INIT_FLUIDSYNTH;
  26.131 +        }
  26.132  #else
  26.133 -		Mix_SetError("Mixer not built with FluidSynth support");
  26.134 +        Mix_SetError("Mixer not built with FluidSynth support");
  26.135  #endif
  26.136 -	}
  26.137 -	if (flags & MIX_INIT_FLAC) {
  26.138 +    }
  26.139 +    if (flags & MIX_INIT_FLAC) {
  26.140  #ifdef FLAC_MUSIC
  26.141 -		if ((initialized & MIX_INIT_FLAC) || Mix_InitFLAC() == 0) {
  26.142 -			result |= MIX_INIT_FLAC;
  26.143 -		}
  26.144 +        if ((initialized & MIX_INIT_FLAC) || Mix_InitFLAC() == 0) {
  26.145 +            result |= MIX_INIT_FLAC;
  26.146 +        }
  26.147  #else
  26.148 -		Mix_SetError("Mixer not built with FLAC support");
  26.149 +        Mix_SetError("Mixer not built with FLAC support");
  26.150  #endif
  26.151 -	}
  26.152 -	if (flags & MIX_INIT_MOD) {
  26.153 +    }
  26.154 +    if (flags & MIX_INIT_MOD) {
  26.155  #ifdef MOD_MUSIC
  26.156 -		if ((initialized & MIX_INIT_MOD) || Mix_InitMOD() == 0) {
  26.157 -			result |= MIX_INIT_MOD;
  26.158 -		}
  26.159 +        if ((initialized & MIX_INIT_MOD) || Mix_InitMOD() == 0) {
  26.160 +            result |= MIX_INIT_MOD;
  26.161 +        }
  26.162  #else
  26.163 -		Mix_SetError("Mixer not built with MOD support");
  26.164 +        Mix_SetError("Mixer not built with MOD support");
  26.165  #endif
  26.166 -	}
  26.167 -	if (flags & MIX_INIT_MP3) {
  26.168 +    }
  26.169 +    if (flags & MIX_INIT_MP3) {
  26.170  #ifdef MP3_MUSIC
  26.171 -		if ((initialized & MIX_INIT_MP3) || Mix_InitMP3() == 0) {
  26.172 -			result |= MIX_INIT_MP3;
  26.173 -		}
  26.174 +        if ((initialized & MIX_INIT_MP3) || Mix_InitMP3() == 0) {
  26.175 +            result |= MIX_INIT_MP3;
  26.176 +        }
  26.177  #else
  26.178 -		Mix_SetError("Mixer not built with MP3 support");
  26.179 +        Mix_SetError("Mixer not built with MP3 support");
  26.180  #endif
  26.181 -	}
  26.182 -	if (flags & MIX_INIT_OGG) {
  26.183 +    }
  26.184 +    if (flags & MIX_INIT_OGG) {
  26.185  #ifdef OGG_MUSIC
  26.186 -		if ((initialized & MIX_INIT_OGG) || Mix_InitOgg() == 0) {
  26.187 -			result |= MIX_INIT_OGG;
  26.188 -		}
  26.189 +        if ((initialized & MIX_INIT_OGG) || Mix_InitOgg() == 0) {
  26.190 +            result |= MIX_INIT_OGG;
  26.191 +        }
  26.192  #else
  26.193 -		Mix_SetError("Mixer not built with Ogg Vorbis support");
  26.194 +        Mix_SetError("Mixer not built with Ogg Vorbis support");
  26.195  #endif
  26.196 -	}
  26.197 -	initialized |= result;
  26.198 +    }
  26.199 +    initialized |= result;
  26.200  
  26.201 -	return (result);
  26.202 +    return (result);
  26.203  }
  26.204  
  26.205  void Mix_Quit()
  26.206  {
  26.207  #ifdef USE_FLUIDSYNTH_MIDI
  26.208 -	if (initialized & MIX_INIT_FLUIDSYNTH) {
  26.209 -		Mix_QuitFluidSynth();
  26.210 -	}
  26.211 +    if (initialized & MIX_INIT_FLUIDSYNTH) {
  26.212 +        Mix_QuitFluidSynth();
  26.213 +    }
  26.214  #endif
  26.215  #ifdef FLAC_MUSIC
  26.216 -	if (initialized & MIX_INIT_FLAC) {
  26.217 -		Mix_QuitFLAC();
  26.218 -	}
  26.219 +    if (initialized & MIX_INIT_FLAC) {
  26.220 +        Mix_QuitFLAC();
  26.221 +    }
  26.222  #endif
  26.223  #ifdef MOD_MUSIC
  26.224 -	if (initialized & MIX_INIT_MOD) {
  26.225 -		Mix_QuitMOD();
  26.226 -	}
  26.227 +    if (initialized & MIX_INIT_MOD) {
  26.228 +        Mix_QuitMOD();
  26.229 +    }
  26.230  #endif
  26.231  #ifdef MP3_MUSIC
  26.232 -	if (initialized & MIX_INIT_MP3) {
  26.233 -		Mix_QuitMP3();
  26.234 -	}
  26.235 +    if (initialized & MIX_INIT_MP3) {
  26.236 +        Mix_QuitMP3();
  26.237 +    }
  26.238  #endif
  26.239  #ifdef OGG_MUSIC
  26.240 -	if (initialized & MIX_INIT_OGG) {
  26.241 -		Mix_QuitOgg();
  26.242 -	}
  26.243 +    if (initialized & MIX_INIT_OGG) {
  26.244 +        Mix_QuitOgg();
  26.245 +    }
  26.246  #endif
  26.247  #ifdef MID_MUSIC
  26.248 -	if (soundfont_paths) {
  26.249 -		SDL_free(soundfont_paths);
  26.250 -	}
  26.251 +    if (soundfont_paths) {
  26.252 +        SDL_free(soundfont_paths);
  26.253 +    }
  26.254  #endif
  26.255 -	initialized = 0;
  26.256 +    initialized = 0;
  26.257  }
  26.258  
  26.259  static int _Mix_remove_all_effects(int channel, effect_info **e);
  26.260 @@ -242,163 +242,163 @@
  26.261   */
  26.262  static void _Mix_channel_done_playing(int channel)
  26.263  {
  26.264 -	if (channel_done_callback) {
  26.265 -	    channel_done_callback(channel);
  26.266 -	}
  26.267 +    if (channel_done_callback) {
  26.268 +        channel_done_callback(channel);
  26.269 +    }
  26.270  
  26.271 -	/*
  26.272 -	 * Call internal function directly, to avoid locking audio from
  26.273 -	 *   inside audio callback.
  26.274 -	 */
  26.275 -	_Mix_remove_all_effects(channel, &mix_channel[channel].effects);
  26.276 +    /*
  26.277 +     * Call internal function directly, to avoid locking audio from
  26.278 +     *   inside audio callback.
  26.279 +     */
  26.280 +    _Mix_remove_all_effects(channel, &mix_channel[channel].effects);
  26.281  }
  26.282  
  26.283  
  26.284  static void *Mix_DoEffects(int chan, void *snd, int len)
  26.285  {
  26.286 -	int posteffect = (chan == MIX_CHANNEL_POST);
  26.287 -	effect_info *e = ((posteffect) ? posteffects : mix_channel[chan].effects);
  26.288 -	void *buf = snd;
  26.289 +    int posteffect = (chan == MIX_CHANNEL_POST);
  26.290 +    effect_info *e = ((posteffect) ? posteffects : mix_channel[chan].effects);
  26.291 +    void *buf = snd;
  26.292  
  26.293 -	if (e != NULL) {    /* are there any registered effects? */
  26.294 -		/* if this is the postmix, we can just overwrite the original. */
  26.295 -		if (!posteffect) {
  26.296 -			buf = SDL_malloc(len);
  26.297 -			if (buf == NULL) {
  26.298 -				return(snd);
  26.299 -			}
  26.300 -			memcpy(buf, snd, len);
  26.301 -		}
  26.302 +    if (e != NULL) {    /* are there any registered effects? */
  26.303 +        /* if this is the postmix, we can just overwrite the original. */
  26.304 +        if (!posteffect) {
  26.305 +            buf = SDL_malloc(len);
  26.306 +            if (buf == NULL) {
  26.307 +                return(snd);
  26.308 +            }
  26.309 +            memcpy(buf, snd, len);
  26.310 +        }
  26.311  
  26.312 -		for (; e != NULL; e = e->next) {
  26.313 -			if (e->callback != NULL) {
  26.314 -				e->callback(chan, buf, len, e->udata);
  26.315 -			}
  26.316 -		}
  26.317 -	}
  26.318 +        for (; e != NULL; e = e->next) {
  26.319 +            if (e->callback != NULL) {
  26.320 +                e->callback(chan, buf, len, e->udata);
  26.321 +            }
  26.322 +        }
  26.323 +    }
  26.324  
  26.325 -	/* be sure to SDL_free() the return value if != snd ... */
  26.326 -	return(buf);
  26.327 +    /* be sure to SDL_free() the return value if != snd ... */
  26.328 +    return(buf);
  26.329  }
  26.330  
  26.331  
  26.332  /* Mixing function */
  26.333  static void mix_channels(void *udata, Uint8 *stream, int len)
  26.334  {
  26.335 -	Uint8 *mix_input;
  26.336 -	int i, mixable, volume = SDL_MIX_MAXVOLUME;
  26.337 -	Uint32 sdl_ticks;
  26.338 +    Uint8 *mix_input;
  26.339 +    int i, mixable, volume = SDL_MIX_MAXVOLUME;
  26.340 +    Uint32 sdl_ticks;
  26.341  
  26.342  #if SDL_VERSION_ATLEAST(1, 3, 0)
  26.343 -	/* Need to initialize the stream in SDL 1.3+ */
  26.344 -	memset(stream, mixer.silence, len);
  26.345 +    /* Need to initialize the stream in SDL 1.3+ */
  26.346 +    memset(stream, mixer.silence, len);
  26.347  #endif
  26.348  
  26.349 -	/* Mix the music (must be done before the channels are added) */
  26.350 -	if ( music_active || (mix_music != music_mixer) ) {
  26.351 -		mix_music(music_data, stream, len);
  26.352 -	}
  26.353 +    /* Mix the music (must be done before the channels are added) */
  26.354 +    if ( music_active || (mix_music != music_mixer) ) {
  26.355 +        mix_music(music_data, stream, len);
  26.356 +    }
  26.357  
  26.358 -	/* Mix any playing channels... */
  26.359 -	sdl_ticks = SDL_GetTicks();
  26.360 -	for ( i=0; i<num_channels; ++i ) {
  26.361 -		if( ! mix_channel[i].paused ) {
  26.362 -			if ( mix_channel[i].expire > 0 && mix_channel[i].expire < sdl_ticks ) {
  26.363 -				/* Expiration delay for that channel is reached */
  26.364 -				mix_channel[i].playing = 0;
  26.365 -				mix_channel[i].looping = 0;
  26.366 -				mix_channel[i].fading = MIX_NO_FADING;
  26.367 -				mix_channel[i].expire = 0;
  26.368 -				_Mix_channel_done_playing(i);
  26.369 -			} else if ( mix_channel[i].fading != MIX_NO_FADING ) {
  26.370 -				Uint32 ticks = sdl_ticks - mix_channel[i].ticks_fade;
  26.371 -				if( ticks > mix_channel[i].fade_length ) {
  26.372 -				    Mix_Volume(i, mix_channel[i].fade_volume_reset); /* Restore the volume */
  26.373 -					if( mix_channel[i].fading == MIX_FADING_OUT ) {
  26.374 -						mix_channel[i].playing = 0;
  26.375 -						mix_channel[i].looping = 0;
  26.376 -						mix_channel[i].expire = 0;
  26.377 -						_Mix_channel_done_playing(i);
  26.378 -					}
  26.379 -					mix_channel[i].fading = MIX_NO_FADING;
  26.380 -				} else {
  26.381 -					if( mix_channel[i].fading == MIX_FADING_OUT ) {
  26.382 -						Mix_Volume(i, (mix_channel[i].fade_volume * (mix_channel[i].fade_length-ticks))
  26.383 -								   / mix_channel[i].fade_length );
  26.384 -					} else {
  26.385 -						Mix_Volume(i, (mix_channel[i].fade_volume * ticks) / mix_channel[i].fade_length );
  26.386 -					}
  26.387 -				}
  26.388 -			}
  26.389 -			if ( mix_channel[i].playing > 0 ) {
  26.390 -				int index = 0;
  26.391 -				int remaining = len;
  26.392 -				while (mix_channel[i].playing > 0 && index < len) {
  26.393 -					remaining = len - index;
  26.394 -					volume = (mix_channel[i].volume*mix_channel[i].chunk->volume) / MIX_MAX_VOLUME;
  26.395 -					mixable = mix_channel[i].playing;
  26.396 -					if ( mixable > remaining ) {
  26.397 -						mixable = remaining;
  26.398 -					}
  26.399 +    /* Mix any playing channels... */
  26.400 +    sdl_ticks = SDL_GetTicks();
  26.401 +    for ( i=0; i<num_channels; ++i ) {
  26.402 +        if( ! mix_channel[i].paused ) {
  26.403 +            if ( mix_channel[i].expire > 0 && mix_channel[i].expire < sdl_ticks ) {
  26.404 +                /* Expiration delay for that channel is reached */
  26.405 +                mix_channel[i].playing = 0;
  26.406 +                mix_channel[i].looping = 0;
  26.407 +                mix_channel[i].fading = MIX_NO_FADING;
  26.408 +                mix_channel[i].expire = 0;
  26.409 +                _Mix_channel_done_playing(i);
  26.410 +            } else if ( mix_channel[i].fading != MIX_NO_FADING ) {
  26.411 +                Uint32 ticks = sdl_ticks - mix_channel[i].ticks_fade;
  26.412 +                if( ticks > mix_channel[i].fade_length ) {
  26.413 +                    Mix_Volume(i, mix_channel[i].fade_volume_reset); /* Restore the volume */
  26.414 +                    if( mix_channel[i].fading == MIX_FADING_OUT ) {
  26.415 +                        mix_channel[i].playing = 0;
  26.416 +                        mix_channel[i].looping = 0;
  26.417 +                        mix_channel[i].expire = 0;
  26.418 +                        _Mix_channel_done_playing(i);
  26.419 +                    }
  26.420 +                    mix_channel[i].fading = MIX_NO_FADING;
  26.421 +                } else {
  26.422 +                    if( mix_channel[i].fading == MIX_FADING_OUT ) {
  26.423 +                        Mix_Volume(i, (mix_channel[i].fade_volume * (mix_channel[i].fade_length-ticks))
  26.424 +                                   / mix_channel[i].fade_length );
  26.425 +                    } else {
  26.426 +                        Mix_Volume(i, (mix_channel[i].fade_volume * ticks) / mix_channel[i].fade_length );
  26.427 +                    }
  26.428 +                }
  26.429 +            }
  26.430 +            if ( mix_channel[i].playing > 0 ) {
  26.431 +                int index = 0;
  26.432 +                int remaining = len;
  26.433 +                while (mix_channel[i].playing > 0 && index < len) {
  26.434 +                    remaining = len - index;
  26.435 +                    volume = (mix_channel[i].volume*mix_channel[i].chunk->volume) / MIX_MAX_VOLUME;
  26.436 +                    mixable = mix_channel[i].playing;
  26.437 +                    if ( mixable > remaining ) {
  26.438 +                        mixable = remaining;
  26.439 +                    }
  26.440  
  26.441 -					mix_input = Mix_DoEffects(i, mix_channel[i].samples, mixable);
  26.442 -					SDL_MixAudio(stream+index,mix_input,mixable,volume);
  26.443 -					if (mix_input != mix_channel[i].samples)
  26.444 -						SDL_free(mix_input);
  26.445 +                    mix_input = Mix_DoEffects(i, mix_channel[i].samples, mixable);
  26.446 +                    SDL_MixAudio(stream+index,mix_input,mixable,volume);
  26.447 +                    if (mix_input != mix_channel[i].samples)
  26.448 +                        SDL_free(mix_input);
  26.449  
  26.450 -					mix_channel[i].samples += mixable;
  26.451 -					mix_channel[i].playing -= mixable;
  26.452 -					index += mixable;
  26.453 +                    mix_channel[i].samples += mixable;
  26.454 +                    mix_channel[i].playing -= mixable;
  26.455 +                    index += mixable;
  26.456  
  26.457 -					/* rcg06072001 Alert app if channel is done playing. */
  26.458 -					if (!mix_channel[i].playing && !mix_channel[i].looping) {
  26.459 -						_Mix_channel_done_playing(i);
  26.460 -					}
  26.461 -				}
  26.462 +                    /* rcg06072001 Alert app if channel is done playing. */
  26.463 +                    if (!mix_channel[i].playing && !mix_channel[i].looping) {
  26.464 +                        _Mix_channel_done_playing(i);
  26.465 +                    }
  26.466 +                }
  26.467  
  26.468 -				/* If looping the sample and we are at its end, make sure
  26.469 -				   we will still return a full buffer */
  26.470 -				while ( mix_channel[i].looping && index < len ) {
  26.471 -					int alen = mix_channel[i].chunk->alen;
  26.472 -					remaining = len - index;
  26.473 -					if (remaining > alen) {
  26.474 -						remaining = alen;
  26.475 -					}
  26.476 +                /* If looping the sample and we are at its end, make sure
  26.477 +                   we will still return a full buffer */
  26.478 +                while ( mix_channel[i].looping && index < len ) {
  26.479 +                    int alen = mix_channel[i].chunk->alen;
  26.480 +                    remaining = len - index;
  26.481 +                    if (remaining > alen) {
  26.482 +                        remaining = alen;
  26.483 +                    }
  26.484  
  26.485 -					mix_input = Mix_DoEffects(i, mix_channel[i].chunk->abuf, remaining);
  26.486 -					SDL_MixAudio(stream+index, mix_input, remaining, volume);
  26.487 -					if (mix_input != mix_channel[i].chunk->abuf)
  26.488 -						SDL_free(mix_input);
  26.489 +                    mix_input = Mix_DoEffects(i, mix_channel[i].chunk->abuf, remaining);
  26.490 +                    SDL_MixAudio(stream+index, mix_input, remaining, volume);
  26.491 +                    if (mix_input != mix_channel[i].chunk->abuf)
  26.492 +                        SDL_free(mix_input);
  26.493  
  26.494 -					--mix_channel[i].looping;
  26.495 -					mix_channel[i].samples = mix_channel[i].chunk->abuf + remaining;
  26.496 -					mix_channel[i].playing = mix_channel[i].chunk->alen - remaining;
  26.497 -					index += remaining;
  26.498 -				}
  26.499 -				if ( ! mix_channel[i].playing && mix_channel[i].looping ) {
  26.500 -					--mix_channel[i].looping;
  26.501 -					mix_channel[i].samples = mix_channel[i].chunk->abuf;
  26.502 -					mix_channel[i].playing = mix_channel[i].chunk->alen;
  26.503 -				}
  26.504 -			}
  26.505 -		}
  26.506 -	}
  26.507 +                    --mix_channel[i].looping;
  26.508 +                    mix_channel[i].samples = mix_channel[i].chunk->abuf + remaining;
  26.509 +                    mix_channel[i].playing = mix_channel[i].chunk->alen - remaining;
  26.510 +                    index += remaining;
  26.511 +                }
  26.512 +                if ( ! mix_channel[i].playing && mix_channel[i].looping ) {
  26.513 +                    --mix_channel[i].looping;
  26.514 +                    mix_channel[i].samples = mix_channel[i].chunk->abuf;
  26.515 +                    mix_channel[i].playing = mix_channel[i].chunk->alen;
  26.516 +                }
  26.517 +            }
  26.518 +        }
  26.519 +    }
  26.520  
  26.521 -	/* rcg06122001 run posteffects... */
  26.522 -	Mix_DoEffects(MIX_CHANNEL_POST, stream, len);
  26.523 +    /* rcg06122001 run posteffects... */
  26.524 +    Mix_DoEffects(MIX_CHANNEL_POST, stream, len);
  26.525  
  26.526 -	if ( mix_postmix ) {
  26.527 -		mix_postmix(mix_postmix_data, stream, len);
  26.528 -	}
  26.529 +    if ( mix_postmix ) {
  26.530 +        mix_postmix(mix_postmix_data, stream, len);
  26.531 +    }
  26.532  }
  26.533  
  26.534  #if 0
  26.535  static void PrintFormat(char *title, SDL_AudioSpec *fmt)
  26.536  {
  26.537 -	printf("%s: %d bit %s audio (%s) at %u Hz\n", title, (fmt->format&0xFF),
  26.538 -			(fmt->format&0x8000) ? "signed" : "unsigned",
  26.539 -			(fmt->channels > 2) ? "surround" :
  26.540 -			(fmt->channels > 1) ? "stereo" : "mono", fmt->freq);
  26.541 +    printf("%s: %d bit %s audio (%s) at %u Hz\n", title, (fmt->format&0xFF),
  26.542 +            (fmt->format&0x8000) ? "signed" : "unsigned",
  26.543 +            (fmt->channels > 2) ? "surround" :
  26.544 +            (fmt->channels > 1) ? "stereo" : "mono", fmt->freq);
  26.545  }
  26.546  #endif
  26.547  
  26.548 @@ -406,77 +406,77 @@
  26.549  /* Open the mixer with a certain desired audio format */
  26.550  int Mix_OpenAudio(int frequency, Uint16 format, int nchannels, int chunksize)
  26.551  {
  26.552 -	int i;
  26.553 -	SDL_AudioSpec desired;
  26.554 +    int i;
  26.555 +    SDL_AudioSpec desired;
  26.556  
  26.557 -	/* If the mixer is already opened, increment open count */
  26.558 -	if ( audio_opened ) {
  26.559 -		if ( format == mixer.format && nchannels == mixer.channels ) {
  26.560 -			++audio_opened;
  26.561 -			return(0);
  26.562 -		}
  26.563 -		while ( audio_opened ) {
  26.564 -			Mix_CloseAudio();
  26.565 -		}
  26.566 -	}
  26.567 +    /* If the mixer is already opened, increment open count */
  26.568 +    if ( audio_opened ) {
  26.569 +        if ( format == mixer.format && nchannels == mixer.channels ) {
  26.570 +            ++audio_opened;
  26.571 +            return(0);
  26.572 +        }
  26.573 +        while ( audio_opened ) {
  26.574 +            Mix_CloseAudio();
  26.575 +        }
  26.576 +    }
  26.577  
  26.578 -	/* Set the desired format and frequency */
  26.579 -	desired.freq = frequency;
  26.580 -	desired.format = format;
  26.581 -	desired.channels = nchannels;
  26.582 -	desired.samples = chunksize;
  26.583 -	desired.callback = mix_channels;
  26.584 -	desired.userdata = NULL;
  26.585 +    /* Set the desired format and frequency */
  26.586 +    desired.freq = frequency;
  26.587 +    desired.format = format;
  26.588 +    desired.channels = nchannels;
  26.589 +    desired.samples = chunksize;
  26.590 +    desired.callback = mix_channels;
  26.591 +    desired.userdata = NULL;
  26.592  
  26.593 -	/* Accept nearly any audio format */
  26.594 -	if ( SDL_OpenAudio(&desired, &mixer) < 0 ) {
  26.595 -		return(-1);
  26.596 -	}
  26.597 +    /* Accept nearly any audio format */
  26.598 +    if ( SDL_OpenAudio(&desired, &mixer) < 0 ) {
  26.599 +        return(-1);
  26.600 +    }
  26.601  #if 0
  26.602 -	PrintFormat("Audio device", &mixer);
  26.603 +    PrintFormat("Audio device", &mixer);
  26.604  #endif
  26.605  
  26.606 -	/* Initialize the music players */
  26.607 -	if ( open_music(&mixer) < 0 ) {
  26.608 -		SDL_CloseAudio();
  26.609 -		return(-1);
  26.610 -	}
  26.611 +    /* Initialize the music players */
  26.612 +    if ( open_music(&mixer) < 0 ) {
  26.613 +        SDL_CloseAudio();
  26.614 +        return(-1);
  26.615 +    }
  26.616  
  26.617 -	num_channels = MIX_CHANNELS;
  26.618 -	mix_channel = (struct _Mix_Channel *) SDL_malloc(num_channels * sizeof(struct _Mix_Channel));
  26.619 +    num_channels = MIX_CHANNELS;
  26.620 +    mix_channel = (struct _Mix_Channel *) SDL_malloc(num_channels * sizeof(struct _Mix_Channel));
  26.621  
  26.622 -	/* Clear out the audio channels */
  26.623 -	for ( i=0; i<num_channels; ++i ) {
  26.624 -		mix_channel[i].chunk = NULL;
  26.625 -		mix_channel[i].playing = 0;
  26.626 -		mix_channel[i].looping = 0;
  26.627 -		mix_channel[i].volume = SDL_MIX_MAXVOLUME;
  26.628 -		mix_channel[i].fade_volume = SDL_MIX_MAXVOLUME;
  26.629 -		mix_channel[i].fade_volume_reset = SDL_MIX_MAXVOLUME;
  26.630 -		mix_channel[i].fading = MIX_NO_FADING;
  26.631 -		mix_channel[i].tag = -1;
  26.632 -		mix_channel[i].expire = 0;
  26.633 -		mix_channel[i].effects = NULL;
  26.634 -		mix_channel[i].paused = 0;
  26.635 -	}
  26.636 -	Mix_VolumeMusic(SDL_MIX_MAXVOLUME);
  26.637 +    /* Clear out the audio channels */
  26.638 +    for ( i=0; i<num_channels; ++i ) {
  26.639 +        mix_channel[i].chunk = NULL;
  26.640 +        mix_channel[i].playing = 0;
  26.641 +        mix_channel[i].looping = 0;
  26.642 +        mix_channel[i].volume = SDL_MIX_MAXVOLUME;
  26.643 +        mix_channel[i].fade_volume = SDL_MIX_MAXVOLUME;
  26.644 +        mix_channel[i].fade_volume_reset = SDL_MIX_MAXVOLUME;
  26.645 +        mix_channel[i].fading = MIX_NO_FADING;
  26.646 +        mix_channel[i].tag = -1;
  26.647 +        mix_channel[i].expire = 0;
  26.648 +        mix_channel[i].effects = NULL;
  26.649 +        mix_channel[i].paused = 0;
  26.650 +    }
  26.651 +    Mix_VolumeMusic(SDL_MIX_MAXVOLUME);
  26.652  
  26.653 -	_Mix_InitEffects();
  26.654 +    _Mix_InitEffects();
  26.655  
  26.656 -	/* This list is (currently) decided at build time. */
  26.657 -	add_chunk_decoder("WAVE");
  26.658 -	add_chunk_decoder("AIFF");
  26.659 -	add_chunk_decoder("VOC");
  26.660 +    /* This list is (currently) decided at build time. */
  26.661 +    add_chunk_decoder("WAVE");
  26.662 +    add_chunk_decoder("AIFF");
  26.663 +    add_chunk_decoder("VOC");
  26.664  #ifdef OGG_MUSIC
  26.665 -	add_chunk_decoder("OGG");
  26.666 +    add_chunk_decoder("OGG");
  26.667  #endif
  26.668  #ifdef FLAC_MUSIC
  26.669 -	add_chunk_decoder("FLAC");
  26.670 +    add_chunk_decoder("FLAC");
  26.671  #endif
  26.672  
  26.673 -	audio_opened = 1;
  26.674 -	SDL_PauseAudio(0);
  26.675 -	return(0);
  26.676 +    audio_opened = 1;
  26.677 +    SDL_PauseAudio(0);
  26.678 +    return(0);
  26.679  }
  26.680  
  26.681  /* Dynamically change the number of channels managed by the mixer.
  26.682 @@ -485,56 +485,56 @@
  26.683   */
  26.684  int Mix_AllocateChannels(int numchans)
  26.685  {
  26.686 -	if ( numchans<0 || numchans==num_channels )
  26.687 -		return(num_channels);
  26.688 +    if ( numchans<0 || numchans==num_channels )
  26.689 +        return(num_channels);
  26.690  
  26.691 -	if ( numchans < num_channels ) {
  26.692 -		/* Stop the affected channels */
  26.693 -		int i;
  26.694 -		for(i=numchans; i < num_channels; i++) {
  26.695 -			Mix_UnregisterAllEffects(i);
  26.696 -			Mix_HaltChannel(i);
  26.697 -		}
  26.698 -	}
  26.699 -	SDL_LockAudio();
  26.700 -	mix_channel = (struct _Mix_Channel *) SDL_realloc(mix_channel, numchans * sizeof(struct _Mix_Channel));
  26.701 -	if ( numchans > num_channels ) {
  26.702 -		/* Initialize the new channels */
  26.703 -		int i;
  26.704 -		for(i=num_channels; i < numchans; i++) {
  26.705 -			mix_channel[i].chunk = NULL;
  26.706 -			mix_channel[i].playing = 0;
  26.707 -			mix_channel[i].looping = 0;
  26.708 -			mix_channel[i].volume = SDL_MIX_MAXVOLUME;
  26.709 -			mix_channel[i].fade_volume = SDL_MIX_MAXVOLUME;
  26.710 -			mix_channel[i].fade_volume_reset = SDL_MIX_MAXVOLUME;
  26.711 -			mix_channel[i].fading = MIX_NO_FADING;
  26.712 -			mix_channel[i].tag = -1;
  26.713 -			mix_channel[i].expire = 0;
  26.714 -			mix_channel[i].effects = NULL;
  26.715 -			mix_channel[i].paused = 0;
  26.716 -		}
  26.717 -	}
  26.718 -	num_channels = numchans;
  26.719 -	SDL_UnlockAudio();
  26.720 -	return(num_channels);
  26.721 +    if ( numchans < num_channels ) {
  26.722 +        /* Stop the affected channels */
  26.723 +        int i;
  26.724 +        for(i=numchans; i < num_channels; i++) {
  26.725 +            Mix_UnregisterAllEffects(i);
  26.726 +            Mix_HaltChannel(i);
  26.727 +        }
  26.728 +    }
  26.729 +    SDL_LockAudio();
  26.730 +    mix_channel = (struct _Mix_Channel *) SDL_realloc(mix_channel, numchans * sizeof(struct _Mix_Channel));
  26.731 +    if ( numchans > num_channels ) {
  26.732 +        /* Initialize the new channels */
  26.733 +        int i;
  26.734 +        for(i=num_channels; i < numchans; i++) {
  26.735 +            mix_channel[i].chunk = NULL;
  26.736 +            mix_channel[i].playing = 0;
  26.737 +            mix_channel[i].looping = 0;
  26.738 +            mix_channel[i].volume = SDL_MIX_MAXVOLUME;
  26.739 +            mix_channel[i].fade_volume = SDL_MIX_MAXVOLUME;
  26.740 +            mix_channel[i].fade_volume_reset = SDL_MIX_MAXVOLUME;
  26.741 +            mix_channel[i].fading = MIX_NO_FADING;
  26.742 +            mix_channel[i].tag = -1;
  26.743 +            mix_channel[i].expire = 0;
  26.744 +            mix_channel[i].effects = NULL;
  26.745 +            mix_channel[i].paused = 0;
  26.746 +        }
  26.747 +    }
  26.748 +    num_channels = numchans;
  26.749 +    SDL_UnlockAudio();
  26.750 +    return(num_channels);
  26.751  }
  26.752  
  26.753  /* Return the actual mixer parameters */
  26.754  int Mix_QuerySpec(int *frequency, Uint16 *format, int *channels)
  26.755  {
  26.756 -	if ( audio_opened ) {
  26.757 -		if ( frequency ) {
  26.758 -			*frequency = mixer.freq;
  26.759 -		}
  26.760 -		if ( format ) {
  26.761 -			*format = mixer.format;
  26.762 -		}
  26.763 -		if ( channels ) {
  26.764 -			*channels = mixer.channels;
  26.765 -		}
  26.766 -	}
  26.767 -	return(audio_opened);
  26.768 +    if ( audio_opened ) {
  26.769 +        if ( frequency ) {
  26.770 +            *frequency = mixer.freq;
  26.771 +        }
  26.772 +        if ( format ) {
  26.773 +            *format = mixer.format;
  26.774 +        }
  26.775 +        if ( channels ) {
  26.776 +            *channels = mixer.channels;
  26.777 +        }
  26.778 +    }
  26.779 +    return(audio_opened);
  26.780  }
  26.781  
  26.782  
  26.783 @@ -546,213 +546,213 @@
  26.784  /* Load a wave file */
  26.785  Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc)
  26.786  {
  26.787 -	Uint32 magic;
  26.788 -	Mix_Chunk *chunk;
  26.789 -	SDL_AudioSpec wavespec, *loaded;
  26.790 -	SDL_AudioCVT wavecvt;
  26.791 -	int samplesize;
  26.792 +    Uint32 magic;
  26.793 +    Mix_Chunk *chunk;
  26.794 +    SDL_AudioSpec wavespec, *loaded;
  26.795 +    SDL_AudioCVT wavecvt;
  26.796 +    int samplesize;
  26.797  
  26.798 -	/* rcg06012001 Make sure src is valid */
  26.799 -	if ( ! src ) {
  26.800 -		SDL_SetError("Mix_LoadWAV_RW with NULL src");
  26.801 -		return(NULL);
  26.802 -	}
  26.803 +    /* rcg06012001 Make sure src is valid */
  26.804 +    if ( ! src ) {
  26.805 +        SDL_SetError("Mix_LoadWAV_RW with NULL src");
  26.806 +        return(NULL);
  26.807 +    }
  26.808  
  26.809 -	/* Make sure audio has been opened */
  26.810 -	if ( ! audio_opened ) {
  26.811 -		SDL_SetError("Audio device hasn't been opened");
  26.812 -		if ( freesrc && src ) {
  26.813 -			SDL_RWclose(src);
  26.814 -		}
  26.815 -		return(NULL);
  26.816 -	}
  26.817 +    /* Make sure audio has been opened */
  26.818 +    if ( ! audio_opened ) {
  26.819 +        SDL_SetError("Audio device hasn't been opened");
  26.820 +        if ( freesrc && src ) {
  26.821 +            SDL_RWclose(src);
  26.822 +        }
  26.823 +        return(NULL);
  26.824 +    }
  26.825  
  26.826 -	/* Allocate the chunk memory */
  26.827 -	chunk = (Mix_Chunk *)SDL_malloc(sizeof(Mix_Chunk));
  26.828 -	if ( chunk == NULL ) {
  26.829 -		SDL_SetError("Out of memory");
  26.830 -		if ( freesrc ) {
  26.831 -			SDL_RWclose(src);
  26.832 -		}
  26.833 -		return(NULL);
  26.834 -	}
  26.835 +    /* Allocate the chunk memory */
  26.836 +    chunk = (Mix_Chunk *)SDL_malloc(sizeof(Mix_Chunk));
  26.837 +    if ( chunk == NULL ) {
  26.838 +        SDL_SetError("Out of memory");
  26.839 +        if ( freesrc ) {
  26.840 +            SDL_RWclose(src);
  26.841 +        }
  26.842 +        return(NULL);
  26.843 +    }
  26.844  
  26.845 -	/* Find out what kind of audio file this is */
  26.846 -	magic = SDL_ReadLE32(src);
  26.847 -	/* Seek backwards for compatibility with older loaders */
  26.848 -	SDL_RWseek(src, -(int)sizeof(Uint32), RW_SEEK_CUR);
  26.849 +    /* Find out what kind of audio file this is */
  26.850 +    magic = SDL_ReadLE32(src);
  26.851 +    /* Seek backwards for compatibility with older loaders */
  26.852 +    SDL_RWseek(src, -(int)sizeof(Uint32), RW_SEEK_CUR);
  26.853  
  26.854 -	switch (magic) {
  26.855 -		case WAVE:
  26.856 -		case RIFF:
  26.857 -			loaded = SDL_LoadWAV_RW(src, freesrc, &wavespec,
  26.858 -					(Uint8 **)&chunk->abuf, &chunk->alen);
  26.859 -			break;
  26.860 -		case FORM:
  26.861 -			loaded = Mix_LoadAIFF_RW(src, freesrc, &wavespec,
  26.862 -					(Uint8 **)&chunk->abuf, &chunk->alen);
  26.863 -			break;
  26.864 +    switch (magic) {
  26.865 +        case WAVE:
  26.866 +        case RIFF:
  26.867 +            loaded = SDL_LoadWAV_RW(src, freesrc, &wavespec,
  26.868 +                    (Uint8 **)&chunk->abuf, &chunk->alen);
  26.869 +            break;
  26.870 +        case FORM:
  26.871 +            loaded = Mix_LoadAIFF_RW(src, freesrc, &wavespec,
  26.872 +                    (Uint8 **)&chunk->abuf, &chunk->alen);
  26.873 +            break;
  26.874  #ifdef OGG_MUSIC
  26.875 -		case OGGS:
  26.876 -			loaded = Mix_LoadOGG_RW(src, freesrc, &wavespec,
  26.877 -					(Uint8 **)&chunk->abuf, &chunk->alen);
  26.878 -			break;
  26.879 +        case OGGS:
  26.880 +            loaded = Mix_LoadOGG_RW(src, freesrc, &wavespec,
  26.881 +                    (Uint8 **)&chunk->abuf, &chunk->alen);
  26.882 +            break;
  26.883  #endif
  26.884  #ifdef FLAC_MUSIC
  26.885 -		case FLAC:
  26.886 -			loaded = Mix_LoadFLAC_RW(src, freesrc, &wavespec,
  26.887 -					(Uint8 **)&chunk->abuf, &chunk->alen);
  26.888 -			break;
  26.889 +        case FLAC:
  26.890 +            loaded = Mix_LoadFLAC_RW(src, freesrc, &wavespec,
  26.891 +                    (Uint8 **)&chunk->abuf, &chunk->alen);
  26.892 +            break;
  26.893  #endif
  26.894 -		case CREA:
  26.895 -			loaded = Mix_LoadVOC_RW(src, freesrc, &wavespec,
  26.896 -					(Uint8 **)&chunk->abuf, &chunk->alen);
  26.897 -			break;
  26.898 -		default:
  26.899 -			SDL_SetError("Unrecognized sound file type");
  26.900 -			if ( freesrc ) {
  26.901 -				SDL_RWclose(src);
  26.902 -			}
  26.903 -			loaded = NULL;
  26.904 -			break;
  26.905 -	}
  26.906 -	if ( !loaded ) {
  26.907 -		/* The individual loaders have closed src if needed */
  26.908 -		SDL_free(chunk);
  26.909 -		return(NULL);
  26.910 -	}
  26.911 +        case CREA:
  26.912 +            loaded = Mix_LoadVOC_RW(src, freesrc, &wavespec,
  26.913 +                    (Uint8 **)&chunk->abuf, &chunk->alen);
  26.914 +            break;
  26.915 +        default:
  26.916 +            SDL_SetError("Unrecognized sound file type");
  26.917 +            if ( freesrc ) {
  26.918 +                SDL_RWclose(src);
  26.919 +            }
  26.920 +            loaded = NULL;
  26.921 +            break;
  26.922 +    }
  26.923 +    if ( !loaded ) {
  26.924 +        /* The individual loaders have closed src if needed */
  26.925 +        SDL_free(chunk);
  26.926 +        return(NULL);
  26.927 +    }
  26.928  
  26.929  #if 0
  26.930 -	PrintFormat("Audio device", &mixer);
  26.931 -	PrintFormat("-- Wave file", &wavespec);
  26.932 +    PrintFormat("Audio device", &mixer);
  26.933 +    PrintFormat("-- Wave file", &wavespec);
  26.934  #endif
  26.935  
  26.936 -	/* Build the audio converter and create conversion buffers */
  26.937 -	if ( wavespec.format != mixer.format ||
  26.938 -		 wavespec.channels != mixer.channels ||
  26.939 -		 wavespec.freq != mixer.freq ) {
  26.940 -		if ( SDL_BuildAudioCVT(&wavecvt,
  26.941 -				wavespec.format, wavespec.channels, wavespec.freq,
  26.942 -				mixer.format, mixer.channels, mixer.freq) < 0 ) {
  26.943 -			SDL_free(chunk->abuf);
  26.944 -			SDL_free(chunk);
  26.945 -			return(NULL);
  26.946 -		}
  26.947 -		samplesize = ((wavespec.format & 0xFF)/8)*wavespec.channels;
  26.948 -		wavecvt.len = chunk->alen & ~(samplesize-1);
  26.949 -		wavecvt.buf = (Uint8 *)SDL_calloc(1, wavecvt.len*wavecvt.len_mult);
  26.950 -		if ( wavecvt.buf == NULL ) {
  26.951 -			SDL_SetError("Out of memory");
  26.952 -			SDL_free(chunk->abuf);
  26.953 -			SDL_free(chunk);
  26.954 -			return(NULL);
  26.955 -		}
  26.956 -		memcpy(wavecvt.buf, chunk->abuf, chunk->alen);
  26.957 -		SDL_free(chunk->abuf);
  26.958 +    /* Build the audio converter and create conversion buffers */
  26.959 +    if ( wavespec.format != mixer.format ||
  26.960 +         wavespec.channels != mixer.channels ||
  26.961 +         wavespec.freq != mixer.freq ) {
  26.962 +        if ( SDL_BuildAudioCVT(&wavecvt,
  26.963 +                wavespec.format, wavespec.channels, wavespec.freq,
  26.964 +                mixer.format, mixer.channels, mixer.freq) < 0 ) {
  26.965 +            SDL_free(chunk->abuf);
  26.966 +            SDL_free(chunk);
  26.967 +            return(NULL);
  26.968 +        }
  26.969 +        samplesize = ((wavespec.format & 0xFF)/8)*wavespec.channels;
  26.970 +        wavecvt.len = chunk->alen & ~(samplesize-1);
  26.971 +        wavecvt.buf = (Uint8 *)SDL_calloc(1, wavecvt.len*wavecvt.len_mult);
  26.972 +        if ( wavecvt.buf == NULL ) {
  26.973 +            SDL_SetError("Out of memory");
  26.974 +            SDL_free(chunk->abuf);
  26.975 +            SDL_free(chunk);
  26.976 +            return(NULL);
  26.977 +        }
  26.978 +        memcpy(wavecvt.buf, chunk->abuf, chunk->alen);
  26.979 +        SDL_free(chunk->abuf);
  26.980  
  26.981 -		/* Run the audio converter */
  26.982 -		if ( SDL_ConvertAudio(&wavecvt) < 0 ) {
  26.983 -			SDL_free(wavecvt.buf);
  26.984 -			SDL_free(chunk);
  26.985 -			return(NULL);
  26.986 -		}
  26.987 +        /* Run the audio converter */
  26.988 +        if ( SDL_ConvertAudio(&wavecvt) < 0 ) {
  26.989 +            SDL_free(wavecvt.buf);
  26.990 +            SDL_free(chunk);
  26.991 +            return(NULL);
  26.992 +        }
  26.993  
  26.994 -		chunk->abuf = wavecvt.buf;
  26.995 -		chunk->alen = wavecvt.len_cvt;
  26.996 -	}
  26.997 +        chunk->abuf = wavecvt.buf;
  26.998 +        chunk->alen = wavecvt.len_cvt;
  26.999 +    }
 26.1000  
 26.1001 -	chunk->allocated = 1;
 26.1002 -	chunk->volume = MIX_MAX_VOLUME;
 26.1003 +    chunk->allocated = 1;
 26.1004 +    chunk->volume = MIX_MAX_VOLUME;
 26.1005  
 26.1006 -	return(chunk);
 26.1007 +    return(chunk);
 26.1008  }
 26.1009  
 26.1010  /* Load a wave file of the mixer format from a memory buffer */
 26.1011  Mix_Chunk *Mix_QuickLoad_WAV(Uint8 *mem)
 26.1012  {
 26.1013 -	Mix_Chunk *chunk;
 26.1014 -	Uint8 magic[4];
 26.1015 +    Mix_Chunk *chunk;
 26.1016 +    Uint8 magic[4];
 26.1017  
 26.1018 -	/* Make sure audio has been opened */
 26.1019 -	if ( ! audio_opened ) {
 26.1020 -		SDL_SetError("Audio device hasn't been opened");
 26.1021 -		return(NULL);
 26.1022 -	}
 26.1023 +    /* Make sure audio has been opened */
 26.1024 +    if ( ! audio_opened ) {
 26.1025 +        SDL_SetError("Audio device hasn't been opened");
 26.1026 +        return(NULL);
 26.1027 +    }
 26.1028  
 26.1029 -	/* Allocate the chunk memory */
 26.1030 -	chunk = (Mix_Chunk *)SDL_calloc(1,sizeof(Mix_Chunk));
 26.1031 -	if ( chunk == NULL ) {
 26.1032 -		SDL_SetError("Out of memory");
 26.1033 -		return(NULL);
 26.1034 -	}
 26.1035 +    /* Allocate the chunk memory */
 26.1036 +    chunk = (Mix_Chunk *)SDL_calloc(1,sizeof(Mix_Chunk));
 26.1037 +    if ( chunk == NULL ) {
 26.1038 +        SDL_SetError("Out of memory");
 26.1039 +        return(NULL);
 26.1040 +    }
 26.1041  
 26.1042 -	/* Essentially just skip to the audio data (no error checking - fast) */
 26.1043 -	chunk->allocated = 0;
 26.1044 -	mem += 12; /* WAV header */
 26.1045 -	do {
 26.1046 -		memcpy(magic, mem, 4);
 26.1047 -		mem += 4;
 26.1048 -		chunk->alen = ((mem[3]<<24)|(mem[2]<<16)|(mem[1]<<8)|(mem[0]));
 26.1049 -		mem += 4;
 26.1050 -		chunk->abuf = mem;
 26.1051 -		mem += chunk->alen;
 26.1052 -	} while ( memcmp(magic, "data", 4) != 0 );
 26.1053 -	chunk->volume = MIX_MAX_VOLUME;
 26.1054 +    /* Essentially just skip to the audio data (no error checking - fast) */
 26.1055 +    chunk->allocated = 0;
 26.1056 +    mem += 12; /* WAV header */
 26.1057 +    do {
 26.1058 +        memcpy(magic, mem, 4);
 26.1059 +        mem += 4;
 26.1060 +        chunk->alen = ((mem[3]<<24)|(mem[2]<<16)|(mem[1]<<8)|(mem[0]));
 26.1061 +        mem += 4;
 26.1062 +        chunk->abuf = mem;
 26.1063 +        mem += chunk->alen;
 26.1064 +    } while ( memcmp(magic, "data", 4) != 0 );
 26.1065 +    chunk->volume = MIX_MAX_VOLUME;
 26.1066  
 26.1067 -	return(chunk);
 26.1068 +    return(chunk);
 26.1069  }
 26.1070  
 26.1071  /* Load raw audio data of the mixer format from a memory buffer */
 26.1072  Mix_Chunk *Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len)
 26.1073  {
 26.1074 -	Mix_Chunk *chunk;
 26.1075 +    Mix_Chunk *chunk;
 26.1076  
 26.1077 -	/* Make sure audio has been opened */
 26.1078 -	if ( ! audio_opened ) {
 26.1079 -		SDL_SetError("Audio device hasn't been opened");
 26.1080 -		return(NULL);
 26.1081 -	}
 26.1082 +    /* Make sure audio has been opened */
 26.1083 +    if ( ! audio_opened ) {
 26.1084 +        SDL_SetError("Audio device hasn't been opened");
 26.1085 +        return(NULL);
 26.1086 +    }
 26.1087  
 26.1088 -	/* Allocate the chunk memory */
 26.1089 -	chunk = (Mix_Chunk *)SDL_malloc(sizeof(Mix_Chunk));
 26.1090 -	if ( chunk == NULL ) {
 26.1091 -		SDL_SetError("Out of memory");
 26.1092 -		return(NULL);
 26.1093 -	}
 26.1094 +    /* Allocate the chunk memory */
 26.1095 +    chunk = (Mix_Chunk *)SDL_malloc(sizeof(Mix_Chunk));
 26.1096 +    if ( chunk == NULL ) {
 26.1097 +        SDL_SetError("Out of memory");
 26.1098 +        return(NULL);
 26.1099 +    }
 26.1100  
 26.1101 -	/* Essentially just point at the audio data (no error checking - fast) */
 26.1102 -	chunk->allocated = 0;
 26.1103 -	chunk->alen = len;
 26.1104 -	chunk->abuf = mem;
 26.1105 -	chunk->volume = MIX_MAX_VOLUME;
 26.1106 +    /* Essentially just point at the audio data (no error checking - fast) */
 26.1107 +    chunk->allocated = 0;
 26.1108 +    chunk->alen = len;
 26.1109 +    chunk->abuf = mem;
 26.1110 +    chunk->volume = MIX_MAX_VOLUME;
 26.1111  
 26.1112 -	return(chunk);
 26.1113 +    return(chunk);
 26.1114  }
 26.1115  
 26.1116  /* Free an audio chunk previously loaded */
 26.1117  void Mix_FreeChunk(Mix_Chunk *chunk)
 26.1118  {
 26.1119 -	int i;
 26.1120 +    int i;
 26.1121  
 26.1122 -	/* Caution -- if the chunk is playing, the mixer will crash */
 26.1123 -	if ( chunk ) {
 26.1124 -		/* Guarantee that this chunk isn't playing */
 26.1125 -		SDL_LockAudio();
 26.1126 -		if ( mix_channel ) {
 26.1127 -			for ( i=0; i<num_channels; ++i ) {
 26.1128 -				if ( chunk == mix_channel[i].chunk ) {
 26.1129 -					mix_channel[i].playing = 0;
 26.1130 -					mix_channel[i].looping = 0;
 26.1131 -				}
 26.1132 -			}
 26.1133 -		}
 26.1134 -		SDL_UnlockAudio();
 26.1135 -		/* Actually free the chunk */
 26.1136 -		if ( chunk->allocated ) {
 26.1137 -			SDL_free(chunk->abuf);
 26.1138 -		}
 26.1139 -		SDL_free(chunk);
 26.1140 -	}
 26.1141 +    /* Caution -- if the chunk is playing, the mixer will crash */
 26.1142 +    if ( chunk ) {
 26.1143 +        /* Guarantee that this chunk isn't playing */
 26.1144 +        SDL_LockAudio();
 26.1145 +        if ( mix_channel ) {
 26.1146 +            for ( i=0; i<num_channels; ++i ) {
 26.1147 +                if ( chunk == mix_channel[i].chunk ) {
 26.1148 +                    mix_channel[i].playing = 0;
 26.1149 +                    mix_channel[i].looping = 0;
 26.1150 +                }
 26.1151 +            }
 26.1152 +        }
 26.1153 +        SDL_UnlockAudio();
 26.1154 +        /* Actually free the chunk */
 26.1155 +        if ( chunk->allocated ) {
 26.1156 +            SDL_free(chunk->abuf);
 26.1157 +        }
 26.1158 +        SDL_free(chunk);
 26.1159 +    }
 26.1160  }
 26.1161  
 26.1162  /* Set a function that is called after all mixing is performed.
 26.1163 @@ -762,10 +762,10 @@
 26.1164  void Mix_SetPostMix(void (*mix_func)
 26.1165                      (void *udata, Uint8 *stream, int len), void *arg)
 26.1166  {
 26.1167 -	SDL_LockAudio();
 26.1168 -	mix_postmix_data = arg;
 26.1169 -	mix_postmix = mix_func;
 26.1170 -	SDL_UnlockAudio();
 26.1171 +    SDL_LockAudio();
 26.1172 +    mix_postmix_data = arg;
 26.1173 +    mix_postmix = mix_func;
 26.1174 +    SDL_UnlockAudio();
 26.1175  }
 26.1176  
 26.1177  /* Add your own music player or mixer function.
 26.1178 @@ -774,27 +774,27 @@
 26.1179  void Mix_HookMusic(void (*mix_func)(void *udata, Uint8 *stream, int len),
 26.1180                                                                  void *arg)
 26.1181  {
 26.1182 -	SDL_LockAudio();
 26.1183 -	if ( mix_func != NULL ) {
 26.1184 -		music_data = arg;
 26.1185 -		mix_music = mix_func;
 26.1186 -	} else {
 26.1187 -		music_data = NULL;
 26.1188 -		mix_music = music_mixer;
 26.1189 -	}
 26.1190 -	SDL_UnlockAudio();
 26.1191 +    SDL_LockAudio();
 26.1192 +    if ( mix_func != NULL ) {
 26.1193 +        music_data = arg;
 26.1194 +        mix_music = mix_func;
 26.1195 +    } else {
 26.1196 +        music_data = NULL;
 26.1197 +        mix_music = music_mixer;
 26.1198 +    }
 26.1199 +    SDL_UnlockAudio();
 26.1200  }
 26.1201  
 26.1202  void *Mix_GetMusicHookData(void)
 26.1203  {
 26.1204 -	return(music_data);
 26.1205 +    return(music_data);
 26.1206  }
 26.1207  
 26.1208  void Mix_ChannelFinished(void (*channel_finished)(int channel))
 26.1209  {
 26.1210 -	SDL_LockAudio();
 26.1211 -	channel_done_callback = channel_finished;
 26.1212 -	SDL_UnlockAudio();
 26.1213 +    SDL_LockAudio();
 26.1214 +    channel_done_callback = channel_finished;
 26.1215 +    SDL_UnlockAudio();
 26.1216  }
 26.1217  
 26.1218  
 26.1219 @@ -804,20 +804,20 @@
 26.1220   */
 26.1221  int Mix_ReserveChannels(int num)
 26.1222  {
 26.1223 -	if (num > num_channels)
 26.1224 -		num = num_channels;
 26.1225 -	reserved_channels = num;
 26.1226 -	return num;
 26.1227 +    if (num > num_channels)
 26.1228 +        num = num_channels;
 26.1229 +    reserved_channels = num;
 26.1230 +    return num;
 26.1231  }
 26.1232  
 26.1233  static int checkchunkintegral(Mix_Chunk *chunk)
 26.1234  {
 26.1235 -	int frame_width = 1;
 26.1236 +    int frame_width = 1;
 26.1237  
 26.1238 -	if ((mixer.format & 0xFF) == 16) frame_width = 2;
 26.1239 -	frame_width *= mixer.channels;
 26.1240 -	while (chunk->alen % frame_width) chunk->alen--;
 26.1241 -	return chunk->alen;
 26.1242 +    if ((mixer.format & 0xFF) == 16) frame_width = 2;
 26.1243 +    frame_width *= mixer.channels;
 26.1244 +    while (chunk->alen % frame_width) chunk->alen--;
 26.1245 +    return chunk->alen;
 26.1246  }
 26.1247  
 26.1248  /* Play an audio chunk on a specific channel.
 26.1249 @@ -828,259 +828,259 @@
 26.1250  */
 26.1251  int Mix_PlayChannelTimed(int which, Mix_Chunk *chunk, int loops, int ticks)
 26.1252  {
 26.1253 -	int i;
 26.1254 +    int i;
 26.1255  
 26.1256 -	/* Don't play null pointers :-) */
 26.1257 -	if ( chunk == NULL ) {
 26.1258 -		Mix_SetError("Tried to play a NULL chunk");
 26.1259 -		return(-1);
 26.1260 -	}
 26.1261 -	if ( !checkchunkintegral(chunk)) {
 26.1262 -		Mix_SetError("Tried to play a chunk with a bad frame");
 26.1263 -		return(-1);
 26.1264 -	}
 26.1265 +    /* Don't play null pointers :-) */
 26.1266 +    if ( chunk == NULL ) {
 26.1267 +        Mix_SetError("Tried to play a NULL chunk");
 26.1268 +        return(-1);
 26.1269 +    }
 26.1270 +    if ( !checkchunkintegral(chunk)) {
 26.1271 +        Mix_SetError("Tried to play a chunk with a bad frame");
 26.1272 +        return(-1);
 26.1273 +    }
 26.1274  
 26.1275 -	/* Lock the mixer while modifying the playing channels */
 26.1276 -	SDL_LockAudio();
 26.1277 -	{
 26.1278 -		/* If which is -1, play on the first free channel */
 26.1279 -		if ( which == -1 ) {
 26.1280 -			for ( i=reserved_channels; i<num_channels; ++i ) {
 26.1281 -				if ( mix_channel[i].playing <= 0 )
 26.1282 -					break;
 26.1283 -			}
 26.1284 -			if ( i == num_channels ) {
 26.1285 -				Mix_SetError("No free channels available");
 26.1286 -				which = -1;
 26.1287 -			} else {
 26.1288 -				which = i;
 26.1289 -			}
 26.1290 -		}
 26.1291 +    /* Lock the mixer while modifying the playing channels */
 26.1292 +    SDL_LockAudio();
 26.1293 +    {
 26.1294 +        /* If which is -1, play on the first free channel */
 26.1295 +        if ( which == -1 ) {
 26.1296 +            for ( i=reserved_channels; i<num_channels; ++i ) {
 26.1297 +                if ( mix_channel[i].playing <= 0 )
 26.1298 +                    break;
 26.1299 +            }
 26.1300 +            if ( i == num_channels ) {
 26.1301 +                Mix_SetError("No free channels available");
 26.1302 +                which = -1;
 26.1303 +            } else {
 26.1304 +                which = i;
 26.1305 +            }
 26.1306 +        }
 26.1307  
 26.1308 -		/* Queue up the audio data for this channel */
 26.1309 -		if ( which >= 0 && which < num_channels ) {
 26.1310 -			Uint32 sdl_ticks = SDL_GetTicks();
 26.1311 -			if (Mix_Playing(which))
 26.1312 -				_Mix_channel_done_playing(which);
 26.1313 -			mix_channel[which].samples = chunk->abuf;
 26.1314 -			mix_channel[which].playing = chunk->alen;
 26.1315 -			mix_channel[which].looping = loops;
 26.1316 -			mix_channel[which].chunk = chunk;
 26.1317 -			mix_channel[which].paused = 0;
 26.1318 -			mix_channel[which].fading = MIX_NO_FADING;
 26.1319 -			mix_channel[which].start_time = sdl_ticks;
 26.1320 -			mix_channel[which].expire = (ticks>0) ? (sdl_ticks + ticks) : 0;
 26.1321 -		}
 26.1322 -	}
 26.1323 -	SDL_UnlockAudio();
 26.1324 +        /* Queue up the audio data for this channel */
 26.1325 +        if ( which >= 0 && which < num_channels ) {
 26.1326 +            Uint32 sdl_ticks = SDL_GetTicks();
 26.1327 +            if (Mix_Playing(which))
 26.1328 +                _Mix_channel_done_playing(which);
 26.1329 +            mix_channel[which].samples = chunk->abuf;
 26.1330 +            mix_channel[which].playing = chunk->alen;
 26.1331 +            mix_channel[which].looping = loops;
 26.1332 +            mix_channel[which].chunk = chunk;
 26.1333 +            mix_channel[which].paused = 0;
 26.1334 +            mix_channel[which].fading = MIX_NO_FADING;
 26.1335 +            mix_channel[which].start_time = sdl_ticks;
 26.1336 +            mix_channel[which].expire = (ticks>0) ? (sdl_ticks + ticks) : 0;
 26.1337 +        }
 26.1338 +    }
 26.1339 +    SDL_UnlockAudio();
 26.1340  
 26.1341 -	/* Return the channel on which the sound is being played */
 26.1342 -	return(which);
 26.1343 +    /* Return the channel on which the sound is being played */
 26.1344 +    return(which);
 26.1345  }
 26.1346  
 26.1347  /* Change the expiration delay for a channel */
 26.1348  int Mix_ExpireChannel(int which, int ticks)
 26.1349  {
 26.1350 -	int status = 0;
 26.1351 +    int status = 0;
 26.1352  
 26.1353 -	if ( which == -1 ) {
 26.1354 -		int i;
 26.1355 -		for ( i=0; i < num_channels; ++ i ) {
 26.1356 -			status += Mix_ExpireChannel(i, ticks);
 26.1357 -		}
 26.1358 -	} else if ( which < num_channels ) {
 26.1359 -		SDL_LockAudio();
 26.1360 -		mix_channel[which].expire = (ticks>0) ? (SDL_GetTicks() + ticks) : 0;
 26.1361 -		SDL_UnlockAudio();
 26.1362 -		++ status;
 26.1363 -	}
 26.1364 -	return(status);
 26.1365 +    if ( which == -1 ) {
 26.1366 +        int i;
 26.1367 +        for ( i=0; i < num_channels; ++ i ) {
 26.1368 +            status += Mix_ExpireChannel(i, ticks);
 26.1369 +        }
 26.1370 +    } else if ( which < num_channels ) {
 26.1371 +        SDL_LockAudio();
 26.1372 +        mix_channel[which].expire = (ticks>0) ? (SDL_GetTicks() + ticks) : 0;
 26.1373 +        SDL_UnlockAudio();
 26.1374 +        ++ status;
 26.1375 +    }
 26.1376 +    return(status);
 26.1377  }
 26.1378  
 26.1379  /* Fade in a sound on a channel, over ms milliseconds */
 26.1380  int Mix_FadeInChannelTimed(int which, Mix_Chunk *chunk, int loops, int ms, int ticks)
 26.1381  {
 26.1382 -	int i;
 26.1383 +    int i;
 26.1384  
 26.1385 -	/* Don't play null pointers :-) */
 26.1386 -	if ( chunk == NULL ) {
 26.1387 -		return(-1);
 26.1388 -	}
 26.1389 -	if ( !checkchunkintegral(chunk)) {
 26.1390 -		Mix_SetError("Tried to play a chunk with a bad frame");
 26.1391 -		return(-1);
 26.1392 -	}
 26.1393 +    /* Don't play null pointers :-) */
 26.1394 +    if ( chunk == NULL ) {
 26.1395 +        return(-1);
 26.1396 +    }
 26.1397 +    if ( !checkchunkintegral(chunk)) {
 26.1398 +        Mix_SetError("Tried to play a chunk with a bad frame");
 26.1399 +        return(-1);
 26.1400 +    }
 26.1401  
 26.1402 -	/* Lock the mixer while modifying the playing channels */
 26.1403 -	SDL_LockAudio();
 26.1404 -	{
 26.1405 -		/* If which is -1, play on the first free channel */
 26.1406 -		if ( which == -1 ) {
 26.1407 -			for ( i=reserved_channels; i<num_channels; ++i ) {
 26.1408 -				if ( mix_channel[i].playing <= 0 )
 26.1409 -					break;
 26.1410 -			}
 26.1411 -			if ( i == num_channels ) {
 26.1412 -				which = -1;
 26.1413 -			} else {
 26.1414 -				which = i;
 26.1415 -			}
 26.1416 -		}
 26.1417 +    /* Lock the mixer while modifying the playing channels */
 26.1418 +    SDL_LockAudio();
 26.1419 +    {
 26.1420 +        /* If which is -1, play on the first free channel */
 26.1421 +        if ( which == -1 ) {
 26.1422 +            for ( i=reserved_channels; i<num_channels; ++i ) {
 26.1423 +                if ( mix_channel[i].playing <= 0 )
 26.1424 +                    break;
 26.1425 +            }
 26.1426 +            if ( i == num_channels ) {
 26.1427 +                which = -1;
 26.1428 +            } else {
 26.1429 +                which = i;
 26.1430 +            }
 26.1431 +        }
 26.1432  
 26.1433 -		/* Queue up the audio data for this channel */
 26.1434 -		if ( which >= 0 && which < num_channels ) {
 26.1435 -			Uint32 sdl_ticks = SDL_GetTicks();
 26.1436 -			if (Mix_Playing(which))
 26.1437 -				_Mix_channel_done_playing(which);
 26.1438 -			mix_channel[which].samples = chunk->abuf;
 26.1439 -			mix_channel[which].playing = chunk->alen;
 26.1440 -			mix_channel[which].looping = loops;
 26.1441 -			mix_channel[which].chunk = chunk;
 26.1442 -			mix_channel[which].paused = 0;
 26.1443 -			mix_channel[which].fading = MIX_FADING_IN;
 26.1444 -			mix_channel[which].fade_volume = mix_channel[which].volume;
 26.1445 -			mix_channel[which].fade_volume_reset = mix_channel[which].volume;
 26.1446 -			mix_channel[which].volume = 0;
 26.1447 -			mix_channel[which].fade_length = (Uint32)ms;
 26.1448 -			mix_channel[which].start_time = mix_channel[which].ticks_fade = sdl_ticks;
 26.1449 -			mix_channel[which].expire = (ticks > 0) ? (sdl_ticks+ticks) : 0;
 26.1450 -		}
 26.1451 -	}
 26.1452 -	SDL_UnlockAudio();
 26.1453 +        /* Queue up the audio data for this channel */
 26.1454 +        if ( which >= 0 && which < num_channels ) {
 26.1455 +            Uint32 sdl_ticks = SDL_GetTicks();
 26.1456 +            if (Mix_Playing(which))
 26.1457 +                _Mix_channel_done_playing(which);
 26.1458 +            mix_channel[which].samples = chunk->abuf;
 26.1459 +            mix_channel[which].playing = chunk->alen;
 26.1460 +            mix_channel[which].looping = loops;
 26.1461 +            mix_channel[which].chunk = chunk;
 26.1462 +            mix_channel[which].paused = 0;
 26.1463 +            mix_channel[which].fading = MIX_FADING_IN;
 26.1464 +            mix_channel[which].fade_volume = mix_channel[which].volume;
 26.1465 +            mix_channel[which].fade_volume_reset = mix_channel[which].volume;
 26.1466 +            mix_channel[which].volume = 0;
 26.1467 +            mix_channel[which].fade_length = (Uint32)ms;
 26.1468 +            mix_channel[which].start_time = mix_channel[which].ticks_fade = sdl_ticks;
 26.1469 +            mix_channel[which].expire = (ticks > 0) ? (sdl_ticks+ticks) : 0;
 26.1470 +        }
 26.1471 +    }
 26.1472 +    SDL_UnlockAudio();
 26.1473  
 26.1474 -	/* Return the channel on which the sound is being played */
 26.1475 -	return(which);
 26.1476 +    /* Return the channel on which the sound is being played */
 26.1477 +    return(which);
 26.1478  }
 26.1479  
 26.1480  /* Set volume of a particular channel */
 26.1481  int Mix_Volume(int which, int volume)
 26.1482  {
 26.1483 -	int i;
 26.1484 -	int prev_volume = 0;
 26.1485 +    int i;
 26.1486 +    int prev_volume = 0;
 26.1487  
 26.1488 -	if ( which == -1 ) {
 26.1489 -		for ( i=0; i<num_channels; ++i ) {
 26.1490 -			prev_volume += Mix_Volume(i, volume);
 26.1491 -		}
 26.1492 -		prev_volume /= num_channels;
 26.1493 -	} else if ( which < num_channels ) {
 26.1494 -		prev_volume = mix_channel[which].volume;
 26.1495 -		if ( volume >= 0 ) {
 26.1496 -			if ( volume > SDL_MIX_MAXVOLUME ) {
 26.1497 -				volume = SDL_MIX_MAXVOLUME;
 26.1498 -			}
 26.1499 -			mix_channel[which].volume = volume;
 26.1500 -		}
 26.1501 -	}
 26.1502 -	return(prev_volume);
 26.1503 +    if ( which == -1 ) {
 26.1504 +        for ( i=0; i<num_channels; ++i ) {
 26.1505 +            prev_volume += Mix_Volume(i, volume);
 26.1506 +        }
 26.1507 +        prev_volume /= num_channels;
 26.1508 +    } else if ( which < num_channels ) {
 26.1509 +        prev_volume = mix_channel[which].volume;
 26.1510 +        if ( volume >= 0 ) {
 26.1511 +            if ( volume > SDL_MIX_MAXVOLUME ) {
 26.1512 +                volume = SDL_MIX_MAXVOLUME;
 26.1513 +            }
 26.1514 +            mix_channel[which].volume = volume;
 26.1515 +        }
 26.1516 +    }
 26.1517 +    return(prev_volume);
 26.1518  }
 26.1519  /* Set volume of a particular chunk */
 26.1520  int Mix_VolumeChunk(Mix_Chunk *chunk, int volume)
 26.1521  {
 26.1522 -	int prev_volume;
 26.1523 +    int prev_volume;
 26.1524  
 26.1525 -	prev_volume = chunk->volume;
 26.1526 -	if ( volume >= 0 ) {
 26.1527 -		if ( volume > MIX_MAX_VOLUME ) {
 26.1528 -			volume = MIX_MAX_VOLUME;
 26.1529 -		}
 26.1530 -		chunk->volume = volume;
 26.1531 -	}
 26.1532 -	return(prev_volume);
 26.1533 +    prev_volume = chunk->volume;
 26.1534 +    if ( volume >= 0 ) {
 26.1535 +        if ( volume > MIX_MAX_VOLUME ) {
 26.1536 +            volume = MIX_MAX_VOLUME;
 26.1537 +        }
 26.1538 +        chunk->volume = volume;
 26.1539 +    }
 26.1540 +    return(prev_volume);
 26.1541  }
 26.1542  
 26.1543  /* Halt playing of a particular channel */
 26.1544  int Mix_HaltChannel(int which)
 26.1545  {
 26.1546 -	int i;
 26.1547 +    int i;
 26.1548  
 26.1549 -	if ( which == -1 ) {
 26.1550 -		for ( i=0; i<num_channels; ++i ) {
 26.1551 -			Mix_HaltChannel(i);
 26.1552 -		}
 26.1553 -	} else if ( which < num_channels ) {
 26.1554 -		SDL_LockAudio();
 26.1555 -		if (mix_channel[which].playing) {
 26.1556 -			_Mix_channel_done_playing(which);
 26.1557 -			mix_channel[which].playing = 0;
 26.1558 -			mix_channel[which].looping = 0;
 26.1559 -		}
 26.1560 -		mix_channel[which].expire = 0;
 26.1561 -		if(mix_channel[which].fading != MIX_NO_FADING) /* Restore volume */
 26.1562 -			mix_channel[which].volume = mix_channel[which].fade_volume_reset;
 26.1563 -		mix_channel[which].fading = MIX_NO_FADING;
 26.1564 -		SDL_UnlockAudio();
 26.1565 -	}
 26.1566 -	return(0);
 26.1567 +    if ( which == -1 ) {
 26.1568 +        for ( i=0; i<num_channels; ++i ) {
 26.1569 +            Mix_HaltChannel(i);
 26.1570 +        }
 26.1571 +    } else if ( which < num_channels ) {
 26.1572 +        SDL_LockAudio();
 26.1573 +        if (mix_channel[which].playing) {
 26.1574 +            _Mix_channel_done_playing(which);
 26.1575 +            mix_channel[which].playing = 0;
 26.1576 +            mix_channel[which].looping = 0;
 26.1577 +        }
 26.1578 +        mix_channel[which].expire = 0;
 26.1579 +        if(mix_channel[which].fading != MIX_NO_FADING) /* Restore volume */
 26.1580 +            mix_channel[which].volume = mix_channel[which].fade_volume_reset;
 26.1581 +        mix_channel[which].fading = MIX_NO_FADING;
 26.1582 +        SDL_UnlockAudio();
 26.1583 +    }
 26.1584 +    return(0);
 26.1585  }
 26.1586  
 26.1587  /* Halt playing of a particular group of channels */
 26.1588  int Mix_HaltGroup(int tag)
 26.1589  {
 26.1590 -	int i;
 26.1591 +    int i;
 26.1592  
 26.1593 -	for ( i=0; i<num_channels; ++i ) {
 26.1594 -		if( mix_channel[i].tag == tag ) {
 26.1595 -			Mix_HaltChannel(i);
 26.1596 -		}
 26.1597 -	}
 26.1598 -	return(0);
 26.1599 +    for ( i=0; i<num_channels; ++i ) {
 26.1600 +        if( mix_channel[i].tag == tag ) {
 26.1601 +            Mix_HaltChannel(i);
 26.1602 +        }
 26.1603 +    }
 26.1604 +    return(0);
 26.1605  }
 26.1606  
 26.1607  /* Fade out a channel and then stop it automatically */
 26.1608  int Mix_FadeOutChannel(int which, int ms)
 26.1609  {
 26.1610 -	int status;
 26.1611 +    int status;
 26.1612  
 26.1613 -	status = 0;
 26.1614 -	if ( audio_opened ) {
 26.1615 -		if ( which == -1 ) {
 26.1616 -			int i;
 26.1617 +    status = 0;
 26.1618 +    if ( audio_opened ) {
 26.1619 +        if ( which == -1 ) {
 26.1620 +            int i;
 26.1621  
 26.1622 -			for ( i=0; i<num_channels; ++i ) {
 26.1623 -				status += Mix_FadeOutChannel(i, ms);
 26.1624 -			}
 26.1625 -		} else if ( which < num_channels ) {
 26.1626 -			SDL_LockAudio();
 26.1627 -			if ( mix_channel[which].playing && 
 26.1628 -			    (mix_channel[which].volume > 0) &&
 26.1629 -			    (mix_channel[which].fading != MIX_FADING_OUT) ) {
 26.1630 -				mix_channel[which].fade_volume = mix_channel[which].volume;
 26.1631 -				mix_channel[which].fading = MIX_FADING_OUT;
 26.1632 -				mix_channel[which].fade_length = ms;
 26.1633 -				mix_channel[which].ticks_fade = SDL_GetTicks();
 26.1634 +            for ( i=0; i<num_channels; ++i ) {
 26.1635 +                status += Mix_FadeOutChannel(i, ms);
 26.1636 +            }
 26.1637 +        } else if ( which < num_channels ) {
 26.1638 +            SDL_LockAudio();
 26.1639 +            if ( mix_channel[which].playing &&
 26.1640 +                (mix_channel[which].volume > 0) &&
 26.1641 +                (mix_channel[which].fading != MIX_FADING_OUT) ) {
 26.1642 +                mix_channel[which].fade_volume = mix_channel[which].volume;
 26.1643 +                mix_channel[which].fading = MIX_FADING_OUT;
 26.1644 +                mix_channel[which].fade_length = ms;
 26.1645 +                mix_channel[which].ticks_fade = SDL_GetTicks();
 26.1646  
 26.1647 -				/* only change fade_volume_reset if we're not fading. */
 26.1648 -				if (mix_channel[which].fading == MIX_NO_FADING) {
 26.1649 -				    mix_channel[which].fade_volume_reset = mix_channel[which].volume;
 26.1650 -				}
 26.1651 -				++status;
 26.1652 -			}
 26.1653 -			SDL_UnlockAudio();
 26.1654 -		}
 26.1655 -	}
 26.1656 -	return(status);
 26.1657 +                /* only change fade_volume_reset if we're not fading. */
 26.1658 +                if (mix_channel[which].fading == MIX_NO_FADING) {
 26.1659 +                    mix_channel[which].fade_volume_reset = mix_channel[which].volume;
 26.1660 +                }
 26.1661 +                ++status;
 26.1662 +            }
 26.1663 +            SDL_UnlockAudio();
 26.1664 +        }
 26.1665 +    }
 26.1666 +    return(status);
 26.1667  }
 26.1668  
 26.1669  /* Halt playing of a particular group of channels */
 26.1670  int Mix_FadeOutGroup(int tag, int ms)
 26.1671  {
 26.1672 -	int i;
 26.1673 -	int status = 0;
 26.1674 -	for ( i=0; i<num_channels; ++i ) {
 26.1675 -		if( mix_channel[i].tag == tag ) {
 26.1676 -			status += Mix_FadeOutChannel(i,ms);
 26.1677 -		}
 26.1678 -	}
 26.1679 -	return(status);
 26.1680 +    int i;
 26.1681 +    int status = 0;
 26.1682 +    for ( i=0; i<num_channels; ++i ) {
 26.1683 +        if( mix_channel[i].tag == tag ) {
 26.1684 +            status += Mix_FadeOutChannel(i,ms);
 26.1685 +        }
 26.1686 +    }
 26.1687 +    return(status);
 26.1688  }
 26.1689  
 26.1690  Mix_Fading Mix_FadingChannel(int which)
 26.1691  {
 26.1692 -	if ( which < 0 || which >= num_channels ) {
 26.1693 -		return MIX_NO_FADING;
 26.1694 -	}
 26.1695 -	return mix_channel[which].fading;
 26.1696 +    if ( which < 0 || which >= num_channels ) {
 26.1697 +        return MIX_NO_FADING;
 26.1698 +    }
 26.1699 +    return mix_channel[which].fading;
 26.1700  }
 26.1701  
 26.1702  /* Check the status of a specific channel.
 26.1703 @@ -1088,206 +1088,206 @@
 26.1704  */
 26.1705  int Mix_Playing(int which)
 26.1706  {
 26.1707 -	int status;
 26.1708 +    int status;
 26.1709  
 26.1710 -	status = 0;
 26.1711 -	if ( which == -1 ) {
 26.1712 -		int i;
 26.1713 +    status = 0;
 26.1714 +    if ( which == -1 ) {
 26.1715 +        int i;
 26.1716  
 26.1717 -		for ( i=0; i<num_channels; ++i ) {
 26.1718 -			if ((mix_channel[i].playing > 0) ||
 26.1719 -				(mix_channel[i].looping > 0))
 26.1720 -			{
 26.1721 -				++status;
 26.1722 -			}
 26.1723 -		}
 26.1724 -	} else if ( which < num_channels ) {
 26.1725 -		if ( (mix_channel[which].playing > 0) ||
 26.1726 -		     (mix_channel[which].looping > 0) )
 26.1727 -		{
 26.1728 -			++status;
 26.1729 -		}
 26.1730 -	}
 26.1731 -	return(status);
 26.1732 +        for ( i=0; i<num_channels; ++i ) {
 26.1733 +            if ((mix_channel[i].playing > 0) ||
 26.1734 +                (mix_channel[i].looping > 0))
 26.1735 +            {
 26.1736 +                ++status;
 26.1737 +            }
 26.1738 +        }
 26.1739 +    } else if ( which < num_channels ) {
 26.1740 +        if ( (mix_channel[which].playing > 0) ||
 26.1741 +             (mix_channel[which].looping > 0) )
 26.1742 +        {
 26.1743 +            ++status;
 26.1744 +        }
 26.1745 +    }
 26.1746 +    return(status);
 26.1747  }
 26.1748  
 26.1749  /* rcg06072001 Get the chunk associated with a channel. */
 26.1750  Mix_Chunk *Mix_GetChunk(int channel)
 26.1751  {
 26.1752 -	Mix_Chunk *retval = NULL;
 26.1753 +    Mix_Chunk *retval = NULL;
 26.1754  
 26.1755 -	if ((channel >= 0) && (channel < num_channels)) {
 26.1756 -		retval = mix_channel[channel].chunk;
 26.1757 -	}
 26.1758 +    if ((channel >= 0) && (channel < num_channels)) {
 26.1759 +        retval = mix_channel[channel].chunk;
 26.1760 +    }
 26.1761  
 26.1762 -	return(retval);
 26.1763 +    return(retval);
 26.1764  }
 26.1765  
 26.1766  /* Close the mixer, halting all playing audio */
 26.1767  void Mix_CloseAudio(void)
 26.1768  {
 26.1769 -	int i;
 26.1770 +    int i;
 26.1771  
 26.1772 -	if ( audio_opened ) {
 26.1773 -		if ( audio_opened == 1 ) {
 26.1774 -			for (i = 0; i < num_channels; i++) {
 26.1775 -				Mix_UnregisterAllEffects(i);
 26.1776 -			}
 26.1777 -			Mix_UnregisterAllEffects(MIX_CHANNEL_POST);
 26.1778 -			close_music();
 26.1779 -			Mix_HaltChannel(-1);
 26.1780 -			_Mix_DeinitEffects();
 26.1781 -			SDL_CloseAudio();
 26.1782 -			SDL_free(mix_channel);
 26.1783 -			mix_channel = NULL;
 26.1784 +    if ( audio_opened ) {
 26.1785 +        if ( audio_opened == 1 ) {
 26.1786 +            for (i = 0; i < num_channels; i++) {
 26.1787 +                Mix_UnregisterAllEffects(i);
 26.1788 +            }
 26.1789 +            Mix_UnregisterAllEffects(MIX_CHANNEL_POST);
 26.1790 +            close_music();
 26.1791 +            Mix_HaltChannel(-1);
 26.1792 +            _Mix_DeinitEffects();
 26.1793 +            SDL_CloseAudio();
 26.1794 +            SDL_free(mix_channel);
 26.1795 +            mix_channel = NULL;
 26.1796  
 26.1797 -			/* rcg06042009 report available decoders at runtime. */
 26.1798 -			SDL_free(chunk_decoders);
 26.1799 -			chunk_decoders = NULL;
 26.1800 -			num_decoders = 0;
 26.1801 -		}
 26.1802 -		--audio_opened;
 26.1803 -	}
 26.1804 +            /* rcg06042009 report available decoders at runtime. */
 26.1805 +            SDL_free(chunk_decoders);
 26.1806 +            chunk_decoders = NULL;
 26.1807 +            num_decoders = 0;
 26.1808 +        }
 26.1809 +        --audio_opened;
 26.1810 +    }
 26.1811  }
 26.1812  
 26.1813  /* Pause a particular channel (or all) */
 26.1814  void Mix_Pause(int which)
 26.1815  {
 26.1816 -	Uint32 sdl_ticks = SDL_GetTicks();
 26.1817 -	if ( which == -1 ) {
 26.1818 -		int i;
 26.1819 +    Uint32 sdl_ticks = SDL_GetTicks();
 26.1820 +    if ( which == -1 ) {
 26.1821 +        int i;
 26.1822  
 26.1823 -		for ( i=0; i<num_channels; ++i ) {
 26.1824 -			if ( mix_channel[i].playing > 0 ) {
 26.1825 -				mix_channel[i].paused = sdl_ticks;
 26.1826 -			}
 26.1827 -		}
 26.1828 -	} else if ( which < num_channels ) {
 26.1829 -		if ( mix_channel[which].playing > 0 ) {
 26.1830 -			mix_channel[which].paused = sdl_ticks;
 26.1831 -		}
 26.1832 -	}
 26.1833 +        for ( i=0; i<num_channels; ++i ) {
 26.1834 +            if ( mix_channel[i].playing > 0 ) {
 26.1835 +                mix_channel[i].paused = sdl_ticks;
 26.1836 +            }
 26.1837 +        }
 26.1838 +    } else if ( which < num_channels ) {
 26.1839 +        if ( mix_channel[which].playing > 0 ) {
 26.1840 +            mix_channel[which].paused = sdl_ticks;
 26.1841 +        }
 26.1842 +    }
 26.1843  }
 26.1844  
 26.1845  /* Resume a paused channel */
 26.1846  void Mix_Resume(int which)
 26.1847  {
 26.1848 -	Uint32 sdl_ticks = SDL_GetTicks();
 26.1849 +    Uint32 sdl_ticks = SDL_GetTicks();
 26.1850  
 26.1851 -	SDL_LockAudio();
 26.1852 -	if ( which == -1 ) {
 26.1853 -		int i;
 26.1854 +    SDL_LockAudio();
 26.1855 +    if ( which == -1 ) {
 26.1856 +        int i;
 26.1857  
 26.1858 -		for ( i=0; i<num_channels; ++i ) {
 26.1859 -			if ( mix_channel[i].playing > 0 ) {
 26.1860 -				if(mix_channel[i].expire > 0)
 26.1861 -					mix_channel[i].expire += sdl_ticks - mix_channel[i].paused;
 26.1862 -				mix_channel[i].paused = 0;
 26.1863 -			}
 26.1864 -		}
 26.1865 -	} else if ( which < num_channels ) {
 26.1866 -		if ( mix_channel[which].playing > 0 ) {
 26.1867 -			if(mix_channel[which].expire > 0)
 26.1868 -				mix_channel[which].expire += sdl_ticks - mix_channel[which].paused;
 26.1869 -			mix_channel[which].paused = 0;
 26.1870 -		}
 26.1871 -	}
 26.1872 -	SDL_UnlockAudio();
 26.1873 +        for ( i=0; i<num_channels; ++i ) {
 26.1874 +            if ( mix_channel[i].playing > 0 ) {
 26.1875 +                if(mix_channel[i].expire > 0)
 26.1876 +                    mix_channel[i].expire += sdl_ticks - mix_channel[i].paused;
 26.1877 +                mix_channel[i].paused = 0;
 26.1878 +            }
 26.1879 +        }
 26.1880 +    } else if ( which < num_channels ) {
 26.1881 +        if ( mix_channel[which].playing > 0 ) {
 26.1882 +            if(mix_channel[which].expire > 0)
 26.1883 +                mix_channel[which].expire += sdl_ticks - mix_channel[which].paused;
 26.1884 +            mix_channel[which].paused = 0;
 26.1885 +        }
 26.1886 +    }
 26.1887 +    SDL_UnlockAudio();
 26.1888  }
 26.1889  
 26.1890  int Mix_Paused(int which)
 26.1891  {
 26.1892 -	if ( which < 0 ) {
 26.1893 -		int status = 0;
 26.1894 -		int i;
 26.1895 -		for( i=0; i < num_channels; ++i ) {
 26.1896 -			if ( mix_channel[i].paused ) {
 26.1897 -				++ status;
 26.1898 -			}
 26.1899 -		}
 26.1900 -		return(status);
 26.1901 -	} else if ( which < num_channels ) {
 26.1902 -		return(mix_channel[which].paused != 0);
 26.1903 -	} else {
 26.1904 -		return(0);
 26.1905 -	}
 26.1906 +    if ( which < 0 ) {
 26.1907 +        int status = 0;
 26.1908 +        int i;
 26.1909 +        for( i=0; i < num_channels; ++i ) {
 26.1910 +            if ( mix_channel[i].paused ) {
 26.1911 +                ++ status;
 26.1912 +            }
 26.1913 +        }
 26.1914 +        return(status);
 26.1915 +    } else if ( which < num_channels ) {
 26.1916 +        return(mix_channel[which].paused != 0);
 26.1917 +    } else {
 26.1918 +        return(0);
 26.1919 +    }
 26.1920  }
 26.1921  
 26.1922  /* Change the group of a channel */
 26.1923  int Mix_GroupChannel(int which, int tag)
 26.1924  {
 26.1925 -	if ( which < 0 || which > num_channels )
 26.1926 -		return(0);
 26.1927 +    if ( which < 0 || which > num_channels )
 26.1928 +        return(0);
 26.1929  
 26.1930 -	SDL_LockAudio();
 26.1931 -	mix_channel[which].tag = tag;
 26.1932 -	SDL_UnlockAudio();
 26.1933 -	return(1);
 26.1934 +    SDL_LockAudio();
 26.1935 +    mix_channel[which].tag = tag;
 26.1936 +    SDL_UnlockAudio();
 26.1937 +    return(1);
 26.1938  }
 26.1939  
 26.1940  /* Assign several consecutive channels to a group */
 26.1941  int Mix_GroupChannels(int from, int to, int tag)
 26.1942  {
 26.1943 -	int status = 0;
 26.1944 -	for( ; from <= to; ++ from ) {
 26.1945 -		status += Mix_GroupChannel(from, tag);
 26.1946 -	}
 26.1947 -	return(status);
 26.1948 +    int status = 0;
 26.1949 +    for( ; from <= to; ++ from ) {
 26.1950 +        status += Mix_GroupChannel(from, tag);
 26.1951 +    }
 26.1952 +    return(status);
 26.1953  }
 26.1954  
 26.1955  /* Finds the first available channel in a group of channels */
 26.1956  int Mix_GroupAvailable(int tag)
 26.1957  {
 26.1958 -	int i;
 26.1959 -	for( i=0; i < num_channels; i ++ ) {
 26.1960 -		if ( ((tag == -1) || (tag == mix_channel[i].tag)) &&
 26.1961 -		                    (mix_channel[i].playing <= 0) )
 26.1962 -			return i;
 26.1963 -	}
 26.1964 -	return(-1);
 26.1965 +    int i;
 26.1966 +    for( i=0; i < num_channels; i ++ ) {
 26.1967 +        if ( ((tag == -1) || (tag == mix_channel[i].tag)) &&
 26.1968 +                            (mix_channel[i].playing <= 0) )
 26.1969 +            return i;
 26.1970 +    }
 26.1971 +    return(-1);
 26.1972  }
 26.1973  
 26.1974  int Mix_GroupCount(int tag)
 26.1975  {
 26.1976 -	int count = 0;
 26.1977 -	int i;
 26.1978 -	for( i=0; i < num_channels; i ++ ) {
 26.1979 -		if ( mix_channel[i].tag==tag || tag==-1 )
 26.1980 -			++ count;
 26.1981 -	}
 26.1982 -	return(count);
 26.1983 +    int count = 0;
 26.1984 +    int i;
 26.1985 +    for( i=0; i < num_channels; i ++ ) {
 26.1986 +        if ( mix_channel[i].tag==tag || tag==-1 )
 26.1987 +            ++ count;
 26.1988 +    }
 26.1989 +    return(count);
 26.1990  }
 26.1991  
 26.1992  /* Finds the "oldest" sample playing in a group of channels */
 26.1993  int Mix_GroupOldest(int tag)
 26.1994  {
 26.1995 -	int chan = -1;
 26.1996 -	Uint32 mintime = SDL_GetTicks();
 26.1997 -	int i;
 26.1998 -	for( i=0; i < num_channels; i ++ ) {
 26.1999 -		if ( (mix_channel[i].tag==tag || tag==-1) && mix_channel[i].playing > 0
 26.2000 -			 && mix_channel[i].start_time <= mintime ) {
 26.2001 -			mintime = mix_channel[i].start_time;
 26.2002 -			chan = i;
 26.2003 -		}
 26.2004 -	}
 26.2005 -	return(chan);
 26.2006 +    int chan = -1;
 26.2007 +    Uint32 mintime = SDL_GetTicks();
 26.2008 +    int i;
 26.2009 +    for( i=0; i < num_channels; i ++ ) {
 26.2010 +        if ( (mix_channel[i].tag==tag || tag==-1) && mix_channel[i].playing > 0
 26.2011 +             && mix_channel[i].start_time <= mintime ) {
 26.2012 +            mintime = mix_channel[i].start_time;
 26.2013 +            chan = i;
 26.2014 +        }
 26.2015 +    }
 26.2016 +    return(chan);
 26.2017  }
 26.2018  
 26.2019  /* Finds the "most recent" (i.e. last) sample playing in a group of channels */
 26.2020  int Mix_GroupNewer(int tag)
 26.2021  {
 26.2022 -	int chan = -1;
 26.2023 -	Uint32 maxtime = 0;
 26.2024 -	int i;
 26.2025 -	for( i=0; i < num_channels; i ++ ) {
 26.2026 -		if ( (mix_channel[i].tag==tag || tag==-1) && mix_channel[i].playing > 0
 26.2027 -			 && mix_channel[i].start_time >= maxtime ) {
 26.2028 -			maxtime = mix_channel[i].start_time;
 26.2029 -			chan = i;
 26.2030 -		}
 26.2031 -	}
 26.2032 -	return(chan);
 26.2033 +    int chan = -1;
 26.2034 +    Uint32 maxtime = 0;
 26.2035 +    int i;
 26.2036 +    for( i=0; i < num_channels; i ++ ) {
 26.2037 +        if ( (mix_channel[i].tag==tag || tag==-1) && mix_channel[i].playing > 0
 26.2038 +             && mix_channel[i].start_time >= maxtime ) {
 26.2039 +            maxtime = mix_channel[i].start_time;
 26.2040 +            chan = i;
 26.2041 +        }
 26.2042 +    }
 26.2043 +    return(chan);
 26.2044  }
 26.2045  
 26.2046  
 26.2047 @@ -1300,134 +1300,134 @@
 26.2048  
 26.2049  /* MAKE SURE you hold the audio lock (SDL_LockAudio()) before calling this! */
 26.2050  static int _Mix_register_effect(effect_info **e, Mix_EffectFunc_t f,
 26.2051 -				Mix_EffectDone_t d, void *arg)
 26.2052 +                Mix_EffectDone_t d, void *arg)
 26.2053  {
 26.2054 -	effect_info *new_e;
 26.2055 +    effect_info *new_e;
 26.2056  
 26.2057 -	if (!e) {
 26.2058 -		Mix_SetError("Internal error");
 26.2059 -		return(0);
 26.2060 -	}
 26.2061 +    if (!e) {
 26.2062 +        Mix_SetError("Internal error");
 26.2063 +        return(0);
 26.2064 +    }
 26.2065  
 26.2066 -	if (f == NULL) {
 26.2067 -		Mix_SetError("NULL effect callback");
 26.2068 -		return(0);
 26.2069 -	}
 26.2070 +    if (f == NULL) {
 26.2071 +        Mix_SetError("NULL effect callback");
 26.2072 +        return(0);
 26.2073 +    }
 26.2074  
 26.2075 -	new_e = SDL_malloc(sizeof (effect_info));
 26.2076 -	if (new_e == NULL) {
 26.2077 -		Mix_SetError("Out of memory");
 26.2078 -		return(0);
 26.2079 -	}
 26.2080 +    new_e = SDL_malloc(sizeof (effect_info));
 26.2081 +    if (new_e == NULL) {
 26.2082 +        Mix_SetError("Out of memory");
 26.2083 +        return(0);
 26.2084 +    }
 26.2085  
 26.2086 -	new_e->callback = f;
 26.2087 -	new_e->done_callback = d;
 26.2088 -	new_e->udata = arg;
 26.2089 -	new_e->next = NULL;
 26.2090 +    new_e->callback = f;
 26.2091 +    new_e->done_callback = d;
 26.2092 +    new_e->udata = arg;
 26.2093 +    new_e->next = NULL;
 26.2094  
 26.2095 -	/* add new effect to end of linked list... */
 26.2096 -	if (*e == NULL) {
 26.2097 -		*e = new_e;
 26.2098 -	} else {
 26.2099 -		effect_info *cur = *e;
 26.2100 -		while (1) {
 26.2101 -			if (cur->next == NULL) {
 26.2102 -				cur->next = new_e;
 26.2103 -				break;
 26.2104 -			}
 26.2105 -			cur = cur->next;
 26.2106 -		}
 26.2107 -	}
 26.2108 +    /* add new effect to end of linked list... */
 26.2109 +    if (*e == NULL) {
 26.2110 +        *e = new_e;
 26.2111 +    } else {
 26.2112 +        effect_info *cur = *e;
 26.2113 +        while (1) {
 26.2114 +            if (cur->next == NULL) {
 26.2115 +                cur->next = new_e;
 26.2116 +                break;
 26.2117 +            }
 26.2118 +            cur = cur->next;
 26.2119 +        }
 26.2120 +    }
 26.2121  
 26.2122 -	return(1);
 26.2123 +    return(1);
 26.2124  }
 26.2125  
 26.2126  
 26.2127  /* MAKE SURE you hold the audio lock (SDL_LockAudio()) before calling this! */
 26.2128  static int _Mix_remove_effect(int channel, effect_info **e, Mix_EffectFunc_t f)
 26.2129  {
 26.2130 -	effect_info *cur;
 26.2131 -	effect_info *prev = NULL;
 26.2132 -	effect_info *next = NULL;
 26.2133 +    effect_info *cur;
 26.2134 +    effect_info *prev = NULL;
 26.2135 +    effect_info *next = NULL;
 26.2136  
 26.2137 -	if (!e) {
 26.2138 -		Mix_SetError("Internal error");
 26.2139 -		return(0);
 26.2140 -	}
 26.2141 +    if (!e) {
 26.2142 +        Mix_SetError("Internal error");
 26.2143 +        return(0);
 26.2144 +    }
 26.2145  
 26.2146 -	for (cur = *e; cur != NULL; cur = cur->next) {
 26.2147 -		if (cur->callback == f) {
 26.2148 -			next = cur->next;
 26.2149 -			if (cur->done_callback != NULL) {
 26.2150 -				cur->done_callback(channel, cur->udata);
 26.2151 -			}
 26.2152 -			SDL_free(cur);
 26.2153 +    for (cur = *e; cur != NULL; cur = cur->next) {
 26.2154 +        if (cur->callback == f) {
 26.2155 +            next = cur->next;
 26.2156 +            if (cur->done_callback != NULL) {
 26.2157 +                cur->done_callback(channel, cur->udata);
 26.2158 +            }
 26.2159 +            SDL_free(cur);
 26.2160  
 26.2161 -			if (prev == NULL) {   /* removing first item of list? */
 26.2162 -				*e = next;
 26.2163 -			} else {
 26.2164 -				prev->next = next;
 26.2165 -			}
 26.2166 -			return(1);
 26.2167 -		}
 26.2168 -		prev = cur;
 26.2169 -	}
 26.2170 +            if (prev == NULL) {   /* removing first item of list? */
 26.2171 +                *e = next;
 26.2172 +            } else {
 26.2173 +                prev->next = next;
 26.2174 +            }
 26.2175 +            return(1);
 26.2176 +        }
 26.2177 +        prev = cur;
 26.2178 +    }
 26.2179  
 26.2180 -	Mix_SetError("No such effect registered");
 26.2181 -	return(0);
 26.2182 +    Mix_SetError("No such effect registered");
 26.2183 +    return(0);
 26.2184  }
 26.2185  
 26.2186  
 26.2187  /* MAKE SURE you hold the audio lock (SDL_LockAudio()) before calling this! */
 26.2188  static int _Mix_remove_all_effects(int channel, effect_info **e)
 26.2189  {
 26.2190 -	effect_info *cur;
 26.2191 -	effect_info *next;
 26.2192 +    effect_info *cur;
 26.2193 +    effect_info *next;
 26.2194  
 26.2195 -	if (!e) {
 26.2196 -		Mix_SetError("Internal error");
 26.2197 -		return(0);
 26.2198 -	}
 26.2199 +    if (!e) {
 26.2200 +        Mix_SetError("Internal error");
 26.2201 +        return(0);
 26.2202 +    }
 26.2203  
 26.2204 -	for (cur = *e; cur != NULL; cur = next) {
 26.2205 -		next = cur->next;
 26.2206 -		if (cur->done_callback != NULL) {
 26.2207 -			cur->done_callback(channel, cur->udata);
 26.2208 -		}
 26.2209 -		SDL_free(cur);
 26.2210 -	}
 26.2211 -	*e = NULL;
 26.2212 +    for (cur = *e; cur != NULL; cur = next) {
 26.2213 +        next = cur->next;
 26.2214 +        if (cur->done_callback != NULL) {
 26.2215 +            cur->done_callback(channel, cur->udata);
 26.2216 +        }
 26.2217 +        SDL_free(cur);
 26.2218 +    }
 26.2219 +    *e = NULL;
 26.2220  
 26.2221 -	return(1);
 26.2222 +    return(1);
 26.2223  }
 26.2224  
 26.2225  
 26.2226  /* MAKE SURE you hold the audio lock (SDL_LockAudio()) before calling this! */
 26.2227  int _Mix_RegisterEffect_locked(int channel, Mix_EffectFunc_t f,
 26.2228 -			Mix_EffectDone_t d, void *arg)
 26.2229 +            Mix_EffectDone_t d, void *arg)
 26.2230  {
 26.2231 -	effect_info **e = NULL;
 26.2232 +    effect_info **e = NULL;
 26.2233  
 26.2234 -	if (channel == MIX_CHANNEL_POST) {
 26.2235 -		e = &posteffects;
 26.2236 -	} else {
 26.2237 -		if ((channel < 0) || (channel >= num_channels)) {
 26.2238 -			Mix_SetError("Invalid channel number");
 26.2239 -			return(0);
 26.2240 -		}
 26.2241 -		e = &mix_channel[channel].effects;
 26.2242 -	}
 26.2243 +    if (channel == MIX_CHANNEL_POST) {
 26.2244 +        e = &posteffects;
 26.2245 +    } else {
 26.2246 +        if ((channel < 0) || (channel >= num_channels)) {
 26.2247 +            Mix_SetError("Invalid channel number");
 26.2248 +            return(0);
 26.2249 +        }
 26.2250 +        e = &mix_channel[channel].effects;
 26.2251 +    }
 26.2252  
 26.2253 -	return _Mix_register_effect(e, f, d, arg);
 26.2254 +    return _Mix_register_effect(e, f, d, arg);
 26.2255  }
 26.2256  
 26.2257  int Mix_RegisterEffect(int channel, Mix_EffectFunc_t f,
 26.2258 -			Mix_EffectDone_t d, void *arg)
 26.2259 +            Mix_EffectDone_t d, void *arg)
 26.2260  {
 26.2261      int retval;
 26.2262 -	SDL_LockAudio();
 26.2263 -	retval = _Mix_RegisterEffect_locked(channel, f, d, arg);
 26.2264 -	SDL_UnlockAudio();
 26.2265 +    SDL_LockAudio();
 26.2266 +    retval = _Mix_RegisterEffect_locked(channel, f, d, arg);
 26.2267 +    SDL_UnlockAudio();
 26.2268      return retval;
 26.2269  }
 26.2270  
 26.2271 @@ -1435,55 +1435,55 @@
 26.2272  /* MAKE SURE you hold the audio lock (SDL_LockAudio()) before calling this! */
 26.2273  int _Mix_UnregisterEffect_locked(int channel, Mix_EffectFunc_t f)
 26.2274  {
 26.2275 -	effect_info **e = NULL;
 26.2276 +    effect_info **e = NULL;
 26.2277  
 26.2278 -	if (channel == MIX_CHANNEL_POST) {
 26.2279 -		e = &posteffects;
 26.2280 -	} else {
 26.2281 -		if ((channel < 0) || (channel >= num_channels)) {
 26.2282 -			Mix_SetError("Invalid channel number");
 26.2283 -			return(0);
 26.2284 -		}
 26.2285 -		e = &mix_channel[channel].effects;
 26.2286 -	}
 26.2287 +    if (channel == MIX_CHANNEL_POST) {
 26.2288 +        e = &posteffects;
 26.2289 +    } else {
 26.2290 +        if ((channel < 0) || (channel >= num_channels)) {
 26.2291 +            Mix_SetError("Invalid channel number");
 26.2292 +            return(0);
 26.2293 +        }
 26.2294 +        e = &mix_channel[channel].effects;
 26.2295 +    }
 26.2296  
 26.2297 -	return _Mix_remove_effect(channel, e, f);
 26.2298 +    return _Mix_remove_effect(channel, e, f);
 26.2299  }
 26.2300  
 26.2301  int Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f)
 26.2302  {
 26.2303 -	int retval;
 26.2304 -	SDL_LockAudio();
 26.2305 -	retval = _Mix_UnregisterEffect_locked(channel, f);
 26.2306 -	SDL_UnlockAudio();
 26.2307 -	return(retval);
 26.2308 +    int retval;
 26.2309 +    SDL_LockAudio();
 26.2310 +    retval = _Mix_UnregisterEffect_locked(channel, f);
 26.2311 +    SDL_UnlockAudio();
 26.2312 +    return(retval);
 26.2313  }
 26.2314  
 26.2315  /* MAKE SURE you hold the audio lock (SDL_LockAudio()) before calling this! */
 26.2316  int _Mix_UnregisterAllEffects_locked(int channel)
 26.2317  {
 26.2318 -	effect_info **e = NULL;
 26.2319 +    effect_info **e = NULL;
 26.2320  
 26.2321 -	if (channel == MIX_CHANNEL_POST) {
 26.2322 -		e = &posteffects;
 26.2323 -	} else {
 26.2324 -		if ((channel < 0) || (channel >= num_channels)) {
 26.2325 -			Mix_SetError("Invalid channel number");
 26.2326 -			return(0);
 26.2327 -		}
 26.2328 -		e = &mix_channel[channel].effects;
 26.2329 -	}
 26.2330 +    if (channel == MIX_CHANNEL_POST) {
 26.2331 +        e = &posteffects;
 26.2332 +    } else {
 26.2333 +        if ((channel < 0) || (channel >= num_channels)) {
 26.2334 +            Mix_SetError("Invalid channel number");
 26.2335 +            return(0);
 26.2336 +        }
 26.2337 +        e = &mix_channel[channel].effects;
 26.2338 +    }
 26.2339  
 26.2340 -	return _Mix_remove_all_effects(channel, e);
 26.2341 +    return _Mix_remove_all_effects(channel, e);
 26.2342  }
 26.2343  
 26.2344  int Mix_UnregisterAllEffects(int channel)
 26.2345  {
 26.2346 -	int retval;
 26.2347 -	SDL_LockAudio();
 26.2348 -	retval = _Mix_UnregisterAllEffects_locked(channel);
 26.2349 -	SDL_UnlockAudio();
 26.2350 -	return(retval);
 26.2351 +    int retval;
 26.2352 +    SDL_LockAudio();
 26.2353 +    retval = _Mix_UnregisterAllEffects_locked(channel);
 26.2354 +    SDL_UnlockAudio();
 26.2355 +    return(retval);
 26.2356  }
 26.2357  
 26.2358  /* end of mixer.c ... */
    27.1 --- a/music_cmd.c	Tue May 21 21:09:26 2013 -0700
    27.2 +++ b/music_cmd.c	Tue May 21 21:21:23 2013 -0700
    27.3 @@ -39,204 +39,204 @@
    27.4  /* Unimplemented */
    27.5  void MusicCMD_SetVolume(int volume)
    27.6  {
    27.7 -	Mix_SetError("No way to modify external player volume");
    27.8 +    Mix_SetError("No way to modify external player volume");
    27.9  }
   27.10  
   27.11  /* Load a music stream from the given file */
   27.12  MusicCMD *MusicCMD_LoadSong(const char *cmd, const char *file)
   27.13  {
   27.14 -	MusicCMD *music;
   27.15 +    MusicCMD *music;
   27.16  
   27.17 -	/* Allocate and fill the music structure */
   27.18 -	music = (MusicCMD *)SDL_malloc(sizeof *music);
   27.19 -	if ( music == NULL ) {
   27.20 -		Mix_SetError("Out of memory");
   27.21 -		return(NULL);
   27.22 -	}
   27.23 -	music->file = SDL_strdup(file);
   27.24 -	music->cmd = SDL_strdup(cmd);
   27.25 -	music->pid = 0;
   27.26 +    /* Allocate and fill the music structure */
   27.27 +    music = (MusicCMD *)SDL_malloc(sizeof *music);
   27.28 +    if ( music == NULL ) {
   27.29 +        Mix_SetError("Out of memory");
   27.30 +        return(NULL);
   27.31 +    }
   27.32 +    music->file = SDL_strdup(file);
   27.33 +    music->cmd = SDL_strdup(cmd);
   27.34 +    music->pid = 0;
   27.35  
   27.36 -	/* We're done */
   27.37 -	return(music);
   27.38 +    /* We're done */
   27.39 +    return(music);
   27.40  }
   27.41  
   27.42  /* Parse a command line buffer into arguments */
   27.43  static int ParseCommandLine(char *cmdline, char **argv)
   27.44  {
   27.45 -	char *bufp;
   27.46 -	int argc;
   27.47 +    char *bufp;
   27.48 +    int argc;
   27.49  
   27.50 -	argc = 0;
   27.51 -	for ( bufp = cmdline; *bufp; ) {
   27.52 -		/* Skip leading whitespace */
   27.53 -		while ( isspace(*bufp) ) {
   27.54 -			++bufp;
   27.55 -		}
   27.56 -		/* Skip over argument */
   27.57 -		if ( *bufp == '"' ) {
   27.58 -			++bufp;
   27.59 -			if ( *bufp ) {
   27.60 -				if ( argv ) {
   27.61 -					argv[argc] = bufp;
   27.62 -				}
   27.63 -				++argc;
   27.64 -			}
   27.65 -			/* Skip over word */
   27.66 -			while ( *bufp && (*bufp != '"') ) {
   27.67 -				++bufp;
   27.68 -			}
   27.69 -		} else {
   27.70 -			if ( *bufp ) {
   27.71 -				if ( argv ) {
   27.72 -					argv[argc] = bufp;
   27.73 -				}
   27.74 -				++argc;
   27.75 -			}
   27.76 -			/* Skip over word */
   27.77 -			while ( *bufp && ! isspace(*bufp) ) {
   27.78 -				++bufp;
   27.79 -			}
   27.80 -		}
   27.81 -		if ( *bufp ) {
   27.82 -			if ( argv ) {
   27.83 -				*bufp = '\0';
   27.84 -			}
   27.85 -			++bufp;
   27.86 -		}
   27.87 -	}
   27.88 -	if ( argv ) {
   27.89 -		argv[argc] = NULL;
   27.90 -	}
   27.91 -	return(argc);
   27.92 +    argc = 0;
   27.93 +    for ( bufp = cmdline; *bufp; ) {
   27.94 +        /* Skip leading whitespace */
   27.95 +        while ( isspace(*bufp) ) {
   27.96 +            ++bufp;
   27.97 +        }
   27.98 +        /* Skip over argument */
   27.99 +        if ( *bufp == '"' ) {
  27.100 +            ++bufp;
  27.101 +            if ( *bufp ) {
  27.102 +                if ( argv ) {
  27.103 +                    argv[argc] = bufp;
  27.104 +                }
  27.105 +                ++argc;
  27.106 +            }
  27.107 +            /* Skip over word */
  27.108 +            while ( *bufp && (*bufp != '"') ) {
  27.109 +                ++bufp;
  27.110 +            }
  27.111 +        } else {
  27.112 +            if ( *bufp ) {
  27.113 +                if ( argv ) {
  27.114 +                    argv[argc] = bufp;
  27.115 +                }
  27.116 +                ++argc;
  27.117 +            }
  27.118 +            /* Skip over word */
  27.119 +            while ( *bufp && ! isspace(*bufp) ) {
  27.120 +                ++bufp;
  27.121 +            }
  27.122 +        }
  27.123 +        if ( *bufp ) {
  27.124 +            if ( argv ) {
  27.125 +                *bufp = '\0';
  27.126 +            }
  27.127 +            ++bufp;
  27.128 +        }
  27.129 +    }
  27.130 +    if ( argv ) {
  27.131 +        argv[argc] = NULL;
  27.132 +    }
  27.133 +    return(argc);
  27.134  }
  27.135  
  27.136  static char **parse_args(char *command, char *last_arg)
  27.137  {
  27.138 -	int argc;
  27.139 -	char **argv;
  27.140 +    int argc;
  27.141 +    char **argv;
  27.142  
  27.143 -	/* Parse the command line */
  27.144 -	argc = ParseCommandLine(command, NULL);
  27.145 -	if ( last_arg ) {
  27.146 -		++argc;
  27.147 -	}
  27.148 -	argv = (char **)SDL_malloc((argc+1)*(sizeof *argv));
  27.149 -	if ( argv == NULL ) {
  27.150 -		return(NULL);
  27.151 -	}
  27.152 -	argc = ParseCommandLine(command, argv);
  27.153 +    /* Parse the command line */
  27.154 +    argc = ParseCommandLine(command, NULL);
  27.155 +    if ( last_arg ) {
  27.156 +        ++argc;
  27.157 +    }
  27.158 +    argv = (char **)SDL_malloc((argc+1)*(sizeof *argv));
  27.159 +    if ( argv == NULL ) {
  27.160 +        return(NULL);
  27.161 +    }
  27.162 +    argc = ParseCommandLine(command, argv);
  27.163  
  27.164 -	/* Add last command line argument */
  27.165 -	if ( last_arg ) {
  27.166 -		argv[argc++] = last_arg;
  27.167 -	}
  27.168 -	argv[argc] = NULL;
  27.169 +    /* Add last command line argument */
  27.170 +    if ( last_arg ) {
  27.171 +        argv[argc++] = last_arg;
  27.172 +    }
  27.173 +    argv[argc] = NULL;
  27.174  
  27.175 -	/* We're ready! */
  27.176 -	return(argv);
  27.177 +    /* We're ready! */
  27.178 +    return(argv);
  27.179  }
  27.180  
  27.181  /* Start playback of a given music stream */
  27.182  void MusicCMD_Start(MusicCMD *music)
  27.183  {
  27.184  #ifdef HAVE_FORK
  27.185 -	music->pid = fork();
  27.186 +    music->pid = fork();
  27.187  #else
  27.188 -	music->pid = vfork();
  27.189 +    music->pid = vfork();
  27.190  #endif
  27.191 -	switch(music->pid) {
  27.192 -	    /* Failed fork() system call */
  27.193 -	    case -1:
  27.194 -		Mix_SetError("fork() failed");
  27.195 -		return;
  27.196 +    switch(music->pid) {
  27.197 +        /* Failed fork() system call */
  27.198 +        case -1:
  27.199 +        Mix_SetError("fork() failed");
  27.200 +        return;
  27.201  
  27.202 -	    /* Child process - executes here */
  27.203 -	    case 0: {
  27.204 -		    char *command;
  27.205 -		    char **argv;
  27.206 +        /* Child process - executes here */
  27.207 +        case 0: {
  27.208 +            char *command;
  27.209 +            char **argv;
  27.210  
  27.211 -		    /* Unblock signals in case we're called from a thread */
  27.212 -		    {
  27.213 -			sigset_t mask;
  27.214 -			sigemptyset(&mask);
  27.215 -			sigprocmask(SIG_SETMASK, &mask, NULL);
  27.216 -		    }
  27.217 +            /* Unblock signals in case we're called from a thread */
  27.218 +            {
  27.219 +            sigset_t mask;
  27.220 +            sigemptyset(&mask);
  27.221 +            sigprocmask(SIG_SETMASK, &mask, NULL);
  27.222 +            }
  27.223  
  27.224 -		    /* Execute the command */
  27.225 -		    command = SDL_strdup(music->cmd);
  27.226 -		    argv = parse_args(command, music->file);
  27.227 -		    if ( argv != NULL ) {
  27.228 -			execvp(argv[0], argv);
  27.229 -		    }
  27.230 -		    SDL_free(command);
  27.231 +            /* Execute the command */
  27.232 +            command = SDL_strdup(music->cmd);
  27.233 +            argv = parse_args(command, music->file);
  27.234 +            if ( argv != NULL ) {
  27.235 +            execvp(argv[0], argv);
  27.236 +            }
  27.237 +            SDL_free(command);
  27.238  
  27.239 -		    /* exec() failed */
  27.240 -		    perror(argv[0]);
  27.241 -		    _exit(-1);
  27.242 -		}
  27.243 -		break;
  27.244 +            /* exec() failed */
  27.245 +            perror(argv[0]);
  27.246 +            _exit(-1);
  27.247 +        }
  27.248 +        break;
  27.249  
  27.250 -	    /* Parent process - executes here */
  27.251 -	    default:
  27.252 -		break;
  27.253 -	}
  27.254 -	return;
  27.255 +        /* Parent process - executes here */
  27.256 +        default:
  27.257 +        break;
  27.258 +    }
  27.259 +    return;
  27.260  }
  27.261  
  27.262  /* Stop playback of a stream previously started with MusicCMD_Start() */
  27.263  void MusicCMD_Stop(MusicCMD *music)
  27.264  {
  27.265 -	int status;
  27.266 +    int status;
  27.267  
  27.268 -	if ( music->pid > 0 ) {
  27.269 -		while ( kill(music->pid, 0) == 0 ) {
  27.270 -			kill(music->pid, SIGTERM);
  27.271 -			sleep(1);
  27.272 -			waitpid(music->pid, &status, WNOHANG);
  27.273 -		}
  27.274 -		music->pid = 0;
  27.275 -	}
  27.276 +    if ( music->pid > 0 ) {
  27.277 +        while ( kill(music->pid, 0) == 0 ) {
  27.278 +            kill(music->pid, SIGTERM);
  27.279 +            sleep(1);
  27.280 +            waitpid(music->pid, &status, WNOHANG);
  27.281 +        }
  27.282 +        music->pid = 0;
  27.283 +    }
  27.284  }
  27.285  
  27.286  /* Pause playback of a given music stream */
  27.287  void MusicCMD_Pause(MusicCMD *music)
  27.288  {
  27.289 -	if ( music->pid > 0 ) {
  27.290 -		kill(music->pid, SIGSTOP);
  27.291 -	}
  27.292 +    if ( music->pid > 0 ) {
  27.293 +        kill(music->pid, SIGSTOP);
  27.294 +    }
  27.295  }
  27.296  
  27.297  /* Resume playback of a given music stream */
  27.298  void MusicCMD_Resume(MusicCMD *music)
  27.299  {
  27.300 -	if ( music->pid > 0 ) {
  27.301 -		kill(music->pid, SIGCONT);
  27.302 -	}
  27.303 +    if ( music->pid > 0 ) {
  27.304 +        kill(music->pid, SIGCONT);
  27.305 +    }
  27.306  }
  27.307  
  27.308  /* Close the given music stream */
  27.309  void MusicCMD_FreeSong(MusicCMD *music)
  27.310  {
  27.311 -	SDL_free(music->file);
  27.312 -	SDL_free(music->cmd);
  27.313 -	SDL_free(music);
  27.314 +    SDL_free(music->file);
  27.315 +    SDL_free(music->cmd);
  27.316 +    SDL_free(music);
  27.317  }
  27.318  
  27.319  /* Return non-zero if a stream is currently playing */
  27.320  int MusicCMD_Active(MusicCMD *music)
  27.321  {
  27.322 -	int status;
  27.323 -	int active;
  27.324 +    int status;
  27.325 +    int active;
  27.326  
  27.327 -	active = 0;
  27.328 -	if ( music->pid > 0 ) {
  27.329 -		waitpid(music->pid, &status, WNOHANG);
  27.330 -		if ( kill(music->pid, 0) == 0 ) {
  27.331 -			active = 1;
  27.332 -		}
  27.333 -	}
  27.334 -	return(active);
  27.335 +    active = 0;
  27.336 +    if ( music->pid > 0 ) {
  27.337 +        waitpid(music->pid, &status, WNOHANG);
  27.338 +        if ( kill(music->pid, 0) == 0 ) {
  27.339 +            active = 1;
  27.340 +        }
  27.341 +    }
  27.342 +    return(active);
  27.343  }
  27.344  
  27.345  #endif /* CMD_MUSIC */
    28.1 --- a/music_cmd.h	Tue May 21 21:09:26 2013 -0700
    28.2 +++ b/music_cmd.h	Tue May 21 21:21:23 2013 -0700
    28.3 @@ -30,9 +30,9 @@
    28.4  # include <linux/limits.h>
    28.5  #endif
    28.6  typedef struct {
    28.7 -	char *file;
    28.8 -	char *cmd;
    28.9 -	pid_t pid;
   28.10 +    char *file;
   28.11 +    char *cmd;
   28.12 +    pid_t pid;
   28.13  } MusicCMD;
   28.14  
   28.15  /* Unimplemented */
    29.1 --- a/music_flac.c	Tue May 21 21:09:26 2013 -0700
    29.2 +++ b/music_flac.c	Tue May 21 21:21:23 2013 -0700
    29.3 @@ -19,7 +19,7 @@
    29.4    3. This notice may not be removed or altered from any source distribution.
    29.5  
    29.6    This file is used to support SDL_LoadMUS playback of FLAC files.
    29.7 -  	~ Austen Dicken (admin@cvpcs.org)
    29.8 +    ~ Austen Dicken (admin@cvpcs.org)
    29.9  */
   29.10  
   29.11  #ifdef FLAC_MUSIC
   29.12 @@ -40,555 +40,555 @@
   29.13   */
   29.14  int FLAC_init(SDL_AudioSpec *mixerfmt)
   29.15  {
   29.16 -	mixer = *mixerfmt;
   29.17 -	return(0);
   29.18 +    mixer = *mixerfmt;
   29.19 +    return(0);
   29.20  }
   29.21  
   29.22  /* Set the volume for an FLAC stream */
   29.23  void FLAC_setvolume(FLAC_music *music, int volume)
   29.24  {
   29.25 -	music->volume = volume;
   29.26 +    music->volume = volume;
   29.27  }
   29.28  
   29.29  static FLAC__StreamDecoderReadStatus flac_read_music_cb(
   29.30 -									const FLAC__StreamDecoder *decoder,
   29.31 -									FLAC__byte buffer[],
   29.32 -									size_t *bytes,
   29.33 -									void *client_data)
   29.34 +                                    const FLAC__StreamDecoder *decoder,
   29.35 +                                    FLAC__byte buffer[],
   29.36 +                                    size_t *bytes,
   29.37 +                                    void *client_data)
   29.38  {
   29.39 -	FLAC_music *data = (FLAC_music*)client_data;
   29.40 +    FLAC_music *data = (FLAC_music*)client_data;
   29.41  
   29.42 -	// make sure there is something to be reading
   29.43 -	if (*bytes > 0) {
   29.44 -		*bytes = SDL_RWread (data->rwops, buffer, sizeof (FLAC__byte), *bytes);
   29.45 +    // make sure there is something to be reading
   29.46 +    if (*bytes > 0) {
   29.47 +        *bytes = SDL_RWread (data->rwops, buffer, sizeof (FLAC__byte), *bytes);
   29.48  
   29.49 -		if (*bytes == 0 ) { // error or no data was read (EOF)
   29.50 -			return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
   29.51 -		}
   29.52 -		else { // data was read, continue
   29.53 -			return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
   29.54 -		}
   29.55 -	}
   29.56 -	else {
   29.57 -		return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   29.58 -	}
   29.59 +        if (*bytes == 0 ) { // error or no data was read (EOF)
   29.60 +            return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
   29.61 +        }
   29.62 +        else { // data was read, continue
   29.63 +            return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
   29.64 +        }
   29.65 +    }
   29.66 +    else {
   29.67 +        return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   29.68 +    }
   29.69  }
   29.70  
   29.71  static FLAC__StreamDecoderSeekStatus flac_seek_music_cb(
   29.72 -									const FLAC__StreamDecoder *decoder,
   29.73 -									FLAC__uint64 absolute_byte_offset,
   29.74 -									void *client_data)
   29.75 +                                    const FLAC__StreamDecoder *decoder,
   29.76 +                                    FLAC__uint64 absolute_byte_offset,
   29.77 +                                    void *client_data)
   29.78  {
   29.79 -	FLAC_music *data = (FLAC_music*)client_data;
   29.80 +    FLAC_music *data = (FLAC_music*)client_data;
   29.81  
   29.82 -	if (SDL_RWseek (data->rwops, absolute_byte_offset, RW_SEEK_SET) < 0) {
   29.83 -		return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
   29.84 -	}
   29.85 -	else {
   29.86 -		return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
   29.87 -	}
   29.88 +    if (SDL_RWseek (data->rwops, absolute_byte_offset, RW_SEEK_SET) < 0) {
   29.89 +        return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
   29.90 +    }
   29.91 +    else {
   29.92 +        return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
   29.93 +    }
   29.94  }
   29.95  
   29.96  static FLAC__StreamDecoderTellStatus flac_tell_music_cb(
   29.97 -									const FLAC__StreamDecoder *decoder,
   29.98 -									FLAC__uint64 *absolute_byte_offset,
   29.99 -									void *client_data )
  29.100 +                                    const FLAC__StreamDecoder *decoder,
  29.101 +                                    FLAC__uint64 *absolute_byte_offset,
  29.102 +                                    void *client_data )
  29.103  {
  29.104 -	FLAC_music *data = (FLAC_music*)client_data;
  29.105 +    FLAC_music *data = (FLAC_music*)client_data;
  29.106  
  29.107 -	int pos = SDL_RWtell (data->rwops);
  29.108 +    int pos = SDL_RWtell (data->rwops);
  29.109  
  29.110 -	if (pos < 0) {
  29.111 -		return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
  29.112 -	}
  29.113 -	else {
  29.114 -		*absolute_byte_offset = (FLAC__uint64)pos;
  29.115 -		return FLAC__STREAM_DECODER_TELL_STATUS_OK;
  29.116 -	}
  29.117 +    if (pos < 0) {
  29.118 +        return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
  29.119 +    }
  29.120 +    else {
  29.121 +        *absolute_byte_offset = (FLAC__uint64)pos;
  29.122 +        return FLAC__STREAM_DECODER_TELL_STATUS_OK;
  29.123 +    }
  29.124  }
  29.125  
  29.126  static FLAC__StreamDecoderLengthStatus flac_length_music_cb (
  29.127 -									const FLAC__StreamDecoder *decoder,
  29.128 -									FLAC__uint64 *stream_length,
  29.129 -									void *client_data)
  29.130 +                                    const FLAC__StreamDecoder *decoder,
  29.131 +                                    FLAC__uint64 *stream_length,
  29.132 +                                    void *client_data)
  29.133  {
  29.134 -	FLAC_music *data = (FLAC_music*)client_data;
  29.135 +    FLAC_music *data = (FLAC_music*)client_data;
  29.136  
  29.137 -	int pos = SDL_RWtell (data->rwops);
  29.138 -	int length = SDL_RWseek (data->rwops, 0, RW_SEEK_END);
  29.139 +    int pos = SDL_RWtell (data->rwops);
  29.140 +    int length = SDL_RWseek (data->rwops, 0, RW_SEEK_END);
  29.141  
  29.142 -	if (SDL_RWseek (data->rwops, pos, RW_SEEK_SET) != pos || length < 0) {
  29.143 -		/* there was an error attempting to return the stream to the original
  29.144 -		 * position, or the length was invalid. */
  29.145 -		return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
  29.146 -	}
  29.147 -	else {
  29.148 -		*stream_length = (FLAC__uint64)length;
  29.149 -		return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
  29.150 -	}
  29.151 +    if (SDL_RWseek (data->rwops, pos, RW_SEEK_SET) != pos || length < 0) {
  29.152 +        /* there was an error attempting to return the stream to the original
  29.153 +         * position, or the length was invalid. */
  29.154 +        return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
  29.155 +    }
  29.156 +    else {
  29.157 +        *stream_length = (FLAC__uint64)length;
  29.158 +        return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
  29.159 +    }
  29.160  }
  29.161  
  29.162  static FLAC__bool flac_eof_music_cb(
  29.163 -								const FLAC__StreamDecoder *decoder,
  29.164 -								void *client_data )
  29.165 +                                const FLAC__StreamDecoder *decoder,
  29.166 +                                void *client_data )
  29.167  {
  29.168 -	FLAC_music *data = (FLAC_music*)client_data;
  29.169 +    FLAC_music *data = (FLAC_music*)client_data;
  29.170  
  29.171 -	int pos = SDL_RWtell (data->rwops);
  29.172 -	int end = SDL_RWseek (data->rwops, 0, RW_SEEK_END);
  29.173 +    int pos = SDL_RWtell (data->rwops);
  29.174 +    int end = SDL_RWseek (data->rwops, 0, RW_SEEK_END);
  29.175  
  29.176 -	// was the original position equal to the end (a.k.a. the seek didn't move)?
  29.177 -	if (pos == end) {
  29.178 -		// must be EOF
  29.179 -		return true;
  29.180 -	}
  29.181 -	else {
  29.182 -		// not EOF, return to the original position
  29.183 -		SDL_RWseek (data->rwops, pos, RW_SEEK_SET);
  29.184 +    // was the original position equal to the end (a.k.a. the seek didn't move)?
  29.185 +    if (pos == end) {
  29.186 +        // must be EOF
  29.187 +        return true;
  29.188 +    }
  29.189 +    else {
  29.190 +        // not EOF, return to the original position
  29.191 +        SDL_RWseek (data->rwops, pos, RW_SEEK_SET);
  29.192  
  29.193 -		return false;
  29.194 -	}
  29.195 +        return false;
  29.196 +    }
  29.197  }
  29.198  
  29.199  static FLAC__StreamDecoderWriteStatus flac_write_music_cb(
  29.200 -									const FLAC__StreamDecoder *decoder,
  29.201 -									const FLAC__Frame *frame,
  29.202 -									const FLAC__int32 *const buffer[],
  29.203 -									void *client_data)
  29.204 +                                    const FLAC__StreamDecoder *decoder,
  29.205 +                                    const FLAC__Frame *frame,
  29.206 +                                    const FLAC__int32 *const buffer[],
  29.207 +                                    void *client_data)
  29.208  {
  29.209 -	FLAC_music *data = (FLAC_music *)client_data;
  29.210 -	size_t i;
  29.211 +    FLAC_music *data = (FLAC_music *)client_data;
  29.212 +    size_t i;
  29.213  
  29.214 -	if (data->flac_data.total_samples == 0) {
  29.215 -		SDL_SetError ("Given FLAC file does not specify its sample count.");
  29.216 -		return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.217 -	}
  29.218 +    if (data->flac_data.total_samples == 0) {
  29.219 +        SDL_SetError ("Given FLAC file does not specify its sample count.");
  29.220 +        return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.221 +    }
  29.222  
  29.223 -	if (data->flac_data.channels != 2 ||
  29.224 -		data->flac_data.bits_per_sample != 16) {
  29.225 -		SDL_SetError("Current FLAC support is only for 16 bit Stereo files.");
  29.226 -		return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.227 -	}
  29.228 +    if (data->flac_data.channels != 2 ||
  29.229 +        data->flac_data.bits_per_sample != 16) {
  29.230 +        SDL_SetError("Current FLAC support is only for 16 bit Stereo files.");
  29.231 +        return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.232 +    }
  29.233  
  29.234 -	for (i = 0; i < frame->header.blocksize; i++) {
  29.235 -		FLAC__int16 i16;
  29.236 -		FLAC__uint16 ui16;
  29.237 +    for (i = 0; i < frame->header.blocksize; i++) {
  29.238 +        FLAC__int16 i16;
  29.239 +        FLAC__uint16 ui16;
  29.240  
  29.241 -		// make sure we still have at least two bytes that can be read (one for
  29.242 -		// each channel)
  29.243 -		if (data->flac_data.max_to_read >= 4) {
  29.244 -			// does the data block exist?
  29.245 -			if (!data->flac_data.data) {
  29.246 -				data->flac_data.data_len = data->flac_data.max_to_read;
  29.247 -				data->flac_data.data_read = 0;
  29.248 +        // make sure we still have at least two bytes that can be read (one for
  29.249 +        // each channel)
  29.250 +        if (data->flac_data.max_to_read >= 4) {
  29.251 +            // does the data block exist?
  29.252 +            if (!data->flac_data.data) {
  29.253 +                data->flac_data.data_len = data->flac_data.max_to_read;
  29.254 +                data->flac_data.data_read = 0;
  29.255  
  29.256 -				// create it
  29.257 -				data->flac_data.data =
  29.258 -					(char *)SDL_malloc (data->flac_data.data_len);
  29.259 +                // create it
  29.260 +                data->flac_data.data =
  29.261 +                    (char *)SDL_malloc (data->flac_data.data_len);
  29.262  
  29.263 -				if (!data->flac_data.data) {
  29.264 -					return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.265 -				}
  29.266 -			}
  29.267 +                if (!data->flac_data.data) {
  29.268 +                    return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.269 +                }
  29.270 +            }
  29.271  
  29.272 -			i16 = (FLAC__int16)buffer[0][i];
  29.273 -			ui16 = (FLAC__uint16)i16;
  29.274 +            i16 = (FLAC__int16)buffer[0][i];
  29.275 +            ui16 = (FLAC__uint16)i16;
  29.276  
  29.277 -			*((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.278 -															(char)(ui16);
  29.279 -			*((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.280 -															(char)(ui16 >> 8);
  29.281 +            *((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.282 +                                                            (char)(ui16);
  29.283 +            *((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.284 +                                                            (char)(ui16 >> 8);
  29.285  
  29.286 -			i16 = (FLAC__int16)buffer[1][i];
  29.287 -			ui16 = (FLAC__uint16)i16;
  29.288 +            i16 = (FLAC__int16)buffer[1][i];
  29.289 +            ui16 = (FLAC__uint16)i16;
  29.290  
  29.291 -			*((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.292 -															(char)(ui16);
  29.293 -			*((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.294 -															(char)(ui16 >> 8);
  29.295 +            *((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.296 +                                                            (char)(ui16);
  29.297 +            *((data->flac_data.data) + (data->flac_data.data_read++)) =
  29.298 +                                                            (char)(ui16 >> 8);
  29.299  
  29.300 -			data->flac_data.max_to_read -= 4;
  29.301 +            data->flac_data.max_to_read -= 4;
  29.302  
  29.303 -			if (data->flac_data.max_to_read < 4) {
  29.304 -				// we need to set this so that the read halts from the
  29.305 -				// FLAC_getsome function.
  29.306 -				data->flac_data.max_to_read = 0;
  29.307 -			}
  29.308 -		}
  29.309 -		else {
  29.310 -			// we need to write to the overflow
  29.311 -			if (!data->flac_data.overflow) {
  29.312 -				data->flac_data.overflow_len =
  29.313 -											4 * (frame->header.blocksize - i);
  29.314 -				data->flac_data.overflow_read = 0;
  29.315 +            if (data->flac_data.max_to_read < 4) {
  29.316 +                // we need to set this so that the read halts from the
  29.317 +                // FLAC_getsome function.
  29.318 +                data->flac_data.max_to_read = 0;
  29.319 +            }
  29.320 +        }
  29.321 +        else {
  29.322 +            // we need to write to the overflow
  29.323 +            if (!data->flac_data.overflow) {
  29.324 +                data->flac_data.overflow_len =
  29.325 +                                            4 * (frame->header.blocksize - i);
  29.326 +                data->flac_data.overflow_read = 0;
  29.327  
  29.328 -				// make it big enough for the rest of the block
  29.329 -				data->flac_data.overflow =
  29.330 -					(char *)SDL_malloc (data->flac_data.overflow_len);
  29.331 +                // make it big enough for the rest of the block
  29.332 +                data->flac_data.overflow =
  29.333 +                    (char *)SDL_malloc (data->flac_data.overflow_len);
  29.334  
  29.335 -				if (!data->flac_data.overflow) {
  29.336 -					return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.337 -				}
  29.338 -			}
  29.339 +                if (!data->flac_data.overflow) {
  29.340 +                    return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
  29.341 +                }
  29.342 +            }
  29.343  
  29.344 -			i16 = (FLAC__int16)buffer[0][i];
  29.345 -			ui16 = (FLAC__uint16)i16;
  29.346 +            i16 = (FLAC__int16)buffer[0][i];
  29.347 +            ui16 = (FLAC__uint16)i16;
  29.348  
  29.349 -			*((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.350 -															(char)(ui16);
  29.351 -			*((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.352 -															(char)(ui16 >> 8);
  29.353 +            *((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.354 +                                                            (char)(ui16);
  29.355 +            *((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.356 +                                                            (char)(ui16 >> 8);
  29.357  
  29.358 -			i16 = (FLAC__int16)buffer[1][i];
  29.359 -			ui16 = (FLAC__uint16)i16;
  29.360 +            i16 = (FLAC__int16)buffer[1][i];
  29.361 +            ui16 = (FLAC__uint16)i16;
  29.362  
  29.363 -			*((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.364 -															(char)(ui16);
  29.365 -			*((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.366 -															(char)(ui16 >> 8);
  29.367 -		}
  29.368 -	}
  29.369 +            *((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.370 +                                                            (char)(ui16);
  29.371 +            *((data->flac_data.overflow) + (data->flac_data.overflow_read++)) =
  29.372 +                                                            (char)(ui16 >> 8);
  29.373 +        }
  29.374 +    }
  29.375  
  29.376 -	return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
  29.377 +    return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
  29.378  }
  29.379  
  29.380  static void flac_metadata_music_cb(
  29.381 -					const FLAC__StreamDecoder *decoder,
  29.382 -					const FLAC__StreamMetadata *metadata,
  29.383 -					void *client_data)
  29.384 +                    const FLAC__StreamDecoder *decoder,
  29.385 +                    const FLAC__StreamMetadata *metadata,
  29.386 +                    void *client_data)
  29.387  {
  29.388 -	FLAC_music *data = (FLAC_music *)client_data;
  29.389 +    FLAC_music *data = (FLAC_music *)client_data;
  29.390  
  29.391 -	if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
  29.392 -		data->flac_data.sample_rate = metadata->data.stream_info.sample_rate;
  29.393 -		data->flac_data.channels = metadata->data.stream_info.channels;
  29.394 -		data->flac_data.total_samples =
  29.395 -							metadata->data.stream_info.total_samples;
  29.396 -		data->flac_data.bits_per_sample =
  29.397 -							metadata->data.stream_info.bits_per_sample;
  29.398 -		data->flac_data.sample_size = data->flac_data.channels *
  29.399 -										((data->flac_data.bits_per_sample) / 8);
  29.400 -	}
  29.401 +    if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
  29.402 +        data->flac_data.sample_rate = metadata->data.stream_info.sample_rate;
  29.403 +        data->flac_data.channels = metadata->data.stream_info.channels;
  29.404 +        data->flac_data.total_samples =
  29.405 +                            metadata->data.stream_info.total_samples;
  29.406 +        data->flac_data.bits_per_sample =
  29.407 +                            metadata->data.stream_info.bits_per_sample;
  29.408 +        data->flac_data.sample_size = data->flac_data.channels *
  29.409 +                                        ((data->flac_data.bits_per_sample) / 8);
  29.410 +    }
  29.411  }
  29.412  
  29.413  static void flac_error_music_cb(
  29.414 -				const FLAC__StreamDecoder *decoder,
  29.415 -				FLAC__StreamDecoderErrorStatus status,
  29.416 -				void *client_data)
  29.417 +                const FLAC__StreamDecoder *decoder,
  29.418 +                FLAC__StreamDecoderErrorStatus status,
  29.419 +                void *client_data)
  29.420  {
  29.421 -	// print an SDL error based on the error status
  29.422 -	switch (status) {
  29.423 -		case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
  29.424 -			SDL_SetError ("Error processing the FLAC file [LOST_SYNC].");
  29.425 -		break;
  29.426 -		case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
  29.427 -			SDL_SetError ("Error processing the FLAC file [BAD_HEADER].");
  29.428 -		break;
  29.429 -		case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
  29.430 -			SDL_SetError ("Error processing the FLAC file [CRC_MISMATCH].");
  29.431 -		break;
  29.432 -		case FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM:
  29.433 -			SDL_SetError ("Error processing the FLAC file [UNPARSEABLE].");
  29.434 -		break;
  29.435 -		default:
  29.436 -			SDL_SetError ("Error processing the FLAC file [UNKNOWN].");
  29.437 -		break;
  29.438 -	}
  29.439 +    // print an SDL error based on the error status
  29.440 +    switch (status) {
  29.441 +        case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
  29.442 +            SDL_SetError ("Error processing the FLAC file [LOST_SYNC].");
  29.443 +        break;
  29.444 +        case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
  29.445 +            SDL_SetError ("Error processing the FLAC file [BAD_HEADER].");
  29.446 +        break;
  29.447 +        case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
  29.448 +            SDL_SetError ("Error processing the FLAC file [CRC_MISMATCH].");
  29.449 +        break;
  29.450 +        case FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM:
  29.451 +            SDL_SetError ("Error processing the FLAC file [UNPARSEABLE].");
  29.452 +        break;
  29.453 +        default:
  29.454 +            SDL_SetError ("Error processing the FLAC file [UNKNOWN].");
  29.455 +        break;
  29.456 +    }
  29.457  }
  29.458  
  29.459  /* Load an FLAC stream from an SDL_RWops object */
  29.460  FLAC_music *FLAC_new_RW(SDL_RWops *rw, int freerw)
  29.461  {
  29.462 -	FLAC_music *music;
  29.463 -	int init_stage = 0;
  29.464 -	int was_error = 1;
  29.465 +    FLAC_music *music;
  29.466 +    int init_stage = 0;
  29.467 +    int was_error = 1;
  29.468  
  29.469 -	if (!Mix_Init(MIX_INIT_FLAC)) {
  29.470 -		if (freerw) {
  29.471 -			SDL_RWclose(rw);
  29.472 -		}
  29.473 -		return NULL;
  29.474 -	}
  29.475 +    if (!Mix_Init(MIX_INIT_FLAC)) {
  29.476 +        if (freerw) {
  29.477 +            SDL_RWclose(rw);
  29.478 +        }
  29.479 +        return NULL;
  29.480 +    }
  29.481  
  29.482 -	music = (FLAC_music *)SDL_malloc ( sizeof (*music));
  29.483 -	if (music) {
  29.484 -		/* Initialize the music structure */
  29.485 -		memset (music, 0, (sizeof (*music)));
  29.486 -		FLAC_stop (music);
  29.487 -		FLAC_setvolume (music, MIX_MAX_VOLUME);
  29.488 -		music->section = -1;
  29.489 -		music->rwops = rw;
  29.490 -		music->freerw = freerw;
  29.491 -		music->flac_data.max_to_read = 0;
  29.492 -		music->flac_data.overflow = NULL;
  29.493 -		music->flac_data.overflow_len = 0;
  29.494 -		music->flac_data.overflow_read = 0;
  29.495 -		music->flac_data.data = NULL;
  29.496 -		music->flac_data.data_len = 0;
  29.497 -		music->flac_data.data_read = 0;
  29.498 +    music = (FLAC_music *)SDL_malloc ( sizeof (*music));
  29.499 +    if (music) {
  29.500 +        /* Initialize the music structure */
  29.501 +        memset (music, 0, (sizeof (*music)));
  29.502 +        FLAC_stop (music);
  29.503 +        FLAC_setvolume (music, MIX_MAX_VOLUME);
  29.504 +        music->section = -1;
  29.505 +        music->rwops = rw;
  29.506 +        music->freerw = freerw;
  29.507 +        music->flac_data.max_to_read = 0;
  29.508 +        music->flac_data.overflow = NULL;
  29.509 +        music->flac_data.overflow_len = 0;
  29.510 +        music->flac_data.overflow_read = 0;
  29.511 +        music->flac_data.data = NULL;
  29.512 +        music->flac_data.data_len = 0;
  29.513 +        music->flac_data.data_read = 0;
  29.514  
  29.515 -		init_stage++; // stage 1!
  29.516 +        init_stage++; // stage 1!
  29.517  
  29.518 -		music->flac_decoder = flac.FLAC__stream_decoder_new ();
  29.519 +        music->flac_decoder = flac.FLAC__stream_decoder_new ();
  29.520  
  29.521 -		if (music->flac_decoder != NULL) {
  29.522 -			init_stage++; // stage 2!
  29.523 +        if (music->flac_decoder != NULL) {
  29.524 +            init_stage++; // stage 2!
  29.525  
  29.526 -			if (flac.FLAC__stream_decoder_init_stream(
  29.527 -						music->flac_decoder,
  29.528 -						flac_read_music_cb, flac_seek_music_cb,
  29.529 -						flac_tell_music_cb, flac_length_music_cb,
  29.530 -						flac_eof_music_cb, flac_write_music_cb,
  29.531 -						flac_metadata_music_cb, flac_error_music_cb,
  29.532 -						music) == FLAC__STREAM_DECODER_INIT_STATUS_OK ) {
  29.533 -				init_stage++; // stage 3!
  29.534 +            if (flac.FLAC__stream_decoder_init_stream(
  29.535 +                        music->flac_decoder,
  29.536 +                        flac_read_music_cb, flac_seek_music_cb,
  29.537 +                        flac_tell_music_cb, flac_length_music_cb,
  29.538 +                        flac_eof_music_cb, flac_write_music_cb,
  29.539 +                        flac_metadata_music_cb, flac_error_music_cb,
  29.540 +                        music) == FLAC__STREAM_DECODER_INIT_STATUS_OK ) {
  29.541 +                init_stage++; // stage 3!
  29.542  
  29.543 -				if (flac.FLAC__stream_decoder_process_until_end_of_metadata
  29.544 -										(music->flac_decoder)) {
  29.545 -					was_error = 0;
  29.546 -				} else {
  29.547 -					SDL_SetError("FLAC__stream_decoder_process_until_end_of_metadata() failed");
  29.548 -				}
  29.549 -			} else {
  29.550 -				SDL_SetError("FLAC__stream_decoder_init_stream() failed");
  29.551 -			}
  29.552 -		} else {
  29.553 -			SDL_SetError("FLAC__stream_decoder_new() failed");
  29.554 -		}
  29.555 +                if (flac.FLAC__stream_decoder_process_until_end_of_metadata
  29.556 +                                        (music->flac_decoder)) {
  29.557 +                    was_error = 0;
  29.558 +                } else {
  29.559 +                    SDL_SetError("FLAC__stream_decoder_process_until_end_of_metadata() failed");
  29.560 +                }
  29.561 +            } else {
  29.562 +                SDL_SetError("FLAC__stream_decoder_init_stream() failed");
  29.563 +            }
  29.564 +        } else {
  29.565 +            SDL_SetError("FLAC__stream_decoder_new() failed");
  29.566 +        }
  29.567  
  29.568 -		if (was_error) {
  29.569 -			switch (init_stage) {
  29.570 -				case 3:
  29.571 -					flac.FLAC__stream_decoder_finish( music->flac_decoder );
  29.572 -				case 2:
  29.573 -					flac.FLAC__stream_decoder_delete( music->flac_decoder );
  29.574 -				case 1:
  29.575 -				case 0:
  29.576 -					SDL_free(music);
  29.577 -					if (freerw) {
  29.578 -						SDL_RWclose(rw);
  29.579 -					}
  29.580 -					break;
  29.581 -			}
  29.582 -			return NULL;
  29.583 -		}
  29.584 -	} else {
  29.585 -		SDL_OutOfMemory();
  29.586 -		if (freerw) {
  29.587 -			SDL_RWclose(rw);
  29.588 -		}
  29.589 -		return NULL;
  29.590 -	}
  29.591 +        if (was_error) {
  29.592 +            switch (init_stage) {
  29.593 +                case 3:
  29.594 +                    flac.FLAC__stream_decoder_finish( music->flac_decoder );
  29.595 +                case 2:
  29.596 +                    flac.FLAC__stream_decoder_delete( music->flac_decoder );
  29.597 +                case 1:
  29.598 +                case 0:
  29.599 +                    SDL_free(music);
  29.600 +                    if (freerw) {
  29.601 +                        SDL_RWclose(rw);
  29.602 +                    }
  29.603 +                    break;
  29.604 +            }
  29.605 +            return NULL;
  29.606 +        }
  29.607 +    } else {
  29.608 +        SDL_OutOfMemory();
  29.609 +        if (freerw) {
  29.610 +            SDL_RWclose(rw);
  29.611 +        }
  29.612 +        return NULL;
  29.613 +    }
  29.614  
  29.615 -	return music;
  29.616 +    return music;
  29.617  }
  29.618  
  29.619  /* Start playback of a given FLAC stream */
  29.620  void FLAC_play(FLAC_music *music)
  29.621  {
  29.622 -	music->playing = 1;
  29.623 +    music->playing = 1;
  29.624  }
  29.625  
  29.626  /* Return non-zero if a stream is currently playing */
  29.627  int FLAC_playing(FLAC_music *music)
  29.628  {
  29.629 -	return(music->playing);
  29.630 +    return(music->playing);
  29.631  }
  29.632  
  29.633  /* Read some FLAC stream data and convert it for output */
  29.634  static void FLAC_getsome(FLAC_music *music)
  29.635  {
  29.636 -	SDL_AudioCVT *cvt;
  29.637 +    SDL_AudioCVT *cvt;
  29.638  
  29.639 -	/* GET AUDIO WAVE DATA */
  29.640 -	// set the max number of characters to read
  29.641 -	music->flac_data.max_to_read = 8192;
  29.642 -	music->flac_data.data_len = music->flac_data.max_to_read;
  29.643 -	music->flac_data.data_read = 0;
  29.644 -	if (!music->flac_data.data) {
  29.645 -		music->flac_data.data = (char *)SDL_malloc (music->flac_data.data_len);
  29.646 -	}
  29.647 +    /* GET AUDIO WAVE DATA */
  29.648 +    // set the max number of characters to read
  29.649 +    music->flac_data.max_to_read = 8192;
  29.650 +    music->flac_data.data_len = music->flac_data.max_to_read;
  29.651 +    music->flac_data.data_read = 0;
  29.652 +    if (!music->flac_data.data) {
  29.653 +        music->flac_data.data = (char *)SDL_malloc (music->flac_data.data_len);
  29.654 +    }
  29.655  
  29.656 -	// we have data to read
  29.657 -	while(music->flac_data.max_to_read > 0) {
  29.658 -		// first check if there is data in the overflow from before
  29.659 -		if (music->flac_data.overflow) {
  29.660 -			size_t overflow_len = music->flac_data.overflow_read;
  29.661 +    // we have data to read
  29.662 +    while(music->flac_data.max_to_read > 0) {
  29.663 +        // first check if there is data in the overflow from before
  29.664 +        if (music->flac_data.overflow) {
  29.665 +            size_t overflow_len = music->flac_data.overflow_read;
  29.666  
  29.667 -			if (overflow_len > music->flac_data.max_to_read) {
  29.668 -				size_t overflow_extra_len = overflow_len -
  29.669 -												music->flac_data.max_to_read;
  29.670 +            if (overflow_len > music->flac_data.max_to_read) {
  29.671 +                size_t overflow_extra_len = overflow_len -
  29.672 +                                                music->flac_data.max_to_read;
  29.673  
  29.674 -				memcpy (music->flac_data.data+music->flac_data.data_read,
  29.675 -					mu