Updated Android build, including MOD, MP3 and OGG music support.
authorSam Lantinga
Sat, 01 Jun 2013 22:16:14 -0700
changeset 6261da1d92ffa9c
parent 625 1d489d8ec2e0
child 627 438fb12df34f
Updated Android build, including MOD, MP3 and OGG music support.
.hgignore
Android.mk
dynamic_ogg.h
external/libmikmod-3.1.12/Android.mk
external/libmikmod-3.1.12/drivers/drv_raw.c
external/libmikmod-3.1.12/include/mikmod.h
external/libmikmod-3.1.12/include/mikmod_build.h
external/libmikmod-patches/libmikmod-3.1.12-android.diff
external/libogg-1.3.1/include/ogg/config_types.h
external/libvorbisidec-1.2.1.patch
external/libvorbisidec-1.2.1/misc.h
external/smpeg2-2.0.0/Android.mk
music_ogg.h
     1.1 --- a/.hgignore	Sat Jun 01 19:52:15 2013 -0700
     1.2 +++ b/.hgignore	Sat Jun 01 22:16:14 2013 -0700
     1.3 @@ -4,6 +4,15 @@
     1.4  config.log
     1.5  config.status
     1.6  Makefile
     1.7 +libtool
     1.8 +.deps
     1.9 +.libs
    1.10 +*.lo
    1.11 +*.o
    1.12 +*.la
    1.13 +*.lai
    1.14 +*.xcworkspacedata
    1.15 +*.xcuserdatad
    1.16 +.DS_Store
    1.17 +build
    1.18  SDL2_mixer.pc
    1.19 -libtool
    1.20 -build
     2.1 --- a/Android.mk	Sat Jun 01 19:52:15 2013 -0700
     2.2 +++ b/Android.mk	Sat Jun 01 22:16:14 2013 -0700
     2.3 @@ -4,16 +4,63 @@
     2.4  
     2.5  LOCAL_MODULE := SDL2_mixer
     2.6  
     2.7 -LOCAL_C_INCLUDES := \
     2.8 -	$(LOCAL_PATH)/.. \
     2.9 -	$(LOCAL_PATH)/../SDL/include \
    2.10 -	$(LOCAL_PATH)/../mikmod/include \
    2.11 +# Enable this if you want to support loading MOD music via mikmod
    2.12 +# The library path should be a relative path to this directory.
    2.13 +SUPPORT_MOD := true
    2.14 +MOD_LIBRARY_PATH := external/libmikmod-3.1.12
    2.15 +
    2.16 +# Enable this if you want to support loading MP3 music via SMPEG
    2.17 +# The library path should be a relative path to this directory.
    2.18 +SUPPORT_MP3 := true
    2.19 +MP3_LIBRARY_PATH := external/smpeg2-2.0.0
    2.20  
    2.21 -LOCAL_CFLAGS := -DWAV_MUSIC -DOGG_MUSIC -DOGG_USE_TREMOR -DMOD_MUSIC
    2.22 +# Enable this if you want to support loading OGG Vorbis music via Tremor
    2.23 +# The library path should be a relative path to this directory.
    2.24 +SUPPORT_OGG := true
    2.25 +OGG_LIBRARY_PATH := external/libogg-1.3.1
    2.26 +VORBIS_LIBRARY_PATH := external/libvorbisidec-1.2.1
    2.27 +
    2.28 +
    2.29 +LOCAL_C_INCLUDES := $(NDK_PROJECT_PATH)/jni/SDL/include
    2.30 +LOCAL_CFLAGS := -DWAV_MUSIC
    2.31  
    2.32  LOCAL_SRC_FILES := $(notdir $(filter-out %/playmus.c %/playwave.c, $(wildcard $(LOCAL_PATH)/*.c)))
    2.33  
    2.34 -LOCAL_SHARED_LIBRARIES := SDL2 mikmod
    2.35 -LOCAL_STATIC_LIBRARIES := tremor
    2.36 +LOCAL_LDLIBS :=
    2.37 +LOCAL_STATIC_LIBRARIES :=
    2.38 +LOCAL_SHARED_LIBRARIES := SDL2
    2.39 +
    2.40 +ifeq ($(SUPPORT_MOD),true)
    2.41 +    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MOD_LIBRARY_PATH)/include
    2.42 +    LOCAL_CFLAGS += -DMOD_MUSIC
    2.43 +    LOCAL_SHARED_LIBRARIES += mikmod
    2.44 +endif
    2.45 +
    2.46 +ifeq ($(SUPPORT_MP3),true)
    2.47 +    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MP3_LIBRARY_PATH)
    2.48 +    LOCAL_CFLAGS += -DMP3_MUSIC
    2.49 +    LOCAL_SHARED_LIBRARIES += smpeg2
    2.50 +endif
    2.51 +
    2.52 +ifeq ($(SUPPORT_OGG),true)
    2.53 +    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include $(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)
    2.54 +    LOCAL_CFLAGS += -DOGG_MUSIC -DOGG_USE_TREMOR
    2.55 +    LOCAL_SRC_FILES += \
    2.56 +        $(VORBIS_LIBRARY_PATH)/mdct.c \
    2.57 +        $(VORBIS_LIBRARY_PATH)/block.c \
    2.58 +        $(VORBIS_LIBRARY_PATH)/window.c \
    2.59 +        $(VORBIS_LIBRARY_PATH)/synthesis.c \
    2.60 +        $(VORBIS_LIBRARY_PATH)/info.c \
    2.61 +        $(VORBIS_LIBRARY_PATH)/floor1.c \
    2.62 +        $(VORBIS_LIBRARY_PATH)/floor0.c \
    2.63 +        $(VORBIS_LIBRARY_PATH)/vorbisfile.c \
    2.64 +        $(VORBIS_LIBRARY_PATH)/res012.c \
    2.65 +        $(VORBIS_LIBRARY_PATH)/mapping0.c \
    2.66 +        $(VORBIS_LIBRARY_PATH)/registry.c \
    2.67 +        $(VORBIS_LIBRARY_PATH)/codebook.c \
    2.68 +        $(VORBIS_LIBRARY_PATH)/sharedbook.c \
    2.69 +        $(OGG_LIBRARY_PATH)/src/framing.c \
    2.70 +        $(OGG_LIBRARY_PATH)/src/bitwise.c
    2.71 +endif
    2.72  
    2.73  include $(BUILD_SHARED_LIBRARY)
     3.1 --- a/dynamic_ogg.h	Sat Jun 01 19:52:15 2013 -0700
     3.2 +++ b/dynamic_ogg.h	Sat Jun 01 22:16:14 2013 -0700
     3.3 @@ -21,7 +21,7 @@
     3.4  
     3.5  #ifdef OGG_MUSIC
     3.6  #ifdef OGG_USE_TREMOR
     3.7 -#include <tremor/ivorbisfile.h>
     3.8 +#include <ivorbisfile.h>
     3.9  #else
    3.10  #include <vorbis/vorbisfile.h>
    3.11  #endif
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/external/libmikmod-3.1.12/Android.mk	Sat Jun 01 22:16:14 2013 -0700
     4.3 @@ -0,0 +1,66 @@
     4.4 +LOCAL_PATH := $(call my-dir)
     4.5 +
     4.6 +include $(CLEAR_VARS)
     4.7 +
     4.8 +LOCAL_MODULE := mikmod
     4.9 +
    4.10 +LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    4.11 +LOCAL_CFLAGS := -D_DLL -DDLL_EXPORTS -DHAVE_UNISTD_H -DHAVE_FCNTL_H
    4.12 +
    4.13 +LOCAL_SRC_FILES := \
    4.14 +    drivers/drv_AF.c \
    4.15 +    drivers/drv_aix.c \
    4.16 +    drivers/drv_alsa.c \
    4.17 +    drivers/drv_esd.c \
    4.18 +    drivers/drv_hp.c \
    4.19 +    drivers/drv_nos.c \
    4.20 +    drivers/drv_oss.c \
    4.21 +    drivers/drv_pipe.c \
    4.22 +    drivers/drv_raw.c \
    4.23 +    drivers/drv_sam9407.c \
    4.24 +    drivers/drv_sgi.c \
    4.25 +    drivers/drv_stdout.c \
    4.26 +    drivers/drv_sun.c \
    4.27 +    drivers/drv_ultra.c \
    4.28 +    drivers/drv_wav.c \
    4.29 +    loaders/load_669.c \
    4.30 +    loaders/load_amf.c \
    4.31 +    loaders/load_dsm.c \
    4.32 +    loaders/load_far.c \
    4.33 +    loaders/load_gdm.c \
    4.34 +    loaders/load_imf.c \
    4.35 +    loaders/load_it.c \
    4.36 +    loaders/load_m15.c \
    4.37 +    loaders/load_med.c \
    4.38 +    loaders/load_mod.c \
    4.39 +    loaders/load_mtm.c \
    4.40 +    loaders/load_okt.c \
    4.41 +    loaders/load_s3m.c \
    4.42 +    loaders/load_stm.c \
    4.43 +    loaders/load_stx.c \
    4.44 +    loaders/load_ult.c \
    4.45 +    loaders/load_uni.c \
    4.46 +    loaders/load_xm.c \
    4.47 +    mmio/mmalloc.c \
    4.48 +    mmio/mmerror.c \
    4.49 +    mmio/mmio.c \
    4.50 +    playercode/mdreg.c \
    4.51 +    playercode/mdriver.c \
    4.52 +    playercode/mdulaw.c \
    4.53 +    playercode/mloader.c \
    4.54 +    playercode/mlreg.c \
    4.55 +    playercode/mlutil.c \
    4.56 +    playercode/mplayer.c \
    4.57 +    playercode/munitrk.c \
    4.58 +    playercode/mwav.c \
    4.59 +    playercode/npertab.c \
    4.60 +    playercode/sloader.c \
    4.61 +    playercode/virtch.c \
    4.62 +    playercode/virtch2.c \
    4.63 +    playercode/virtch_common.c
    4.64 +
    4.65 +LOCAL_LDLIBS :=
    4.66 +LOCAL_STATIC_LIBRARIES :=
    4.67 +LOCAL_SHARED_LIBRARIES :=
    4.68 +
    4.69 +include $(BUILD_SHARED_LIBRARY)
     5.1 --- a/external/libmikmod-3.1.12/drivers/drv_raw.c	Sat Jun 01 19:52:15 2013 -0700
     5.2 +++ b/external/libmikmod-3.1.12/drivers/drv_raw.c	Sat Jun 01 22:16:14 2013 -0700
     5.3 @@ -50,6 +50,13 @@
     5.4  #ifndef O_BINARY
     5.5  #define O_BINARY 0
     5.6  #endif
     5.7 +#ifndef S_IREAD
     5.8 +#define S_IREAD S_IRUSR
     5.9 +#endif
    5.10 +#ifndef S_IWRITE
    5.11 +#define S_IWRITE S_IWUSR
    5.12 +#endif
    5.13 +
    5.14  
    5.15  #if defined(WIN32) && !defined(__MWERKS__)
    5.16  #define open _open
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/external/libmikmod-3.1.12/include/mikmod.h	Sat Jun 01 22:16:14 2013 -0700
     6.3 @@ -0,0 +1,725 @@
     6.4 +/*	MikMod sound library
     6.5 +	(c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS
     6.6 +	for complete list.
     6.7 +
     6.8 +	This library is free software; you can redistribute it and/or modify
     6.9 +	it under the terms of the GNU Library General Public License as
    6.10 +	published by the Free Software Foundation; either version 2 of
    6.11 +	the License, or (at your option) any later version.
    6.12 + 
    6.13 +	This program is distributed in the hope that it will be useful,
    6.14 +	but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 +	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.16 +	GNU Library General Public License for more details.
    6.17 + 
    6.18 +	You should have received a copy of the GNU Library General Public
    6.19 +	License along with this library; if not, write to the Free Software
    6.20 +	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    6.21 +	02111-1307, USA.
    6.22 +*/
    6.23 +
    6.24 +/*==============================================================================
    6.25 +
    6.26 +  $Id: mikmod.h.in,v 1.2 2004/06/01 16:43:45 raph Exp $
    6.27 +
    6.28 +  MikMod sound library include file
    6.29 +
    6.30 +==============================================================================*/
    6.31 +
    6.32 +#ifndef _MIKMOD_H_
    6.33 +#define _MIKMOD_H_
    6.34 +
    6.35 +#include <stdio.h>
    6.36 +#include <stdlib.h>
    6.37 +
    6.38 +#ifdef __cplusplus
    6.39 +extern "C" {
    6.40 +#endif
    6.41 +
    6.42 +/*
    6.43 + * ========== Compiler magic for shared libraries
    6.44 + */
    6.45 +
    6.46 +#if defined WIN32 && defined _DLL
    6.47 +#ifdef DLL_EXPORTS
    6.48 +#define MIKMODAPI __declspec(dllexport)
    6.49 +#else
    6.50 +#define MIKMODAPI __declspec(dllimport)
    6.51 +#endif
    6.52 +#else
    6.53 +#define MIKMODAPI
    6.54 +#endif
    6.55 +
    6.56 +/*
    6.57 + *	========== Library version
    6.58 + */
    6.59 +
    6.60 +#define LIBMIKMOD_VERSION_MAJOR 3L
    6.61 +#define LIBMIKMOD_VERSION_MINOR 1L
    6.62 +#define LIBMIKMOD_REVISION      10L
    6.63 +
    6.64 +#define LIBMIKMOD_VERSION \
    6.65 +	((LIBMIKMOD_VERSION_MAJOR<<16)| \
    6.66 +	 (LIBMIKMOD_VERSION_MINOR<< 8)| \
    6.67 +	 (LIBMIKMOD_REVISION))
    6.68 +
    6.69 +MIKMODAPI extern long MikMod_GetVersion(void);
    6.70 +
    6.71 +/*
    6.72 + *	========== Platform independent-type definitions
    6.73 + */
    6.74 +
    6.75 +#ifdef WIN32
    6.76 +#define WIN32_LEAN_AND_MEAN
    6.77 +#include <windows.h>
    6.78 +#include <io.h>
    6.79 +#include <mmsystem.h>
    6.80 +
    6.81 +/* Avoid conflicts with windef.h */
    6.82 +#define SBYTE   _mm_SBYTE
    6.83 +#define UBYTE   _mm_UBYTE
    6.84 +#define SWORD   _mm_SWORD
    6.85 +#define UWORD   _mm_UWORD
    6.86 +#define SLONG   _mm_SLONG
    6.87 +#define ULONG   _mm_ULONG
    6.88 +#define BOOL    _mm_BOOL
    6.89 +
    6.90 +#endif /* WIN32 */
    6.91 +
    6.92 +#if defined(__OS2__)||defined(__EMX__)
    6.93 +#define INCL_DOSSEMAPHORES
    6.94 +#include <os2.h>
    6.95 +#else
    6.96 +typedef char CHAR;
    6.97 +#endif
    6.98 +
    6.99 +
   6.100 +
   6.101 +#if defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(_LP64)
   6.102 +/* 64 bit architectures */
   6.103 +
   6.104 +typedef signed char     SBYTE;      /* 1 byte, signed */
   6.105 +typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   6.106 +typedef signed short    SWORD;      /* 2 bytes, signed */
   6.107 +typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   6.108 +typedef signed int      SLONG;      /* 4 bytes, signed */
   6.109 +typedef unsigned int    ULONG;      /* 4 bytes, unsigned */
   6.110 +typedef int             BOOL;       /* 0=false, <>0 true */
   6.111 +
   6.112 +#else
   6.113 +/* 32 bit architectures */
   6.114 +
   6.115 +typedef signed char     SBYTE;      /* 1 byte, signed */
   6.116 +typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   6.117 +typedef signed short    SWORD;      /* 2 bytes, signed */
   6.118 +typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   6.119 +typedef signed long     SLONG;      /* 4 bytes, signed */
   6.120 +typedef unsigned long   ULONG;      /* 4 bytes, unsigned */
   6.121 +typedef int             BOOL;       /* 0=false, <>0 true */
   6.122 +#endif
   6.123 +
   6.124 +/*
   6.125 + *	========== Error codes
   6.126 + */
   6.127 +
   6.128 +enum {
   6.129 +	MMERR_OPENING_FILE = 1,
   6.130 +	MMERR_OUT_OF_MEMORY,
   6.131 +	MMERR_DYNAMIC_LINKING,
   6.132 +
   6.133 +	MMERR_SAMPLE_TOO_BIG,
   6.134 +	MMERR_OUT_OF_HANDLES,
   6.135 +	MMERR_UNKNOWN_WAVE_TYPE,
   6.136 +
   6.137 +	MMERR_LOADING_PATTERN,
   6.138 +	MMERR_LOADING_TRACK,
   6.139 +	MMERR_LOADING_HEADER,
   6.140 +	MMERR_LOADING_SAMPLEINFO,
   6.141 +	MMERR_NOT_A_MODULE,
   6.142 +	MMERR_NOT_A_STREAM,
   6.143 +	MMERR_MED_SYNTHSAMPLES,
   6.144 +	MMERR_ITPACK_INVALID_DATA,
   6.145 +
   6.146 +	MMERR_DETECTING_DEVICE,
   6.147 +	MMERR_INVALID_DEVICE,
   6.148 +	MMERR_INITIALIZING_MIXER,
   6.149 +	MMERR_OPENING_AUDIO,
   6.150 +	MMERR_8BIT_ONLY,
   6.151 +	MMERR_16BIT_ONLY,
   6.152 +	MMERR_STEREO_ONLY,
   6.153 +	MMERR_ULAW,
   6.154 +	MMERR_NON_BLOCK,
   6.155 +
   6.156 +	MMERR_AF_AUDIO_PORT,
   6.157 +
   6.158 +	MMERR_AIX_CONFIG_INIT,
   6.159 +	MMERR_AIX_CONFIG_CONTROL,
   6.160 +	MMERR_AIX_CONFIG_START,
   6.161 +
   6.162 +	MMERR_GUS_SETTINGS,
   6.163 +	MMERR_GUS_RESET,
   6.164 +	MMERR_GUS_TIMER,
   6.165 +
   6.166 +	MMERR_HP_SETSAMPLESIZE,
   6.167 +	MMERR_HP_SETSPEED,
   6.168 +	MMERR_HP_CHANNELS,
   6.169 +	MMERR_HP_AUDIO_OUTPUT,
   6.170 +	MMERR_HP_AUDIO_DESC,
   6.171 +	MMERR_HP_BUFFERSIZE,
   6.172 +
   6.173 +	MMERR_OSS_SETFRAGMENT,
   6.174 +	MMERR_OSS_SETSAMPLESIZE,
   6.175 +	MMERR_OSS_SETSTEREO,
   6.176 +	MMERR_OSS_SETSPEED,
   6.177 +
   6.178 +	MMERR_SGI_SPEED,
   6.179 +	MMERR_SGI_16BIT,
   6.180 +	MMERR_SGI_8BIT,
   6.181 +	MMERR_SGI_STEREO,
   6.182 +	MMERR_SGI_MONO,
   6.183 +
   6.184 +	MMERR_SUN_INIT,
   6.185 +
   6.186 +	MMERR_OS2_MIXSETUP,
   6.187 +	MMERR_OS2_SEMAPHORE,
   6.188 +	MMERR_OS2_TIMER,
   6.189 +	MMERR_OS2_THREAD,
   6.190 +
   6.191 +	MMERR_DS_PRIORITY,
   6.192 +	MMERR_DS_BUFFER,
   6.193 +	MMERR_DS_FORMAT,
   6.194 +	MMERR_DS_NOTIFY,
   6.195 +	MMERR_DS_EVENT,
   6.196 +	MMERR_DS_THREAD,
   6.197 +	MMERR_DS_UPDATE,
   6.198 +
   6.199 +	MMERR_WINMM_HANDLE,
   6.200 +	MMERR_WINMM_ALLOCATED,
   6.201 +	MMERR_WINMM_DEVICEID,
   6.202 +	MMERR_WINMM_FORMAT,
   6.203 +	MMERR_WINMM_UNKNOWN,
   6.204 +
   6.205 +	MMERR_MAC_SPEED,
   6.206 +	MMERR_MAC_START,
   6.207 +
   6.208 +	MMERR_MAX
   6.209 +};
   6.210 +
   6.211 +/*
   6.212 + *	========== Error handling
   6.213 + */
   6.214 +
   6.215 +typedef void (MikMod_handler)(void);
   6.216 +typedef MikMod_handler *MikMod_handler_t;
   6.217 +
   6.218 +MIKMODAPI extern int  MikMod_errno;
   6.219 +MIKMODAPI extern BOOL MikMod_critical;
   6.220 +MIKMODAPI extern char *MikMod_strerror(int);
   6.221 +
   6.222 +MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
   6.223 +
   6.224 +/*
   6.225 + *	========== Library initialization and core functions
   6.226 + */
   6.227 +
   6.228 +struct MDRIVER;
   6.229 +
   6.230 +MIKMODAPI extern void   MikMod_RegisterAllDrivers(void);
   6.231 +
   6.232 +MIKMODAPI extern CHAR*  MikMod_InfoDriver(void);
   6.233 +MIKMODAPI extern void   MikMod_RegisterDriver(struct MDRIVER*);
   6.234 +MIKMODAPI extern int    MikMod_DriverFromAlias(CHAR*);
   6.235 +
   6.236 +MIKMODAPI extern BOOL   MikMod_Init(CHAR*);
   6.237 +MIKMODAPI extern void   MikMod_Exit(void);
   6.238 +MIKMODAPI extern BOOL   MikMod_Reset(CHAR*);
   6.239 +MIKMODAPI extern BOOL   MikMod_SetNumVoices(int,int);
   6.240 +MIKMODAPI extern BOOL   MikMod_Active(void);
   6.241 +MIKMODAPI extern BOOL   MikMod_EnableOutput(void);
   6.242 +MIKMODAPI extern void   MikMod_DisableOutput(void);
   6.243 +MIKMODAPI extern void   MikMod_Update(void);
   6.244 +
   6.245 +MIKMODAPI extern BOOL   MikMod_InitThreads(void);
   6.246 +MIKMODAPI extern void   MikMod_Lock(void);
   6.247 +MIKMODAPI extern void   MikMod_Unlock(void);
   6.248 +
   6.249 +/*
   6.250 + *	========== Reader, Writer
   6.251 + */
   6.252 +
   6.253 +typedef struct MREADER {
   6.254 +	BOOL (*Seek)(struct MREADER*,long,int);
   6.255 +	long (*Tell)(struct MREADER*);
   6.256 +	BOOL (*Read)(struct MREADER*,void*,size_t);
   6.257 +	int  (*Get)(struct MREADER*);
   6.258 +	BOOL (*Eof)(struct MREADER*);
   6.259 +} MREADER;
   6.260 +
   6.261 +typedef struct MWRITER {
   6.262 +	BOOL (*Seek)(struct MWRITER*,long,int);
   6.263 +	long (*Tell)(struct MWRITER*);
   6.264 +	BOOL (*Write)(struct MWRITER*,void*,size_t);
   6.265 +	BOOL (*Put)(struct MWRITER*,int);
   6.266 +} MWRITER;
   6.267 +
   6.268 +/*
   6.269 + *	========== Samples
   6.270 + */
   6.271 +
   6.272 +/* Sample playback should not be interrupted */
   6.273 +#define SFX_CRITICAL 1
   6.274 +
   6.275 +/* Sample format [loading and in-memory] flags: */
   6.276 +#define SF_16BITS       0x0001
   6.277 +#define SF_STEREO       0x0002
   6.278 +#define SF_SIGNED       0x0004
   6.279 +#define SF_BIG_ENDIAN   0x0008
   6.280 +#define SF_DELTA        0x0010
   6.281 +#define SF_ITPACKED		0x0020
   6.282 +
   6.283 +#define	SF_FORMATMASK	0x003F
   6.284 +
   6.285 +/* General Playback flags */
   6.286 +
   6.287 +#define SF_LOOP         0x0100
   6.288 +#define SF_BIDI         0x0200
   6.289 +#define SF_REVERSE      0x0400
   6.290 +#define SF_SUSTAIN      0x0800
   6.291 +
   6.292 +#define SF_PLAYBACKMASK	0x0C00
   6.293 +
   6.294 +/* Module-only Playback Flags */
   6.295 +
   6.296 +#define SF_OWNPAN		0x1000
   6.297 +#define SF_UST_LOOP     0x2000
   6.298 +
   6.299 +#define SF_EXTRAPLAYBACKMASK	0x3000
   6.300 +
   6.301 +/* Panning constants */
   6.302 +#define PAN_LEFT		0
   6.303 +#define PAN_HALFLEFT 	64
   6.304 +#define PAN_CENTER		128
   6.305 +#define PAN_HALFRIGHT	192
   6.306 +#define PAN_RIGHT		255
   6.307 +#define PAN_SURROUND	512 /* panning value for Dolby Surround */
   6.308 +
   6.309 +typedef struct SAMPLE {
   6.310 +	SWORD  panning;     /* panning (0-255 or PAN_SURROUND) */
   6.311 +	ULONG  speed;       /* Base playing speed/frequency of note */
   6.312 +	UBYTE  volume;      /* volume 0-64 */
   6.313 +	UWORD  inflags;		/* sample format on disk */
   6.314 +	UWORD  flags;       /* sample format in memory */
   6.315 +	ULONG  length;      /* length of sample (in samples!) */
   6.316 +	ULONG  loopstart;   /* repeat position (relative to start, in samples) */
   6.317 +	ULONG  loopend;     /* repeat end */
   6.318 +	ULONG  susbegin;    /* sustain loop begin (in samples) \  Not Supported */
   6.319 +	ULONG  susend;      /* sustain loop end                /      Yet! */
   6.320 +
   6.321 +	/* Variables used by the module player only! (ignored for sound effects) */
   6.322 +	UBYTE  globvol;     /* global volume */
   6.323 +	UBYTE  vibflags;    /* autovibrato flag stuffs */
   6.324 +	UBYTE  vibtype;     /* Vibratos moved from INSTRUMENT to SAMPLE */
   6.325 +	UBYTE  vibsweep;
   6.326 +	UBYTE  vibdepth;
   6.327 +	UBYTE  vibrate;
   6.328 +	CHAR*  samplename;  /* name of the sample */
   6.329 +
   6.330 +	/* Values used internally only */
   6.331 +	UWORD  avibpos;     /* autovibrato pos [player use] */
   6.332 +	UBYTE  divfactor;   /* for sample scaling, maintains proper period slides */
   6.333 +	ULONG  seekpos;     /* seek position in file */
   6.334 +	SWORD  handle;      /* sample handle used by individual drivers */
   6.335 +} SAMPLE;
   6.336 +
   6.337 +/* Sample functions */
   6.338 +
   6.339 +MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);
   6.340 +MIKMODAPI extern SAMPLE *Sample_LoadFP(FILE*);
   6.341 +MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
   6.342 +MIKMODAPI extern void   Sample_Free(SAMPLE*);
   6.343 +MIKMODAPI extern SBYTE  Sample_Play(SAMPLE*,ULONG,UBYTE);
   6.344 +
   6.345 +MIKMODAPI extern void   Voice_SetVolume(SBYTE,UWORD);
   6.346 +MIKMODAPI extern UWORD  Voice_GetVolume(SBYTE);
   6.347 +MIKMODAPI extern void   Voice_SetFrequency(SBYTE,ULONG);
   6.348 +MIKMODAPI extern ULONG  Voice_GetFrequency(SBYTE);
   6.349 +MIKMODAPI extern void   Voice_SetPanning(SBYTE,ULONG);
   6.350 +MIKMODAPI extern ULONG  Voice_GetPanning(SBYTE);
   6.351 +MIKMODAPI extern void   Voice_Play(SBYTE,SAMPLE*,ULONG);
   6.352 +MIKMODAPI extern void   Voice_Stop(SBYTE);
   6.353 +MIKMODAPI extern BOOL   Voice_Stopped(SBYTE);
   6.354 +MIKMODAPI extern SLONG  Voice_GetPosition(SBYTE);
   6.355 +MIKMODAPI extern ULONG  Voice_RealVolume(SBYTE);
   6.356 +
   6.357 +/*
   6.358 + *	========== Internal module representation (UniMod)
   6.359 + */
   6.360 +
   6.361 +/*
   6.362 +	Instrument definition - for information only, the only field which may be
   6.363 +	of use in user programs is the name field
   6.364 +*/
   6.365 +
   6.366 +/* Instrument note count */
   6.367 +#define INSTNOTES 120
   6.368 +
   6.369 +/* Envelope point */
   6.370 +typedef struct ENVPT {
   6.371 +	SWORD pos;
   6.372 +	SWORD val;
   6.373 +} ENVPT;
   6.374 +
   6.375 +/* Envelope point count */
   6.376 +#define ENVPOINTS 32
   6.377 +
   6.378 +/* Instrument structure */
   6.379 +typedef struct INSTRUMENT {
   6.380 +	CHAR* insname;
   6.381 +
   6.382 +	UBYTE flags;
   6.383 +	UWORD samplenumber[INSTNOTES];
   6.384 +	UBYTE samplenote[INSTNOTES];
   6.385 +
   6.386 +	UBYTE nnatype;
   6.387 +	UBYTE dca;              /* duplicate check action */
   6.388 +	UBYTE dct;              /* duplicate check type */
   6.389 +	UBYTE globvol;
   6.390 +	UWORD volfade;
   6.391 +	SWORD panning;          /* instrument-based panning var */
   6.392 +
   6.393 +	UBYTE pitpansep;        /* pitch pan separation (0 to 255) */
   6.394 +	UBYTE pitpancenter;     /* pitch pan center (0 to 119) */
   6.395 +	UBYTE rvolvar;          /* random volume varations (0 - 100%) */
   6.396 +	UBYTE rpanvar;          /* random panning varations (0 - 100%) */
   6.397 +
   6.398 +	/* volume envelope */
   6.399 +	UBYTE volflg;           /* bit 0: on 1: sustain 2: loop */
   6.400 +	UBYTE volpts;
   6.401 +	UBYTE volsusbeg;
   6.402 +	UBYTE volsusend;
   6.403 +	UBYTE volbeg;
   6.404 +	UBYTE volend;
   6.405 +	ENVPT volenv[ENVPOINTS];
   6.406 +	/* panning envelope */
   6.407 +	UBYTE panflg;           /* bit 0: on 1: sustain 2: loop */
   6.408 +	UBYTE panpts;
   6.409 +	UBYTE pansusbeg;
   6.410 +	UBYTE pansusend;
   6.411 +	UBYTE panbeg;
   6.412 +	UBYTE panend;
   6.413 +	ENVPT panenv[ENVPOINTS];
   6.414 +	/* pitch envelope */
   6.415 +	UBYTE pitflg;           /* bit 0: on 1: sustain 2: loop */
   6.416 +	UBYTE pitpts;
   6.417 +	UBYTE pitsusbeg;
   6.418 +	UBYTE pitsusend;
   6.419 +	UBYTE pitbeg;
   6.420 +	UBYTE pitend;
   6.421 +	ENVPT pitenv[ENVPOINTS];
   6.422 +} INSTRUMENT;
   6.423 +
   6.424 +struct MP_CONTROL;
   6.425 +struct MP_VOICE;
   6.426 +
   6.427 +/*
   6.428 +	Module definition
   6.429 +*/
   6.430 +
   6.431 +/* maximum master channels supported */
   6.432 +#define UF_MAXCHAN	64
   6.433 +
   6.434 +/* Module flags */
   6.435 +#define UF_XMPERIODS	0x0001 /* XM periods / finetuning */
   6.436 +#define UF_LINEAR		0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
   6.437 +#define UF_INST			0x0004 /* Instruments are used */
   6.438 +#define UF_NNA			0x0008 /* IT: NNA used, set numvoices rather
   6.439 +								  than numchn */
   6.440 +#define UF_S3MSLIDES	0x0010 /* uses old S3M volume slides */
   6.441 +#define UF_BGSLIDES		0x0020 /* continue volume slides in the background */
   6.442 +#define UF_HIGHBPM		0x0040 /* MED: can use >255 bpm */
   6.443 +#define UF_NOWRAP		0x0080 /* XM-type (i.e. illogical) pattern break
   6.444 +								  semantics */
   6.445 +#define UF_ARPMEM		0x0100 /* IT: need arpeggio memory */
   6.446 +#define UF_FT2QUIRKS	0x0200 /* emulate some FT2 replay quirks */
   6.447 +#define UF_PANNING		0x0400 /* module uses panning effects or have
   6.448 +								  non-tracker default initial panning */
   6.449 +
   6.450 +typedef struct MODULE {
   6.451 +	/* general module information */
   6.452 +		CHAR*       songname;    /* name of the song */
   6.453 +		CHAR*       modtype;     /* string type of module loaded */
   6.454 +		CHAR*       comment;     /* module comments */
   6.455 +
   6.456 +		UWORD       flags;       /* See module flags above */
   6.457 +		UBYTE       numchn;      /* number of module channels */
   6.458 +		UBYTE       numvoices;   /* max # voices used for full NNA playback */
   6.459 +		UWORD       numpos;      /* number of positions in this song */
   6.460 +		UWORD       numpat;      /* number of patterns in this song */
   6.461 +		UWORD       numins;      /* number of instruments */
   6.462 +		UWORD       numsmp;      /* number of samples */
   6.463 +struct  INSTRUMENT* instruments; /* all instruments */
   6.464 +struct  SAMPLE*     samples;     /* all samples */
   6.465 +		UBYTE       realchn;     /* real number of channels used */
   6.466 +		UBYTE       totalchn;    /* total number of channels used (incl NNAs) */
   6.467 +
   6.468 +	/* playback settings */
   6.469 +		UWORD       reppos;      /* restart position */
   6.470 +		UBYTE       initspeed;   /* initial song speed */
   6.471 +		UWORD       inittempo;   /* initial song tempo */
   6.472 +		UBYTE       initvolume;  /* initial global volume (0 - 128) */
   6.473 +		UWORD       panning[UF_MAXCHAN]; /* panning positions */
   6.474 +		UBYTE       chanvol[UF_MAXCHAN]; /* channel positions */
   6.475 +		UWORD       bpm;         /* current beats-per-minute speed */
   6.476 +		UWORD       sngspd;      /* current song speed */
   6.477 +		SWORD       volume;      /* song volume (0-128) (or user volume) */
   6.478 +
   6.479 +		BOOL        extspd;      /* extended speed flag (default enabled) */
   6.480 +		BOOL        panflag;     /* panning flag (default enabled) */
   6.481 +		BOOL        wrap;        /* wrap module ? (default disabled) */
   6.482 +		BOOL        loop;		 /* allow module to loop ? (default enabled) */
   6.483 +		BOOL        fadeout;	 /* volume fade out during last pattern */
   6.484 +
   6.485 +		UWORD       patpos;      /* current row number */
   6.486 +		SWORD       sngpos;      /* current song position */
   6.487 +		ULONG       sngtime;     /* current song time in 2^-10 seconds */
   6.488 +
   6.489 +		SWORD       relspd;      /* relative speed factor */
   6.490 +
   6.491 +	/* internal module representation */
   6.492 +		UWORD       numtrk;      /* number of tracks */
   6.493 +		UBYTE**     tracks;      /* array of numtrk pointers to tracks */
   6.494 +		UWORD*      patterns;    /* array of Patterns */
   6.495 +		UWORD*      pattrows;    /* array of number of rows for each pattern */
   6.496 +		UWORD*      positions;   /* all positions */
   6.497 +
   6.498 +		BOOL        forbid;      /* if true, no player update! */
   6.499 +		UWORD       numrow;      /* number of rows on current pattern */
   6.500 +		UWORD       vbtick;      /* tick counter (counts from 0 to sngspd) */
   6.501 +		UWORD       sngremainder;/* used for song time computation */
   6.502 +
   6.503 +struct MP_CONTROL*  control;     /* Effects Channel info (size pf->numchn) */
   6.504 +struct MP_VOICE*    voice;       /* Audio Voice information (size md_numchn) */
   6.505 +
   6.506 +		UBYTE       globalslide; /* global volume slide rate */
   6.507 +		UBYTE       pat_repcrazy;/* module has just looped to position -1 */
   6.508 +		UWORD       patbrk;      /* position where to start a new pattern */
   6.509 +		UBYTE       patdly;      /* patterndelay counter (command memory) */
   6.510 +		UBYTE       patdly2;     /* patterndelay counter (real one) */
   6.511 +		SWORD       posjmp;      /* flag to indicate a jump is needed... */
   6.512 +		UWORD		bpmlimit;	 /* threshold to detect bpm or speed values */
   6.513 +} MODULE;
   6.514 +
   6.515 +/*
   6.516 + *	========== Module loaders
   6.517 + */
   6.518 +
   6.519 +struct MLOADER;
   6.520 +
   6.521 +MIKMODAPI extern CHAR*   MikMod_InfoLoader(void);
   6.522 +MIKMODAPI extern void    MikMod_RegisterAllLoaders(void);
   6.523 +MIKMODAPI extern void    MikMod_RegisterLoader(struct MLOADER*);
   6.524 +
   6.525 +MIKMODAPI extern struct MLOADER load_669; /* 669 and Extended-669 (by Tran/Renaissance) */
   6.526 +MIKMODAPI extern struct MLOADER load_amf; /* DMP Advanced Module Format (by Otto Chrons) */
   6.527 +MIKMODAPI extern struct MLOADER load_dsm; /* DSIK internal module format */
   6.528 +MIKMODAPI extern struct MLOADER load_far; /* Farandole Composer (by Daniel Potter) */
   6.529 +MIKMODAPI extern struct MLOADER load_gdm; /* General DigiMusic (by Edward Schlunder) */
   6.530 +MIKMODAPI extern struct MLOADER load_it;  /* Impulse Tracker (by Jeffrey Lim) */
   6.531 +MIKMODAPI extern struct MLOADER load_imf; /* Imago Orpheus (by Lutz Roeder) */
   6.532 +MIKMODAPI extern struct MLOADER load_med; /* Amiga MED modules (by Teijo Kinnunen) */
   6.533 +MIKMODAPI extern struct MLOADER load_m15; /* Soundtracker 15-instrument */
   6.534 +MIKMODAPI extern struct MLOADER load_mod; /* Standard 31-instrument Module loader */
   6.535 +MIKMODAPI extern struct MLOADER load_mtm; /* Multi-Tracker Module (by Renaissance) */
   6.536 +MIKMODAPI extern struct MLOADER load_okt; /* Amiga Oktalyzer */
   6.537 +MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
   6.538 +MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
   6.539 +MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
   6.540 +MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
   6.541 +MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
   6.542 +MIKMODAPI extern struct MLOADER load_xm;  /* FastTracker 2 (by Triton) */
   6.543 +
   6.544 +/*
   6.545 + *	========== Module player
   6.546 + */
   6.547 +
   6.548 +MIKMODAPI extern MODULE* Player_Load(CHAR*,int,BOOL);
   6.549 +MIKMODAPI extern MODULE* Player_LoadFP(FILE*,int,BOOL);
   6.550 +MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,BOOL);
   6.551 +MIKMODAPI extern CHAR*   Player_LoadTitle(CHAR*);
   6.552 +MIKMODAPI extern CHAR*   Player_LoadTitleFP(FILE*);
   6.553 +MIKMODAPI extern void    Player_Free(MODULE*);
   6.554 +MIKMODAPI extern void    Player_Start(MODULE*);
   6.555 +MIKMODAPI extern BOOL    Player_Active(void);
   6.556 +MIKMODAPI extern void    Player_Stop(void);
   6.557 +MIKMODAPI extern void    Player_TogglePause(void);
   6.558 +MIKMODAPI extern BOOL    Player_Paused(void);
   6.559 +MIKMODAPI extern void    Player_NextPosition(void);
   6.560 +MIKMODAPI extern void    Player_PrevPosition(void);
   6.561 +MIKMODAPI extern void    Player_SetPosition(UWORD);
   6.562 +MIKMODAPI extern BOOL    Player_Muted(UBYTE);
   6.563 +MIKMODAPI extern void    Player_SetVolume(SWORD);
   6.564 +MIKMODAPI extern MODULE* Player_GetModule(void);
   6.565 +MIKMODAPI extern void    Player_SetSpeed(UWORD);
   6.566 +MIKMODAPI extern void    Player_SetTempo(UWORD);
   6.567 +MIKMODAPI extern void    Player_Unmute(SLONG,...);
   6.568 +MIKMODAPI extern void    Player_Mute(SLONG,...);
   6.569 +MIKMODAPI extern void    Player_ToggleMute(SLONG,...);
   6.570 +MIKMODAPI extern int     Player_GetChannelVoice(UBYTE);
   6.571 +MIKMODAPI extern UWORD   Player_GetChannelPeriod(UBYTE);
   6.572 +
   6.573 +typedef void (MikMod_player)(void);
   6.574 +typedef MikMod_player *MikMod_player_t;
   6.575 +
   6.576 +MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
   6.577 +
   6.578 +#define MUTE_EXCLUSIVE  32000
   6.579 +#define MUTE_INCLUSIVE  32001
   6.580 +
   6.581 +/*
   6.582 + *	========== Drivers
   6.583 + */
   6.584 +
   6.585 +enum {
   6.586 +	MD_MUSIC = 0,
   6.587 +	MD_SNDFX
   6.588 +};
   6.589 +
   6.590 +enum {
   6.591 +	MD_HARDWARE = 0,
   6.592 +	MD_SOFTWARE
   6.593 +};
   6.594 +
   6.595 +/* Mixing flags */
   6.596 +
   6.597 +/* These ones take effect only after MikMod_Init or MikMod_Reset */
   6.598 +#define DMODE_16BITS     0x0001 /* enable 16 bit output */
   6.599 +#define DMODE_STEREO     0x0002 /* enable stereo output */
   6.600 +#define DMODE_SOFT_SNDFX 0x0004 /* Process sound effects via software mixer */
   6.601 +#define DMODE_SOFT_MUSIC 0x0008 /* Process music via software mixer */
   6.602 +#define DMODE_HQMIXER    0x0010 /* Use high-quality (slower) software mixer */
   6.603 +/* These take effect immediately. */
   6.604 +#define DMODE_SURROUND   0x0100 /* enable surround sound */
   6.605 +#define DMODE_INTERP     0x0200 /* enable interpolation */
   6.606 +#define DMODE_REVERSE    0x0400 /* reverse stereo */
   6.607 +
   6.608 +struct SAMPLOAD;
   6.609 +typedef struct MDRIVER {
   6.610 +struct MDRIVER* next;
   6.611 +	CHAR*       Name;
   6.612 +	CHAR*       Version;
   6.613 +
   6.614 +	UBYTE       HardVoiceLimit; /* Limit of hardware mixer voices */
   6.615 +	UBYTE       SoftVoiceLimit; /* Limit of software mixer voices */
   6.616 +
   6.617 +	CHAR*       Alias;
   6.618 +
   6.619 +	void        (*CommandLine)      (CHAR*);
   6.620 +	BOOL        (*IsPresent)        (void);
   6.621 +	SWORD       (*SampleLoad)       (struct SAMPLOAD*,int);
   6.622 +	void        (*SampleUnload)     (SWORD);
   6.623 +	ULONG       (*FreeSampleSpace)  (int);
   6.624 +	ULONG       (*RealSampleLength) (int,struct SAMPLE*);
   6.625 +	BOOL        (*Init)             (void);
   6.626 +	void        (*Exit)             (void);
   6.627 +	BOOL        (*Reset)            (void);
   6.628 +	BOOL        (*SetNumVoices)     (void);
   6.629 +	BOOL        (*PlayStart)        (void);
   6.630 +	void        (*PlayStop)         (void);
   6.631 +	void        (*Update)           (void);
   6.632 +	void		(*Pause)			(void);
   6.633 +	void        (*VoiceSetVolume)   (UBYTE,UWORD);
   6.634 +	UWORD       (*VoiceGetVolume)   (UBYTE);
   6.635 +	void        (*VoiceSetFrequency)(UBYTE,ULONG);
   6.636 +	ULONG       (*VoiceGetFrequency)(UBYTE);
   6.637 +	void        (*VoiceSetPanning)  (UBYTE,ULONG);
   6.638 +	ULONG       (*VoiceGetPanning)  (UBYTE);
   6.639 +	void        (*VoicePlay)        (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
   6.640 +	void        (*VoiceStop)        (UBYTE);
   6.641 +	BOOL        (*VoiceStopped)     (UBYTE);
   6.642 +	SLONG       (*VoiceGetPosition) (UBYTE);
   6.643 +	ULONG       (*VoiceRealVolume)  (UBYTE);
   6.644 +} MDRIVER;
   6.645 +
   6.646 +/* These variables can be changed at ANY time and results will be immediate */
   6.647 +MIKMODAPI extern UBYTE md_volume;      /* global sound volume (0-128) */
   6.648 +MIKMODAPI extern UBYTE md_musicvolume; /* volume of song */
   6.649 +MIKMODAPI extern UBYTE md_sndfxvolume; /* volume of sound effects */
   6.650 +MIKMODAPI extern UBYTE md_reverb;      /* 0 = none;  15 = chaos */
   6.651 +MIKMODAPI extern UBYTE md_pansep;      /* 0 = mono;  128 == 100% (full left/right) */
   6.652 +
   6.653 +/* The variables below can be changed at any time, but changes will not be
   6.654 +   implemented until MikMod_Reset is called. A call to MikMod_Reset may result
   6.655 +   in a skip or pop in audio (depending on the soundcard driver and the settings
   6.656 +   changed). */
   6.657 +MIKMODAPI extern UWORD md_device;      /* device */
   6.658 +MIKMODAPI extern UWORD md_mixfreq;     /* mixing frequency */
   6.659 +MIKMODAPI extern UWORD md_mode;        /* mode. See DMODE_? flags above */
   6.660 +
   6.661 +/* The following variable should not be changed! */
   6.662 +MIKMODAPI extern MDRIVER* md_driver;   /* Current driver in use. */
   6.663 +
   6.664 +/* Known drivers list */
   6.665 +
   6.666 +MIKMODAPI extern struct MDRIVER drv_nos;    /* no sound */
   6.667 +MIKMODAPI extern struct MDRIVER drv_pipe;   /* piped output */
   6.668 +MIKMODAPI extern struct MDRIVER drv_raw;    /* raw file disk writer [music.raw] */
   6.669 +MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
   6.670 +MIKMODAPI extern struct MDRIVER drv_wav;    /* RIFF WAVE file disk writer [music.wav] */
   6.671 +
   6.672 +MIKMODAPI extern struct MDRIVER drv_ultra;  /* Linux Ultrasound driver */
   6.673 +MIKMODAPI extern struct MDRIVER drv_sam9407;	/* Linux sam9407 driver */
   6.674 +
   6.675 +MIKMODAPI extern struct MDRIVER drv_AF;     /* Dec Alpha AudioFile */
   6.676 +MIKMODAPI extern struct MDRIVER drv_aix;    /* AIX audio device */
   6.677 +MIKMODAPI extern struct MDRIVER drv_alsa;   /* Advanced Linux Sound Architecture (ALSA) */
   6.678 +MIKMODAPI extern struct MDRIVER drv_esd;    /* Enlightened sound daemon (EsounD) */
   6.679 +MIKMODAPI extern struct MDRIVER drv_hp;     /* HP-UX audio device */
   6.680 +MIKMODAPI extern struct MDRIVER drv_oss;    /* OpenSound System (Linux,FreeBSD...) */
   6.681 +MIKMODAPI extern struct MDRIVER drv_sgi;    /* SGI audio library */
   6.682 +MIKMODAPI extern struct MDRIVER drv_sun;    /* Sun/NetBSD/OpenBSD audio device */
   6.683 +
   6.684 +MIKMODAPI extern struct MDRIVER drv_dart;   /* OS/2 Direct Audio RealTime */
   6.685 +MIKMODAPI extern struct MDRIVER drv_os2;    /* OS/2 MMPM/2 */
   6.686 +
   6.687 +MIKMODAPI extern struct MDRIVER drv_ds;     /* Win32 DirectSound driver */
   6.688 +MIKMODAPI extern struct MDRIVER drv_win;    /* Win32 multimedia API driver */
   6.689 +
   6.690 +MIKMODAPI extern struct MDRIVER drv_mac;    /* Macintosh Sound Manager driver */
   6.691 +
   6.692 +/*========== Virtual channel mixer interface (for user-supplied drivers only) */
   6.693 +
   6.694 +MIKMODAPI extern BOOL  VC_Init(void);
   6.695 +MIKMODAPI extern void  VC_Exit(void);
   6.696 +MIKMODAPI extern BOOL  VC_SetNumVoices(void);
   6.697 +MIKMODAPI extern ULONG VC_SampleSpace(int);
   6.698 +MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
   6.699 +
   6.700 +MIKMODAPI extern BOOL  VC_PlayStart(void);
   6.701 +MIKMODAPI extern void  VC_PlayStop(void);
   6.702 +
   6.703 +MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);
   6.704 +MIKMODAPI extern void  VC_SampleUnload(SWORD);
   6.705 +
   6.706 +MIKMODAPI extern ULONG VC_WriteBytes(SBYTE*,ULONG);
   6.707 +MIKMODAPI extern ULONG VC_SilenceBytes(SBYTE*,ULONG);
   6.708 +
   6.709 +MIKMODAPI extern void  VC_VoiceSetVolume(UBYTE,UWORD);
   6.710 +MIKMODAPI extern UWORD VC_VoiceGetVolume(UBYTE);
   6.711 +MIKMODAPI extern void  VC_VoiceSetFrequency(UBYTE,ULONG);
   6.712 +MIKMODAPI extern ULONG VC_VoiceGetFrequency(UBYTE);
   6.713 +MIKMODAPI extern void  VC_VoiceSetPanning(UBYTE,ULONG);
   6.714 +MIKMODAPI extern ULONG VC_VoiceGetPanning(UBYTE);
   6.715 +MIKMODAPI extern void  VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
   6.716 +
   6.717 +MIKMODAPI extern void  VC_VoiceStop(UBYTE);
   6.718 +MIKMODAPI extern BOOL  VC_VoiceStopped(UBYTE);
   6.719 +MIKMODAPI extern SLONG VC_VoiceGetPosition(UBYTE);
   6.720 +MIKMODAPI extern ULONG VC_VoiceRealVolume(UBYTE);
   6.721 +
   6.722 +#ifdef __cplusplus
   6.723 +}
   6.724 +#endif
   6.725 +
   6.726 +#endif
   6.727 +
   6.728 +/* ex:set ts=4: */
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/external/libmikmod-3.1.12/include/mikmod_build.h	Sat Jun 01 22:16:14 2013 -0700
     7.3 @@ -0,0 +1,725 @@
     7.4 +/*	MikMod sound library
     7.5 +	(c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS
     7.6 +	for complete list.
     7.7 +
     7.8 +	This library is free software; you can redistribute it and/or modify
     7.9 +	it under the terms of the GNU Library General Public License as
    7.10 +	published by the Free Software Foundation; either version 2 of
    7.11 +	the License, or (at your option) any later version.
    7.12 + 
    7.13 +	This program is distributed in the hope that it will be useful,
    7.14 +	but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 +	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.16 +	GNU Library General Public License for more details.
    7.17 + 
    7.18 +	You should have received a copy of the GNU Library General Public
    7.19 +	License along with this library; if not, write to the Free Software
    7.20 +	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    7.21 +	02111-1307, USA.
    7.22 +*/
    7.23 +
    7.24 +/*==============================================================================
    7.25 +
    7.26 +  $Id: mikmod.h.in,v 1.2 2004/06/01 16:43:45 raph Exp $
    7.27 +
    7.28 +  MikMod sound library include file
    7.29 +
    7.30 +==============================================================================*/
    7.31 +
    7.32 +#ifndef _MIKMOD_H_
    7.33 +#define _MIKMOD_H_
    7.34 +
    7.35 +#include <stdio.h>
    7.36 +#include <stdlib.h>
    7.37 +
    7.38 +#ifdef __cplusplus
    7.39 +extern "C" {
    7.40 +#endif
    7.41 +
    7.42 +/*
    7.43 + * ========== Compiler magic for shared libraries
    7.44 + */
    7.45 +
    7.46 +#if defined WIN32 && defined _DLL
    7.47 +#ifdef DLL_EXPORTS
    7.48 +#define MIKMODAPI __declspec(dllexport)
    7.49 +#else
    7.50 +#define MIKMODAPI __declspec(dllimport)
    7.51 +#endif
    7.52 +#else
    7.53 +#define MIKMODAPI
    7.54 +#endif
    7.55 +
    7.56 +/*
    7.57 + *	========== Library version
    7.58 + */
    7.59 +
    7.60 +#define LIBMIKMOD_VERSION_MAJOR 3L
    7.61 +#define LIBMIKMOD_VERSION_MINOR 1L
    7.62 +#define LIBMIKMOD_REVISION      10L
    7.63 +
    7.64 +#define LIBMIKMOD_VERSION \
    7.65 +	((LIBMIKMOD_VERSION_MAJOR<<16)| \
    7.66 +	 (LIBMIKMOD_VERSION_MINOR<< 8)| \
    7.67 +	 (LIBMIKMOD_REVISION))
    7.68 +
    7.69 +MIKMODAPI extern long MikMod_GetVersion(void);
    7.70 +
    7.71 +/*
    7.72 + *	========== Platform independent-type definitions
    7.73 + */
    7.74 +
    7.75 +#ifdef WIN32
    7.76 +#define WIN32_LEAN_AND_MEAN
    7.77 +#include <windows.h>
    7.78 +#include <io.h>
    7.79 +#include <mmsystem.h>
    7.80 +
    7.81 +/* Avoid conflicts with windef.h */
    7.82 +#define SBYTE   _mm_SBYTE
    7.83 +#define UBYTE   _mm_UBYTE
    7.84 +#define SWORD   _mm_SWORD
    7.85 +#define UWORD   _mm_UWORD
    7.86 +#define SLONG   _mm_SLONG
    7.87 +#define ULONG   _mm_ULONG
    7.88 +#define BOOL    _mm_BOOL
    7.89 +
    7.90 +#endif /* WIN32 */
    7.91 +
    7.92 +#if defined(__OS2__)||defined(__EMX__)
    7.93 +#define INCL_DOSSEMAPHORES
    7.94 +#include <os2.h>
    7.95 +#else
    7.96 +typedef char CHAR;
    7.97 +#endif
    7.98 +
    7.99 +
   7.100 +
   7.101 +#if defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(_LP64)
   7.102 +/* 64 bit architectures */
   7.103 +
   7.104 +typedef signed char     SBYTE;      /* 1 byte, signed */
   7.105 +typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   7.106 +typedef signed short    SWORD;      /* 2 bytes, signed */
   7.107 +typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   7.108 +typedef signed int      SLONG;      /* 4 bytes, signed */
   7.109 +typedef unsigned int    ULONG;      /* 4 bytes, unsigned */
   7.110 +typedef int             BOOL;       /* 0=false, <>0 true */
   7.111 +
   7.112 +#else
   7.113 +/* 32 bit architectures */
   7.114 +
   7.115 +typedef signed char     SBYTE;      /* 1 byte, signed */
   7.116 +typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   7.117 +typedef signed short    SWORD;      /* 2 bytes, signed */
   7.118 +typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   7.119 +typedef signed long     SLONG;      /* 4 bytes, signed */
   7.120 +typedef unsigned long   ULONG;      /* 4 bytes, unsigned */
   7.121 +typedef int             BOOL;       /* 0=false, <>0 true */
   7.122 +#endif
   7.123 +
   7.124 +/*
   7.125 + *	========== Error codes
   7.126 + */
   7.127 +
   7.128 +enum {
   7.129 +	MMERR_OPENING_FILE = 1,
   7.130 +	MMERR_OUT_OF_MEMORY,
   7.131 +	MMERR_DYNAMIC_LINKING,
   7.132 +
   7.133 +	MMERR_SAMPLE_TOO_BIG,
   7.134 +	MMERR_OUT_OF_HANDLES,
   7.135 +	MMERR_UNKNOWN_WAVE_TYPE,
   7.136 +
   7.137 +	MMERR_LOADING_PATTERN,
   7.138 +	MMERR_LOADING_TRACK,
   7.139 +	MMERR_LOADING_HEADER,
   7.140 +	MMERR_LOADING_SAMPLEINFO,
   7.141 +	MMERR_NOT_A_MODULE,
   7.142 +	MMERR_NOT_A_STREAM,
   7.143 +	MMERR_MED_SYNTHSAMPLES,
   7.144 +	MMERR_ITPACK_INVALID_DATA,
   7.145 +
   7.146 +	MMERR_DETECTING_DEVICE,
   7.147 +	MMERR_INVALID_DEVICE,
   7.148 +	MMERR_INITIALIZING_MIXER,
   7.149 +	MMERR_OPENING_AUDIO,
   7.150 +	MMERR_8BIT_ONLY,
   7.151 +	MMERR_16BIT_ONLY,
   7.152 +	MMERR_STEREO_ONLY,
   7.153 +	MMERR_ULAW,
   7.154 +	MMERR_NON_BLOCK,
   7.155 +
   7.156 +	MMERR_AF_AUDIO_PORT,
   7.157 +
   7.158 +	MMERR_AIX_CONFIG_INIT,
   7.159 +	MMERR_AIX_CONFIG_CONTROL,
   7.160 +	MMERR_AIX_CONFIG_START,
   7.161 +
   7.162 +	MMERR_GUS_SETTINGS,
   7.163 +	MMERR_GUS_RESET,
   7.164 +	MMERR_GUS_TIMER,
   7.165 +
   7.166 +	MMERR_HP_SETSAMPLESIZE,
   7.167 +	MMERR_HP_SETSPEED,
   7.168 +	MMERR_HP_CHANNELS,
   7.169 +	MMERR_HP_AUDIO_OUTPUT,
   7.170 +	MMERR_HP_AUDIO_DESC,
   7.171 +	MMERR_HP_BUFFERSIZE,
   7.172 +
   7.173 +	MMERR_OSS_SETFRAGMENT,
   7.174 +	MMERR_OSS_SETSAMPLESIZE,
   7.175 +	MMERR_OSS_SETSTEREO,
   7.176 +	MMERR_OSS_SETSPEED,
   7.177 +
   7.178 +	MMERR_SGI_SPEED,
   7.179 +	MMERR_SGI_16BIT,
   7.180 +	MMERR_SGI_8BIT,
   7.181 +	MMERR_SGI_STEREO,
   7.182 +	MMERR_SGI_MONO,
   7.183 +
   7.184 +	MMERR_SUN_INIT,
   7.185 +
   7.186 +	MMERR_OS2_MIXSETUP,
   7.187 +	MMERR_OS2_SEMAPHORE,
   7.188 +	MMERR_OS2_TIMER,
   7.189 +	MMERR_OS2_THREAD,
   7.190 +
   7.191 +	MMERR_DS_PRIORITY,
   7.192 +	MMERR_DS_BUFFER,
   7.193 +	MMERR_DS_FORMAT,
   7.194 +	MMERR_DS_NOTIFY,
   7.195 +	MMERR_DS_EVENT,
   7.196 +	MMERR_DS_THREAD,
   7.197 +	MMERR_DS_UPDATE,
   7.198 +
   7.199 +	MMERR_WINMM_HANDLE,
   7.200 +	MMERR_WINMM_ALLOCATED,
   7.201 +	MMERR_WINMM_DEVICEID,
   7.202 +	MMERR_WINMM_FORMAT,
   7.203 +	MMERR_WINMM_UNKNOWN,
   7.204 +
   7.205 +	MMERR_MAC_SPEED,
   7.206 +	MMERR_MAC_START,
   7.207 +
   7.208 +	MMERR_MAX
   7.209 +};
   7.210 +
   7.211 +/*
   7.212 + *	========== Error handling
   7.213 + */
   7.214 +
   7.215 +typedef void (MikMod_handler)(void);
   7.216 +typedef MikMod_handler *MikMod_handler_t;
   7.217 +
   7.218 +MIKMODAPI extern int  MikMod_errno;
   7.219 +MIKMODAPI extern BOOL MikMod_critical;
   7.220 +MIKMODAPI extern char *MikMod_strerror(int);
   7.221 +
   7.222 +MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
   7.223 +
   7.224 +/*
   7.225 + *	========== Library initialization and core functions
   7.226 + */
   7.227 +
   7.228 +struct MDRIVER;
   7.229 +
   7.230 +MIKMODAPI extern void   MikMod_RegisterAllDrivers(void);
   7.231 +
   7.232 +MIKMODAPI extern CHAR*  MikMod_InfoDriver(void);
   7.233 +MIKMODAPI extern void   MikMod_RegisterDriver(struct MDRIVER*);
   7.234 +MIKMODAPI extern int    MikMod_DriverFromAlias(CHAR*);
   7.235 +
   7.236 +MIKMODAPI extern BOOL   MikMod_Init(CHAR*);
   7.237 +MIKMODAPI extern void   MikMod_Exit(void);
   7.238 +MIKMODAPI extern BOOL   MikMod_Reset(CHAR*);
   7.239 +MIKMODAPI extern BOOL   MikMod_SetNumVoices(int,int);
   7.240 +MIKMODAPI extern BOOL   MikMod_Active(void);
   7.241 +MIKMODAPI extern BOOL   MikMod_EnableOutput(void);
   7.242 +MIKMODAPI extern void   MikMod_DisableOutput(void);
   7.243 +MIKMODAPI extern void   MikMod_Update(void);
   7.244 +
   7.245 +MIKMODAPI extern BOOL   MikMod_InitThreads(void);
   7.246 +MIKMODAPI extern void   MikMod_Lock(void);
   7.247 +MIKMODAPI extern void   MikMod_Unlock(void);
   7.248 +
   7.249 +/*
   7.250 + *	========== Reader, Writer
   7.251 + */
   7.252 +
   7.253 +typedef struct MREADER {
   7.254 +	BOOL (*Seek)(struct MREADER*,long,int);
   7.255 +	long (*Tell)(struct MREADER*);
   7.256 +	BOOL (*Read)(struct MREADER*,void*,size_t);
   7.257 +	int  (*Get)(struct MREADER*);
   7.258 +	BOOL (*Eof)(struct MREADER*);
   7.259 +} MREADER;
   7.260 +
   7.261 +typedef struct MWRITER {
   7.262 +	BOOL (*Seek)(struct MWRITER*,long,int);
   7.263 +	long (*Tell)(struct MWRITER*);
   7.264 +	BOOL (*Write)(struct MWRITER*,void*,size_t);
   7.265 +	BOOL (*Put)(struct MWRITER*,int);
   7.266 +} MWRITER;
   7.267 +
   7.268 +/*
   7.269 + *	========== Samples
   7.270 + */
   7.271 +
   7.272 +/* Sample playback should not be interrupted */
   7.273 +#define SFX_CRITICAL 1
   7.274 +
   7.275 +/* Sample format [loading and in-memory] flags: */
   7.276 +#define SF_16BITS       0x0001
   7.277 +#define SF_STEREO       0x0002
   7.278 +#define SF_SIGNED       0x0004
   7.279 +#define SF_BIG_ENDIAN   0x0008
   7.280 +#define SF_DELTA        0x0010
   7.281 +#define SF_ITPACKED		0x0020
   7.282 +
   7.283 +#define	SF_FORMATMASK	0x003F
   7.284 +
   7.285 +/* General Playback flags */
   7.286 +
   7.287 +#define SF_LOOP         0x0100
   7.288 +#define SF_BIDI         0x0200
   7.289 +#define SF_REVERSE      0x0400
   7.290 +#define SF_SUSTAIN      0x0800
   7.291 +
   7.292 +#define SF_PLAYBACKMASK	0x0C00
   7.293 +
   7.294 +/* Module-only Playback Flags */
   7.295 +
   7.296 +#define SF_OWNPAN		0x1000
   7.297 +#define SF_UST_LOOP     0x2000
   7.298 +
   7.299 +#define SF_EXTRAPLAYBACKMASK	0x3000
   7.300 +
   7.301 +/* Panning constants */
   7.302 +#define PAN_LEFT		0
   7.303 +#define PAN_HALFLEFT 	64
   7.304 +#define PAN_CENTER		128
   7.305 +#define PAN_HALFRIGHT	192
   7.306 +#define PAN_RIGHT		255
   7.307 +#define PAN_SURROUND	512 /* panning value for Dolby Surround */
   7.308 +
   7.309 +typedef struct SAMPLE {
   7.310 +	SWORD  panning;     /* panning (0-255 or PAN_SURROUND) */
   7.311 +	ULONG  speed;       /* Base playing speed/frequency of note */
   7.312 +	UBYTE  volume;      /* volume 0-64 */
   7.313 +	UWORD  inflags;		/* sample format on disk */
   7.314 +	UWORD  flags;       /* sample format in memory */
   7.315 +	ULONG  length;      /* length of sample (in samples!) */
   7.316 +	ULONG  loopstart;   /* repeat position (relative to start, in samples) */
   7.317 +	ULONG  loopend;     /* repeat end */
   7.318 +	ULONG  susbegin;    /* sustain loop begin (in samples) \  Not Supported */
   7.319 +	ULONG  susend;      /* sustain loop end                /      Yet! */
   7.320 +
   7.321 +	/* Variables used by the module player only! (ignored for sound effects) */
   7.322 +	UBYTE  globvol;     /* global volume */
   7.323 +	UBYTE  vibflags;    /* autovibrato flag stuffs */
   7.324 +	UBYTE  vibtype;     /* Vibratos moved from INSTRUMENT to SAMPLE */
   7.325 +	UBYTE  vibsweep;
   7.326 +	UBYTE  vibdepth;
   7.327 +	UBYTE  vibrate;
   7.328 +	CHAR*  samplename;  /* name of the sample */
   7.329 +
   7.330 +	/* Values used internally only */
   7.331 +	UWORD  avibpos;     /* autovibrato pos [player use] */
   7.332 +	UBYTE  divfactor;   /* for sample scaling, maintains proper period slides */
   7.333 +	ULONG  seekpos;     /* seek position in file */
   7.334 +	SWORD  handle;      /* sample handle used by individual drivers */
   7.335 +} SAMPLE;
   7.336 +
   7.337 +/* Sample functions */
   7.338 +
   7.339 +MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);
   7.340 +MIKMODAPI extern SAMPLE *Sample_LoadFP(FILE*);
   7.341 +MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
   7.342 +MIKMODAPI extern void   Sample_Free(SAMPLE*);
   7.343 +MIKMODAPI extern SBYTE  Sample_Play(SAMPLE*,ULONG,UBYTE);
   7.344 +
   7.345 +MIKMODAPI extern void   Voice_SetVolume(SBYTE,UWORD);
   7.346 +MIKMODAPI extern UWORD  Voice_GetVolume(SBYTE);
   7.347 +MIKMODAPI extern void   Voice_SetFrequency(SBYTE,ULONG);
   7.348 +MIKMODAPI extern ULONG  Voice_GetFrequency(SBYTE);
   7.349 +MIKMODAPI extern void   Voice_SetPanning(SBYTE,ULONG);
   7.350 +MIKMODAPI extern ULONG  Voice_GetPanning(SBYTE);
   7.351 +MIKMODAPI extern void   Voice_Play(SBYTE,SAMPLE*,ULONG);
   7.352 +MIKMODAPI extern void   Voice_Stop(SBYTE);
   7.353 +MIKMODAPI extern BOOL   Voice_Stopped(SBYTE);
   7.354 +MIKMODAPI extern SLONG  Voice_GetPosition(SBYTE);
   7.355 +MIKMODAPI extern ULONG  Voice_RealVolume(SBYTE);
   7.356 +
   7.357 +/*
   7.358 + *	========== Internal module representation (UniMod)
   7.359 + */
   7.360 +
   7.361 +/*
   7.362 +	Instrument definition - for information only, the only field which may be
   7.363 +	of use in user programs is the name field
   7.364 +*/
   7.365 +
   7.366 +/* Instrument note count */
   7.367 +#define INSTNOTES 120
   7.368 +
   7.369 +/* Envelope point */
   7.370 +typedef struct ENVPT {
   7.371 +	SWORD pos;
   7.372 +	SWORD val;
   7.373 +} ENVPT;
   7.374 +
   7.375 +/* Envelope point count */
   7.376 +#define ENVPOINTS 32
   7.377 +
   7.378 +/* Instrument structure */
   7.379 +typedef struct INSTRUMENT {
   7.380 +	CHAR* insname;
   7.381 +
   7.382 +	UBYTE flags;
   7.383 +	UWORD samplenumber[INSTNOTES];
   7.384 +	UBYTE samplenote[INSTNOTES];
   7.385 +
   7.386 +	UBYTE nnatype;
   7.387 +	UBYTE dca;              /* duplicate check action */
   7.388 +	UBYTE dct;              /* duplicate check type */
   7.389 +	UBYTE globvol;
   7.390 +	UWORD volfade;
   7.391 +	SWORD panning;          /* instrument-based panning var */
   7.392 +
   7.393 +	UBYTE pitpansep;        /* pitch pan separation (0 to 255) */
   7.394 +	UBYTE pitpancenter;     /* pitch pan center (0 to 119) */
   7.395 +	UBYTE rvolvar;          /* random volume varations (0 - 100%) */
   7.396 +	UBYTE rpanvar;          /* random panning varations (0 - 100%) */
   7.397 +
   7.398 +	/* volume envelope */
   7.399 +	UBYTE volflg;           /* bit 0: on 1: sustain 2: loop */
   7.400 +	UBYTE volpts;
   7.401 +	UBYTE volsusbeg;
   7.402 +	UBYTE volsusend;
   7.403 +	UBYTE volbeg;
   7.404 +	UBYTE volend;
   7.405 +	ENVPT volenv[ENVPOINTS];
   7.406 +	/* panning envelope */
   7.407 +	UBYTE panflg;           /* bit 0: on 1: sustain 2: loop */
   7.408 +	UBYTE panpts;
   7.409 +	UBYTE pansusbeg;
   7.410 +	UBYTE pansusend;
   7.411 +	UBYTE panbeg;
   7.412 +	UBYTE panend;
   7.413 +	ENVPT panenv[ENVPOINTS];
   7.414 +	/* pitch envelope */
   7.415 +	UBYTE pitflg;           /* bit 0: on 1: sustain 2: loop */
   7.416 +	UBYTE pitpts;
   7.417 +	UBYTE pitsusbeg;
   7.418 +	UBYTE pitsusend;
   7.419 +	UBYTE pitbeg;
   7.420 +	UBYTE pitend;
   7.421 +	ENVPT pitenv[ENVPOINTS];
   7.422 +} INSTRUMENT;
   7.423 +
   7.424 +struct MP_CONTROL;
   7.425 +struct MP_VOICE;
   7.426 +
   7.427 +/*
   7.428 +	Module definition
   7.429 +*/
   7.430 +
   7.431 +/* maximum master channels supported */
   7.432 +#define UF_MAXCHAN	64
   7.433 +
   7.434 +/* Module flags */
   7.435 +#define UF_XMPERIODS	0x0001 /* XM periods / finetuning */
   7.436 +#define UF_LINEAR		0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
   7.437 +#define UF_INST			0x0004 /* Instruments are used */
   7.438 +#define UF_NNA			0x0008 /* IT: NNA used, set numvoices rather
   7.439 +								  than numchn */
   7.440 +#define UF_S3MSLIDES	0x0010 /* uses old S3M volume slides */
   7.441 +#define UF_BGSLIDES		0x0020 /* continue volume slides in the background */
   7.442 +#define UF_HIGHBPM		0x0040 /* MED: can use >255 bpm */
   7.443 +#define UF_NOWRAP		0x0080 /* XM-type (i.e. illogical) pattern break
   7.444 +								  semantics */
   7.445 +#define UF_ARPMEM		0x0100 /* IT: need arpeggio memory */
   7.446 +#define UF_FT2QUIRKS	0x0200 /* emulate some FT2 replay quirks */
   7.447 +#define UF_PANNING		0x0400 /* module uses panning effects or have
   7.448 +								  non-tracker default initial panning */
   7.449 +
   7.450 +typedef struct MODULE {
   7.451 +	/* general module information */
   7.452 +		CHAR*       songname;    /* name of the song */
   7.453 +		CHAR*       modtype;     /* string type of module loaded */
   7.454 +		CHAR*       comment;     /* module comments */
   7.455 +
   7.456 +		UWORD       flags;       /* See module flags above */
   7.457 +		UBYTE       numchn;      /* number of module channels */
   7.458 +		UBYTE       numvoices;   /* max # voices used for full NNA playback */
   7.459 +		UWORD       numpos;      /* number of positions in this song */
   7.460 +		UWORD       numpat;      /* number of patterns in this song */
   7.461 +		UWORD       numins;      /* number of instruments */
   7.462 +		UWORD       numsmp;      /* number of samples */
   7.463 +struct  INSTRUMENT* instruments; /* all instruments */
   7.464 +struct  SAMPLE*     samples;     /* all samples */
   7.465 +		UBYTE       realchn;     /* real number of channels used */
   7.466 +		UBYTE       totalchn;    /* total number of channels used (incl NNAs) */
   7.467 +
   7.468 +	/* playback settings */
   7.469 +		UWORD       reppos;      /* restart position */
   7.470 +		UBYTE       initspeed;   /* initial song speed */
   7.471 +		UWORD       inittempo;   /* initial song tempo */
   7.472 +		UBYTE       initvolume;  /* initial global volume (0 - 128) */
   7.473 +		UWORD       panning[UF_MAXCHAN]; /* panning positions */
   7.474 +		UBYTE       chanvol[UF_MAXCHAN]; /* channel positions */
   7.475 +		UWORD       bpm;         /* current beats-per-minute speed */
   7.476 +		UWORD       sngspd;      /* current song speed */
   7.477 +		SWORD       volume;      /* song volume (0-128) (or user volume) */
   7.478 +
   7.479 +		BOOL        extspd;      /* extended speed flag (default enabled) */
   7.480 +		BOOL        panflag;     /* panning flag (default enabled) */
   7.481 +		BOOL        wrap;        /* wrap module ? (default disabled) */
   7.482 +		BOOL        loop;		 /* allow module to loop ? (default enabled) */
   7.483 +		BOOL        fadeout;	 /* volume fade out during last pattern */
   7.484 +
   7.485 +		UWORD       patpos;      /* current row number */
   7.486 +		SWORD       sngpos;      /* current song position */
   7.487 +		ULONG       sngtime;     /* current song time in 2^-10 seconds */
   7.488 +
   7.489 +		SWORD       relspd;      /* relative speed factor */
   7.490 +
   7.491 +	/* internal module representation */
   7.492 +		UWORD       numtrk;      /* number of tracks */
   7.493 +		UBYTE**     tracks;      /* array of numtrk pointers to tracks */
   7.494 +		UWORD*      patterns;    /* array of Patterns */
   7.495 +		UWORD*      pattrows;    /* array of number of rows for each pattern */
   7.496 +		UWORD*      positions;   /* all positions */
   7.497 +
   7.498 +		BOOL        forbid;      /* if true, no player update! */
   7.499 +		UWORD       numrow;      /* number of rows on current pattern */
   7.500 +		UWORD       vbtick;      /* tick counter (counts from 0 to sngspd) */
   7.501 +		UWORD       sngremainder;/* used for song time computation */
   7.502 +
   7.503 +struct MP_CONTROL*  control;     /* Effects Channel info (size pf->numchn) */
   7.504 +struct MP_VOICE*    voice;       /* Audio Voice information (size md_numchn) */
   7.505 +
   7.506 +		UBYTE       globalslide; /* global volume slide rate */
   7.507 +		UBYTE       pat_repcrazy;/* module has just looped to position -1 */
   7.508 +		UWORD       patbrk;      /* position where to start a new pattern */
   7.509 +		UBYTE       patdly;      /* patterndelay counter (command memory) */
   7.510 +		UBYTE       patdly2;     /* patterndelay counter (real one) */
   7.511 +		SWORD       posjmp;      /* flag to indicate a jump is needed... */
   7.512 +		UWORD		bpmlimit;	 /* threshold to detect bpm or speed values */
   7.513 +} MODULE;
   7.514 +
   7.515 +/*
   7.516 + *	========== Module loaders
   7.517 + */
   7.518 +
   7.519 +struct MLOADER;
   7.520 +
   7.521 +MIKMODAPI extern CHAR*   MikMod_InfoLoader(void);
   7.522 +MIKMODAPI extern void    MikMod_RegisterAllLoaders(void);
   7.523 +MIKMODAPI extern void    MikMod_RegisterLoader(struct MLOADER*);
   7.524 +
   7.525 +MIKMODAPI extern struct MLOADER load_669; /* 669 and Extended-669 (by Tran/Renaissance) */
   7.526 +MIKMODAPI extern struct MLOADER load_amf; /* DMP Advanced Module Format (by Otto Chrons) */
   7.527 +MIKMODAPI extern struct MLOADER load_dsm; /* DSIK internal module format */
   7.528 +MIKMODAPI extern struct MLOADER load_far; /* Farandole Composer (by Daniel Potter) */
   7.529 +MIKMODAPI extern struct MLOADER load_gdm; /* General DigiMusic (by Edward Schlunder) */
   7.530 +MIKMODAPI extern struct MLOADER load_it;  /* Impulse Tracker (by Jeffrey Lim) */
   7.531 +MIKMODAPI extern struct MLOADER load_imf; /* Imago Orpheus (by Lutz Roeder) */
   7.532 +MIKMODAPI extern struct MLOADER load_med; /* Amiga MED modules (by Teijo Kinnunen) */
   7.533 +MIKMODAPI extern struct MLOADER load_m15; /* Soundtracker 15-instrument */
   7.534 +MIKMODAPI extern struct MLOADER load_mod; /* Standard 31-instrument Module loader */
   7.535 +MIKMODAPI extern struct MLOADER load_mtm; /* Multi-Tracker Module (by Renaissance) */
   7.536 +MIKMODAPI extern struct MLOADER load_okt; /* Amiga Oktalyzer */
   7.537 +MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
   7.538 +MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
   7.539 +MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
   7.540 +MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
   7.541 +MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
   7.542 +MIKMODAPI extern struct MLOADER load_xm;  /* FastTracker 2 (by Triton) */
   7.543 +
   7.544 +/*
   7.545 + *	========== Module player
   7.546 + */
   7.547 +
   7.548 +MIKMODAPI extern MODULE* Player_Load(CHAR*,int,BOOL);
   7.549 +MIKMODAPI extern MODULE* Player_LoadFP(FILE*,int,BOOL);
   7.550 +MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,BOOL);
   7.551 +MIKMODAPI extern CHAR*   Player_LoadTitle(CHAR*);
   7.552 +MIKMODAPI extern CHAR*   Player_LoadTitleFP(FILE*);
   7.553 +MIKMODAPI extern void    Player_Free(MODULE*);
   7.554 +MIKMODAPI extern void    Player_Start(MODULE*);
   7.555 +MIKMODAPI extern BOOL    Player_Active(void);
   7.556 +MIKMODAPI extern void    Player_Stop(void);
   7.557 +MIKMODAPI extern void    Player_TogglePause(void);
   7.558 +MIKMODAPI extern BOOL    Player_Paused(void);
   7.559 +MIKMODAPI extern void    Player_NextPosition(void);
   7.560 +MIKMODAPI extern void    Player_PrevPosition(void);
   7.561 +MIKMODAPI extern void    Player_SetPosition(UWORD);
   7.562 +MIKMODAPI extern BOOL    Player_Muted(UBYTE);
   7.563 +MIKMODAPI extern void    Player_SetVolume(SWORD);
   7.564 +MIKMODAPI extern MODULE* Player_GetModule(void);
   7.565 +MIKMODAPI extern void    Player_SetSpeed(UWORD);
   7.566 +MIKMODAPI extern void    Player_SetTempo(UWORD);
   7.567 +MIKMODAPI extern void    Player_Unmute(SLONG,...);
   7.568 +MIKMODAPI extern void    Player_Mute(SLONG,...);
   7.569 +MIKMODAPI extern void    Player_ToggleMute(SLONG,...);
   7.570 +MIKMODAPI extern int     Player_GetChannelVoice(UBYTE);
   7.571 +MIKMODAPI extern UWORD   Player_GetChannelPeriod(UBYTE);
   7.572 +
   7.573 +typedef void (MikMod_player)(void);
   7.574 +typedef MikMod_player *MikMod_player_t;
   7.575 +
   7.576 +MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
   7.577 +
   7.578 +#define MUTE_EXCLUSIVE  32000
   7.579 +#define MUTE_INCLUSIVE  32001
   7.580 +
   7.581 +/*
   7.582 + *	========== Drivers
   7.583 + */
   7.584 +
   7.585 +enum {
   7.586 +	MD_MUSIC = 0,
   7.587 +	MD_SNDFX
   7.588 +};
   7.589 +
   7.590 +enum {
   7.591 +	MD_HARDWARE = 0,
   7.592 +	MD_SOFTWARE
   7.593 +};
   7.594 +
   7.595 +/* Mixing flags */
   7.596 +
   7.597 +/* These ones take effect only after MikMod_Init or MikMod_Reset */
   7.598 +#define DMODE_16BITS     0x0001 /* enable 16 bit output */
   7.599 +#define DMODE_STEREO     0x0002 /* enable stereo output */
   7.600 +#define DMODE_SOFT_SNDFX 0x0004 /* Process sound effects via software mixer */
   7.601 +#define DMODE_SOFT_MUSIC 0x0008 /* Process music via software mixer */
   7.602 +#define DMODE_HQMIXER    0x0010 /* Use high-quality (slower) software mixer */
   7.603 +/* These take effect immediately. */
   7.604 +#define DMODE_SURROUND   0x0100 /* enable surround sound */
   7.605 +#define DMODE_INTERP     0x0200 /* enable interpolation */
   7.606 +#define DMODE_REVERSE    0x0400 /* reverse stereo */
   7.607 +
   7.608 +struct SAMPLOAD;
   7.609 +typedef struct MDRIVER {
   7.610 +struct MDRIVER* next;
   7.611 +	CHAR*       Name;
   7.612 +	CHAR*       Version;
   7.613 +
   7.614 +	UBYTE       HardVoiceLimit; /* Limit of hardware mixer voices */
   7.615 +	UBYTE       SoftVoiceLimit; /* Limit of software mixer voices */
   7.616 +
   7.617 +	CHAR*       Alias;
   7.618 +
   7.619 +	void        (*CommandLine)      (CHAR*);
   7.620 +	BOOL        (*IsPresent)        (void);
   7.621 +	SWORD       (*SampleLoad)       (struct SAMPLOAD*,int);
   7.622 +	void        (*SampleUnload)     (SWORD);
   7.623 +	ULONG       (*FreeSampleSpace)  (int);
   7.624 +	ULONG       (*RealSampleLength) (int,struct SAMPLE*);
   7.625 +	BOOL        (*Init)             (void);
   7.626 +	void        (*Exit)             (void);
   7.627 +	BOOL        (*Reset)            (void);
   7.628 +	BOOL        (*SetNumVoices)     (void);
   7.629 +	BOOL        (*PlayStart)        (void);
   7.630 +	void        (*PlayStop)         (void);
   7.631 +	void        (*Update)           (void);
   7.632 +	void		(*Pause)			(void);
   7.633 +	void        (*VoiceSetVolume)   (UBYTE,UWORD);
   7.634 +	UWORD       (*VoiceGetVolume)   (UBYTE);
   7.635 +	void        (*VoiceSetFrequency)(UBYTE,ULONG);
   7.636 +	ULONG       (*VoiceGetFrequency)(UBYTE);
   7.637 +	void        (*VoiceSetPanning)  (UBYTE,ULONG);
   7.638 +	ULONG       (*VoiceGetPanning)  (UBYTE);
   7.639 +	void        (*VoicePlay)        (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
   7.640 +	void        (*VoiceStop)        (UBYTE);
   7.641 +	BOOL        (*VoiceStopped)     (UBYTE);
   7.642 +	SLONG       (*VoiceGetPosition) (UBYTE);
   7.643 +	ULONG       (*VoiceRealVolume)  (UBYTE);
   7.644 +} MDRIVER;
   7.645 +
   7.646 +/* These variables can be changed at ANY time and results will be immediate */
   7.647 +MIKMODAPI extern UBYTE md_volume;      /* global sound volume (0-128) */
   7.648 +MIKMODAPI extern UBYTE md_musicvolume; /* volume of song */
   7.649 +MIKMODAPI extern UBYTE md_sndfxvolume; /* volume of sound effects */
   7.650 +MIKMODAPI extern UBYTE md_reverb;      /* 0 = none;  15 = chaos */
   7.651 +MIKMODAPI extern UBYTE md_pansep;      /* 0 = mono;  128 == 100% (full left/right) */
   7.652 +
   7.653 +/* The variables below can be changed at any time, but changes will not be
   7.654 +   implemented until MikMod_Reset is called. A call to MikMod_Reset may result
   7.655 +   in a skip or pop in audio (depending on the soundcard driver and the settings
   7.656 +   changed). */
   7.657 +MIKMODAPI extern UWORD md_device;      /* device */
   7.658 +MIKMODAPI extern UWORD md_mixfreq;     /* mixing frequency */
   7.659 +MIKMODAPI extern UWORD md_mode;        /* mode. See DMODE_? flags above */
   7.660 +
   7.661 +/* The following variable should not be changed! */
   7.662 +MIKMODAPI extern MDRIVER* md_driver;   /* Current driver in use. */
   7.663 +
   7.664 +/* Known drivers list */
   7.665 +
   7.666 +MIKMODAPI extern struct MDRIVER drv_nos;    /* no sound */
   7.667 +MIKMODAPI extern struct MDRIVER drv_pipe;   /* piped output */
   7.668 +MIKMODAPI extern struct MDRIVER drv_raw;    /* raw file disk writer [music.raw] */
   7.669 +MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
   7.670 +MIKMODAPI extern struct MDRIVER drv_wav;    /* RIFF WAVE file disk writer [music.wav] */
   7.671 +
   7.672 +MIKMODAPI extern struct MDRIVER drv_ultra;  /* Linux Ultrasound driver */
   7.673 +MIKMODAPI extern struct MDRIVER drv_sam9407;	/* Linux sam9407 driver */
   7.674 +
   7.675 +MIKMODAPI extern struct MDRIVER drv_AF;     /* Dec Alpha AudioFile */
   7.676 +MIKMODAPI extern struct MDRIVER drv_aix;    /* AIX audio device */
   7.677 +MIKMODAPI extern struct MDRIVER drv_alsa;   /* Advanced Linux Sound Architecture (ALSA) */
   7.678 +MIKMODAPI extern struct MDRIVER drv_esd;    /* Enlightened sound daemon (EsounD) */
   7.679 +MIKMODAPI extern struct MDRIVER drv_hp;     /* HP-UX audio device */
   7.680 +MIKMODAPI extern struct MDRIVER drv_oss;    /* OpenSound System (Linux,FreeBSD...) */
   7.681 +MIKMODAPI extern struct MDRIVER drv_sgi;    /* SGI audio library */
   7.682 +MIKMODAPI extern struct MDRIVER drv_sun;    /* Sun/NetBSD/OpenBSD audio device */
   7.683 +
   7.684 +MIKMODAPI extern struct MDRIVER drv_dart;   /* OS/2 Direct Audio RealTime */
   7.685 +MIKMODAPI extern struct MDRIVER drv_os2;    /* OS/2 MMPM/2 */
   7.686 +
   7.687 +MIKMODAPI extern struct MDRIVER drv_ds;     /* Win32 DirectSound driver */
   7.688 +MIKMODAPI extern struct MDRIVER drv_win;    /* Win32 multimedia API driver */
   7.689 +
   7.690 +MIKMODAPI extern struct MDRIVER drv_mac;    /* Macintosh Sound Manager driver */
   7.691 +
   7.692 +/*========== Virtual channel mixer interface (for user-supplied drivers only) */
   7.693 +
   7.694 +MIKMODAPI extern BOOL  VC_Init(void);
   7.695 +MIKMODAPI extern void  VC_Exit(void);
   7.696 +MIKMODAPI extern BOOL  VC_SetNumVoices(void);
   7.697 +MIKMODAPI extern ULONG VC_SampleSpace(int);
   7.698 +MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
   7.699 +
   7.700 +MIKMODAPI extern BOOL  VC_PlayStart(void);
   7.701 +MIKMODAPI extern void  VC_PlayStop(void);
   7.702 +
   7.703 +MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);
   7.704 +MIKMODAPI extern void  VC_SampleUnload(SWORD);
   7.705 +
   7.706 +MIKMODAPI extern ULONG VC_WriteBytes(SBYTE*,ULONG);
   7.707 +MIKMODAPI extern ULONG VC_SilenceBytes(SBYTE*,ULONG);
   7.708 +
   7.709 +MIKMODAPI extern void  VC_VoiceSetVolume(UBYTE,UWORD);
   7.710 +MIKMODAPI extern UWORD VC_VoiceGetVolume(UBYTE);
   7.711 +MIKMODAPI extern void  VC_VoiceSetFrequency(UBYTE,ULONG);
   7.712 +MIKMODAPI extern ULONG VC_VoiceGetFrequency(UBYTE);
   7.713 +MIKMODAPI extern void  VC_VoiceSetPanning(UBYTE,ULONG);
   7.714 +MIKMODAPI extern ULONG VC_VoiceGetPanning(UBYTE);
   7.715 +MIKMODAPI extern void  VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
   7.716 +
   7.717 +MIKMODAPI extern void  VC_VoiceStop(UBYTE);
   7.718 +MIKMODAPI extern BOOL  VC_VoiceStopped(UBYTE);
   7.719 +MIKMODAPI extern SLONG VC_VoiceGetPosition(UBYTE);
   7.720 +MIKMODAPI extern ULONG VC_VoiceRealVolume(UBYTE);
   7.721 +
   7.722 +#ifdef __cplusplus
   7.723 +}
   7.724 +#endif
   7.725 +
   7.726 +#endif
   7.727 +
   7.728 +/* ex:set ts=4: */
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/external/libmikmod-patches/libmikmod-3.1.12-android.diff	Sat Jun 01 22:16:14 2013 -0700
     8.3 @@ -0,0 +1,1545 @@
     8.4 +diff -ruN libmikmod-3.1.12/Android.mk libmikmod-3.1.12.new/Android.mk
     8.5 +--- libmikmod-3.1.12/Android.mk	1969-12-31 16:00:00.000000000 -0800
     8.6 ++++ libmikmod-3.1.12.new/Android.mk	2013-06-01 21:47:27.000000000 -0700
     8.7 +@@ -0,0 +1,66 @@
     8.8 ++LOCAL_PATH := $(call my-dir)
     8.9 ++
    8.10 ++include $(CLEAR_VARS)
    8.11 ++
    8.12 ++LOCAL_MODULE := mikmod
    8.13 ++
    8.14 ++LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    8.15 ++LOCAL_CFLAGS := -D_DLL -DDLL_EXPORTS -DHAVE_UNISTD_H -DHAVE_FCNTL_H
    8.16 ++
    8.17 ++LOCAL_SRC_FILES := \
    8.18 ++    drivers/drv_AF.c \
    8.19 ++    drivers/drv_aix.c \
    8.20 ++    drivers/drv_alsa.c \
    8.21 ++    drivers/drv_esd.c \
    8.22 ++    drivers/drv_hp.c \
    8.23 ++    drivers/drv_nos.c \
    8.24 ++    drivers/drv_oss.c \
    8.25 ++    drivers/drv_pipe.c \
    8.26 ++    drivers/drv_raw.c \
    8.27 ++    drivers/drv_sam9407.c \
    8.28 ++    drivers/drv_sgi.c \
    8.29 ++    drivers/drv_stdout.c \
    8.30 ++    drivers/drv_sun.c \
    8.31 ++    drivers/drv_ultra.c \
    8.32 ++    drivers/drv_wav.c \
    8.33 ++    loaders/load_669.c \
    8.34 ++    loaders/load_amf.c \
    8.35 ++    loaders/load_dsm.c \
    8.36 ++    loaders/load_far.c \
    8.37 ++    loaders/load_gdm.c \
    8.38 ++    loaders/load_imf.c \
    8.39 ++    loaders/load_it.c \
    8.40 ++    loaders/load_m15.c \
    8.41 ++    loaders/load_med.c \
    8.42 ++    loaders/load_mod.c \
    8.43 ++    loaders/load_mtm.c \
    8.44 ++    loaders/load_okt.c \
    8.45 ++    loaders/load_s3m.c \
    8.46 ++    loaders/load_stm.c \
    8.47 ++    loaders/load_stx.c \
    8.48 ++    loaders/load_ult.c \
    8.49 ++    loaders/load_uni.c \
    8.50 ++    loaders/load_xm.c \
    8.51 ++    mmio/mmalloc.c \
    8.52 ++    mmio/mmerror.c \
    8.53 ++    mmio/mmio.c \
    8.54 ++    playercode/mdreg.c \
    8.55 ++    playercode/mdriver.c \
    8.56 ++    playercode/mdulaw.c \
    8.57 ++    playercode/mloader.c \
    8.58 ++    playercode/mlreg.c \
    8.59 ++    playercode/mlutil.c \
    8.60 ++    playercode/mplayer.c \
    8.61 ++    playercode/munitrk.c \
    8.62 ++    playercode/mwav.c \
    8.63 ++    playercode/npertab.c \
    8.64 ++    playercode/sloader.c \
    8.65 ++    playercode/virtch.c \
    8.66 ++    playercode/virtch2.c \
    8.67 ++    playercode/virtch_common.c
    8.68 ++
    8.69 ++LOCAL_LDLIBS :=
    8.70 ++LOCAL_STATIC_LIBRARIES :=
    8.71 ++LOCAL_SHARED_LIBRARIES :=
    8.72 ++
    8.73 ++include $(BUILD_SHARED_LIBRARY)
    8.74 +diff -ruN libmikmod-3.1.12/drivers/drv_raw.c libmikmod-3.1.12.new/drivers/drv_raw.c
    8.75 +--- libmikmod-3.1.12/drivers/drv_raw.c	2013-06-01 21:51:46.000000000 -0700
    8.76 ++++ libmikmod-3.1.12.new/drivers/drv_raw.c	2013-06-01 21:49:31.000000000 -0700
    8.77 +@@ -50,6 +50,13 @@
    8.78 + #ifndef O_BINARY
    8.79 + #define O_BINARY 0
    8.80 + #endif
    8.81 ++#ifndef S_IREAD
    8.82 ++#define S_IREAD S_IRUSR
    8.83 ++#endif
    8.84 ++#ifndef S_IWRITE
    8.85 ++#define S_IWRITE S_IWUSR
    8.86 ++#endif
    8.87 ++
    8.88 + 
    8.89 + #if defined(WIN32) && !defined(__MWERKS__)
    8.90 + #define open _open
    8.91 +diff -ruN libmikmod-3.1.12/include/mikmod.h libmikmod-3.1.12.new/include/mikmod.h
    8.92 +--- libmikmod-3.1.12/include/mikmod.h	1969-12-31 16:00:00.000000000 -0800
    8.93 ++++ libmikmod-3.1.12.new/include/mikmod.h	2013-06-01 20:43:04.000000000 -0700
    8.94 +@@ -0,0 +1,725 @@
    8.95 ++/*	MikMod sound library
    8.96 ++	(c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS
    8.97 ++	for complete list.
    8.98 ++
    8.99 ++	This library is free software; you can redistribute it and/or modify
   8.100 ++	it under the terms of the GNU Library General Public License as
   8.101 ++	published by the Free Software Foundation; either version 2 of
   8.102 ++	the License, or (at your option) any later version.
   8.103 ++ 
   8.104 ++	This program is distributed in the hope that it will be useful,
   8.105 ++	but WITHOUT ANY WARRANTY; without even the implied warranty of
   8.106 ++	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   8.107 ++	GNU Library General Public License for more details.
   8.108 ++ 
   8.109 ++	You should have received a copy of the GNU Library General Public
   8.110 ++	License along with this library; if not, write to the Free Software
   8.111 ++	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   8.112 ++	02111-1307, USA.
   8.113 ++*/
   8.114 ++
   8.115 ++/*==============================================================================
   8.116 ++
   8.117 ++  $Id: mikmod.h.in,v 1.2 2004/06/01 16:43:45 raph Exp $
   8.118 ++
   8.119 ++  MikMod sound library include file
   8.120 ++
   8.121 ++==============================================================================*/
   8.122 ++
   8.123 ++#ifndef _MIKMOD_H_
   8.124 ++#define _MIKMOD_H_
   8.125 ++
   8.126 ++#include <stdio.h>
   8.127 ++#include <stdlib.h>
   8.128 ++
   8.129 ++#ifdef __cplusplus
   8.130 ++extern "C" {
   8.131 ++#endif
   8.132 ++
   8.133 ++/*
   8.134 ++ * ========== Compiler magic for shared libraries
   8.135 ++ */
   8.136 ++
   8.137 ++#if defined WIN32 && defined _DLL
   8.138 ++#ifdef DLL_EXPORTS
   8.139 ++#define MIKMODAPI __declspec(dllexport)
   8.140 ++#else
   8.141 ++#define MIKMODAPI __declspec(dllimport)
   8.142 ++#endif
   8.143 ++#else
   8.144 ++#define MIKMODAPI
   8.145 ++#endif
   8.146 ++
   8.147 ++/*
   8.148 ++ *	========== Library version
   8.149 ++ */
   8.150 ++
   8.151 ++#define LIBMIKMOD_VERSION_MAJOR 3L
   8.152 ++#define LIBMIKMOD_VERSION_MINOR 1L
   8.153 ++#define LIBMIKMOD_REVISION      10L
   8.154 ++
   8.155 ++#define LIBMIKMOD_VERSION \
   8.156 ++	((LIBMIKMOD_VERSION_MAJOR<<16)| \
   8.157 ++	 (LIBMIKMOD_VERSION_MINOR<< 8)| \
   8.158 ++	 (LIBMIKMOD_REVISION))
   8.159 ++
   8.160 ++MIKMODAPI extern long MikMod_GetVersion(void);
   8.161 ++
   8.162 ++/*
   8.163 ++ *	========== Platform independent-type definitions
   8.164 ++ */
   8.165 ++
   8.166 ++#ifdef WIN32
   8.167 ++#define WIN32_LEAN_AND_MEAN
   8.168 ++#include <windows.h>
   8.169 ++#include <io.h>
   8.170 ++#include <mmsystem.h>
   8.171 ++
   8.172 ++/* Avoid conflicts with windef.h */
   8.173 ++#define SBYTE   _mm_SBYTE
   8.174 ++#define UBYTE   _mm_UBYTE
   8.175 ++#define SWORD   _mm_SWORD
   8.176 ++#define UWORD   _mm_UWORD
   8.177 ++#define SLONG   _mm_SLONG
   8.178 ++#define ULONG   _mm_ULONG
   8.179 ++#define BOOL    _mm_BOOL
   8.180 ++
   8.181 ++#endif /* WIN32 */
   8.182 ++
   8.183 ++#if defined(__OS2__)||defined(__EMX__)
   8.184 ++#define INCL_DOSSEMAPHORES
   8.185 ++#include <os2.h>
   8.186 ++#else
   8.187 ++typedef char CHAR;
   8.188 ++#endif
   8.189 ++
   8.190 ++
   8.191 ++
   8.192 ++#if defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(_LP64)
   8.193 ++/* 64 bit architectures */
   8.194 ++
   8.195 ++typedef signed char     SBYTE;      /* 1 byte, signed */
   8.196 ++typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   8.197 ++typedef signed short    SWORD;      /* 2 bytes, signed */
   8.198 ++typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   8.199 ++typedef signed int      SLONG;      /* 4 bytes, signed */
   8.200 ++typedef unsigned int    ULONG;      /* 4 bytes, unsigned */
   8.201 ++typedef int             BOOL;       /* 0=false, <>0 true */
   8.202 ++
   8.203 ++#else
   8.204 ++/* 32 bit architectures */
   8.205 ++
   8.206 ++typedef signed char     SBYTE;      /* 1 byte, signed */
   8.207 ++typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   8.208 ++typedef signed short    SWORD;      /* 2 bytes, signed */
   8.209 ++typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   8.210 ++typedef signed long     SLONG;      /* 4 bytes, signed */
   8.211 ++typedef unsigned long   ULONG;      /* 4 bytes, unsigned */
   8.212 ++typedef int             BOOL;       /* 0=false, <>0 true */
   8.213 ++#endif
   8.214 ++
   8.215 ++/*
   8.216 ++ *	========== Error codes
   8.217 ++ */
   8.218 ++
   8.219 ++enum {
   8.220 ++	MMERR_OPENING_FILE = 1,
   8.221 ++	MMERR_OUT_OF_MEMORY,
   8.222 ++	MMERR_DYNAMIC_LINKING,
   8.223 ++
   8.224 ++	MMERR_SAMPLE_TOO_BIG,
   8.225 ++	MMERR_OUT_OF_HANDLES,
   8.226 ++	MMERR_UNKNOWN_WAVE_TYPE,
   8.227 ++
   8.228 ++	MMERR_LOADING_PATTERN,
   8.229 ++	MMERR_LOADING_TRACK,
   8.230 ++	MMERR_LOADING_HEADER,
   8.231 ++	MMERR_LOADING_SAMPLEINFO,
   8.232 ++	MMERR_NOT_A_MODULE,
   8.233 ++	MMERR_NOT_A_STREAM,
   8.234 ++	MMERR_MED_SYNTHSAMPLES,
   8.235 ++	MMERR_ITPACK_INVALID_DATA,
   8.236 ++
   8.237 ++	MMERR_DETECTING_DEVICE,
   8.238 ++	MMERR_INVALID_DEVICE,
   8.239 ++	MMERR_INITIALIZING_MIXER,
   8.240 ++	MMERR_OPENING_AUDIO,
   8.241 ++	MMERR_8BIT_ONLY,
   8.242 ++	MMERR_16BIT_ONLY,
   8.243 ++	MMERR_STEREO_ONLY,
   8.244 ++	MMERR_ULAW,
   8.245 ++	MMERR_NON_BLOCK,
   8.246 ++
   8.247 ++	MMERR_AF_AUDIO_PORT,
   8.248 ++
   8.249 ++	MMERR_AIX_CONFIG_INIT,
   8.250 ++	MMERR_AIX_CONFIG_CONTROL,
   8.251 ++	MMERR_AIX_CONFIG_START,
   8.252 ++
   8.253 ++	MMERR_GUS_SETTINGS,
   8.254 ++	MMERR_GUS_RESET,
   8.255 ++	MMERR_GUS_TIMER,
   8.256 ++
   8.257 ++	MMERR_HP_SETSAMPLESIZE,
   8.258 ++	MMERR_HP_SETSPEED,
   8.259 ++	MMERR_HP_CHANNELS,
   8.260 ++	MMERR_HP_AUDIO_OUTPUT,
   8.261 ++	MMERR_HP_AUDIO_DESC,
   8.262 ++	MMERR_HP_BUFFERSIZE,
   8.263 ++
   8.264 ++	MMERR_OSS_SETFRAGMENT,
   8.265 ++	MMERR_OSS_SETSAMPLESIZE,
   8.266 ++	MMERR_OSS_SETSTEREO,
   8.267 ++	MMERR_OSS_SETSPEED,
   8.268 ++
   8.269 ++	MMERR_SGI_SPEED,
   8.270 ++	MMERR_SGI_16BIT,
   8.271 ++	MMERR_SGI_8BIT,
   8.272 ++	MMERR_SGI_STEREO,
   8.273 ++	MMERR_SGI_MONO,
   8.274 ++
   8.275 ++	MMERR_SUN_INIT,
   8.276 ++
   8.277 ++	MMERR_OS2_MIXSETUP,
   8.278 ++	MMERR_OS2_SEMAPHORE,
   8.279 ++	MMERR_OS2_TIMER,
   8.280 ++	MMERR_OS2_THREAD,
   8.281 ++
   8.282 ++	MMERR_DS_PRIORITY,
   8.283 ++	MMERR_DS_BUFFER,
   8.284 ++	MMERR_DS_FORMAT,
   8.285 ++	MMERR_DS_NOTIFY,
   8.286 ++	MMERR_DS_EVENT,
   8.287 ++	MMERR_DS_THREAD,
   8.288 ++	MMERR_DS_UPDATE,
   8.289 ++
   8.290 ++	MMERR_WINMM_HANDLE,
   8.291 ++	MMERR_WINMM_ALLOCATED,
   8.292 ++	MMERR_WINMM_DEVICEID,
   8.293 ++	MMERR_WINMM_FORMAT,
   8.294 ++	MMERR_WINMM_UNKNOWN,
   8.295 ++
   8.296 ++	MMERR_MAC_SPEED,
   8.297 ++	MMERR_MAC_START,
   8.298 ++
   8.299 ++	MMERR_MAX
   8.300 ++};
   8.301 ++
   8.302 ++/*
   8.303 ++ *	========== Error handling
   8.304 ++ */
   8.305 ++
   8.306 ++typedef void (MikMod_handler)(void);
   8.307 ++typedef MikMod_handler *MikMod_handler_t;
   8.308 ++
   8.309 ++MIKMODAPI extern int  MikMod_errno;
   8.310 ++MIKMODAPI extern BOOL MikMod_critical;
   8.311 ++MIKMODAPI extern char *MikMod_strerror(int);
   8.312 ++
   8.313 ++MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
   8.314 ++
   8.315 ++/*
   8.316 ++ *	========== Library initialization and core functions
   8.317 ++ */
   8.318 ++
   8.319 ++struct MDRIVER;
   8.320 ++
   8.321 ++MIKMODAPI extern void   MikMod_RegisterAllDrivers(void);
   8.322 ++
   8.323 ++MIKMODAPI extern CHAR*  MikMod_InfoDriver(void);
   8.324 ++MIKMODAPI extern void   MikMod_RegisterDriver(struct MDRIVER*);
   8.325 ++MIKMODAPI extern int    MikMod_DriverFromAlias(CHAR*);
   8.326 ++
   8.327 ++MIKMODAPI extern BOOL   MikMod_Init(CHAR*);
   8.328 ++MIKMODAPI extern void   MikMod_Exit(void);
   8.329 ++MIKMODAPI extern BOOL   MikMod_Reset(CHAR*);
   8.330 ++MIKMODAPI extern BOOL   MikMod_SetNumVoices(int,int);
   8.331 ++MIKMODAPI extern BOOL   MikMod_Active(void);
   8.332 ++MIKMODAPI extern BOOL   MikMod_EnableOutput(void);
   8.333 ++MIKMODAPI extern void   MikMod_DisableOutput(void);
   8.334 ++MIKMODAPI extern void   MikMod_Update(void);
   8.335 ++
   8.336 ++MIKMODAPI extern BOOL   MikMod_InitThreads(void);
   8.337 ++MIKMODAPI extern void   MikMod_Lock(void);
   8.338 ++MIKMODAPI extern void   MikMod_Unlock(void);
   8.339 ++
   8.340 ++/*
   8.341 ++ *	========== Reader, Writer
   8.342 ++ */
   8.343 ++
   8.344 ++typedef struct MREADER {
   8.345 ++	BOOL (*Seek)(struct MREADER*,long,int);
   8.346 ++	long (*Tell)(struct MREADER*);
   8.347 ++	BOOL (*Read)(struct MREADER*,void*,size_t);
   8.348 ++	int  (*Get)(struct MREADER*);
   8.349 ++	BOOL (*Eof)(struct MREADER*);
   8.350 ++} MREADER;
   8.351 ++
   8.352 ++typedef struct MWRITER {
   8.353 ++	BOOL (*Seek)(struct MWRITER*,long,int);
   8.354 ++	long (*Tell)(struct MWRITER*);
   8.355 ++	BOOL (*Write)(struct MWRITER*,void*,size_t);
   8.356 ++	BOOL (*Put)(struct MWRITER*,int);
   8.357 ++} MWRITER;
   8.358 ++
   8.359 ++/*
   8.360 ++ *	========== Samples
   8.361 ++ */
   8.362 ++
   8.363 ++/* Sample playback should not be interrupted */
   8.364 ++#define SFX_CRITICAL 1
   8.365 ++
   8.366 ++/* Sample format [loading and in-memory] flags: */
   8.367 ++#define SF_16BITS       0x0001
   8.368 ++#define SF_STEREO       0x0002
   8.369 ++#define SF_SIGNED       0x0004
   8.370 ++#define SF_BIG_ENDIAN   0x0008
   8.371 ++#define SF_DELTA        0x0010
   8.372 ++#define SF_ITPACKED		0x0020
   8.373 ++
   8.374 ++#define	SF_FORMATMASK	0x003F
   8.375 ++
   8.376 ++/* General Playback flags */
   8.377 ++
   8.378 ++#define SF_LOOP         0x0100
   8.379 ++#define SF_BIDI         0x0200
   8.380 ++#define SF_REVERSE      0x0400
   8.381 ++#define SF_SUSTAIN      0x0800
   8.382 ++
   8.383 ++#define SF_PLAYBACKMASK	0x0C00
   8.384 ++
   8.385 ++/* Module-only Playback Flags */
   8.386 ++
   8.387 ++#define SF_OWNPAN		0x1000
   8.388 ++#define SF_UST_LOOP     0x2000
   8.389 ++
   8.390 ++#define SF_EXTRAPLAYBACKMASK	0x3000
   8.391 ++
   8.392 ++/* Panning constants */
   8.393 ++#define PAN_LEFT		0
   8.394 ++#define PAN_HALFLEFT 	64
   8.395 ++#define PAN_CENTER		128
   8.396 ++#define PAN_HALFRIGHT	192
   8.397 ++#define PAN_RIGHT		255
   8.398 ++#define PAN_SURROUND	512 /* panning value for Dolby Surround */
   8.399 ++
   8.400 ++typedef struct SAMPLE {
   8.401 ++	SWORD  panning;     /* panning (0-255 or PAN_SURROUND) */
   8.402 ++	ULONG  speed;       /* Base playing speed/frequency of note */
   8.403 ++	UBYTE  volume;      /* volume 0-64 */
   8.404 ++	UWORD  inflags;		/* sample format on disk */
   8.405 ++	UWORD  flags;       /* sample format in memory */
   8.406 ++	ULONG  length;      /* length of sample (in samples!) */
   8.407 ++	ULONG  loopstart;   /* repeat position (relative to start, in samples) */
   8.408 ++	ULONG  loopend;     /* repeat end */
   8.409 ++	ULONG  susbegin;    /* sustain loop begin (in samples) \  Not Supported */
   8.410 ++	ULONG  susend;      /* sustain loop end                /      Yet! */
   8.411 ++
   8.412 ++	/* Variables used by the module player only! (ignored for sound effects) */
   8.413 ++	UBYTE  globvol;     /* global volume */
   8.414 ++	UBYTE  vibflags;    /* autovibrato flag stuffs */
   8.415 ++	UBYTE  vibtype;     /* Vibratos moved from INSTRUMENT to SAMPLE */
   8.416 ++	UBYTE  vibsweep;
   8.417 ++	UBYTE  vibdepth;
   8.418 ++	UBYTE  vibrate;
   8.419 ++	CHAR*  samplename;  /* name of the sample */
   8.420 ++
   8.421 ++	/* Values used internally only */
   8.422 ++	UWORD  avibpos;     /* autovibrato pos [player use] */
   8.423 ++	UBYTE  divfactor;   /* for sample scaling, maintains proper period slides */
   8.424 ++	ULONG  seekpos;     /* seek position in file */
   8.425 ++	SWORD  handle;      /* sample handle used by individual drivers */
   8.426 ++} SAMPLE;
   8.427 ++
   8.428 ++/* Sample functions */
   8.429 ++
   8.430 ++MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);
   8.431 ++MIKMODAPI extern SAMPLE *Sample_LoadFP(FILE*);
   8.432 ++MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
   8.433 ++MIKMODAPI extern void   Sample_Free(SAMPLE*);
   8.434 ++MIKMODAPI extern SBYTE  Sample_Play(SAMPLE*,ULONG,UBYTE);
   8.435 ++
   8.436 ++MIKMODAPI extern void   Voice_SetVolume(SBYTE,UWORD);
   8.437 ++MIKMODAPI extern UWORD  Voice_GetVolume(SBYTE);
   8.438 ++MIKMODAPI extern void   Voice_SetFrequency(SBYTE,ULONG);
   8.439 ++MIKMODAPI extern ULONG  Voice_GetFrequency(SBYTE);
   8.440 ++MIKMODAPI extern void   Voice_SetPanning(SBYTE,ULONG);
   8.441 ++MIKMODAPI extern ULONG  Voice_GetPanning(SBYTE);
   8.442 ++MIKMODAPI extern void   Voice_Play(SBYTE,SAMPLE*,ULONG);
   8.443 ++MIKMODAPI extern void   Voice_Stop(SBYTE);
   8.444 ++MIKMODAPI extern BOOL   Voice_Stopped(SBYTE);
   8.445 ++MIKMODAPI extern SLONG  Voice_GetPosition(SBYTE);
   8.446 ++MIKMODAPI extern ULONG  Voice_RealVolume(SBYTE);
   8.447 ++
   8.448 ++/*
   8.449 ++ *	========== Internal module representation (UniMod)
   8.450 ++ */
   8.451 ++
   8.452 ++/*
   8.453 ++	Instrument definition - for information only, the only field which may be
   8.454 ++	of use in user programs is the name field
   8.455 ++*/
   8.456 ++
   8.457 ++/* Instrument note count */
   8.458 ++#define INSTNOTES 120
   8.459 ++
   8.460 ++/* Envelope point */
   8.461 ++typedef struct ENVPT {
   8.462 ++	SWORD pos;
   8.463 ++	SWORD val;
   8.464 ++} ENVPT;
   8.465 ++
   8.466 ++/* Envelope point count */
   8.467 ++#define ENVPOINTS 32
   8.468 ++
   8.469 ++/* Instrument structure */
   8.470 ++typedef struct INSTRUMENT {
   8.471 ++	CHAR* insname;
   8.472 ++
   8.473 ++	UBYTE flags;
   8.474 ++	UWORD samplenumber[INSTNOTES];
   8.475 ++	UBYTE samplenote[INSTNOTES];
   8.476 ++
   8.477 ++	UBYTE nnatype;
   8.478 ++	UBYTE dca;              /* duplicate check action */
   8.479 ++	UBYTE dct;              /* duplicate check type */
   8.480 ++	UBYTE globvol;
   8.481 ++	UWORD volfade;
   8.482 ++	SWORD panning;          /* instrument-based panning var */
   8.483 ++
   8.484 ++	UBYTE pitpansep;        /* pitch pan separation (0 to 255) */
   8.485 ++	UBYTE pitpancenter;     /* pitch pan center (0 to 119) */
   8.486 ++	UBYTE rvolvar;          /* random volume varations (0 - 100%) */
   8.487 ++	UBYTE rpanvar;          /* random panning varations (0 - 100%) */
   8.488 ++
   8.489 ++	/* volume envelope */
   8.490 ++	UBYTE volflg;           /* bit 0: on 1: sustain 2: loop */
   8.491 ++	UBYTE volpts;
   8.492 ++	UBYTE volsusbeg;
   8.493 ++	UBYTE volsusend;
   8.494 ++	UBYTE volbeg;
   8.495 ++	UBYTE volend;
   8.496 ++	ENVPT volenv[ENVPOINTS];
   8.497 ++	/* panning envelope */
   8.498 ++	UBYTE panflg;           /* bit 0: on 1: sustain 2: loop */
   8.499 ++	UBYTE panpts;
   8.500 ++	UBYTE pansusbeg;
   8.501 ++	UBYTE pansusend;
   8.502 ++	UBYTE panbeg;
   8.503 ++	UBYTE panend;
   8.504 ++	ENVPT panenv[ENVPOINTS];
   8.505 ++	/* pitch envelope */
   8.506 ++	UBYTE pitflg;           /* bit 0: on 1: sustain 2: loop */
   8.507 ++	UBYTE pitpts;
   8.508 ++	UBYTE pitsusbeg;
   8.509 ++	UBYTE pitsusend;
   8.510 ++	UBYTE pitbeg;
   8.511 ++	UBYTE pitend;
   8.512 ++	ENVPT pitenv[ENVPOINTS];
   8.513 ++} INSTRUMENT;
   8.514 ++
   8.515 ++struct MP_CONTROL;
   8.516 ++struct MP_VOICE;
   8.517 ++
   8.518 ++/*
   8.519 ++	Module definition
   8.520 ++*/
   8.521 ++
   8.522 ++/* maximum master channels supported */
   8.523 ++#define UF_MAXCHAN	64
   8.524 ++
   8.525 ++/* Module flags */
   8.526 ++#define UF_XMPERIODS	0x0001 /* XM periods / finetuning */
   8.527 ++#define UF_LINEAR		0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
   8.528 ++#define UF_INST			0x0004 /* Instruments are used */
   8.529 ++#define UF_NNA			0x0008 /* IT: NNA used, set numvoices rather
   8.530 ++								  than numchn */
   8.531 ++#define UF_S3MSLIDES	0x0010 /* uses old S3M volume slides */
   8.532 ++#define UF_BGSLIDES		0x0020 /* continue volume slides in the background */
   8.533 ++#define UF_HIGHBPM		0x0040 /* MED: can use >255 bpm */
   8.534 ++#define UF_NOWRAP		0x0080 /* XM-type (i.e. illogical) pattern break
   8.535 ++								  semantics */
   8.536 ++#define UF_ARPMEM		0x0100 /* IT: need arpeggio memory */
   8.537 ++#define UF_FT2QUIRKS	0x0200 /* emulate some FT2 replay quirks */
   8.538 ++#define UF_PANNING		0x0400 /* module uses panning effects or have
   8.539 ++								  non-tracker default initial panning */
   8.540 ++
   8.541 ++typedef struct MODULE {
   8.542 ++	/* general module information */
   8.543 ++		CHAR*       songname;    /* name of the song */
   8.544 ++		CHAR*       modtype;     /* string type of module loaded */
   8.545 ++		CHAR*       comment;     /* module comments */
   8.546 ++
   8.547 ++		UWORD       flags;       /* See module flags above */
   8.548 ++		UBYTE       numchn;      /* number of module channels */
   8.549 ++		UBYTE       numvoices;   /* max # voices used for full NNA playback */
   8.550 ++		UWORD       numpos;      /* number of positions in this song */
   8.551 ++		UWORD       numpat;      /* number of patterns in this song */
   8.552 ++		UWORD       numins;      /* number of instruments */
   8.553 ++		UWORD       numsmp;      /* number of samples */
   8.554 ++struct  INSTRUMENT* instruments; /* all instruments */
   8.555 ++struct  SAMPLE*     samples;     /* all samples */
   8.556 ++		UBYTE       realchn;     /* real number of channels used */
   8.557 ++		UBYTE       totalchn;    /* total number of channels used (incl NNAs) */
   8.558 ++
   8.559 ++	/* playback settings */
   8.560 ++		UWORD       reppos;      /* restart position */
   8.561 ++		UBYTE       initspeed;   /* initial song speed */
   8.562 ++		UWORD       inittempo;   /* initial song tempo */
   8.563 ++		UBYTE       initvolume;  /* initial global volume (0 - 128) */
   8.564 ++		UWORD       panning[UF_MAXCHAN]; /* panning positions */
   8.565 ++		UBYTE       chanvol[UF_MAXCHAN]; /* channel positions */
   8.566 ++		UWORD       bpm;         /* current beats-per-minute speed */
   8.567 ++		UWORD       sngspd;      /* current song speed */
   8.568 ++		SWORD       volume;      /* song volume (0-128) (or user volume) */
   8.569 ++
   8.570 ++		BOOL        extspd;      /* extended speed flag (default enabled) */
   8.571 ++		BOOL        panflag;     /* panning flag (default enabled) */
   8.572 ++		BOOL        wrap;        /* wrap module ? (default disabled) */
   8.573 ++		BOOL        loop;		 /* allow module to loop ? (default enabled) */
   8.574 ++		BOOL        fadeout;	 /* volume fade out during last pattern */
   8.575 ++
   8.576 ++		UWORD       patpos;      /* current row number */
   8.577 ++		SWORD       sngpos;      /* current song position */
   8.578 ++		ULONG       sngtime;     /* current song time in 2^-10 seconds */
   8.579 ++
   8.580 ++		SWORD       relspd;      /* relative speed factor */
   8.581 ++
   8.582 ++	/* internal module representation */
   8.583 ++		UWORD       numtrk;      /* number of tracks */
   8.584 ++		UBYTE**     tracks;      /* array of numtrk pointers to tracks */
   8.585 ++		UWORD*      patterns;    /* array of Patterns */
   8.586 ++		UWORD*      pattrows;    /* array of number of rows for each pattern */
   8.587 ++		UWORD*      positions;   /* all positions */
   8.588 ++
   8.589 ++		BOOL        forbid;      /* if true, no player update! */
   8.590 ++		UWORD       numrow;      /* number of rows on current pattern */
   8.591 ++		UWORD       vbtick;      /* tick counter (counts from 0 to sngspd) */
   8.592 ++		UWORD       sngremainder;/* used for song time computation */
   8.593 ++
   8.594 ++struct MP_CONTROL*  control;     /* Effects Channel info (size pf->numchn) */
   8.595 ++struct MP_VOICE*    voice;       /* Audio Voice information (size md_numchn) */
   8.596 ++
   8.597 ++		UBYTE       globalslide; /* global volume slide rate */
   8.598 ++		UBYTE       pat_repcrazy;/* module has just looped to position -1 */
   8.599 ++		UWORD       patbrk;      /* position where to start a new pattern */
   8.600 ++		UBYTE       patdly;      /* patterndelay counter (command memory) */
   8.601 ++		UBYTE       patdly2;     /* patterndelay counter (real one) */
   8.602 ++		SWORD       posjmp;      /* flag to indicate a jump is needed... */
   8.603 ++		UWORD		bpmlimit;	 /* threshold to detect bpm or speed values */
   8.604 ++} MODULE;
   8.605 ++
   8.606 ++/*
   8.607 ++ *	========== Module loaders
   8.608 ++ */
   8.609 ++
   8.610 ++struct MLOADER;
   8.611 ++
   8.612 ++MIKMODAPI extern CHAR*   MikMod_InfoLoader(void);
   8.613 ++MIKMODAPI extern void    MikMod_RegisterAllLoaders(void);
   8.614 ++MIKMODAPI extern void    MikMod_RegisterLoader(struct MLOADER*);
   8.615 ++
   8.616 ++MIKMODAPI extern struct MLOADER load_669; /* 669 and Extended-669 (by Tran/Renaissance) */
   8.617 ++MIKMODAPI extern struct MLOADER load_amf; /* DMP Advanced Module Format (by Otto Chrons) */
   8.618 ++MIKMODAPI extern struct MLOADER load_dsm; /* DSIK internal module format */
   8.619 ++MIKMODAPI extern struct MLOADER load_far; /* Farandole Composer (by Daniel Potter) */
   8.620 ++MIKMODAPI extern struct MLOADER load_gdm; /* General DigiMusic (by Edward Schlunder) */
   8.621 ++MIKMODAPI extern struct MLOADER load_it;  /* Impulse Tracker (by Jeffrey Lim) */
   8.622 ++MIKMODAPI extern struct MLOADER load_imf; /* Imago Orpheus (by Lutz Roeder) */
   8.623 ++MIKMODAPI extern struct MLOADER load_med; /* Amiga MED modules (by Teijo Kinnunen) */
   8.624 ++MIKMODAPI extern struct MLOADER load_m15; /* Soundtracker 15-instrument */
   8.625 ++MIKMODAPI extern struct MLOADER load_mod; /* Standard 31-instrument Module loader */
   8.626 ++MIKMODAPI extern struct MLOADER load_mtm; /* Multi-Tracker Module (by Renaissance) */
   8.627 ++MIKMODAPI extern struct MLOADER load_okt; /* Amiga Oktalyzer */
   8.628 ++MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
   8.629 ++MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
   8.630 ++MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
   8.631 ++MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
   8.632 ++MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
   8.633 ++MIKMODAPI extern struct MLOADER load_xm;  /* FastTracker 2 (by Triton) */
   8.634 ++
   8.635 ++/*
   8.636 ++ *	========== Module player
   8.637 ++ */
   8.638 ++
   8.639 ++MIKMODAPI extern MODULE* Player_Load(CHAR*,int,BOOL);
   8.640 ++MIKMODAPI extern MODULE* Player_LoadFP(FILE*,int,BOOL);
   8.641 ++MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,BOOL);
   8.642 ++MIKMODAPI extern CHAR*   Player_LoadTitle(CHAR*);
   8.643 ++MIKMODAPI extern CHAR*   Player_LoadTitleFP(FILE*);
   8.644 ++MIKMODAPI extern void    Player_Free(MODULE*);
   8.645 ++MIKMODAPI extern void    Player_Start(MODULE*);
   8.646 ++MIKMODAPI extern BOOL    Player_Active(void);
   8.647 ++MIKMODAPI extern void    Player_Stop(void);
   8.648 ++MIKMODAPI extern void    Player_TogglePause(void);
   8.649 ++MIKMODAPI extern BOOL    Player_Paused(void);
   8.650 ++MIKMODAPI extern void    Player_NextPosition(void);
   8.651 ++MIKMODAPI extern void    Player_PrevPosition(void);
   8.652 ++MIKMODAPI extern void    Player_SetPosition(UWORD);
   8.653 ++MIKMODAPI extern BOOL    Player_Muted(UBYTE);
   8.654 ++MIKMODAPI extern void    Player_SetVolume(SWORD);
   8.655 ++MIKMODAPI extern MODULE* Player_GetModule(void);
   8.656 ++MIKMODAPI extern void    Player_SetSpeed(UWORD);
   8.657 ++MIKMODAPI extern void    Player_SetTempo(UWORD);
   8.658 ++MIKMODAPI extern void    Player_Unmute(SLONG,...);
   8.659 ++MIKMODAPI extern void    Player_Mute(SLONG,...);
   8.660 ++MIKMODAPI extern void    Player_ToggleMute(SLONG,...);
   8.661 ++MIKMODAPI extern int     Player_GetChannelVoice(UBYTE);
   8.662 ++MIKMODAPI extern UWORD   Player_GetChannelPeriod(UBYTE);
   8.663 ++
   8.664 ++typedef void (MikMod_player)(void);
   8.665 ++typedef MikMod_player *MikMod_player_t;
   8.666 ++
   8.667 ++MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
   8.668 ++
   8.669 ++#define MUTE_EXCLUSIVE  32000
   8.670 ++#define MUTE_INCLUSIVE  32001
   8.671 ++
   8.672 ++/*
   8.673 ++ *	========== Drivers
   8.674 ++ */
   8.675 ++
   8.676 ++enum {
   8.677 ++	MD_MUSIC = 0,
   8.678 ++	MD_SNDFX
   8.679 ++};
   8.680 ++
   8.681 ++enum {
   8.682 ++	MD_HARDWARE = 0,
   8.683 ++	MD_SOFTWARE
   8.684 ++};
   8.685 ++
   8.686 ++/* Mixing flags */
   8.687 ++
   8.688 ++/* These ones take effect only after MikMod_Init or MikMod_Reset */
   8.689 ++#define DMODE_16BITS     0x0001 /* enable 16 bit output */
   8.690 ++#define DMODE_STEREO     0x0002 /* enable stereo output */
   8.691 ++#define DMODE_SOFT_SNDFX 0x0004 /* Process sound effects via software mixer */
   8.692 ++#define DMODE_SOFT_MUSIC 0x0008 /* Process music via software mixer */
   8.693 ++#define DMODE_HQMIXER    0x0010 /* Use high-quality (slower) software mixer */
   8.694 ++/* These take effect immediately. */
   8.695 ++#define DMODE_SURROUND   0x0100 /* enable surround sound */
   8.696 ++#define DMODE_INTERP     0x0200 /* enable interpolation */
   8.697 ++#define DMODE_REVERSE    0x0400 /* reverse stereo */
   8.698 ++
   8.699 ++struct SAMPLOAD;
   8.700 ++typedef struct MDRIVER {
   8.701 ++struct MDRIVER* next;
   8.702 ++	CHAR*       Name;
   8.703 ++	CHAR*       Version;
   8.704 ++
   8.705 ++	UBYTE       HardVoiceLimit; /* Limit of hardware mixer voices */
   8.706 ++	UBYTE       SoftVoiceLimit; /* Limit of software mixer voices */
   8.707 ++
   8.708 ++	CHAR*       Alias;
   8.709 ++
   8.710 ++	void        (*CommandLine)      (CHAR*);
   8.711 ++	BOOL        (*IsPresent)        (void);
   8.712 ++	SWORD       (*SampleLoad)       (struct SAMPLOAD*,int);
   8.713 ++	void        (*SampleUnload)     (SWORD);
   8.714 ++	ULONG       (*FreeSampleSpace)  (int);
   8.715 ++	ULONG       (*RealSampleLength) (int,struct SAMPLE*);
   8.716 ++	BOOL        (*Init)             (void);
   8.717 ++	void        (*Exit)             (void);
   8.718 ++	BOOL        (*Reset)            (void);
   8.719 ++	BOOL        (*SetNumVoices)     (void);
   8.720 ++	BOOL        (*PlayStart)        (void);
   8.721 ++	void        (*PlayStop)         (void);
   8.722 ++	void        (*Update)           (void);
   8.723 ++	void		(*Pause)			(void);
   8.724 ++	void        (*VoiceSetVolume)   (UBYTE,UWORD);
   8.725 ++	UWORD       (*VoiceGetVolume)   (UBYTE);
   8.726 ++	void        (*VoiceSetFrequency)(UBYTE,ULONG);
   8.727 ++	ULONG       (*VoiceGetFrequency)(UBYTE);
   8.728 ++	void        (*VoiceSetPanning)  (UBYTE,ULONG);
   8.729 ++	ULONG       (*VoiceGetPanning)  (UBYTE);
   8.730 ++	void        (*VoicePlay)        (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
   8.731 ++	void        (*VoiceStop)        (UBYTE);
   8.732 ++	BOOL        (*VoiceStopped)     (UBYTE);
   8.733 ++	SLONG       (*VoiceGetPosition) (UBYTE);
   8.734 ++	ULONG       (*VoiceRealVolume)  (UBYTE);
   8.735 ++} MDRIVER;
   8.736 ++
   8.737 ++/* These variables can be changed at ANY time and results will be immediate */
   8.738 ++MIKMODAPI extern UBYTE md_volume;      /* global sound volume (0-128) */
   8.739 ++MIKMODAPI extern UBYTE md_musicvolume; /* volume of song */
   8.740 ++MIKMODAPI extern UBYTE md_sndfxvolume; /* volume of sound effects */
   8.741 ++MIKMODAPI extern UBYTE md_reverb;      /* 0 = none;  15 = chaos */
   8.742 ++MIKMODAPI extern UBYTE md_pansep;      /* 0 = mono;  128 == 100% (full left/right) */
   8.743 ++
   8.744 ++/* The variables below can be changed at any time, but changes will not be
   8.745 ++   implemented until MikMod_Reset is called. A call to MikMod_Reset may result
   8.746 ++   in a skip or pop in audio (depending on the soundcard driver and the settings
   8.747 ++   changed). */
   8.748 ++MIKMODAPI extern UWORD md_device;      /* device */
   8.749 ++MIKMODAPI extern UWORD md_mixfreq;     /* mixing frequency */
   8.750 ++MIKMODAPI extern UWORD md_mode;        /* mode. See DMODE_? flags above */
   8.751 ++
   8.752 ++/* The following variable should not be changed! */
   8.753 ++MIKMODAPI extern MDRIVER* md_driver;   /* Current driver in use. */
   8.754 ++
   8.755 ++/* Known drivers list */
   8.756 ++
   8.757 ++MIKMODAPI extern struct MDRIVER drv_nos;    /* no sound */
   8.758 ++MIKMODAPI extern struct MDRIVER drv_pipe;   /* piped output */
   8.759 ++MIKMODAPI extern struct MDRIVER drv_raw;    /* raw file disk writer [music.raw] */
   8.760 ++MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
   8.761 ++MIKMODAPI extern struct MDRIVER drv_wav;    /* RIFF WAVE file disk writer [music.wav] */
   8.762 ++
   8.763 ++MIKMODAPI extern struct MDRIVER drv_ultra;  /* Linux Ultrasound driver */
   8.764 ++MIKMODAPI extern struct MDRIVER drv_sam9407;	/* Linux sam9407 driver */
   8.765 ++
   8.766 ++MIKMODAPI extern struct MDRIVER drv_AF;     /* Dec Alpha AudioFile */
   8.767 ++MIKMODAPI extern struct MDRIVER drv_aix;    /* AIX audio device */
   8.768 ++MIKMODAPI extern struct MDRIVER drv_alsa;   /* Advanced Linux Sound Architecture (ALSA) */
   8.769 ++MIKMODAPI extern struct MDRIVER drv_esd;    /* Enlightened sound daemon (EsounD) */
   8.770 ++MIKMODAPI extern struct MDRIVER drv_hp;     /* HP-UX audio device */
   8.771 ++MIKMODAPI extern struct MDRIVER drv_oss;    /* OpenSound System (Linux,FreeBSD...) */
   8.772 ++MIKMODAPI extern struct MDRIVER drv_sgi;    /* SGI audio library */
   8.773 ++MIKMODAPI extern struct MDRIVER drv_sun;    /* Sun/NetBSD/OpenBSD audio device */
   8.774 ++
   8.775 ++MIKMODAPI extern struct MDRIVER drv_dart;   /* OS/2 Direct Audio RealTime */
   8.776 ++MIKMODAPI extern struct MDRIVER drv_os2;    /* OS/2 MMPM/2 */
   8.777 ++
   8.778 ++MIKMODAPI extern struct MDRIVER drv_ds;     /* Win32 DirectSound driver */
   8.779 ++MIKMODAPI extern struct MDRIVER drv_win;    /* Win32 multimedia API driver */
   8.780 ++
   8.781 ++MIKMODAPI extern struct MDRIVER drv_mac;    /* Macintosh Sound Manager driver */
   8.782 ++
   8.783 ++/*========== Virtual channel mixer interface (for user-supplied drivers only) */
   8.784 ++
   8.785 ++MIKMODAPI extern BOOL  VC_Init(void);
   8.786 ++MIKMODAPI extern void  VC_Exit(void);
   8.787 ++MIKMODAPI extern BOOL  VC_SetNumVoices(void);
   8.788 ++MIKMODAPI extern ULONG VC_SampleSpace(int);
   8.789 ++MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
   8.790 ++
   8.791 ++MIKMODAPI extern BOOL  VC_PlayStart(void);
   8.792 ++MIKMODAPI extern void  VC_PlayStop(void);
   8.793 ++
   8.794 ++MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);
   8.795 ++MIKMODAPI extern void  VC_SampleUnload(SWORD);
   8.796 ++
   8.797 ++MIKMODAPI extern ULONG VC_WriteBytes(SBYTE*,ULONG);
   8.798 ++MIKMODAPI extern ULONG VC_SilenceBytes(SBYTE*,ULONG);
   8.799 ++
   8.800 ++MIKMODAPI extern void  VC_VoiceSetVolume(UBYTE,UWORD);
   8.801 ++MIKMODAPI extern UWORD VC_VoiceGetVolume(UBYTE);
   8.802 ++MIKMODAPI extern void  VC_VoiceSetFrequency(UBYTE,ULONG);
   8.803 ++MIKMODAPI extern ULONG VC_VoiceGetFrequency(UBYTE);
   8.804 ++MIKMODAPI extern void  VC_VoiceSetPanning(UBYTE,ULONG);
   8.805 ++MIKMODAPI extern ULONG VC_VoiceGetPanning(UBYTE);
   8.806 ++MIKMODAPI extern void  VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
   8.807 ++
   8.808 ++MIKMODAPI extern void  VC_VoiceStop(UBYTE);
   8.809 ++MIKMODAPI extern BOOL  VC_VoiceStopped(UBYTE);
   8.810 ++MIKMODAPI extern SLONG VC_VoiceGetPosition(UBYTE);
   8.811 ++MIKMODAPI extern ULONG VC_VoiceRealVolume(UBYTE);
   8.812 ++
   8.813 ++#ifdef __cplusplus
   8.814 ++}
   8.815 ++#endif
   8.816 ++
   8.817 ++#endif
   8.818 ++
   8.819 ++/* ex:set ts=4: */
   8.820 +diff -ruN libmikmod-3.1.12/include/mikmod_build.h libmikmod-3.1.12.new/include/mikmod_build.h
   8.821 +--- libmikmod-3.1.12/include/mikmod_build.h	1969-12-31 16:00:00.000000000 -0800
   8.822 ++++ libmikmod-3.1.12.new/include/mikmod_build.h	2013-06-01 21:43:42.000000000 -0700
   8.823 +@@ -0,0 +1,725 @@
   8.824 ++/*	MikMod sound library
   8.825 ++	(c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS
   8.826 ++	for complete list.
   8.827 ++
   8.828 ++	This library is free software; you can redistribute it and/or modify
   8.829 ++	it under the terms of the GNU Library General Public License as
   8.830 ++	published by the Free Software Foundation; either version 2 of
   8.831 ++	the License, or (at your option) any later version.
   8.832 ++ 
   8.833 ++	This program is distributed in the hope that it will be useful,
   8.834 ++	but WITHOUT ANY WARRANTY; without even the implied warranty of
   8.835 ++	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   8.836 ++	GNU Library General Public License for more details.
   8.837 ++ 
   8.838 ++	You should have received a copy of the GNU Library General Public
   8.839 ++	License along with this library; if not, write to the Free Software
   8.840 ++	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   8.841 ++	02111-1307, USA.
   8.842 ++*/
   8.843 ++
   8.844 ++/*==============================================================================
   8.845 ++
   8.846 ++  $Id: mikmod.h.in,v 1.2 2004/06/01 16:43:45 raph Exp $
   8.847 ++
   8.848 ++  MikMod sound library include file
   8.849 ++
   8.850 ++==============================================================================*/
   8.851 ++
   8.852 ++#ifndef _MIKMOD_H_
   8.853 ++#define _MIKMOD_H_
   8.854 ++
   8.855 ++#include <stdio.h>
   8.856 ++#include <stdlib.h>
   8.857 ++
   8.858 ++#ifdef __cplusplus
   8.859 ++extern "C" {
   8.860 ++#endif
   8.861 ++
   8.862 ++/*
   8.863 ++ * ========== Compiler magic for shared libraries
   8.864 ++ */
   8.865 ++
   8.866 ++#if defined WIN32 && defined _DLL
   8.867 ++#ifdef DLL_EXPORTS
   8.868 ++#define MIKMODAPI __declspec(dllexport)
   8.869 ++#else
   8.870 ++#define MIKMODAPI __declspec(dllimport)
   8.871 ++#endif
   8.872 ++#else
   8.873 ++#define MIKMODAPI
   8.874 ++#endif
   8.875 ++
   8.876 ++/*
   8.877 ++ *	========== Library version
   8.878 ++ */
   8.879 ++
   8.880 ++#define LIBMIKMOD_VERSION_MAJOR 3L
   8.881 ++#define LIBMIKMOD_VERSION_MINOR 1L
   8.882 ++#define LIBMIKMOD_REVISION      10L
   8.883 ++
   8.884 ++#define LIBMIKMOD_VERSION \
   8.885 ++	((LIBMIKMOD_VERSION_MAJOR<<16)| \
   8.886 ++	 (LIBMIKMOD_VERSION_MINOR<< 8)| \
   8.887 ++	 (LIBMIKMOD_REVISION))
   8.888 ++
   8.889 ++MIKMODAPI extern long MikMod_GetVersion(void);
   8.890 ++
   8.891 ++/*
   8.892 ++ *	========== Platform independent-type definitions
   8.893 ++ */
   8.894 ++
   8.895 ++#ifdef WIN32
   8.896 ++#define WIN32_LEAN_AND_MEAN
   8.897 ++#include <windows.h>
   8.898 ++#include <io.h>
   8.899 ++#include <mmsystem.h>
   8.900 ++
   8.901 ++/* Avoid conflicts with windef.h */
   8.902 ++#define SBYTE   _mm_SBYTE
   8.903 ++#define UBYTE   _mm_UBYTE
   8.904 ++#define SWORD   _mm_SWORD
   8.905 ++#define UWORD   _mm_UWORD
   8.906 ++#define SLONG   _mm_SLONG
   8.907 ++#define ULONG   _mm_ULONG
   8.908 ++#define BOOL    _mm_BOOL
   8.909 ++
   8.910 ++#endif /* WIN32 */
   8.911 ++
   8.912 ++#if defined(__OS2__)||defined(__EMX__)
   8.913 ++#define INCL_DOSSEMAPHORES
   8.914 ++#include <os2.h>
   8.915 ++#else
   8.916 ++typedef char CHAR;
   8.917 ++#endif
   8.918 ++
   8.919 ++
   8.920 ++
   8.921 ++#if defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(_LP64)
   8.922 ++/* 64 bit architectures */
   8.923 ++
   8.924 ++typedef signed char     SBYTE;      /* 1 byte, signed */
   8.925 ++typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   8.926 ++typedef signed short    SWORD;      /* 2 bytes, signed */
   8.927 ++typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   8.928 ++typedef signed int      SLONG;      /* 4 bytes, signed */
   8.929 ++typedef unsigned int    ULONG;      /* 4 bytes, unsigned */
   8.930 ++typedef int             BOOL;       /* 0=false, <>0 true */
   8.931 ++
   8.932 ++#else
   8.933 ++/* 32 bit architectures */
   8.934 ++
   8.935 ++typedef signed char     SBYTE;      /* 1 byte, signed */
   8.936 ++typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
   8.937 ++typedef signed short    SWORD;      /* 2 bytes, signed */
   8.938 ++typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
   8.939 ++typedef signed long     SLONG;      /* 4 bytes, signed */
   8.940 ++typedef unsigned long   ULONG;      /* 4 bytes, unsigned */
   8.941 ++typedef int             BOOL;       /* 0=false, <>0 true */
   8.942 ++#endif
   8.943 ++
   8.944 ++/*
   8.945 ++ *	========== Error codes
   8.946 ++ */
   8.947 ++
   8.948 ++enum {
   8.949 ++	MMERR_OPENING_FILE = 1,
   8.950 ++	MMERR_OUT_OF_MEMORY,
   8.951 ++	MMERR_DYNAMIC_LINKING,
   8.952 ++
   8.953 ++	MMERR_SAMPLE_TOO_BIG,
   8.954 ++	MMERR_OUT_OF_HANDLES,
   8.955 ++	MMERR_UNKNOWN_WAVE_TYPE,
   8.956 ++
   8.957 ++	MMERR_LOADING_PATTERN,
   8.958 ++	MMERR_LOADING_TRACK,
   8.959 ++	MMERR_LOADING_HEADER,
   8.960 ++	MMERR_LOADING_SAMPLEINFO,
   8.961 ++	MMERR_NOT_A_MODULE,
   8.962 ++	MMERR_NOT_A_STREAM,
   8.963 ++	MMERR_MED_SYNTHSAMPLES,
   8.964 ++	MMERR_ITPACK_INVALID_DATA,
   8.965 ++
   8.966 ++	MMERR_DETECTING_DEVICE,
   8.967 ++	MMERR_INVALID_DEVICE,
   8.968 ++	MMERR_INITIALIZING_MIXER,
   8.969 ++	MMERR_OPENING_AUDIO,
   8.970 ++	MMERR_8BIT_ONLY,
   8.971 ++	MMERR_16BIT_ONLY,
   8.972 ++	MMERR_STEREO_ONLY,
   8.973 ++	MMERR_ULAW,
   8.974 ++	MMERR_NON_BLOCK,
   8.975 ++
   8.976 ++	MMERR_AF_AUDIO_PORT,
   8.977 ++
   8.978 ++	MMERR_AIX_CONFIG_INIT,
   8.979 ++	MMERR_AIX_CONFIG_CONTROL,
   8.980 ++	MMERR_AIX_CONFIG_START,
   8.981 ++
   8.982 ++	MMERR_GUS_SETTINGS,
   8.983 ++	MMERR_GUS_RESET,
   8.984 ++	MMERR_GUS_TIMER,
   8.985 ++
   8.986 ++	MMERR_HP_SETSAMPLESIZE,
   8.987 ++	MMERR_HP_SETSPEED,
   8.988 ++	MMERR_HP_CHANNELS,
   8.989 ++	MMERR_HP_AUDIO_OUTPUT,
   8.990 ++	MMERR_HP_AUDIO_DESC,
   8.991 ++	MMERR_HP_BUFFERSIZE,
   8.992 ++
   8.993 ++	MMERR_OSS_SETFRAGMENT,
   8.994 ++	MMERR_OSS_SETSAMPLESIZE,
   8.995 ++	MMERR_OSS_SETSTEREO,
   8.996 ++	MMERR_OSS_SETSPEED,
   8.997 ++
   8.998 ++	MMERR_SGI_SPEED,
   8.999 ++	MMERR_SGI_16BIT,
  8.1000 ++	MMERR_SGI_8BIT,
  8.1001 ++	MMERR_SGI_STEREO,
  8.1002 ++	MMERR_SGI_MONO,
  8.1003 ++
  8.1004 ++	MMERR_SUN_INIT,
  8.1005 ++
  8.1006 ++	MMERR_OS2_MIXSETUP,
  8.1007 ++	MMERR_OS2_SEMAPHORE,
  8.1008 ++	MMERR_OS2_TIMER,
  8.1009 ++	MMERR_OS2_THREAD,
  8.1010 ++
  8.1011 ++	MMERR_DS_PRIORITY,
  8.1012 ++	MMERR_DS_BUFFER,
  8.1013 ++	MMERR_DS_FORMAT,
  8.1014 ++	MMERR_DS_NOTIFY,
  8.1015 ++	MMERR_DS_EVENT,
  8.1016 ++	MMERR_DS_THREAD,
  8.1017 ++	MMERR_DS_UPDATE,
  8.1018 ++
  8.1019 ++	MMERR_WINMM_HANDLE,
  8.1020 ++	MMERR_WINMM_ALLOCATED,
  8.1021 ++	MMERR_WINMM_DEVICEID,
  8.1022 ++	MMERR_WINMM_FORMAT,
  8.1023 ++	MMERR_WINMM_UNKNOWN,
  8.1024 ++
  8.1025 ++	MMERR_MAC_SPEED,
  8.1026 ++	MMERR_MAC_START,
  8.1027 ++
  8.1028 ++	MMERR_MAX
  8.1029 ++};
  8.1030 ++
  8.1031 ++/*
  8.1032 ++ *	========== Error handling
  8.1033 ++ */
  8.1034 ++
  8.1035 ++typedef void (MikMod_handler)(void);
  8.1036 ++typedef MikMod_handler *MikMod_handler_t;
  8.1037 ++
  8.1038 ++MIKMODAPI extern int  MikMod_errno;
  8.1039 ++MIKMODAPI extern BOOL MikMod_critical;
  8.1040 ++MIKMODAPI extern char *MikMod_strerror(int);
  8.1041 ++
  8.1042 ++MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
  8.1043 ++
  8.1044 ++/*
  8.1045 ++ *	========== Library initialization and core functions
  8.1046 ++ */
  8.1047 ++
  8.1048 ++struct MDRIVER;
  8.1049 ++
  8.1050 ++MIKMODAPI extern void   MikMod_RegisterAllDrivers(void);
  8.1051 ++
  8.1052 ++MIKMODAPI extern CHAR*  MikMod_InfoDriver(void);
  8.1053 ++MIKMODAPI extern void   MikMod_RegisterDriver(struct MDRIVER*);
  8.1054 ++MIKMODAPI extern int    MikMod_DriverFromAlias(CHAR*);
  8.1055 ++
  8.1056 ++MIKMODAPI extern BOOL   MikMod_Init(CHAR*);
  8.1057 ++MIKMODAPI extern void   MikMod_Exit(void);
  8.1058 ++MIKMODAPI extern BOOL   MikMod_Reset(CHAR*);
  8.1059 ++MIKMODAPI extern BOOL   MikMod_SetNumVoices(int,int);
  8.1060 ++MIKMODAPI extern BOOL   MikMod_Active(void);
  8.1061 ++MIKMODAPI extern BOOL   MikMod_EnableOutput(void);
  8.1062 ++MIKMODAPI extern void   MikMod_DisableOutput(void);
  8.1063 ++MIKMODAPI extern void   MikMod_Update(void);
  8.1064 ++
  8.1065 ++MIKMODAPI extern BOOL   MikMod_InitThreads(void);
  8.1066 ++MIKMODAPI extern void   MikMod_Lock(void);
  8.1067 ++MIKMODAPI extern void   MikMod_Unlock(void);
  8.1068 ++
  8.1069 ++/*
  8.1070 ++ *	========== Reader, Writer
  8.1071 ++ */
  8.1072 ++
  8.1073 ++typedef struct MREADER {
  8.1074 ++	BOOL (*Seek)(struct MREADER*,long,int);
  8.1075 ++	long (*Tell)(struct MREADER*);
  8.1076 ++	BOOL (*Read)(struct MREADER*,void*,size_t);
  8.1077 ++	int  (*Get)(struct MREADER*);
  8.1078 ++	BOOL (*Eof)(struct MREADER*);
  8.1079 ++} MREADER;
  8.1080 ++
  8.1081 ++typedef struct MWRITER {
  8.1082 ++	BOOL (*Seek)(struct MWRITER*,long,int);
  8.1083 ++	long (*Tell)(struct MWRITER*);
  8.1084 ++	BOOL (*Write)(struct MWRITER*,void*,size_t);
  8.1085 ++	BOOL (*Put)(struct MWRITER*,int);
  8.1086 ++} MWRITER;
  8.1087 ++
  8.1088 ++/*
  8.1089 ++ *	========== Samples
  8.1090 ++ */
  8.1091 ++
  8.1092 ++/* Sample playback should not be interrupted */
  8.1093 ++#define SFX_CRITICAL 1
  8.1094 ++
  8.1095 ++/* Sample format [loading and in-memory] flags: */
  8.1096 ++#define SF_16BITS       0x0001
  8.1097 ++#define SF_STEREO       0x0002
  8.1098 ++#define SF_SIGNED       0x0004
  8.1099 ++#define SF_BIG_ENDIAN   0x0008
  8.1100 ++#define SF_DELTA        0x0010
  8.1101 ++#define SF_ITPACKED		0x0020
  8.1102 ++
  8.1103 ++#define	SF_FORMATMASK	0x003F
  8.1104 ++
  8.1105 ++/* General Playback flags */
  8.1106 ++
  8.1107 ++#define SF_LOOP         0x0100
  8.1108 ++#define SF_BIDI         0x0200
  8.1109 ++#define SF_REVERSE      0x0400
  8.1110 ++#define SF_SUSTAIN      0x0800
  8.1111 ++
  8.1112 ++#define SF_PLAYBACKMASK	0x0C00
  8.1113 ++
  8.1114 ++/* Module-only Playback Flags */
  8.1115 ++
  8.1116 ++#define SF_OWNPAN		0x1000
  8.1117 ++#define SF_UST_LOOP     0x2000
  8.1118 ++
  8.1119 ++#define SF_EXTRAPLAYBACKMASK	0x3000
  8.1120 ++
  8.1121 ++/* Panning constants */
  8.1122 ++#define PAN_LEFT		0
  8.1123 ++#define PAN_HALFLEFT 	64
  8.1124 ++#define PAN_CENTER		128
  8.1125 ++#define PAN_HALFRIGHT	192
  8.1126 ++#define PAN_RIGHT		255
  8.1127 ++#define PAN_SURROUND	512 /* panning value for Dolby Surround */
  8.1128 ++
  8.1129 ++typedef struct SAMPLE {
  8.1130 ++	SWORD  panning;     /* panning (0-255 or PAN_SURROUND) */
  8.1131 ++	ULONG  speed;       /* Base playing speed/frequency of note */
  8.1132 ++	UBYTE  volume;      /* volume 0-64 */
  8.1133 ++	UWORD  inflags;		/* sample format on disk */
  8.1134 ++	UWORD  flags;       /* sample format in memory */
  8.1135 ++	ULONG  length;      /* length of sample (in samples!) */
  8.1136 ++	ULONG  loopstart;   /* repeat position (relative to start, in samples) */
  8.1137 ++	ULONG  loopend;     /* repeat end */
  8.1138 ++	ULONG  susbegin;    /* sustain loop begin (in samples) \  Not Supported */
  8.1139 ++	ULONG  susend;      /* sustain loop end                /      Yet! */
  8.1140 ++
  8.1141 ++	/* Variables used by the module player only! (ignored for sound effects) */
  8.1142 ++	UBYTE  globvol;     /* global volume */
  8.1143 ++	UBYTE  vibflags;    /* autovibrato flag stuffs */
  8.1144 ++	UBYTE  vibtype;     /* Vibratos moved from INSTRUMENT to SAMPLE */
  8.1145 ++	UBYTE  vibsweep;
  8.1146 ++	UBYTE  vibdepth;
  8.1147 ++	UBYTE  vibrate;
  8.1148 ++	CHAR*  samplename;  /* name of the sample */
  8.1149 ++
  8.1150 ++	/* Values used internally only */
  8.1151 ++	UWORD  avibpos;     /* autovibrato pos [player use] */
  8.1152 ++	UBYTE  divfactor;   /* for sample scaling, maintains proper period slides */
  8.1153 ++	ULONG  seekpos;     /* seek position in file */
  8.1154 ++	SWORD  handle;      /* sample handle used by individual drivers */
  8.1155 ++} SAMPLE;
  8.1156 ++
  8.1157 ++/* Sample functions */
  8.1158 ++
  8.1159 ++MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);
  8.1160 ++MIKMODAPI extern SAMPLE *Sample_LoadFP(FILE*);
  8.1161 ++MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
  8.1162 ++MIKMODAPI extern void   Sample_Free(SAMPLE*);
  8.1163 ++MIKMODAPI extern SBYTE  Sample_Play(SAMPLE*,ULONG,UBYTE);
  8.1164 ++
  8.1165 ++MIKMODAPI extern void   Voice_SetVolume(SBYTE,UWORD);
  8.1166 ++MIKMODAPI extern UWORD  Voice_GetVolume(SBYTE);
  8.1167 ++MIKMODAPI extern void   Voice_SetFrequency(SBYTE,ULONG);
  8.1168 ++MIKMODAPI extern ULONG  Voice_GetFrequency(SBYTE);
  8.1169 ++MIKMODAPI extern void   Voice_SetPanning(SBYTE,ULONG);
  8.1170 ++MIKMODAPI extern ULONG  Voice_GetPanning(SBYTE);
  8.1171 ++MIKMODAPI extern void   Voice_Play(SBYTE,SAMPLE*,ULONG);
  8.1172 ++MIKMODAPI extern void   Voice_Stop(SBYTE);
  8.1173 ++MIKMODAPI extern BOOL   Voice_Stopped(SBYTE);
  8.1174 ++MIKMODAPI extern SLONG  Voice_GetPosition(SBYTE);
  8.1175 ++MIKMODAPI extern ULONG  Voice_RealVolume(SBYTE);
  8.1176 ++
  8.1177 ++/*
  8.1178 ++ *	========== Internal module representation (UniMod)
  8.1179 ++ */
  8.1180 ++
  8.1181 ++/*
  8.1182 ++	Instrument definition - for information only, the only field which may be
  8.1183 ++	of use in user programs is the name field
  8.1184 ++*/
  8.1185 ++
  8.1186 ++/* Instrument note count */
  8.1187 ++#define INSTNOTES 120
  8.1188 ++
  8.1189 ++/* Envelope point */
  8.1190 ++typedef struct ENVPT {
  8.1191 ++	SWORD pos;
  8.1192 ++	SWORD val;
  8.1193 ++} ENVPT;
  8.1194 ++
  8.1195 ++/* Envelope point count */
  8.1196 ++#define ENVPOINTS 32
  8.1197 ++
  8.1198 ++/* Instrument structure */
  8.1199 ++typedef struct INSTRUMENT {
  8.1200 ++	CHAR* insname;
  8.1201 ++
  8.1202 ++	UBYTE flags;
  8.1203 ++	UWORD samplenumber[INSTNOTES];
  8.1204 ++	UBYTE samplenote[INSTNOTES];
  8.1205 ++
  8.1206 ++	UBYTE nnatype;
  8.1207 ++	UBYTE dca;              /* duplicate check action */
  8.1208 ++	UBYTE dct;              /* duplicate check type */
  8.1209 ++	UBYTE globvol;
  8.1210 ++	UWORD volfade;
  8.1211 ++	SWORD panning;          /* instrument-based panning var */
  8.1212 ++
  8.1213 ++	UBYTE pitpansep;        /* pitch pan separation (0 to 255) */
  8.1214 ++	UBYTE pitpancenter;     /* pitch pan center (0 to 119) */
  8.1215 ++	UBYTE rvolvar;          /* random volume varations (0 - 100%) */
  8.1216 ++	UBYTE rpanvar;          /* random panning varations (0 - 100%) */
  8.1217 ++
  8.1218 ++	/* volume envelope */
  8.1219 ++	UBYTE volflg;           /* bit 0: on 1: sustain 2: loop */
  8.1220 ++	UBYTE volpts;
  8.1221 ++	UBYTE volsusbeg;
  8.1222 ++	UBYTE volsusend;
  8.1223 ++	UBYTE volbeg;
  8.1224 ++	UBYTE volend;
  8.1225 ++	ENVPT volenv[ENVPOINTS];
  8.1226 ++	/* panning envelope */
  8.1227 ++	UBYTE panflg;           /* bit 0: on 1: sustain 2: loop */
  8.1228 ++	UBYTE panpts;
  8.1229 ++	UBYTE pansusbeg;
  8.1230 ++	UBYTE pansusend;
  8.1231 ++	UBYTE panbeg;
  8.1232 ++	UBYTE panend;
  8.1233 ++	ENVPT panenv[ENVPOINTS];
  8.1234 ++	/* pitch envelope */
  8.1235 ++	UBYTE pitflg;           /* bit 0: on 1: sustain 2: loop */
  8.1236 ++	UBYTE pitpts;
  8.1237 ++	UBYTE pitsusbeg;
  8.1238 ++	UBYTE pitsusend;
  8.1239 ++	UBYTE pitbeg;
  8.1240 ++	UBYTE pitend;
  8.1241 ++	ENVPT pitenv[ENVPOINTS];
  8.1242 ++} INSTRUMENT;
  8.1243 ++
  8.1244 ++struct MP_CONTROL;
  8.1245 ++struct MP_VOICE;
  8.1246 ++
  8.1247 ++/*
  8.1248 ++	Module definition
  8.1249 ++*/
  8.1250 ++
  8.1251 ++/* maximum master channels supported */
  8.1252 ++#define UF_MAXCHAN	64
  8.1253 ++
  8.1254 ++/* Module flags */
  8.1255 ++#define UF_XMPERIODS	0x0001 /* XM periods / finetuning */
  8.1256 ++#define UF_LINEAR		0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
  8.1257 ++#define UF_INST			0x0004 /* Instruments are used */
  8.1258 ++#define UF_NNA			0x0008 /* IT: NNA used, set numvoices rather
  8.1259 ++								  than numchn */
  8.1260 ++#define UF_S3MSLIDES	0x0010 /* uses old S3M volume slides */
  8.1261 ++#define UF_BGSLIDES		0x0020 /* continue volume slides in the background */
  8.1262 ++#define UF_HIGHBPM		0x0040 /* MED: can use >255 bpm */
  8.1263 ++#define UF_NOWRAP		0x0080 /* XM-type (i.e. illogical) pattern break
  8.1264 ++								  semantics */
  8.1265 ++#define UF_ARPMEM		0x0100 /* IT: need arpeggio memory */
  8.1266 ++#define UF_FT2QUIRKS	0x0200 /* emulate some FT2 replay quirks */
  8.1267 ++#define UF_PANNING		0x0400 /* module uses panning effects or have
  8.1268 ++								  non-tracker default initial panning */
  8.1269 ++
  8.1270 ++typedef struct MODULE {
  8.1271 ++	/* general module information */
  8.1272 ++		CHAR*       songname;    /* name of the song */
  8.1273 ++		CHAR*       modtype;     /* string type of module loaded */
  8.1274 ++		CHAR*       comment;     /* module comments */
  8.1275 ++
  8.1276 ++		UWORD       flags;       /* See module flags above */
  8.1277 ++		UBYTE       numchn;      /* number of module channels */
  8.1278 ++		UBYTE       numvoices;   /* max # voices used for full NNA playback */
  8.1279 ++		UWORD       numpos;      /* number of positions in this song */
  8.1280 ++		UWORD       numpat;      /* number of patterns in this song */
  8.1281 ++		UWORD       numins;      /* number of instruments */
  8.1282 ++		UWORD       numsmp;      /* number of samples */
  8.1283 ++struct  INSTRUMENT* instruments; /* all instruments */
  8.1284 ++struct  SAMPLE*     samples;     /* all samples */
  8.1285 ++		UBYTE       realchn;     /* real number of channels used */
  8.1286 ++		UBYTE       totalchn;    /* total number of channels used (incl NNAs) */
  8.1287 ++
  8.1288 ++	/* playback settings */
  8.1289 ++		UWORD       reppos;      /* restart position */
  8.1290 ++		UBYTE       initspeed;   /* initial song speed */
  8.1291 ++		UWORD       inittempo;   /* initial song tempo */
  8.1292 ++		UBYTE       initvolume;  /* initial global volume (0 - 128) */
  8.1293 ++		UWORD       panning[UF_MAXCHAN]; /* panning positions */
  8.1294 ++		UBYTE       chanvol[UF_MAXCHAN]; /* channel positions */
  8.1295 ++		UWORD       bpm;         /* current beats-per-minute speed */
  8.1296 ++		UWORD       sngspd;      /* current song speed */
  8.1297 ++		SWORD       volume;      /* song volume (0-128) (or user volume) */
  8.1298 ++
  8.1299 ++		BOOL        extspd;      /* extended speed flag (default enabled) */
  8.1300 ++		BOOL        panflag;     /* panning flag (default enabled) */
  8.1301 ++		BOOL        wrap;        /* wrap module ? (default disabled) */
  8.1302 ++		BOOL        loop;		 /* allow module to loop ? (default enabled) */
  8.1303 ++		BOOL        fadeout;	 /* volume fade out during last pattern */
  8.1304 ++
  8.1305 ++		UWORD       patpos;      /* current row number */
  8.1306 ++		SWORD       sngpos;      /* current song position */
  8.1307 ++		ULONG       sngtime;     /* current song time in 2^-10 seconds */
  8.1308 ++
  8.1309 ++		SWORD       relspd;      /* relative speed factor */
  8.1310 ++
  8.1311 ++	/* internal module representation */
  8.1312 ++		UWORD       numtrk;      /* number of tracks */
  8.1313 ++		UBYTE**     tracks;      /* array of numtrk pointers to tracks */
  8.1314 ++		UWORD*      patterns;    /* array of Patterns */
  8.1315 ++		UWORD*      pattrows;    /* array of number of rows for each pattern */
  8.1316 ++		UWORD*      positions;   /* all positions */
  8.1317 ++
  8.1318 ++		BOOL        forbid;      /* if true, no player update! */
  8.1319 ++		UWORD       numrow;      /* number of rows on current pattern */
  8.1320 ++		UWORD       vbtick;      /* tick counter (counts from 0 to sngspd) */
  8.1321 ++		UWORD       sngremainder;/* used for song time computation */
  8.1322 ++
  8.1323 ++struct MP_CONTROL*  control;     /* Effects Channel info (size pf->numchn) */
  8.1324 ++struct MP_VOICE*    voice;       /* Audio Voice information (size md_numchn) */
  8.1325 ++
  8.1326 ++		UBYTE       globalslide; /* global volume slide rate */
  8.1327 ++		UBYTE       pat_repcrazy;/* module has just looped to position -1 */
  8.1328 ++		UWORD       patbrk;      /* position where to start a new pattern */
  8.1329 ++		UBYTE       patdly;      /* patterndelay counter (command memory) */
  8.1330 ++		UBYTE       patdly2;     /* patterndelay counter (real one) */
  8.1331 ++		SWORD       posjmp;      /* flag to indicate a jump is needed... */
  8.1332 ++		UWORD		bpmlimit;	 /* threshold to detect bpm or speed values */
  8.1333 ++} MODULE;
  8.1334 ++
  8.1335 ++/*
  8.1336 ++ *	========== Module loaders
  8.1337 ++ */
  8.1338 ++
  8.1339 ++struct MLOADER;
  8.1340 ++
  8.1341 ++MIKMODAPI extern CHAR*   MikMod_InfoLoader(void);
  8.1342 ++MIKMODAPI extern void    MikMod_RegisterAllLoaders(void);
  8.1343 ++MIKMODAPI extern void    MikMod_RegisterLoader(struct MLOADER*);
  8.1344 ++
  8.1345 ++MIKMODAPI extern struct MLOADER load_669; /* 669 and Extended-669 (by Tran/Renaissance) */
  8.1346 ++MIKMODAPI extern struct MLOADER load_amf; /* DMP Advanced Module Format (by Otto Chrons) */
  8.1347 ++MIKMODAPI extern struct MLOADER load_dsm; /* DSIK internal module format */
  8.1348 ++MIKMODAPI extern struct MLOADER load_far; /* Farandole Composer (by Daniel Potter) */
  8.1349 ++MIKMODAPI extern struct MLOADER load_gdm; /* General DigiMusic (by Edward Schlunder) */
  8.1350 ++MIKMODAPI extern struct MLOADER load_it;  /* Impulse Tracker (by Jeffrey Lim) */
  8.1351 ++MIKMODAPI extern struct MLOADER load_imf; /* Imago Orpheus (by Lutz Roeder) */
  8.1352 ++MIKMODAPI extern struct MLOADER load_med; /* Amiga MED modules (by Teijo Kinnunen) */
  8.1353 ++MIKMODAPI extern struct MLOADER load_m15; /* Soundtracker 15-instrument */
  8.1354 ++MIKMODAPI extern struct MLOADER load_mod; /* Standard 31-instrument Module loader */
  8.1355 ++MIKMODAPI extern struct MLOADER load_mtm; /* Multi-Tracker Module (by Renaissance) */
  8.1356 ++MIKMODAPI extern struct MLOADER load_okt; /* Amiga Oktalyzer */
  8.1357 ++MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
  8.1358 ++MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
  8.1359 ++MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
  8.1360 ++MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
  8.1361 ++MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
  8.1362 ++MIKMODAPI extern struct MLOADER load_xm;  /* FastTracker 2 (by Triton) */
  8.1363 ++
  8.1364 ++/*
  8.1365 ++ *	========== Module player
  8.1366 ++ */
  8.1367 ++
  8.1368 ++MIKMODAPI extern MODULE* Player_Load(CHAR*,int,BOOL);
  8.1369 ++MIKMODAPI extern MODULE* Player_LoadFP(FILE*,int,BOOL);
  8.1370 ++MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,BOOL);
  8.1371 ++MIKMODAPI extern CHAR*   Player_LoadTitle(CHAR*);
  8.1372 ++MIKMODAPI extern CHAR*   Player_LoadTitleFP(FILE*);
  8.1373 ++MIKMODAPI extern void    Player_Free(MODULE*);
  8.1374 ++MIKMODAPI extern void    Player_Start(MODULE*);
  8.1375 ++MIKMODAPI extern BOOL    Player_Active(void);
  8.1376 ++MIKMODAPI extern void    Player_Stop(void);
  8.1377 ++MIKMODAPI extern void    Player_TogglePause(void);
  8.1378 ++MIKMODAPI extern BOOL    Player_Paused(void);
  8.1379 ++MIKMODAPI extern void    Player_NextPosition(void);
  8.1380 ++MIKMODAPI extern void    Player_PrevPosition(void);
  8.1381 ++MIKMODAPI extern void    Player_SetPosition(UWORD);
  8.1382 ++MIKMODAPI extern BOOL    Player_Muted(UBYTE);
  8.1383 ++MIKMODAPI extern void    Player_SetVolume(SWORD);
  8.1384 ++MIKMODAPI extern MODULE* Player_GetModule(void);
  8.1385 ++MIKMODAPI extern void    Player_SetSpeed(UWORD);
  8.1386 ++MIKMODAPI extern void    Player_SetTempo(UWORD);
  8.1387 ++MIKMODAPI extern void    Player_Unmute(SLONG,...);
  8.1388 ++MIKMODAPI extern void    Player_Mute(SLONG,...);
  8.1389 ++MIKMODAPI extern void    Player_ToggleMute(SLONG,...);
  8.1390 ++MIKMODAPI extern int     Player_GetChannelVoice(UBYTE);
  8.1391 ++MIKMODAPI extern UWORD   Player_GetChannelPeriod(UBYTE);
  8.1392 ++
  8.1393 ++typedef void (MikMod_player)(void);
  8.1394 ++typedef MikMod_player *MikMod_player_t;
  8.1395 ++
  8.1396 ++MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
  8.1397 ++
  8.1398 ++#define MUTE_EXCLUSIVE  32000
  8.1399 ++#define MUTE_INCLUSIVE  32001
  8.1400 ++
  8.1401 ++/*
  8.1402 ++ *	========== Drivers
  8.1403 ++ */
  8.1404 ++
  8.1405 ++enum {
  8.1406 ++	MD_MUSIC = 0,
  8.1407 ++	MD_SNDFX
  8.1408 ++};
  8.1409 ++
  8.1410 ++enum {
  8.1411 ++	MD_HARDWARE = 0,
  8.1412 ++	MD_SOFTWARE
  8.1413 ++};
  8.1414 ++
  8.1415 ++/* Mixing flags */
  8.1416 ++
  8.1417 ++/* These ones take effect only after MikMod_Init or MikMod_Reset */
  8.1418 ++#define DMODE_16BITS     0x0001 /* enable 16 bit output */
  8.1419 ++#define DMODE_STEREO     0x0002 /* enable stereo output */
  8.1420 ++#define DMODE_SOFT_SNDFX 0x0004 /* Process sound effects via software mixer */
  8.1421 ++#define DMODE_SOFT_MUSIC 0x0008 /* Process music via software mixer */
  8.1422 ++#define DMODE_HQMIXER    0x0010 /* Use high-quality (slower) software mixer */
  8.1423 ++/* These take effect immediately. */
  8.1424 ++#define DMODE_SURROUND   0x0100 /* enable surround sound */
  8.1425 ++#define DMODE_INTERP     0x0200 /* enable interpolation */
  8.1426 ++#define DMODE_REVERSE    0x0400 /* reverse stereo */
  8.1427 ++
  8.1428 ++struct SAMPLOAD;
  8.1429 ++typedef struct MDRIVER {
  8.1430 ++struct MDRIVER* next;
  8.1431 ++	CHAR*       Name;
  8.1432 ++	CHAR*       Version;
  8.1433 ++
  8.1434 ++	UBYTE       HardVoiceLimit; /* Limit of hardware mixer voices */
  8.1435 ++	UBYTE       SoftVoiceLimit; /* Limit of software mixer voices */
  8.1436 ++
  8.1437 ++	CHAR*       Alias;
  8.1438 ++
  8.1439 ++	void        (*CommandLine)      (CHAR*);
  8.1440 ++	BOOL        (*IsPresent)        (void);
  8.1441 ++	SWORD       (*SampleLoad)       (struct SAMPLOAD*,int);
  8.1442 ++	void        (*SampleUnload)     (SWORD);
  8.1443 ++	ULONG       (*FreeSampleSpace)  (int);
  8.1444 ++	ULONG       (*RealSampleLength) (int,struct SAMPLE*);
  8.1445 ++	BOOL        (*Init)             (void);
  8.1446 ++	void        (*Exit)             (void);
  8.1447 ++	BOOL        (*Reset)            (void);
  8.1448 ++	BOOL        (*SetNumVoices)     (void);
  8.1449 ++	BOOL        (*PlayStart)        (void);
  8.1450 ++	void        (*PlayStop)         (void);
  8.1451 ++	void        (*Update)           (void);
  8.1452 ++	void		(*Pause)			(void);
  8.1453 ++	void        (*VoiceSetVolume)   (UBYTE,UWORD);
  8.1454 ++	UWORD       (*VoiceGetVolume)   (UBYTE);
  8.1455 ++	void        (*VoiceSetFrequency)(UBYTE,ULONG);
  8.1456 ++	ULONG       (*VoiceGetFrequency)(UBYTE);
  8.1457 ++	void        (*VoiceSetPanning)  (UBYTE,ULONG);
  8.1458 ++	ULONG       (*VoiceGetPanning)  (UBYTE);
  8.1459 ++	void        (*VoicePlay)        (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
  8.1460 ++	void        (*VoiceStop)        (UBYTE);
  8.1461 ++	BOOL        (*VoiceStopped)     (UBYTE);
  8.1462 ++	SLONG       (*VoiceGetPosition) (UBYTE);
  8.1463 ++	ULONG       (*VoiceRealVolume)  (UBYTE);
  8.1464 ++} MDRIVER;
  8.1465 ++
  8.1466 ++/* These variables can be changed at ANY time and results will be immediate */
  8.1467 ++MIKMODAPI extern UBYTE md_volume;      /* global sound volume (0-128) */
  8.1468 ++MIKMODAPI extern UBYTE md_musicvolume; /* volume of song */
  8.1469 ++MIKMODAPI extern UBYTE md_sndfxvolume; /* volume of sound effects */
  8.1470 ++MIKMODAPI extern UBYTE md_reverb;      /* 0 = none;  15 = chaos */
  8.1471 ++MIKMODAPI extern UBYTE md_pansep;      /* 0 = mono;  128 == 100% (full left/right) */
  8.1472 ++
  8.1473 ++/* The variables below can be changed at any time, but changes will not be
  8.1474 ++   implemented until MikMod_Reset is called. A call to MikMod_Reset may result
  8.1475 ++   in a skip or pop in audio (depending on the soundcard driver and the settings
  8.1476 ++   changed). */
  8.1477 ++MIKMODAPI extern UWORD md_device;      /* device */
  8.1478 ++MIKMODAPI extern UWORD md_mixfreq;     /* mixing frequency */
  8.1479 ++MIKMODAPI extern UWORD md_mode;        /* mode. See DMODE_? flags above */
  8.1480 ++
  8.1481 ++/* The following variable should not be changed! */
  8.1482 ++MIKMODAPI extern MDRIVER* md_driver;   /* Current driver in use. */
  8.1483 ++
  8.1484 ++/* Known drivers list */
  8.1485 ++
  8.1486 ++MIKMODAPI extern struct MDRIVER drv_nos;    /* no sound */
  8.1487 ++MIKMODAPI extern struct MDRIVER drv_pipe;   /* piped output */
  8.1488 ++MIKMODAPI extern struct MDRIVER drv_raw;    /* raw file disk writer [music.raw] */
  8.1489 ++MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
  8.1490 ++MIKMODAPI extern struct MDRIVER drv_wav;    /* RIFF WAVE file disk writer [music.wav] */
  8.1491 ++
  8.1492 ++MIKMODAPI extern struct MDRIVER drv_ultra;  /* Linux Ultrasound driver */
  8.1493 ++MIKMODAPI extern struct MDRIVER drv_sam9407;	/* Linux sam9407 driver */
  8.1494 ++
  8.1495 ++MIKMODAPI extern struct MDRIVER drv_AF;     /* Dec Alpha AudioFile */
  8.1496 ++MIKMODAPI extern struct MDRIVER drv_aix;    /* AIX audio device */
  8.1497 ++MIKMODAPI extern struct MDRIVER drv_alsa;   /* Advanced Linux Sound Architecture (ALSA) */
  8.1498 ++MIKMODAPI extern struct MDRIVER drv_esd;    /* Enlightened sound daemon (EsounD) */
  8.1499 ++MIKMODAPI extern struct MDRIVER drv_hp;     /* HP-UX audio device */
  8.1500 ++MIKMODAPI extern struct MDRIVER drv_oss;    /* OpenSound System (Linux,FreeBSD...) */
  8.1501 ++MIKMODAPI extern struct MDRIVER drv_sgi;    /* SGI audio library */
  8.1502 ++MIKMODAPI extern struct MDRIVER drv_sun;    /* Sun/NetBSD/OpenBSD audio device */
  8.1503 ++
  8.1504 ++MIKMODAPI extern struct MDRIVER drv_dart;   /* OS/2 Direct Audio RealTime */
  8.1505 ++MIKMODAPI extern struct MDRIVER drv_os2;    /* OS/2 MMPM/2 */
  8.1506 ++
  8.1507 ++MIKMODAPI extern struct MDRIVER drv_ds;     /* Win32 DirectSound driver */
  8.1508 ++MIKMODAPI extern struct MDRIVER drv_win;    /* Win32 multimedia API driver */
  8.1509 ++
  8.1510 ++MIKMODAPI extern struct MDRIVER drv_mac;    /* Macintosh Sound Manager driver */
  8.1511 ++
  8.1512 ++/*========== Virtual channel mixer interface (for user-supplied drivers only) */
  8.1513 ++
  8.1514 ++MIKMODAPI extern BOOL  VC_Init(void);
  8.1515 ++MIKMODAPI extern void  VC_Exit(void);
  8.1516 ++MIKMODAPI extern BOOL  VC_SetNumVoices(void);
  8.1517 ++MIKMODAPI extern ULONG VC_SampleSpace(int);
  8.1518 ++MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
  8.1519 ++
  8.1520 ++MIKMODAPI extern BOOL  VC_PlayStart(void);
  8.1521 ++MIKMODAPI extern void  VC_PlayStop(void);
  8.1522 ++
  8.1523 ++MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);
  8.1524 ++MIKMODAPI extern void  VC_SampleUnload(SWORD);
  8.1525 ++
  8.1526 ++MIKMODAPI extern ULONG VC_WriteBytes(SBYTE*,ULONG);
  8.1527 ++MIKMODAPI extern ULONG VC_SilenceBytes(SBYTE*,ULONG);
  8.1528 ++
  8.1529 ++MIKMODAPI extern void  VC_VoiceSetVolume(UBYTE,UWORD);
  8.1530 ++MIKMODAPI extern UWORD VC_VoiceGetVolume(UBYTE);
  8.1531 ++MIKMODAPI extern void  VC_VoiceSetFrequency(UBYTE,ULONG);
  8.1532 ++MIKMODAPI extern ULONG VC_VoiceGetFrequency(UBYTE);
  8.1533 ++MIKMODAPI extern void  VC_VoiceSetPanning(UBYTE,ULONG);
  8.1534 ++MIKMODAPI extern ULONG VC_VoiceGetPanning(UBYTE);
  8.1535 ++MIKMODAPI extern void  VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
  8.1536 ++
  8.1537 ++MIKMODAPI extern void  VC_VoiceStop(UBYTE);
  8.1538 ++MIKMODAPI extern BOOL  VC_VoiceStopped(UBYTE);
  8.1539 ++MIKMODAPI extern SLONG VC_VoiceGetPosition(UBYTE);
  8.1540 ++MIKMODAPI extern ULONG VC_VoiceRealVolume(UBYTE);
  8.1541 ++
  8.1542 ++#ifdef __cplusplus
  8.1543 ++}
  8.1544 ++#endif
  8.1545 ++
  8.1546 ++#endif
  8.1547 ++
  8.1548 ++/* ex:set ts=4: */
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/external/libogg-1.3.1/include/ogg/config_types.h	Sat Jun 01 22:16:14 2013 -0700
     9.3 @@ -0,0 +1,25 @@
     9.4 +#ifndef __CONFIG_TYPES_H__
     9.5 +#define __CONFIG_TYPES_H__
     9.6 +
     9.7 +/* these are filled in by configure */
     9.8 +#define INCLUDE_INTTYPES_H 1
     9.9 +#define INCLUDE_STDINT_H 1
    9.10 +#define INCLUDE_SYS_TYPES_H 1
    9.11 +
    9.12 +#if INCLUDE_INTTYPES_H
    9.13 +#  include <inttypes.h>
    9.14 +#endif
    9.15 +#if INCLUDE_STDINT_H
    9.16 +#  include <stdint.h>
    9.17 +#endif
    9.18 +#if INCLUDE_SYS_TYPES_H
    9.19 +#  include <sys/types.h>
    9.20 +#endif
    9.21 +
    9.22 +typedef int16_t ogg_int16_t;
    9.23 +typedef uint16_t ogg_uint16_t;
    9.24 +typedef int32_t ogg_int32_t;
    9.25 +typedef uint32_t ogg_uint32_t;
    9.26 +typedef int64_t ogg_int64_t;
    9.27 +
    9.28 +#endif
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/external/libvorbisidec-1.2.1.patch	Sat Jun 01 22:16:14 2013 -0700
    10.3 @@ -0,0 +1,11 @@
    10.4 +diff -ruN libvorbisidec-1.2.1/misc.h libvorbisidec-1.2.1.new/misc.h
    10.5 +--- libvorbisidec-1.2.1/misc.h	2013-06-01 21:02:13.000000000 -0700
    10.6 ++++ libvorbisidec-1.2.1.new/misc.h	2013-06-01 21:02:00.000000000 -0700
    10.7 +@@ -30,6 +30,7 @@
    10.8 + 
    10.9 + #include "asm_arm.h"
   10.10 + #include <stdlib.h> /* for abs() */
   10.11 ++#include <endian.h>
   10.12 +   
   10.13 + #ifndef _V_WIDE_MATH
   10.14 + #define _V_WIDE_MATH
    11.1 --- a/external/libvorbisidec-1.2.1/misc.h	Sat Jun 01 19:52:15 2013 -0700
    11.2 +++ b/external/libvorbisidec-1.2.1/misc.h	Sat Jun 01 22:16:14 2013 -0700
    11.3 @@ -30,6 +30,7 @@
    11.4  
    11.5  #include "asm_arm.h"
    11.6  #include <stdlib.h> /* for abs() */
    11.7 +#include <endian.h>
    11.8    
    11.9  #ifndef _V_WIDE_MATH
   11.10  #define _V_WIDE_MATH
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/external/smpeg2-2.0.0/Android.mk	Sat Jun 01 22:16:14 2013 -0700
    12.3 @@ -0,0 +1,42 @@
    12.4 +LOCAL_PATH := $(call my-dir)
    12.5 +
    12.6 +include $(CLEAR_VARS)
    12.7 +
    12.8 +LOCAL_MODULE := smpeg2
    12.9 +
   12.10 +LOCAL_C_INCLUDES := $(NDK_PROJECT_PATH)/jni/SDL/include
   12.11 +LOCAL_CFLAGS := -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -D_THREAD_SAFE -DTHREADED_AUDIO -DNOCONTROLS
   12.12 +
   12.13 +LOCAL_SRC_FILES := \
   12.14 +    smpeg.cpp \
   12.15 +    MPEG.cpp \
   12.16 +    MPEGlist.cpp \
   12.17 +    MPEGring.cpp \
   12.18 +    MPEGstream.cpp \
   12.19 +    MPEGsystem.cpp \
   12.20 +    audio/MPEGaudio.cpp \
   12.21 +    audio/bitwindow.cpp \
   12.22 +    audio/filter.cpp \
   12.23 +    audio/filter_2.cpp \
   12.24 +    audio/hufftable.cpp \
   12.25 +    audio/mpeglayer1.cpp \
   12.26 +    audio/mpeglayer2.cpp \
   12.27 +    audio/mpeglayer3.cpp \
   12.28 +    audio/mpegtable.cpp \
   12.29 +    audio/mpegtoraw.cpp \
   12.30 +    video/MPEGvideo.cpp \
   12.31 +    video/decoders.cpp \
   12.32 +    video/floatdct.cpp \
   12.33 +    video/gdith.cpp \
   12.34 +    video/jrevdct.cpp \
   12.35 +    video/motionvec.cpp \
   12.36 +    video/parseblock.cpp \
   12.37 +    video/readfile.cpp \
   12.38 +    video/util.cpp \
   12.39 +    video/video.cpp
   12.40 +
   12.41 +LOCAL_LDLIBS :=
   12.42 +LOCAL_STATIC_LIBRARIES :=
   12.43 +LOCAL_SHARED_LIBRARIES := SDL2
   12.44 +
   12.45 +include $(BUILD_SHARED_LIBRARY)
    13.1 --- a/music_ogg.h	Sat Jun 01 19:52:15 2013 -0700
    13.2 +++ b/music_ogg.h	Sat Jun 01 22:16:14 2013 -0700
    13.3 @@ -26,7 +26,7 @@
    13.4  /* This file supports Ogg Vorbis music streams */
    13.5  
    13.6  #ifdef OGG_USE_TREMOR
    13.7 -#include <tremor/ivorbisfile.h>
    13.8 +#include <ivorbisfile.h>
    13.9  #else
   13.10  #include <vorbis/vorbisfile.h>
   13.11  #endif