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

Merge pull request #36 from DanWin/performance

Performance improvements
This commit is contained in:
Leland Lucius 2015-04-24 07:52:38 -05:00
commit ed79e13fbf
37 changed files with 132 additions and 141 deletions

View File

@ -117,6 +117,7 @@ void AboutDialog::CreateCreditsList()
AddCredit(wxT("Philip Van Baren"), roleContributor); AddCredit(wxT("Philip Van Baren"), roleContributor);
AddCredit(wxT("Salvo Ventura"), roleContributor); AddCredit(wxT("Salvo Ventura"), roleContributor);
AddCredit(wxT("Jun Wan"), roleContributor); AddCredit(wxT("Jun Wan"), roleContributor);
AddCredit(wxT("Daniel Winzen"), roleContributor);
AddCredit(wxT("Tom Woodhams"), roleContributor); AddCredit(wxT("Tom Woodhams"), roleContributor);
AddCredit(wxT("Wing Yu"), roleContributor); AddCredit(wxT("Wing Yu"), roleContributor);

View File

@ -2283,7 +2283,7 @@ void AudioIO::StopStream()
} }
if( appendRecord ) if( appendRecord )
{ // append-recording { // append-recording
bool bResult = true; bool bResult;
if (recordingOffset < 0) if (recordingOffset < 0)
bResult = track->Clear(mT0, mT0 - recordingOffset); // cut the latency out bResult = track->Clear(mT0, mT0 - recordingOffset); // cut the latency out
else else
@ -4115,7 +4115,6 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
bool selected = false; bool selected = false;
int group = 0; int group = 0;
int chanCnt = 0; int chanCnt = 0;
float rate = 0.0;
int maxLen = 0; int maxLen = 0;
for (t = 0; t < numPlaybackTracks; t++) for (t = 0; t < numPlaybackTracks; t++)
{ {
@ -4136,7 +4135,6 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
if (vt->GetMute() && !vt->GetSolo()) if (vt->GetMute() && !vt->GetSolo())
cut = true; cut = true;
rate = vt->GetRate();
linkFlag = vt->GetLinked(); linkFlag = vt->GetLinked();
selected = vt->GetSelected(); selected = vt->GetSelected();

View File

@ -427,7 +427,7 @@ wxString BatchCommands::BuildCleanFileName(wxString fileName, wxString extension
return cleanedName; return cleanedName;
} }
bool BatchCommands::WriteMp3File( const wxString Name, int bitrate ) bool BatchCommands::WriteMp3File( const wxString & Name, int bitrate )
{ //check if current project is mono or stereo { //check if current project is mono or stereo
int numChannels = 2; int numChannels = 2;
if (IsMono()) { if (IsMono()) {
@ -471,7 +471,7 @@ bool BatchCommands::WriteMp3File( const wxString Name, int bitrate )
// and think again. // and think again.
// ======= IMPORTANT ======== // ======= IMPORTANT ========
// CLEANSPEECH remnant // CLEANSPEECH remnant
bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString command,const wxString params) bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString & command,const wxString & params)
{ {
if (ReportAndSkip(command, params)) if (ReportAndSkip(command, params))
return true; return true;
@ -555,7 +555,7 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString c
} }
// end CLEANSPEECH remnant // end CLEANSPEECH remnant
bool BatchCommands::SetCurrentParametersFor(const wxString command, const wxString params) bool BatchCommands::SetCurrentParametersFor(const wxString & command, const wxString & params)
{ {
// transfer the parameters to the effect... // transfer the parameters to the effect...
if( !params.IsEmpty() ) if( !params.IsEmpty() )
@ -576,7 +576,7 @@ bool BatchCommands::SetCurrentParametersFor(const wxString command, const wxStri
return true; return true;
} }
bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString command, const wxString params) bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params)
{ {
//Possibly end processing here, if in batch-debug //Possibly end processing here, if in batch-debug
if( ReportAndSkip(command, params)) if( ReportAndSkip(command, params))
@ -597,7 +597,7 @@ bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString comma
AudacityProject::OnEffectFlags::kSkipState); AudacityProject::OnEffectFlags::kSkipState);
} }
bool BatchCommands::ApplyCommand(const wxString command, const wxString params) bool BatchCommands::ApplyCommand(const wxString & command, const wxString & params)
{ {
unsigned int i; unsigned int i;
@ -729,7 +729,7 @@ void BatchCommands::ResetChain()
// ReportAndSkip() is a diagnostic function that avoids actually // ReportAndSkip() is a diagnostic function that avoids actually
// applying the requested effect if in batch-debug mode. // applying the requested effect if in batch-debug mode.
bool BatchCommands::ReportAndSkip(const wxString command, const wxString params) bool BatchCommands::ReportAndSkip(const wxString & command, const wxString & params)
{ {
int bDebug; int bDebug;
gPrefs->Read(wxT("/Batch/Debug"), &bDebug, false); gPrefs->Read(wxT("/Batch/Debug"), &bDebug, false);

View File

@ -25,16 +25,16 @@ class BatchCommands {
BatchCommands(); BatchCommands();
public: public:
bool ApplyChain(const wxString & filename = wxT("")); bool ApplyChain(const wxString & filename = wxT(""));
bool ApplyCommand( const wxString command, const wxString params ); bool ApplyCommand( const wxString & command, const wxString & params );
bool ApplyCommandInBatchMode(const wxString & command, const wxString &params); bool ApplyCommandInBatchMode(const wxString & command, const wxString &params);
bool ApplySpecialCommand(int iCommand, const wxString command,const wxString params); bool ApplySpecialCommand(int iCommand, const wxString & command,const wxString & params);
bool ApplyEffectCommand(const PluginID & ID, const wxString command, const wxString params); bool ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params);
bool ReportAndSkip( const wxString command, const wxString params ); bool ReportAndSkip( const wxString & command, const wxString & params );
void AbortBatch(); void AbortBatch();
// Utility functions for the special commands. // Utility functions for the special commands.
wxString BuildCleanFileName(wxString fileName, wxString extension); wxString BuildCleanFileName(wxString fileName, wxString extension);
bool WriteMp3File( const wxString Name, int bitrate ); bool WriteMp3File( const wxString & Name, int bitrate );
double GetEndTime(); double GetEndTime();
bool IsMono(); bool IsMono();
@ -42,7 +42,7 @@ class BatchCommands {
wxArrayString GetNames(); wxArrayString GetNames();
static bool PromptForParamsFor( wxString command, wxWindow *parent ); static bool PromptForParamsFor( wxString command, wxWindow *parent );
static wxString GetCurrentParamsFor( wxString command ); static wxString GetCurrentParamsFor( wxString command );
static bool SetCurrentParametersFor(const wxString command, const wxString params); static bool SetCurrentParametersFor(const wxString & command, const wxString & params);
static wxArrayString GetAllCommands(); static wxArrayString GetAllCommands();
// These commands do depend on the command list. // These commands do depend on the command list.

View File

@ -463,7 +463,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
progress->Update(count, total); progress->Update(count, total);
iter++; ++iter;
count++; count++;
} }
@ -485,7 +485,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
if (count>=0) if (count>=0)
progress->Update(count, total); progress->Update(count, total);
iter++; ++iter;
count--; count--;
} }
@ -1271,7 +1271,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName)
db->LockRead(); db->LockRead();
} }
iter++; ++iter;
} }
if (needToRename) { if (needToRename) {
@ -1297,7 +1297,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName)
if (!b->IsDataAvailable() && (db->GetEncodedAudioFilename() == fName)) if (!b->IsDataAvailable() && (db->GetEncodedAudioFilename() == fName))
db->UnlockRead(); db->UnlockRead();
iter++; ++iter;
} }
// Print error message and cancel the export // Print error message and cancel the export
@ -1327,7 +1327,7 @@ bool DirManager::EnsureSafeFilename(wxFileName fName)
db->ChangeAudioFile(renamedFileName); db->ChangeAudioFile(renamedFileName);
db->UnlockRead(); db->UnlockRead();
} }
iter++; ++iter;
} }
} }
@ -1474,7 +1474,7 @@ _("Project check of \"%s\" folder \
b->Recover(); b->Recover();
nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP; nResult = FSCKstatus_CHANGED | FSCKstatus_SAVE_AUP;
} }
iter++; ++iter;
} }
if ((action == 2) && bAutoRecoverMode) if ((action == 2) && bAutoRecoverMode)
wxLogWarning(_(" Project check replaced missing aliased file(s) with silence.")); wxLogWarning(_(" Project check replaced missing aliased file(s) with silence."));
@ -1527,7 +1527,7 @@ _("Project check of \"%s\" folder \
// Silence error logging for this block in this session. // Silence error logging for this block in this session.
b->SilenceLog(); b->SilenceLog();
} }
iter++; ++iter;
} }
if ((action == 0) && bAutoRecoverMode) if ((action == 0) && bAutoRecoverMode)
wxLogWarning(_(" Project check regenerated missing alias summary file(s).")); wxLogWarning(_(" Project check regenerated missing alias summary file(s)."));
@ -1585,7 +1585,7 @@ _("Project check of \"%s\" folder \
} }
else if (action == 1) else if (action == 1)
b->SilenceLog(); b->SilenceLog();
iter++; ++iter;
} }
if ((action == 2) && bAutoRecoverMode) if ((action == 2) && bAutoRecoverMode)
wxLogWarning(_(" Project check replaced missing audio data block file(s) with silence.")); wxLogWarning(_(" Project check replaced missing audio data block file(s) with silence."));
@ -1701,14 +1701,14 @@ void DirManager::FindMissingAliasedFiles(
missingAliasedFilePathHash[aliasedFileFullPath] = NULL; missingAliasedFilePathHash[aliasedFileFullPath] = NULL;
} }
} }
iter++; ++iter;
} }
iter = missingAliasedFilePathHash.begin(); iter = missingAliasedFilePathHash.begin();
while (iter != missingAliasedFilePathHash.end()) while (iter != missingAliasedFilePathHash.end())
{ {
wxLogWarning(_("Missing aliased audio file: '%s'"), iter->first.c_str()); wxLogWarning(_("Missing aliased audio file: '%s'"), iter->first.c_str());
iter++; ++iter;
} }
} }
@ -1734,7 +1734,7 @@ void DirManager::FindMissingAUFs(
fileName.GetFullPath().c_str()); fileName.GetFullPath().c_str());
} }
} }
iter++; ++iter;
} }
} }
@ -1758,7 +1758,7 @@ void DirManager::FindMissingAUs(
fileName.GetFullPath().c_str()); fileName.GetFullPath().c_str());
} }
} }
iter++; ++iter;
} }
} }
@ -1847,7 +1847,7 @@ void DirManager::FillBlockfilesCache()
BlockFile *b = iter->second; BlockFile *b = iter->second;
if (b->GetNeedFillCache()) if (b->GetNeedFillCache())
numNeed++; numNeed++;
iter++; ++iter;
} }
if (numNeed == 0) if (numNeed == 0)
@ -1867,7 +1867,7 @@ void DirManager::FillBlockfilesCache()
if (!progress.Update(current, numNeed)) if (!progress.Update(current, numNeed))
break; // user cancelled progress dialog, stop caching break; // user cancelled progress dialog, stop caching
iter++; ++iter;
current++; current++;
} }
#endif // DEPRECATED_AUDIO_CACHE #endif // DEPRECATED_AUDIO_CACHE
@ -1884,7 +1884,7 @@ void DirManager::WriteCacheToDisk()
BlockFile *b = iter->second; BlockFile *b = iter->second;
if (b->GetNeedWriteCacheToDisk()) if (b->GetNeedWriteCacheToDisk())
numNeed++; numNeed++;
iter++; ++iter;
} }
if (numNeed == 0) if (numNeed == 0)
@ -1903,7 +1903,7 @@ void DirManager::WriteCacheToDisk()
b->WriteCacheToDisk(); b->WriteCacheToDisk();
progress.Update(current, numNeed); progress.Update(current, numNeed);
} }
iter++; ++iter;
current++; current++;
} }
} }

