[audacity] r12313 committed - Lasse suggested the change to the BUF_SIZE (on http://forum.audacityte...

9 views
Skip to first unread message

auda...@googlecode.com

unread,
May 7, 2013, 6:47:09 PM5/7/13
to audaci...@googlegroups.com
Revision: 12313
Author: martynshaw99
Date: Tue May 7 15:46:58 2013
Log: 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.
http://code.google.com/p/audacity/source/detail?r=12313

Modified:
/audacity-src/trunk/src/effects/AutoDuck.cpp

=======================================
--- /audacity-src/trunk/src/effects/AutoDuck.cpp Wed Aug 1 23:03:19 2012
+++ /audacity-src/trunk/src/effects/AutoDuck.cpp Tue May 7 15:46:58 2013
@@ -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::Process()
{
- int i;
+ sampleCount i;

if (GetNumWaveTracks() == 0 || !mControlTrack)
return false;
@@ -383,11 +383,11 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
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::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::OnLeftUp(wxMouseEvent &evt)
+void EffectAutoDuckPanel::OnLeftUp(wxMouseEvent& WXUNUSED(event))
{
if (mCurrentControlPoint != none)
{
Reply all
Reply to author
Forward
0 new messages