aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2011-04-10 12:45:15 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2011-04-10 12:45:15 +0000
commitc274cd75771c36e0e06f6cf14641ee89e69b43c1 (patch)
tree67361c41159027a1989aa95447f2d5cfda6f892f
parent4533ca31e118fe10f5b366a0ad449fb96b47dcc1 (diff)
downloadusdx-c274cd75771c36e0e06f6cf14641ee89e69b43c1.tar.gz
usdx-c274cd75771c36e0e06f6cf14641ee89e69b43c1.tar.xz
usdx-c274cd75771c36e0e06f6cf14641ee89e69b43c1.zip
using international note notation with C4 = 0 (internal)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2817 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Classes/URecord.pas28
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas45
2 files changed, 25 insertions, 48 deletions
diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas
index 10d1cbc6..d18b509d 100644
--- a/Game/Code/Classes/URecord.pas
+++ b/Game/Code/Classes/URecord.pas
@@ -55,6 +55,8 @@ type
// procedures - bass record
function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall;
+ function GetNoteName(Note: integer): string;
+
var
Sound: array of TSound;
@@ -68,14 +70,34 @@ const
'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'
);
+ NumHalftones = 47;
+
implementation
uses UMain, ULog;
+function GetNoteName(Note: integer): string;
+var
+ N1, N2: Integer;
+
+begin
+ if (Note >= 0) then
+ begin
+ N1 := Note mod 12;
+ N2 := Note div 12 + 4;
+ end else
+ begin
+ N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12;
+ N2 := (Note + 1) div 12 + 3;
+ end;
+
+ Result := ToneStrings[N1] + IntToStr(N2);
+end;
+
// from usdx 1.1
function TSound.GetToneString: string;
begin
if (SzczytJest) then
- Result := ToneStrings[TonGamy] + IntToStr(Ton div 12 + 2)
+ Result := GetNoteName(Ton)
else
Result := '-';
end;
@@ -117,7 +139,7 @@ procedure TSound.AnalizujByAutocorrelation;
var
T: integer; // tone
F: real; // freq
- Wages: array[0..35] of real; // wages
+ Wages: array[0..NumHalftones] of real; // wages
MaxT: integer; // max tone
MaxW: real; // max wage
V: real; // volume
@@ -147,7 +169,7 @@ begin
MaxT := 0;
// analyze all 12 halftones
- for T := 0 to 35 do begin // to 11, then 23, now 35 (for Whitney and my high voice)
+ for T := 0 to NumHalftones do begin // to 11, then 23, now 35 (for Whitney and my high voice)
F := 130.81*Power(1.05946309436, T)/2; // let's analyze below 130.81
Wages[T] := AnalyzeAutocorrelationFreq(F);
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas
index 6389edfb..8ff9d0e7 100644
--- a/Game/Code/Screens/UScreenEditSub.pas
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -122,8 +122,6 @@ type
procedure PasteText;
procedure CopySentence(Src, Dst: integer);
procedure CopySentences(Src, Dst, Num: integer);
- //Note Name Mod
- function GetNoteName(Note: Integer): String;
function GetMedleyLength: real; //returns if availible the length of the medley in seconds, else 0
procedure DrawInfoBar(P, x, y, w, h: integer);
procedure DrawStatics;
@@ -154,7 +152,6 @@ type
const
ID='ID_001'; //for help system
- NumHalftones = 36;
implementation
uses UGraphic, UDisplay, UDraw, UMain, USkins, ULanguage;
@@ -3788,48 +3785,6 @@ begin
Music.CaptureStop;
end;
-function TScreenEditSub.GetNoteName(Note: Integer): String;
-var N1, N2: Integer;
-begin
- if (Note > 0) then
- begin
- N1 := Note mod 12;
- N2 := Note div 12;
- end
- else
- begin
- N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12;
- N2 := -1;
- end;
-
-
-
- case N1 of
- 0: Result := 'c';
- 1: Result := 'c#';
- 2: Result := 'd';
- 3: Result := 'd#';
- 4: Result := 'e';
- 5: Result := 'f';
- 6: Result := 'f#';
- 7: Result := 'g';
- 8: Result := 'g#';
- 9: Result := 'a';
- 10: Result := 'a#';
- 11: Result := 'b';
- end;
-
- case N2 of
- 0: Result := UpperCase(Result); //Normal Uppercase Note, 1: Normal lowercase Note
- 2: Result := Result + ''''; //One Striped
- 3: Result := Result + ''''''; //Two Striped
- 4: Result := Result + ''''''''; //etc.
- 5: Result := Result + '''''''''';
- 6: Result := Result + '''''''''''';
- 7: Result := Result + '''''''''''''';
- end;
-end;
-
function TScreenEditSub.GetMedleyLength: real;
begin
if MedleyNotes.isStart and MedleyNotes.isEnd then