diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-12-11 17:34:54 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-12-11 17:34:54 +0000 |
commit | 1ab628e8ad6c85c8f1b562f10480253ee3e622b7 (patch) | |
tree | d21621f68850ecd7762137e1c4387fa15731a811 /Lua/src/lib/midi | |
parent | 6ec275387c320d3d9a8f5b6fe185687643565b8c (diff) | |
download | usdx-1ab628e8ad6c85c8f1b562f10480253ee3e622b7.tar.gz usdx-1ab628e8ad6c85c8f1b562f10480253ee3e622b7.tar.xz usdx-1ab628e8ad6c85c8f1b562f10480253ee3e622b7.zip |
merged trunk into lua branch
plugin loading is disabled atm because of a bug reading the files (lua may be the reason).
Reading the files in usdx and passing the contents to lua may solve this
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2019 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Lua/src/lib/midi')
-rw-r--r-- | Lua/src/lib/midi/CIRCBUF.PAS | 2 | ||||
-rw-r--r-- | Lua/src/lib/midi/DELPHMCB.PAS | 2 | ||||
-rw-r--r-- | Lua/src/lib/midi/MIDIDEFS.PAS | 2 | ||||
-rw-r--r-- | Lua/src/lib/midi/MIDITYPE.PAS | 2 | ||||
-rw-r--r-- | Lua/src/lib/midi/MidiFile.pas | 28 | ||||
-rw-r--r-- | Lua/src/lib/midi/MidiScope.pas | 2 | ||||
-rw-r--r-- | Lua/src/lib/midi/Midicons.pas | 2 | ||||
-rw-r--r-- | Lua/src/lib/midi/Midiin.pas | 2 | ||||
-rw-r--r-- | Lua/src/lib/midi/Midiout.pas | 2 |
9 files changed, 21 insertions, 23 deletions
diff --git a/Lua/src/lib/midi/CIRCBUF.PAS b/Lua/src/lib/midi/CIRCBUF.PAS index 77cb3643..3ceb4c6e 100644 --- a/Lua/src/lib/midi/CIRCBUF.PAS +++ b/Lua/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/Lua/src/lib/midi/DELPHMCB.PAS b/Lua/src/lib/midi/DELPHMCB.PAS index e607627d..ef0d5451 100644 --- a/Lua/src/lib/midi/DELPHMCB.PAS +++ b/Lua/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/Lua/src/lib/midi/MIDIDEFS.PAS b/Lua/src/lib/midi/MIDIDEFS.PAS index fc8eed26..4afe56ef 100644 --- a/Lua/src/lib/midi/MIDIDEFS.PAS +++ b/Lua/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/Lua/src/lib/midi/MIDITYPE.PAS b/Lua/src/lib/midi/MIDITYPE.PAS index b1ec1bdd..45b50820 100644 --- a/Lua/src/lib/midi/MIDITYPE.PAS +++ b/Lua/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/Lua/src/lib/midi/MidiFile.pas b/Lua/src/lib/midi/MidiFile.pas index 11b1ca0b..acf44c04 100644 --- a/Lua/src/lib/midi/MidiFile.pas +++ b/Lua/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/Lua/src/lib/midi/MidiScope.pas b/Lua/src/lib/midi/MidiScope.pas index 42fc65fc..afc20b0f 100644 --- a/Lua/src/lib/midi/MidiScope.pas +++ b/Lua/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/Lua/src/lib/midi/Midicons.pas b/Lua/src/lib/midi/Midicons.pas index 35dbb5f3..72259beb 100644 --- a/Lua/src/lib/midi/Midicons.pas +++ b/Lua/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/Lua/src/lib/midi/Midiin.pas b/Lua/src/lib/midi/Midiin.pas index 21db0298..66e4f76d 100644 --- a/Lua/src/lib/midi/Midiin.pas +++ b/Lua/src/lib/midi/Midiin.pas @@ -103,7 +103,7 @@ interface {$IFDEF FPC} {$MODE Delphi} - {$H+} // use AnsiString + {$H+} // use long strings {$ENDIF} uses diff --git a/Lua/src/lib/midi/Midiout.pas b/Lua/src/lib/midi/Midiout.pas index 606d0dae..98e6e3fb 100644 --- a/Lua/src/lib/midi/Midiout.pas +++ b/Lua/src/lib/midi/Midiout.pas @@ -98,7 +98,7 @@ interface {$IFDEF FPC} {$MODE Delphi} - {$H+} // use AnsiString + {$H+} // use long strings {$ENDIF} uses |