View File

@ -1292,14 +1292,14 @@ static double SolveIntegrateInverseInterpolated(double y1, double y2, double tim
else if(1.0 + a * y1 * l <= 0.0) else if(1.0 + a * y1 * l <= 0.0)
res = 1.0; res = 1.0;
else else
res = log(1.0 + a * y1 * l) / l; res = log1p(a * y1 * l) / l;
} }
else else
{ {
if(fabs(y2 - y1) < 1.0e-5) // fall back to average if(fabs(y2 - y1) < 1.0e-5) // fall back to average
res = a * (y1 + y2) * 0.5; res = a * (y1 + y2) * 0.5;
else else
res = y1 * (exp(a * (y2 - y1)) - 1.0) / (y2 - y1); res = y1 * expm1(a * (y2 - y1)) / (y2 - y1);
} }
return std::max(0.0, std::min(1.0, res)) * time; return std::max(0.0, std::min(1.0, res)) * time;
} }

View File

@ -19,7 +19,7 @@
#include "FileIO.h" #include "FileIO.h"
FileIO::FileIO(const wxString name, FileIOMode mode) FileIO::FileIO(const wxString & name, FileIOMode mode)
: mName(name), : mName(name),
mMode(mode), mMode(mode),
mInputStream(NULL), mInputStream(NULL),

View File

@ -24,7 +24,7 @@ class FileIO
} FileIOMode; } FileIOMode;
public: public:
FileIO(const wxString name, FileIOMode mode); FileIO(const wxString & name, FileIOMode mode);
~FileIO(); ~FileIO();
bool IsOpened(); bool IsOpened();

View File

