Skip to content

Commit d2f1562

Browse files
committed
Remove obsolete SDL2_mixer macros
SDL2_Mixer v2.6.0 promoted some identifiers from C preprocessor macros to proper functions. This commit removes Pascal functions that imitated said macros and replaces them with external function declarations.
1 parent cdfdd40 commit d2f1562

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

units/sdl2_mixer.pas

+5-18
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function Mix_QuerySpec(frequency: pcint; format: pcuint16; channels: pcint): cin
196196

197197
{* Load a wave file or a music (.mod .s3m .it .xm) file *}
198198
function Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: cint): PMix_Chunk cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_LoadWAV_RW' {$ENDIF} {$ENDIF};
199-
function Mix_LoadWAV(_file: PAnsiChar): PMix_Chunk;
199+
function Mix_LoadWAV(_file: PAnsiChar): PMix_Chunk cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_LoadWAV' {$ENDIF} {$ENDIF};
200200
function Mix_LoadMUS(_file: PAnsiChar): PMix_Music cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_LoadMUS' {$ENDIF} {$ENDIF};
201201

202202
{* Load a music file from an SDL_RWop object (Ogg and MikMod specific currently)
@@ -651,15 +651,17 @@ function Mix_GroupNewer(tag: cint): cint cdecl; external MIX_LibName {$IFDEF DEL
651651
If 'loops' is -1, loop inifinitely (~65000 times).
652652
Returns which channel was used to play the sound.
653653
*}
654-
function Mix_PlayChannel(channel: cint; chunk: PMix_Chunk; loops: cint): cint;
654+
function Mix_PlayChannel(channel: cint; chunk: PMix_Chunk; loops: cint): cint; cdecl;
655+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_PlayChannel' {$ENDIF} {$ENDIF};
655656
{* The same as above, but the sound is played at most 'ticks' milliseconds *}
656657
function Mix_PlayChannelTimed(channel: cint; chunk: PMix_Chunk; loops: cint; ticks: cint): cint cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_PlayChannelTimed' {$ENDIF} {$ENDIF};
657658
function Mix_PlayMusic(music: PMix_Music; loops: cint): cint cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_PlayMusic' {$ENDIF} {$ENDIF};
658659

659660
{* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions *}
660661
function Mix_FadeInMusic(music: PMix_Music; loops: cint; ms: cint): cint cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_FadeInMusic' {$ENDIF} {$ENDIF};
661662
function Mix_FadeInMusicPos(music: PMix_Music; loops: cint; ms: cint; position: Double): cint cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_FadeInMusicPos' {$ENDIF} {$ENDIF};
662-
function Mix_FadeInChannel(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint): cint;
663+
function Mix_FadeInChannel(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint): cint; cdecl;
664+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_FadeInChannel' {$ENDIF} {$ENDIF};
663665
function Mix_FadeInChannelTimed(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint; ticks: cint): cint cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_FadeInChannelTimed' {$ENDIF} {$ENDIF};
664666

665667
{* Set the volume in the range of 0-128 of a specific channel or chunk.
@@ -848,19 +850,4 @@ procedure MIX_VERSION(Out X: TSDL_Version);
848850
SDL_MIXER_VERSION(X);
849851
end;
850852

851-
function Mix_FadeInChannel(channel: cint; chunk: PMix_Chunk; loops: cint; ms: cint): cint;
852-
begin
853-
Result := Mix_FadeInChannelTimed(channel, chunk, loops, ms, -1);
854-
end;
855-
856-
function Mix_PlayChannel(channel: cint; chunk: PMix_Chunk; loops: cint): cint;
857-
begin
858-
Result := Mix_PlayChannelTimed(channel, chunk, loops, -1);
859-
end;
860-
861-
function Mix_LoadWAV(_file: PAnsiChar): PMix_Chunk;
862-
begin
863-
Result := Mix_LoadWAV_RW(SDL_RWFromFile(_file, 'rb'), 1);
864-
end;
865-
866853
end.

0 commit comments

Comments
 (0)