Skip to content

Commit a78bb2f

Browse files
committed
Update SDL2_mixer.pas to 2.0.4
1 parent 256ea45 commit a78bb2f

File tree

1 file changed

+42
-20
lines changed

1 file changed

+42
-20
lines changed

sdl2_mixer.pas

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ interface
6565
const
6666
SDL_MIXER_MAJOR_VERSION = 2;
6767
SDL_MIXER_MINOR_VERSION = 0;
68-
SDL_MIXER_PATCHLEVEL = 0;
68+
SDL_MIXER_PATCHLEVEL = 4;
6969

7070
{* This macro can be used to fill a version structure with the compile-time
7171
* version of the SDL_mixer library.
@@ -89,12 +89,17 @@ function Mix_Linked_Version: PSDL_Version cdecl; external MIX_LibName {$IFDEF DE
8989
const
9090
MIX_INIT_FLAC = $00000001;
9191
MIX_INIT_MOD = $00000002;
92-
MIX_INIT_MODPLUG = $00000004;
9392
MIX_INIT_MP3 = $00000008;
9493
MIX_INIT_OGG = $00000010;
94+
MIX_INIT_MID = $00000020;
95+
MIX_INIT_OPUS = $00000040;
96+
97+
{ // Removed in SDL2_mixer 2.0.2
98+
MIX_INIT_MODPLUG = $00000004;
9599
MIX_INIT_FLUIDSYNTH = $00000020;
100+
}
96101
type
97-
TMIX_InitFlags = Byte;
102+
TMIX_InitFlags = Integer;
98103

99104
{* Loads dynamic libraries and prepares them for use. Flags should be
100105
one or more flags from MIX_InitFlags OR'd together.
@@ -116,7 +121,7 @@ procedure Mix_Quit() cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS}
116121
const
117122
MIX_DEFAULT_FREQUENCY = 22050;
118123
MIX_DEFAULT_CHANNELS = 2;
119-
MIX_MAX_VOLUME = 128; {* Volume of a chunk *}
124+
MIX_MAX_VOLUME = SDL2.SDL_MIX_MAXVOLUME; {* Volume of a chunk *}
120125

121126
{$IFDEF FPC}
122127
{$IF DEFINED(ENDIAN_LITTLE)}
@@ -142,16 +147,19 @@ TMix_Chunk = record
142147
type
143148
TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN);
144149

145-
TMix_MusicType = (MUS_NONE,
146-
MUS_CMD,
147-
MUS_WAV,
148-
MUS_MOD,
149-
MUS_MID,
150-
MUS_OGG,
151-
MUS_MP3,
152-
MUS_MP3_MAD,
153-
MUS_FLAC,
154-
MUS_MODPLUG);
150+
TMix_MusicType = (
151+
MUS_NONE,
152+
MUS_CMD,
153+
MUS_WAV,
154+
MUS_MOD,
155+
MUS_MID,
156+
MUS_OGG,
157+
MUS_MP3,
158+
MUS_MP3_MAD_UNUSED,
159+
MUS_FLAC,
160+
MUS_MODPLUG_UNUSED,
161+
MUS_OPUS
162+
);
155163

156164
{* The internal format for a music chunk interpreted via mikmod *}
157165
PMix_Music = ^TMix_Music;
@@ -213,10 +221,18 @@ procedure Mix_FreeMusic(music: PMix_Music) cdecl; external MIX_LibName {$IFDEF D
213221
These return values are static, read-only data; do not modify or free it.
214222
The pointers remain valid until you call Mix_CloseAudio().
215223
*}
216-
function Mix_GetNumChunkDecoders: Integer cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetNumChunkDecoders' {$ENDIF} {$ENDIF};
217-
function Mix_GetChunkDecoder(index: Integer): PAnsiChar cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetChunkDecoder' {$ENDIF} {$ENDIF};
218-
function Mix_GetNumMusicDecoders: Integer cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetNumMusicDecoders' {$ENDIF} {$ENDIF};
219-
function Mix_GetMusicDecoder(index: Integer): PAnsiChar cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetMusicDecoder' {$ENDIF} {$ENDIF};
224+
function Mix_GetNumChunkDecoders: Integer cdecl;
225+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetNumChunkDecoders' {$ENDIF} {$ENDIF};
226+
function Mix_GetChunkDecoder(index: Integer): PAnsiChar cdecl;
227+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetChunkDecoder' {$ENDIF} {$ENDIF};
228+
function Mix_HasChunkDecoder(const name: PAnsiChar): TSDL_Bool cdecl;
229+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_HasChunkDecoder' {$ENDIF} {$ENDIF};
230+
function Mix_GetNumMusicDecoders: Integer cdecl;
231+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetNumMusicDecoders' {$ENDIF} {$ENDIF};
232+
function Mix_GetMusicDecoder(index: Integer): PAnsiChar cdecl;
233+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetMusicDecoder' {$ENDIF} {$ENDIF};
234+
function Mix_HasMusicDecoder(const name: PAnsiChar): TSDL_Bool cdecl;
235+
external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_HasMusicDecoder' {$ENDIF} {$ENDIF};
220236

221237
{* Find out the music format of a mixer music, or the currently playing
222238
music, if 'music' is NULL.
@@ -615,8 +631,8 @@ function Mix_PausedMusic: Integer cdecl; external MIX_LibName {$IFDEF DELPHI} {$
615631
{* Set the current position in the music stream.
616632
This returns 0 if successful, or -1 if it failed or isn't implemented.
617633
This function is only implemented for MOD music formats (set pattern
618-
order number) and for OGG, FLAC, MP3_MAD, and MODPLUG music (set
619-
position in seconds), at the moment.
634+
order number) and for OGG, FLAC, MP3_MAD, MP3_MPG and MODPLUG music
635+
(set position in seconds), at the moment.
620636
*}
621637
function Mix_SetMusicPosition(position: Double): Integer cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_SetMusicPosition' {$ENDIF} {$ENDIF};
622638

@@ -653,6 +669,7 @@ procedure Mix_CloseAudio cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MAC
653669
{* We'll use SDL for reporting errors *}
654670
function Mix_SetError(const fmt: PAnsiChar): SInt32; cdecl;
655671
function Mix_GetError: PAnsiChar; cdecl;
672+
procedure Mix_ClearError(); cdecl;
656673

657674
implementation
658675

@@ -693,4 +710,9 @@ function Mix_GetError: PAnsiChar; cdecl;
693710
Result := SDL_GetError();
694711
end;
695712

713+
procedure Mix_ClearError; cdecl;
714+
begin
715+
SDL_ClearError()
716+
end;
717+
696718
end.

0 commit comments

Comments
 (0)