Skip to content

Commit

Permalink
backported SDLCALL updates. (from 2.0 branch commit aef7a1784ffd).
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Oct 7, 2018
1 parent 03bd4ca commit 07bd386
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
14 changes: 7 additions & 7 deletions SDL_mixer.h
Expand Up @@ -200,19 +200,19 @@ extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music);
This can be used to provide real-time visual display of the audio stream
or add a custom mixer filter for the stream data.
*/
extern DECLSPEC void SDLCALL Mix_SetPostMix(void (*mix_func)
extern DECLSPEC void SDLCALL Mix_SetPostMix(void (SDLCALL *mix_func)
(void *udata, Uint8 *stream, int len), void *arg);

/* Add your own music player or additional mixer function.
If 'mix_func' is NULL, the default music player is re-enabled.
*/
extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func)
extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func)
(void *udata, Uint8 *stream, int len), void *arg);

/* Add your own callback when the music has finished playing.
This callback is only called if the music finishes naturally.
*/
extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (*music_finished)(void));
extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (SDLCALL *music_finished)(void));

/* Get a pointer to the user data for the current music hook */
extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void);
Expand All @@ -225,7 +225,7 @@ extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void);
* inside the audio callback, or SDL_mixer will explicitly lock the audio
* before calling your callback.
*/
extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel));
extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel));


/* Special Effects API by ryan c. gordon. (icculus@icculus.org) */
Expand All @@ -249,7 +249,7 @@ extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int ch
*
* DO NOT EVER call SDL_LockAudio() from your callback function!
*/
typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata);
typedef void (SDLCALL *Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata);

/*
* This is a callback that signifies that a channel has finished all its
Expand All @@ -260,7 +260,7 @@ typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata);
*
* DO NOT EVER call SDL_LockAudio() from your callback function!
*/
typedef void (*Mix_EffectDone_t)(int chan, void *udata);
typedef void (SDLCALL *Mix_EffectDone_t)(int chan, void *udata);


/* Register a special effect function. At mixing time, the channel data is
Expand Down Expand Up @@ -611,7 +611,7 @@ extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void);
/* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */
extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths);
extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void);
extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (*function)(const char*, void*), void *data);
extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data);

/* Get the Mix_Chunk currently associated with a mixer channel
Returns NULL if it's an invalid channel, or there's no chunk associated.
Expand Down
42 changes: 21 additions & 21 deletions effect_position.c
Expand Up @@ -98,7 +98,7 @@ void _Eff_PositionDeinit(void)


/* This just frees up the callback-specific data. */
static void _Eff_PositionDone(int channel, void *udata)
static void SDLCALL _Eff_PositionDone(int channel, void *udata)
{
if (channel < 0) {
if (pos_args_global != NULL) {
Expand All @@ -114,7 +114,7 @@ static void _Eff_PositionDone(int channel, void *udata)
}


static void _Eff_position_u8(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Uint8 *ptr = (Uint8 *) stream;
Expand Down Expand Up @@ -151,7 +151,7 @@ static void _Eff_position_u8(int chan, void *stream, int len, void *udata)
ptr++;
}
}
static void _Eff_position_u8_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Uint8 *ptr = (Uint8 *) stream;
Expand Down Expand Up @@ -235,7 +235,7 @@ static void _Eff_position_u8_c4(int chan, void *stream, int len, void *udata)
}


