From a56aa776bb1fc89e946e30c5d21711226b66ba74 Mon Sep 17 00:00:00 2001 From: Almindor Date: Fri, 16 Mar 2007 10:30:19 +0000 Subject: [PATCH] * remove win32 constraint so it compiles on win64 and possibly others later too git-svn-id: trunk@6876 - --- packages/extra/sdl/jedi-sdl.inc | 8 +- packages/extra/sdl/moduleloader.pas | 2 +- packages/extra/sdl/sdl.pas | 38 +- packages/extra/sdl/sdl_gfx.pas | 1368 ++++++++--------- packages/extra/sdl/sdl_image.pas | 569 +++---- packages/extra/sdl/sdl_mixer.pas | 2142 +++++++++++++-------------- packages/extra/sdl/sdl_net.pas | 10 +- packages/extra/sdl/sdl_sound.pas | 4 +- packages/extra/sdl/sdl_ttf.pas | 4 +- packages/extra/sdl/sdlsprites.pas | 2 +- packages/extra/sdl/smpeg.pas | 2 +- 11 files changed, 2075 insertions(+), 2074 deletions(-) diff --git a/packages/extra/sdl/jedi-sdl.inc b/packages/extra/sdl/jedi-sdl.inc index 140652d5f2..951f7c4a88 100644 --- a/packages/extra/sdl/jedi-sdl.inc +++ b/packages/extra/sdl/jedi-sdl.inc @@ -119,7 +119,7 @@ {$ELSE} {$DEFINE __OS_DOS__} {$ENDIF} - {$IFDEF WIN32} + {$IFDEF windows} {$DEFINE UseWin} {$ENDIF} @@ -129,13 +129,13 @@ {$DEFINE OS_BigMem} {$ENDIF OS2} -{$IFDEF Win32} +{$IFDEF windows} {$DEFINE OS_BigMem} -{$ELSE Win32} +{$ELSE windows} {$IFDEF ver70} {$DEFINE assembler} {$ENDIF} { use 16-bit assembler! } -{$ENDIF Win32} +{$ENDIF windows} { ************************** dos/dos-like platforms **************} {$IFDEF Windows} diff --git a/packages/extra/sdl/moduleloader.pas b/packages/extra/sdl/moduleloader.pas index 56863ea5c2..3592dc1415 100644 --- a/packages/extra/sdl/moduleloader.pas +++ b/packages/extra/sdl/moduleloader.pas @@ -59,7 +59,7 @@ interface // each OS gets its own IFDEFed complete code block to make reading easier -{$IFDEF WIN32} +{$IFDEF windows} uses Windows; diff --git a/packages/extra/sdl/sdl.pas b/packages/extra/sdl/sdl.pas index 5ad23f7399..9b885a740d 100644 --- a/packages/extra/sdl/sdl.pas +++ b/packages/extra/sdl/sdl.pas @@ -244,7 +244,7 @@ unit sdl; interface uses -{$IFDEF WIN32} +{$IFDEF windows} Windows; {$ENDIF} @@ -265,7 +265,7 @@ uses {$ENDIF} const -{$IFDEF WIN32} +{$IFDEF windows} SDLLibName = 'SDL.dll'; {$ENDIF} @@ -1660,7 +1660,7 @@ type {$ENDIF} // The windows custom event structure -{$IFDEF Win32} +{$IFDEF windows} PSDL_SysWMmsg = ^TSDL_SysWMmsg; TSDL_SysWMmsg = record version: TSDL_version; @@ -1695,7 +1695,7 @@ type {$ENDIF} // The Windows custom window manager information structure -{$IFDEF Win32} +{$IFDEF windows} PSDL_SysWMinfo = ^TSDL_SysWMinfo; TSDL_SysWMinfo = record version : TSDL_version; @@ -1824,7 +1824,7 @@ type alpha: UInt8; // Alpha value information (per-surface alpha) end; -{$IFDEF WIN32} +{$IFDEF windows} {PPrivate_hwdata = ^TPrivate_hwdata; TPrivate_hwdata = record dd_surface : IDIRECTDRAWSURFACE3; @@ -1972,7 +1972,7 @@ type // SDL_mutex.h types -{$IFDEF WIN32} +{$IFDEF windows} PSDL_Mutex = ^TSDL_Mutex; TSDL_Mutex = record id: THANDLE; @@ -1997,8 +1997,8 @@ type {$ENDIF} PSDL_semaphore = ^TSDL_semaphore; -{$IFDEF WIN32} - // Win32 or Machintosh +{$IFDEF windows} + // windows or Machintosh TSDL_semaphore = record id: THANDLE; count: UInt32; @@ -2050,7 +2050,7 @@ PSDL_semaphore = ^TSDL_semaphore; end; // SDL_thread.h types -{$IFDEF WIN32} +{$IFDEF windows} TSYS_ThreadHandle = THandle; {$ENDIF} @@ -2140,7 +2140,7 @@ procedure SDL_Quit; cdecl; external {$IFDEF __GPC__}name 'SDL_Quit'{$ELSE} SDLLibName{$ENDIF __GPC__}; {$EXTERNALSYM SDL_Quit} -{$IFDEF WIN32} +{$IFDEF windows} // This should be called from your WinMain() function, if any function SDL_RegisterApp(name: PChar; style: UInt32; h_Inst: Pointer): Integer; cdecl; external {$IFDEF __GPC__}name 'SDL_RegisterApp'{$ELSE} SDLLibName{$ENDIF __GPC__}; @@ -2177,7 +2177,7 @@ procedure SDL_ClearError; cdecl; external {$IFDEF __GPC__}name 'SDL_ClearError'{$ELSE} SDLLibName{$ENDIF __GPC__}; {$EXTERNALSYM SDL_ClearError} -{$IFNDEF WIN32} +{$IFNDEF windows} procedure SDL_Error(Code: TSDL_errorcode); cdecl; external {$IFDEF __GPC__}name 'SDL_Error'{$ELSE} SDLLibName{$ENDIF __GPC__}; {$EXTERNALSYM SDL_Error} @@ -2766,7 +2766,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_Linked_Version'{$ELSE} SDLLibName{$END Note that event handling is activated by this routine. If you use both sound and video in your application, you need to call - SDL_Init() before opening the sound device, otherwise under Win32 DirectX, + SDL_Init() before opening the sound device, otherwise under windows DirectX, you won't be able to set full-screen display modes. } function SDL_VideoInit(driver_name: PChar; flags: UInt32): Integer; @@ -3739,7 +3739,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_KillThread'{$ELSE} SDLLibName{$ENDIF _ {------------------------------------------------------------------------------} { Get Environment Routines } {------------------------------------------------------------------------------} -{$IFDEF WIN32} +{$IFDEF windows} function _putenv( const variable : Pchar ): integer; cdecl; {$ENDIF} @@ -3761,7 +3761,7 @@ function SDL_putenv(const variable: PChar): integer; //function putenv(const variable: PChar): integer; //{$EXTERNALSYM putenv} -{$IFDEF WIN32} +{$IFDEF windows} {$IFNDEF __GPC__} function getenv( const name : Pchar ): PChar; cdecl; {$ENDIF} @@ -3850,7 +3850,7 @@ end; procedure SDL_OutOfMemory; begin - {$IFNDEF WIN32} + {$IFNDEF windows} SDL_Error(SDL_ENOMEM); {$ENDIF} end; @@ -4016,7 +4016,7 @@ begin Result := SDL_mutexV(mutex); end; -{$IFDEF WIN32} +{$IFDEF windows} function _putenv( const variable : Pchar ): Integer; cdecl; external {$IFDEF __GPC__}name '_putenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF __GPC__}; {$ENDIF} @@ -4024,7 +4024,7 @@ cdecl; external {$IFDEF __GPC__}name '_putenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF __GPC_ function SDL_putenv(const variable: PChar): Integer; begin - {$IFDEF WIN32} + {$IFDEF windows} Result := _putenv(variable); {$ENDIF} @@ -4037,7 +4037,7 @@ begin {$ENDIF} end; -{$IFDEF WIN32} +{$IFDEF windows} {$IFNDEF __GPC__} function getenv( const name : Pchar ): PChar; cdecl; external {$IFDEF __GPC__}name 'getenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF}; @@ -4046,7 +4046,7 @@ cdecl; external {$IFDEF __GPC__}name 'getenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF}; function SDL_getenv(const name: PChar): PChar; begin - {$IFDEF WIN32} + {$IFDEF windows} {$IFDEF __GPC__} Result := getenv( string( name ) ); diff --git a/packages/extra/sdl/sdl_gfx.pas b/packages/extra/sdl/sdl_gfx.pas index 36b0ee0fa0..1f98c0d1f3 100644 --- a/packages/extra/sdl/sdl_gfx.pas +++ b/packages/extra/sdl/sdl_gfx.pas @@ -1,685 +1,685 @@ -unit sdl_gfx; -{ - $Id: sdl_gfx.pas,v 1.1 2005/01/03 19:08:32 savage Exp $ - -} -{ - $Log: sdl_gfx.pas,v $ - Revision 1.1 2005/01/03 19:08:32 savage - Header for the SDL_Gfx library. - - - -} - -{$I jedi-sdl.inc} - -interface - -uses - sdl; - -const -{$IFDEF WIN32} - SDLgfxLibName = 'SDL_gfx.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - SDLgfxLibName = 'libSDL_gfx.dylib'; -{$ELSE} - SDLgfxLibName = 'libSDL_gfx.so'; -{$ENDIF} -{$ENDIF} - -{$IFDEF MACOS} - SDLgfxLibName = 'SDL_gfx'; -{$ENDIF} - - // Some rates in Hz - FPS_UPPER_LIMIT = 200; - FPS_LOWER_LIMIT = 1; - FPS_DEFAULT = 30; - -// ---- Defines - - SMOOTHING_OFF = 0; - SMOOTHING_ON = 1; - - - -type - PFPSmanager = ^TFPSmanager; - TFPSmanager = packed record - framecount : Uint32; - rateticks : single; - lastticks : Uint32; - rate : Uint32; - end; - -// ---- Structures - PColorRGBA = ^TColorRGBA; - TColorRGBA = packed record - r : Uint8; - g : Uint8; - b : Uint8; - a : Uint8; - end; - - PColorY = ^TColorY; - TColorY = packed record - y : Uint8; - end; - -{ - - SDL_framerate: framerate manager - - LGPL (c) A. Schiffler - -} - -procedure SDL_initFramerate( manager : PFPSmanager ); -cdecl; external {$IFDEF __GPC__}name 'SDL_initFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_initFramerate} - -function SDL_setFramerate( manager : PFPSmanager; rate : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_setFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_setFramerate} - -function SDL_getFramerate( manager : PFPSmanager ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_getFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_getFramerate} - -procedure SDL_framerateDelay( manager : PFPSmanager ); -cdecl; external {$IFDEF __GPC__}name 'SDL_framerateDelay'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_framerateDelay} - -{ - - SDL_gfxPrimitives: graphics primitives for SDL - - LGPL (c) A. Schiffler - -} - -// Note: all ___Color routines expect the color to be in format 0xRRGGBBAA - -// Pixel - -function pixelColor( dst : PSDL_Surface; x : Sint16; y : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'pixelColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM pixelColor} - -function pixelRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'pixelRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM pixelRGBA} - -// Horizontal line - -function hlineColor( dst : PSDL_Surface; x1: Sint16; x2 : Sint16; y : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'hlineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM hlineColor} - -function hlineRGBA( dst : PSDL_Surface; x1: Sint16; x2 : Sint16; y : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'hlineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM hlineRGBA} - -// Vertical line - -function vlineColor( dst : PSDL_Surface; x : Sint16; y1 : Sint16; y2 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'vlineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM vlineColor} - -function vlineRGBA( dst : PSDL_Surface; x : Sint16; y1 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'vlineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM vlineRGBA} - -// Rectangle - -function rectangleColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'rectangleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM rectangleColor} - -function rectangleRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; - x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'rectangleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM rectangleRGBA} - -// Filled rectangle (Box) - -function boxColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'boxColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM boxColor} - -function boxRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; - y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'boxRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM boxRGBA} - -// Line - -function lineColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'lineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM lineColor} - -function lineRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; - x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'lineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM lineRGBA} - -// AA Line -function aalineColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aalineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aalineColor} - -function aalineRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; - x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aalineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aalineRGBA} - -// Circle - -function circleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'circleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM circleColor} - -function circleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'circleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM circleRGBA} - -// AA Circle - -function aacircleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aacircleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aacircleColor} - -function aacircleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; - rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aacircleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aacircleRGBA} - -// Filled Circle - -function filledCircleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledCircleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledCircleColor} - -function filledCircleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; - rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledCircleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledCircleRGBA} - -// Ellipse - -function ellipseColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'ellipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM ellipseColor} - -function ellipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; - rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'ellipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM ellipseRGBA} - -// AA Ellipse - -function aaellipseColor( dst : PSDL_Surface; xc : Sint16; yc : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aaellipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aaellipseColor} - -function aaellipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; - rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aaellipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aaellipseRGBA} - -// Filled Ellipse - -function filledEllipseColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledEllipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledEllipseColor} - -function filledEllipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; - rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledEllipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledEllipseRGBA} - -// Pie - -function pieColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; - start : Sint16; finish : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'pieColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM pieColor} - -function pieRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; - start : Sint16; finish : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'pieRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM pieRGBA} - -// Filled Pie - -function filledPieColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; - start : Sint16; finish : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledPieColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledPieColor} - -function filledPieRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; - start : Sint16; finish : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledPieRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledPieRGBA} - -// Trigon - -function trigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'trigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM trigonColor} - -function trigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; - r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'trigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM trigonRGBA} - -// AA-Trigon - -function aatrigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aatrigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aatrigonColor} -function aatrigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; - r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aatrigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aatrigonRGBA} - -// Filled Trigon - -function filledTrigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledTrigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledTrigonColor} - -function filledTrigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; - r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledTrigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledTrigonRGBA} - -// Polygon - -function polygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'polygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM polygonColor} - -function polygonRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; - n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'polygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM polygonRGBA} - -// AA-Polygon - -function aapolygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aapolygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aapolygonColor} - -function aapolygonRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; - n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'aapolygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM aapolygonRGBA} - -// Filled Polygon - -function filledPolygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledPolygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledPolygonColor} - -function filledPolygonRGBA( dst : PSDL_Surface; const vx : PSint16; - const vy : PSint16; n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'filledPolygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM filledPolygonRGBA} - -// Bezier -// s = number of steps - -function bezierColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; s : integer; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'bezierColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM bezierColor} - -function bezierRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; - n : integer; s : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'bezierRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM bezierRGBA} - - -// Characters/Strings - -function characterColor( dst : PSDL_Surface; x : Sint16; y : Sint16; c : char; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'characterColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM characterColor} - -function characterRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; c : char; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'characterRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM characterRGBA} - -function stringColor( dst : PSDL_Surface; x : Sint16; y : Sint16; const c : PChar; color : Uint32 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'stringColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM stringColor} - -function stringRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; const c : PChar; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; -cdecl; external {$IFDEF __GPC__}name 'stringRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM stringRGBA} - -procedure gfxPrimitivesSetFont(const fontdata : Pointer; cw : integer; ch : integer ); -cdecl; external {$IFDEF __GPC__}name 'gfxPrimitivesSetFont'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM gfxPrimitivesSetFont} - -{ - - SDL_imageFilter - bytes-image "filter" routines - (uses inline x86 MMX optimizations if available) - - LGPL (c) A. Schiffler - -} - -{ Comments: } -{ 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. } -{ 2.) Data that is not within an 8 byte boundary is processed using the C routine. } -{ 3.) Convolution routines do not have C routines at this time. } - -// Detect MMX capability in CPU -function SDL_imageFilterMMXdetect : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXdetect'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMMXdetect} - -// Force use of MMX off (or turn possible use back on) -procedure SDL_imageFilterMMXoff; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXoff'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMMXoff} - -procedure SDL_imageFilterMMXon; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXon'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMMXon} - -// -// All routines return: -// 0 OK -// -1 Error (internal error, parameter error) -// - -// SDL_imageFilterAdd: D = saturation255(S1 + S2) -function SDL_imageFilterAdd(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imaSDL_imageFilterAddgeFilterMMXon'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterAdd} - -// SDL_imageFilterMean: D = S1/2 + S2/2 -function SDL_imageFilterMean(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMean'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMean} - -// SDL_imageFilterSub: D = saturation0(S1 - S2) -function SDL_imageFilterSub(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSub'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterSub} - -// SDL_imageFilterAbsDiff: D = | S1 - S2 | -function SDL_imageFilterAbsDiff(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAbsDiff'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterAbsDiff} - -// SDL_imageFilterMult: D = saturation(S1 * S2) -function SDL_imageFilterMult(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMult'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMult} - -// SDL_imageFilterMultNor: D = S1 * S2 (non-MMX) -function SDL_imageFilterMultNor(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultNor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMultNor} - -// SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2) -function SDL_imageFilterMultDivby2(Src1 : PChar; Src2 : PChar; Dest : PChar; - length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultDivby2'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMultDivby2} - -// SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2) -function SDL_imageFilterMultDivby4(Src1 : PChar; Src2 : PChar; Dest : PChar; - length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultDivby4'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMultDivby4} - -// SDL_imageFilterBitAnd: D = S1 & S2 -function SDL_imageFilterBitAnd(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitAnd'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterBitAnd} - -// SDL_imageFilterBitOr: D = S1 | S2 -function SDL_imageFilterBitOr(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitOr'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterBitOr} - -// SDL_imageFilterDiv: D = S1 / S2 (non-MMX) -function SDL_imageFilterDiv(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterDiv'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterDiv} - -// SDL_imageFilterBitNegation: D = !S -function SDL_imageFilterBitNegation(Src1 : PChar; Dest : PChar; length : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitNegation'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterBitNegation} - -// SDL_imageFilterAddByte: D = saturation255(S + C) -function SDL_imageFilterAddByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterAddByte} - -// SDL_imageFilterAddUint: D = saturation255(S + (uint)C) -function SDL_imageFilterAddUint(Src1 : PChar; Dest : PChar; length : integer; C : Cardinal ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterAddUint} - -// SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C) -function SDL_imageFilterAddByteToHalf(Src1 : PChar; Dest : PChar; length : integer; - C : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddByteToHalf'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterAddByteToHalf} - -// SDL_imageFilterSubByte: D = saturation0(S - C) -function SDL_imageFilterSubByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSubByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterSubByte} - -// SDL_imageFilterSubUint: D = saturation0(S - (uint)C) -function SDL_imageFilterSubUint(Src1 : PChar; Dest : PChar; length : integer; C : Cardinal ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSubUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterSubUint} - -// SDL_imageFilterShiftRight: D = saturation0(S >> N) -function SDL_imageFilterShiftRight(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterShiftRight} - -// SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N) -function SDL_imageFilterShiftRightUint(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRightUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterShiftRightUint} - -// SDL_imageFilterMultByByte: D = saturation255(S * C) -function SDL_imageFilterMultByByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultByByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterMultByByte} - -// SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C) -function SDL_imageFilterShiftRightAndMultByByte(Src1 : PChar; Dest : PChar; length : integer; - N : char; C : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRightAndMultByByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterShiftRightAndMultByByte} - -// SDL_imageFilterShiftLeftByte: D = (S << N) -function SDL_imageFilterShiftLeftByte(Src1 : PChar; Dest : PChar; length : integer; - N : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeftByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterShiftLeftByte} - -// SDL_imageFilterShiftLeftUint: D = ((uint)S << N) -function SDL_imageFilterShiftLeftUint(Src1 : PChar; Dest : PChar; length : integer; - N : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeftUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterShiftLeftUint} - -// SDL_imageFilterShiftLeft: D = saturation255(S << N) -function SDL_imageFilterShiftLeft(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeft'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterShiftLeft} - -// SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0 -function SDL_imageFilterBinarizeUsingThreshold(Src1 : PChar; Dest : PChar; length : integer; - T : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBinarizeUsingThreshold'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterBinarizeUsingThreshold} - -// SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0 -function SDL_imageFilterClipToRange(Src1 : PChar; Dest : PChar; length : integer; - Tmin : Byte; Tmax : Byte ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterClipToRange'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterClipToRange} - -// SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) -function SDL_imageFilterNormalizeLinear(Src1 : PChar; Dest : PChar; length : integer; Cmin : integer; - Cmax : integer; Nmin : integer; Nmax : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterClipToRange'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterClipToRange} - -{ !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! } - -// SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel3x3Divide(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel3x3Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel3x3Divide} - -// SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel5x5Divide(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel5x5Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel5x5Divide} - -// SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel7x7Divide(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel7x7Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel7x7Divide} - -// SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel9x9Divide(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel9x9Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel9x9Divide} - -// SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel3x3ShiftRight(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; - NRightShift : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel3x3ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel3x3ShiftRight} - -// SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel5x5ShiftRight(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; - NRightShift : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel5x5ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel5x5ShiftRight} - -// SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel7x7ShiftRight(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; - NRightShift : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel7x7ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel7x7ShiftRight} - -// SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... ) -function SDL_imageFilterConvolveKernel9x9ShiftRight(Src : PChar; Dest : PChar; rows : integer; - columns : integer; Kernel : PShortInt; - NRightShift : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel9x9ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterConvolveKernel9x9ShiftRight} - -// SDL_imageFilterSobelX: Dij = saturation255( ... ) -function SDL_imageFilterSobelX(Src : PChar; Dest : PChar; rows : integer; columns : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSobelX'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterSobelX} - -// SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... ) -function SDL_imageFilterSobelXShiftRight(Src : PChar; Dest : PChar; rows : integer; columns : integer; - NRightShift : char ) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSobelXShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterSobelXShiftRight} - -// Align/restore stack to 32 byte boundary -- Functionality untested! -- -procedure SDL_imageFilterAlignStack; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAlignStack'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterAlignStack} - -procedure SDL_imageFilterRestoreStack; -cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterRestoreStack'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_imageFilterRestoreStack} - -{ - - SDL_rotozoom - rotozoomer - - LGPL (c) A. Schiffler - -} - -{ - - rotozoomSurface() - - Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. - 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1 - then the destination 32bit surface is anti-aliased. If the surface is not 8bit - or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. - -} - -function rotozoomSurface( src : PSDL_Surface; angle : double; zoom : double; smooth : integer ) : PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'rotozoomSurface'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM rotozoomSurface} - -function rotozoomSurfaceXY( src : PSDL_Surface; angle : double; zoomx : double; zoomy : double; smooth : integer ) : PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceXY'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM rotozoomSurfaceXY} - -{ Returns the size of the target surface for a rotozoomSurface() call } - -procedure rotozoomSurfaceSize( width : integer; height : integer; angle : double; zoom : double; var dstwidth : integer; - var dstheight : integer ); -cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceSize'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM rotozoomSurfaceSize} - -procedure rotozoomSurfaceSizeXY - ( width : integer; height : integer; angle : double; zoomx : double; zoomy : double; - var dstwidth : integer; var dstheight : integer ); -cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceSizeXY'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM rotozoomSurfaceSizeXY} - -{ - - zoomSurface() - - Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. - 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1 - then the destination 32bit surface is anti-aliased. If the surface is not 8bit - or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. - -} - -function zoomSurface(src : PSDL_Surface; zoomx : double; zoomy : double; smooth : integer ) : PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'zoomSurface'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM zoomSurface} - -{ Returns the size of the target surface for a zoomSurface() call } - -procedure zoomSurfaceSize( width : integer; height : integer; zoomx : double; zoomy : double; var dstwidth : integer; var dstheight : integer ); -cdecl; external {$IFDEF __GPC__}name 'zoomSurfaceSize'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; -{$EXTERNALSYM zoomSurfaceSize} - -implementation - +unit sdl_gfx; +{ + $Id: sdl_gfx.pas,v 1.1 2005/01/03 19:08:32 savage Exp $ + +} +{ + $Log: sdl_gfx.pas,v $ + Revision 1.1 2005/01/03 19:08:32 savage + Header for the SDL_Gfx library. + + + +} + +{$I jedi-sdl.inc} + +interface + +uses + sdl; + +const +{$IFDEF windows} + SDLgfxLibName = 'SDL_gfx.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDLgfxLibName = 'libSDL_gfx.dylib'; +{$ELSE} + SDLgfxLibName = 'libSDL_gfx.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDLgfxLibName = 'SDL_gfx'; +{$ENDIF} + + // Some rates in Hz + FPS_UPPER_LIMIT = 200; + FPS_LOWER_LIMIT = 1; + FPS_DEFAULT = 30; + +// ---- Defines + + SMOOTHING_OFF = 0; + SMOOTHING_ON = 1; + + + +type + PFPSmanager = ^TFPSmanager; + TFPSmanager = packed record + framecount : Uint32; + rateticks : single; + lastticks : Uint32; + rate : Uint32; + end; + +// ---- Structures + PColorRGBA = ^TColorRGBA; + TColorRGBA = packed record + r : Uint8; + g : Uint8; + b : Uint8; + a : Uint8; + end; + + PColorY = ^TColorY; + TColorY = packed record + y : Uint8; + end; + +{ + + SDL_framerate: framerate manager + + LGPL (c) A. Schiffler + +} + +procedure SDL_initFramerate( manager : PFPSmanager ); +cdecl; external {$IFDEF __GPC__}name 'SDL_initFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_initFramerate} + +function SDL_setFramerate( manager : PFPSmanager; rate : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_setFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_setFramerate} + +function SDL_getFramerate( manager : PFPSmanager ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_getFramerate'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_getFramerate} + +procedure SDL_framerateDelay( manager : PFPSmanager ); +cdecl; external {$IFDEF __GPC__}name 'SDL_framerateDelay'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_framerateDelay} + +{ + + SDL_gfxPrimitives: graphics primitives for SDL + + LGPL (c) A. Schiffler + +} + +// Note: all ___Color routines expect the color to be in format 0xRRGGBBAA + +// Pixel + +function pixelColor( dst : PSDL_Surface; x : Sint16; y : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'pixelColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM pixelColor} + +function pixelRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'pixelRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM pixelRGBA} + +// Horizontal line + +function hlineColor( dst : PSDL_Surface; x1: Sint16; x2 : Sint16; y : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'hlineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM hlineColor} + +function hlineRGBA( dst : PSDL_Surface; x1: Sint16; x2 : Sint16; y : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'hlineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM hlineRGBA} + +// Vertical line + +function vlineColor( dst : PSDL_Surface; x : Sint16; y1 : Sint16; y2 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'vlineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM vlineColor} + +function vlineRGBA( dst : PSDL_Surface; x : Sint16; y1 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'vlineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM vlineRGBA} + +// Rectangle + +function rectangleColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'rectangleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM rectangleColor} + +function rectangleRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; + x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'rectangleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM rectangleRGBA} + +// Filled rectangle (Box) + +function boxColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'boxColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM boxColor} + +function boxRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; + y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'boxRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM boxRGBA} + +// Line + +function lineColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'lineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM lineColor} + +function lineRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; + x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'lineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM lineRGBA} + +// AA Line +function aalineColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aalineColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aalineColor} + +function aalineRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; + x2 : Sint16; y2 : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aalineRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aalineRGBA} + +// Circle + +function circleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'circleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM circleColor} + +function circleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'circleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM circleRGBA} + +// AA Circle + +function aacircleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aacircleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aacircleColor} + +function aacircleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; + rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aacircleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aacircleRGBA} + +// Filled Circle + +function filledCircleColor( dst : PSDL_Surface; x : Sint16; y : Sint16; r : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledCircleColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledCircleColor} + +function filledCircleRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; + rad : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledCircleRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledCircleRGBA} + +// Ellipse + +function ellipseColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'ellipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM ellipseColor} + +function ellipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; + rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'ellipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM ellipseRGBA} + +// AA Ellipse + +function aaellipseColor( dst : PSDL_Surface; xc : Sint16; yc : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aaellipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aaellipseColor} + +function aaellipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; + rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aaellipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aaellipseRGBA} + +// Filled Ellipse + +function filledEllipseColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rx : Sint16; ry : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledEllipseColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledEllipseColor} + +function filledEllipseRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; + rx : Sint16; ry : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledEllipseRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledEllipseRGBA} + +// Pie + +function pieColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; + start : Sint16; finish : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'pieColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM pieColor} + +function pieRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; + start : Sint16; finish : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'pieRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM pieRGBA} + +// Filled Pie + +function filledPieColor( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; + start : Sint16; finish : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledPieColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledPieColor} + +function filledPieRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; rad : Sint16; + start : Sint16; finish : Sint16; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledPieRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledPieRGBA} + +// Trigon + +function trigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'trigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM trigonColor} + +function trigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; + r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'trigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM trigonRGBA} + +// AA-Trigon + +function aatrigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aatrigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aatrigonColor} +function aatrigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; + r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aatrigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aatrigonRGBA} + +// Filled Trigon + +function filledTrigonColor( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledTrigonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledTrigonColor} + +function filledTrigonRGBA( dst : PSDL_Surface; x1 : Sint16; y1 : Sint16; x2 : Sint16; y2 : Sint16; x3 : Sint16; y3 : Sint16; + r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledTrigonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledTrigonRGBA} + +// Polygon + +function polygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'polygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM polygonColor} + +function polygonRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; + n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'polygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM polygonRGBA} + +// AA-Polygon + +function aapolygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aapolygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aapolygonColor} + +function aapolygonRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; + n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'aapolygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM aapolygonRGBA} + +// Filled Polygon + +function filledPolygonColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledPolygonColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledPolygonColor} + +function filledPolygonRGBA( dst : PSDL_Surface; const vx : PSint16; + const vy : PSint16; n : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'filledPolygonRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM filledPolygonRGBA} + +// Bezier +// s = number of steps + +function bezierColor( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; n : integer; s : integer; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'bezierColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM bezierColor} + +function bezierRGBA( dst : PSDL_Surface; const vx : PSint16; const vy : PSint16; + n : integer; s : integer; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'bezierRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM bezierRGBA} + + +// Characters/Strings + +function characterColor( dst : PSDL_Surface; x : Sint16; y : Sint16; c : char; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'characterColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM characterColor} + +function characterRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; c : char; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'characterRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM characterRGBA} + +function stringColor( dst : PSDL_Surface; x : Sint16; y : Sint16; const c : PChar; color : Uint32 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'stringColor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM stringColor} + +function stringRGBA( dst : PSDL_Surface; x : Sint16; y : Sint16; const c : PChar; r : Uint8; g : Uint8; b : Uint8; a : Uint8 ) : integer; +cdecl; external {$IFDEF __GPC__}name 'stringRGBA'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM stringRGBA} + +procedure gfxPrimitivesSetFont(const fontdata : Pointer; cw : integer; ch : integer ); +cdecl; external {$IFDEF __GPC__}name 'gfxPrimitivesSetFont'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM gfxPrimitivesSetFont} + +{ + + SDL_imageFilter - bytes-image "filter" routines + (uses inline x86 MMX optimizations if available) + + LGPL (c) A. Schiffler + +} + +{ Comments: } +{ 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. } +{ 2.) Data that is not within an 8 byte boundary is processed using the C routine. } +{ 3.) Convolution routines do not have C routines at this time. } + +// Detect MMX capability in CPU +function SDL_imageFilterMMXdetect : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXdetect'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMMXdetect} + +// Force use of MMX off (or turn possible use back on) +procedure SDL_imageFilterMMXoff; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXoff'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMMXoff} + +procedure SDL_imageFilterMMXon; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMMXon'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMMXon} + +// +// All routines return: +// 0 OK +// -1 Error (internal error, parameter error) +// + +// SDL_imageFilterAdd: D = saturation255(S1 + S2) +function SDL_imageFilterAdd(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imaSDL_imageFilterAddgeFilterMMXon'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterAdd} + +// SDL_imageFilterMean: D = S1/2 + S2/2 +function SDL_imageFilterMean(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMean'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMean} + +// SDL_imageFilterSub: D = saturation0(S1 - S2) +function SDL_imageFilterSub(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSub'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterSub} + +// SDL_imageFilterAbsDiff: D = | S1 - S2 | +function SDL_imageFilterAbsDiff(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAbsDiff'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterAbsDiff} + +// SDL_imageFilterMult: D = saturation(S1 * S2) +function SDL_imageFilterMult(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMult'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMult} + +// SDL_imageFilterMultNor: D = S1 * S2 (non-MMX) +function SDL_imageFilterMultNor(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultNor'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMultNor} + +// SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2) +function SDL_imageFilterMultDivby2(Src1 : PChar; Src2 : PChar; Dest : PChar; + length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultDivby2'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMultDivby2} + +// SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2) +function SDL_imageFilterMultDivby4(Src1 : PChar; Src2 : PChar; Dest : PChar; + length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultDivby4'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMultDivby4} + +// SDL_imageFilterBitAnd: D = S1 & S2 +function SDL_imageFilterBitAnd(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitAnd'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterBitAnd} + +// SDL_imageFilterBitOr: D = S1 | S2 +function SDL_imageFilterBitOr(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitOr'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterBitOr} + +// SDL_imageFilterDiv: D = S1 / S2 (non-MMX) +function SDL_imageFilterDiv(Src1 : PChar; Src2 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterDiv'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterDiv} + +// SDL_imageFilterBitNegation: D = !S +function SDL_imageFilterBitNegation(Src1 : PChar; Dest : PChar; length : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBitNegation'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterBitNegation} + +// SDL_imageFilterAddByte: D = saturation255(S + C) +function SDL_imageFilterAddByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterAddByte} + +// SDL_imageFilterAddUint: D = saturation255(S + (uint)C) +function SDL_imageFilterAddUint(Src1 : PChar; Dest : PChar; length : integer; C : Cardinal ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterAddUint} + +// SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C) +function SDL_imageFilterAddByteToHalf(Src1 : PChar; Dest : PChar; length : integer; + C : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAddByteToHalf'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterAddByteToHalf} + +// SDL_imageFilterSubByte: D = saturation0(S - C) +function SDL_imageFilterSubByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSubByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterSubByte} + +// SDL_imageFilterSubUint: D = saturation0(S - (uint)C) +function SDL_imageFilterSubUint(Src1 : PChar; Dest : PChar; length : integer; C : Cardinal ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSubUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterSubUint} + +// SDL_imageFilterShiftRight: D = saturation0(S >> N) +function SDL_imageFilterShiftRight(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterShiftRight} + +// SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N) +function SDL_imageFilterShiftRightUint(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRightUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterShiftRightUint} + +// SDL_imageFilterMultByByte: D = saturation255(S * C) +function SDL_imageFilterMultByByte(Src1 : PChar; Dest : PChar; length : integer; C : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterMultByByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterMultByByte} + +// SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C) +function SDL_imageFilterShiftRightAndMultByByte(Src1 : PChar; Dest : PChar; length : integer; + N : char; C : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftRightAndMultByByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterShiftRightAndMultByByte} + +// SDL_imageFilterShiftLeftByte: D = (S << N) +function SDL_imageFilterShiftLeftByte(Src1 : PChar; Dest : PChar; length : integer; + N : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeftByte'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterShiftLeftByte} + +// SDL_imageFilterShiftLeftUint: D = ((uint)S << N) +function SDL_imageFilterShiftLeftUint(Src1 : PChar; Dest : PChar; length : integer; + N : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeftUint'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterShiftLeftUint} + +// SDL_imageFilterShiftLeft: D = saturation255(S << N) +function SDL_imageFilterShiftLeft(Src1 : PChar; Dest : PChar; length : integer; N : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterShiftLeft'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterShiftLeft} + +// SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0 +function SDL_imageFilterBinarizeUsingThreshold(Src1 : PChar; Dest : PChar; length : integer; + T : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterBinarizeUsingThreshold'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterBinarizeUsingThreshold} + +// SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0 +function SDL_imageFilterClipToRange(Src1 : PChar; Dest : PChar; length : integer; + Tmin : Byte; Tmax : Byte ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterClipToRange'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterClipToRange} + +// SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) +function SDL_imageFilterNormalizeLinear(Src1 : PChar; Dest : PChar; length : integer; Cmin : integer; + Cmax : integer; Nmin : integer; Nmax : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterClipToRange'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterClipToRange} + +{ !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! } + +// SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel3x3Divide(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel3x3Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel3x3Divide} + +// SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel5x5Divide(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel5x5Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel5x5Divide} + +// SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel7x7Divide(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel7x7Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel7x7Divide} + +// SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel9x9Divide(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; Divisor : Byte ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel9x9Divide'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel9x9Divide} + +// SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel3x3ShiftRight(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; + NRightShift : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel3x3ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel3x3ShiftRight} + +// SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel5x5ShiftRight(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; + NRightShift : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel5x5ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel5x5ShiftRight} + +// SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel7x7ShiftRight(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; + NRightShift : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel7x7ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel7x7ShiftRight} + +// SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... ) +function SDL_imageFilterConvolveKernel9x9ShiftRight(Src : PChar; Dest : PChar; rows : integer; + columns : integer; Kernel : PShortInt; + NRightShift : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterConvolveKernel9x9ShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterConvolveKernel9x9ShiftRight} + +// SDL_imageFilterSobelX: Dij = saturation255( ... ) +function SDL_imageFilterSobelX(Src : PChar; Dest : PChar; rows : integer; columns : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSobelX'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterSobelX} + +// SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... ) +function SDL_imageFilterSobelXShiftRight(Src : PChar; Dest : PChar; rows : integer; columns : integer; + NRightShift : char ) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterSobelXShiftRight'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterSobelXShiftRight} + +// Align/restore stack to 32 byte boundary -- Functionality untested! -- +procedure SDL_imageFilterAlignStack; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterAlignStack'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterAlignStack} + +procedure SDL_imageFilterRestoreStack; +cdecl; external {$IFDEF __GPC__}name 'SDL_imageFilterRestoreStack'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_imageFilterRestoreStack} + +{ + + SDL_rotozoom - rotozoomer + + LGPL (c) A. Schiffler + +} + +{ + + rotozoomSurface() + + Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. + 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1 + then the destination 32bit surface is anti-aliased. If the surface is not 8bit + or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. + +} + +function rotozoomSurface( src : PSDL_Surface; angle : double; zoom : double; smooth : integer ) : PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'rotozoomSurface'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM rotozoomSurface} + +function rotozoomSurfaceXY( src : PSDL_Surface; angle : double; zoomx : double; zoomy : double; smooth : integer ) : PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceXY'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM rotozoomSurfaceXY} + +{ Returns the size of the target surface for a rotozoomSurface() call } + +procedure rotozoomSurfaceSize( width : integer; height : integer; angle : double; zoom : double; var dstwidth : integer; + var dstheight : integer ); +cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceSize'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM rotozoomSurfaceSize} + +procedure rotozoomSurfaceSizeXY + ( width : integer; height : integer; angle : double; zoomx : double; zoomy : double; + var dstwidth : integer; var dstheight : integer ); +cdecl; external {$IFDEF __GPC__}name 'rotozoomSurfaceSizeXY'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM rotozoomSurfaceSizeXY} + +{ + + zoomSurface() + + Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. + 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1 + then the destination 32bit surface is anti-aliased. If the surface is not 8bit + or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. + +} + +function zoomSurface(src : PSDL_Surface; zoomx : double; zoomy : double; smooth : integer ) : PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'zoomSurface'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM zoomSurface} + +{ Returns the size of the target surface for a zoomSurface() call } + +procedure zoomSurfaceSize( width : integer; height : integer; zoomx : double; zoomy : double; var dstwidth : integer; var dstheight : integer ); +cdecl; external {$IFDEF __GPC__}name 'zoomSurfaceSize'{$ELSE} SDLgfxLibName{$ENDIF __GPC__}; +{$EXTERNALSYM zoomSurfaceSize} + +implementation + end. diff --git a/packages/extra/sdl/sdl_image.pas b/packages/extra/sdl/sdl_image.pas index 0d36b7029d..bc26b403c4 100644 --- a/packages/extra/sdl/sdl_image.pas +++ b/packages/extra/sdl/sdl_image.pas @@ -1,284 +1,285 @@ -unit sdl_image; -{ - $Id: sdl_image.pas,v 1.7 2005/01/01 02:03:12 savage Exp $ - -} -{******************************************************************************} -{ } -{ Borland Delphi SDL_Image - An example image loading library for use } -{ with SDL } -{ Conversion of the Simple DirectMedia Layer Image Headers } -{ } -{ Portions created by Sam Lantinga are } -{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } -{ 5635-34 Springhouse Dr. } -{ Pleasanton, CA 94588 (USA) } -{ } -{ All Rights Reserved. } -{ } -{ The original files are : SDL_image.h } -{ } -{ The initial developer of this Pascal code was : } -{ Matthias Thoma } -{ } -{ Portions created by Matthias Thoma are } -{ Copyright (C) 2000 - 2001 Matthias Thoma. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Dominique Louis } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ A simple library to load images of various formats as SDL surfaces } -{ } -{ Requires } -{ -------- } -{ SDL.pas in your search path. } -{ } -{ Programming Notes } -{ ----------------- } -{ See the Aliens Demo on how to make use of this libaray } -{ } -{ Revision History } -{ ---------------- } -{ April 02 2001 - MT : Initial Translation } -{ } -{ May 08 2001 - DL : Added ExternalSym derectives and copyright header } -{ } -{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } -{ Pascal compilers. Initial support is now included } -{ for GnuPascal, VirtualPascal, TMT and obviously } -{ continue support for Delphi Kylix and FreePascal. } -{ } -{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } -{ } -{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} -{ better TMT Pascal support and under instruction } -{ from Prof. Abimbola Olowofoyeku (The African Chief),} -{ I have added better Gnu Pascal support } -{ } -{ April 30 2003 - DL : under instruction from David Mears AKA } -{ Jason Siletto, I have added FPC Linux support. } -{ This was compiled with fpc 1.1, so remember to set } -{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } -{ } -{ - $Log: sdl_image.pas,v $ - Revision 1.7 2005/01/01 02:03:12 savage - Updated to v1.2.4 - - Revision 1.6 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.5 2004/05/10 14:10:04 savage - Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). - - Revision 1.4 2004/04/13 09:32:08 savage - Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. - - Revision 1.3 2004/04/01 20:53:23 savage - Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. - - Revision 1.2 2004/03/30 20:23:28 savage - Tidied up use of UNIX compiler directive. - - Revision 1.1 2004/02/14 23:35:42 savage - version 1 of sdl_image, sdl_mixer and smpeg. - - -} -{******************************************************************************} - -{$I jedi-sdl.inc} -interface - -uses -{$IFDEF __GPC__} - gpc, -{$ENDIF} - sdl; - -const -{$IFDEF WIN32} - SDL_ImageLibName = 'SDL_Image.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - SDL_ImageLibName = 'libSDL_image.dylib'; -{$ELSE} - SDL_ImageLibName = 'libSDL_image.so'; -{$ENDIF} -{$ENDIF} - -{$IFDEF MACOS} - SDL_ImageLibName = 'SDL_image'; -{$ENDIF} - - // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL - SDL_IMAGE_MAJOR_VERSION = 1; -{$EXTERNALSYM SDL_IMAGE_MAJOR_VERSION} - SDL_IMAGE_MINOR_VERSION = 2; -{$EXTERNALSYM SDL_IMAGE_MINOR_VERSION} - SDL_IMAGE_PATCHLEVEL = 4; -{$EXTERNALSYM SDL_IMAGE_PATCHLEVEL} - -{ This macro can be used to fill a version structure with the compile-time - version of the SDL_image library. } -procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); -{$EXTERNALSYM SDL_IMAGE_VERSION} - -{ This function gets the version of the dynamically linked SDL_image library. - it should NOT be used to fill a version structure, instead you should - use the SDL_IMAGE_VERSION() macro. - } -function IMG_Linked_Version : PSDL_version; -external {$IFDEF __GPC__}name 'IMG_Linked_Version'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_Linked_Version} - -{ Load an image from an SDL data source. - The 'type' may be one of: "BMP", "GIF", "PNG", etc. - - If the image format supports a transparent pixel, SDL will set the - colorkey for the surface. You can enable RLE acceleration on the - surface afterwards by calling: - SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey); -} -function IMG_LoadTyped_RW(src: PSDL_RWops; freesrc: Integer; _type: PChar): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTyped_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadTyped_RW} -{ Convenience functions } -function IMG_Load(const _file: PChar): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_Load'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_Load} -function IMG_Load_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_Load_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_Load_RW} - -{ Invert the alpha of a surface for use with OpenGL - This function is now a no-op, and only provided for backwards compatibility. } -function IMG_InvertAlpha(_on: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_InvertAlpha'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_InvertAlpha} - -{ Functions to detect a file type, given a seekable source } -function IMG_isBMP(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isBMP'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isBMP} -function IMG_isPNM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPNM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPNM} -function IMG_isXPM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isXPM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isXPM} -function IMG_isXCF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isXCF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isXCF} -function IMG_isPCX(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPCX'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPCX} -function IMG_isGIF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isGIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isGIF} -function IMG_isJPG(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isJPG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isJPG} -function IMG_isTIF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isTIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isTIF} -function IMG_isPNG(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPNG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPNG} -function IMG_isLBM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isLBM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isLBM} - -{ Individual loading functions } -function IMG_LoadBMP_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadBMP_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadBMP_RW} -function IMG_LoadPNM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPNM_RW} -function IMG_LoadXPM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXPM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadXPM_RW} -function IMG_LoadXCF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXCF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadXCF_RW} -function IMG_LoadPCX_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPCX_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPCX_RW} -function IMG_LoadGIF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadGIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadGIF_RW} -function IMG_LoadJPG_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadJPG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadJPG_RW} -function IMG_LoadTIF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadTIF_RW} -function IMG_LoadPNG_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPNG_RW} -function IMG_LoadTGA_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTGA_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadTGA_RW} -function IMG_LoadLBM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadLBM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadLBM_RW} - -{ used internally, NOT an exported function } -//function IMG_string_equals( const str1 : PChar; const str2 : PChar ) : integer; -//cdecl; external {$IFDEF __GPC__}name 'IMG_string_equals'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -//{ $ EXTERNALSYM IMG_string_equals} - -{ Error Macros } -{ We'll use SDL for reporting errors } -procedure IMG_SetError( fmt : PChar ); - -function IMG_GetError : PChar; - -implementation - -{$IFDEF __GPC__} - {$L 'sdl_image'} { link sdl_image.dll.a or libsdl_image.so or libsdl_image.a } -{$ENDIF} - -procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); -begin - X.major := SDL_IMAGE_MAJOR_VERSION; - X.minor := SDL_IMAGE_MINOR_VERSION; - X.patch := SDL_IMAGE_PATCHLEVEL; -end; - -procedure IMG_SetError( fmt : PChar ); -begin - SDL_SetError( fmt ); -end; - -function IMG_GetError : PChar; -begin - result := SDL_GetError; -end; - -end. +unit sdl_image; +{ + $Id: sdl_image.pas,v 1.7 2005/01/01 02:03:12 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL_Image - An example image loading library for use } +{ with SDL } +{ Conversion of the Simple DirectMedia Layer Image Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_image.h } +{ } +{ The initial developer of this Pascal code was : } +{ Matthias Thoma } +{ } +{ Portions created by Matthias Thoma are } +{ Copyright (C) 2000 - 2001 Matthias Thoma. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ A simple library to load images of various formats as SDL surfaces } +{ } +{ Requires } +{ -------- } +{ SDL.pas in your search path. } +{ } +{ Programming Notes } +{ ----------------- } +{ See the Aliens Demo on how to make use of this libaray } +{ } +{ Revision History } +{ ---------------- } +{ April 02 2001 - MT : Initial Translation } +{ } +{ May 08 2001 - DL : Added ExternalSym derectives and copyright header } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl_image.pas,v $ + Revision 1.7 2005/01/01 02:03:12 savage + Updated to v1.2.4 + + Revision 1.6 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.5 2004/05/10 14:10:04 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.4 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.3 2004/04/01 20:53:23 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.2 2004/03/30 20:23:28 savage + Tidied up use of UNIX compiler directive. + + Revision 1.1 2004/02/14 23:35:42 savage + version 1 of sdl_image, sdl_mixer and smpeg. + + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +interface + +uses +{$IFDEF __GPC__} + gpc, +{$ENDIF} + sdl; + +const +{$IFDEF windows} + SDL_ImageLibName = 'SDL_Image.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDL_ImageLibName = 'libSDL_image.dylib'; +{$ELSE} + SDL_ImageLibName = 'libSDL_image.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDL_ImageLibName = 'SDL_image'; +{$ENDIF} + + // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL + SDL_IMAGE_MAJOR_VERSION = 1; +{$EXTERNALSYM SDL_IMAGE_MAJOR_VERSION} + SDL_IMAGE_MINOR_VERSION = 2; +{$EXTERNALSYM SDL_IMAGE_MINOR_VERSION} + SDL_IMAGE_PATCHLEVEL = 4; +{$EXTERNALSYM SDL_IMAGE_PATCHLEVEL} + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL_image library. } +procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); +{$EXTERNALSYM SDL_IMAGE_VERSION} + +{ This function gets the version of the dynamically linked SDL_image library. + it should NOT be used to fill a version structure, instead you should + use the SDL_IMAGE_VERSION() macro. + } +function IMG_Linked_Version : PSDL_version; +external {$IFDEF __GPC__}name 'IMG_Linked_Version'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Linked_Version} + +{ Load an image from an SDL data source. + The 'type' may be one of: "BMP", "GIF", "PNG", etc. + + If the image format supports a transparent pixel, SDL will set the + colorkey for the surface. You can enable RLE acceleration on the + surface afterwards by calling: + SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey); +} +function IMG_LoadTyped_RW(src: PSDL_RWops; freesrc: Integer; _type: PChar): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTyped_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTyped_RW} +{ Convenience functions } +function IMG_Load(const _file: PChar): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_Load'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Load} +function IMG_Load_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_Load_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Load_RW} + +{ Invert the alpha of a surface for use with OpenGL + This function is now a no-op, and only provided for backwards compatibility. } +function IMG_InvertAlpha(_on: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_InvertAlpha'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_InvertAlpha} + +{ Functions to detect a file type, given a seekable source } +function IMG_isBMP(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isBMP'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isBMP} +function IMG_isPNM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNM} +function IMG_isXPM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXPM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXPM} +function IMG_isXCF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXCF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXCF} +function IMG_isPCX(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPCX'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPCX} +function IMG_isGIF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isGIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isGIF} +function IMG_isJPG(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isJPG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isJPG} +function IMG_isTIF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isTIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isTIF} +function IMG_isPNG(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNG} +function IMG_isLBM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isLBM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isLBM} + +{ Individual loading functions } +function IMG_LoadBMP_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadBMP_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadBMP_RW} +function IMG_LoadPNM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPNM_RW} +function IMG_LoadXPM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXPM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXPM_RW} +function IMG_LoadXCF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXCF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXCF_RW} +function IMG_LoadPCX_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPCX_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPCX_RW} +function IMG_LoadGIF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadGIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadGIF_RW} +function IMG_LoadJPG_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadJPG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadJPG_RW} +function IMG_LoadTIF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTIF_RW} +function IMG_LoadPNG_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPNG_RW} +function IMG_LoadTGA_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTGA_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTGA_RW} +function IMG_LoadLBM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadLBM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadLBM_RW} + +{ used internally, NOT an exported function } +//function IMG_string_equals( const str1 : PChar; const str2 : PChar ) : integer; +//cdecl; external {$IFDEF __GPC__}name 'IMG_string_equals'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +//{ $ EXTERNALSYM IMG_string_equals} + +{ Error Macros } +{ We'll use SDL for reporting errors } +procedure IMG_SetError( fmt : PChar ); + +function IMG_GetError : PChar; + +implementation + +{$IFDEF __GPC__} + {$L 'sdl_image'} { link sdl_image.dll.a or libsdl_image.so or libsdl_image.a } +{$ENDIF} + +procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); +begin + X.major := SDL_IMAGE_MAJOR_VERSION; + X.minor := SDL_IMAGE_MINOR_VERSION; + X.patch := SDL_IMAGE_PATCHLEVEL; +end; + +procedure IMG_SetError( fmt : PChar ); +begin + SDL_SetError( fmt ); +end; + +function IMG_GetError : PChar; +begin + result := SDL_GetError; +end; + +end. diff --git a/packages/extra/sdl/sdl_mixer.pas b/packages/extra/sdl/sdl_mixer.pas index 34e148f6a0..4efbb4f7e4 100644 --- a/packages/extra/sdl/sdl_mixer.pas +++ b/packages/extra/sdl/sdl_mixer.pas @@ -1,1072 +1,1072 @@ -unit sdl_mixer; -{******************************************************************************} -{ - $Id: sdl_mixer.pas,v 1.11 2005/01/01 02:05:19 savage Exp $ - -} -{ } -{ Borland Delphi SDL_Mixer - Simple DirectMedia Layer Mixer Library } -{ Conversion of the Simple DirectMedia Layer Headers } -{ } -{ Portions created by Sam Lantinga are } -{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } -{ 5635-34 Springhouse Dr. } -{ Pleasanton, CA 94588 (USA) } -{ } -{ All Rights Reserved. } -{ } -{ The original files are : SDL_mixer.h } -{ music_cmd.h } -{ wavestream.h } -{ timidity.h } -{ playmidi.h } -{ music_ogg.h } -{ mikmod.h } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2001 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Matthias Thoma } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ SDL.pas & SMPEG.pas somewhere within your search path. } -{ } -{ Programming Notes } -{ ----------------- } -{ See the Aliens Demo to see how this library is used } -{ } -{ Revision History } -{ ---------------- } -{ April 02 2001 - DL : Initial Translation } -{ } -{ February 02 2002 - DL : Update to version 1.2.1 } -{ } -{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } -{ Pascal compilers. Initial support is now included } -{ for GnuPascal, VirtualPascal, TMT and obviously } -{ continue support for Delphi Kylix and FreePascal. } -{ } -{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} -{ better TMT Pascal support and under instruction } -{ from Prof. Abimbola Olowofoyeku (The African Chief),} -{ I have added better Gnu Pascal support } -{ } -{ April 30 2003 - DL : under instruction from David Mears AKA } -{ Jason Siletto, I have added FPC Linux support. } -{ This was compiled with fpc 1.1, so remember to set } -{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } -{ } -{ - $Log: sdl_mixer.pas,v $ - Revision 1.11 2005/01/01 02:05:19 savage - Updated to v1.2.6 - - Revision 1.10 2004/09/12 21:45:17 savage - Robert Reed spotted that Mix_SetMusicPosition was missing from the conversion, so this has now been added. - - Revision 1.9 2004/08/27 21:48:24 savage - IFDEFed out Smpeg support on MacOS X - - Revision 1.8 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.7 2004/05/10 14:10:04 savage - Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). - - Revision 1.6 2004/04/13 09:32:08 savage - Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. - - Revision 1.5 2004/04/01 20:53:23 savage - Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. - - Revision 1.4 2004/03/31 22:20:02 savage - Windows unit not used in this file, so it was removed to keep the code tidy. - - Revision 1.3 2004/03/31 10:05:08 savage - Better defines for Endianess under FreePascal and Borland compilers. - - Revision 1.2 2004/03/30 20:23:28 savage - Tidied up use of UNIX compiler directive. - - Revision 1.1 2004/02/14 23:35:42 savage - version 1 of sdl_image, sdl_mixer and smpeg. - - -} -{******************************************************************************} - -{$I jedi-sdl.inc} - -interface - -{$IFDEF FPC} -{$IFDEF FPC_LITTLE_ENDIAN} -{$DEFINE IA32} -{$ENDIF} -{$ENDIF} - -uses -{$IFNDEF DARWIN} - smpeg, -{$ENDIF} - sdl; - -const -{$IFDEF WIN32} - SDL_MixerLibName = 'SDL_mixer.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - SDL_MixerLibName = 'libSDL_mixer.dylib'; -{$ELSE} - SDL_MixerLibName = 'libSDL_mixer.so'; -{$ENDIF} -{$ENDIF} - -{$IFDEF MACOS} - SDL_MixerLibName = 'SDL_mixer'; -{$ENDIF} - - {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *} - SDL_MIXER_MAJOR_VERSION = 1; -{$EXTERNALSYM MIX_MAJOR_VERSION} - SDL_MIXER_MINOR_VERSION = 2; -{$EXTERNALSYM MIX_MINOR_VERSION} - SDL_MIXER_PATCHLEVEL = 6; -{$EXTERNALSYM MIX_PATCHLEVEL} - - // Backwards compatibility - MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION; - MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION; - MIX_PATCHLEVEL = SDL_MIXER_PATCHLEVEL; - - // SDL_Mixer.h constants - { The default mixer has 8 simultaneous mixing channels } -{$IFNDEF MIX_CHANNELS} - MIX_CHANNELS = 8; -{$ENDIF} -{$EXTERNALSYM MIX_CHANNELS} - { Good default values for a PC soundcard } - MIX_DEFAULT_FREQUENCY = 22050; -{$EXTERNALSYM MIX_DEFAULT_FREQUENCY} - -{$IFDEF IA32} - MIX_DEFAULT_FORMAT = AUDIO_S16LSB; -{$ELSE} - MIX_DEFAULT_FORMAT = AUDIO_S16MSB; -{$ENDIF} -{$EXTERNALSYM MIX_DEFAULT_FORMAT} - - MIX_DEFAULT_CHANNELS = 2; -{$EXTERNALSYM MIX_DEFAULT_CHANNELS} - MIX_MAX_VOLUME = 128; { Volume of a chunk } -{$EXTERNALSYM MIX_MAX_VOLUME} - - PATH_MAX = 255; - - // mikmod.h constants - {* - * Library version - *} - LIBMIKMOD_VERSION_MAJOR = 3; - LIBMIKMOD_VERSION_MINOR = 1; - LIBMIKMOD_REVISION = 8; - LIBMIKMOD_VERSION = ( ( LIBMIKMOD_VERSION_MAJOR shl 16 ) or - ( LIBMIKMOD_VERSION_MINOR shl 8 ) or - ( LIBMIKMOD_REVISION ) ); - -type - //music_cmd.h types - PMusicCMD = ^TMusicCMD; - TMusicCMD = record - filename : array[ 0..PATH_MAX - 1 ] of char; - cmd : array[ 0..PATH_MAX - 1 ] of char; - pid : TSYS_ThreadHandle; - end; - - //wavestream.h types - PWAVStream = ^TWAVStream; - TWAVStream = record - wavefp : Pointer; - start : longint; - stop : longint; - cvt : TSDL_AudioCVT; - end; - - //playmidi.h types - PMidiEvent = ^TMidiEvent; - TMidiEvent = record - time : Longint; - channel : uint8; - type_ : uint8; - a : uint8; - b : uint8; - end; - - PMidiSong = ^TMidiSong; - TMidiSong = record - samples : Longint; - events : PMidiEvent; - end; - - //music_ogg.h types - POGG_Music = ^TOGG_Music; - TOGG_Music = record - playing : integer; - volume : integer; - //vf: OggVorbis_File; - section : integer; - cvt : TSDL_AudioCVT; - len_available : integer; - snd_available : PUint8; - end; - - // mikmod.h types - {* - * Error codes - *} - TErrorEnum = ( - MMERR_OPENING_FILE, - MMERR_OUT_OF_MEMORY, - MMERR_DYNAMIC_LINKING, - MMERR_SAMPLE_TOO_BIG, - MMERR_OUT_OF_HANDLES, - MMERR_UNKNOWN_WAVE_TYPE, - MMERR_LOADING_PATTERN, - MMERR_LOADING_TRACK, - MMERR_LOADING_HEADER, - MMERR_LOADING_SAMPLEINFO, - MMERR_NOT_A_MODULE, - MMERR_NOT_A_STREAM, - MMERR_MED_SYNTHSAMPLES, - MMERR_ITPACK_INVALID_DATA, - MMERR_DETECTING_DEVICE, - MMERR_INVALID_DEVICE, - MMERR_INITIALIZING_MIXER, - MMERR_OPENING_AUDIO, - MMERR_8BIT_ONLY, - MMERR_16BIT_ONLY, - MMERR_STEREO_ONLY, - MMERR_ULAW, - MMERR_NON_BLOCK, - MMERR_AF_AUDIO_PORT, - MMERR_AIX_CONFIG_INIT, - MMERR_AIX_CONFIG_CONTROL, - MMERR_AIX_CONFIG_START, - MMERR_GUS_SETTINGS, - MMERR_GUS_RESET, - MMERR_GUS_TIMER, - MMERR_HP_SETSAMPLESIZE, - MMERR_HP_SETSPEED, - MMERR_HP_CHANNELS, - MMERR_HP_AUDIO_OUTPUT, - MMERR_HP_AUDIO_DESC, - MMERR_HP_BUFFERSIZE, - MMERR_OSS_SETFRAGMENT, - MMERR_OSS_SETSAMPLESIZE, - MMERR_OSS_SETSTEREO, - MMERR_OSS_SETSPEED, - MMERR_SGI_SPEED, - MMERR_SGI_16BIT, - MMERR_SGI_8BIT, - MMERR_SGI_STEREO, - MMERR_SGI_MONO, - MMERR_SUN_INIT, - MMERR_OS2_MIXSETUP, - MMERR_OS2_SEMAPHORE, - MMERR_OS2_TIMER, - MMERR_OS2_THREAD, - MMERR_DS_PRIORITY, - MMERR_DS_BUFFER, - MMERR_DS_FORMAT, - MMERR_DS_NOTIFY, - MMERR_DS_EVENT, - MMERR_DS_THREAD, - MMERR_DS_UPDATE, - MMERR_WINMM_HANDLE, - MMERR_WINMM_ALLOCATED, - MMERR_WINMM_DEVICEID, - MMERR_WINMM_FORMAT, - MMERR_WINMM_UNKNOWN, - MMERR_MAC_SPEED, - MMERR_MAC_START, - MMERR_MAX - ); - - PMODULE = ^TMODULE; - TMODULE = record - (* general module information *) - //CHAR* songname; (* name of the song *) - //CHAR* modtype; (* string type of module loaded *) - //CHAR* comment; (* module comments *) - //UWORD flags; (* See module flags above *) - //UBYTE numchn; (* number of module channels *) - //UBYTE numvoices; (* max # voices used for full NNA playback *) - //UWORD numpos; (* number of positions in this song *) - //UWORD numpat; (* number of patterns in this song *) - //UWORD numins; (* number of instruments *) - //UWORD numsmp; (* number of samples *) - //type = record INSTRUMENT* instruments; (* all instruments *) - //type = record SAMPLE* samples; (* all samples *) - //UBYTE realchn; (* real number of channels used *) - //UBYTE totalchn; (* total number of channels used (incl NNAs) *) - (* playback settings *) - //UWORD reppos; (* restart position *) - //UBYTE initspeed; (* initial song speed *) - //UWORD inittempo; (* initial song tempo *) - //UBYTE initvolume; (* initial global volume (0 - 128) *) - //UWORD panning : array[ 0..64- 1 ] of ; (* 64 panning positions *) - //UBYTE chanvol : array[ 0..64- 1 ] of ; (* 64 channel positions *) - //UWORD bpm; (* current beats-per-minute speed *) - //UWORD sngspd; (* current song speed *) - //SWORD volume; (* song volume (0-128) (or user volume) *) - //BOOL extspd; (* extended speed flag (default enabled) *) - //BOOL panflag; (* panning flag (default enabled) *) - //BOOL wrap; (* wrap module ? (default disabled) *) - //BOOL loop; (* allow module to loop ? (default enabled) *) - //BOOL fadeout; (* volume fade out during last pattern *) - //UWORD patpos; (* current row number *) - //SWORD sngpos; (* current song position *) - //ULONG sngtime; (* current song time in 2^-10 seconds *) - //SWORD relspd; (* relative speed factor *) - (* internal module representation *) - //UWORD numtrk; (* number of tracks *) - //UBYTE** tracks; (* array of numtrk pointers to tracks *) - //UWORD* patterns; (* array of Patterns *) - //UWORD* pattrows; (* array of number of rows for each pattern *) - //UWORD* positions; (* all positions *) - //BOOL forbid; (* if true, no player updatenot *) - //UWORD numrow; (* number of rows on current pattern *) - //UWORD vbtick; (* tick counter (counts from 0 to sngspd) *) - //UWORD sngremainder;(* used for song time computation *) - //type = record MP_CONTROL* control; (* Effects Channel info (size pf.numchn) *) - //type = record MP_VOICE* voice; (* Audio Voice information (size md_numchn) *) - //UBYTE globalslide; (* global volume slide rate *) - //UBYTE pat_repcrazy;(* module has just looped to position -1 *) - //UWORD patbrk; (* position where to start a new pattern *) - //UBYTE patdly; (* patterndelay counter (command memory) *) - //UBYTE patdly2; (* patterndelay counter (real one) *) - //SWORD posjmp; (* flag to indicate a jump is needed... *) - end; - - PUNIMOD = ^TUNIMOD; - TUNIMOD = TMODULE; - - //SDL_mixer.h types - { The internal format for an audio chunk } - PMix_Chunk = ^TMix_Chunk; - TMix_Chunk = record - allocated : integer; - abuf : PUint8; - alen : Uint32; - volume : Uint8; { Per-sample volume, 0-128 } - end; - Mix_Chunk = TMix_Chunk; - - { The different fading types supported } - TMix_Fading = ( - MIX_NO_FADING, - MIX_FADING_OUT, - MIX_FADING_IN - ); - Mix_Fading = TMix_Fading; - - TMusic = ( MUS_CMD, - MUS_WAV, - MUS_MOD, - MUS_MID, - MUS_OGG, - MUS_MP3 - ); - - TMusicUnion = record - case Byte of - 0 : ( cmd : PMusicCMD ); - 1 : ( wave : PWAVStream ); - 2 : ( module : PUNIMOD ); - 3 : ( midi : TMidiSong ); - 4 : ( ogg : POGG_music ); - {$IFNDEF DARWIN} - 5 : ( mp3 : PSMPEG ); - {$ENDIF} - end; - - P_Mix_Music = ^T_Mix_Music; - T_Mix_Music = record - type_ : TMusic; - data : TMusicUnion; - fading : TMix_Fading; - fade_volume : integer; - fade_step : integer; - fade_steps : integer; - error : integer; - end; - - { The internal format for a music chunk interpreted via mikmod } - PMix_Music = ^TMix_Music; - TMix_Music = T_Mix_Music; - - {$IFNDEF __GPC__} - TMixFunction = function( udata : Pointer; stream : PUint8; len : integer ) : Pointer; cdecl; - {$ELSE} - TMixFunction = function( udata : Pointer; stream : PUint8; len : integer ) : Pointer; - {$ENDIF} - -{ This macro can be used to fill a version structure with the compile-time - version of the SDL_mixer library. } -procedure SDL_MIXER_VERSION(var X: TSDL_Version); -{$EXTERNALSYM SDL_MIXER_VERSION} - -{ This function gets the version of the dynamically linked SDL_mixer library. - It should NOT be used to fill a version structure, instead you should use the - SDL_MIXER_VERSION() macro. } -function Mix_Linked_Version : PSDL_version; -cdecl; external {$IFDEF __GPC__}name 'Mix_Linked_Version'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_Linked_Version} - -{ Open the mixer with a certain audio format } -function Mix_OpenAudio( frequency : integer; format : Uint16; channels : - integer; chunksize : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_OpenAudio'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_OpenAudio} - -{ Dynamically change the number of channels managed by the mixer. - If decreasing the number of channels, the upper channels are - stopped. - This function returns the new number of allocated channels. - } -function Mix_AllocateChannels( numchannels : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_AllocateChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_AllocateChannels} - -{ Find out what the actual audio device parameters are. - This function returns 1 if the audio has been opened, 0 otherwise. - } -function Mix_QuerySpec( var frequency : integer; var format : Uint16; var channels : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_QuerySpec'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_QuerySpec} - -{ Load a wave file or a music (.mod .s3m .it .xm) file } -function Mix_LoadWAV_RW( src : PSDL_RWops; freesrc : integer ) : PMix_Chunk; -cdecl; external {$IFDEF __GPC__}name 'Mix_LoadWAV_RW'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_LoadWAV_RW} - -function Mix_LoadWAV( filename : PChar ) : PMix_Chunk; - -function Mix_LoadMUS( const filename : PChar ) : PMix_Music; -cdecl; external {$IFDEF __GPC__}name 'Mix_LoadMUS'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_LoadMUS} - -(*#if 0 { This hasn't been hooked into music.c yet } -{ Load a music file from an SDL_RWop object (MikMod-specific currently) - Matt Campbell (matt@campbellhome.dhs.org) April 2000 } -function Mix_LoadMUS_RW(SDL_RWops *rw) : PMix_Music; cdecl; -#endif*) - -{ Load a wave file of the mixer format from a memory buffer } -function Mix_QuickLoad_WAV( mem : PUint8 ) : PMix_Chunk; -cdecl; external {$IFDEF __GPC__}name 'Mix_QuickLoad_WAV'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_QuickLoad_WAV} - -{ Free an audio chunk previously loaded } -procedure Mix_FreeChunk( chunk : PMix_Chunk ); -cdecl; external {$IFDEF __GPC__}name 'Mix_FreeChunk'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FreeChunk} - -procedure Mix_FreeMusic( music : PMix_Music ); -cdecl; external {$IFDEF __GPC__}name 'Mix_FreeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FreeMusic} - -{ Set a function that is called after all mixing is performed. - This can be used to provide real-time visual display of the audio stream - or add a custom mixer filter for the stream data. -} -procedure Mix_SetPostMix( mix_func : TMixFunction; arg : Pointer ); -cdecl; external {$IFDEF __GPC__}name 'Mix_SetPostMix'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_SetPostMix} - -{ Add your own music player or additional mixer function. - If 'mix_func' is NULL, the default music player is re-enabled. - } -procedure Mix_HookMusic( mix_func : TMixFunction; arg : Pointer ); - cdecl; external {$IFDEF __GPC__}name 'Mix_HookMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_HookMusic} - -{ Add your own callback when the music has finished playing. - } -procedure Mix_HookMusicFinished( music_finished : Pointer ); -cdecl; external {$IFDEF __GPC__}name 'Mix_HookMusicFinished'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_HookMusicFinished} - -{ Get a pointer to the user data for the current music hook } -function Mix_GetMusicHookData : Pointer; -cdecl; external {$IFDEF __GPC__}name 'Mix_GetMusicHookData'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_GetMusicHookData} - -{* Add your own callback when a channel has finished playing. NULL - * to disable callback.*} -type - {$IFNDEF __GPC__} - TChannel_finished = procedure( channel: Integer ); cdecl; - {$ELSE} - TChannel_finished = procedure( channel: Integer ); - {$ENDIF} - -procedure Mix_ChannelFinished( channel_finished : TChannel_finished ); -cdecl; external {$IFDEF __GPC__}name 'Mix_ChannelFinished'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_ChannelFinished} - -const - MIX_CHANNEL_POST = -2; - - {* This is the format of a special effect callback: - * - * myeffect(int chan, void *stream, int len, void *udata); - * - * (chan) is the channel number that your effect is affecting. (stream) is - * the buffer of data to work upon. (len) is the size of (stream), and - * (udata) is a user-defined bit of data, which you pass as the last arg of - * Mix_RegisterEffect(), and is passed back unmolested to your callback. - * Your effect changes the contents of (stream) based on whatever parameters - * are significant, or just leaves it be, if you prefer. You can do whatever - * you like to the buffer, though, and it will continue in its changed state - * down the mixing pipeline, through any other effect functions, then finally - * to be mixed with the rest of the channels and music for the final output - * stream. - *} -type - {$IFNDEF __GPC__} - TMix_EffectFunc = function( chan : integer; stream : Pointer; len : integer; udata : Pointer ) : Pointer; cdecl; - {$ELSE} - TMix_EffectFunc = function( chan : integer; stream : Pointer; len : integer; udata : Pointer ) : Pointer; - {$ENDIF} - {* - * This is a callback that signifies that a channel has finished all its - * loops and has completed playback. This gets called if the buffer - * plays out normally, or if you call Mix_HaltChannel(), implicitly stop - * a channel via Mix_AllocateChannels(), or unregister a callback while - * it's still playing. - *} - {$IFNDEF __GPC__} - TMix_EffectDone = function( chan : integer; udata : Pointer ) : Pointer; cdecl; - {$ELSE} - TMix_EffectDone = function( chan : integer; udata : Pointer ) : Pointer; - {$ENDIF} - {* Register a special effect function. At mixing time, the channel data is - * copied into a buffer and passed through each registered effect function. - * After it passes through all the functions, it is mixed into the final - * output stream. The copy to buffer is performed once, then each effect - * function performs on the output of the previous effect. Understand that - * this extra copy to a buffer is not performed if there are no effects - * registered for a given chunk, which saves CPU cycles, and any given - * effect will be extra cycles, too, so it is crucial that your code run - * fast. Also note that the data that your function is given is in the - * format of the sound device, and not the format you gave to Mix_OpenAudio(), - * although they may in reality be the same. This is an unfortunate but - * necessary speed concern. Use Mix_QuerySpec() to determine if you can - * handle the data before you register your effect, and take appropriate - * actions. - * You may also specify a callback (Mix_EffectDone_t) that is called when - * the channel finishes playing. This gives you a more fine-grained control - * than Mix_ChannelFinished(), in case you need to free effect-specific - * resources, etc. If you don't need this, you can specify NULL. - * You may set the callbacks before or after calling Mix_PlayChannel(). - * Things like Mix_SetPanning() are just internal special effect functions, - * so if you are using that, you've already incurred the overhead of a copy - * to a separate buffer, and that these effects will be in the queue with - * any functions you've registered. The list of registered effects for a - * channel is reset when a chunk finishes playing, so you need to explicitly - * set them with each call to Mix_PlayChannel*(). - * You may also register a special effect function that is to be run after - * final mixing occurs. The rules for these callbacks are identical to those - * in Mix_RegisterEffect, but they are run after all the channels and the - * music have been mixed into a single stream, whereas channel-specific - * effects run on a given channel before any other mixing occurs. These - * global effect callbacks are call "posteffects". Posteffects only have - * their Mix_EffectDone_t function called when they are unregistered (since - * the main output stream is never "done" in the same sense as a channel). - * You must unregister them manually when you've had enough. Your callback - * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the - * processing is considered a posteffect. - * - * After all these effects have finished processing, the callback registered - * through Mix_SetPostMix() runs, and then the stream goes to the audio - * device. - * - * returns zero if error (no such channel), nonzero if added. - * Error messages can be retrieved from Mix_GetError(). - *} -function Mix_RegisterEffect( chan : integer; f : TMix_EffectFunc; d : TMix_EffectDone; arg : Pointer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_RegisterEffect'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_RegisterEffect} - -{* You may not need to call this explicitly, unless you need to stop an - * effect from processing in the middle of a chunk's playback. - * Posteffects are never implicitly unregistered as they are for channels, - * but they may be explicitly unregistered through this function by - * specifying MIX_CHANNEL_POST for a channel. - * returns zero if error (no such channel or effect), nonzero if removed. - * Error messages can be retrieved from Mix_GetError(). - *} -function Mix_UnregisterEffect( channel : integer; f : TMix_EffectFunc ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_UnregisterEffect'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_UnregisterEffect} - - {* You may not need to call this explicitly, unless you need to stop all - * effects from processing in the middle of a chunk's playback. Note that - * this will also shut off some internal effect processing, since - * Mix_SetPanning( ) and others may use this API under the hood.This is - * called internally when a channel completes playback. - * Posteffects are never implicitly unregistered as they are for channels, - * but they may be explicitly unregistered through this function by - * specifying MIX_CHANNEL_POST for a channel. - * returns zero if error( no such channel ), nonzero if all effects removed. - * Error messages can be retrieved from Mix_GetError( ). - *} -function Mix_UnregisterAllEffects( channel : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_UnregisterAllEffects'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_UnregisterAllEffects} - -const - MIX_EFFECTSMAXSPEED = 'MIX_EFFECTSMAXSPEED'; - - {* - * These are the internally - defined mixing effects.They use the same API that - * effects defined in the application use, but are provided here as a - * convenience.Some effects can reduce their quality or use more memory in - * the name of speed; to enable this, make sure the environment variable - * MIX_EFFECTSMAXSPEED( see above ) is defined before you call - * Mix_OpenAudio( ). - * } - - {* set the panning of a channel.The left and right channels are specified - * as integers between 0 and 255, quietest to loudest, respectively. - * - * Technically, this is just individual volume control for a sample with - * two( stereo )channels, so it can be used for more than just panning. - * if you want real panning, call it like this : - * - * Mix_SetPanning( channel, left, 255 - left ); - * - * ...which isn't so hard. - * - * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and - * the panning will be done to the final mixed stream before passing it on - * to the audio device. - * - * This uses the Mix_RegisterEffect( )API internally, and returns without - * registering the effect function if the audio device is not configured - * for stereo output.Setting both( left ) and ( right ) to 255 causes this - * effect to be unregistered, since that is the data's normal state. - * - * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), - * nonzero if panning effect enabled.Note that an audio device in mono - * mode is a no - op, but this call will return successful in that case . - * Error messages can be retrieved from Mix_GetError( ). - * } - function Mix_SetPanning( channel : integer; left : Uint8; right : Uint8 ) : integer; - cdecl; external {$IFDEF __GPC__}name 'Mix_SetPanning'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; - {$EXTERNALSYM Mix_SetPanning} - - { * set the position ofa channel.( angle ) is an integer from 0 to 360, that - * specifies the location of the sound in relation to the listener.( angle ) - * will be reduced as neccesary( 540 becomes 180 degrees, -100 becomes 260 ). - * Angle 0 is due north, and rotates clockwise as the value increases. - * for efficiency, the precision of this effect may be limited( angles 1 - * through 7 might all produce the same effect, 8 through 15 are equal, etc ). - * ( distance ) is an integer between 0 and 255 that specifies the space - * between the sound and the listener.The larger the number, the further - * away the sound is .Using 255 does not guarantee that the channel will be - * culled from the mixing process or be completely silent.For efficiency, - * the precision of this effect may be limited( distance 0 through 5 might - * all produce the same effect, 6 through 10 are equal, etc ).Setting( angle ) - * and ( distance ) to 0 unregisters this effect, since the data would be - * unchanged. - * - * if you need more precise positional audio, consider using OpenAL for - * spatialized effects instead of SDL_mixer.This is only meant to be a - * basic effect for simple "3D" games. - * - * if the audio device is configured for mono output, then you won't get - * any effectiveness from the angle; however, distance attenuation on the - * channel will still occur.While this effect will function with stereo - * voices, it makes more sense to use voices with only one channel of sound, - * so when they are mixed through this effect, the positioning will sound - * correct.You can convert them to mono through SDL before giving them to - * the mixer in the first place if you like. - * - * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and - * the positioning will be done to the final mixed stream before passing it - * on to the audio device. - * - * This is a convenience wrapper over Mix_SetDistance( ) and Mix_SetPanning( ). - * - * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), - * nonzero if position effect is enabled. - * Error messages can be retrieved from Mix_GetError( ). - * } - function Mix_SetPosition( channel :integer; angle : Sint16; distance : Uint8 ) : integer; - cdecl; external {$IFDEF __GPC__}name 'Mix_SetPosition'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; - {$EXTERNALSYM Mix_SetPosition} - - {* set the "distance" of a channel.( distance ) is an integer from 0 to 255 - * that specifies the location of the sound in relation to the listener. - * Distance 0 is overlapping the listener, and 255 is as far away as possible - * A distance of 255 does not guarantee silence; in such a case , you might - * want to try changing the chunk's volume, or just cull the sample from the - * mixing process with Mix_HaltChannel( ). - * for efficiency, the precision of this effect may be limited( distances 1 - * through 7 might all produce the same effect, 8 through 15 are equal, etc ). - * ( distance ) is an integer between 0 and 255 that specifies the space - * between the sound and the listener.The larger the number, the further - * away the sound is . - * Setting( distance ) to 0 unregisters this effect, since the data would be - * unchanged. - * if you need more precise positional audio, consider using OpenAL for - * spatialized effects instead of SDL_mixer.This is only meant to be a - * basic effect for simple "3D" games. - * - * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and - * the distance attenuation will be done to the final mixed stream before - * passing it on to the audio device. - * - * This uses the Mix_RegisterEffect( )API internally. - * - * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), - * nonzero if position effect is enabled. - * Error messages can be retrieved from Mix_GetError( ). - * } - function Mix_SetDistance( channel : integer; distance : Uint8 ) : integer; - cdecl; external {$IFDEF __GPC__}name 'Mix_SetDistance'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; - {$EXTERNALSYM Mix_SetDistance} - { * - * !!! FIXME : Haven't implemented, since the effect goes past the - * end of the sound buffer.Will have to think about this. - * - -ryan. - * / - { if 0 - { * Causes an echo effect to be mixed into a sound.( echo ) is the amount - * of echo to mix.0 is no echo, 255 is infinite( and probably not - * what you want ). - * - * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and - * the reverbing will be done to the final mixed stream before passing it on - * to the audio device. - * - * This uses the Mix_RegisterEffect( )API internally.If you specify an echo - * of zero, the effect is unregistered, as the data is already in that state. - * - * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), - * nonzero if reversing effect is enabled. - * Error messages can be retrieved from Mix_GetError( ). - * - extern no_parse_DECLSPEC int Mix_SetReverb( int channel, Uint8 echo ); - #E ndif} - { * Causes a channel to reverse its stereo.This is handy if the user has his - * speakers hooked up backwards, or you would like to have a minor bit of - * psychedelia in your sound code. : )Calling this function with ( flip ) - * set to non - zero reverses the chunks's usual channels. If (flip) is zero, - * the effect is unregistered. - * - * This uses the Mix_RegisterEffect( )API internally, and thus is probably - * more CPU intensive than having the user just plug in his speakers - * correctly.Mix_SetReverseStereo( )returns without registering the effect - * function if the audio device is not configured for stereo output. - * - * if you specify MIX_CHANNEL_POST for ( channel ), then this the effect is used - * on the final mixed stream before sending it on to the audio device( a - * posteffect ). - * - * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), - * nonzero if reversing effect is enabled.Note that an audio device in mono - * mode is a no - op, but this call will return successful in that case . - * Error messages can be retrieved from Mix_GetError( ). - * } - function Mix_SetReverseStereo( channel : integer; flip : integer ) : integer; - cdecl; external {$IFDEF __GPC__}name 'Mix_SetReverseStereo'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; - {$EXTERNALSYM Mix_SetReverseStereo} - { end of effects API. - -ryan. *} - -{ Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate - them dynamically to the next sample if requested with a -1 value below. - Returns the number of reserved channels. - } -function Mix_ReserveChannels( num : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_ReserveChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_ReserveChannels} - -{ Channel grouping functions } - -{ Attach a tag to a channel. A tag can be assigned to several mixer - channels, to form groups of channels. - If 'tag' is -1, the tag is removed (actually -1 is the tag used to - represent the group of all the channels). - Returns true if everything was OK. - } -function Mix_GroupChannel( which : integer; tag : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_GroupChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_GroupChannel} - -{ Assign several consecutive channels to a group } -function Mix_GroupChannels( from : integer; to_ : integer; tag : integer ) : -integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_GroupChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_GroupChannels} - -{ Finds the first available channel in a group of channels } -function Mix_GroupAvailable( tag : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_GroupAvailable'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_GroupAvailable} - -{ Returns the number of channels in a group. This is also a subtle - way to get the total number of channels when 'tag' is -1 - } -function Mix_GroupCount( tag : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_GroupCount'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_GroupCount} - -{ Finds the "oldest" sample playing in a group of channels } -function Mix_GroupOldest( tag : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_GroupOldest'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_GroupOldest} - -{ Finds the "most recent" (i.e. last) sample playing in a group of channels } -function Mix_GroupNewer( tag : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_GroupNewer'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_GroupNewer} - -{ The same as above, but the sound is played at most 'ticks' milliseconds } -function Mix_PlayChannelTimed( channel : integer; chunk : PMix_Chunk; loops : integer; ticks : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_PlayChannelTimed'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_PlayChannelTimed} - -{ Play an audio chunk on a specific channel. - If the specified channel is -1, play on the first free channel. - If 'loops' is greater than zero, loop the sound that many times. - If 'loops' is -1, loop inifinitely (~65000 times). - Returns which channel was used to play the sound. -} -function Mix_PlayChannel( channel : integer; chunk : PMix_Chunk; loops : integer ) : integer; - -function Mix_PlayMusic( music : PMix_Music; loops : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_PlayMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_PlayMusic} - -{ Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions } -function Mix_FadeInMusic( music : PMix_Music; loops : integer; ms : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_FadeInMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FadeInMusic} - -function Mix_FadeInChannelTimed( channel : integer; chunk : PMix_Chunk; loops : integer; ms : integer; ticks : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_FadeInChannelTimed'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FadeInChannelTimed} - -function Mix_FadeInChannel( channel : integer; chunk : PMix_Chunk; loops : integer; ms : integer ) : integer; - -{ Set the volume in the range of 0-128 of a specific channel or chunk. - If the specified channel is -1, set volume for all channels. - Returns the original volume. - If the specified volume is -1, just return the current volume. -} -function Mix_Volume( channel : integer; volume : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_Volume'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_Volume} - -function Mix_VolumeChunk( chunk : PMix_Chunk; volume : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_VolumeChunk'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_VolumeChunk} - -function Mix_VolumeMusic( volume : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_VolumeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_VolumeMusic} - -{ Halt playing of a particular channel } -function Mix_HaltChannel( channel : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_HaltChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_HaltChannel} - -function Mix_HaltGroup( tag : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_HaltGroup'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_HaltGroup} - -function Mix_HaltMusic : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_HaltMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_HaltMusic} - -{ Change the expiration delay for a particular channel. - The sample will stop playing after the 'ticks' milliseconds have elapsed, - or remove the expiration if 'ticks' is -1 -} -function Mix_ExpireChannel( channel : integer; ticks : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_ExpireChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_ExpireChannel} - -{ Halt a channel, fading it out progressively till it's silent - The ms parameter indicates the number of milliseconds the fading - will take. - } -function Mix_FadeOutChannel( which : integer; ms : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FadeOutChannel} -function Mix_FadeOutGroup( tag : integer; ms : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutGroup'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FadeOutGroup} -function Mix_FadeOutMusic( ms : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FadeOutMusic} - -{ Query the fading status of a channel } -function Mix_FadingMusic : TMix_Fading; -cdecl; external {$IFDEF __GPC__}name 'Mix_FadingMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FadingMusic} - -function Mix_FadingChannel( which : integer ) : TMix_Fading; -cdecl; external {$IFDEF __GPC__}name 'Mix_FadingChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_FadingChannel} - -{ Pause/Resume a particular channel } -procedure Mix_Pause( channel : integer ); -cdecl; external {$IFDEF __GPC__}name 'Mix_Pause'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_Pause} - -procedure Mix_Resume( channel : integer ); -cdecl; external {$IFDEF __GPC__}name 'Mix_Resume'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_Resume} - -function Mix_Paused( channel : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_Paused'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_Paused} - -{ Pause/Resume the music stream } -procedure Mix_PauseMusic; -cdecl; external {$IFDEF __GPC__}name 'Mix_PauseMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_PauseMusic} - -procedure Mix_ResumeMusic; -cdecl; external {$IFDEF __GPC__}name 'Mix_ResumeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_ResumeMusic} - -procedure Mix_RewindMusic; -cdecl; external {$IFDEF __GPC__}name 'Mix_RewindMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_RewindMusic} - -function Mix_PausedMusic : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_PausedMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_PausedMusic} - -{ Set the current position in the music stream. - This returns 0 if successful, or -1 if it failed or isn't implemented. - This function is only implemented for MOD music formats (set pattern - order number) and for OGG music (set position in seconds), at the - moment. -} -function Mix_SetMusicPosition( position : double ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_SetMusicPosition'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_SetMusicPosition} - -{ Check the status of a specific channel. - If the specified channel is -1, check all channels. -} -function Mix_Playing( channel : integer ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_Playing'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_Playing} - -function Mix_PlayingMusic : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_PlayingMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_PlayingMusic} - -{ Stop music and set external music playback command } -function Mix_SetMusicCMD( const command : PChar ) : integer; -cdecl; external {$IFDEF __GPC__}name 'Mix_SetMusicCMD'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_SetMusicCMD} - -{ Close the mixer, halting all playing audio } -procedure Mix_CloseAudio; -cdecl; external {$IFDEF __GPC__}name 'Mix_CloseAudio'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; -{$EXTERNALSYM Mix_CloseAudio} - -{ We'll use SDL for reporting errors } -procedure Mix_SetError( fmt : PChar ); - -function Mix_GetError : PChar; - -{------------------------------------------------------------------------------} -{ initialization } -{------------------------------------------------------------------------------} - -{------------------------------------------------------------------------------} - -implementation - -{$IFDEF __GPC__} - {$L 'sdl_mixer'} { link sdl_mixer.dll.a or libsdl_mixer.so or libsdl_mixer.a } -{$ENDIF} - -procedure SDL_MIXER_VERSION( var X : TSDL_version ); -begin - X.major := SDL_MIXER_MAJOR_VERSION; - X.minor := SDL_MIXER_MINOR_VERSION; - X.patch := SDL_MIXER_PATCHLEVEL; -end; - -function Mix_LoadWAV( filename : PChar ) : PMix_Chunk; -begin - result := Mix_LoadWAV_RW( SDL_RWFromFile( filename, 'rb' ), 1 ); -end; - -function Mix_PlayChannel( channel : integer; chunk : PMix_Chunk; loops : integer ) : integer; -begin - result := Mix_PlayChannelTimed( channel, chunk, loops, -1 ); -end; - -function Mix_FadeInChannel( channel : integer; chunk : PMix_Chunk; loops : - integer; ms : integer ) : integer; -begin - result := Mix_FadeInChannelTimed( channel, chunk, loops, ms, -1 ); -end; - -procedure Mix_SetError( fmt : PChar ); -begin - SDL_SetError( fmt ); -end; - -function Mix_GetError : PChar; -begin - result := SDL_GetError; -end; - +unit sdl_mixer; +{******************************************************************************} +{ + $Id: sdl_mixer.pas,v 1.11 2005/01/01 02:05:19 savage Exp $ + +} +{ } +{ Borland Delphi SDL_Mixer - Simple DirectMedia Layer Mixer Library } +{ Conversion of the Simple DirectMedia Layer Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_mixer.h } +{ music_cmd.h } +{ wavestream.h } +{ timidity.h } +{ playmidi.h } +{ music_ogg.h } +{ mikmod.h } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Matthias Thoma } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.pas & SMPEG.pas somewhere within your search path. } +{ } +{ Programming Notes } +{ ----------------- } +{ See the Aliens Demo to see how this library is used } +{ } +{ Revision History } +{ ---------------- } +{ April 02 2001 - DL : Initial Translation } +{ } +{ February 02 2002 - DL : Update to version 1.2.1 } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl_mixer.pas,v $ + Revision 1.11 2005/01/01 02:05:19 savage + Updated to v1.2.6 + + Revision 1.10 2004/09/12 21:45:17 savage + Robert Reed spotted that Mix_SetMusicPosition was missing from the conversion, so this has now been added. + + Revision 1.9 2004/08/27 21:48:24 savage + IFDEFed out Smpeg support on MacOS X + + Revision 1.8 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.7 2004/05/10 14:10:04 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.6 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.5 2004/04/01 20:53:23 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.4 2004/03/31 22:20:02 savage + Windows unit not used in this file, so it was removed to keep the code tidy. + + Revision 1.3 2004/03/31 10:05:08 savage + Better defines for Endianess under FreePascal and Borland compilers. + + Revision 1.2 2004/03/30 20:23:28 savage + Tidied up use of UNIX compiler directive. + + Revision 1.1 2004/02/14 23:35:42 savage + version 1 of sdl_image, sdl_mixer and smpeg. + + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +interface + +{$IFDEF FPC} +{$IFDEF FPC_LITTLE_ENDIAN} +{$DEFINE IA32} +{$ENDIF} +{$ENDIF} + +uses +{$IFNDEF DARWIN} + smpeg, +{$ENDIF} + sdl; + +const +{$IFDEF windows} + SDL_MixerLibName = 'SDL_mixer.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDL_MixerLibName = 'libSDL_mixer.dylib'; +{$ELSE} + SDL_MixerLibName = 'libSDL_mixer.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDL_MixerLibName = 'SDL_mixer'; +{$ENDIF} + + {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *} + SDL_MIXER_MAJOR_VERSION = 1; +{$EXTERNALSYM MIX_MAJOR_VERSION} + SDL_MIXER_MINOR_VERSION = 2; +{$EXTERNALSYM MIX_MINOR_VERSION} + SDL_MIXER_PATCHLEVEL = 6; +{$EXTERNALSYM MIX_PATCHLEVEL} + + // Backwards compatibility + MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION; + MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION; + MIX_PATCHLEVEL = SDL_MIXER_PATCHLEVEL; + + // SDL_Mixer.h constants + { The default mixer has 8 simultaneous mixing channels } +{$IFNDEF MIX_CHANNELS} + MIX_CHANNELS = 8; +{$ENDIF} +{$EXTERNALSYM MIX_CHANNELS} + { Good default values for a PC soundcard } + MIX_DEFAULT_FREQUENCY = 22050; +{$EXTERNALSYM MIX_DEFAULT_FREQUENCY} + +{$IFDEF IA32} + MIX_DEFAULT_FORMAT = AUDIO_S16LSB; +{$ELSE} + MIX_DEFAULT_FORMAT = AUDIO_S16MSB; +{$ENDIF} +{$EXTERNALSYM MIX_DEFAULT_FORMAT} + + MIX_DEFAULT_CHANNELS = 2; +{$EXTERNALSYM MIX_DEFAULT_CHANNELS} + MIX_MAX_VOLUME = 128; { Volume of a chunk } +{$EXTERNALSYM MIX_MAX_VOLUME} + + PATH_MAX = 255; + + // mikmod.h constants + {* + * Library version + *} + LIBMIKMOD_VERSION_MAJOR = 3; + LIBMIKMOD_VERSION_MINOR = 1; + LIBMIKMOD_REVISION = 8; + LIBMIKMOD_VERSION = ( ( LIBMIKMOD_VERSION_MAJOR shl 16 ) or + ( LIBMIKMOD_VERSION_MINOR shl 8 ) or + ( LIBMIKMOD_REVISION ) ); + +type + //music_cmd.h types + PMusicCMD = ^TMusicCMD; + TMusicCMD = record + filename : array[ 0..PATH_MAX - 1 ] of char; + cmd : array[ 0..PATH_MAX - 1 ] of char; + pid : TSYS_ThreadHandle; + end; + + //wavestream.h types + PWAVStream = ^TWAVStream; + TWAVStream = record + wavefp : Pointer; + start : longint; + stop : longint; + cvt : TSDL_AudioCVT; + end; + + //playmidi.h types + PMidiEvent = ^TMidiEvent; + TMidiEvent = record + time : Longint; + channel : uint8; + type_ : uint8; + a : uint8; + b : uint8; + end; + + PMidiSong = ^TMidiSong; + TMidiSong = record + samples : Longint; + events : PMidiEvent; + end; + + //music_ogg.h types + POGG_Music = ^TOGG_Music; + TOGG_Music = record + playing : integer; + volume : integer; + //vf: OggVorbis_File; + section : integer; + cvt : TSDL_AudioCVT; + len_available : integer; + snd_available : PUint8; + end; + + // mikmod.h types + {* + * Error codes + *} + TErrorEnum = ( + MMERR_OPENING_FILE, + MMERR_OUT_OF_MEMORY, + MMERR_DYNAMIC_LINKING, + MMERR_SAMPLE_TOO_BIG, + MMERR_OUT_OF_HANDLES, + MMERR_UNKNOWN_WAVE_TYPE, + MMERR_LOADING_PATTERN, + MMERR_LOADING_TRACK, + MMERR_LOADING_HEADER, + MMERR_LOADING_SAMPLEINFO, + MMERR_NOT_A_MODULE, + MMERR_NOT_A_STREAM, + MMERR_MED_SYNTHSAMPLES, + MMERR_ITPACK_INVALID_DATA, + MMERR_DETECTING_DEVICE, + MMERR_INVALID_DEVICE, + MMERR_INITIALIZING_MIXER, + MMERR_OPENING_AUDIO, + MMERR_8BIT_ONLY, + MMERR_16BIT_ONLY, + MMERR_STEREO_ONLY, + MMERR_ULAW, + MMERR_NON_BLOCK, + MMERR_AF_AUDIO_PORT, + MMERR_AIX_CONFIG_INIT, + MMERR_AIX_CONFIG_CONTROL, + MMERR_AIX_CONFIG_START, + MMERR_GUS_SETTINGS, + MMERR_GUS_RESET, + MMERR_GUS_TIMER, + MMERR_HP_SETSAMPLESIZE, + MMERR_HP_SETSPEED, + MMERR_HP_CHANNELS, + MMERR_HP_AUDIO_OUTPUT, + MMERR_HP_AUDIO_DESC, + MMERR_HP_BUFFERSIZE, + MMERR_OSS_SETFRAGMENT, + MMERR_OSS_SETSAMPLESIZE, + MMERR_OSS_SETSTEREO, + MMERR_OSS_SETSPEED, + MMERR_SGI_SPEED, + MMERR_SGI_16BIT, + MMERR_SGI_8BIT, + MMERR_SGI_STEREO, + MMERR_SGI_MONO, + MMERR_SUN_INIT, + MMERR_OS2_MIXSETUP, + MMERR_OS2_SEMAPHORE, + MMERR_OS2_TIMER, + MMERR_OS2_THREAD, + MMERR_DS_PRIORITY, + MMERR_DS_BUFFER, + MMERR_DS_FORMAT, + MMERR_DS_NOTIFY, + MMERR_DS_EVENT, + MMERR_DS_THREAD, + MMERR_DS_UPDATE, + MMERR_WINMM_HANDLE, + MMERR_WINMM_ALLOCATED, + MMERR_WINMM_DEVICEID, + MMERR_WINMM_FORMAT, + MMERR_WINMM_UNKNOWN, + MMERR_MAC_SPEED, + MMERR_MAC_START, + MMERR_MAX + ); + + PMODULE = ^TMODULE; + TMODULE = record + (* general module information *) + //CHAR* songname; (* name of the song *) + //CHAR* modtype; (* string type of module loaded *) + //CHAR* comment; (* module comments *) + //UWORD flags; (* See module flags above *) + //UBYTE numchn; (* number of module channels *) + //UBYTE numvoices; (* max # voices used for full NNA playback *) + //UWORD numpos; (* number of positions in this song *) + //UWORD numpat; (* number of patterns in this song *) + //UWORD numins; (* number of instruments *) + //UWORD numsmp; (* number of samples *) + //type = record INSTRUMENT* instruments; (* all instruments *) + //type = record SAMPLE* samples; (* all samples *) + //UBYTE realchn; (* real number of channels used *) + //UBYTE totalchn; (* total number of channels used (incl NNAs) *) + (* playback settings *) + //UWORD reppos; (* restart position *) + //UBYTE initspeed; (* initial song speed *) + //UWORD inittempo; (* initial song tempo *) + //UBYTE initvolume; (* initial global volume (0 - 128) *) + //UWORD panning : array[ 0..64- 1 ] of ; (* 64 panning positions *) + //UBYTE chanvol : array[ 0..64- 1 ] of ; (* 64 channel positions *) + //UWORD bpm; (* current beats-per-minute speed *) + //UWORD sngspd; (* current song speed *) + //SWORD volume; (* song volume (0-128) (or user volume) *) + //BOOL extspd; (* extended speed flag (default enabled) *) + //BOOL panflag; (* panning flag (default enabled) *) + //BOOL wrap; (* wrap module ? (default disabled) *) + //BOOL loop; (* allow module to loop ? (default enabled) *) + //BOOL fadeout; (* volume fade out during last pattern *) + //UWORD patpos; (* current row number *) + //SWORD sngpos; (* current song position *) + //ULONG sngtime; (* current song time in 2^-10 seconds *) + //SWORD relspd; (* relative speed factor *) + (* internal module representation *) + //UWORD numtrk; (* number of tracks *) + //UBYTE** tracks; (* array of numtrk pointers to tracks *) + //UWORD* patterns; (* array of Patterns *) + //UWORD* pattrows; (* array of number of rows for each pattern *) + //UWORD* positions; (* all positions *) + //BOOL forbid; (* if true, no player updatenot *) + //UWORD numrow; (* number of rows on current pattern *) + //UWORD vbtick; (* tick counter (counts from 0 to sngspd) *) + //UWORD sngremainder;(* used for song time computation *) + //type = record MP_CONTROL* control; (* Effects Channel info (size pf.numchn) *) + //type = record MP_VOICE* voice; (* Audio Voice information (size md_numchn) *) + //UBYTE globalslide; (* global volume slide rate *) + //UBYTE pat_repcrazy;(* module has just looped to position -1 *) + //UWORD patbrk; (* position where to start a new pattern *) + //UBYTE patdly; (* patterndelay counter (command memory) *) + //UBYTE patdly2; (* patterndelay counter (real one) *) + //SWORD posjmp; (* flag to indicate a jump is needed... *) + end; + + PUNIMOD = ^TUNIMOD; + TUNIMOD = TMODULE; + + //SDL_mixer.h types + { The internal format for an audio chunk } + PMix_Chunk = ^TMix_Chunk; + TMix_Chunk = record + allocated : integer; + abuf : PUint8; + alen : Uint32; + volume : Uint8; { Per-sample volume, 0-128 } + end; + Mix_Chunk = TMix_Chunk; + + { The different fading types supported } + TMix_Fading = ( + MIX_NO_FADING, + MIX_FADING_OUT, + MIX_FADING_IN + ); + Mix_Fading = TMix_Fading; + + TMusic = ( MUS_CMD, + MUS_WAV, + MUS_MOD, + MUS_MID, + MUS_OGG, + MUS_MP3 + ); + + TMusicUnion = record + case Byte of + 0 : ( cmd : PMusicCMD ); + 1 : ( wave : PWAVStream ); + 2 : ( module : PUNIMOD ); + 3 : ( midi : TMidiSong ); + 4 : ( ogg : POGG_music ); + {$IFNDEF DARWIN} + 5 : ( mp3 : PSMPEG ); + {$ENDIF} + end; + + P_Mix_Music = ^T_Mix_Music; + T_Mix_Music = record + type_ : TMusic; + data : TMusicUnion; + fading : TMix_Fading; + fade_volume : integer; + fade_step : integer; + fade_steps : integer; + error : integer; + end; + + { The internal format for a music chunk interpreted via mikmod } + PMix_Music = ^TMix_Music; + TMix_Music = T_Mix_Music; + + {$IFNDEF __GPC__} + TMixFunction = function( udata : Pointer; stream : PUint8; len : integer ) : Pointer; cdecl; + {$ELSE} + TMixFunction = function( udata : Pointer; stream : PUint8; len : integer ) : Pointer; + {$ENDIF} + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL_mixer library. } +procedure SDL_MIXER_VERSION(var X: TSDL_Version); +{$EXTERNALSYM SDL_MIXER_VERSION} + +{ This function gets the version of the dynamically linked SDL_mixer library. + It should NOT be used to fill a version structure, instead you should use the + SDL_MIXER_VERSION() macro. } +function Mix_Linked_Version : PSDL_version; +cdecl; external {$IFDEF __GPC__}name 'Mix_Linked_Version'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_Linked_Version} + +{ Open the mixer with a certain audio format } +function Mix_OpenAudio( frequency : integer; format : Uint16; channels : + integer; chunksize : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_OpenAudio'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_OpenAudio} + +{ Dynamically change the number of channels managed by the mixer. + If decreasing the number of channels, the upper channels are + stopped. + This function returns the new number of allocated channels. + } +function Mix_AllocateChannels( numchannels : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_AllocateChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_AllocateChannels} + +{ Find out what the actual audio device parameters are. + This function returns 1 if the audio has been opened, 0 otherwise. + } +function Mix_QuerySpec( var frequency : integer; var format : Uint16; var channels : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_QuerySpec'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_QuerySpec} + +{ Load a wave file or a music (.mod .s3m .it .xm) file } +function Mix_LoadWAV_RW( src : PSDL_RWops; freesrc : integer ) : PMix_Chunk; +cdecl; external {$IFDEF __GPC__}name 'Mix_LoadWAV_RW'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_LoadWAV_RW} + +function Mix_LoadWAV( filename : PChar ) : PMix_Chunk; + +function Mix_LoadMUS( const filename : PChar ) : PMix_Music; +cdecl; external {$IFDEF __GPC__}name 'Mix_LoadMUS'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_LoadMUS} + +(*#if 0 { This hasn't been hooked into music.c yet } +{ Load a music file from an SDL_RWop object (MikMod-specific currently) + Matt Campbell (matt@campbellhome.dhs.org) April 2000 } +function Mix_LoadMUS_RW(SDL_RWops *rw) : PMix_Music; cdecl; +#endif*) + +{ Load a wave file of the mixer format from a memory buffer } +function Mix_QuickLoad_WAV( mem : PUint8 ) : PMix_Chunk; +cdecl; external {$IFDEF __GPC__}name 'Mix_QuickLoad_WAV'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_QuickLoad_WAV} + +{ Free an audio chunk previously loaded } +procedure Mix_FreeChunk( chunk : PMix_Chunk ); +cdecl; external {$IFDEF __GPC__}name 'Mix_FreeChunk'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FreeChunk} + +procedure Mix_FreeMusic( music : PMix_Music ); +cdecl; external {$IFDEF __GPC__}name 'Mix_FreeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FreeMusic} + +{ Set a function that is called after all mixing is performed. + This can be used to provide real-time visual display of the audio stream + or add a custom mixer filter for the stream data. +} +procedure Mix_SetPostMix( mix_func : TMixFunction; arg : Pointer ); +cdecl; external {$IFDEF __GPC__}name 'Mix_SetPostMix'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_SetPostMix} + +{ Add your own music player or additional mixer function. + If 'mix_func' is NULL, the default music player is re-enabled. + } +procedure Mix_HookMusic( mix_func : TMixFunction; arg : Pointer ); + cdecl; external {$IFDEF __GPC__}name 'Mix_HookMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_HookMusic} + +{ Add your own callback when the music has finished playing. + } +procedure Mix_HookMusicFinished( music_finished : Pointer ); +cdecl; external {$IFDEF __GPC__}name 'Mix_HookMusicFinished'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_HookMusicFinished} + +{ Get a pointer to the user data for the current music hook } +function Mix_GetMusicHookData : Pointer; +cdecl; external {$IFDEF __GPC__}name 'Mix_GetMusicHookData'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_GetMusicHookData} + +{* Add your own callback when a channel has finished playing. NULL + * to disable callback.*} +type + {$IFNDEF __GPC__} + TChannel_finished = procedure( channel: Integer ); cdecl; + {$ELSE} + TChannel_finished = procedure( channel: Integer ); + {$ENDIF} + +procedure Mix_ChannelFinished( channel_finished : TChannel_finished ); +cdecl; external {$IFDEF __GPC__}name 'Mix_ChannelFinished'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_ChannelFinished} + +const + MIX_CHANNEL_POST = -2; + + {* This is the format of a special effect callback: + * + * myeffect(int chan, void *stream, int len, void *udata); + * + * (chan) is the channel number that your effect is affecting. (stream) is + * the buffer of data to work upon. (len) is the size of (stream), and + * (udata) is a user-defined bit of data, which you pass as the last arg of + * Mix_RegisterEffect(), and is passed back unmolested to your callback. + * Your effect changes the contents of (stream) based on whatever parameters + * are significant, or just leaves it be, if you prefer. You can do whatever + * you like to the buffer, though, and it will continue in its changed state + * down the mixing pipeline, through any other effect functions, then finally + * to be mixed with the rest of the channels and music for the final output + * stream. + *} +type + {$IFNDEF __GPC__} + TMix_EffectFunc = function( chan : integer; stream : Pointer; len : integer; udata : Pointer ) : Pointer; cdecl; + {$ELSE} + TMix_EffectFunc = function( chan : integer; stream : Pointer; len : integer; udata : Pointer ) : Pointer; + {$ENDIF} + {* + * This is a callback that signifies that a channel has finished all its + * loops and has completed playback. This gets called if the buffer + * plays out normally, or if you call Mix_HaltChannel(), implicitly stop + * a channel via Mix_AllocateChannels(), or unregister a callback while + * it's still playing. + *} + {$IFNDEF __GPC__} + TMix_EffectDone = function( chan : integer; udata : Pointer ) : Pointer; cdecl; + {$ELSE} + TMix_EffectDone = function( chan : integer; udata : Pointer ) : Pointer; + {$ENDIF} + {* Register a special effect function. At mixing time, the channel data is + * copied into a buffer and passed through each registered effect function. + * After it passes through all the functions, it is mixed into the final + * output stream. The copy to buffer is performed once, then each effect + * function performs on the output of the previous effect. Understand that + * this extra copy to a buffer is not performed if there are no effects + * registered for a given chunk, which saves CPU cycles, and any given + * effect will be extra cycles, too, so it is crucial that your code run + * fast. Also note that the data that your function is given is in the + * format of the sound device, and not the format you gave to Mix_OpenAudio(), + * although they may in reality be the same. This is an unfortunate but + * necessary speed concern. Use Mix_QuerySpec() to determine if you can + * handle the data before you register your effect, and take appropriate + * actions. + * You may also specify a callback (Mix_EffectDone_t) that is called when + * the channel finishes playing. This gives you a more fine-grained control + * than Mix_ChannelFinished(), in case you need to free effect-specific + * resources, etc. If you don't need this, you can specify NULL. + * You may set the callbacks before or after calling Mix_PlayChannel(). + * Things like Mix_SetPanning() are just internal special effect functions, + * so if you are using that, you've already incurred the overhead of a copy + * to a separate buffer, and that these effects will be in the queue with + * any functions you've registered. The list of registered effects for a + * channel is reset when a chunk finishes playing, so you need to explicitly + * set them with each call to Mix_PlayChannel*(). + * You may also register a special effect function that is to be run after + * final mixing occurs. The rules for these callbacks are identical to those + * in Mix_RegisterEffect, but they are run after all the channels and the + * music have been mixed into a single stream, whereas channel-specific + * effects run on a given channel before any other mixing occurs. These + * global effect callbacks are call "posteffects". Posteffects only have + * their Mix_EffectDone_t function called when they are unregistered (since + * the main output stream is never "done" in the same sense as a channel). + * You must unregister them manually when you've had enough. Your callback + * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the + * processing is considered a posteffect. + * + * After all these effects have finished processing, the callback registered + * through Mix_SetPostMix() runs, and then the stream goes to the audio + * device. + * + * returns zero if error (no such channel), nonzero if added. + * Error messages can be retrieved from Mix_GetError(). + *} +function Mix_RegisterEffect( chan : integer; f : TMix_EffectFunc; d : TMix_EffectDone; arg : Pointer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_RegisterEffect'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_RegisterEffect} + +{* You may not need to call this explicitly, unless you need to stop an + * effect from processing in the middle of a chunk's playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel or effect), nonzero if removed. + * Error messages can be retrieved from Mix_GetError(). + *} +function Mix_UnregisterEffect( channel : integer; f : TMix_EffectFunc ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_UnregisterEffect'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_UnregisterEffect} + + {* You may not need to call this explicitly, unless you need to stop all + * effects from processing in the middle of a chunk's playback. Note that + * this will also shut off some internal effect processing, since + * Mix_SetPanning( ) and others may use this API under the hood.This is + * called internally when a channel completes playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error( no such channel ), nonzero if all effects removed. + * Error messages can be retrieved from Mix_GetError( ). + *} +function Mix_UnregisterAllEffects( channel : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_UnregisterAllEffects'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_UnregisterAllEffects} + +const + MIX_EFFECTSMAXSPEED = 'MIX_EFFECTSMAXSPEED'; + + {* + * These are the internally - defined mixing effects.They use the same API that + * effects defined in the application use, but are provided here as a + * convenience.Some effects can reduce their quality or use more memory in + * the name of speed; to enable this, make sure the environment variable + * MIX_EFFECTSMAXSPEED( see above ) is defined before you call + * Mix_OpenAudio( ). + * } + + {* set the panning of a channel.The left and right channels are specified + * as integers between 0 and 255, quietest to loudest, respectively. + * + * Technically, this is just individual volume control for a sample with + * two( stereo )channels, so it can be used for more than just panning. + * if you want real panning, call it like this : + * + * Mix_SetPanning( channel, left, 255 - left ); + * + * ...which isn't so hard. + * + * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and + * the panning will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect( )API internally, and returns without + * registering the effect function if the audio device is not configured + * for stereo output.Setting both( left ) and ( right ) to 255 causes this + * effect to be unregistered, since that is the data's normal state. + * + * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), + * nonzero if panning effect enabled.Note that an audio device in mono + * mode is a no - op, but this call will return successful in that case . + * Error messages can be retrieved from Mix_GetError( ). + * } + function Mix_SetPanning( channel : integer; left : Uint8; right : Uint8 ) : integer; + cdecl; external {$IFDEF __GPC__}name 'Mix_SetPanning'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; + {$EXTERNALSYM Mix_SetPanning} + + { * set the position ofa channel.( angle ) is an integer from 0 to 360, that + * specifies the location of the sound in relation to the listener.( angle ) + * will be reduced as neccesary( 540 becomes 180 degrees, -100 becomes 260 ). + * Angle 0 is due north, and rotates clockwise as the value increases. + * for efficiency, the precision of this effect may be limited( angles 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc ). + * ( distance ) is an integer between 0 and 255 that specifies the space + * between the sound and the listener.The larger the number, the further + * away the sound is .Using 255 does not guarantee that the channel will be + * culled from the mixing process or be completely silent.For efficiency, + * the precision of this effect may be limited( distance 0 through 5 might + * all produce the same effect, 6 through 10 are equal, etc ).Setting( angle ) + * and ( distance ) to 0 unregisters this effect, since the data would be + * unchanged. + * + * if you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer.This is only meant to be a + * basic effect for simple "3D" games. + * + * if the audio device is configured for mono output, then you won't get + * any effectiveness from the angle; however, distance attenuation on the + * channel will still occur.While this effect will function with stereo + * voices, it makes more sense to use voices with only one channel of sound, + * so when they are mixed through this effect, the positioning will sound + * correct.You can convert them to mono through SDL before giving them to + * the mixer in the first place if you like. + * + * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and + * the positioning will be done to the final mixed stream before passing it + * on to the audio device. + * + * This is a convenience wrapper over Mix_SetDistance( ) and Mix_SetPanning( ). + * + * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError( ). + * } + function Mix_SetPosition( channel :integer; angle : Sint16; distance : Uint8 ) : integer; + cdecl; external {$IFDEF __GPC__}name 'Mix_SetPosition'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; + {$EXTERNALSYM Mix_SetPosition} + + {* set the "distance" of a channel.( distance ) is an integer from 0 to 255 + * that specifies the location of the sound in relation to the listener. + * Distance 0 is overlapping the listener, and 255 is as far away as possible + * A distance of 255 does not guarantee silence; in such a case , you might + * want to try changing the chunk's volume, or just cull the sample from the + * mixing process with Mix_HaltChannel( ). + * for efficiency, the precision of this effect may be limited( distances 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc ). + * ( distance ) is an integer between 0 and 255 that specifies the space + * between the sound and the listener.The larger the number, the further + * away the sound is . + * Setting( distance ) to 0 unregisters this effect, since the data would be + * unchanged. + * if you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer.This is only meant to be a + * basic effect for simple "3D" games. + * + * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and + * the distance attenuation will be done to the final mixed stream before + * passing it on to the audio device. + * + * This uses the Mix_RegisterEffect( )API internally. + * + * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError( ). + * } + function Mix_SetDistance( channel : integer; distance : Uint8 ) : integer; + cdecl; external {$IFDEF __GPC__}name 'Mix_SetDistance'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; + {$EXTERNALSYM Mix_SetDistance} + { * + * !!! FIXME : Haven't implemented, since the effect goes past the + * end of the sound buffer.Will have to think about this. + * - -ryan. + * / + { if 0 + { * Causes an echo effect to be mixed into a sound.( echo ) is the amount + * of echo to mix.0 is no echo, 255 is infinite( and probably not + * what you want ). + * + * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and + * the reverbing will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect( )API internally.If you specify an echo + * of zero, the effect is unregistered, as the data is already in that state. + * + * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), + * nonzero if reversing effect is enabled. + * Error messages can be retrieved from Mix_GetError( ). + * + extern no_parse_DECLSPEC int Mix_SetReverb( int channel, Uint8 echo ); + #E ndif} + { * Causes a channel to reverse its stereo.This is handy if the user has his + * speakers hooked up backwards, or you would like to have a minor bit of + * psychedelia in your sound code. : )Calling this function with ( flip ) + * set to non - zero reverses the chunks's usual channels. If (flip) is zero, + * the effect is unregistered. + * + * This uses the Mix_RegisterEffect( )API internally, and thus is probably + * more CPU intensive than having the user just plug in his speakers + * correctly.Mix_SetReverseStereo( )returns without registering the effect + * function if the audio device is not configured for stereo output. + * + * if you specify MIX_CHANNEL_POST for ( channel ), then this the effect is used + * on the final mixed stream before sending it on to the audio device( a + * posteffect ). + * + * returns zero if error( no such channel or Mix_RegisterEffect( )fails ), + * nonzero if reversing effect is enabled.Note that an audio device in mono + * mode is a no - op, but this call will return successful in that case . + * Error messages can be retrieved from Mix_GetError( ). + * } + function Mix_SetReverseStereo( channel : integer; flip : integer ) : integer; + cdecl; external {$IFDEF __GPC__}name 'Mix_SetReverseStereo'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; + {$EXTERNALSYM Mix_SetReverseStereo} + { end of effects API. - -ryan. *} + +{ Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate + them dynamically to the next sample if requested with a -1 value below. + Returns the number of reserved channels. + } +function Mix_ReserveChannels( num : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_ReserveChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_ReserveChannels} + +{ Channel grouping functions } + +{ Attach a tag to a channel. A tag can be assigned to several mixer + channels, to form groups of channels. + If 'tag' is -1, the tag is removed (actually -1 is the tag used to + represent the group of all the channels). + Returns true if everything was OK. + } +function Mix_GroupChannel( which : integer; tag : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_GroupChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_GroupChannel} + +{ Assign several consecutive channels to a group } +function Mix_GroupChannels( from : integer; to_ : integer; tag : integer ) : +integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_GroupChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_GroupChannels} + +{ Finds the first available channel in a group of channels } +function Mix_GroupAvailable( tag : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_GroupAvailable'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_GroupAvailable} + +{ Returns the number of channels in a group. This is also a subtle + way to get the total number of channels when 'tag' is -1 + } +function Mix_GroupCount( tag : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_GroupCount'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_GroupCount} + +{ Finds the "oldest" sample playing in a group of channels } +function Mix_GroupOldest( tag : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_GroupOldest'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_GroupOldest} + +{ Finds the "most recent" (i.e. last) sample playing in a group of channels } +function Mix_GroupNewer( tag : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_GroupNewer'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_GroupNewer} + +{ The same as above, but the sound is played at most 'ticks' milliseconds } +function Mix_PlayChannelTimed( channel : integer; chunk : PMix_Chunk; loops : integer; ticks : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_PlayChannelTimed'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_PlayChannelTimed} + +{ Play an audio chunk on a specific channel. + If the specified channel is -1, play on the first free channel. + If 'loops' is greater than zero, loop the sound that many times. + If 'loops' is -1, loop inifinitely (~65000 times). + Returns which channel was used to play the sound. +} +function Mix_PlayChannel( channel : integer; chunk : PMix_Chunk; loops : integer ) : integer; + +function Mix_PlayMusic( music : PMix_Music; loops : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_PlayMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_PlayMusic} + +{ Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions } +function Mix_FadeInMusic( music : PMix_Music; loops : integer; ms : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_FadeInMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FadeInMusic} + +function Mix_FadeInChannelTimed( channel : integer; chunk : PMix_Chunk; loops : integer; ms : integer; ticks : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_FadeInChannelTimed'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FadeInChannelTimed} + +function Mix_FadeInChannel( channel : integer; chunk : PMix_Chunk; loops : integer; ms : integer ) : integer; + +{ Set the volume in the range of 0-128 of a specific channel or chunk. + If the specified channel is -1, set volume for all channels. + Returns the original volume. + If the specified volume is -1, just return the current volume. +} +function Mix_Volume( channel : integer; volume : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_Volume'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_Volume} + +function Mix_VolumeChunk( chunk : PMix_Chunk; volume : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_VolumeChunk'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_VolumeChunk} + +function Mix_VolumeMusic( volume : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_VolumeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_VolumeMusic} + +{ Halt playing of a particular channel } +function Mix_HaltChannel( channel : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_HaltChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_HaltChannel} + +function Mix_HaltGroup( tag : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_HaltGroup'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_HaltGroup} + +function Mix_HaltMusic : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_HaltMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_HaltMusic} + +{ Change the expiration delay for a particular channel. + The sample will stop playing after the 'ticks' milliseconds have elapsed, + or remove the expiration if 'ticks' is -1 +} +function Mix_ExpireChannel( channel : integer; ticks : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_ExpireChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_ExpireChannel} + +{ Halt a channel, fading it out progressively till it's silent + The ms parameter indicates the number of milliseconds the fading + will take. + } +function Mix_FadeOutChannel( which : integer; ms : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FadeOutChannel} +function Mix_FadeOutGroup( tag : integer; ms : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutGroup'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FadeOutGroup} +function Mix_FadeOutMusic( ms : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FadeOutMusic} + +{ Query the fading status of a channel } +function Mix_FadingMusic : TMix_Fading; +cdecl; external {$IFDEF __GPC__}name 'Mix_FadingMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FadingMusic} + +function Mix_FadingChannel( which : integer ) : TMix_Fading; +cdecl; external {$IFDEF __GPC__}name 'Mix_FadingChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_FadingChannel} + +{ Pause/Resume a particular channel } +procedure Mix_Pause( channel : integer ); +cdecl; external {$IFDEF __GPC__}name 'Mix_Pause'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_Pause} + +procedure Mix_Resume( channel : integer ); +cdecl; external {$IFDEF __GPC__}name 'Mix_Resume'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_Resume} + +function Mix_Paused( channel : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_Paused'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_Paused} + +{ Pause/Resume the music stream } +procedure Mix_PauseMusic; +cdecl; external {$IFDEF __GPC__}name 'Mix_PauseMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_PauseMusic} + +procedure Mix_ResumeMusic; +cdecl; external {$IFDEF __GPC__}name 'Mix_ResumeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_ResumeMusic} + +procedure Mix_RewindMusic; +cdecl; external {$IFDEF __GPC__}name 'Mix_RewindMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_RewindMusic} + +function Mix_PausedMusic : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_PausedMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_PausedMusic} + +{ Set the current position in the music stream. + This returns 0 if successful, or -1 if it failed or isn't implemented. + This function is only implemented for MOD music formats (set pattern + order number) and for OGG music (set position in seconds), at the + moment. +} +function Mix_SetMusicPosition( position : double ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_SetMusicPosition'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_SetMusicPosition} + +{ Check the status of a specific channel. + If the specified channel is -1, check all channels. +} +function Mix_Playing( channel : integer ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_Playing'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_Playing} + +function Mix_PlayingMusic : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_PlayingMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_PlayingMusic} + +{ Stop music and set external music playback command } +function Mix_SetMusicCMD( const command : PChar ) : integer; +cdecl; external {$IFDEF __GPC__}name 'Mix_SetMusicCMD'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_SetMusicCMD} + +{ Close the mixer, halting all playing audio } +procedure Mix_CloseAudio; +cdecl; external {$IFDEF __GPC__}name 'Mix_CloseAudio'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__}; +{$EXTERNALSYM Mix_CloseAudio} + +{ We'll use SDL for reporting errors } +procedure Mix_SetError( fmt : PChar ); + +function Mix_GetError : PChar; + +{------------------------------------------------------------------------------} +{ initialization } +{------------------------------------------------------------------------------} + +{------------------------------------------------------------------------------} + +implementation + +{$IFDEF __GPC__} + {$L 'sdl_mixer'} { link sdl_mixer.dll.a or libsdl_mixer.so or libsdl_mixer.a } +{$ENDIF} + +procedure SDL_MIXER_VERSION( var X : TSDL_version ); +begin + X.major := SDL_MIXER_MAJOR_VERSION; + X.minor := SDL_MIXER_MINOR_VERSION; + X.patch := SDL_MIXER_PATCHLEVEL; +end; + +function Mix_LoadWAV( filename : PChar ) : PMix_Chunk; +begin + result := Mix_LoadWAV_RW( SDL_RWFromFile( filename, 'rb' ), 1 ); +end; + +function Mix_PlayChannel( channel : integer; chunk : PMix_Chunk; loops : integer ) : integer; +begin + result := Mix_PlayChannelTimed( channel, chunk, loops, -1 ); +end; + +function Mix_FadeInChannel( channel : integer; chunk : PMix_Chunk; loops : + integer; ms : integer ) : integer; +begin + result := Mix_FadeInChannelTimed( channel, chunk, loops, ms, -1 ); +end; + +procedure Mix_SetError( fmt : PChar ); +begin + SDL_SetError( fmt ); +end; + +function Mix_GetError : PChar; +begin + result := SDL_GetError; +end; + end. diff --git a/packages/extra/sdl/sdl_net.pas b/packages/extra/sdl/sdl_net.pas index d580215287..3ddedd27b1 100644 --- a/packages/extra/sdl/sdl_net.pas +++ b/packages/extra/sdl/sdl_net.pas @@ -120,7 +120,7 @@ uses gpc, {$ENDIF} -{$IFDEF WIN32} +{$IFDEF windows} {$IFNDEF __GPC__} Windows, {$ENDIF} @@ -128,7 +128,7 @@ uses sdl; const -{$IFDEF WIN32} +{$IFDEF windows} SDLNetLibName = 'SDL_net.dll'; {$ENDIF} @@ -192,7 +192,7 @@ type PTCPSocket = ^TTCPSocket; TTCPSocket = record ready : integer; -{$IFDEF WIN32} +{$IFDEF windows} channel : integer; {$ENDIF} {$IFDEF UNIX} @@ -215,7 +215,7 @@ type PUDPSocket = ^TUDPSocket; TUDPSocket = record ready : integer; -{$IFDEF WIN32} +{$IFDEF windows} channel : integer; {$ENDIF} {$IFDEF UNIX} @@ -242,7 +242,7 @@ type PSDLNet_Socket = ^TSDLNet_Socket; TSDLNet_Socket = record ready : integer; -{$IFDEF WIN32} +{$IFDEF windows} channel : integer; {$ENDIF} {$IFDEF UNIX} diff --git a/packages/extra/sdl/sdl_sound.pas b/packages/extra/sdl/sdl_sound.pas index 7f6f6c7d38..0891d50818 100644 --- a/packages/extra/sdl/sdl_sound.pas +++ b/packages/extra/sdl/sdl_sound.pas @@ -91,13 +91,13 @@ unit sdl_sound; interface uses -{$IFDEF WIN32} +{$IFDEF windows} Windows, {$ENDIF} sdl; const -{$IFDEF WIN32} +{$IFDEF windows} SDLSoundLibName = 'SDL_sound.dll'; {$ENDIF} diff --git a/packages/extra/sdl/sdl_ttf.pas b/packages/extra/sdl/sdl_ttf.pas index d65e951323..00bcc0a292 100644 --- a/packages/extra/sdl/sdl_ttf.pas +++ b/packages/extra/sdl/sdl_ttf.pas @@ -127,13 +127,13 @@ unit sdl_ttf; interface uses -{$IFDEF WIN32} +{$IFDEF windows} Windows, {$ENDIF} sdl; const -{$IFDEF WIN32} +{$IFDEF windows} SDLttfLibName = 'SDL_ttf.dll'; {$ENDIF} diff --git a/packages/extra/sdl/sdlsprites.pas b/packages/extra/sdl/sdlsprites.pas index c8d42d1f30..db731d71cd 100644 --- a/packages/extra/sdl/sdlsprites.pas +++ b/packages/extra/sdl/sdlsprites.pas @@ -39,7 +39,7 @@ unit sdlsprites; interface uses -{$IFDEF WIN32} +{$IFDEF windows} Windows, {$ENDIF} Classes, diff --git a/packages/extra/sdl/smpeg.pas b/packages/extra/sdl/smpeg.pas index ca71aacf29..af6913e3aa 100644 --- a/packages/extra/sdl/smpeg.pas +++ b/packages/extra/sdl/smpeg.pas @@ -138,7 +138,7 @@ uses sdl; const -{$IFDEF WIN32} +{$IFDEF windows} SmpegLibName = 'smpeg.dll'; {$ENDIF}