Lasse suggested the change to the BUF_SIZE (on http://forum.audacityteam.org/viewtopic.php?f=50&t=72371 and Steve passed it on. It improves the speed by an order of magnitude, or more.
Also made some int -> sampleCount changes as they looked dodgy. And removed some compiler messages.
This commit is contained in:
parent
d4989b3a53
commit
19ea4e81d5
|
@ -46,7 +46,7 @@
|
|||
* Common constants
|
||||
*/
|
||||
|
||||
#define BUF_SIZE 4096 // number of samples to process at once
|
||||
#define BUF_SIZE 131072 // number of samples to process at once
|
||||
#define RMS_WINDOW_SIZE 100 // samples in circular RMS window buffer
|
||||
|
||||
/*
|
||||
|
@ -214,7 +214,7 @@ bool EffectAutoDuck::PromptUser()
|
|||
|
||||
bool EffectAutoDuck::Process()
|
||||
{
|
||||
int i;
|
||||
sampleCount i;
|
||||
|
||||
if (GetNumWaveTracks() == 0 || !mControlTrack)
|
||||
return false;
|
||||
|
@ -383,11 +383,11 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t,
|
|||
{
|
||||
bool cancel = false;
|
||||
|
||||
int start = t->TimeToLongSamples(t0);
|
||||
int end = t->TimeToLongSamples(t1);
|
||||
sampleCount start = t->TimeToLongSamples(t0);
|
||||
sampleCount end = t->TimeToLongSamples(t1);
|
||||
|
||||
float *buf = new float[BUF_SIZE];
|
||||
int pos = start;
|
||||
sampleCount pos = start;
|
||||
|
||||
int fadeDownSamples = t->TimeToLongSamples(
|
||||
mOuterFadeDownLen + mInnerFadeDownLen);
|
||||
|
@ -408,9 +408,9 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t,
|
|||
if (len > BUF_SIZE)
|
||||
len = BUF_SIZE;
|
||||
|
||||
t->Get((samplePtr)buf, floatSample, pos, (sampleCount)len);
|
||||
t->Get((samplePtr)buf, floatSample, pos, len);
|
||||
|
||||
for (int i = pos; i < pos + len; i++)
|
||||
for (sampleCount i = pos; i < pos + len; i++)
|
||||
{
|
||||
float gainDown = fadeDownStep * (i - start);
|
||||
float gainUp = fadeUpStep * (end - i);;
|
||||
|
@ -426,7 +426,7 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t,
|
|||
buf[i - pos] *= pow(10.0, gain / 20.0);
|
||||
}
|
||||
|
||||
t->Set((samplePtr)buf, floatSample, pos, (sampleCount)len);
|
||||
t->Set((samplePtr)buf, floatSample, pos, len);
|
||||
|
||||
pos += len;
|
||||
|
||||
|
@ -563,7 +563,7 @@ EffectAutoDuckDialog::EffectAutoDuckDialog(EffectAutoDuck* effect,
|
|||
Center();
|
||||
}
|
||||
|
||||
void EffectAutoDuckDialog::OnOk(wxCommandEvent& evt)
|
||||
void EffectAutoDuckDialog::OnOk(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
double duckAmountDb = 0, thresholdDb = 0;
|
||||
double innerFadeDownLen = 0, innerFadeUpLen = 0;
|
||||
|
@ -611,12 +611,12 @@ void EffectAutoDuckDialog::OnOk(wxCommandEvent& evt)
|
|||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
void EffectAutoDuckDialog::OnCancel(wxCommandEvent& evt)
|
||||
void EffectAutoDuckDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
|
||||
void EffectAutoDuckDialog::OnValueChanged(wxCommandEvent& evt)
|
||||
void EffectAutoDuckDialog::OnValueChanged(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
mPanel->Refresh(false);
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ void EffectAutoDuckPanel::ResetControlPoints()
|
|||
mControlPoints[duckAmount] = wxPoint(-100,-100);
|
||||
}
|
||||
|
||||
void EffectAutoDuckPanel::OnPaint(wxPaintEvent& evt)
|
||||
void EffectAutoDuckPanel::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
int clientWidth, clientHeight;
|
||||
GetSize(&clientWidth, &clientHeight);
|
||||
|
@ -853,14 +853,14 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent& evt)
|
|||
}
|
||||
|
||||
void EffectAutoDuckPanel::OnMouseCaptureChanged(
|
||||
wxMouseCaptureChangedEvent &evt)
|
||||
wxMouseCaptureChangedEvent& WXUNUSED(event))
|
||||
{
|
||||
SetCursor(wxNullCursor);
|
||||
mCurrentControlPoint = none;
|
||||
}
|
||||
|
||||
void EffectAutoDuckPanel::OnMouseCaptureLost(
|
||||
wxMouseCaptureLostEvent &evt)
|
||||
wxMouseCaptureLostEvent& WXUNUSED(event))
|
||||
{
|
||||
mCurrentControlPoint = none;
|
||||
|
||||
|
@ -909,7 +909,7 @@ void EffectAutoDuckPanel::OnLeftDown(wxMouseEvent &evt)
|
|||
}
|
||||
}
|
||||
|
||||
void EffectAutoDuckPanel::OnLeftUp(wxMouseEvent &evt)
|
||||
void EffectAutoDuckPanel::OnLeftUp(wxMouseEvent& WXUNUSED(event))
|
||||
{
|
||||
if (mCurrentControlPoint != none)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user