From 4011eba627ea427b59b3aa1544f987a2a6d25b2e Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 20 Aug 2016 10:54:44 -0400 Subject: [PATCH 1/9] Fix bug in disabled experimental code... a * had got replaced with , and no compiler error! --- src/import/ImportFFmpeg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/import/ImportFFmpeg.cpp b/src/import/ImportFFmpeg.cpp index 1d5641d32..9c7a42350 100644 --- a/src/import/ImportFFmpeg.cpp +++ b/src/import/ImportFFmpeg.cpp @@ -592,7 +592,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory, sampleCount sampleDuration = 0; auto sc = scs[s].get(); if (sc->m_stream->duration > 0) - sampleDuration = ((sampleCount)sc->m_stream->duration * sc->m_stream->time_base.num), sc->m_stream->codec->sample_rate / sc->m_stream->time_base.den; + sampleDuration = ((sampleCount)sc->m_stream->duration * sc->m_stream->time_base.num) * sc->m_stream->codec->sample_rate / sc->m_stream->time_base.den; else sampleDuration = ((sampleCount)mFormatContext->duration *sc->m_stream->codec->sample_rate) / AV_TIME_BASE; From 2a7d8dca77b97b37c86c428fdf8ad9477a485c6d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 20 Aug 2016 18:13:49 -0400 Subject: [PATCH 2/9] time warper bug --- src/effects/Effect.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index f040db5cd..70e1070b8 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -1576,9 +1576,9 @@ bool Effect::ProcessTrack(int count, sampleCount genLength = 0; bool isGenerator = GetType() == EffectTypeGenerate; bool isProcessor = GetType() == EffectTypeProcess; + double genDur = 0; if (isGenerator) { - double genDur; if (mIsPreview) { gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &genDur, 6.0); genDur = wxMin(mDuration, CalcPreviewInputLength(genDur)); @@ -1850,17 +1850,33 @@ bool Effect::ProcessTrack(int count, if (isGenerator) { AudacityProject *p = GetActiveProject(); - StepTimeWarper warper(mT0 + genLength, genLength - (mT1 - mT0)); + + // PRL: this code was here and could not have been the right + // intent, mixing time and sampleCount values: + // StepTimeWarper warper(mT0 + genLength, genLength - (mT1 - mT0)); + + // This looks like what it should have been: + // StepTimeWarper warper(mT0 + genDur, genDur - (mT1 - mT0)); + // But rather than fix it, I will just disable the use of it for now. + // The purpose was to remap split lines inside the selected region when + // a generator replaces it with sound of different duration. But + // the "correct" version might have the effect of mapping some splits too + // far left, to before the seletion. + // In practice the wrong version probably did nothing most of the time, + // because the cutoff time for the step time warper was 44100 times too + // far from mT0. // Transfer the data from the temporary tracks to the actual ones genLeft->Flush(); // mT1 gives us the NEW selection. We want to replace up to GetSel1(). - left->ClearAndPaste(mT0, p->GetSel1(), genLeft.get(), true, true, &warper); + left->ClearAndPaste(mT0, p->GetSel1(), genLeft.get(), true, true, + nullptr /* &warper */); if (genRight) { genRight->Flush(); - right->ClearAndPaste(mT0, mT1, genRight.get(), true, true, &warper); + right->ClearAndPaste(mT0, mT1, genRight.get(), true, true, + nullptr /* &warper */); } } From 854651306ca9b89cc3b9dec135cab9a4b57a0c09 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 20 Aug 2016 19:29:49 -0400 Subject: [PATCH 3/9] A mutex guarding access to this variable made volatile unnecessary --- src/ondemand/ODTask.cpp | 3 +-- src/ondemand/ODTask.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ondemand/ODTask.cpp b/src/ondemand/ODTask.cpp index 57d248313..39de3aaae 100644 --- a/src/ondemand/ODTask.cpp +++ b/src/ondemand/ODTask.cpp @@ -31,6 +31,7 @@ DEFINE_EVENT_TYPE(EVT_ODTASK_COMPLETE) /// Constructs an ODTask ODTask::ODTask() +: mDemandSample(0) { static int sTaskNumber=0; @@ -41,8 +42,6 @@ ODTask::ODTask() mIsRunning = false; mTaskNumber=sTaskNumber++; - - mDemandSample=0; } //outside code must ensure this task is not scheduled again. diff --git a/src/ondemand/ODTask.h b/src/ondemand/ODTask.h index 847e080b1..c8736120d 100644 --- a/src/ondemand/ODTask.h +++ b/src/ondemand/ODTask.h @@ -159,7 +159,7 @@ class ODTask /* not final */ std::vector mWaveTracks; ODLock mWaveTrackMutex; - volatile sampleCount mDemandSample; + sampleCount mDemandSample; mutable ODLock mDemandSampleMutex; volatile bool mIsRunning; From 49e699b1df37f48704ca68101965468d3079fae6 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 19 Aug 2016 13:18:48 -0400 Subject: [PATCH 4/9] Remove overloads for sampleCount from ConfigInterface... ... The value was always cast to int anyway when writing, and it was used only for one value in VST effect, which did not need 64 bits --- include/audacity/ConfigInterface.h | 6 ---- include/audacity/PluginInterface.h | 5 --- src/PluginManager.cpp | 54 ------------------------------ src/PluginManager.h | 6 ---- src/effects/Effect.cpp | 20 ----------- src/effects/Effect.h | 4 --- src/effects/VST/VSTEffect.cpp | 14 ++------ src/effects/VST/VSTEffect.h | 4 +-- 8 files changed, 4 insertions(+), 109 deletions(-) diff --git a/include/audacity/ConfigInterface.h b/include/audacity/ConfigInterface.h index c061a9ad4..9364f9300 100644 --- a/include/audacity/ConfigInterface.h +++ b/include/audacity/ConfigInterface.h @@ -42,8 +42,6 @@ #ifndef __AUDACITY_CONFIGINTERFACE_H__ #define __AUDACITY_CONFIGINTERFACE_H__ -#include "audacity/Types.h" - class AUDACITY_DLL_API ConfigClientInterface /* not final */ { public: @@ -57,14 +55,12 @@ public: virtual bool GetSharedConfig(const wxString & group, const wxString & key, bool & value, bool defval) = 0; virtual bool GetSharedConfig(const wxString & group, const wxString & key, float & value, float defval) = 0; virtual bool GetSharedConfig(const wxString & group, const wxString & key, double & value, double defval) = 0; - virtual bool GetSharedConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) = 0; virtual bool SetSharedConfig(const wxString & group, const wxString & key, const wxString & value) = 0; virtual bool SetSharedConfig(const wxString & group, const wxString & key, const int & value) = 0; virtual bool SetSharedConfig(const wxString & group, const wxString & key, const bool & value) = 0; virtual bool SetSharedConfig(const wxString & group, const wxString & key, const float & value) = 0; virtual bool SetSharedConfig(const wxString & group, const wxString & key, const double & value) = 0; - virtual bool SetSharedConfig(const wxString & group, const wxString & key, const sampleCount & value) = 0; virtual bool RemoveSharedConfigSubgroup(const wxString & group) = 0; virtual bool RemoveSharedConfig(const wxString & group, const wxString & key) = 0; @@ -77,14 +73,12 @@ public: virtual bool GetPrivateConfig(const wxString & group, const wxString & key, bool & value, bool defval) = 0; virtual bool GetPrivateConfig(const wxString & group, const wxString & key, float & value, float defval) = 0; virtual bool GetPrivateConfig(const wxString & group, const wxString & key, double & value, double defval) = 0; - virtual bool GetPrivateConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) = 0; virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value) = 0; virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const int & value) = 0; virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const bool & value) = 0; virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const float & value) = 0; virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const double & value) = 0; - virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const sampleCount & value) = 0; virtual bool RemovePrivateConfigSubgroup(const wxString & group) = 0; virtual bool RemovePrivateConfig(const wxString & group, const wxString & key) = 0; diff --git a/include/audacity/PluginInterface.h b/include/audacity/PluginInterface.h index 9d6e6d1b2..489e9959f 100644 --- a/include/audacity/PluginInterface.h +++ b/include/audacity/PluginInterface.h @@ -42,7 +42,6 @@ #ifndef __AUDACITY_PLUGININTERFACE_H__ #define __AUDACITY_PLUGININTERFACE_H__ -#include "audacity/Types.h" #include "audacity/ConfigInterface.h" #include "audacity/EffectInterface.h" #include "audacity/IdentInterface.h" @@ -73,14 +72,12 @@ public: virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) = 0; virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) = 0; virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) = 0; - virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) = 0; virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) = 0; virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) = 0; virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) = 0; virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) = 0; virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) = 0; - virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) = 0; virtual bool RemoveSharedConfigSubgroup(const PluginID & ID, const wxString & group) = 0; virtual bool RemoveSharedConfig(const PluginID & ID, const wxString & group, const wxString & key) = 0; @@ -92,14 +89,12 @@ public: virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) = 0; virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) = 0; virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) = 0; - virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) = 0; virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) = 0; virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) = 0; virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) = 0; virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) = 0; virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) = 0; - virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) = 0; virtual bool RemovePrivateConfigSubgroup(const PluginID & ID, const wxString & group) = 0; virtual bool RemovePrivateConfig(const PluginID & ID, const wxString & group, const wxString & key) = 0; diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index 2d0b55c7d..ba9da1939 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -1510,11 +1510,6 @@ bool PluginManager::GetSharedConfig(const PluginID & ID, const wxString & group, return GetConfig(SharedKey(ID, group, key), value, defval); } -bool PluginManager::GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) -{ - return GetConfig(SharedKey(ID, group, key), value, defval); -} - bool PluginManager::SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) { return SetConfig(SharedKey(ID, group, key), value); @@ -1540,11 +1535,6 @@ bool PluginManager::SetSharedConfig(const PluginID & ID, const wxString & group, return SetConfig(SharedKey(ID, group, key), value); } -bool PluginManager::SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) -{ - return SetConfig(SharedKey(ID, group, key), value); -} - bool PluginManager::RemoveSharedConfigSubgroup(const PluginID & ID, const wxString & group) { bool result = GetSettings()->DeleteGroup(SharedGroup(ID, group)); @@ -1602,11 +1592,6 @@ bool PluginManager::GetPrivateConfig(const PluginID & ID, const wxString & group return GetConfig(PrivateKey(ID, group, key), value, defval); } -bool PluginManager::GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) -{ - return GetConfig(PrivateKey(ID, group, key), value, defval); -} - bool PluginManager::SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) { return SetConfig(PrivateKey(ID, group, key), value); @@ -1632,11 +1617,6 @@ bool PluginManager::SetPrivateConfig(const PluginID & ID, const wxString & group return SetConfig(PrivateKey(ID, group, key), value); } -bool PluginManager::SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) -{ - return SetConfig(PrivateKey(ID, group, key), value); -} - bool PluginManager::RemovePrivateConfigSubgroup(const PluginID & ID, const wxString & group) { bool result = GetSettings()->DeleteGroup(PrivateGroup(ID, group)); @@ -2643,24 +2623,6 @@ bool PluginManager::GetConfig(const wxString & key, double & value, double defva return result; } -bool PluginManager::GetConfig(const wxString & key, sampleCount & value, sampleCount defval) -{ - bool result = false; - - if (!key.IsEmpty()) - { - wxString wxval = wxEmptyString; - wxString wxdef; - wchar_t *endptr; - wxdef.Printf(wxT("%Ld"), defval); - - result = GetSettings()->Read(key, &wxval, wxdef); - value = wxStrtoll(wxval.c_str(), &endptr, 10); - } - - return result; -} - bool PluginManager::SetConfig(const wxString & key, const wxString & value) { bool result = false; @@ -2742,22 +2704,6 @@ bool PluginManager::SetConfig(const wxString & key, const double & value) return result; } -bool PluginManager::SetConfig(const wxString & key, const sampleCount & value) -{ - bool result = false; - - if (!key.IsEmpty()) - { - result = GetSettings()->Write(key, wxString::Format(wxT("%d"), (int) value)); - if (result) - { - result = GetSettings()->Flush(); - } - } - - return result; -} - wxString PluginManager::SettingsPath(const PluginID & ID, bool shared) { if (mPlugins.find(ID) == mPlugins.end()) diff --git a/src/PluginManager.h b/src/PluginManager.h index ecdab8f15..cf07c9d23 100644 --- a/src/PluginManager.h +++ b/src/PluginManager.h @@ -195,14 +195,12 @@ public: bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) override; bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) override; bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) override; - bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override; bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) override; bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) override; bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) override; bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) override; bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) override; - bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) override; bool RemoveSharedConfigSubgroup(const PluginID & ID, const wxString & group) override; bool RemoveSharedConfig(const PluginID & ID, const wxString & group, const wxString & key) override; @@ -215,14 +213,12 @@ public: bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) override; bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) override; bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) override; - bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override; bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) override; bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) override; bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) override; bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) override; bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) override; - bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) override; bool RemovePrivateConfigSubgroup(const PluginID & ID, const wxString & group) override; bool RemovePrivateConfig(const PluginID & ID, const wxString & group, const wxString & key) override; @@ -289,14 +285,12 @@ private: bool GetConfig(const wxString & key, bool & value, bool defval = false); bool GetConfig(const wxString & key, float & value, float defval = 0.0); bool GetConfig(const wxString & key, double & value, double defval = 0.0); - bool GetConfig(const wxString & key, sampleCount & value, sampleCount defval = 0); bool SetConfig(const wxString & key, const wxString & value); bool SetConfig(const wxString & key, const int & value); bool SetConfig(const wxString & key, const bool & value); bool SetConfig(const wxString & key, const float & value); bool SetConfig(const wxString & key, const double & value); - bool SetConfig(const wxString & key, const sampleCount & value); wxString SettingsPath(const PluginID & ID, bool shared); wxString SharedGroup(const PluginID & ID, const wxString & group); diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 70e1070b8..42653198a 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -847,11 +847,6 @@ bool Effect::GetSharedConfig(const wxString & group, const wxString & key, doubl return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval); } -bool Effect::GetSharedConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) -{ - return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval); -} - bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const wxString & value) { return PluginManager::Get().SetSharedConfig(GetID(), group, key, value); @@ -877,11 +872,6 @@ bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const return PluginManager::Get().SetSharedConfig(GetID(), group, key, value); } -bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const sampleCount & value) -{ - return PluginManager::Get().SetSharedConfig(GetID(), group, key, value); -} - bool Effect::RemoveSharedConfigSubgroup(const wxString & group) { return PluginManager::Get().RemoveSharedConfigSubgroup(GetID(), group); @@ -927,11 +917,6 @@ bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, doub return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval); } -bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) -{ - return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval); -} - bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value) { return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value); @@ -957,11 +942,6 @@ bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, cons return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value); } -bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const sampleCount & value) -{ - return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value); -} - bool Effect::RemovePrivateConfigSubgroup(const wxString & group) { return PluginManager::Get().RemovePrivateConfigSubgroup(GetID(), group); diff --git a/src/effects/Effect.h b/src/effects/Effect.h index 9debae0ca..38a078e47 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -182,14 +182,12 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler, bool GetSharedConfig(const wxString & group, const wxString & key, bool & value, bool defval = false) override; bool GetSharedConfig(const wxString & group, const wxString & key, float & value, float defval = 0.0) override; bool GetSharedConfig(const wxString & group, const wxString & key, double & value, double defval = 0.0) override; - bool GetSharedConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override; bool SetSharedConfig(const wxString & group, const wxString & key, const wxString & value) override; bool SetSharedConfig(const wxString & group, const wxString & key, const int & value) override; bool SetSharedConfig(const wxString & group, const wxString & key, const bool & value) override; bool SetSharedConfig(const wxString & group, const wxString & key, const float & value) override; bool SetSharedConfig(const wxString & group, const wxString & key, const double & value) override; - bool SetSharedConfig(const wxString & group, const wxString & key, const sampleCount & value) override; bool RemoveSharedConfigSubgroup(const wxString & group) override; bool RemoveSharedConfig(const wxString & group, const wxString & key) override; @@ -202,14 +200,12 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler, bool GetPrivateConfig(const wxString & group, const wxString & key, bool & value, bool defval = false) override; bool GetPrivateConfig(const wxString & group, const wxString & key, float & value, float defval = 0.0) override; bool GetPrivateConfig(const wxString & group, const wxString & key, double & value, double defval = 0.0) override; - bool GetPrivateConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override; bool SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value) override; bool SetPrivateConfig(const wxString & group, const wxString & key, const int & value) override; bool SetPrivateConfig(const wxString & group, const wxString & key, const bool & value) override; bool SetPrivateConfig(const wxString & group, const wxString & key, const float & value) override; bool SetPrivateConfig(const wxString & group, const wxString & key, const double & value) override; - bool SetPrivateConfig(const wxString & group, const wxString & key, const sampleCount & value) override; bool RemovePrivateConfigSubgroup(const wxString & group) override; bool RemovePrivateConfig(const wxString & group, const wxString & key) override; diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 3adf8a6b8..5fe36fb5c 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -1085,14 +1085,12 @@ VSTEffect::VSTEffect(const wxString & path, VSTEffect *master) mMidiIns = 0; mMidiOuts = 0; mSampleRate = 44100; - mBlockSize = 0; + mBlockSize = mUserBlockSize = 8192; mBufferDelay = 0; mProcessLevel = 1; // in GUI thread mHasPower = false; mWantsIdle = false; mWantsEditIdle = false; - mUserBlockSize = 8192; - mBlockSize = mUserBlockSize; mUseLatency = true; mReady = false; @@ -1330,15 +1328,7 @@ int VSTEffect::GetMidiOutCount() sampleCount VSTEffect::SetBlockSize(sampleCount maxBlockSize) { - if (mUserBlockSize > maxBlockSize) - { - mBlockSize = maxBlockSize; - } - else - { - mBlockSize = mUserBlockSize; - } - + mBlockSize = std::min((int)maxBlockSize, mUserBlockSize); return mBlockSize; } diff --git a/src/effects/VST/VSTEffect.h b/src/effects/VST/VSTEffect.h index 6bae149ce..109cf99ad 100644 --- a/src/effects/VST/VSTEffect.h +++ b/src/effects/VST/VSTEffect.h @@ -268,7 +268,7 @@ private: int mMidiOuts; bool mAutomatable; float mSampleRate; - sampleCount mUserBlockSize; + int mUserBlockSize; wxString mName; wxString mVendor; wxString mDescription; @@ -313,7 +313,7 @@ private: bool mUseLatency; int mBufferDelay; - sampleCount mBlockSize; + int mBlockSize; int mProcessLevel; bool mHasPower; From a1d930322c4c118054a6c2e95e32b50fbd46c4bc Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 20 Aug 2016 20:58:13 -0400 Subject: [PATCH 5/9] Rewrite Sequence::FindBlock using size_t variables for indices --- src/Sequence.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Sequence.cpp b/src/Sequence.cpp index ebb5b9621..fd2c662c7 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -1051,16 +1051,15 @@ int Sequence::FindBlock(sampleCount pos) const int numBlocks = mBlock.size(); - sampleCount lo = 0, loSamples = 0; - sampleCount hi = numBlocks, hiSamples = mNumSamples; - sampleCount guess; + size_t lo = 0, hi = numBlocks, guess; + sampleCount loSamples = 0, hiSamples = mNumSamples; while (true) { //this is not a binary search, but a //dictionary search where we guess something smarter than the binary division //of the unsearched area, since samples are usually proportional to block file number. const double frac = double(pos - loSamples) / (hiSamples - loSamples); - guess = std::min(hi - 1, lo + sampleCount(frac * (hi - lo))); + guess = std::min(hi - 1, lo + size_t(frac * (hi - lo))); const SeqBlock &block = mBlock[guess]; wxASSERT(block.f->GetLength() > 0); From 0c4c835b2722d074d60aab5f427eb958d894b537 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 17 Aug 2016 17:27:48 -0400 Subject: [PATCH 6/9] Write and read the wide aliasStart fields carefully... ...They may never have been large enough to matter, but some seek offsets into files were written as 64 bits but read back as only 32. It ought to be consistent. --- src/Legacy.cpp | 3 +++ src/blockfile/LegacyAliasBlockFile.cpp | 14 ++++++++++---- src/blockfile/ODDecodeBlockFile.cpp | 14 ++++++++++---- src/blockfile/ODPCMAliasBlockFile.cpp | 14 ++++++++++---- src/blockfile/PCMAliasBlockFile.cpp | 14 ++++++++++---- 5 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/Legacy.cpp b/src/Legacy.cpp index 4e2792e73..88abd17cb 100644 --- a/src/Legacy.cpp +++ b/src/Legacy.cpp @@ -206,7 +206,10 @@ static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile) xmlFile.WriteAttr(wxT("name"), localName); xmlFile.WriteAttr(wxT("alias"), 1); xmlFile.WriteAttr(wxT("aliaspath"), aliasPath); + + // This was written but not read again? xmlFile.WriteAttr(wxT("aliasstart"), aliasStart); + xmlFile.WriteAttr(wxT("aliaslen"), aliasLen); xmlFile.WriteAttr(wxT("aliaschannel"), aliasChannel); xmlFile.WriteAttr(wxT("summarylen"), localLen); diff --git a/src/blockfile/LegacyAliasBlockFile.cpp b/src/blockfile/LegacyAliasBlockFile.cpp index 280f36295..beb9d0d6e 100644 --- a/src/blockfile/LegacyAliasBlockFile.cpp +++ b/src/blockfile/LegacyAliasBlockFile.cpp @@ -68,7 +68,8 @@ void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.WriteAttr(wxT("alias"), 1); xmlFile.WriteAttr(wxT("name"), mFileName.GetFullName()); xmlFile.WriteAttr(wxT("aliaspath"), mAliasedFileName.GetFullPath()); - xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart); + xmlFile.WriteAttr(wxT("aliasstart"), + static_cast( mAliasStart )); xmlFile.WriteAttr(wxT("aliaslen"), mLen); xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel); xmlFile.WriteAttr(wxT("summarylen"), mSummaryInfo.totalSummaryBytes); @@ -89,6 +90,7 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w int summaryLen=0; bool noRMS = false; long nValue; + long long nnValue; while(*attrs) { @@ -116,11 +118,15 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w // but we want to keep the reference to the missing file because it's a good path string. aliasFileName.Assign(strValue); } + else if ( !wxStricmp(attr, wxT("aliasstart")) ) + { + if (XMLValueChecker::IsGoodInt64(strValue) && + strValue.ToLongLong(&nnValue) && (nnValue >= 0)) + aliasStart = nnValue; + } else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters - if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) - aliasStart = nValue; - else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) + if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) aliasLen = nValue; else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel)) aliasChannel = nValue; diff --git a/src/blockfile/ODDecodeBlockFile.cpp b/src/blockfile/ODDecodeBlockFile.cpp index a00b04f23..3c86c0439 100644 --- a/src/blockfile/ODDecodeBlockFile.cpp +++ b/src/blockfile/ODDecodeBlockFile.cpp @@ -207,7 +207,8 @@ void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile) mFileNameMutex.Unlock(); LockRead(); xmlFile.WriteAttr(wxT("audiofile"), mAudioFileName.GetFullPath()); - xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart); + xmlFile.WriteAttr(wxT("aliasstart"), + static_cast( mAliasStart )); xmlFile.WriteAttr(wxT("aliaslen"), mLen); xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel); xmlFile.WriteAttr(wxT("decodetype"), (size_t)mType); @@ -229,6 +230,7 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr sampleCount aliasStart=0, aliasLen=0; int aliasChannel=0; long nValue; + long long nnValue; unsigned int decodeType=0; while(*attrs) @@ -261,11 +263,15 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr // but we want to keep the reference to the file because it's a good path string. audioFileName.Assign(strValue); } + else if ( !wxStricmp(attr, wxT("aliasstart")) ) + { + if (XMLValueChecker::IsGoodInt64(strValue) && + strValue.ToLongLong(&nnValue) && (nnValue >= 0)) + aliasStart = nnValue; + } else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters - if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) - aliasStart = nValue; - else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) + if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) aliasLen = nValue; else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel)) aliasChannel = nValue; diff --git a/src/blockfile/ODPCMAliasBlockFile.cpp b/src/blockfile/ODPCMAliasBlockFile.cpp index 87cdb705d..2f7500494 100644 --- a/src/blockfile/ODPCMAliasBlockFile.cpp +++ b/src/blockfile/ODPCMAliasBlockFile.cpp @@ -247,7 +247,8 @@ void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile) LockRead(); xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath()); - xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart); + xmlFile.WriteAttr(wxT("aliasstart"), + static_cast( mAliasStart)); xmlFile.WriteAttr(wxT("aliaslen"), mLen); xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel); @@ -269,6 +270,7 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at sampleCount aliasStart=0, aliasLen=0; int aliasChannel=0; long nValue; + long long nnValue; while(*attrs) { @@ -300,11 +302,15 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at // but we want to keep the reference to the missing file because it's a good path string. aliasFileName.Assign(strValue); } + else if ( !wxStricmp(attr, wxT("aliasstart")) ) + { + if (XMLValueChecker::IsGoodInt64(strValue) && + strValue.ToLongLong(&nnValue) && (nnValue >= 0)) + aliasStart = nnValue; + } else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters - if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) - aliasStart = nValue; - else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) + if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) aliasLen = nValue; else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel)) aliasChannel = nValue; diff --git a/src/blockfile/PCMAliasBlockFile.cpp b/src/blockfile/PCMAliasBlockFile.cpp index 0a1765b3f..e30e8dbb2 100644 --- a/src/blockfile/PCMAliasBlockFile.cpp +++ b/src/blockfile/PCMAliasBlockFile.cpp @@ -165,7 +165,8 @@ void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile) xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName()); xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath()); - xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart); + xmlFile.WriteAttr(wxT("aliasstart"), + static_cast( mAliasStart )); xmlFile.WriteAttr(wxT("aliaslen"), mLen); xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel); xmlFile.WriteAttr(wxT("min"), mMin); @@ -186,6 +187,7 @@ BlockFilePtr PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr float min = 0.0f, max = 0.0f, rms = 0.0f; double dblValue; long nValue; + long long nnValue; while(*attrs) { @@ -217,11 +219,15 @@ BlockFilePtr PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr // but we want to keep the reference to the missing file because it's a good path string. aliasFileName.Assign(strValue); } + else if ( !wxStricmp(attr, wxT("aliasstart")) ) + { + if (XMLValueChecker::IsGoodInt64(strValue) && + strValue.ToLongLong(&nnValue) && (nnValue >= 0)) + aliasStart = nnValue; + } else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) { // integer parameters - if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0)) - aliasStart = nValue; - else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) + if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0)) aliasLen = nValue; else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel)) aliasChannel = nValue; From 5cf331ae8c8a27d4d5c891d912671b6446059998 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 20 Aug 2016 17:56:41 -0400 Subject: [PATCH 7/9] Rewrite WaveTrack::GetEnvelopeValues, taking one less argument... ... In practice this argument was always 1 / rate so it was superfluous. Also make the buffer size argument unsigned. --- src/Mix.cpp | 12 ++++++------ src/WaveTrack.cpp | 28 +++++++++++++--------------- src/WaveTrack.h | 4 ++-- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/Mix.cpp b/src/Mix.cpp index 329afc81d..638808b16 100644 --- a/src/Mix.cpp +++ b/src/Mix.cpp @@ -460,8 +460,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache, track->GetEnvelopeValues(mEnvValues, getLen, - (*pos - (getLen- 1)) / trackRate, - tstep); + (*pos - (getLen- 1)) / trackRate); *pos -= getLen; } @@ -471,8 +470,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache, track->GetEnvelopeValues(mEnvValues, getLen, - (*pos) / trackRate, - tstep); + (*pos) / trackRate); *pos += getLen; } @@ -584,10 +582,12 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache, if (slen > mMaxOut) slen = mMaxOut; + wxASSERT(slen >= 0); + if (backwards) { auto results = cache.Get(floatSample, *pos - (slen - 1), slen); memcpy(mFloatBuffer, results, sizeof(float) * slen); - track->GetEnvelopeValues(mEnvValues, slen, t - (slen - 1) / mRate, 1.0 / mRate); + track->GetEnvelopeValues(mEnvValues, slen, t - (slen - 1) / mRate); for(int i=0; iGetEnvelopeValues(mEnvValues, slen, t, 1.0 / mRate); + track->GetEnvelopeValues(mEnvValues, slen, t); for(int i=0; iGetStartTime(); - double dClipEndTime = clip->GetEndTime(); + auto dClipStartTime = clip->GetStartTime(); + auto dClipEndTime = clip->GetEndTime(); if ((dClipStartTime < endTime) && (dClipEndTime > startTime)) { - double* rbuf = buffer; - int rlen = bufferLen; - double rt0 = t0; + auto rbuf = buffer; + auto rlen = bufferLen; + auto rt0 = t0; if (rt0 < dClipStartTime) { sampleCount nDiff = (sampleCount)floor((dClipStartTime - rt0) * mRate + 0.5); rbuf += nDiff; + wxASSERT(nDiff <= rlen); rlen -= nDiff; rt0 = dClipStartTime; } if (rt0 + rlen*tstep > dClipEndTime) { - int nClipLen = clip->GetEndSample() - clip->GetStartSample(); + auto nClipLen = clip->GetEndSample() - clip->GetStartSample(); if (nClipLen <= 0) // Testing for bug 641, this problem is consistently '== 0', but doesn't hurt to check <. return; @@ -2151,8 +2149,8 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen, // This conditional prevents the previous write past the buffer end, in clip->GetEnvelope() call. // Never increase rlen here. // PRL bug 827: rewrote it again - rlen = std::min(rlen, nClipLen); - rlen = std::min(rlen, int(floor(0.5 + (dClipEndTime - rt0) / tstep))); + rlen = static_cast( std::min(sampleCount( rlen ), nClipLen) ); + rlen = std::min(rlen, size_t(floor(0.5 + (dClipEndTime - rt0) / tstep))); } clip->GetEnvelope()->GetValues(rbuf, rlen, rt0, tstep); } diff --git a/src/WaveTrack.h b/src/WaveTrack.h index ad35eaa98..88ff55adf 100644 --- a/src/WaveTrack.h +++ b/src/WaveTrack.h @@ -239,8 +239,8 @@ class AUDACITY_DLL_API WaveTrack final : public Track { sampleCount start, sampleCount len, fillFormat fill=fillZero) const; bool Set(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len); - void GetEnvelopeValues(double *buffer, int bufferLen, - double t0, double tstep) const; + void GetEnvelopeValues(double *buffer, size_t bufferLen, + double t0) const; bool GetMinMax(float *min, float *max, double t0, double t1) const; bool GetRMS(float *rms, double t0, double t1); From 56586770e0d8d027ba2651fd24de9ac62984af3f Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 20 Aug 2016 18:10:36 -0400 Subject: [PATCH 8/9] EffectClientInterface::SetSampleRate takes double... ... All the overrides (except Ladspa) were casting it to floating poing anyway --- include/audacity/EffectInterface.h | 2 +- src/effects/Effect.cpp | 2 +- src/effects/Effect.h | 2 +- src/effects/VST/VSTEffect.cpp | 2 +- src/effects/VST/VSTEffect.h | 2 +- src/effects/audiounits/AudioUnitEffect.cpp | 2 +- src/effects/audiounits/AudioUnitEffect.h | 2 +- src/effects/ladspa/LadspaEffect.cpp | 2 +- src/effects/ladspa/LadspaEffect.h | 2 +- src/effects/lv2/LV2Effect.cpp | 2 +- src/effects/lv2/LV2Effect.h | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/audacity/EffectInterface.h b/include/audacity/EffectInterface.h index 15c1a5033..e2e85993c 100755 --- a/include/audacity/EffectInterface.h +++ b/include/audacity/EffectInterface.h @@ -123,7 +123,7 @@ public: virtual int GetMidiInCount() = 0; virtual int GetMidiOutCount() = 0; - virtual void SetSampleRate(sampleCount rate) = 0; + virtual void SetSampleRate(double rate) = 0; virtual sampleCount SetBlockSize(sampleCount maxBlockSize) = 0; virtual sampleCount GetLatency() = 0; diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 42653198a..50c23c9ca 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -325,7 +325,7 @@ int Effect::GetMidiOutCount() return 0; } -void Effect::SetSampleRate(sampleCount rate) +void Effect::SetSampleRate(double rate) { if (mClient) { diff --git a/src/effects/Effect.h b/src/effects/Effect.h index 38a078e47..f8a10b5e1 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -106,7 +106,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler, sampleCount GetLatency() override; sampleCount GetTailSize() override; - void SetSampleRate(sampleCount rate) override; + void SetSampleRate(double rate) override; sampleCount SetBlockSize(sampleCount maxBlockSize) override; bool IsReady() override; diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 5fe36fb5c..1bcd78aa8 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -1332,7 +1332,7 @@ sampleCount VSTEffect::SetBlockSize(sampleCount maxBlockSize) return mBlockSize; } -void VSTEffect::SetSampleRate(sampleCount rate) +void VSTEffect::SetSampleRate(double rate) { mSampleRate = (float) rate; } diff --git a/src/effects/VST/VSTEffect.h b/src/effects/VST/VSTEffect.h index 109cf99ad..7bcb344b6 100644 --- a/src/effects/VST/VSTEffect.h +++ b/src/effects/VST/VSTEffect.h @@ -108,7 +108,7 @@ class VSTEffect final : public wxEvtHandler, sampleCount GetLatency() override; sampleCount GetTailSize() override; - void SetSampleRate(sampleCount rate) override; + void SetSampleRate(double rate) override; sampleCount SetBlockSize(sampleCount maxBlockSize) override; bool IsReady() override; diff --git a/src/effects/audiounits/AudioUnitEffect.cpp b/src/effects/audiounits/AudioUnitEffect.cpp index 170f94707..99b6c4d5b 100644 --- a/src/effects/audiounits/AudioUnitEffect.cpp +++ b/src/effects/audiounits/AudioUnitEffect.cpp @@ -1187,7 +1187,7 @@ int AudioUnitEffect::GetMidiOutCount() return 0; } -void AudioUnitEffect::SetSampleRate(sampleCount rate) +void AudioUnitEffect::SetSampleRate(double rate) { mSampleRate = rate; } diff --git a/src/effects/audiounits/AudioUnitEffect.h b/src/effects/audiounits/AudioUnitEffect.h index de311fbec..44c5daeb6 100644 --- a/src/effects/audiounits/AudioUnitEffect.h +++ b/src/effects/audiounits/AudioUnitEffect.h @@ -78,7 +78,7 @@ public: int GetMidiInCount() override; int GetMidiOutCount() override; - void SetSampleRate(sampleCount rate) override; + void SetSampleRate(double rate) override; sampleCount SetBlockSize(sampleCount maxBlockSize) override; sampleCount GetLatency() override; diff --git a/src/effects/ladspa/LadspaEffect.cpp b/src/effects/ladspa/LadspaEffect.cpp index 91a7927c6..21bb485b3 100644 --- a/src/effects/ladspa/LadspaEffect.cpp +++ b/src/effects/ladspa/LadspaEffect.cpp @@ -886,7 +886,7 @@ int LadspaEffect::GetMidiOutCount() return 0; } -void LadspaEffect::SetSampleRate(sampleCount rate) +void LadspaEffect::SetSampleRate(double rate) { mSampleRate = rate; } diff --git a/src/effects/ladspa/LadspaEffect.h b/src/effects/ladspa/LadspaEffect.h index fd867d107..c8bb75dbc 100644 --- a/src/effects/ladspa/LadspaEffect.h +++ b/src/effects/ladspa/LadspaEffect.h @@ -73,7 +73,7 @@ public: int GetMidiInCount() override; int GetMidiOutCount() override; - void SetSampleRate(sampleCount rate) override; + void SetSampleRate(double rate) override; sampleCount SetBlockSize(sampleCount maxBlockSize) override; sampleCount GetLatency() override; diff --git a/src/effects/lv2/LV2Effect.cpp b/src/effects/lv2/LV2Effect.cpp index 64bd0561f..336d5265d 100644 --- a/src/effects/lv2/LV2Effect.cpp +++ b/src/effects/lv2/LV2Effect.cpp @@ -722,7 +722,7 @@ int LV2Effect::GetMidiOutCount() return 0; } -void LV2Effect::SetSampleRate(sampleCount rate) +void LV2Effect::SetSampleRate(double rate) { mSampleRate = (double) rate; diff --git a/src/effects/lv2/LV2Effect.h b/src/effects/lv2/LV2Effect.h index 9b122f1a1..100230979 100644 --- a/src/effects/lv2/LV2Effect.h +++ b/src/effects/lv2/LV2Effect.h @@ -128,7 +128,7 @@ public: int GetMidiInCount() override; int GetMidiOutCount() override; - void SetSampleRate(sampleCount rate) override; + void SetSampleRate(double rate) override; sampleCount SetBlockSize(sampleCount maxBlockSize) override; sampleCount GetLatency() override; From 2969336258f5f4d640a401c9938a2194c42c5e5c Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 20 Aug 2016 18:15:20 -0400 Subject: [PATCH 9/9] Fix bug in update of progress in CompareAudioCommand --- src/commands/CompareAudioCommand.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/CompareAudioCommand.cpp b/src/commands/CompareAudioCommand.cpp index d7e3e35e4..5e78002d9 100644 --- a/src/commands/CompareAudioCommand.cpp +++ b/src/commands/CompareAudioCommand.cpp @@ -128,7 +128,7 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context) } position += block; - Progress((position - mT0) / length); + Progress((position - s0) / length); } delete [] buff0;