aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/URecord.pas
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-12-21 17:51:42 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-12-21 17:51:42 +0000
commit3e561cd4fd1eb46590cb70aaf940f7775a855966 (patch)
treea8e390ab9e5ab7103aa488d05dfd272863c6757a /Game/Code/Classes/URecord.pas
parente32e65d0272f98e47dbbb7c5a0a33566d791e5d4 (diff)
downloadusdx-3e561cd4fd1eb46590cb70aaf940f7775a855966.tar.gz
usdx-3e561cd4fd1eb46590cb70aaf940f7775a855966.tar.xz
usdx-3e561cd4fd1eb46590cb70aaf940f7775a855966.zip
added pitch detection for editor
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2765 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/URecord.pas')
-rw-r--r--Game/Code/Classes/URecord.pas18
1 files changed, 17 insertions, 1 deletions
diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas
index 7354d931..57919fe1 100644
--- a/Game/Code/Classes/URecord.pas
+++ b/Game/Code/Classes/URecord.pas
@@ -27,6 +27,7 @@ type
procedure AnalizujBufor; // use to analyze sound from buffers to get new pitch
procedure AnalizujByAutocorrelation; // we call it to analyze sound by checking Autocorrelation
function AnalyzeAutocorrelationFreq(Freq: real): real; // use this to check one frequency by Autocorrelation
+ function GetToneString: string; //from usdx 1.1
end;
TSoundCardInput = record
@@ -61,9 +62,24 @@ var
Poz: integer;
Recording: TRecord;
+const
+ // from usdx 1.1
+ ToneStrings: array[0..11] of string = (
+ 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'
+ );
+
implementation
uses UMain, ULog;
+// from usdx 1.1
+function TSound.GetToneString: string;
+begin
+ if (SzczytJest) then
+ Result := ToneStrings[TonGamy] + IntToStr(Ton div 12 + 2)
+ else
+ Result := '-';
+end;
+
procedure TSound.ProcessNewBuffer;
var
S: integer;
@@ -153,7 +169,7 @@ begin
if MaxV >= Threshold then begin // found acceptable volume // 0.1
SzczytJest := true;
TonGamy := MaxT mod 12;
- Ton := MaxT mod 12;
+ Ton := MaxT;
end;
// Log.LogAnalyze('--> Weight: ')