diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-03-21 11:50:39 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-03-21 11:50:39 +0000 |
commit | 2e80ca57ed2428f7c11cd18c9db2fef8790ce748 (patch) | |
tree | d3a07c9234930dbec36c981e45aa7ea8942f4f8d | |
parent | 8394bda24520c064c150c87a4d75bb91ef11cb04 (diff) | |
download | usdx-2e80ca57ed2428f7c11cd18c9db2fef8790ce748.tar.gz usdx-2e80ca57ed2428f7c11cd18c9db2fef8790ce748.tar.xz usdx-2e80ca57ed2428f7c11cd18c9db2fef8790ce748.zip |
lenght -> length
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@964 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UDraw.pas | 14 | ||||
-rw-r--r-- | Game/Code/Classes/UFiles.pas | 2 | ||||
-rw-r--r-- | Game/Code/Classes/ULyrics.pas | 4 | ||||
-rw-r--r-- | Game/Code/Classes/UMain.pas | 28 | ||||
-rw-r--r-- | Game/Code/Classes/UMusic.pas | 1088 | ||||
-rw-r--r-- | Game/Code/Classes/USong.pas | 14 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenEditConvert.pas | 2 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenEditSub.pas | 40 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenSing.pas | 28 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenSingModi.pas | 2 |
10 files changed, 617 insertions, 605 deletions
diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 7523c10f..7e8e9849 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -305,7 +305,7 @@ begin // srodkowa czesc - middle part Rec.Left := Rec.Right; - Rec.Right := (Start+Lenght-Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == lenght + Rec.Right := (Start+Length-Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == length glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); @@ -407,10 +407,10 @@ var // Middle part of the note Rec.Left := Rec.Right; - Rec.Right := X + (Start+Lenght-Lines[0].Line[Lines[0].Current].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; + Rec.Right := X + (Start+Length-Lines[0].Line[Lines[0].Current].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; // (nowe) - dunno - if (Start+Lenght-1 = LineState.CurrentBeatD) then + if (Start+Length-1 = LineState.CurrentBeatD) then Rec.Right := Rec.Right - (1-Frac(LineState.MidBeatD)) * TempR; // the left note is more right than the right note itself, sounds weird - so we fix that xD if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; @@ -442,8 +442,8 @@ var // Perfect note is stored if Perfect and (Ini.EffectSing=1) then begin - A := 1 - 2*(LineState.CurrentTime - GetTimeFromBeat(Start+Lenght)); - if not (Start+Lenght-1 = LineState.CurrentBeatD) then + A := 1 - 2*(LineState.CurrentTime - GetTimeFromBeat(Start+Length)); + if not (Start+Length-1 = LineState.CurrentBeatD) then //Star animation counter //inc(Starfr); @@ -513,7 +513,7 @@ begin X2 := (Start-Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie X1 := X2-W; - X3 := (Start+Lenght-Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie + X3 := (Start+Length-Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie X4 := X3+W; // left @@ -1272,7 +1272,7 @@ begin // srodkowa czesc - middle part Rec.Left := Rec.Right; - Rec.Right := (Start+Lenght-Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; + Rec.Right := (Start+Length-Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); glBegin(GL_QUADS); diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 8d3a1c42..b7c231db 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -120,7 +120,7 @@ begin 1: NoteState := ': '; 2: NoteState := '* '; end; // case - S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Lenght) + ' ' + IntToStr(Tone) + ' ' + Text; + S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Length) + ' ' + IntToStr(Tone) + ' ' + Text; WriteLn(SongFile, S); diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 17c16d9e..6cec37b9 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -349,7 +349,7 @@ begin // copy values from SongLine to LyricLine CountNotes := High(Line.Note); LyricLine.Start := Line.Note[0].Start; - LyricLine.Length := Line.Note[CountNotes].Start + Line.Note[CountNotes].Lenght - LyricLine.Start; + LyricLine.Length := Line.Note[CountNotes].Start + Line.Note[CountNotes].Length - LyricLine.Start; LyricLine.CurWord := -1; LyricLine.LastLine := Line.LastLine; @@ -366,7 +366,7 @@ begin For I := 0 to CountNotes do begin LyricLine.Words[I].Start := Line.Note[I].Start; - LyricLine.Words[I].Length := Line.Note[I].Lenght; + LyricLine.Words[I].Length := Line.Note[I].Length; LyricLine.Words[I].Text := Line.Note[I].Text; LyricLine.Words[I].Freestyle := Line.Note[I].FreeStyle; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index fd0c9eb5..3cf2f7d0 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -59,7 +59,7 @@ type IlNut: integer;
Note: array of record
Start: integer;
- Lenght: integer;
+ Length: integer;
Detekt: real; // accurate place, detected in the note
Tone: real;
Perfect: boolean; // true if the note matches the original one, lit the star
@@ -747,9 +747,9 @@ begin for N := 0 to Lines[0].Line[Lines[0].Current].HighNote do
begin
if (Lines[0].Line[Lines[0].Current].Note[N].Start <= LineState.MidBeat) and
- (Lines[0].Line[Lines[0].Current].Note[N].Start + Lines[0].Line[Lines[0].Current].Note[N].Lenght >= LineState.MidBeat) then
+ (Lines[0].Line[Lines[0].Current].Note[N].Start + Lines[0].Line[Lines[0].Current].Note[N].Length >= LineState.MidBeat) then
begin
- Done := (LineState.MidBeat - Lines[0].Line[Lines[0].Current].Note[N].Start) / (Lines[0].Line[Lines[0].Current].Note[N].Lenght);
+ Done := (LineState.MidBeat - Lines[0].Line[Lines[0].Current].Note[N].Start) / (Lines[0].Line[Lines[0].Current].Note[N].Length);
end;
end;
@@ -758,7 +758,7 @@ begin // wylacza ostatnia nute po przejsciu
{// todo: Lyrics
if (Ini.LyricsEffect = 1) and (Done = 1) and
- (LineState.MidBeat > Lines[0].Line[Lines[0].Current].Note[N].Start + Lines[0].Line[Lines[0].Current].Note[N].Lenght)
+ (LineState.MidBeat > Lines[0].Line[Lines[0].Current].Note[N].Start + Lines[0].Line[Lines[0].Current].Note[N].Length)
then Sender.LyricMain.Selected := -1;
if Done > 1 then Done := 1;
@@ -943,9 +943,9 @@ begin for Count := 0 to Lines[0].Line[S].HighNote do
begin
if ((Lines[0].Line[S].Note[Count].Start <= LineState.CurrentBeatD)
- and (Lines[0].Line[S].Note[Count].Start + Lines[0].Line[S].Note[Count].Lenght - 1 >= LineState.CurrentBeatD))
+ and (Lines[0].Line[S].Note[Count].Start + Lines[0].Line[S].Note[Count].Length - 1 >= LineState.CurrentBeatD))
and (not Lines[0].Line[S].Note[Count].FreeStyle) // but don't allow when it's FreeStyle note
- and (Lines[0].Line[S].Note[Count].Lenght > 0) then // and make sure the note lenghts is at least 1
+ and (Lines[0].Line[S].Note[Count].Length > 0) then // and make sure the note lengths is at least 1
begin
SDet := S;
Mozna := true;
@@ -967,7 +967,7 @@ begin begin
if (Lines[0].Line[S].Note[Count].Start <= LineState.OldBeatD+1) and
(Lines[0].Line[S].Note[Count].Start +
- Lines[0].Line[S].Note[Count].Lenght > LineState.OldBeatD+1) then
+ Lines[0].Line[S].Note[Count].Length > LineState.OldBeatD+1) then
begin
// to robi, tylko dla pary nut (oryginalnej i gracza)
@@ -1027,15 +1027,15 @@ begin if S = SMax then
begin
New := true;
- // jezeli ostatnia ma ten sam Tone
+ // if last has the same tone
if (Player[CP].IlNut > 0 ) and
(Player[CP].Note[Player[CP].HighNote].Tone = AudioInputProcessor.Sound[CP].Tone) and
- (Player[CP].Note[Player[CP].HighNote].Start + Player[CP].Note[Player[CP].HighNote].Lenght = LineState.CurrentBeatD) then
+ (Player[CP].Note[Player[CP].HighNote].Start + Player[CP].Note[Player[CP].HighNote].Length = LineState.CurrentBeatD) then
begin
New := false;
end;
- // jezeli jest jakas nowa nuta na sprawdzanym beacie
+ // if is not as new note to control "beacie" (TODO: translate polish "beacie")
for Count := 0 to Lines[0].Line[S].HighNote do
begin
if (Lines[0].Line[S].Note[Count].Start = LineState.CurrentBeatD) then
@@ -1050,7 +1050,7 @@ begin Player[CP].HighNote := Player[CP].HighNote + 1;
SetLength(Player[CP].Note, Player[CP].IlNut);
Player[CP].Note[Player[CP].HighNote].Start := LineState.CurrentBeatD;
- Player[CP].Note[Player[CP].HighNote].Lenght := 1;
+ Player[CP].Note[Player[CP].HighNote].Length := 1;
Player[CP].Note[Player[CP].HighNote].Tone := AudioInputProcessor.Sound[CP].Tone; // Ton || TonDokl
Player[CP].Note[Player[CP].HighNote].Detekt := LineState.MidBeat;
@@ -1062,14 +1062,14 @@ begin else
begin
// przedluzenie nuty
- Player[CP].Note[Player[CP].HighNote].Lenght := Player[CP].Note[Player[CP].HighNote].Lenght + 1;
+ Player[CP].Note[Player[CP].HighNote].Length := Player[CP].Note[Player[CP].HighNote].Length + 1;
end;
// check for perfect note and then lit the star (on Draw)
for Count := 0 to Lines[0].Line[S].HighNote do
begin
if (Lines[0].Line[S].Note[Count].Start = Player[CP].Note[Player[CP].HighNote].Start) and
- (Lines[0].Line[S].Note[Count].Lenght = Player[CP].Note[Player[CP].HighNote].Lenght) and
+ (Lines[0].Line[S].Note[Count].Length = Player[CP].Note[Player[CP].HighNote].Length) and
(Lines[0].Line[S].Note[Count].Tone = Player[CP].Note[Player[CP].HighNote].Tone) then
begin
Player[CP].Note[Player[CP].HighNote].Perfect := true;
@@ -1085,7 +1085,7 @@ begin if (sDet >= low(Lines[0].Line)) and (sDet <= high(Lines[0].Line)) then
begin
if assigned( Sender ) and
- ((Lines[0].Line[SDet].Note[Lines[0].Line[SDet].HighNote].Start + Lines[0].Line[SDet].Note[Lines[0].Line[SDet].HighNote].Lenght - 1) = LineState.CurrentBeatD) then
+ ((Lines[0].Line[SDet].Note[Lines[0].Line[SDet].HighNote].Start + Lines[0].Line[SDet].Note[Lines[0].Line[SDet].HighNote].Length - 1) = LineState.CurrentBeatD) then
begin
Sender.onSentenceEnd(sDet);
end;
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 4406ac21..c4123dd0 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -1,544 +1,544 @@ -unit UMusic;
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- Classes;
-
-type
- TNoteType = (ntFreestyle, ntNormal, ntGolden);
-
- //http://paste.ubuntu-nl.org/51892/
-
- TMelody = record
- Path: string;
- Start: integer; // start of song in ms
- IlNut: integer; // (TODO: Il = tone, Nut(a) = Note)
- NoteLenght: integer;
- end;
-
- PLine = ^TLine;
- TLine = record
- Start: integer;
- StartNote: integer;
- Lyric: string;
- LyricWidth: real;
- End_: integer;
- BaseNote: integer;
- HighNote: integer;
- IlNut: integer; // (TODO: Il = tone, Nut(a) = Note)
- TotalNotes: integer;
- LastLine: boolean;
- Note: array of record
- Color: integer;
- Start: integer;
- Lenght: integer;
- Tone: integer; // full range tone
- ToneGamus: integer; // tone unified to one octave
- Text: string;
- FreeStyle: boolean;
- NoteType: integer; // normal-note: 1, golden-note: 2
- end;
- end;
- ALine = array of TLine; // (TODO: rename to TLineArray)
-
- // (TCzesci = TSentences) TCzesci changed to TLines because TSentences exist elseware in incompatible form
- TLines = record
- Current: integer; // for drawing of current line
- High: integer;
- Number: integer;
- Resolution: integer;
- NotesGAP: integer;
- NoteType: integer;
- Line: ALine;
- end;
-
- // (TODO: rename TCzas to something like T(Line/Sentence)Time/TLinePosition/TLineState)
- // (Czas = time)
- TLineState = record // all that concerns the current frames
- OldBeat: integer; // previous discovered beat
- CurrentBeat: integer;
- MidBeat: real; // like CurrentBeat
-
- // now we use this for super synchronization!
- // only used when analyzing voice
- OldBeatD: integer; // previous discovered beat
- CurrentBeatD: integer;
- MidBeatD: real; // like CurrentBeatD
- FracBeatD: real; // fractional part of MidBeatD
-
- // we use this for audible clicks
- OldBeatC: integer; // previous discovered beat
- CurrentBeatC: integer;
- MidBeatC: real; // like CurrentBeatC
- FracBeatC: real; // fractional part of MidBeatC
-
-
- OldLine: integer; // previous displayed sentence
-
- CurrentTime: real;
- TotalTime: real;
- end;
-
-
-const
- FFTSize = 512; // size of FFT data (output: FFTSize/2 values)
-type
- TFFTData = array[0..(FFTSize div 2)-1] of Single;
-
-type
- TPCMStereoSample = array[0..1] of SmallInt;
- TPCMData = array[0..511] of TPCMStereoSample;
-
-type
- TStreamStatus = (ssStopped, ssPlaying, ssPaused, ssBlocked, ssUnknown);
-const
- StreamStatusStr: array[TStreamStatus] of string =
- ('Stopped', 'Playing', 'Paused', 'Blocked', 'Unknown');
-
-type
- TAudioSampleFormat = (
- asfU8, asfS8, // unsigned/signed 8 bits
- asfU16LSB, asfS16LSB, // unsigned/signed 16 bits (endianness: LSB)
- asfU16MSB, asfS16MSB, // unsigned/signed 16 bits (endianness: MSB)
- asfU16, asfS16, // unsigned/signed 16 bits (endianness: System)
- asfS24, // signed 24 bits (endianness: System)
- asfS32, // signed 32 bits (endianness: System)
- asfFloat // float
- );
-
-const
- // Size of one sample (one channel only) in bytes
- AudioSampleSize: array[TAudioSampleFormat] of integer = (
- 1, 1, // asfU8, asfS8
- 2, 2, // asfU16LSB, asfS16LSB
- 2, 2, // asfU16MSB, asfS16MSB
- 2, 2, // asfU16, asfS16
- 3, // asfS24
- 4, // asfS32
- 4 // asfFloat
- );
-
-type
- TAudioFormatInfo = class
- public
- Channels : byte;
- SampleRate : integer;
- Format : TAudioSampleFormat;
- FrameSize : integer; // calculated on construction
-
- constructor Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat);
- end;
-
-type
- TAudioProcessingStream = class
- public
- procedure Close(); virtual; abstract;
- end;
-
- TAudioPlaybackStream = class(TAudioProcessingStream)
- protected
- function GetLoop(): boolean; virtual; abstract;
- procedure SetLoop(Enabled: boolean); virtual; abstract;
- function GetLength(): real; virtual; abstract;
- function GetStatus(): TStreamStatus; virtual; abstract;
- function GetVolume(): integer; virtual; abstract;
- procedure SetVolume(volume: integer); virtual; abstract;
- public
- procedure Play(); virtual; abstract;
- procedure Pause(); virtual; abstract;
- procedure Stop(); virtual; abstract;
-
- property Loop: boolean READ GetLoop WRITE SetLoop;
- property Length: real READ GetLength;
- property Status: TStreamStatus READ GetStatus;
- property Volume: integer READ GetVolume WRITE SetVolume;
- end;
-
- (*
- TAudioMixerStream = class(TAudioProcessingStream)
- procedure AddStream(stream: TAudioProcessingStream);
- procedure RemoveStream(stream: TAudioProcessingStream);
- procedure SetMasterVolume(volume: cardinal);
- function GetMasterVolume(): cardinal;
- procedure SetStreamVolume(stream: TAudioProcessingStream; volume: cardinal);
- function GetStreamVolume(stream: TAudioProcessingStream): cardinal;
- end;
- *)
-
- TAudioDecodeStream = class(TAudioProcessingStream)
- protected
- function GetLength(): real; virtual; abstract;
- function GetPosition(): real; virtual; abstract;
- procedure SetPosition(Time: real); virtual; abstract;
- function IsEOF(): boolean; virtual; abstract;
- public
- function ReadData(Buffer: PChar; BufSize: integer): integer; virtual; abstract;
- function GetAudioFormatInfo(): TAudioFormatInfo; virtual; abstract;
-
- property Length: real READ GetLength;
- property Position: real READ GetPosition WRITE SetPosition;
- property EOF: boolean READ IsEOF;
- end;
-
-type
- IGenericPlayback = Interface
- ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}']
- function GetName: String;
-
- function Open(const Filename: string): boolean; // true if succeed
- procedure Close;
-
- procedure Play;
- procedure Pause;
- procedure Stop;
-
- procedure SetPosition(Time: real);
- function GetPosition: real;
-
- property Position : real READ GetPosition WRITE SetPosition;
- end;
-
- IVideoPlayback = Interface( IGenericPlayback )
- ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}']
- procedure init();
-
- procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC
- procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC
-
- end;
-
- IVideoVisualization = Interface( IVideoPlayback )
- ['{5AC17D60-B34D-478D-B632-EB00D4078017}']
- end;
-
- IAudioPlayback = Interface( IGenericPlayback )
- ['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}']
- function InitializePlayback: boolean;
- procedure SetVolume(Volume: integer);
- procedure SetMusicVolume(Volume: integer);
- procedure SetLoop(Enabled: boolean);
-
- procedure Rewind;
- function Finished: boolean;
- function Length: real;
-
- // Sounds
- function OpenSound(const Filename: String): TAudioPlaybackStream;
- procedure PlaySound(stream: TAudioPlaybackStream);
- procedure StopSound(stream: TAudioPlaybackStream);
-
- // Equalizer
- procedure GetFFTData(var data: TFFTData);
-
- // Interface for Visualizer
- function GetPCMData(var data: TPCMData): Cardinal;
- end;
-
- IGenericDecoder = Interface
- ['{557B0E9A-604D-47E4-B826-13769F3E10B7}']
- function GetName(): String;
- function InitializeDecoder(): boolean;
- //function IsSupported(const Filename: string): boolean;
- end;
-
- (*
- IVideoDecoder = Interface( IGenericDecoder )
- ['{2F184B2B-FE69-44D5-9031-0A2462391DCA}']
- function Open(const Filename: string): TVideoDecodeStream;
- end;
- *)
-
- IAudioDecoder = Interface( IGenericDecoder )
- ['{AB47B1B6-2AA9-4410-BF8C-EC79561B5478}']
- function Open(const Filename: string): TAudioDecodeStream;
- end;
-
- IAudioInput = Interface
- ['{A5C8DA92-2A0C-4AB2-849B-2F7448C6003A}']
- function GetName: String;
- function InitializeRecord: boolean;
-
- procedure CaptureStart;
- procedure CaptureStop;
- end;
-
-type
- TSoundLibrary = class
- public
- Start: TAudioPlaybackStream;
- Back: TAudioPlaybackStream;
- Swoosh: TAudioPlaybackStream;
- Change: TAudioPlaybackStream;
- Option: TAudioPlaybackStream;
- Click: TAudioPlaybackStream;
- Drum: TAudioPlaybackStream;
- Hihat: TAudioPlaybackStream;
- Clap: TAudioPlaybackStream;
- Shuffle: TAudioPlaybackStream;
-
- constructor Create();
- destructor Destroy(); override;
- end;
-
-var // TODO : JB --- THESE SHOULD NOT BE GLOBAL
- // music
- Melody: TMelody;
-
- // czesci z nutami;
- Lines: array of TLines;
-
- // LineState
- LineState: TLineState;
-
- SoundLib: TSoundLibrary;
-
-
-procedure InitializeSound;
-
-function Visualization(): IVideoPlayback;
-function VideoPlayback(): IVideoPlayback;
-function AudioPlayback(): IAudioPlayback;
-function AudioInput(): IAudioInput;
-function AudioDecoder(): IAudioDecoder;
-
-function AudioManager: TInterfaceList;
-
-
-implementation
-
-uses
- sysutils,
- UMain,
- UCommandLine,
- ULog;
-
-var
- singleton_VideoPlayback : IVideoPlayback = nil;
- singleton_Visualization : IVideoPlayback = nil;
- singleton_AudioPlayback : IAudioPlayback = nil;
- singleton_AudioInput : IAudioInput = nil;
- singleton_AudioDecoder : IAudioDecoder = nil;
-
- singleton_AudioManager : TInterfaceList = nil;
-
-
-constructor TAudioFormatInfo.Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat);
-begin
- Self.Channels := Channels;
- Self.SampleRate := SampleRate;
- Self.Format := Format;
- Self.FrameSize := AudioSampleSize[Format] * Channels;
-end;
-
-function AudioManager: TInterfaceList;
-begin
- if singleton_AudioManager = nil then
- singleton_AudioManager := TInterfaceList.Create();
-
- Result := singleton_AudioManager;
-end; //CompressionPluginManager
-
-
-function VideoPlayback(): IVideoPlayback;
-begin
- result := singleton_VideoPlayback;
-end;
-
-function Visualization(): IVideoPlayback;
-begin
- result := singleton_Visualization;
-end;
-
-function AudioPlayback(): IAudioPlayback;
-begin
- result := singleton_AudioPlayback;
-end;
-
-function AudioInput(): IAudioInput;
-begin
- result := singleton_AudioInput;
-end;
-
-function AudioDecoder(): IAudioDecoder;
-begin
- result := singleton_AudioDecoder;
-end;
-
-procedure AssignSingletonObjects();
-var
- lTmpInterface : IInterface;
- iCount : Integer;
-begin
- lTmpInterface := nil;
-
-
-
- for iCount := 0 to AudioManager.Count - 1 do
- begin
- if assigned( AudioManager[iCount] ) then
- begin
- // if this interface is a Playback, then set it as the default used
-
- if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND
- ( true ) then //not assigned( singleton_AudioPlayback ) ) then
- begin
- singleton_AudioPlayback := IAudioPlayback( lTmpInterface );
- end;
-
- // if this interface is a Input, then set it as the default used
- if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND
- ( true ) then //not assigned( singleton_AudioInput ) ) then
- begin
- singleton_AudioInput := IAudioInput( lTmpInterface );
- end;
-
- // if this interface is a Decoder, then set it as the default used
- if ( AudioManager[iCount].QueryInterface( IAudioDecoder, lTmpInterface ) = 0 ) AND
- ( true ) then //not assigned( singleton_AudioDecoder ) ) then
- begin
- singleton_AudioDecoder := IAudioDecoder( lTmpInterface );
- end;
-
- // if this interface is a Input, then set it as the default used
- if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND
- ( true ) then //not assigned( singleton_VideoPlayback ) ) then
- begin
- singleton_VideoPlayback := IVideoPlayback( lTmpInterface );
- end;
-
- if ( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) = 0 ) AND
- ( true ) then //not assigned( singleton_Visualization ) ) then
- begin
- singleton_Visualization := IVideoPlayback( lTmpInterface );
- end;
-
- end;
- end;
-
-end;
-
-procedure InitializeSound;
-begin
- singleton_AudioPlayback := nil;
- singleton_AudioInput := nil;
- singleton_AudioDecoder := nil;
- singleton_VideoPlayback := nil;
- singleton_Visualization := nil;
-
- AssignSingletonObjects();
-
- if VideoPlayback <> nil then
- begin
- end;
-
- if AudioDecoder <> nil then
- begin
- while not AudioDecoder.InitializeDecoder do
- begin
- Log.LogError('Initialize failed, Removing - '+ AudioDecoder.GetName);
- AudioManager.remove( AudioDecoder );
- singleton_AudioDecoder := nil;
- AssignSingletonObjects();
- end;
- end;
-
- if AudioPlayback <> nil then
- begin
- while not AudioPlayback.InitializePlayback do
- begin
- Log.LogError('Initialize failed, Removing - '+ AudioPlayback.GetName);
- AudioManager.remove( AudioPlayback );
- singleton_AudioPlayback := nil;
- AssignSingletonObjects();
- end;
- end;
-
- if AudioInput <> nil then
- begin
- while not AudioInput.InitializeRecord do
- begin
- Log.LogError('Initialize failed, Removing - '+ AudioInput.GetName);
- AudioManager.remove( AudioInput );
- singleton_AudioInput := nil;
- AssignSingletonObjects();
- end;
- end;
-
- // Load in-game sounds
- SoundLib := TSoundLibrary.Create;
-
- if FindCmdLineSwitch( cMediaInterfaces ) then
- begin
- writeln( '' );
- writeln( '--------------------------------------------------------------' );
- writeln( ' In-use Media Interfaces ' );
- writeln( '--------------------------------------------------------------' );
- writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName );
- writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName );
- writeln( 'Registered Video Playback Interface : ' + VideoPlayback.GetName );
- writeln( 'Registered Visualization Interface : ' + Visualization.GetName );
- writeln( '--------------------------------------------------------------' );
- writeln( '' );
-
- halt;
- end;
-end;
-
-constructor TSoundLibrary.Create();
-begin
- //Log.LogStatus('Loading Sounds', 'Music Initialize');
-
- //Log.BenchmarkStart(4);
-
- Start := AudioPlayback.OpenSound(SoundPath + 'Common start.mp3');
- Back := AudioPlayback.OpenSound(SoundPath + 'Common back.mp3');
- Swoosh := AudioPlayback.OpenSound(SoundPath + 'menu swoosh.mp3');
- Change := AudioPlayback.OpenSound(SoundPath + 'select music change music 50.mp3');
- Option := AudioPlayback.OpenSound(SoundPath + 'option change col.mp3');
- Click := AudioPlayback.OpenSound(SoundPath + 'rimshot022b.mp3');
-
- //Drum := AudioPlayback.OpenSound(SoundPath + 'bassdrumhard076b.mp3');
- //Hihat := AudioPlayback.OpenSound(SoundPath + 'hihatclosed068b.mp3');
- //Clap := AudioPlayback.OpenSound(SoundPath + 'claps050b.mp3');
-
- //Shuffle := AudioPlayback.OpenSound(SoundPath + 'Shuffle.mp3');
-
- //Log.BenchmarkEnd(4);
- //Log.LogBenchmark('--> Loading Sounds', 4);
-end;
-
-destructor TSoundLibrary.Destroy();
-begin
- Start.Free;
- Back.Free;
- Swoosh.Free;
- Change.Free;
- Option.Free;
- Click.Free;
-
- //Drum.Free;
- //Hihat.Free;
- //Clap.Free;
-
- //Shuffle.Free;
-end;
-
-
-initialization
-begin
- singleton_AudioManager := TInterfaceList.Create();
-
-end;
-
-finalization
- singleton_AudioManager.clear;
- FreeAndNil( singleton_AudioManager );
-
-end.
+unit UMusic; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + Classes; + +type + TNoteType = (ntFreestyle, ntNormal, ntGolden); + + //http://paste.ubuntu-nl.org/51892/ + + TMelody = record + Path: string; + Start: integer; // start of song in ms + IlNut: integer; // (TODO: Il = tone, Nut(a) = Note) + NoteLength: integer; + end; + + PLine = ^TLine; + TLine = record + Start: integer; + StartNote: integer; + Lyric: string; + LyricWidth: real; + End_: integer; + BaseNote: integer; + HighNote: integer; + IlNut: integer; // (TODO: Il = tone, Nut(a) = Note) + TotalNotes: integer; + LastLine: boolean; + Note: array of record + Color: integer; + Start: integer; + Length: integer; + Tone: integer; // full range tone + ToneGamus: integer; // tone unified to one octave + Text: string; + FreeStyle: boolean; + NoteType: integer; // normal-note: 1, golden-note: 2 + end; + end; + ALine = array of TLine; // (TODO: rename to TLineArray) + + // (TCzesci = TSentences) TCzesci changed to TLines because TSentences exist elseware in incompatible form + TLines = record + Current: integer; // for drawing of current line + High: integer; + Number: integer; + Resolution: integer; + NotesGAP: integer; + NoteType: integer; + Line: ALine; + end; + + // (TODO: rename TCzas to something like T(Line/Sentence)Time/TLinePosition/TLineState) + // (Czas = time) + TLineState = record // all that concerns the current frames + OldBeat: integer; // previous discovered beat + CurrentBeat: integer; + MidBeat: real; // like CurrentBeat + + // now we use this for super synchronization! + // only used when analyzing voice + OldBeatD: integer; // previous discovered beat + CurrentBeatD: integer; + MidBeatD: real; // like CurrentBeatD + FracBeatD: real; // fractional part of MidBeatD + + // we use this for audible clicks + OldBeatC: integer; // previous discovered beat + CurrentBeatC: integer; + MidBeatC: real; // like CurrentBeatC + FracBeatC: real; // fractional part of MidBeatC + + + OldLine: integer; // previous displayed sentence + + CurrentTime: real; + TotalTime: real; + end; + + +const + FFTSize = 512; // size of FFT data (output: FFTSize/2 values) +type + TFFTData = array[0..(FFTSize div 2)-1] of Single; + +type + TPCMStereoSample = array[0..1] of SmallInt; + TPCMData = array[0..511] of TPCMStereoSample; + +type + TStreamStatus = (ssStopped, ssPlaying, ssPaused, ssBlocked, ssUnknown); +const + StreamStatusStr: array[TStreamStatus] of string = + ('Stopped', 'Playing', 'Paused', 'Blocked', 'Unknown'); + +type + TAudioSampleFormat = ( + asfU8, asfS8, // unsigned/signed 8 bits + asfU16LSB, asfS16LSB, // unsigned/signed 16 bits (endianness: LSB) + asfU16MSB, asfS16MSB, // unsigned/signed 16 bits (endianness: MSB) + asfU16, asfS16, // unsigned/signed 16 bits (endianness: System) + asfS24, // signed 24 bits (endianness: System) + asfS32, // signed 32 bits (endianness: System) + asfFloat // float + ); + +const + // Size of one sample (one channel only) in bytes + AudioSampleSize: array[TAudioSampleFormat] of integer = ( + 1, 1, // asfU8, asfS8 + 2, 2, // asfU16LSB, asfS16LSB + 2, 2, // asfU16MSB, asfS16MSB + 2, 2, // asfU16, asfS16 + 3, // asfS24 + 4, // asfS32 + 4 // asfFloat + ); + +type + TAudioFormatInfo = class + public + Channels : byte; + SampleRate : integer; + Format : TAudioSampleFormat; + FrameSize : integer; // calculated on construction + + constructor Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat); + end; + +type + TAudioProcessingStream = class + public + procedure Close(); virtual; abstract; + end; + + TAudioPlaybackStream = class(TAudioProcessingStream) + protected + function GetLoop(): boolean; virtual; abstract; + procedure SetLoop(Enabled: boolean); virtual; abstract; + function GetLength(): real; virtual; abstract; + function GetStatus(): TStreamStatus; virtual; abstract; + function GetVolume(): integer; virtual; abstract; + procedure SetVolume(volume: integer); virtual; abstract; + public + procedure Play(); virtual; abstract; + procedure Pause(); virtual; abstract; + procedure Stop(); virtual; abstract; + + property Loop: boolean READ GetLoop WRITE SetLoop; + property Length: real READ GetLength; + property Status: TStreamStatus READ GetStatus; + property Volume: integer READ GetVolume WRITE SetVolume; + end; + + (* + TAudioMixerStream = class(TAudioProcessingStream) + procedure AddStream(stream: TAudioProcessingStream); + procedure RemoveStream(stream: TAudioProcessingStream); + procedure SetMasterVolume(volume: cardinal); + function GetMasterVolume(): cardinal; + procedure SetStreamVolume(stream: TAudioProcessingStream; volume: cardinal); + function GetStreamVolume(stream: TAudioProcessingStream): cardinal; + end; + *) + + TAudioDecodeStream = class(TAudioProcessingStream) + protected + function GetLength(): real; virtual; abstract; + function GetPosition(): real; virtual; abstract; + procedure SetPosition(Time: real); virtual; abstract; + function IsEOF(): boolean; virtual; abstract; + public + function ReadData(Buffer: PChar; BufSize: integer): integer; virtual; abstract; + function GetAudioFormatInfo(): TAudioFormatInfo; virtual; abstract; + + property Length: real READ GetLength; + property Position: real READ GetPosition WRITE SetPosition; + property EOF: boolean READ IsEOF; + end; + +type + IGenericPlayback = Interface + ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}'] + function GetName: String; + + function Open(const Filename: string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure SetPosition(Time: real); + function GetPosition: real; + + property Position : real READ GetPosition WRITE SetPosition; + end; + + IVideoPlayback = Interface( IGenericPlayback ) + ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] + procedure init(); + + procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + + end; + + IVideoVisualization = Interface( IVideoPlayback ) + ['{5AC17D60-B34D-478D-B632-EB00D4078017}'] + end; + + IAudioPlayback = Interface( IGenericPlayback ) + ['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}'] + function InitializePlayback: boolean; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + + procedure Rewind; + function Finished: boolean; + function Length: real; + + // Sounds + function OpenSound(const Filename: String): TAudioPlaybackStream; + procedure PlaySound(stream: TAudioPlaybackStream); + procedure StopSound(stream: TAudioPlaybackStream); + + // Equalizer + procedure GetFFTData(var data: TFFTData); + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + end; + + IGenericDecoder = Interface + ['{557B0E9A-604D-47E4-B826-13769F3E10B7}'] + function GetName(): String; + function InitializeDecoder(): boolean; + //function IsSupported(const Filename: string): boolean; + end; + + (* + IVideoDecoder = Interface( IGenericDecoder ) + ['{2F184B2B-FE69-44D5-9031-0A2462391DCA}'] + function Open(const Filename: string): TVideoDecodeStream; + end; + *) + + IAudioDecoder = Interface( IGenericDecoder ) + ['{AB47B1B6-2AA9-4410-BF8C-EC79561B5478}'] + function Open(const Filename: string): TAudioDecodeStream; + end; + + IAudioInput = Interface + ['{A5C8DA92-2A0C-4AB2-849B-2F7448C6003A}'] + function GetName: String; + function InitializeRecord: boolean; + + procedure CaptureStart; + procedure CaptureStop; + end; + +type + TSoundLibrary = class + public + Start: TAudioPlaybackStream; + Back: TAudioPlaybackStream; + Swoosh: TAudioPlaybackStream; + Change: TAudioPlaybackStream; + Option: TAudioPlaybackStream; + Click: TAudioPlaybackStream; + Drum: TAudioPlaybackStream; + Hihat: TAudioPlaybackStream; + Clap: TAudioPlaybackStream; + Shuffle: TAudioPlaybackStream; + + constructor Create(); + destructor Destroy(); override; + end; + +var // TODO : JB --- THESE SHOULD NOT BE GLOBAL + // music + Melody: TMelody; + + // czesci z nutami; + Lines: array of TLines; + + // LineState + LineState: TLineState; + + SoundLib: TSoundLibrary; + + +procedure InitializeSound; + +function Visualization(): IVideoPlayback; +function VideoPlayback(): IVideoPlayback; +function AudioPlayback(): IAudioPlayback; +function AudioInput(): IAudioInput; +function AudioDecoder(): IAudioDecoder; + +function AudioManager: TInterfaceList; + + +implementation + +uses + sysutils, + UMain, + UCommandLine, + ULog; + +var + singleton_VideoPlayback : IVideoPlayback = nil; + singleton_Visualization : IVideoPlayback = nil; + singleton_AudioPlayback : IAudioPlayback = nil; + singleton_AudioInput : IAudioInput = nil; + singleton_AudioDecoder : IAudioDecoder = nil; + + singleton_AudioManager : TInterfaceList = nil; + + +constructor TAudioFormatInfo.Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat); +begin + Self.Channels := Channels; + Self.SampleRate := SampleRate; + Self.Format := Format; + Self.FrameSize := AudioSampleSize[Format] * Channels; +end; + +function AudioManager: TInterfaceList; +begin + if singleton_AudioManager = nil then + singleton_AudioManager := TInterfaceList.Create(); + + Result := singleton_AudioManager; +end; //CompressionPluginManager + + +function VideoPlayback(): IVideoPlayback; +begin + result := singleton_VideoPlayback; +end; + +function Visualization(): IVideoPlayback; +begin + result := singleton_Visualization; +end; + +function AudioPlayback(): IAudioPlayback; +begin + result := singleton_AudioPlayback; +end; + +function AudioInput(): IAudioInput; +begin + result := singleton_AudioInput; +end; + +function AudioDecoder(): IAudioDecoder; +begin + result := singleton_AudioDecoder; +end; + +procedure AssignSingletonObjects(); +var + lTmpInterface : IInterface; + iCount : Integer; +begin + lTmpInterface := nil; + + + + for iCount := 0 to AudioManager.Count - 1 do + begin + if assigned( AudioManager[iCount] ) then + begin + // if this interface is a Playback, then set it as the default used + + if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND + ( true ) then //not assigned( singleton_AudioPlayback ) ) then + begin + singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); + end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND + ( true ) then //not assigned( singleton_AudioInput ) ) then + begin + singleton_AudioInput := IAudioInput( lTmpInterface ); + end; + + // if this interface is a Decoder, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioDecoder, lTmpInterface ) = 0 ) AND + ( true ) then //not assigned( singleton_AudioDecoder ) ) then + begin + singleton_AudioDecoder := IAudioDecoder( lTmpInterface ); + end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND + ( true ) then //not assigned( singleton_VideoPlayback ) ) then + begin + singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); + end; + + if ( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) = 0 ) AND + ( true ) then //not assigned( singleton_Visualization ) ) then + begin + singleton_Visualization := IVideoPlayback( lTmpInterface ); + end; + + end; + end; + +end; + +procedure InitializeSound; +begin + singleton_AudioPlayback := nil; + singleton_AudioInput := nil; + singleton_AudioDecoder := nil; + singleton_VideoPlayback := nil; + singleton_Visualization := nil; + + AssignSingletonObjects(); + + if VideoPlayback <> nil then + begin + end; + + if AudioDecoder <> nil then + begin + while not AudioDecoder.InitializeDecoder do + begin + Log.LogError('Initialize failed, Removing - '+ AudioDecoder.GetName); + AudioManager.remove( AudioDecoder ); + singleton_AudioDecoder := nil; + AssignSingletonObjects(); + end; + end; + + if AudioPlayback <> nil then + begin + while not AudioPlayback.InitializePlayback do + begin + Log.LogError('Initialize failed, Removing - '+ AudioPlayback.GetName); + AudioManager.remove( AudioPlayback ); + singleton_AudioPlayback := nil; + AssignSingletonObjects(); + end; + end; + + if AudioInput <> nil then + begin + while not AudioInput.InitializeRecord do + begin + Log.LogError('Initialize failed, Removing - '+ AudioInput.GetName); + AudioManager.remove( AudioInput ); + singleton_AudioInput := nil; + AssignSingletonObjects(); + end; + end; + + // Load in-game sounds + SoundLib := TSoundLibrary.Create; + + if FindCmdLineSwitch( cMediaInterfaces ) then + begin + writeln( '' ); + writeln( '--------------------------------------------------------------' ); + writeln( ' In-use Media Interfaces ' ); + writeln( '--------------------------------------------------------------' ); + writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); + writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); + writeln( 'Registered Video Playback Interface : ' + VideoPlayback.GetName ); + writeln( 'Registered Visualization Interface : ' + Visualization.GetName ); + writeln( '--------------------------------------------------------------' ); + writeln( '' ); + + halt; + end; +end; + +constructor TSoundLibrary.Create(); +begin + //Log.LogStatus('Loading Sounds', 'Music Initialize'); + + //Log.BenchmarkStart(4); + + Start := AudioPlayback.OpenSound(SoundPath + 'Common start.mp3'); + Back := AudioPlayback.OpenSound(SoundPath + 'Common back.mp3'); + Swoosh := AudioPlayback.OpenSound(SoundPath + 'menu swoosh.mp3'); + Change := AudioPlayback.OpenSound(SoundPath + 'select music change music 50.mp3'); + Option := AudioPlayback.OpenSound(SoundPath + 'option change col.mp3'); + Click := AudioPlayback.OpenSound(SoundPath + 'rimshot022b.mp3'); + + //Drum := AudioPlayback.OpenSound(SoundPath + 'bassdrumhard076b.mp3'); + //Hihat := AudioPlayback.OpenSound(SoundPath + 'hihatclosed068b.mp3'); + //Clap := AudioPlayback.OpenSound(SoundPath + 'claps050b.mp3'); + + //Shuffle := AudioPlayback.OpenSound(SoundPath + 'Shuffle.mp3'); + + //Log.BenchmarkEnd(4); + //Log.LogBenchmark('--> Loading Sounds', 4); +end; + +destructor TSoundLibrary.Destroy(); +begin + Start.Free; + Back.Free; + Swoosh.Free; + Change.Free; + Option.Free; + Click.Free; + + //Drum.Free; + //Hihat.Free; + //Clap.Free; + + //Shuffle.Free; +end; + + +initialization +begin + singleton_AudioManager := TInterfaceList.Create(); + +end; + +finalization + singleton_AudioManager.clear; + FreeAndNil( singleton_AudioManager ); + +end. diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index a3a72107..5b10f8a1 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -300,7 +300,7 @@ begin Lines[CP].Line[Lines[CP].High].TotalNotes := 0; for I := low(Lines[CP].Line[Lines[CP].High].Note) to high(Lines[CP].Line[Lines[CP].High].Note) do begin - Lines[CP].Line[Lines[CP].High].TotalNotes := Lines[CP].Line[Lines[CP].High].TotalNotes + Lines[CP].Line[Lines[CP].High].Note[I].Lenght * Lines[CP].Line[Lines[CP].High].Note[I].NoteType; + Lines[CP].Line[Lines[CP].High].TotalNotes := Lines[CP].Line[Lines[CP].High].TotalNotes + Lines[CP].Line[Lines[CP].High].Note[I].Length * Lines[CP].Line[Lines[CP].High].Note[I].NoteType; end; //Total Notes Patch End end else begin @@ -311,7 +311,7 @@ begin Lines[Count].Line[Lines[Count].High].TotalNotes := 0; for I := low(Lines[Count].Line[Lines[Count].High].Note) to high(Lines[Count].Line[Lines[Count].High].Note) do begin - Lines[Count].Line[Lines[Count].High].TotalNotes := Lines[Count].Line[Lines[Count].High].TotalNotes + Lines[Count].Line[Lines[Count].High].Note[I].Lenght * Lines[Count].Line[Lines[Count].High].Note[I].NoteType; + Lines[Count].Line[Lines[Count].High].TotalNotes := Lines[Count].Line[Lines[Count].High].TotalNotes + Lines[Count].Line[Lines[Count].High].Note[I].Length * Lines[Count].Line[Lines[Count].High].Note[I].NoteType; end; //Total Notes Patch End end; @@ -600,8 +600,8 @@ begin // Start := Note[HighNote].Start; end; - Note[HighNote].Lenght := DurationP; - Melody.NoteLenght := Melody.NoteLenght + Note[HighNote].Lenght; + Note[HighNote].Length := DurationP; + Melody.NoteLength := Melody.NoteLength + Note[HighNote].Length; // back to the normal system with normal, golden and now freestyle notes case TypeP of @@ -610,7 +610,7 @@ begin '*': Note[HighNote].NoteType := 2; end; - Lines[LineNumber].NoteType := Lines[LineNumber].NoteType + Note[HighNote].Lenght * Note[HighNote].NoteType; + Lines[LineNumber].NoteType := Lines[LineNumber].NoteType + Note[HighNote].Length * Note[HighNote].NoteType; Note[HighNote].Tone := NoteP; if Note[HighNote].Tone < Base[LineNumber] then Base[LineNumber] := Note[HighNote].Tone; @@ -622,7 +622,7 @@ begin if TypeP = 'F' then Note[HighNote].FreeStyle := true; - End_ := Note[HighNote].Start + Note[HighNote].Lenght; + End_ := Note[HighNote].Start + Note[HighNote].Length; end; // with end; @@ -639,7 +639,7 @@ begin Lines[LineNumberP].Line[Lines[LineNumberP].High].TotalNotes := 0; for I := low(Lines[LineNumberP].Line[Lines[LineNumberP].High].Note) to high(Lines[LineNumberP].Line[Lines[LineNumberP].High].Note) do begin - Lines[LineNumberP].Line[Lines[LineNumberP].High].TotalNotes := Lines[LineNumberP].Line[Lines[LineNumberP].High].TotalNotes + Lines[LineNumberP].Line[Lines[LineNumberP].High].Note[I].Lenght * Lines[LineNumberP].Line[Lines[LineNumberP].High].Note[I].NoteType; + Lines[LineNumberP].Line[Lines[LineNumberP].High].TotalNotes := Lines[LineNumberP].Line[Lines[LineNumberP].High].TotalNotes + Lines[LineNumberP].Line[Lines[LineNumberP].High].Note[I].Length * Lines[LineNumberP].Line[Lines[LineNumberP].High].Note[I].NoteType; end; //Total Notes Patch End diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index ed99e63e..6eb79d1c 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -341,7 +341,7 @@ begin // dopisuje Lines.Line[C].Note[N].Start := Note[Nu].Start; - Lines.Line[C].Note[N].Lenght := Note[Nu].Len; + Lines.Line[C].Note[N].Length := Note[Nu].Len; Lines.Line[C].Note[N].Tone := Note[Nu].Tone; Lines.Line[C].Note[N].Text := Note[Nu].Lyric; //All Notes are Freestyle when Converted Fix: diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index b9b76db6..33acd8fb 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -134,7 +134,7 @@ begin SDLK_BACKQUOTE: begin // Increase Note Length (same as Alt + Right) - Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght); + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Inc(Lines[0].Line[Lines[0].Current].End_); end; @@ -367,7 +367,7 @@ begin AudioPlayback.Position := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); PlayStopTime := (GetTimeFromBeat( Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght)); + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length)); AudioPlayback.Play; LastClick := -100; end; @@ -407,8 +407,8 @@ begin // ctrl + right if SDL_ModState = KMOD_LCTRL then begin - if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght > 1 then begin - Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght); + if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin + Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); if CurrentNote = 0 then begin Inc(Lines[0].Line[Lines[0].Current].Start); @@ -430,7 +430,7 @@ begin // alt + right if SDL_ModState = KMOD_LALT then begin - Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght); + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Inc(Lines[0].Line[Lines[0].Current].End_); end; @@ -456,7 +456,7 @@ begin // ctrl + left if SDL_ModState = KMOD_LCTRL then begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); - Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght); + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = 0 then begin Dec(Lines[0].Line[Lines[0].Current].Start); Dec(Lines[0].Line[Lines[0].Current].StartNote); @@ -480,8 +480,8 @@ begin // alt + left if SDL_ModState = KMOD_LALT then begin - if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght > 1 then begin - Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght); + if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin + Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Dec(Lines[0].Line[Lines[0].Current].End_); end; @@ -664,7 +664,7 @@ begin Lines[0].Line[C].End_ := Lines[0].Line[C].End_ div 2; for N := 0 to Lines[0].Line[C].HighNote do begin Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start div 2; - Lines[0].Line[C].Note[N].Lenght := Round(Lines[0].Line[C].Note[N].Lenght / 2); + Lines[0].Line[C].Note[N].Length := Round(Lines[0].Line[C].Note[N].Length / 2); end; // N end; // C end; @@ -681,7 +681,7 @@ begin Lines[0].Line[C].End_ := Lines[0].Line[C].End_ * 2; for N := 0 to Lines[0].Line[C].HighNote do begin Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start * 2; - Lines[0].Line[C].Note[N].Lenght := Lines[0].Line[C].Note[N].Lenght * 2; + Lines[0].Line[C].Note[N].Length := Lines[0].Line[C].Note[N].Length * 2; end; // N end; // C end; @@ -757,7 +757,7 @@ var begin for C := 1 to Lines[0].High do begin with Lines[0].Line[C-1] do begin - Min := Note[HighNote].Start + Note[HighNote].Lenght; + Min := Note[HighNote].Start + Note[HighNote].Length; Max := Lines[0].Line[C].StartNote; case (Max - Min) of 0: S := Max; @@ -822,14 +822,14 @@ begin Inc(Lines[0].Line[CNew].IlNut); Inc(Lines[0].Line[CNew].HighNote); Lines[0].Line[CNew].End_ := Lines[0].Line[CNew].Note[NNewL].Start + - Lines[0].Line[CNew].Note[NNewL].Lenght; + Lines[0].Line[CNew].Note[NNewL].Length; end; // clear old notes and set sentence counters Lines[0].Line[CStart].HighNote := NStart - 1; Lines[0].Line[CStart].IlNut := Lines[0].Line[CStart].HighNote + 1; Lines[0].Line[CStart].End_ := Lines[0].Line[CStart].Note[NStart-1].Start + - Lines[0].Line[CStart].Note[NStart-1].Lenght; + Lines[0].Line[CStart].Note[NStart-1].Length; SetLength(Lines[0].Line[CStart].Note, Lines[0].Line[CStart].IlNut); // 0.5.0: modify BaseNote @@ -869,7 +869,7 @@ begin // increase sentence counters NDst := Lines[0].Line[C].HighNote; Lines[0].Line[C].End_ := Lines[0].Line[C].Note[NDst].Start + - Lines[0].Line[C].Note[NDst].Lenght; + Lines[0].Line[C].Note[NDst].Length; // move needed sentences to one backward. for C := Lines[0].Current + 1 to Lines[0].High - 1 do @@ -900,9 +900,9 @@ begin end; // me slightly modify new note - Lines[0].Line[C].Note[CurrentNote].Lenght := 1; + Lines[0].Line[C].Note[CurrentNote].Length := 1; Inc(Lines[0].Line[C].Note[CurrentNote+1].Start); - Dec(Lines[0].Line[C].Note[CurrentNote+1].Lenght); + Dec(Lines[0].Line[C].Note[CurrentNote+1].Length); Lines[0].Line[C].Note[CurrentNote+1].Text := '- '; Lines[0].Line[C].Note[CurrentNote+1].Color := 0; end; @@ -1060,12 +1060,12 @@ begin Lines[0].Line[Dst].HighNote := Lines[0].Line[Src].HighNote; for N := 0 to Lines[0].Line[Src].HighNote do begin Lines[0].Line[Dst].Note[N].Text := Lines[0].Line[Src].Note[N].Text; - Lines[0].Line[Dst].Note[N].Lenght := Lines[0].Line[Src].Note[N].Lenght; + Lines[0].Line[Dst].Note[N].Length := Lines[0].Line[Src].Note[N].Length; Lines[0].Line[Dst].Note[N].Tone := Lines[0].Line[Src].Note[N].Tone; Lines[0].Line[Dst].Note[N].Start := Lines[0].Line[Src].Note[N].Start + TD; end; N := Lines[0].Line[Src].HighNote; - Lines[0].Line[Dst].End_ := Lines[0].Line[Dst].Note[N].Start + Lines[0].Line[Dst].Note[N].Lenght; + Lines[0].Line[Dst].End_ := Lines[0].Line[Dst].Note[N].Start + Lines[0].Line[Dst].Note[N].Length; end; procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer); @@ -1091,7 +1091,7 @@ begin Lines[0].Line[Dst + C].IlNut := 1; Lines[0].Line[Dst + C].HighNote := 0; Lines[0].Line[Dst + C].Note[0].Start := Lines[0].Line[Dst + C].Start; - Lines[0].Line[Dst + C].Note[0].Lenght := 1; + Lines[0].Line[Dst + C].Note[0].Length := 1; Lines[0].Line[Dst + C].StartNote := Lines[0].Line[Dst + C].Start; Lines[0].Line[Dst + C].End_ := Lines[0].Line[Dst + C].Start + 1; end; @@ -1303,7 +1303,7 @@ begin begin // Note info Text[TextNStart].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); - Text[TextNDlugosc].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Lenght); + Text[TextNDlugosc].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); Text[TextNTon].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' ( ' + GetNoteName(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' )'; Text[TextNText].Text := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text; end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 5c7916e4..23e9cb1e 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -223,7 +223,10 @@ begin LineState.CurrentTime := PauseTime; //Position of Notes // Position of Music + // FIXME: remove this and provide LineState.CurrentTime as sync-source instead + // so every stream can synch itself AudioPlayback.Position := PauseTime; + // Play Music AudioPlayback.Play; @@ -544,26 +547,32 @@ begin Lyrics.LineColor_act.B := 210/256; Lyrics.LineColor_act.A := 1; -{ LyricSub.FontStyle := 0; + { + LyricSub.FontStyle := 0; LyricMain.Size := 14; // 13 LyricSub.Size := 14; // 13 LyricMain.ColR := Skin_FontR; LyricMain.ColG := Skin_FontG; LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; + } + { + LyricMain.ColSR := Skin_FontHighlightR; LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}{ + LyricMain.ColSB := Skin_FontHighlightB; + }{ LyricMain.ColSR := 5/255; //26 LyricMain.ColSG := 163/255; //165 LyricMain.ColSB := 210/255; //220 LyricSub.ColR := 0.4; //0.6 LyricSub.ColG := 0.4; //0.6 - LyricSub.ColB := 0.4; //0.6 } + LyricSub.ColB := 0.4; //0.6 + } end; 1: begin - { LyricMain.FontStyle := 2; + { + LyricMain.FontStyle := 2; LyricSub.FontStyle := 2; LyricMain.Size := 14; LyricSub.Size := 14; @@ -575,7 +584,8 @@ begin LyricMain.ColSB := 1; LyricSub.ColR := 0.8; LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; } + LyricSub.ColB := 0.8; + } Lyrics.UpperLineSize := 14; Lyrics.LowerLineSize := 14; @@ -616,7 +626,8 @@ begin Lyrics.LineColor_act.G := 0.5; Lyrics.LineColor_act.B := 1; Lyrics.LineColor_act.A := 1; -{ LyricSub.FontStyle := 3; + { + LyricSub.FontStyle := 3; LyricMain.Size := 12; LyricSub.Size := 12; LyricMain.ColR := 0.75; @@ -627,7 +638,8 @@ begin LyricMain.ColSB := 1; LyricSub.ColR := 0.8; LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8;} + LyricSub.ColB := 0.8; + } end; end; // case diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index c2b1be79..e22934cf 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -156,7 +156,7 @@ begin begin Result.Sentence[I].Note[J].Color := Lines.Line[I].Note[J].Color; Result.Sentence[I].Note[J].Start := Lines.Line[I].Note[J].Start; - Result.Sentence[I].Note[J].Length := Lines.Line[I].Note[J].Lenght; + Result.Sentence[I].Note[J].Length := Lines.Line[I].Note[J].Length; Result.Sentence[I].Note[J].Tone := Lines.Line[I].Note[J].Tone; Result.Sentence[I].Note[J].ToneGamus := Lines.Line[I].Note[J].ToneGamus; //Result.Sentence[I].Note[J].Text := Lines.Line[I].Note[J].Tekst; |