aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/src/lib/midi
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-23 09:07:15 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-23 09:07:15 +0000
commit678cc132f942ff4d84a803550eedf96acc543bca (patch)
treeeb195abafaf69d55fa0f4b77323e517fcd2263cd /cmake/src/lib/midi
parent7e677fd5ebe60c3dd9df8954e1ed28c4afdf8660 (diff)
downloadusdx-678cc132f942ff4d84a803550eedf96acc543bca.tar.gz
usdx-678cc132f942ff4d84a803550eedf96acc543bca.tar.xz
usdx-678cc132f942ff4d84a803550eedf96acc543bca.zip
update to trunk rev. 2391
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2401 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--cmake/src/lib/midi/CIRCBUF.PAS2
-rw-r--r--cmake/src/lib/midi/DELPHMCB.PAS2
-rw-r--r--cmake/src/lib/midi/MIDIDEFS.PAS2
-rw-r--r--cmake/src/lib/midi/MIDITYPE.PAS2
-rw-r--r--cmake/src/lib/midi/MidiFile.pas28
-rw-r--r--cmake/src/lib/midi/MidiScope.pas2
-rw-r--r--cmake/src/lib/midi/Midicons.pas2
-rw-r--r--cmake/src/lib/midi/Midiin.pas11
-rw-r--r--cmake/src/lib/midi/Midiout.pas11
9 files changed, 23 insertions, 39 deletions
diff --git a/cmake/src/lib/midi/CIRCBUF.PAS b/cmake/src/lib/midi/CIRCBUF.PAS
index 77cb3643..3ceb4c6e 100644
--- a/cmake/src/lib/midi/CIRCBUF.PAS
+++ b/cmake/src/lib/midi/CIRCBUF.PAS
@@ -23,7 +23,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
Uses
diff --git a/cmake/src/lib/midi/DELPHMCB.PAS b/cmake/src/lib/midi/DELPHMCB.PAS
index e607627d..ef0d5451 100644
--- a/cmake/src/lib/midi/DELPHMCB.PAS
+++ b/cmake/src/lib/midi/DELPHMCB.PAS
@@ -13,7 +13,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses
diff --git a/cmake/src/lib/midi/MIDIDEFS.PAS b/cmake/src/lib/midi/MIDIDEFS.PAS
index fc8eed26..4afe56ef 100644
--- a/cmake/src/lib/midi/MIDIDEFS.PAS
+++ b/cmake/src/lib/midi/MIDIDEFS.PAS
@@ -13,7 +13,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses
diff --git a/cmake/src/lib/midi/MIDITYPE.PAS b/cmake/src/lib/midi/MIDITYPE.PAS
index b1ec1bdd..45b50820 100644
--- a/cmake/src/lib/midi/MIDITYPE.PAS
+++ b/cmake/src/lib/midi/MIDITYPE.PAS
@@ -10,7 +10,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses
diff --git a/cmake/src/lib/midi/MidiFile.pas b/cmake/src/lib/midi/MidiFile.pas
index 11b1ca0b..acf44c04 100644
--- a/cmake/src/lib/midi/MidiFile.pas
+++ b/cmake/src/lib/midi/MidiFile.pas
@@ -92,18 +92,18 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses
Windows,
- //Forms,
Messages,
Classes,
{$IFDEF FPC}
WinAllocation,
{$ENDIF}
- SysUtils;
+ SysUtils,
+ UPath;
type
TChunkType = (illegal, header, track);
@@ -162,7 +162,7 @@ type
procedure WndProc(var Msg : TMessage);
protected
{ Protected declarations }
- midiFile: file of byte;
+ midiFile: TBinaryFileStream;
chunkType: TChunkType;
chunkLength: integer;
chunkData: PByte;
@@ -177,7 +177,7 @@ type
FBpm: integer;
FBeatsPerMeasure: integer;
FusPerTick: double;
- FFilename: string;
+ FFilename: IPath;
Tracks: TList;
currentTrack: TMidiTrack;
@@ -191,7 +191,7 @@ type
currentPos: Double; // Current Position in ticks
procedure OnTrackReady;
- procedure setFilename(val: string);
+ procedure SetFilename(val: IPath);
procedure ReadChunkHeader;
procedure ReadChunkContent;
procedure ReadChunk;
@@ -221,7 +221,7 @@ type
function Ready: boolean;
published
{ Published declarations }
- property Filename: string read FFilename write setFilename;
+ property Filename: IPath read FFilename write SetFilename;
property NumberOfTracks: integer read numberTracks;
property TicksPerQuarter: integer read deltaTicks;
property FileFormat: TFileFormat read FFileFormat;
@@ -463,7 +463,7 @@ begin
result := Tracks.Items[index];
end;
-procedure TMidifile.setFilename(val: string);
+procedure TMidifile.SetFilename(val: IPath);
begin
FFilename := val;
// ReadFile;
@@ -586,7 +586,7 @@ procedure TMidifile.ReadChunkHeader;
var
theByte: array[0..7] of byte;
begin
- BlockRead(midiFile, theByte, 8);
+ midiFile.Read(theByte[0], 8);
if (theByte[0] = $4D) and (theByte[1] = $54) then
begin
if (theByte[2] = $68) and (theByte[3] = $64) then
@@ -608,7 +608,7 @@ begin
if not (chunkData = nil) then
FreeMem(chunkData);
GetMem(chunkData, chunkLength + 10);
- BlockRead(midiFile, chunkData^, chunkLength);
+ midiFile.Read(chunkData^, chunkLength);
chunkIndex := chunkData;
chunkEnd := PByte(integer(chunkIndex) + integer(chunkLength) - 1);
end;
@@ -848,12 +848,10 @@ begin
Tracks.Clear;
chunkType := illegal;
- AssignFile(midiFile, FFilename);
- FileMode := 0;
- Reset(midiFile);
- while not eof(midiFile) do
+ midiFile := TBinaryFileStream.Create(FFilename, fmOpenRead);
+ while (midiFile.Position < midiFile.Size) do
ReadChunk;
- CloseFile(midiFile);
+ FreeAndNil(midiFile);
numberTracks := Tracks.Count;
end;
diff --git a/cmake/src/lib/midi/MidiScope.pas b/cmake/src/lib/midi/MidiScope.pas
index 42fc65fc..afc20b0f 100644
--- a/cmake/src/lib/midi/MidiScope.pas
+++ b/cmake/src/lib/midi/MidiScope.pas
@@ -20,7 +20,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses
diff --git a/cmake/src/lib/midi/Midicons.pas b/cmake/src/lib/midi/Midicons.pas
index 35dbb5f3..72259beb 100644
--- a/cmake/src/lib/midi/Midicons.pas
+++ b/cmake/src/lib/midi/Midicons.pas
@@ -11,7 +11,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses Messages;
diff --git a/cmake/src/lib/midi/Midiin.pas b/cmake/src/lib/midi/Midiin.pas
index 21db0298..a055669a 100644
--- a/cmake/src/lib/midi/Midiin.pas
+++ b/cmake/src/lib/midi/Midiin.pas
@@ -103,7 +103,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses
@@ -237,20 +237,13 @@ uses Controls,
There are special requirements and restrictions for this callback
procedure (see midiInOpen in MMSYSTEM.HLP) so it's impractical to
make it an object method }
-{$IFDEF WIN32}
+{$IFDEF MSWINDOWS}
function midiHandler(
hMidiIn: HMidiIn;
wMsg: UINT;
dwInstance: DWORD;
dwParam1: DWORD;
dwParam2: DWORD): Boolean; stdcall; external 'DELMID32.DLL';
-{$ELSE}
-procedure midiHandler(
- hMidiIn: HMidiIn;
- wMsg: Word;
- dwInstance: DWORD;
- dwParam1: DWORD;
- dwParam2: DWORD); far; external 'DELPHMID';
{$ENDIF}
*)
{-------------------------------------------------------------------}
diff --git a/cmake/src/lib/midi/Midiout.pas b/cmake/src/lib/midi/Midiout.pas
index 606d0dae..7ce385eb 100644
--- a/cmake/src/lib/midi/Midiout.pas
+++ b/cmake/src/lib/midi/Midiout.pas
@@ -98,7 +98,7 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
- {$H+} // use AnsiString
+ {$H+} // use long strings
{$ENDIF}
uses
@@ -234,20 +234,13 @@ implementation
There are special requirements and restrictions for this callback
procedure (see midioutOpen in MMSYSTEM.HLP) so it's impractical to
make it an object method }
-{$IFDEF WIN32}
+{$IFDEF MSWINDOWS}
function midiHandler(
hMidiIn: HMidiIn;
wMsg: UINT;
dwInstance: DWORD;
dwParam1: DWORD;
dwParam2: DWORD): Boolean; stdcall; external 'DELMID32.DLL';
-{$ELSE}
-function midiHandler(
- hMidiIn: HMidiIn;
- wMsg: Word;
- dwInstance: DWORD;
- dwParam1: DWORD;
- dwParam2: DWORD): Boolean; far; external 'DELPHMID.DLL';
{$ENDIF}
*)