static void _Eff_position_u8_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Uint8 *ptr = (Uint8 *) stream;
Expand Down Expand Up @@ -357,7 +357,7 @@ static void _Eff_position_u8_c6(int chan, void *stream, int len, void *udata)
* in case the user has called Mix_SetPanning() or whatnot again while this
* callback is running.
*/
static void _Eff_position_table_u8(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_table_u8(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Uint8 *ptr = (Uint8 *) stream;
Expand Down Expand Up @@ -406,7 +406,7 @@ static void _Eff_position_table_u8(int chan, void *stream, int len, void *udata)
}


static void _Eff_position_s8(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s8(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Sint8 *ptr = (Sint8 *) stream;
Expand Down Expand Up @@ -438,7 +438,7 @@ static void _Eff_position_s8(int chan, void *stream, int len, void *udata)
ptr++;
}
}
static void _Eff_position_s8_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s8_c4(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Sint8 *ptr = (Sint8 *) stream;
Expand Down Expand Up @@ -484,7 +484,7 @@ static void _Eff_position_s8_c4(int chan, void *stream, int len, void *udata)
}
}
}
static void _Eff_position_s8_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Sint8 *ptr = (Sint8 *) stream;
Expand Down Expand Up @@ -551,7 +551,7 @@ static void _Eff_position_s8_c6(int chan, void *stream, int len, void *udata)
* in case the user has called Mix_SetPanning() or whatnot again while this
* callback is running.
*/
static void _Eff_position_table_s8(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_table_s8(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Sint8 *ptr = (Sint8 *) stream;
Expand Down Expand Up @@ -601,7 +601,7 @@ static void _Eff_position_table_s8(int chan, void *stream, int len, void *udata)

/* !!! FIXME : Optimize the code for 16-bit samples? */

static void _Eff_position_u16lsb(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u16lsb(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Uint16 *ptr = (Uint16 *) stream;
Expand All @@ -626,7 +626,7 @@ static void _Eff_position_u16lsb(int chan, void *stream, int len, void *udata)
}
}
}
static void _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Uint16 *ptr = (Uint16 *) stream;
Expand Down Expand Up @@ -675,7 +675,7 @@ static void _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata
}
}
}
static void _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata)
{
volatile position_args *args = (volatile position_args *) udata;
Uint16 *ptr = (Uint16 *) stream;
Expand Down Expand Up @@ -739,7 +739,7 @@ static void _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_s16lsb(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s16lsb(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 2 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -768,7 +768,7 @@ static void _Eff_position_s16lsb(int chan, void *stream, int len, void *udata)
}
}
}
static void _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 4 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -813,7 +813,7 @@ static void _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 6 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -870,7 +870,7 @@ static void _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_u16msb(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u16msb(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 2 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand All @@ -896,7 +896,7 @@ static void _Eff_position_u16msb(int chan, void *stream, int len, void *udata)
}
}
}
static void _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 4 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -946,7 +946,7 @@ static void _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata
}
}
}
static void _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 6 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1011,7 +1011,7 @@ static void _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_s16msb(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s16msb(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 2 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand All @@ -1027,7 +1027,7 @@ static void _Eff_position_s16msb(int chan, void *stream, int len, void *udata)
*(ptr++) = (Sint16) SDL_SwapBE16(swapr);
}
}
static void _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 4 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1071,7 +1071,7 @@ static void _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata
}
}
}
static void _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata)
{
/* 16 signed bits (lsb) * 6 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down
4 changes: 2 additions & 2 deletions effect_stereoreverse.c
Expand Up @@ -55,7 +55,7 @@
* Stereo reversal effect...this one's pretty straightforward...
*/

static void _Eff_reversestereo16(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_reversestereo16(int chan, void *stream, int len, void *udata)
{
/* 16 bits * 2 channels. */
Uint32 *ptr = (Uint32 *) stream;
Expand All @@ -67,7 +67,7 @@ static void _Eff_reversestereo16(int chan, void *stream, int len, void *udata)
}


static void _Eff_reversestereo8(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_reversestereo8(int chan, void *stream, int len, void *udata)
{
/* 8 bits * 2 channels. */
Uint32 *ptr = (Uint32 *) stream;
Expand Down
4 changes: 2 additions & 2 deletions fluidsynth.c
Expand Up @@ -34,7 +34,7 @@ static Uint16 format;
static Uint8 channels;
static int freq;

int fluidsynth_check_soundfont(const char *path, void *data)
int SDLCALL fluidsynth_check_soundfont(const char *path, void *data)
{
FILE *file = fopen(path, "r");

Expand All @@ -47,7 +47,7 @@ int fluidsynth_check_soundfont(const char *path, void *data)
}
}

int fluidsynth_load_soundfont(const char *path, void *data)
int SDLCALL fluidsynth_load_soundfont(const char *path, void *data)
{
/* If this fails, it's too late to try Timidity so pray that at least one works. */
fluidsynth.fluid_synth_sfload((fluid_synth_t*) data, path, 1);
Expand Down
14 changes: 7 additions & 7 deletions mixer.c
Expand Up @@ -86,20 +86,20 @@ static int reserved_channels = 0;


/* Support for hooking into the mixer callback system */
static void (*mix_postmix)(void *udata, Uint8 *stream, int len) = NULL;
static void (SDLCALL *mix_postmix)(void *udata, Uint8 *stream, int len) = NULL;
static void *mix_postmix_data = NULL;

/* rcg07062001 callback to alert when channels are done playing. */
static void (*channel_done_callback)(int channel) = NULL;
static void (SDLCALL *channel_done_callback)(int channel) = NULL;

/* Music function declarations */
extern int open_music(SDL_AudioSpec *mixer);
extern void close_music(void);

/* Support for user defined music functions, plus the default one */
extern int volatile music_active;
extern void music_mixer(void *udata, Uint8 *stream, int len);
static void (*mix_music)(void *udata, Uint8 *stream, int len) = music_mixer;
extern void SDLCALL music_mixer(void *udata, Uint8 *stream, int len);
static void (SDLCALL *mix_music)(void *udata, Uint8 *stream, int len) = music_mixer;
static void *music_data = NULL;

/* rcg06042009 report available decoders at runtime. */
Expand Down Expand Up @@ -760,7 +760,7 @@ void Mix_FreeChunk(Mix_Chunk *chunk)
This can be used to provide real-time visual display of the audio stream
or add a custom mixer filter for the stream data.
*/
void Mix_SetPostMix(void (*mix_func)
void Mix_SetPostMix(void (SDLCALL *mix_func)
(void *udata, Uint8 *stream, int len), void *arg)
{
SDL_LockAudio();
Expand All @@ -772,7 +772,7 @@ void Mix_SetPostMix(void (*mix_func)
/* Add your own music player or mixer function.
If 'mix_func' is NULL, the default music player is re-enabled.
*/
void Mix_HookMusic(void (*mix_func)(void *udata, Uint8 *stream, int len),
void Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len),
void *arg)
{
SDL_LockAudio();
Expand All @@ -791,7 +791,7 @@ void *Mix_GetMusicHookData(void)
return(music_data);
}

void Mix_ChannelFinished(void (*channel_finished)(int channel))
void Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel))
{
SDL_LockAudio();
channel_done_callback = channel_finished;
Expand Down
8 changes: 4 additions & 4 deletions music.c
Expand Up @@ -181,9 +181,9 @@ static void music_internal_halt(void);


/* Support for hooking when the music has finished */
static void (*music_finished_hook)(void) = NULL;
static void (SDLCALL *music_finished_hook)(void) = NULL;

void Mix_HookMusicFinished(void (*music_finished)(void))
void Mix_HookMusicFinished(void (SDLCALL *music_finished)(void))
{
SDL_LockAudio();
music_finished_hook = music_finished;
Expand Down Expand Up @@ -231,7 +231,7 @@ static int music_halt_or_loop (void)


/* Mixing function */
void music_mixer(void *udata, Uint8 *stream, int len)
void SDLCALL music_mixer(void *udata, Uint8 *stream, int len)
{
int left = 0;

Expand Down Expand Up @@ -1567,7 +1567,7 @@ const char* Mix_GetSoundFonts(void)
}
}

int Mix_EachSoundFont(int (*function)(const char*, void*), void *data)
int Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data)
{
char *context, *path, *paths;
const char* cpaths = Mix_GetSoundFonts();
Expand Down
2 changes: 1 addition & 1 deletion playwave.c
Expand Up @@ -134,7 +134,7 @@ static void test_versions(void)

#ifdef TEST_MIX_CHANNELFINISHED /* rcg06072001 */
static volatile int channel_is_done = 0;
static void channel_complete_callback(int chan)
static void SDLCALL channel_complete_callback (int chan)
{
Mix_Chunk *done_chunk = Mix_GetChunk(chan);
fprintf(stderr, "We were just alerted that Mixer channel #%d is done.\n", chan);
Expand Down

0 comments on commit 07bd386

Please sign in to comment.