some optimizations for audio recording and pitch detections
This commit is contained in:
1 parent
41933045aa
commit
6b049e4fc4
3 files changed
+41
-8
No files matched your search
@@ -242,6 +242,11 @@ namespace Vocaluxe.Base
|
|||||||
_MidBeatD = -0.5f + GetBeatFromTime(Time, song.BPM, song.Gap + CConfig.MicDelay/1000f);
|
_MidBeatD = -0.5f + GetBeatFromTime(Time, song.BPM, song.Gap + CConfig.MicDelay/1000f);
|
||||||
_CurrentBeatD = (int)Math.Floor(_MidBeatD);
|
_CurrentBeatD = (int)Math.Floor(_MidBeatD);
|
||||||
|
|
||||||
|
for (int p = 0; p < _NumPlayer; p++)
|
||||||
|
{
|
||||||
|
CSound.AnalyzeBuffer(p);
|
||||||
|
}
|
||||||
|
|
||||||
if (_OldBeatD == _CurrentBeatD)
|
if (_OldBeatD == _CurrentBeatD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -298,7 +303,6 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSound.AnalyzeBuffer(p);
|
|
||||||
if (notes[Note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || DEBUG_HIT))
|
if (notes[Note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || DEBUG_HIT))
|
||||||
{
|
{
|
||||||
int Tone = notes[Note].Tone;
|
int Tone = notes[Note].Tone;
|
||||||
|
|||||||
+33
-6
@@ -297,26 +297,53 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public int ToneAbs
|
public int ToneAbs
|
||||||
{
|
{
|
||||||
get { return _ToneAbs; }
|
get
|
||||||
|
{
|
||||||
|
lock (_AnalysisBufferLock)
|
||||||
|
{
|
||||||
|
return _ToneAbs;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Tone
|
public int Tone
|
||||||
{
|
{
|
||||||
get { return _Tone; }
|
get
|
||||||
set { _Tone = value; }
|
{
|
||||||
|
lock (_AnalysisBufferLock)
|
||||||
|
{
|
||||||
|
return _Tone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
lock (_AnalysisBufferLock)
|
||||||
|
{
|
||||||
|
_Tone = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float MaxVolume
|
public float MaxVolume
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (float)_MaxVolume;
|
lock (_AnalysisBufferLock)
|
||||||
|
{
|
||||||
|
return (float)_MaxVolume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ToneValid
|
public bool ToneValid
|
||||||
{
|
{
|
||||||
get { return _ToneValid; }
|
get
|
||||||
|
{
|
||||||
|
lock (_AnalysisBufferLock)
|
||||||
|
{
|
||||||
|
return _ToneValid;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CBuffer()
|
public CBuffer()
|
||||||
@@ -415,7 +442,7 @@ namespace Vocaluxe.Base
|
|||||||
_MaxVolume = Volume;
|
_MaxVolume = Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_MaxVolume >= 0.2f)
|
if (_MaxVolume >= 0.05f)
|
||||||
{
|
{
|
||||||
// analyse the current voice pitch
|
// analyse the current voice pitch
|
||||||
AnalyzeByAutocorrelation();
|
AnalyzeByAutocorrelation();
|
||||||
|
|||||||
@@ -400,7 +400,9 @@ namespace Vocaluxe.Menu.SingNotes
|
|||||||
|
|
||||||
if (note.EndBeat >= CGame.ActBeatD && note.Hit && note.NoteType == ENoteType.Golden)
|
if (note.EndBeat >= CGame.ActBeatD && note.Hit && note.NoteType == ENoteType.Golden)
|
||||||
{
|
{
|
||||||
AddFlare(rect, n);
|
SRectF re = new SRectF(rect);
|
||||||
|
re.W = (CGame.MidBeatD - note.StartBeat) / beats * w;
|
||||||
|
AddFlare(re, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.Perfect && note.EndBeat < CGame.ActBeatD)
|
if (note.Perfect && note.EndBeat < CGame.ActBeatD)
|
||||||
|
|||||||
Reference in new issue
Block a user