From e2fea8646f72081d75fbad367be6ced68c82fb4c Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 20 Feb 2008 17:46:34 +0000 Subject: 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 --- Game/Code/lib/midi/MidiFile.pas | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'Game/Code/lib/midi/MidiFile.pas') 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; -- cgit v1.2.3