misc/winutils/include/SDL_mixer.h
changeset 10017 de822cd3df3a
parent 7809 7d4fb2f35f4f
equal deleted inserted replaced
10015:4feced261c68 10017:de822cd3df3a
    36 extern "C" {
    36 extern "C" {
    37 #endif
    37 #endif
    38 
    38 
    39 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
    39 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
    40 */
    40 */
    41 #define SDL_MIXER_MAJOR_VERSION	1
    41 #define SDL_MIXER_MAJOR_VERSION 1
    42 #define SDL_MIXER_MINOR_VERSION	2
    42 #define SDL_MIXER_MINOR_VERSION 2
    43 #define SDL_MIXER_PATCHLEVEL    12
    43 #define SDL_MIXER_PATCHLEVEL    12
    44 
    44 
    45 /* This macro can be used to fill a version structure with the compile-time
    45 /* This macro can be used to fill a version structure with the compile-time
    46  * version of the SDL_mixer library.
    46  * version of the SDL_mixer library.
    47  */
    47  */
    48 #define SDL_MIXER_VERSION(X)						\
    48 #define SDL_MIXER_VERSION(X)                        \
    49 {									\
    49 {                                   \
    50 	(X)->major = SDL_MIXER_MAJOR_VERSION;				\
    50     (X)->major = SDL_MIXER_MAJOR_VERSION;               \
    51 	(X)->minor = SDL_MIXER_MINOR_VERSION;				\
    51     (X)->minor = SDL_MIXER_MINOR_VERSION;               \
    52 	(X)->patch = SDL_MIXER_PATCHLEVEL;				\
    52     (X)->patch = SDL_MIXER_PATCHLEVEL;              \
    53 }
    53 }
    54 
    54 
    55 /* Backwards compatibility */
    55 /* Backwards compatibility */
    56 #define MIX_MAJOR_VERSION	SDL_MIXER_MAJOR_VERSION
    56 #define MIX_MAJOR_VERSION   SDL_MIXER_MAJOR_VERSION
    57 #define MIX_MINOR_VERSION	SDL_MIXER_MINOR_VERSION
    57 #define MIX_MINOR_VERSION   SDL_MIXER_MINOR_VERSION
    58 #define MIX_PATCHLEVEL		SDL_MIXER_PATCHLEVEL
    58 #define MIX_PATCHLEVEL      SDL_MIXER_PATCHLEVEL
    59 #define MIX_VERSION(X)		SDL_MIXER_VERSION(X)
    59 #define MIX_VERSION(X)      SDL_MIXER_VERSION(X)
    60 
    60 
    61 /* This function gets the version of the dynamically linked SDL_mixer library.
    61 /* This function gets the version of the dynamically linked SDL_mixer library.
    62    it should NOT be used to fill a version structure, instead you should
    62    it should NOT be used to fill a version structure, instead you should
    63    use the SDL_MIXER_VERSION() macro.
    63    use the SDL_MIXER_VERSION() macro.
    64  */
    64  */
    83 extern DECLSPEC void SDLCALL Mix_Quit(void);
    83 extern DECLSPEC void SDLCALL Mix_Quit(void);
    84 
    84 
    85 
    85 
    86 /* The default mixer has 8 simultaneous mixing channels */
    86 /* The default mixer has 8 simultaneous mixing channels */
    87 #ifndef MIX_CHANNELS
    87 #ifndef MIX_CHANNELS
    88 #define MIX_CHANNELS	8
    88 #define MIX_CHANNELS    8
    89 #endif
    89 #endif
    90 
    90 
    91 /* Good default values for a PC soundcard */
    91 /* Good default values for a PC soundcard */
    92 #define MIX_DEFAULT_FREQUENCY	22050
    92 #define MIX_DEFAULT_FREQUENCY   22050
    93 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
    93 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
    94 #define MIX_DEFAULT_FORMAT	AUDIO_S16LSB
    94 #define MIX_DEFAULT_FORMAT  AUDIO_S16LSB
    95 #else
    95 #else
    96 #define MIX_DEFAULT_FORMAT	AUDIO_S16MSB
    96 #define MIX_DEFAULT_FORMAT  AUDIO_S16MSB
    97 #endif
    97 #endif
    98 #define MIX_DEFAULT_CHANNELS	2
    98 #define MIX_DEFAULT_CHANNELS    2
    99 #define MIX_MAX_VOLUME		128	/* Volume of a chunk */
    99 #define MIX_MAX_VOLUME      128 /* Volume of a chunk */
   100 
   100 
   101 /* The internal format for an audio chunk */
   101 /* The internal format for an audio chunk */
   102 typedef struct Mix_Chunk {
   102 typedef struct Mix_Chunk {
   103 	int allocated;
   103     int allocated;
   104 	Uint8 *abuf;
   104     Uint8 *abuf;
   105 	Uint32 alen;
   105     Uint32 alen;
   106 	Uint8 volume;		/* Per-sample volume, 0-128 */
   106     Uint8 volume;       /* Per-sample volume, 0-128 */
   107 } Mix_Chunk;
   107 } Mix_Chunk;
   108 
   108 
   109 /* The different fading types supported */
   109 /* The different fading types supported */
   110 typedef enum {
   110 typedef enum {
   111 	MIX_NO_FADING,
   111     MIX_NO_FADING,
   112 	MIX_FADING_OUT,
   112     MIX_FADING_OUT,
   113 	MIX_FADING_IN
   113     MIX_FADING_IN
   114 } Mix_Fading;
   114 } Mix_Fading;
   115 
   115 
   116 typedef enum {
   116 typedef enum {
   117 	MUS_NONE,
   117     MUS_NONE,
   118 	MUS_CMD,
   118     MUS_CMD,
   119 	MUS_WAV,
   119     MUS_WAV,
   120 	MUS_MOD,
   120     MUS_MOD,
   121 	MUS_MID,
   121     MUS_MID,
   122 	MUS_OGG,
   122     MUS_OGG,
   123 	MUS_MP3,
   123     MUS_MP3,
   124 	MUS_MP3_MAD,
   124     MUS_MP3_MAD,
   125 	MUS_FLAC,
   125     MUS_FLAC,
   126 	MUS_MODPLUG
   126     MUS_MODPLUG
   127 } Mix_MusicType;
   127 } Mix_MusicType;
   128 
   128 
   129 /* The internal format for a music chunk interpreted via mikmod */
   129 /* The internal format for a music chunk interpreted via mikmod */
   130 typedef struct _Mix_Music Mix_Music;
   130 typedef struct _Mix_Music Mix_Music;
   131 
   131 
   132 /* Open the mixer with a certain audio format */
   132 /* Open the mixer with a certain audio format */
   133 extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels,
   133 extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels,
   134 							int chunksize);
   134                             int chunksize);
   135 
   135 
   136 /* Dynamically change the number of channels managed by the mixer.
   136 /* Dynamically change the number of channels managed by the mixer.
   137    If decreasing the number of channels, the upper channels are
   137    If decreasing the number of channels, the upper channels are
   138    stopped.
   138    stopped.
   139    This function returns the new number of allocated channels.
   139    This function returns the new number of allocated channels.
   145  */
   145  */
   146 extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels);
   146 extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels);
   147 
   147 
   148 /* Load a wave file or a music (.mod .s3m .it .xm) file */
   148 /* Load a wave file or a music (.mod .s3m .it .xm) file */
   149 extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc);
   149 extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc);
   150 #define Mix_LoadWAV(file)	Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
   150 #define Mix_LoadWAV(file)   Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
   151 extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file);
   151 extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file);
   152 
   152 
   153 /* Load a music file from an SDL_RWop object (Ogg and MikMod specific currently)
   153 /* Load a music file from an SDL_RWop object (Ogg and MikMod specific currently)
   154    Matt Campbell (matt@campbellhome.dhs.org) April 2000 */
   154    Matt Campbell (matt@campbellhome.dhs.org) April 2000 */
   155 extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *rw);
   155 extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *rw);
   217 /* Get a pointer to the user data for the current music hook */
   217 /* Get a pointer to the user data for the current music hook */
   218 extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void);
   218 extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void);
   219 
   219 
   220 /*
   220 /*
   221  * Add your own callback when a channel has finished playing. NULL
   221  * Add your own callback when a channel has finished playing. NULL
   222  *  to disable callback. The callback may be called from the mixer's audio 
   222  *  to disable callback. The callback may be called from the mixer's audio
   223  *  callback or it could be called as a result of Mix_HaltChannel(), etc.
   223  *  callback or it could be called as a result of Mix_HaltChannel(), etc.
   224  *  do not call SDL_LockAudio() from this callback; you will either be 
   224  *  do not call SDL_LockAudio() from this callback; you will either be
   225  *  inside the audio callback, or SDL_mixer will explicitly lock the audio
   225  *  inside the audio callback, or SDL_mixer will explicitly lock the audio
   226  *  before calling your callback.
   226  *  before calling your callback.
   227  */
   227  */
   228 extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel));
   228 extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel));
   229 
   229 
   300  *  will be told that the channel being mixed is (MIX_CHANNEL_POST) if the
   300  *  will be told that the channel being mixed is (MIX_CHANNEL_POST) if the
   301  *  processing is considered a posteffect.
   301  *  processing is considered a posteffect.
   302  *
   302  *
   303  * After all these effects have finished processing, the callback registered
   303  * After all these effects have finished processing, the callback registered
   304  *  through Mix_SetPostMix() runs, and then the stream goes to the audio
   304  *  through Mix_SetPostMix() runs, and then the stream goes to the audio
   305  *  device. 
   305  *  device.
   306  *
   306  *
   307  * DO NOT EVER call SDL_LockAudio() from your callback function!
   307  * DO NOT EVER call SDL_LockAudio() from your callback function!
   308  *
   308  *
   309  * returns zero if error (no such channel), nonzero if added.
   309  * returns zero if error (no such channel), nonzero if added.
   310  *  Error messages can be retrieved from Mix_GetError().
   310  *  Error messages can be retrieved from Mix_GetError().
   311  */
   311  */
   312 extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f,
   312 extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f,
   313 					Mix_EffectDone_t d, void *arg);
   313                     Mix_EffectDone_t d, void *arg);
   314 
   314 
   315 
   315 
   316 /* You may not need to call this explicitly, unless you need to stop an
   316 /* You may not need to call this explicitly, unless you need to stop an
   317  *  effect from processing in the middle of a chunk's playback.
   317  *  effect from processing in the middle of a chunk's playback.
   318  * Posteffects are never implicitly unregistered as they are for channels,
   318  * Posteffects are never implicitly unregistered as they are for channels,
   588 extern DECLSPEC int SDLCALL Mix_PausedMusic(void);
   588 extern DECLSPEC int SDLCALL Mix_PausedMusic(void);
   589 
   589 
   590 /* Set the current position in the music stream.
   590 /* Set the current position in the music stream.
   591    This returns 0 if successful, or -1 if it failed or isn't implemented.
   591    This returns 0 if successful, or -1 if it failed or isn't implemented.
   592    This function is only implemented for MOD music formats (set pattern
   592    This function is only implemented for MOD music formats (set pattern
   593    order number) and for OGG, FLAC, MP3_MAD, and MODPLUG music (set 
   593    order number) and for OGG, FLAC, MP3_MAD, and MODPLUG music (set
   594    position in seconds), at the moment.
   594    position in seconds), at the moment.
   595 */
   595 */
   596 extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position);
   596 extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position);
   597 
   597 
   598 /* Check the status of a specific channel.
   598 /* Check the status of a specific channel.
   620 
   620 
   621 /* Close the mixer, halting all playing audio */
   621 /* Close the mixer, halting all playing audio */
   622 extern DECLSPEC void SDLCALL Mix_CloseAudio(void);
   622 extern DECLSPEC void SDLCALL Mix_CloseAudio(void);
   623 
   623 
   624 /* We'll use SDL for reporting errors */
   624 /* We'll use SDL for reporting errors */
   625 #define Mix_SetError	SDL_SetError
   625 #define Mix_SetError    SDL_SetError
   626 #define Mix_GetError	SDL_GetError
   626 #define Mix_GetError    SDL_GetError
   627 
   627 
   628 /* Ends C function definitions when using C++ */
   628 /* Ends C function definitions when using C++ */
   629 #ifdef __cplusplus
   629 #ifdef __cplusplus
   630 }
   630 }
   631 #endif
   631 #endif