@ -1064,7 +1064,6 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc,
mProcessed[i] = float(0.0); mProcessed[i] = float(0.0);
float *in = new float[mWindowSize]; float *in = new float[mWindowSize];
float *in2 = new float[mWindowSize];
float *out = new float[mWindowSize]; float *out = new float[mWindowSize];
float *out2 = new float[mWindowSize]; float *out2 = new float[mWindowSize];
float *win = new float[mWindowSize]; float *win = new float[mWindowSize];
@ -1277,7 +1276,6 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc,
} }
delete[]in; delete[]in;
delete[]in2;
delete[]out; delete[]out;
delete[]out2; delete[]out2;
delete[]win; delete[]win;

View File

@ -3632,7 +3632,6 @@ void AudacityProject::OnSplitCut()
Track *dest; Track *dest;
ClearClipboard(); ClearClipboard();
n = iter.First();
while (n) { while (n) {
if (n->GetSelected()) { if (n->GetSelected()) {
dest = NULL; dest = NULL;

View File

@ -883,7 +883,7 @@ void MixerTrackCluster::OnButton_Solo(wxCommandEvent& WXUNUSED(event))
// class MusicalInstrument // class MusicalInstrument
MusicalInstrument::MusicalInstrument(wxBitmap* pBitmap, const wxString strXPMfilename) MusicalInstrument::MusicalInstrument(wxBitmap* pBitmap, const wxString & strXPMfilename)
{ {
mBitmap = pBitmap; mBitmap = pBitmap;
@ -1219,7 +1219,7 @@ void MixerBoard::RemoveTrackCluster(const WaveTrack* pTrack)
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT
wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(wxString name) wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const wxString & name)
#else #else
wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack) wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack)
#endif #endif

View File

@ -154,7 +154,7 @@ WX_DEFINE_ARRAY(MixerTrackCluster*, MixerTrackClusterArray);
class MusicalInstrument class MusicalInstrument
{ {
public: public:
MusicalInstrument(wxBitmap* pBitmap, const wxString strXPMfilename); MusicalInstrument(wxBitmap* pBitmap, const wxString & strXPMfilename);
virtual ~MusicalInstrument(); virtual ~MusicalInstrument();
wxBitmap* mBitmap; wxBitmap* mBitmap;
@ -213,7 +213,7 @@ public:
void RemoveTrackCluster(const Track* pTrack); void RemoveTrackCluster(const Track* pTrack);
wxBitmap* GetMusicalInstrumentBitmap(const wxString name); wxBitmap* GetMusicalInstrumentBitmap(const wxString & name);
#else #else
void MoveTrackCluster(const WaveTrack* pTrack, bool bUp); // Up in TrackPanel is left in MixerBoard. void MoveTrackCluster(const WaveTrack* pTrack, bool bUp); // Up in TrackPanel is left in MixerBoard.
void RemoveTrackCluster(const WaveTrack* pTrack); void RemoveTrackCluster(const WaveTrack* pTrack);

View File

@ -555,7 +555,7 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S)
wxRect iconrect; wxRect iconrect;
int i = 0; int i = 0;
for (ProviderMap::iterator iter = mMap.begin(); iter != mMap.end(); iter++, i++) for (ProviderMap::iterator iter = mMap.begin(); iter != mMap.end(); ++iter, i++)
{ {
miState.Add( SHOW_CHECKED ); miState.Add( SHOW_CHECKED );
@ -1734,7 +1734,7 @@ void PluginManager::Save()
void PluginManager::SaveGroup(PluginType type) void PluginManager::SaveGroup(PluginType type)
{ {
wxString group = GetPluginTypeString(type); wxString group = GetPluginTypeString(type);
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); iter++) for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
{ {
PluginDescriptor & plug = iter->second; PluginDescriptor & plug = iter->second;
@ -1861,13 +1861,13 @@ void PluginManager::CheckForUpdates()
plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugPath)); plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugPath));
} }
iter++; ++iter;
} }
// If we're only checking for new plugins, then remove all of the known ones // If we're only checking for new plugins, then remove all of the known ones
if (doCheck && !doRescan) if (doCheck && !doRescan)
{ {
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); iter++) for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
{ {
PluginDescriptor & plug = iter->second; PluginDescriptor & plug = iter->second;
const wxString & plugPath = plug.GetPath(); const wxString & plugPath = plug.GetPath();
@ -1898,7 +1898,7 @@ int PluginManager::GetPluginCount(PluginType type)
{ {
int num = 0; int num = 0;
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); iter++) for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
{ {
if (iter->second.GetPluginType() == type) if (iter->second.GetPluginType() == type)
{ {
@ -1921,7 +1921,7 @@ const PluginDescriptor *PluginManager::GetPlugin(const PluginID & ID)
const PluginDescriptor *PluginManager::GetFirstPlugin(PluginType type) const PluginDescriptor *PluginManager::GetFirstPlugin(PluginType type)
{ {
for (mPluginsIter = mPlugins.begin(); mPluginsIter != mPlugins.end(); mPluginsIter++) for (mPluginsIter = mPlugins.begin(); mPluginsIter != mPlugins.end(); ++mPluginsIter)
{ {
PluginDescriptor & plug = mPluginsIter->second; PluginDescriptor & plug = mPluginsIter->second;
bool familyEnabled = true; bool familyEnabled = true;
@ -1959,7 +1959,7 @@ const PluginDescriptor *PluginManager::GetNextPlugin(PluginType type)
const PluginDescriptor *PluginManager::GetFirstPluginForEffectType(EffectType type) const PluginDescriptor *PluginManager::GetFirstPluginForEffectType(EffectType type)
{ {
for (mPluginsIter = mPlugins.begin(); mPluginsIter != mPlugins.end(); mPluginsIter++) for (mPluginsIter = mPlugins.begin(); mPluginsIter != mPlugins.end(); ++mPluginsIter)
{ {
PluginDescriptor & plug = mPluginsIter->second; PluginDescriptor & plug = mPluginsIter->second;

View File

@ -2344,7 +2344,7 @@ wxArrayString AudacityProject::ShowOpenDialog(wxString extraformat, wxString ext
} }
// static method, can be called outside of a project // static method, can be called outside of a project
bool AudacityProject::IsAlreadyOpen(const wxString projPathName) bool AudacityProject::IsAlreadyOpen(const wxString & projPathName)
{ {
wxFileName newProjPathName(projPathName); wxFileName newProjPathName(projPathName);
size_t numProjects = gAudacityProjects.Count(); size_t numProjects = gAudacityProjects.Count();
@ -3436,7 +3436,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
} }
#ifdef USE_LIBVORBIS #ifdef USE_LIBVORBIS
bool AudacityProject::SaveCompressedWaveTracks(const wxString strProjectPathName) // full path for aup except extension bool AudacityProject::SaveCompressedWaveTracks(const wxString & strProjectPathName) // full path for aup except extension
{ {
// Some of this is similar to code in ExportMultiple::ExportMultipleByTrack // Some of this is similar to code in ExportMultiple::ExportMultipleByTrack
// but that code is really tied into the dialogs. // but that code is really tied into the dialogs.
@ -3661,7 +3661,7 @@ bool AudacityProject::Import(wxString fileName, WaveTrackArray* pTrackArray /*=
return true; return true;
} }
bool AudacityProject::SaveAs(const wxString newFileName, bool bWantSaveCompressed /*= false*/, bool addToHistory /*= true*/) bool AudacityProject::SaveAs(const wxString & newFileName, bool bWantSaveCompressed /*= false*/, bool addToHistory /*= true*/)
{ {
wxString oldFileName = mFileName; wxString oldFileName = mFileName;

View File

@ -201,7 +201,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
*/ */
static wxArrayString ShowOpenDialog(wxString extraformat = wxEmptyString, static wxArrayString ShowOpenDialog(wxString extraformat = wxEmptyString,
wxString extrafilter = wxEmptyString); wxString extrafilter = wxEmptyString);
static bool IsAlreadyOpen(const wxString projPathName); static bool IsAlreadyOpen(const wxString & projPathName);
static void OpenFiles(AudacityProject *proj); static void OpenFiles(AudacityProject *proj);
void OpenFile(wxString fileName, bool addtohistory = true); void OpenFile(wxString fileName, bool addtohistory = true);
bool WarnOfLegacyFile( ); bool WarnOfLegacyFile( );
@ -215,9 +215,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
void UnlockAllBlocks(); void UnlockAllBlocks();
bool Save(bool overwrite = true, bool fromSaveAs = false, bool bWantSaveCompressed = false); bool Save(bool overwrite = true, bool fromSaveAs = false, bool bWantSaveCompressed = false);
bool SaveAs(bool bWantSaveCompressed = false); bool SaveAs(bool bWantSaveCompressed = false);
bool SaveAs(const wxString newFileName, bool bWantSaveCompressed = false, bool addToHistory = true); bool SaveAs(const wxString & newFileName, bool bWantSaveCompressed = false, bool addToHistory = true);
#ifdef USE_LIBVORBIS #ifdef USE_LIBVORBIS
bool SaveCompressedWaveTracks(const wxString strProjectPathName); // full path for aup except extension bool SaveCompressedWaveTracks(const wxString & strProjectPathName); // full path for aup except extension
#endif #endif
void Clear(); void Clear();

View File

@ -844,7 +844,7 @@ void ShuttleGuiBase::EndNotebook()
} }
wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString Name ) wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString & Name )
{ {
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return NULL; return NULL;
@ -867,7 +867,7 @@ wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString Name )
return pPage; return pPage;
} }
void ShuttleGuiBase::StartNotebookPage( const wxString Name, wxNotebookPage * pPage ) void ShuttleGuiBase::StartNotebookPage( const wxString & Name, wxNotebookPage * pPage )
{ {
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;

View File

@ -132,8 +132,8 @@ public:
wxNotebook * StartNotebook(); wxNotebook * StartNotebook();
void EndNotebook(); void EndNotebook();
wxNotebookPage * StartNotebookPage( const wxString Name ); wxNotebookPage * StartNotebookPage( const wxString & Name );
void StartNotebookPage( const wxString Name, wxNotebookPage * pPage ); void StartNotebookPage( const wxString & Name, wxNotebookPage * pPage );
void EndNotebookPage(); void EndNotebookPage();
wxPanel * StartInvisiblePanel(); wxPanel * StartInvisiblePanel();
void EndInvisiblePanel(); void EndInvisiblePanel();

View File

@ -409,7 +409,7 @@ bool Tags::GetFirst(wxString & name, wxString & value)
bool Tags::GetNext(wxString & name, wxString & value) bool Tags::GetNext(wxString & name, wxString & value)
{ {
mIter++; ++mIter;
if (mIter == mMap.end()) { if (mIter == mMap.end()) {
return false; return false;
} }

View File

@ -2199,7 +2199,6 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track,
} }
} }
int it=0; int it=0;
int oldBin0=-1;
bool inMaximum = false; bool inMaximum = false;
#endif //EXPERIMENTAL_FIND_NOTES #endif //EXPERIMENTAL_FIND_NOTES

View File

@ -3752,7 +3752,7 @@ void TrackPanel::ForwardEventToWaveTrackEnvelope(wxMouseEvent & event)
// ie one of the Wave displays // ie one of the Wave displays
if (display <= 1) { if (display <= 1) {
bool dB = (display == 1); bool dB = (display == 1);
bool needUpdate = false; bool needUpdate;
// AS: Then forward our mouse event to the envelope. // AS: Then forward our mouse event to the envelope.
// It'll recalculate and then tell us whether or not to redraw. // It'll recalculate and then tell us whether or not to redraw.
@ -7189,7 +7189,7 @@ void TrackPanel::DrawTracks(wxDC * dc)
*dc, region, tracksRect, clip, mViewInfo, *dc, region, tracksRect, clip, mViewInfo,
envelopeFlag, samplesFlag, sliderFlag); envelopeFlag, samplesFlag, sliderFlag);
DrawEverythingElse(dc, region, panelRect, clip); DrawEverythingElse(dc, region, clip);
} }
/// Draws 'Everything else'. In particular it draws: /// Draws 'Everything else'. In particular it draws:
@ -7197,9 +7197,8 @@ void TrackPanel::DrawTracks(wxDC * dc)
/// - Zooming Indicators. /// - Zooming Indicators.
/// - Fills in space below the tracks. /// - Fills in space below the tracks.
void TrackPanel::DrawEverythingElse(wxDC * dc, void TrackPanel::DrawEverythingElse(wxDC * dc,
const wxRegion region, const wxRegion &region,
const wxRect WXUNUSED(panelRect), const wxRect & clip)
const wxRect clip)
{ {
// We draw everything else // We draw everything else
@ -7402,7 +7401,7 @@ void TrackPanel::DrawScrubSpeed(wxDC &dc)
/// be zoomed into when the user clicks and drags with a /// be zoomed into when the user clicks and drags with a
/// zoom cursor. Handles both vertical and horizontal /// zoom cursor. Handles both vertical and horizontal
/// zooming. /// zooming.
void TrackPanel::DrawZooming(wxDC * dc, const wxRect clip) void TrackPanel::DrawZooming(wxDC * dc, const wxRect & clip)
{ {
wxRect r; wxRect r;
@ -7429,8 +7428,8 @@ void TrackPanel::DrawZooming(wxDC * dc, const wxRect clip)
} }
void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect rec, void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec,
const wxRect trackRect) const wxRect & trackRect)
{ {
wxRect r = rec; wxRect r = rec;
int labelw = GetLabelWidth(); int labelw = GetLabelWidth();
@ -7557,7 +7556,7 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect rec,
#endif // USE_MIDI #endif // USE_MIDI
} }
void TrackPanel::DrawOutsideOfTrack(Track * t, wxDC * dc, const wxRect r) void TrackPanel::DrawOutsideOfTrack(Track * t, wxDC * dc, const wxRect & r)
{ {
// Fill in area outside of the track // Fill in area outside of the track
AColor::TrackPanelBackground(dc, false); AColor::TrackPanelBackground(dc, false);
@ -7598,7 +7597,7 @@ void TrackPanel::DrawOutsideOfTrack(Track * t, wxDC * dc, const wxRect r)
} }
/// Draw a three-level highlight gradient around the focused track. /// Draw a three-level highlight gradient around the focused track.
void TrackPanel::HighlightFocusedTrack(wxDC * dc, const wxRect r) void TrackPanel::HighlightFocusedTrack(wxDC * dc, const wxRect & r)
{ {
wxRect rect = r; wxRect rect = r;
rect.x += kLeftInset; rect.x += kLeftInset;
@ -8639,7 +8638,7 @@ void TrackPanel::EnsureVisible(Track * t)
} }
void TrackPanel::DrawBordersAroundTrack(Track * t, wxDC * dc, void TrackPanel::DrawBordersAroundTrack(Track * t, wxDC * dc,
const wxRect r, const int vrul, const wxRect & r, const int vrul,
const int labelw) const int labelw)
{ {
// Border around track and label area // Border around track and label area
@ -8666,7 +8665,7 @@ void TrackPanel::DrawBordersAroundTrack(Track * t, wxDC * dc,
#endif #endif
} }
void TrackPanel::DrawShadow(Track * /* t */ , wxDC * dc, const wxRect r) void TrackPanel::DrawShadow(Track * /* t */ , wxDC * dc, const wxRect & r)
{ {
int right = r.x + r.width - 1; int right = r.x + r.width - 1;
int bottom = r.y + r.height - 1; int bottom = r.y + r.height - 1;
@ -9754,7 +9753,7 @@ int TrackInfo::GetTrackInfoWidth() const
return kTrackInfoWidth; return kTrackInfoWidth;
} }
void TrackInfo::GetCloseBoxRect(const wxRect r, wxRect & dest) const void TrackInfo::GetCloseBoxRect(const wxRect & r, wxRect & dest) const
{ {
dest.x = r.x; dest.x = r.x;
dest.y = r.y; dest.y = r.y;
@ -9762,7 +9761,7 @@ void TrackInfo::GetCloseBoxRect(const wxRect r, wxRect & dest) const
dest.height = kTrackInfoBtnSize; dest.height = kTrackInfoBtnSize;
} }
void TrackInfo::GetTitleBarRect(const wxRect r, wxRect & dest) const void TrackInfo::GetTitleBarRect(const wxRect & r, wxRect & dest) const
{ {
dest.x = r.x + kTrackInfoBtnSize; // to right of CloseBoxRect dest.x = r.x + kTrackInfoBtnSize; // to right of CloseBoxRect
dest.y = r.y; dest.y = r.y;
@ -9770,7 +9769,7 @@ void TrackInfo::GetTitleBarRect(const wxRect r, wxRect & dest) const
dest.height = kTrackInfoBtnSize; dest.height = kTrackInfoBtnSize;
} }
void TrackInfo::GetMuteSoloRect(const wxRect r, wxRect & dest, bool solo, bool bHasSoloButton) const void TrackInfo::GetMuteSoloRect(const wxRect & r, wxRect & dest, bool solo, bool bHasSoloButton) const
{ {
dest.x = r.x ; dest.x = r.x ;
dest.y = r.y + 50; dest.y = r.y + 50;
@ -9787,7 +9786,7 @@ void TrackInfo::GetMuteSoloRect(const wxRect r, wxRect & dest, bool solo, bool b
} }
} }
void TrackInfo::GetGainRect(const wxRect r, wxRect & dest) const void TrackInfo::GetGainRect(const wxRect & r, wxRect & dest) const
{ {
dest.x = r.x + 7; dest.x = r.x + 7;
dest.y = r.y + 70; dest.y = r.y + 70;
@ -9795,7 +9794,7 @@ void TrackInfo::GetGainRect(const wxRect r, wxRect & dest) const
dest.height = 25; dest.height = 25;
} }
void TrackInfo::GetPanRect(const wxRect r, wxRect & dest) const void TrackInfo::GetPanRect(const wxRect & r, wxRect & dest) const
{ {
dest.x = r.x + 7; dest.x = r.x + 7;
dest.y = r.y + 100; dest.y = r.y + 100;
@ -9803,7 +9802,7 @@ void TrackInfo::GetPanRect(const wxRect r, wxRect & dest) const
dest.height = 25; dest.height = 25;
} }
void TrackInfo::GetMinimizeRect(const wxRect r, wxRect &dest) const void TrackInfo::GetMinimizeRect(const wxRect & r, wxRect &dest) const
{ {
const int kBlankWidth = kTrackInfoBtnSize + 4; const int kBlankWidth = kTrackInfoBtnSize + 4;
dest.x = r.x + kBlankWidth; dest.x = r.x + kBlankWidth;
@ -9813,7 +9812,7 @@ void TrackInfo::GetMinimizeRect(const wxRect r, wxRect &dest) const
dest.height = kTrackInfoBtnSize; dest.height = kTrackInfoBtnSize;
} }
void TrackInfo::GetSyncLockIconRect(const wxRect r, wxRect &dest) const void TrackInfo::GetSyncLockIconRect(const wxRect & r, wxRect &dest) const
{ {
dest.x = r.x + kTrackInfoWidth - kTrackInfoBtnSize - 4; // to right of minimize button dest.x = r.x + kTrackInfoWidth - kTrackInfoBtnSize - 4; // to right of minimize button
dest.y = r.y + r.height - 19; dest.y = r.y + r.height - 19;
@ -9828,7 +9827,7 @@ void TrackInfo::SetTrackInfoFont(wxDC * dc)
dc->SetFont(mFont); dc->SetFont(mFont);
} }
void TrackInfo::DrawBordersWithin(wxDC* dc, const wxRect r, bool bHasMuteSolo) void TrackInfo::DrawBordersWithin(wxDC* dc, const wxRect & r, bool bHasMuteSolo)
{ {
AColor::Dark(dc, false); // same color as border of toolbars (ToolBar::OnPaint()) AColor::Dark(dc, false); // same color as border of toolbars (ToolBar::OnPaint())
@ -9854,7 +9853,7 @@ void TrackInfo::DrawBordersWithin(wxDC* dc, const wxRect r, bool bHasMuteSolo)
minimizeRect.x + minimizeRect.width, minimizeRect.y - 1); minimizeRect.x + minimizeRect.width, minimizeRect.y - 1);
} }
void TrackInfo::DrawBackground(wxDC * dc, const wxRect r, bool bSelected, void TrackInfo::DrawBackground(wxDC * dc, const wxRect & r, bool bSelected,
bool WXUNUSED(bHasMuteSolo), const int labelw, const int WXUNUSED(vrul)) bool WXUNUSED(bHasMuteSolo), const int labelw, const int WXUNUSED(vrul))
{ {
// fill in label // fill in label
@ -9879,7 +9878,7 @@ void TrackInfo::DrawBackground(wxDC * dc, const wxRect r, bool bSelected,
//} //}
} }
void TrackInfo::GetTrackControlsRect(const wxRect r, wxRect & dest) const void TrackInfo::GetTrackControlsRect(const wxRect & r, wxRect & dest) const
{ {
wxRect top; wxRect top;
wxRect bot; wxRect bot;
@ -9894,7 +9893,7 @@ void TrackInfo::GetTrackControlsRect(const wxRect r, wxRect & dest) const
} }
void TrackInfo::DrawCloseBox(wxDC * dc, const wxRect r, bool down) void TrackInfo::DrawCloseBox(wxDC * dc, const wxRect & r, bool down)
{ {
wxRect bev; wxRect bev;
GetCloseBoxRect(r, bev); GetCloseBoxRect(r, bev);
@ -9923,7 +9922,7 @@ void TrackInfo::DrawCloseBox(wxDC * dc, const wxRect r, bool down)
AColor::BevelTrackInfo(*dc, !down, bev); AColor::BevelTrackInfo(*dc, !down, bev);
} }
void TrackInfo::DrawTitleBar(wxDC * dc, const wxRect r, Track * t, void TrackInfo::DrawTitleBar(wxDC * dc, const wxRect & r, Track * t,
bool down) bool down)
{ {
wxRect bev; wxRect bev;
@ -9969,7 +9968,7 @@ void TrackInfo::DrawTitleBar(wxDC * dc, const wxRect r, Track * t,
} }
/// Draw the Mute or the Solo button, depending on the value of solo. /// Draw the Mute or the Solo button, depending on the value of solo.
void TrackInfo::DrawMuteSolo(wxDC * dc, const wxRect r, Track * t, void TrackInfo::DrawMuteSolo(wxDC * dc, const wxRect & r, Track * t,
bool down, bool solo, bool bHasSoloButton) bool down, bool solo, bool bHasSoloButton)
{ {
wxRect bev; wxRect bev;
@ -10022,7 +10021,7 @@ void TrackInfo::DrawMuteSolo(wxDC * dc, const wxRect r, Track * t,
} }
// Draw the minimize button *and* the sync-lock track icon, if necessary. // Draw the minimize button *and* the sync-lock track icon, if necessary.
void TrackInfo::DrawMinimize(wxDC * dc, const wxRect r, Track * t, bool down) void TrackInfo::DrawMinimize(wxDC * dc, const wxRect & r, Track * t, bool down)
{ {
wxRect bev; wxRect bev;
GetMinimizeRect(r, bev); GetMinimizeRect(r, bev);

View File

@ -103,28 +103,28 @@ private:
void EnsureSufficientSliders(int index); void EnsureSufficientSliders(int index);
void SetTrackInfoFont(wxDC *dc); void SetTrackInfoFont(wxDC *dc);
void DrawBackground(wxDC * dc, const wxRect r, bool bSelected, bool bHasMuteSolo, const int labelw, const int vrul); void DrawBackground(wxDC * dc, const wxRect & r, bool bSelected, bool bHasMuteSolo, const int labelw, const int vrul);
void DrawBordersWithin(wxDC * dc, const wxRect r, bool bHasMuteSolo ); void DrawBordersWithin(wxDC * dc, const wxRect & r, bool bHasMuteSolo );
void DrawCloseBox(wxDC * dc, const wxRect r, bool down); void DrawCloseBox(wxDC * dc, const wxRect & r, bool down);
void DrawTitleBar(wxDC * dc, const wxRect r, Track * t, bool down); void DrawTitleBar(wxDC * dc, const wxRect & r, Track * t, bool down);
void DrawMuteSolo(wxDC * dc, const wxRect r, Track * t, bool down, bool solo, bool bHasSoloButton); void DrawMuteSolo(wxDC * dc, const wxRect & r, Track * t, bool down, bool solo, bool bHasSoloButton);
void DrawVRuler(wxDC * dc, const wxRect r, Track * t); void DrawVRuler(wxDC * dc, const wxRect & r, Track * t);
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT
void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect r); void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect r);
#endif #endif
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect r); void DrawSliders(wxDC * dc, WaveTrack *t, wxRect r);
// Draw the minimize button *and* the sync-lock track icon, if necessary. // Draw the minimize button *and* the sync-lock track icon, if necessary.
void DrawMinimize(wxDC * dc, const wxRect r, Track * t, bool down); void DrawMinimize(wxDC * dc, const wxRect & r, Track * t, bool down);
void GetTrackControlsRect(const wxRect r, wxRect &dest) const; void GetTrackControlsRect(const wxRect & r, wxRect &dest) const;
void GetCloseBoxRect(const wxRect r, wxRect &dest) const; void GetCloseBoxRect(const wxRect & r, wxRect &dest) const;
void GetTitleBarRect(const wxRect r, wxRect &dest) const; void GetTitleBarRect(const wxRect & r, wxRect &dest) const;
void GetMuteSoloRect(const wxRect r, wxRect &dest, bool solo, bool bHasSoloButton) const; void GetMuteSoloRect(const wxRect & r, wxRect &dest, bool solo, bool bHasSoloButton) const;
void GetGainRect(const wxRect r, wxRect &dest) const; void GetGainRect(const wxRect & r, wxRect &dest) const;
void GetPanRect(const wxRect r, wxRect &dest) const; void GetPanRect(const wxRect & r, wxRect &dest) const;
void GetMinimizeRect(const wxRect r, wxRect &dest) const; void GetMinimizeRect(const wxRect & r, wxRect &dest) const;
void GetSyncLockIconRect(const wxRect r, wxRect &dest) const; void GetSyncLockIconRect(const wxRect & r, wxRect &dest) const;
// These arrays are always kept the same size. // These arrays are always kept the same size.
LWSliderArray mGains; LWSliderArray mGains;
@ -523,17 +523,17 @@ public:
protected: protected:
virtual void DrawTracks(wxDC * dc); virtual void DrawTracks(wxDC * dc);
virtual void DrawEverythingElse(wxDC *dc, const wxRegion region, virtual void DrawEverythingElse(wxDC *dc, const wxRegion & region,
const wxRect panelRect, const wxRect clip); const wxRect & clip);
virtual void DrawOutside(Track *t, wxDC *dc, const wxRect rec, virtual void DrawOutside(Track *t, wxDC *dc, const wxRect & rec,
const wxRect trackRect); const wxRect &trackRect);
void DrawScrubSpeed(wxDC &dc); void DrawScrubSpeed(wxDC &dc);
virtual void DrawZooming(wxDC* dc, const wxRect clip); virtual void DrawZooming(wxDC* dc, const wxRect & clip);
virtual void HighlightFocusedTrack (wxDC* dc, const wxRect r); virtual void HighlightFocusedTrack (wxDC* dc, const wxRect &r);
virtual void DrawShadow (Track *t, wxDC* dc, const wxRect r); virtual void DrawShadow (Track *t, wxDC* dc, const wxRect & r);
virtual void DrawBordersAroundTrack(Track *t, wxDC* dc, const wxRect r, const int labelw, const int vrul); virtual void DrawBordersAroundTrack(Track *t, wxDC* dc, const wxRect & r, const int labelw, const int vrul);
virtual void DrawOutsideOfTrack (Track *t, wxDC* dc, const wxRect r); virtual void DrawOutsideOfTrack (Track *t, wxDC* dc, const wxRect & r);
virtual int IdOfRate( int rate ); virtual int IdOfRate( int rate );
virtual int IdOfFormat( int format ); virtual int IdOfFormat( int format );

View File

@ -59,7 +59,7 @@ EffectManager::~EffectManager()
while (iter != mHostEffects.end()) while (iter != mHostEffects.end())
{ {
delete iter->second; delete iter->second;
iter++; ++iter;
} }
} }

View File

@ -955,7 +955,6 @@ bool EffectEqualization::TransferDataFromWindow()
int m = 2 * mMSlider->GetValue() + 1; // odd numbers only int m = 2 * mMSlider->GetValue() + 1; // odd numbers only
if (m != mM) { if (m != mM) {
rr = true;
mM = m; mM = m;
mPanel->ForceRecalc(); mPanel->ForceRecalc();

View File

@ -283,7 +283,6 @@ void EffectLeveller::CalcLevellerFactors()
limit = gLimit[f]; limit = gLimit[f];
prevAdjLimit = gAdjLimit[prev]; prevAdjLimit = gAdjLimit[prev];
addOnValue = prevAdjLimit - (adjFactor * prevLimit); addOnValue = prevAdjLimit - (adjFactor * prevLimit);
upperAdjLimit = (adjFactor * limit) + addOnValue;
gAddOnValue[f] = addOnValue; gAddOnValue[f] = addOnValue;
gAdjLimit[f] = (adjFactor * limit) + addOnValue; gAdjLimit[f] = (adjFactor * limit) + addOnValue;

View File

@ -157,7 +157,7 @@ sampleCount EffectPhaser::ProcessBlock(float **inBlock, float **outBlock, sample
gain = (1.0 + cos(skipcount * lfoskip + phase)) / 2.0; gain = (1.0 + cos(skipcount * lfoskip + phase)) / 2.0;
// change lfo shape // change lfo shape
gain = (exp(gain * phaserlfoshape) - 1.0) / (exp(phaserlfoshape) - 1.0); gain = expm1(gain * phaserlfoshape) / expm1(phaserlfoshape);
// attenuate the lfo // attenuate the lfo
gain = 1.0 - gain / 255.0 * mDepth; gain = 1.0 - gain / 255.0 * mDepth;

View File

@ -121,7 +121,7 @@ GeometricInputTimeWarper::GeometricInputTimeWarper(double tStart, double tEnd,
double GeometricOutputTimeWarper::Warp(double originalTime) const double GeometricOutputTimeWarper::Warp(double originalTime) const
{ {
double scaledTime = mTimeWarper.Warp(originalTime); double scaledTime = mTimeWarper.Warp(originalTime);
return mTStart + mScale*log(mC0 * scaledTime + 1.0); return mTStart + mScale*log1p(mC0 * scaledTime);
} }
GeometricOutputTimeWarper::GeometricOutputTimeWarper(double tStart, double tEnd, GeometricOutputTimeWarper::GeometricOutputTimeWarper(double tStart, double tEnd,

View File

@ -160,7 +160,7 @@ wxArrayString VampEffectsModule::FindPlugins(PluginManagerInterface & WXUNUSED(p
int output = 0; int output = 0;
for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); j++) for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
{ {
if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate || if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep || j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
@ -294,7 +294,7 @@ Plugin *VampEffectsModule::FindPlugin(const wxString & path,
hasParameters = !vp->getParameterDescriptors().empty(); hasParameters = !vp->getParameterDescriptors().empty();
for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); j++) for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
{ {
if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate || if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep || j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||

View File

@ -405,7 +405,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
} }
bool Exporter::Process(AudacityProject *project, int numChannels, bool Exporter::Process(AudacityProject *project, int numChannels,
const wxChar *type, const wxString filename, const wxChar *type, const wxString & filename,
bool selectedOnly, double t0, double t1) bool selectedOnly, double t0, double t1)
{ {
// Save parms // Save parms

View File

@ -147,7 +147,7 @@ public:
bool Process(AudacityProject *project, bool selectedOnly, bool Process(AudacityProject *project, bool selectedOnly,
double t0, double t1); double t0, double t1);
bool Process(AudacityProject *project, int numChannels, bool Process(AudacityProject *project, int numChannels,
const wxChar *type, const wxString filename, const wxChar *type, const wxString & filename,
bool selectedOnly, double t0, double t1); bool selectedOnly, double t0, double t1);
void DisplayOptions(int index); void DisplayOptions(int index);

View File

@ -327,7 +327,7 @@ public:
private: private:
char *AdjustString(wxString wxStr, int sf_format); char *AdjustString(const wxString & wxStr, int sf_format);
bool AddStrings(AudacityProject *project, SNDFILE *sf, Tags *tags, int sf_format); bool AddStrings(AudacityProject *project, SNDFILE *sf, Tags *tags, int sf_format);
void AddID3Chunk(wxString fName, Tags *tags, int sf_format); void AddID3Chunk(wxString fName, Tags *tags, int sf_format);
@ -574,7 +574,7 @@ int ExportPCM::Export(AudacityProject *project,
return updateResult; return updateResult;
} }
char *ExportPCM::AdjustString(const wxString wxStr, int sf_format) char *ExportPCM::AdjustString(const wxString & wxStr, int sf_format)
{ {
bool b_aiff = false; bool b_aiff = false;
if ((sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF) if ((sf_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF)

View File

@ -778,6 +778,11 @@ int FFmpegImportFileHandle::WriteData(streamContext *sc)
default: default:
wxLogError(wxT("Stream %d has unrecognized sample format %d."), streamid, sc->m_samplefmt); wxLogError(wxT("Stream %d has unrecognized sample format %d."), streamid, sc->m_samplefmt);
for (int chn=0; chn < nChannels; chn++)
{
free(tmp[chn]);
}
free(tmp);
return 1; return 1;
break; break;
} }

View File

@ -304,8 +304,6 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount
samplePtr bufStart = data; samplePtr bufStart = data;
streamContext* sc = NULL; streamContext* sc = NULL;
int nChannels;
// printf("start %llu len %llu\n", start, len); // printf("start %llu len %llu\n", start, len);
//TODO update this to work with seek - this only works linearly now. //TODO update this to work with seek - this only works linearly now.
if(mCurrentPos > start && mCurrentPos <= start+len + kDecodeSampleAllowance) if(mCurrentPos > start && mCurrentPos <= start+len + kDecodeSampleAllowance)
@ -370,7 +368,6 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount
// ReadNextFrame returns 1 if stream is not to be imported // ReadNextFrame returns 1 if stream is not to be imported
if (sc != (streamContext*)1) if (sc != (streamContext*)1)
{ {
nChannels = sc->m_stream->codec->channels < sc->m_initialchannels ? sc->m_stream->codec->channels : sc->m_initialchannels;
//find out the dts we've seekd to. can't use the stream->cur_dts because it is faulty. also note that until we do the first seek, pkt.dts can be false and will change for the same samples after the initial seek. //find out the dts we've seekd to. can't use the stream->cur_dts because it is faulty. also note that until we do the first seek, pkt.dts can be false and will change for the same samples after the initial seek.
sampleCount actualDecodeStart = mCurrentPos; sampleCount actualDecodeStart = mCurrentPos;

View File

@ -310,7 +310,7 @@ void DeviceToolBar::UpdatePrefs()
} }
} }
long oldChannels = 1, newChannels; long oldChannels, newChannels;
oldChannels = mInputChannels->GetSelection() + 1; oldChannels = mInputChannels->GetSelection() + 1;
gPrefs->Read(wxT("/AudioIO/RecordChannels"), &newChannels, 0); gPrefs->Read(wxT("/AudioIO/RecordChannels"), &newChannels, 0);
if (newChannels > 0 && oldChannels != newChannels) if (newChannels > 0 && oldChannels != newChannels)

View File

@ -237,9 +237,7 @@ void MeterToolBar::OnSize( wxSizeEvent & event) //WXUNUSED(event) )
bool MeterToolBar::Expose( bool show ) bool MeterToolBar::Expose( bool show )
{ {
bool updated = false;
if( show ) { if( show ) {
Meter *meter;
if( mPlayMeter ) { if( mPlayMeter ) {
mProject->SetPlaybackMeter( mPlayMeter ); mProject->SetPlaybackMeter( mPlayMeter );
} }

View File

@ -867,7 +867,6 @@ void Ruler::TickCustom(int labelIdx, bool major, bool minor)
} }
else { else {
strTop =-strH-mLead;
strTop = mTop- mLead+4;// More space was needed... strTop = mTop- mLead+4;// More space was needed...
mMaxHeight = max(mMaxHeight, strH + 6); mMaxHeight = max(mMaxHeight, strH + 6);
} }

View File

@ -38,7 +38,7 @@
#include "../SampleFormat.h" #include "../SampleFormat.h"
#include "../Track.h" #include "../Track.h"
bool XMLValueChecker::IsGoodString(const wxString str) bool XMLValueChecker::IsGoodString(const wxString & str)
{ {
size_t len = str.Length(); size_t len = str.Length();
int nullIndex = str.Find('\0', false); int nullIndex = str.Find('\0', false);
@ -50,7 +50,7 @@ bool XMLValueChecker::IsGoodString(const wxString str)
} }
// "Good" means the name is well-formed and names an existing file or folder. // "Good" means the name is well-formed and names an existing file or folder.
bool XMLValueChecker::IsGoodFileName(const wxString strFileName, const wxString strDirName /* = "" */) bool XMLValueChecker::IsGoodFileName(const wxString & strFileName, const wxString & strDirName /* = "" */)
{ {
// Test strFileName. // Test strFileName.
if (!IsGoodFileString(strFileName) || if (!IsGoodFileString(strFileName) ||
@ -74,7 +74,7 @@ bool XMLValueChecker::IsGoodFileString(wxString str)
(str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters. (str.Find(wxFileName::GetPathSeparator()) == -1)); // No path separator characters.
} }
bool XMLValueChecker::IsGoodSubdirName(const wxString strSubdirName, const wxString strDirName /* = "" */) bool XMLValueChecker::IsGoodSubdirName(const wxString & strSubdirName, const wxString & strDirName /* = "" */)
{ {
// Test strSubdirName. // Test strSubdirName.
// Note this prevents path separators, and relative path to parents (strDirName), // Note this prevents path separators, and relative path to parents (strDirName),
@ -90,7 +90,7 @@ bool XMLValueChecker::IsGoodSubdirName(const wxString strSubdirName, const wxStr
return (fileName.IsOk() && fileName.DirExists()); return (fileName.IsOk() && fileName.DirExists());
} }
bool XMLValueChecker::IsGoodPathName(const wxString strPathName) bool XMLValueChecker::IsGoodPathName(const wxString & strPathName)
{ {
// Test the corresponding wxFileName. // Test the corresponding wxFileName.
wxFileName fileName(strPathName); wxFileName fileName(strPathName);
@ -105,7 +105,7 @@ bool XMLValueChecker::IsGoodPathString(wxString str)
} }
bool XMLValueChecker::IsGoodInt(const wxString strInt) bool XMLValueChecker::IsGoodInt(const wxString & strInt)
{ {
if (!IsGoodString(strInt)) if (!IsGoodString(strInt))
return false; return false;
@ -146,7 +146,7 @@ bool XMLValueChecker::IsGoodInt(const wxString strInt)
return true; return true;
} }
bool XMLValueChecker::IsGoodInt64(const wxString strInt) bool XMLValueChecker::IsGoodInt64(const wxString & strInt)
{ {
if (!IsGoodString(strInt)) if (!IsGoodString(strInt))
return false; return false;

View File

@ -29,12 +29,12 @@ public:
// "Good" means well-formed and for the file-related functions, names an existing file or folder. // "Good" means well-formed and for the file-related functions, names an existing file or folder.
// These are used in HandleXMLTag and BuildFomXML methods to check the input for // These are used in HandleXMLTag and BuildFomXML methods to check the input for
// security vulnerabilites, per the NGS report for UmixIt. // security vulnerabilites, per the NGS report for UmixIt.
static bool IsGoodString(const wxString str); static bool IsGoodString(const wxString & str);
static bool IsGoodFileName(const wxString strFileName, const wxString strDirName = wxEmptyString); static bool IsGoodFileName(const wxString & strFileName, const wxString & strDirName = wxEmptyString);
static bool IsGoodFileString(wxString str); static bool IsGoodFileString(wxString str);
static bool IsGoodSubdirName(const wxString strSubdirName, const wxString strDirName = wxEmptyString); static bool IsGoodSubdirName(const wxString & strSubdirName, const wxString & strDirName = wxEmptyString);
static bool IsGoodPathName(const wxString strPathName); static bool IsGoodPathName(const wxString & strPathName);
static bool IsGoodPathString(wxString str); static bool IsGoodPathString(wxString str);
/** @brief Check that the supplied string can be converted to a long (32bit) /** @brief Check that the supplied string can be converted to a long (32bit)
@ -46,7 +46,7 @@ public:
* @param strInt The string to test * @param strInt The string to test
* @return true if the string is convertable, false if not * @return true if the string is convertable, false if not
*/ */
static bool IsGoodInt(const wxString strInt); static bool IsGoodInt(const wxString & strInt);
/** @brief Check that the supplied string can be converted to a 64bit /** @brief Check that the supplied string can be converted to a 64bit
* integer. * integer.
* *
@ -56,7 +56,7 @@ public:
* @param strInt The string to test * @param strInt The string to test
* @return true if the string is convertable, false if not * @return true if the string is convertable, false if not
*/ */
static bool IsGoodInt64(const wxString strInt); static bool IsGoodInt64(const wxString & strInt);
static bool IsValidChannel(const int nValue); static bool IsValidChannel(const int nValue);
#ifdef USE_MIDI #ifdef USE_MIDI