diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-02-20 17:46:34 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-02-20 17:46:34 +0000 |
commit | e2fea8646f72081d75fbad367be6ced68c82fb4c (patch) | |
tree | 146558b630d0cdeea1153ec6463c962e194936bb /Game/Code/lib/midi/MidiFile.pas | |
parent | b4d9e59f54100db2cbfc18368004f28f34aee11b (diff) | |
download | usdx-e2fea8646f72081d75fbad367be6ced68c82fb4c.tar.gz usdx-e2fea8646f72081d75fbad367be6ced68c82fb4c.tar.xz usdx-e2fea8646f72081d75fbad367be6ced68c82fb4c.zip |
Made the midi-stuff FPC (for windows) compatible.
Now (in windows) FPC contains all functionalities of the delphi build.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@872 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/lib/midi/MidiFile.pas')
-rw-r--r-- | Game/Code/lib/midi/MidiFile.pas | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/Game/Code/lib/midi/MidiFile.pas b/Game/Code/lib/midi/MidiFile.pas index 10b64a80..e6306bec 100644 --- a/Game/Code/lib/midi/MidiFile.pas +++ b/Game/Code/lib/midi/MidiFile.pas @@ -90,17 +90,19 @@ unit MidiFile; interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
uses
Windows,
+ Forms,
Messages,
SysUtils,
- Classes,
- Graphics,
- Controls,
- Forms,
- stdctrls,
- ExtCtrls,
- WinProcs;
+ {$IFDEF LCL}
+ LCLIntf, // used for AllocateHWnd
+ {$ENDIF}
+ Classes;
type
TChunkType = (illegal, header, track);
@@ -235,7 +237,13 @@ implementation uses mmsystem;
-type TTimerProc=procedure(uTimerID,uMsg: Integer; dwUser,dwParam1,dwParam2:DWORD);stdcall;
+type
+{$IFDEF FPC}
+ TTimerProc = TTIMECALLBACK;
+ TTimeCaps = TIMECAPS;
+{$ELSE}
+ TTimerProc = TFNTimeCallBack;
+{$ENDIF}
const TIMER_RESOLUTION=10;
const WM_MULTIMEDIA_TIMER=WM_USER+127;
@@ -245,13 +253,13 @@ var MIDIFileHandle : HWND; MIDITimerID : Integer;
TimerPeriod : Integer;
-procedure TimerCallBackProc(uTimerID,uMsg: Integer; dwUser,dwParam1,dwParam2:DWORD);stdcall;
+procedure TimerCallBackProc(uTimerID,uMsg: Cardinal; dwUser,dwParam1,dwParam2:DWORD);stdcall;
begin
PostMessage(HWND(dwUser),WM_MULTIMEDIA_TIMER,0,0);
end;
procedure SetMIDITimer;
- var TimeCaps : TTimeCaps ;
+ var TimeCaps : TTimeCaps;
begin
timeGetDevCaps(@TimeCaps,SizeOf(TimeCaps));
if TIMER_RESOLUTION < TimeCaps.wPeriodMin then
@@ -262,7 +270,7 @@ begin TimerPeriod:=TIMER_RESOLUTION;
timeBeginPeriod(TimerPeriod);
- MIDITimerID:=timeSetEvent(TimerPeriod,TimerPeriod,@TimerProc,
+ MIDITimerID:=timeSetEvent(TimerPeriod,TimerPeriod,TimerProc,
DWORD(MIDIFileHandle),TIME_PERIODIC);
if MIDITimerID=0 then
timeEndPeriod(TimerPeriod);
@@ -428,7 +436,7 @@ begin chunkData := nil;
chunkType := illegal;
Tracks := TList.Create;
- TimerProc:=TimerCallBackProc;
+ TimerProc:=@TimerCallBackProc;
FPriority:=GetPriorityClass(MIDIFileHandle);
end;
|