mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-05 11:13:16 +01:00
EXPERIMENTAL_VOICE_DETECTION: compile, use const, more careful casts
This commit is contained in:
@@ -85,7 +85,8 @@ VoiceKey::~VoiceKey()
|
||||
|
||||
|
||||
//Move forward to find an ON region.
|
||||
sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount len)
|
||||
sampleCount VoiceKey::OnForward (
|
||||
const WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
if((mWindowSize) >= (len + 10).as_double() ){
|
||||
@@ -236,7 +237,8 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
|
||||
}
|
||||
|
||||
//Move backward from end to find an ON region.
|
||||
sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount len)
|
||||
sampleCount VoiceKey::OnBackward (
|
||||
const WaveTrack & t, sampleCount end, sampleCount len)
|
||||
{
|
||||
|
||||
|
||||
@@ -374,7 +376,8 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
|
||||
|
||||
|
||||
//Move froward from the start to find an OFF region.
|
||||
sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount len)
|
||||
sampleCount VoiceKey::OffForward (
|
||||
const WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
if((mWindowSize) >= (len + 10).as_double() ){
|
||||
@@ -509,7 +512,8 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
|
||||
|
||||
|
||||
//Move backward from the end to find an OFF region
|
||||
sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount len)
|
||||
sampleCount VoiceKey::OffBackward (
|
||||
const WaveTrack & t, sampleCount end, sampleCount len)
|
||||
{
|
||||
|
||||
|
||||
@@ -648,7 +652,8 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
|
||||
}
|
||||
|
||||
//This tests whether a specified block region is above or below threshold.
|
||||
bool VoiceKey::AboveThreshold(WaveTrack & t, sampleCount start, sampleCount len)
|
||||
bool VoiceKey::AboveThreshold(
|
||||
const WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
double erg=0;
|
||||
@@ -729,7 +734,7 @@ void VoiceKey::AdjustThreshold(double t)
|
||||
|
||||
|
||||
//This 'calibrates' the voicekey to noise
|
||||
void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len)
|
||||
void VoiceKey::CalibrateNoise(const WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
//To calibrate the noise, we need to scan the sample block just like in the voicekey and
|
||||
//calculate the mean and standard deviation of the test statistics.
|
||||
@@ -835,7 +840,8 @@ void VoiceKey::SetKeyType(bool erg, bool scLow , bool scHigh,
|
||||
|
||||
|
||||
//This might continue over a number of blocks.
|
||||
double VoiceKey::TestEnergy (WaveTrack & t, sampleCount start, sampleCount len)
|
||||
double VoiceKey::TestEnergy (
|
||||
const WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
double sum = 1;
|
||||
@@ -876,7 +882,8 @@ void VoiceKey::TestEnergyUpdate (double & prevErg, int len, const float & drop,
|
||||
}
|
||||
|
||||
|
||||
double VoiceKey::TestSignChanges(WaveTrack & t, sampleCount start, sampleCount len)
|
||||
double VoiceKey::TestSignChanges(
|
||||
const WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
|
||||
@@ -932,7 +939,8 @@ void VoiceKey::TestSignChangesUpdate(double & currentsignchanges, int len,
|
||||
}
|
||||
|
||||
|
||||
double VoiceKey::TestDirectionChanges(WaveTrack & t, sampleCount start, sampleCount len)
|
||||
double VoiceKey::TestDirectionChanges(
|
||||
const WaveTrack & t, sampleCount start, sampleCount len)
|
||||
{
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user