1 {
2 Translation of the libmodplug headers for FreePascal
3 Copyright (C) 2006 by Ivo Steinmann
4 }
6 (*
7 * This source code is public domain.
8 *
9 * Authors: Kenton Varda <temporal@gauge3d.org> (C interface wrapper)
10 *)
14 {$MODE OBJFPC}
15 {$PACKRECORDS C}
17 interface
19 uses
20 ctypes;
22 {$IF DEFINED(WINDOWS)}
23 {$IFDEF MODPLUG_WINDOZE_STATIC}
25 {$LINKLIB libmodplug.a}
26 {$ELSE}
27 {$DEFINE MP_DYNAMIC}
29 {$ENDIF}
30 {$ELSEIF DEFINED(UNIX)}
31 {$DEFINE MP_DYNAMIC}
32 {$LINKLIB libmodplug}
34 {$ELSE}
35 {$ERROR libmodplug not supported on this platform. Fix it!}
36 {$ENDIF}
38 type
43 (* Load a mod file. [data] should point to a block of memory containing the complete
44 * file, and [size] should be the size of that block.
45 * Return the loaded mod file on success, or NULL on failure. *)
46 function ModPlug_Load(data: pointer; size: cint): PModPlugFile; cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
48 (* Unload a mod file. *)
49 procedure ModPlug_Unload(_file: PModPlugFile); cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
51 (* Read sample data into the buffer. Returns the number of bytes read. If the end
52 * of the mod has been reached, zero is returned. *)
53 function ModPlug_Read(_file: PModPlugFile; buffer: pointer; size: cint): cint; cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
55 (* Get the name of the mod. The returned buffer is stored within the ModPlugFile
56 * structure and will remain valid until you unload the file. *)
57 function ModPlug_GetName(_file: PModPlugFile): pcchar; cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
59 (* Get the length of the mod, in milliseconds. Note that this result is not always
60 * accurate, especially in the case of mods with loops. *)
61 function ModPlug_GetLength(_file: PModPlugFile): cint; cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
63 (* Seek to a particular position in the song. Note that seeking and MODs don't mix very
64 * well. Some mods will be missing instruments for a short time after a seek, as ModPlug
65 * does not scan the sequence backwards to find out which instruments were supposed to be
66 * playing at that time. (Doing so would be difficult and not very reliable.) Also,
67 * note that seeking is not very exact in some mods -- especially those for which
68 * ModPlug_GetLength() does not report the full length. *)
69 procedure ModPlug_Seek(_file: PModPlugFile; millisecond: cint); cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
72 const
73 // _ModPlug_Flags
80 // _ModPlug_ResamplingMode
86 type
105 (* Get and set the mod decoder settings. All options, except for channels, bits-per-sample,
106 * sampling rate, and loop count, will take effect immediately. Those options which don't
107 * take effect immediately will take effect the next time you load a mod. *)
108 procedure ModPlug_GetSettings(settings: PModPlug_Settings); cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
109 procedure ModPlug_SetSettings(const settings: PModPlug_Settings); cdecl; external {$IFDEF MP_DYNAMIC}modpluglib{$ENDIF};
111 implementation
113 // TODO: why the fuck does this exist here
115 (*
117 function cppNew(s: cint): pointer; cdecl; public; alias : '_Znaj'; alias : '_Znwj';
118 begin
119 GetMem(Result, s);
120 end;
122 procedure cppDelete(p: pointer); cdecl; public; alias : '_ZdlPv'; alias : '_ZdaPv';
123 begin
124 FreeMem(p);
125 end;
127 *)