1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Sweep unnecessary wxString copies: effects

This commit is contained in:
Paul Licameli 2016-02-22 21:17:19 -05:00
parent 83e8a80f61
commit 99f161c36c
10 changed files with 33 additions and 33 deletions

View File

@ -2022,7 +2022,7 @@ bool Effect::TotalProgress(double frac)
return (updateResult != eProgressSuccess); return (updateResult != eProgressSuccess);
} }
bool Effect::TrackProgress(int whichTrack, double frac, wxString msg) bool Effect::TrackProgress(int whichTrack, double frac, const wxString &msg)
{ {
int updateResult = (mProgress ? int updateResult = (mProgress ?
mProgress->Update(whichTrack + frac, (double) mNumTracks, msg) : mProgress->Update(whichTrack + frac, (double) mNumTracks, msg) :
@ -2030,7 +2030,7 @@ bool Effect::TrackProgress(int whichTrack, double frac, wxString msg)
return (updateResult != eProgressSuccess); return (updateResult != eProgressSuccess);
} }
bool Effect::TrackGroupProgress(int whichGroup, double frac, wxString msg) bool Effect::TrackGroupProgress(int whichGroup, double frac, const wxString &msg)
{ {
int updateResult = (mProgress ? int updateResult = (mProgress ?
mProgress->Update(whichGroup + frac, (double) mNumGroups, msg) : mProgress->Update(whichGroup + frac, (double) mNumGroups, msg) :

View File

@ -309,11 +309,11 @@ protected:
// Pass a fraction between 0.0 and 1.0, for the current track // Pass a fraction between 0.0 and 1.0, for the current track
// (when doing one track at a time) // (when doing one track at a time)
bool TrackProgress(int whichTrack, double frac, wxString = wxT("")); bool TrackProgress(int whichTrack, double frac, const wxString & = wxEmptyString);
// Pass a fraction between 0.0 and 1.0, for the current track group // Pass a fraction between 0.0 and 1.0, for the current track group
// (when doing stereo groups at a time) // (when doing stereo groups at a time)
bool TrackGroupProgress(int whichGroup, double frac, wxString = wxT("")); bool TrackGroupProgress(int whichGroup, double frac, const wxString & = wxEmptyString);
int GetNumWaveTracks() { return mNumTracks; } int GetNumWaveTracks() { return mNumTracks; }

View File

@ -1362,7 +1362,7 @@ void EffectEqualization::Filter(sampleCount len, float *buffer)
// //
// Load external curves with fallback to default, then message // Load external curves with fallback to default, then message
// //
void EffectEqualization::LoadCurves(wxString fileName, bool append) void EffectEqualization::LoadCurves(const wxString &fileName, bool append)
{ {
// Construct normal curve filename // Construct normal curve filename
// //
@ -1460,7 +1460,7 @@ void EffectEqualization::LoadCurves(wxString fileName, bool append)
// //
// Save curves to external file // Save curves to external file
// //
void EffectEqualization::SaveCurves(wxString fileName) void EffectEqualization::SaveCurves(const wxString &fileName)
{ {
wxFileName fn; wxFileName fn;
if( fileName == wxT("")) if( fileName == wxT(""))
@ -1601,7 +1601,7 @@ void EffectEqualization::setCurve()
setCurve((int) mCurves.GetCount()-1); setCurve((int) mCurves.GetCount()-1);
} }
void EffectEqualization::setCurve(wxString curveName) void EffectEqualization::setCurve(const wxString &curveName)
{ {
unsigned i = 0; unsigned i = 0;
for( i = 0; i < mCurves.GetCount(); i++ ) for( i = 0; i < mCurves.GetCount(); i++ )
@ -3456,7 +3456,7 @@ void EditCurvesDialog::OnOK(wxCommandEvent & WXUNUSED(event))
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
SliderAx::SliderAx( wxWindow * window, wxString fmt ): SliderAx::SliderAx(wxWindow * window, const wxString &fmt) :
wxWindowAccessible( window ) wxWindowAccessible( window )
{ {
mParent = window; mParent = window;

View File

@ -141,11 +141,11 @@ private:
void EnvelopeUpdated(Envelope *env, bool lin); void EnvelopeUpdated(Envelope *env, bool lin);
bool IsLinear(); bool IsLinear();
void LoadCurves(wxString fileName = wxT(""), bool append = false); void LoadCurves(const wxString &fileName = wxEmptyString, bool append = false);
void SaveCurves(wxString fileName = wxT("")); void SaveCurves(const wxString &fileName = wxEmptyString);
void Select(int sel); void Select(int sel);
void setCurve(int currentCurve); void setCurve(int currentCurve);
void setCurve(wxString curveName); void setCurve(const wxString &curveName);
void setCurve(void); void setCurve(void);
// XMLTagHandler callback methods for loading and saving // XMLTagHandler callback methods for loading and saving
@ -367,7 +367,7 @@ private:
class SliderAx: public wxWindowAccessible class SliderAx: public wxWindowAccessible
{ {
public: public:
SliderAx(wxWindow * window, wxString fmt); SliderAx(wxWindow * window, const wxString &fmt);
virtual ~ SliderAx(); virtual ~ SliderAx();

View File

@ -333,7 +333,7 @@ bool EffectNormalize::TransferDataFromWindow()
// EffectNormalize implementation // EffectNormalize implementation
void EffectNormalize::AnalyseTrack(WaveTrack * track, wxString msg) void EffectNormalize::AnalyseTrack(WaveTrack * track, const wxString &msg)
{ {
if(mGain) { if(mGain) {
// Since we need complete summary data, we need to block until the OD tasks are done for this track // Since we need complete summary data, we need to block until the OD tasks are done for this track
@ -361,7 +361,7 @@ void EffectNormalize::AnalyseTrack(WaveTrack * track, wxString msg)
//AnalyseDC() takes a track, transforms it to bunch of buffer-blocks, //AnalyseDC() takes a track, transforms it to bunch of buffer-blocks,
//and executes AnalyzeData on it... //and executes AnalyzeData on it...
// sets mOffset // sets mOffset
bool EffectNormalize::AnalyseDC(WaveTrack * track, wxString msg) bool EffectNormalize::AnalyseDC(WaveTrack * track, const wxString &msg)
{ {
bool rc = true; bool rc = true;
sampleCount s; sampleCount s;
@ -427,7 +427,7 @@ bool EffectNormalize::AnalyseDC(WaveTrack * track, wxString msg)
//ProcessOne() takes a track, transforms it to bunch of buffer-blocks, //ProcessOne() takes a track, transforms it to bunch of buffer-blocks,
//and executes ProcessData, on it... //and executes ProcessData, on it...
// uses mMult and mOffset to normalize a track. Needs to have them set before being called // uses mMult and mOffset to normalize a track. Needs to have them set before being called
bool EffectNormalize::ProcessOne(WaveTrack * track, wxString msg) bool EffectNormalize::ProcessOne(WaveTrack * track, const wxString &msg)
{ {
bool rc = true; bool rc = true;
sampleCount s; sampleCount s;

View File

@ -56,10 +56,10 @@ public:
private: private:
// EffectNormalize implementation // EffectNormalize implementation
bool ProcessOne(WaveTrack * t, wxString msg); bool ProcessOne(WaveTrack * t, const wxString &msg);
virtual void AnalyseTrack(WaveTrack * track, wxString msg); virtual void AnalyseTrack(WaveTrack * track, const wxString &msg);
virtual void AnalyzeData(float *buffer, sampleCount len); virtual void AnalyzeData(float *buffer, sampleCount len);
bool AnalyseDC(WaveTrack * track, wxString msg); bool AnalyseDC(WaveTrack * track, const wxString &msg);
virtual void ProcessData(float *buffer, sampleCount len); virtual void ProcessData(float *buffer, sampleCount len);
void OnUpdateUI(wxCommandEvent & evt); void OnUpdateUI(wxCommandEvent & evt);

View File

@ -2727,7 +2727,7 @@ wxString VSTEffect::b64encode(const void *in, int len)
return out; return out;
} }
int VSTEffect::b64decode(wxString in, void *out) int VSTEffect::b64decode(const wxString &in, void *out)
{ {
int len = in.length(); int len = in.length();
unsigned char *p = (unsigned char *) out; unsigned char *p = (unsigned char *) out;

View File

@ -175,7 +175,7 @@ private:
// Base64 encoding and decoding // Base64 encoding and decoding
static wxString b64encode(const void *in, int len); static wxString b64encode(const void *in, int len);
static int b64decode(wxString in, void *out); static int b64decode(const wxString &in, void *out);
// Realtime // Realtime
int GetChannelCount(); int GetChannelCount();

View File

@ -114,7 +114,7 @@ BEGIN_EVENT_TABLE(NyquistEffect, wxEvtHandler)
wxEVT_COMMAND_CHOICE_SELECTED, NyquistEffect::OnChoice) wxEVT_COMMAND_CHOICE_SELECTED, NyquistEffect::OnChoice)
END_EVENT_TABLE() END_EVENT_TABLE()
NyquistEffect::NyquistEffect(wxString fName) NyquistEffect::NyquistEffect(const wxString &fName)
{ {
mAction = _("Applying Nyquist Effect..."); mAction = _("Applying Nyquist Effect...");
mInputCmd = wxEmptyString; mInputCmd = wxEmptyString;
@ -1290,7 +1290,7 @@ void NyquistEffect::RedirectOutput()
mRedirectOutput = true; mRedirectOutput = true;
} }
void NyquistEffect::SetCommand(wxString cmd) void NyquistEffect::SetCommand(const wxString &cmd)
{ {
mExternal = true; mExternal = true;
@ -1312,7 +1312,7 @@ void NyquistEffect::Stop()
mStop = true; mStop = true;
} }
wxString NyquistEffect::UnQuote(wxString s) wxString NyquistEffect::UnQuote(const wxString &s)
{ {
wxString out; wxString out;
int len = s.Length(); int len = s.Length();
@ -1324,7 +1324,7 @@ wxString NyquistEffect::UnQuote(wxString s)
return s; return s;
} }
double NyquistEffect::GetCtrlValue(wxString s) double NyquistEffect::GetCtrlValue(const wxString &s)
{ {
/* For this to work correctly requires that the plug-in header is /* For this to work correctly requires that the plug-in header is
* parsed on each run so that the correct value for "half-srate" may * parsed on each run so that the correct value for "half-srate" may
@ -1341,10 +1341,10 @@ double NyquistEffect::GetCtrlValue(wxString s)
} }
*/ */
return Internat::CompatibleToDouble(s);; return Internat::CompatibleToDouble(s);
} }
void NyquistEffect::Parse(wxString line) void NyquistEffect::Parse(const wxString &line)
{ {
wxArrayString tokens; wxArrayString tokens;
@ -2237,7 +2237,7 @@ END_EVENT_TABLE()
NyquistOutputDialog::NyquistOutputDialog(wxWindow * parent, wxWindowID id, NyquistOutputDialog::NyquistOutputDialog(wxWindow * parent, wxWindowID id,
const wxString & title, const wxString & title,
const wxString & prompt, const wxString & prompt,
wxString message) const wxString &message)
: wxDialog(parent, id, title) : wxDialog(parent, id, title)
{ {
SetName(GetTitle()); SetName(GetTitle());

View File

@ -68,7 +68,7 @@ public:
/** @param fName File name of the Nyquist script defining this effect. If /** @param fName File name of the Nyquist script defining this effect. If
* an empty string, then prompt the user for the Nyquist code to interpret. * an empty string, then prompt the user for the Nyquist code to interpret.
*/ */
NyquistEffect(wxString fName); NyquistEffect(const wxString &fName);
virtual ~NyquistEffect(); virtual ~NyquistEffect();
// IdentInterface implementation // IdentInterface implementation
@ -106,7 +106,7 @@ public:
// For Nyquist Workbench support // For Nyquist Workbench support
void RedirectOutput(); void RedirectOutput();
void SetCommand(wxString cmd); void SetCommand(const wxString &cmd);
void Continue(); void Continue();
void Break(); void Break();
void Stop(); void Stop();
@ -152,10 +152,10 @@ private:
void ParseFile(); void ParseFile();
bool ParseCommand(const wxString & cmd); bool ParseCommand(const wxString & cmd);
bool ParseProgram(wxInputStream & stream); bool ParseProgram(wxInputStream & stream);
void Parse(wxString line); void Parse(const wxString &line);
wxString UnQuote(wxString s); wxString UnQuote(const wxString &s);
double GetCtrlValue(wxString s); double GetCtrlValue(const wxString &s);
void OnLoad(wxCommandEvent & evt); void OnLoad(wxCommandEvent & evt);
void OnSave(wxCommandEvent & evt); void OnSave(wxCommandEvent & evt);
@ -248,7 +248,7 @@ public:
NyquistOutputDialog(wxWindow * parent, wxWindowID id, NyquistOutputDialog(wxWindow * parent, wxWindowID id,
const wxString & title, const wxString & title,
const wxString & prompt, const wxString & prompt,
wxString message); const wxString &message);
private: private:
void OnOk(wxCommandEvent & event); void OnOk(wxCommandEvent & event);