From 49e699b1df37f48704ca68101965468d3079fae6 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 19 Aug 2016 13:18:48 -0400 Subject: [PATCH] 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;