mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-27 07:40:10 +01:00
Rename project in many places; Replace Most Project Logos; Refactor About Tenacity... Dialog (#276)
Add `locale/en.po` file. Add English to `locale/LINGUAS` list. Partially duplicate `msgid`s to `msgstr`s in English locale enable eventual key `msgid` changes Replace former project name with Tenacity in English locale. Replace former project website with Tenacity compatible usages in English locale. Modify `AboutDialog.h` by renaming variables. Modify `AboutDialog.cpp` by replacing usage of pre-fork name in Strings. Modify AddBuildInfoRow methods to be static in About dialog. Make License text const in About dialog. Make pre-fork credits different in About dialog. Begin adding Tenacity specific credits Macros starting with `__` are reserved, so I removed the `__` on the About Dialog guard macro. Remove `AboutDialog::` from usage of `Role` in `AboutDialog.h` Refactor overly long generator method into separate methods in `AboutDialog.(h|cpp)` Begin adding Tenacity developer information Cleanup layout of `AboutDialog.h` and `AboutDialog.cpp` Add `safedelete` macro to compliment odd `safenew` macro Add `enum` to `ShuttleGui.cpp` to make it more clear what `Prop` method is doing. Remove a ton of pointless and/or redunant `#ifdef` usage Remove pointless singleton in AboutDialog Make AboutDialog modal on MacOS Fix reference type use of `auto` in `AudacityApp` b/c it makes unintentional copy. Update XPM and PNG images using Tenacity assets Update ICO images using Tenacity assets. Fix Windows resource script that improperly used `winuser.h` import. Add `*.aps` to gitignore to prevent IDE RC pre-load file from being committed. Add default values for pre-processor constants in `tenacity.rc`. Make changes needed for `Tenacity.exe` binary Add 8x8 PNG to Windows ICO files Replace project name in various CMake and CPack file. Replace project name in various directory structures. Replace project name in various OS-specific build files. Replace project name in various documentation files. Update the PO and POT files using the script. Fix places where a `.desktop` file was used on Linux. Replace title of project windows. Make splash screen click through to `tenacityaudio.org`. Remove ® from `AboutDialog.cpp` Modify copyright message in `AboutDialog.cpp` Signed-off-by: Emily Mabrey <emilymabrey93@gmail.com>
This commit is contained in:
88
include/tenacity/ComponentInterface.h
Normal file
88
include/tenacity/ComponentInterface.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ComponentInterface.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Copyright (c) 2014, Audacity Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_COMPONENT_INTERFACE_H__
|
||||
#define __AUDACITY_COMPONENT_INTERFACE_H__
|
||||
|
||||
#include "Identifier.h"
|
||||
#include "tenacity/Types.h"
|
||||
#include <wx/string.h> // member variables
|
||||
|
||||
class ComponentInterfaceSymbol;
|
||||
using VendorSymbol = ComponentInterfaceSymbol;
|
||||
|
||||
class ShuttleParams;
|
||||
|
||||
/**************************************************************************//**
|
||||
|
||||
\brief ComponentInterface provides name / vendor / version functions to identify
|
||||
plugins. It is what makes a class a plug-in. Additionally it provides an
|
||||
optional parameter definitions function, for those components such as commands,
|
||||
effects and (soon) preference pagess that define parameters.
|
||||
********************************************************************************/
|
||||
class AUDACITY_DLL_API ComponentInterface /* not final */
|
||||
{
|
||||
public:
|
||||
virtual ~ComponentInterface() {};
|
||||
|
||||
// These should return an untranslated value
|
||||
virtual PluginPath GetPath() = 0;
|
||||
|
||||
// The internal string persists in configuration files
|
||||
// So config compatibility will break if it is changed across Audacity versions
|
||||
virtual ComponentInterfaceSymbol GetSymbol() = 0;
|
||||
|
||||
virtual VendorSymbol GetVendor() = 0;
|
||||
|
||||
virtual wxString GetVersion() = 0;
|
||||
|
||||
// This returns a translated string
|
||||
// Any verb should be present tense indicative, not imperative
|
||||
virtual TranslatableString GetDescription() = 0;
|
||||
|
||||
// non-virtual convenience function
|
||||
TranslatableString GetName();
|
||||
|
||||
// Parameters, if defined. false means no defined parameters.
|
||||
virtual bool DefineParams( ShuttleParams & WXUNUSED(S) ){ return false;};
|
||||
};
|
||||
|
||||
#endif // __AUDACITY_IDENTINTERFACE_H__
|
||||
98
include/tenacity/ConfigInterface.h
Normal file
98
include/tenacity/ConfigInterface.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ConfigInterface.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Copyright (c) 2014, Audacity Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_CONFIGINTERFACE_H__
|
||||
#define __AUDACITY_CONFIGINTERFACE_H__
|
||||
|
||||
#include "Identifier.h"
|
||||
|
||||
/*************************************************************************************//**
|
||||
|
||||
\class ConfigClientInterface
|
||||
|
||||
\brief ConfigClientInterface is an unholy get/set configuration class, which
|
||||
differentiates between private and shared config. It should probably be replaced
|
||||
with a Shuttle.
|
||||
|
||||
*******************************************************************************************/
|
||||
class AUDACITY_DLL_API ConfigClientInterface /* not final */
|
||||
{
|
||||
public:
|
||||
virtual ~ConfigClientInterface() {};
|
||||
|
||||
virtual bool HasSharedConfigGroup(const RegistryPath & group) = 0;
|
||||
virtual bool GetSharedConfigSubgroups(const RegistryPath & group, RegistryPaths & subgroups) = 0;
|
||||
|
||||
virtual bool GetSharedConfig(const RegistryPath & group, const RegistryPath & key, wxString & value, const wxString & defval) = 0;
|
||||
virtual bool GetSharedConfig(const RegistryPath & group, const RegistryPath & key, int & value, int defval) = 0;
|
||||
virtual bool GetSharedConfig(const RegistryPath & group, const RegistryPath & key, bool & value, bool defval) = 0;
|
||||
virtual bool GetSharedConfig(const RegistryPath & group, const RegistryPath & key, float & value, float defval) = 0;
|
||||
virtual bool GetSharedConfig(const RegistryPath & group, const RegistryPath & key, double & value, double defval) = 0;
|
||||
|
||||
virtual bool SetSharedConfig(const RegistryPath & group, const RegistryPath & key, const wxString & value) = 0;
|
||||
virtual bool SetSharedConfig(const RegistryPath & group, const RegistryPath & key, const int & value) = 0;
|
||||
virtual bool SetSharedConfig(const RegistryPath & group, const RegistryPath & key, const bool & value) = 0;
|
||||
virtual bool SetSharedConfig(const RegistryPath & group, const RegistryPath & key, const float & value) = 0;
|
||||
virtual bool SetSharedConfig(const RegistryPath & group, const RegistryPath & key, const double & value) = 0;
|
||||
|
||||
virtual bool RemoveSharedConfigSubgroup(const RegistryPath & group) = 0;
|
||||
virtual bool RemoveSharedConfig(const RegistryPath & group, const RegistryPath & key) = 0;
|
||||
|
||||
virtual bool HasPrivateConfigGroup(const RegistryPath & group) = 0;
|
||||
virtual bool GetPrivateConfigSubgroups(const RegistryPath & group, RegistryPaths &subgroups) = 0;
|
||||
|
||||
virtual bool GetPrivateConfig(const RegistryPath & group, const RegistryPath & key, wxString & value, const wxString & defval) = 0;
|
||||
virtual bool GetPrivateConfig(const RegistryPath & group, const RegistryPath & key, int & value, int defval) = 0;
|
||||
virtual bool GetPrivateConfig(const RegistryPath & group, const RegistryPath & key, bool & value, bool defval) = 0;
|
||||
virtual bool GetPrivateConfig(const RegistryPath & group, const RegistryPath & key, float & value, float defval) = 0;
|
||||
virtual bool GetPrivateConfig(const RegistryPath & group, const RegistryPath & key, double & value, double defval) = 0;
|
||||
|
||||
virtual bool SetPrivateConfig(const RegistryPath & group, const RegistryPath & key, const wxString & value) = 0;
|
||||
virtual bool SetPrivateConfig(const RegistryPath & group, const RegistryPath & key, const int & value) = 0;
|
||||
virtual bool SetPrivateConfig(const RegistryPath & group, const RegistryPath & key, const bool & value) = 0;
|
||||
virtual bool SetPrivateConfig(const RegistryPath & group, const RegistryPath & key, const float & value) = 0;
|
||||
virtual bool SetPrivateConfig(const RegistryPath & group, const RegistryPath & key, const double & value) = 0;
|
||||
|
||||
virtual bool RemovePrivateConfigSubgroup(const RegistryPath & group) = 0;
|
||||
virtual bool RemovePrivateConfig(const RegistryPath & group, const RegistryPath & key) = 0;
|
||||
};
|
||||
|
||||
#endif // __AUDACITY_CONFIGINTERFACE_H__
|
||||
342
include/tenacity/EffectAutomationParameters.h
Normal file
342
include/tenacity/EffectAutomationParameters.h
Normal file
@@ -0,0 +1,342 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
EffectAutomationParameters.h
|
||||
(defining CommandParameters)
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Copyright (c) 2014, Audacity Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_COMMAND_PARAMETERS_H__
|
||||
#define __AUDACITY_COMMAND_PARAMETERS_H__
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <wx/cmdline.h> // for wxCmdLineParser::ConvertStringToArgs
|
||||
#include <wx/fileconf.h> // to inherit
|
||||
#include <algorithm>
|
||||
|
||||
#include "ComponentInterface.h"
|
||||
#include "ComponentInterfaceSymbol.h"
|
||||
|
||||
|
||||
/**
|
||||
\brief CommandParameters, derived from wxFileConfig, is essentially doing
|
||||
the same things as the Shuttle classes. It does text <-> binary conversions of
|
||||
parameters. It does not seem to be using actual file read/writing.
|
||||
|
||||
Should it be converted to using Shuttle? Probably yes. Shuttle leads to shorter code.
|
||||
And Shuttle is more multi-functional since Shuttle can report on signature, do the work of
|
||||
wxWidget validators, and can create default dialogs. However until that conversion is
|
||||
done, we need this class, and we use a pointer to one from within a Shuttle when interfacing
|
||||
with the code that still uses it.
|
||||
*/
|
||||
class CommandParameters final : public wxFileConfig
|
||||
{
|
||||
public:
|
||||
CommandParameters(const wxString & parms = {})
|
||||
: wxFileConfig(wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
0)
|
||||
{
|
||||
SetExpandEnvVars(false);
|
||||
SetParameters(parms);
|
||||
}
|
||||
|
||||
virtual ~CommandParameters()
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool HasGroup(const wxString & strName) const override
|
||||
{
|
||||
return wxFileConfig::HasGroup(NormalizeName(strName));
|
||||
}
|
||||
|
||||
virtual bool HasEntry(const wxString& strName) const override
|
||||
{
|
||||
return wxFileConfig::HasEntry(NormalizeName(strName));
|
||||
}
|
||||
|
||||
virtual bool DoReadString(const wxString & key, wxString *pStr) const override
|
||||
{
|
||||
return wxFileConfig::DoReadString(NormalizeName(key), pStr);
|
||||
}
|
||||
|
||||
virtual bool DoReadLong(const wxString & key, long *pl) const override
|
||||
{
|
||||
return wxFileConfig::DoReadLong(NormalizeName(key), pl);
|
||||
}
|
||||
|
||||
virtual bool DoReadDouble(const wxString & key, double *pd) const override
|
||||
{
|
||||
wxString str;
|
||||
if (Read(key, &str))
|
||||
{
|
||||
struct lconv *info = localeconv();
|
||||
wxString dec =
|
||||
info ? wxString::FromUTF8(info->decimal_point) : wxString(".");
|
||||
|
||||
str.Replace(wxT(","), dec);
|
||||
str.Replace(wxT("."), dec);
|
||||
|
||||
return str.ToDouble(pd);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool DoWriteString(const wxString & key, const wxString & szValue) override
|
||||
{
|
||||
return wxFileConfig::DoWriteString(NormalizeName(key), szValue);
|
||||
}
|
||||
|
||||
virtual bool DoWriteLong(const wxString & key, long lValue) override
|
||||
{
|
||||
return wxFileConfig::DoWriteLong(NormalizeName(key), lValue);
|
||||
}
|
||||
|
||||
virtual bool DoWriteDouble(const wxString & key, double value) override
|
||||
{
|
||||
return DoWriteString(key, wxString::Format(wxT("%.8g"), value));
|
||||
}
|
||||
|
||||
bool ReadFloat(const wxString & key, float *pf) const
|
||||
{
|
||||
double d = *pf;
|
||||
bool success = Read(key, &d);
|
||||
if (success)
|
||||
{
|
||||
*pf = (float) d;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ReadFloat(const wxString & key, float *pf, float defVal) const
|
||||
{
|
||||
if (!ReadFloat(key, pf))
|
||||
{
|
||||
*pf = defVal;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WriteFloat(const wxString & key, float f)
|
||||
{
|
||||
return Write(key, f);
|
||||
}
|
||||
|
||||
// For reading old config files with enumeration names that have been
|
||||
// changed in later versions. Pair a string with an index into the other
|
||||
// list of non-obsolete names.
|
||||
using ObsoleteMap = std::pair< wxString, size_t >;
|
||||
|
||||
bool ReadEnum(const wxString & key, int *pi,
|
||||
const EnumValueSymbol choices[], size_t nChoices,
|
||||
const ObsoleteMap obsoletes[] = nullptr,
|
||||
size_t nObsoletes = 0) const
|
||||
{
|
||||
wxString s;
|
||||
if (!wxFileConfig::Read(key, &s))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*pi = std::find( choices, choices + nChoices,
|
||||
EnumValueSymbol{ s, {} } ) - choices;
|
||||
if (*pi == (int)nChoices)
|
||||
*pi = -1;
|
||||
if (*pi < 0 && obsoletes) {
|
||||
auto index = std::find_if(obsoletes, obsoletes + nObsoletes,
|
||||
[&](const ObsoleteMap &entry){
|
||||
return entry.first == s; })
|
||||
- obsoletes;
|
||||
if (index < (int)nObsoletes)
|
||||
*pi = (int)obsoletes[index].second;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadEnum(const wxString & key, int *pi, int defVal,
|
||||
const EnumValueSymbol choices[], size_t nChoices,
|
||||
const ObsoleteMap obsoletes[] = nullptr,
|
||||
size_t nObsoletes = 0) const
|
||||
{
|
||||
if (!ReadEnum(key, pi, choices, nChoices, obsoletes, nObsoletes))
|
||||
{
|
||||
*pi = defVal;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WriteEnum(const wxString & key, int value,
|
||||
const EnumValueSymbol choices[], size_t nChoices)
|
||||
{
|
||||
if (value < 0 || value >= (int)nChoices)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return wxFileConfig::Write(key, choices[value].Internal());
|
||||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, float *val, float defVal, float min, float max) const
|
||||
{
|
||||
ReadFloat(key, val, defVal);
|
||||
return (*val >= min && *val <= max);
|
||||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, double *val, double defVal, double min, double max) const
|
||||
{
|
||||
Read(key, val, defVal);
|
||||
return (*val >= min && *val <= max);
|
||||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, int *val, int defVal, int min, int max) const
|
||||
{
|
||||
Read(key, val, defVal);
|
||||
return (*val >= min && *val <= max);
|
||||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, long *val, long defVal, long min, long max) const
|
||||
{
|
||||
Read(key, val, defVal);
|
||||
return (*val >= min && *val <= max);
|
||||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, bool *val, bool defVal) const
|
||||
{
|
||||
Read(key, val, defVal);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, wxString *val, const wxString & defVal) const
|
||||
{
|
||||
Read(key, val, defVal);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, int *val, int defVal,
|
||||
const EnumValueSymbol choices[], size_t nChoices,
|
||||
const ObsoleteMap obsoletes[] = nullptr,
|
||||
size_t nObsoletes = 0) const
|
||||
{
|
||||
ReadEnum(key, val, defVal, choices, nChoices, obsoletes, nObsoletes);
|
||||
return (*val != wxNOT_FOUND);
|
||||
}
|
||||
|
||||
bool GetParameters(wxString & parms)
|
||||
{
|
||||
wxFileConfig::SetPath(wxT("/"));
|
||||
|
||||
wxString str;
|
||||
wxString key;
|
||||
|
||||
long ndx = 0;
|
||||
bool res = wxFileConfig::GetFirstEntry(key, ndx);
|
||||
while (res)
|
||||
{
|
||||
wxString val;
|
||||
if (!wxFileConfig::Read(key, &val))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
str += key + wxT("=\"") + Escape(val) + wxT("\" ");
|
||||
|
||||
res = wxFileConfig::GetNextEntry(key, ndx);
|
||||
}
|
||||
str.Trim();
|
||||
|
||||
parms = str;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetParameters(const wxString & parms)
|
||||
{
|
||||
wxFileConfig::SetPath(wxT("/"));
|
||||
|
||||
auto parsed = wxCmdLineParser::ConvertStringToArgs(parms);
|
||||
|
||||
for (size_t i = 0, cnt = parsed.size(); i < cnt; i++)
|
||||
{
|
||||
wxString key = parsed[i].BeforeFirst(wxT('=')).Trim(false).Trim(true);
|
||||
wxString val = parsed[i].AfterFirst(wxT('=')).Trim(false).Trim(true);
|
||||
|
||||
if (!wxFileConfig::Write(key, Unescape(val)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString NormalizeName(const wxString & name) const
|
||||
{
|
||||
wxString cleaned = name;
|
||||
|
||||
cleaned.Trim(true).Trim(false);
|
||||
cleaned.Replace(wxT(" "), wxT("_"));
|
||||
cleaned.Replace(wxT("/"), wxT("_"));
|
||||
cleaned.Replace(wxT("\\"), wxT("_"));
|
||||
cleaned.Replace(wxT(":"), wxT("_"));
|
||||
cleaned.Replace(wxT("="), wxT("_"));
|
||||
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
wxString Escape(wxString val)
|
||||
{
|
||||
val.Replace(wxT("\\"), wxT("\\\\"), true);
|
||||
val.Replace(wxT("\""), wxT("\\\""), true);
|
||||
val.Replace(wxT("\n"), wxT("\\n"), true);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
wxString Unescape(wxString val)
|
||||
{
|
||||
val.Replace(wxT("\\n"), wxT("\n"), true);
|
||||
val.Replace(wxT("\\\""), wxT("\""), true);
|
||||
val.Replace(wxT("\\\\"), wxT("\\"), true);
|
||||
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
250
include/tenacity/EffectInterface.h
Normal file
250
include/tenacity/EffectInterface.h
Normal file
@@ -0,0 +1,250 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
EffectInterface.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Copyright (c) 2014, Audacity Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_EFFECTINTERFACE_H__
|
||||
#define __AUDACITY_EFFECTINTERFACE_H__
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "Identifier.h"
|
||||
#include "tenacity/ComponentInterface.h"
|
||||
#include "ComponentInterfaceSymbol.h"
|
||||
#include "tenacity/ConfigInterface.h"
|
||||
#include "tenacity/EffectAutomationParameters.h" // for command automation
|
||||
|
||||
class ShuttleGui;
|
||||
|
||||
typedef enum EffectType : int
|
||||
{
|
||||
EffectTypeNone,
|
||||
EffectTypeHidden,
|
||||
EffectTypeGenerate,
|
||||
EffectTypeProcess,
|
||||
EffectTypeAnalyze,
|
||||
EffectTypeTool,
|
||||
} EffectType;
|
||||
|
||||
|
||||
/*************************************************************************************//**
|
||||
|
||||
\class EffectDefinitionInterface
|
||||
|
||||
\brief EffectDefinitionInterface is a ComponentInterface that additionally tracks
|
||||
flag-functions for interactivity, play-preview and whether the effect can run without a GUI.
|
||||
|
||||
*******************************************************************************************/
|
||||
class AUDACITY_DLL_API EffectDefinitionInterface /* not final */ : public ComponentInterface
|
||||
{
|
||||
public:
|
||||
virtual ~EffectDefinitionInterface() {};
|
||||
|
||||
// Type determines how it behaves.
|
||||
virtual EffectType GetType() = 0;
|
||||
// Classification determines which menu it appears in.
|
||||
virtual EffectType GetClassification() { return GetType();};
|
||||
|
||||
virtual EffectFamilySymbol GetFamily() = 0;
|
||||
|
||||
// These should move to the "EffectClientInterface" class once all
|
||||
// effects have been converted.
|
||||
virtual bool IsInteractive() = 0;
|
||||
|
||||
// I don't really like this, but couldn't think of a better way to force the
|
||||
// effect to appear "above the line" in the menus.
|
||||
virtual bool IsDefault() = 0;
|
||||
|
||||
// This will go away when all Effects have been updated to the new
|
||||
// interface.
|
||||
virtual bool IsLegacy() = 0;
|
||||
|
||||
// Whether the effect supports realtime previewing (while audio is playing).
|
||||
virtual bool SupportsRealtime() = 0;
|
||||
|
||||
// Can the effect be used without the UI.
|
||||
virtual bool SupportsAutomation() = 0;
|
||||
};
|
||||
|
||||
class wxDialog;
|
||||
class wxWindow;
|
||||
class EffectUIHostInterface;
|
||||
class EffectUIClientInterface;
|
||||
|
||||
/*************************************************************************************//**
|
||||
|
||||
\class EffectHostInterface
|
||||
|
||||
\brief EffectHostInterface is a decorator of a EffectUIClientInterface. It adds
|
||||
virtual (abstract) functions to get presets and actually apply the effect. It uses
|
||||
ConfigClientInterface to add Getters/setters for private and shared configs.
|
||||
|
||||
*******************************************************************************************/
|
||||
class AUDACITY_DLL_API EffectHostInterface /* not final */ : public ConfigClientInterface
|
||||
{
|
||||
public:
|
||||
virtual ~EffectHostInterface() {};
|
||||
|
||||
virtual double GetDefaultDuration() = 0;
|
||||
virtual double GetDuration() = 0;
|
||||
virtual NumericFormatSymbol GetDurationFormat() = 0;
|
||||
virtual void SetDuration(double seconds) = 0;
|
||||
|
||||
// Preset handling
|
||||
virtual RegistryPath GetUserPresetsGroup(const RegistryPath & name) = 0;
|
||||
virtual RegistryPath GetCurrentSettingsGroup() = 0;
|
||||
virtual RegistryPath GetFactoryDefaultsGroup() = 0;
|
||||
};
|
||||
|
||||
/*************************************************************************************//**
|
||||
|
||||
\class EffectClientInterface
|
||||
|
||||
\brief EffectClientInterface provides the ident interface to Effect, and is what makes
|
||||
Effect into a plug-in command. It has functions for realtime that are not part of
|
||||
AudacityCommand.
|
||||
|
||||
*******************************************************************************************/
|
||||
class AUDACITY_DLL_API EffectClientInterface /* not final */ : public EffectDefinitionInterface
|
||||
{
|
||||
public:
|
||||
using EffectDialogFactory = std::function<
|
||||
wxDialog* ( wxWindow &parent,
|
||||
EffectHostInterface*, EffectUIClientInterface* )
|
||||
>;
|
||||
|
||||
virtual ~EffectClientInterface() {};
|
||||
|
||||
virtual bool SetHost(EffectHostInterface *host) = 0;
|
||||
|
||||
virtual unsigned GetAudioInCount() = 0;
|
||||
virtual unsigned GetAudioOutCount() = 0;
|
||||
|
||||
virtual int GetMidiInCount() = 0;
|
||||
virtual int GetMidiOutCount() = 0;
|
||||
|
||||
virtual void SetSampleRate(double rate) = 0;
|
||||
// Suggest a block size, but the return is the size that was really set:
|
||||
virtual size_t SetBlockSize(size_t maxBlockSize) = 0;
|
||||
virtual size_t GetBlockSize() const = 0;
|
||||
|
||||
virtual sampleCount GetLatency() = 0;
|
||||
virtual size_t GetTailSize() = 0;
|
||||
|
||||
virtual bool IsReady() = 0;
|
||||
virtual bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) = 0;
|
||||
// This may be called during stack unwinding:
|
||||
virtual bool ProcessFinalize() /* noexcept */ = 0;
|
||||
virtual size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) = 0;
|
||||
|
||||
virtual bool RealtimeInitialize() = 0;
|
||||
virtual bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) = 0;
|
||||
virtual bool RealtimeFinalize() = 0;
|
||||
virtual bool RealtimeSuspend() = 0;
|
||||
virtual bool RealtimeResume() = 0;
|
||||
virtual bool RealtimeProcessStart() = 0;
|
||||
virtual size_t RealtimeProcess(int group, float **inBuf, float **outBuf, size_t numSamples) = 0;
|
||||
virtual bool RealtimeProcessEnd() = 0;
|
||||
|
||||
virtual bool ShowInterface(
|
||||
wxWindow &parent, const EffectDialogFactory &factory,
|
||||
bool forceModal = false
|
||||
) = 0;
|
||||
// Some effects will use define params to define what parameters they take.
|
||||
// If they do, they won't need to implement Get or SetAutomation parameters.
|
||||
// since the Effect class can do it. Or at least that is how things happen
|
||||
// in AudacityCommand. IF we do the same in class Effect, then Effect maybe
|
||||
// should derive by some route from AudacityCommand to pick up that
|
||||
// functionality.
|
||||
//virtual bool DefineParams( ShuttleParams & S){ return false;};
|
||||
virtual bool GetAutomationParameters(CommandParameters & parms) = 0;
|
||||
virtual bool SetAutomationParameters(CommandParameters & parms) = 0;
|
||||
|
||||
virtual bool LoadUserPreset(const RegistryPath & name) = 0;
|
||||
virtual bool SaveUserPreset(const RegistryPath & name) = 0;
|
||||
|
||||
virtual RegistryPaths GetFactoryPresets() = 0;
|
||||
virtual bool LoadFactoryPreset(int id) = 0;
|
||||
virtual bool LoadFactoryDefaults() = 0;
|
||||
};
|
||||
|
||||
/*************************************************************************************//**
|
||||
|
||||
\class EffectUIHostInterface
|
||||
|
||||
\brief EffectUIHostInterface has nothing in it. It is provided so that an Effect
|
||||
can call SetHostUI passing in a pointer to an EffectUIHostInterface. It contains no
|
||||
functionality and is provided, apparently, for type checking. Since only EffectUIHost
|
||||
uses it, EffectUIHost could be used instead.
|
||||
*******************************************************************************************/
|
||||
class AUDACITY_DLL_API EffectUIHostInterface
|
||||
{
|
||||
public:
|
||||
virtual ~EffectUIHostInterface() {};
|
||||
};
|
||||
|
||||
/*************************************************************************************//**
|
||||
|
||||
\class EffectUIClientInterface
|
||||
|
||||
\brief EffectUIClientInterface is an abstract base class to populate a UI and validate UI
|
||||
values. It can import and export presets.
|
||||
|
||||
*******************************************************************************************/
|
||||
class AUDACITY_DLL_API EffectUIClientInterface /* not final */
|
||||
{
|
||||
public:
|
||||
virtual ~EffectUIClientInterface() {};
|
||||
|
||||
virtual void SetHostUI(EffectUIHostInterface *host) = 0;
|
||||
virtual bool IsGraphicalUI() = 0;
|
||||
virtual bool PopulateUI(ShuttleGui &S) = 0;
|
||||
virtual bool ValidateUI() = 0;
|
||||
virtual bool HideUI() = 0;
|
||||
virtual bool CloseUI() = 0;
|
||||
|
||||
virtual bool CanExportPresets() = 0;
|
||||
virtual void ExportPresets() = 0;
|
||||
virtual void ImportPresets() = 0;
|
||||
|
||||
virtual bool HasOptions() = 0;
|
||||
virtual void ShowOptions() = 0;
|
||||
};
|
||||
|
||||
#endif // __AUDACITY_EFFECTINTERFACE_H__
|
||||
181
include/tenacity/ModuleInterface.h
Normal file
181
include/tenacity/ModuleInterface.h
Normal file
@@ -0,0 +1,181 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ModuleInterface.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Copyright (c) 2014, Audacity Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_MODULEINTERFACE_H__
|
||||
#define __AUDACITY_MODULEINTERFACE_H__
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include "Identifier.h"
|
||||
#include "tenacity/ComponentInterface.h"
|
||||
#include "tenacity/PluginInterface.h"
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Don't even think about adding module types, like effect, importer, etc. in
|
||||
// here. The module interface should not have to change when new types of
|
||||
// plugins are added to Audacity.
|
||||
//
|
||||
// In addition a single module may want to provide multiple plugin types.
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
///
|
||||
/// ModuleInterface is a generic dll or so interface for Audacity, that is
|
||||
/// used for plug ins. Classes derived from it can handle more specific plug
|
||||
/// in types.
|
||||
///
|
||||
// ============================================================================
|
||||
|
||||
class ModuleInterface /* not final */ : public ComponentInterface
|
||||
{
|
||||
public:
|
||||
virtual ~ModuleInterface() {};
|
||||
|
||||
// Called immediately after creation to give the instance a chance to
|
||||
// initialize. Return "true" if initialziation was successful.
|
||||
virtual bool Initialize() = 0;
|
||||
|
||||
// Called just prior to deletion to allow releasing any resources.
|
||||
virtual void Terminate() = 0;
|
||||
|
||||
// A symbol identifying the family of plugin provided by this module;
|
||||
// if it is not empty, then the family as a whole can be enabled or
|
||||
// disabled by the user in Preferences
|
||||
virtual EffectFamilySymbol GetOptionalFamilySymbol() = 0;
|
||||
|
||||
// "Paths" returned by FindPluginPaths() and passed back to
|
||||
// DiscoverPluginsAtPath() have module-specific meaning.
|
||||
// They are not necessarily file system paths to existent files that
|
||||
// could be placed in any folder and queried for
|
||||
// plugin information.
|
||||
// This function returns nonempty only when that is the case, and lists
|
||||
// the possible extensions of such files (an empty string in a nonempty
|
||||
// array means any file is a candidate).
|
||||
virtual const FileExtensions &GetFileExtensions() = 0;
|
||||
|
||||
// Returns empty, or else, where to copy a plug-in file or bundle.
|
||||
// Drag-and-drop is supported only if GetFileExtensions() returns nonempty and
|
||||
// this function returns nonempty.
|
||||
virtual FilePath InstallPath() = 0;
|
||||
|
||||
// Modules providing a single or static set of plugins may use
|
||||
// AutoRegisterPlugins() to register those plugins.
|
||||
virtual bool AutoRegisterPlugins(PluginManagerInterface & pluginManager) = 0;
|
||||
|
||||
// For modules providing an interface to other dynamically loaded plugins,
|
||||
// the module returns a list of path names that will be presented to the
|
||||
// user as "New" for enablement.
|
||||
virtual PluginPaths FindPluginPaths(PluginManagerInterface & pluginManager) = 0;
|
||||
|
||||
// Once the user selects desired paths from FindPluginPaths(),
|
||||
// a call to DiscoverPluginsAtPath()
|
||||
// will be made to request registration of one or more plugins. If the module must create
|
||||
// an instance of the plugin to register it, then the instance should be deleted
|
||||
// after registration.
|
||||
// May discover more than one plug-in at the path, and
|
||||
// may call-back with paths not equal to path (perhaps appending
|
||||
// other information to it).
|
||||
// Error message does not need to mention the path and may be nonempty
|
||||
// even if some plugins are also discovered successfully.
|
||||
// Return value is the number of plugins found.
|
||||
using RegistrationCallback =
|
||||
std::function<
|
||||
const PluginID &(ModuleInterface *, ComponentInterface *) >;
|
||||
virtual unsigned DiscoverPluginsAtPath(
|
||||
const PluginPath & path, TranslatableString &errMsg,
|
||||
const RegistrationCallback &callback )
|
||||
= 0;
|
||||
|
||||
// For modules providing an interface to other dynamically loaded plugins,
|
||||
// the module returns true if the plugin is still valid, otherwise false.
|
||||
virtual bool IsPluginValid(const PluginPath & path, bool bFast) = 0;
|
||||
|
||||
// When appropriate, CreateInstance() will be called to instantiate the plugin.
|
||||
virtual std::unique_ptr<ComponentInterface>
|
||||
CreateInstance(const PluginPath & path) = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Since there may be multiple embedded modules, the module entry function will
|
||||
// be declared static so as not to interfere with other modules during link.
|
||||
// ----------------------------------------------------------------------------
|
||||
#define DECLARE_MODULE_ENTRY(name) \
|
||||
static ModuleInterface * name()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// This will create a class and instance that will register the module entry
|
||||
// point during Audacity startup. At the appropriate time, the entry point
|
||||
// will be called to create the module instance.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Provides the base for embedded module registration. If used, a Register()
|
||||
// method must be supplied explicitly.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define DECLARE_BUILTIN_MODULE_BASE(name) \
|
||||
class name \
|
||||
{ \
|
||||
public: \
|
||||
name() {Register();} \
|
||||
~name() {Unregister();} \
|
||||
void Register(); \
|
||||
void Unregister(); \
|
||||
}; \
|
||||
static name name ## _instance;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Provides the full embedded module registration process. Nothing further is
|
||||
// required (other than supplying the module entry point function).
|
||||
// ----------------------------------------------------------------------------
|
||||
#define DECLARE_BUILTIN_MODULE(name) \
|
||||
DECLARE_BUILTIN_MODULE_BASE(name) \
|
||||
void name::Register() \
|
||||
{ \
|
||||
RegisterProvider(AudacityModule); \
|
||||
} \
|
||||
void name::Unregister() \
|
||||
{ \
|
||||
UnregisterProvider(AudacityModule); \
|
||||
}
|
||||
|
||||
#endif // __AUDACITY_MODULEINTERFACE_H__
|
||||
115
include/tenacity/PluginInterface.h
Normal file
115
include/tenacity/PluginInterface.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
PluginInterface.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Copyright (c) 2014, Audacity Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_PLUGININTERFACE_H__
|
||||
#define __AUDACITY_PLUGININTERFACE_H__
|
||||
|
||||
#include "tenacity/ConfigInterface.h"
|
||||
#include "tenacity/EffectInterface.h"
|
||||
#include "tenacity/ComponentInterface.h"
|
||||
|
||||
|
||||
class ModuleInterface;
|
||||
|
||||
|
||||
class AUDACITY_DLL_API PluginManagerInterface /* not final */
|
||||
{
|
||||
public:
|
||||
|
||||
static const PluginID &DefaultRegistrationCallback(
|
||||
ModuleInterface *provider, ComponentInterface *ident );
|
||||
static const PluginID &AudacityCommandRegistrationCallback(
|
||||
ModuleInterface *provider, ComponentInterface *ident );
|
||||
|
||||
//! Was the plugin registry already populated for a path (maybe from loading the config file)?
|
||||
/*!
|
||||
@param path an identifier for the plug-in with meaning defined by provider; not always a file path
|
||||
@param pName if supplied, a correction for the user visible name associated with the plug-in, if it is
|
||||
registered already. (Needed because the configuration file only stores an internal name.)
|
||||
*/
|
||||
virtual bool IsPluginRegistered(
|
||||
const PluginPath & path,
|
||||
const TranslatableString *pName = nullptr) = 0;
|
||||
|
||||
virtual const PluginID & RegisterPlugin(ModuleInterface *module) = 0;
|
||||
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectDefinitionInterface *effect, int type) = 0;
|
||||
|
||||
virtual void FindFilesInPathList(const wxString & pattern,
|
||||
const FilePaths & pathList,
|
||||
FilePaths & files,
|
||||
bool directories = false) = 0;
|
||||
|
||||
virtual bool GetSharedConfigSubgroups(const PluginID & ID, const RegistryPath & group, RegistryPaths & subgroups) = 0;
|
||||
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, wxString & value, const wxString & defval = wxString()) = 0;
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, int & value, int defval = 0) = 0;
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, bool & value, bool defval = false) = 0;
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, float & value, float defval = 0.0) = 0;
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, double & value, double defval = 0.0) = 0;
|
||||
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const wxString & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const int & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const bool & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const float & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const double & value) = 0;
|
||||
|
||||
virtual bool RemoveSharedConfigSubgroup(const PluginID & ID, const RegistryPath & group) = 0;
|
||||
virtual bool RemoveSharedConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key) = 0;
|
||||
|
||||
virtual bool GetPrivateConfigSubgroups(const PluginID & ID, const RegistryPath & group, RegistryPaths & subgroups) = 0;
|
||||
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, wxString & value, const wxString & defval = wxString()) = 0;
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, int & value, int defval = 0) = 0;
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, bool & value, bool defval = false) = 0;
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, float & value, float defval = 0.0) = 0;
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, double & value, double defval = 0.0) = 0;
|
||||
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const wxString & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const int & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const bool & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const float & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key, const double & value) = 0;
|
||||
|
||||
virtual bool RemovePrivateConfigSubgroup(const PluginID & ID, const RegistryPath & group) = 0;
|
||||
virtual bool RemovePrivateConfig(const PluginID & ID, const RegistryPath & group, const RegistryPath & key) = 0;
|
||||
};
|
||||
|
||||
#endif // __AUDACITY_PLUGININTERFACE_H__
|
||||
259
include/tenacity/Types.h
Normal file
259
include/tenacity/Types.h
Normal file
@@ -0,0 +1,259 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
Types.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Copyright (c) 2014, Audacity Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_TYPES_H__
|
||||
#define __AUDACITY_TYPES_H__
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <wx/debug.h> // for wxASSERT
|
||||
#include <wx/string.h> // type used in inline function and member variable
|
||||
|
||||
#include "Internat.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// TODO: I'd imagine this header may be replaced by other public headers. But,
|
||||
// to try and minimize more changes to the base code, we can use this
|
||||
// until proper public headers are created for the stuff in here.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A native 64-bit integer...used when referring to any number of samples
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class sampleCount
|
||||
{
|
||||
public:
|
||||
using type = long long;
|
||||
static_assert(sizeof(type) == 8, "Wrong width of sampleCount");
|
||||
|
||||
sampleCount () : value { 0 } {}
|
||||
|
||||
// Allow implicit conversion from integral types
|
||||
sampleCount ( type v ) : value { v } {}
|
||||
sampleCount ( unsigned long long v ) : value ( v ) {}
|
||||
sampleCount ( int v ) : value { v } {}
|
||||
sampleCount ( unsigned v ) : value { v } {}
|
||||
sampleCount ( long v ) : value { v } {}
|
||||
|
||||
// unsigned long is 64 bit on some platforms. Let it narrow.
|
||||
sampleCount ( unsigned long v ) : value ( v ) {}
|
||||
|
||||
// Beware implicit conversions from floating point values!
|
||||
// Otherwise the meaning of binary operators with sampleCount change
|
||||
// their meaning when sampleCount is not an alias!
|
||||
explicit sampleCount ( float f ) : value ( f ) {}
|
||||
explicit sampleCount ( double d ) : value ( d ) {}
|
||||
|
||||
sampleCount ( const sampleCount& ) = default;
|
||||
sampleCount &operator= ( const sampleCount& ) = default;
|
||||
|
||||
float as_float() const { return value; }
|
||||
double as_double() const { return value; }
|
||||
|
||||
long long as_long_long() const { return value; }
|
||||
|
||||
size_t as_size_t() const {
|
||||
wxASSERT(value >= 0);
|
||||
wxASSERT(static_cast<std::make_unsigned<type>::type>(value) <= std::numeric_limits<size_t>::max());
|
||||
return value;
|
||||
}
|
||||
|
||||
sampleCount &operator += (sampleCount b) { value += b.value; return *this; }
|
||||
sampleCount &operator -= (sampleCount b) { value -= b.value; return *this; }
|
||||
sampleCount &operator *= (sampleCount b) { value *= b.value; return *this; }
|
||||
sampleCount &operator /= (sampleCount b) { value /= b.value; return *this; }
|
||||
sampleCount &operator %= (sampleCount b) { value %= b.value; return *this; }
|
||||
|
||||
sampleCount operator - () const { return -value; }
|
||||
|
||||
sampleCount &operator ++ () { ++value; return *this; }
|
||||
sampleCount operator ++ (int)
|
||||
{ sampleCount result{ *this }; ++value; return result; }
|
||||
|
||||
sampleCount &operator -- () { --value; return *this; }
|
||||
sampleCount operator -- (int)
|
||||
{ sampleCount result{ *this }; --value; return result; }
|
||||
|
||||
private:
|
||||
type value;
|
||||
};
|
||||
|
||||
inline bool operator == (sampleCount a, sampleCount b)
|
||||
{
|
||||
return a.as_long_long() == b.as_long_long();
|
||||
}
|
||||
|
||||
inline bool operator != (sampleCount a, sampleCount b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
inline bool operator < (sampleCount a, sampleCount b)
|
||||
{
|
||||
return a.as_long_long() < b.as_long_long();
|
||||
}
|
||||
|
||||
inline bool operator >= (sampleCount a, sampleCount b)
|
||||
{
|
||||
return !(a < b);
|
||||
}
|
||||
|
||||
inline bool operator > (sampleCount a, sampleCount b)
|
||||
{
|
||||
return b < a;
|
||||
}
|
||||
|
||||
inline bool operator <= (sampleCount a, sampleCount b)
|
||||
{
|
||||
return !(b < a);
|
||||
}
|
||||
|
||||
inline sampleCount operator + (sampleCount a, sampleCount b)
|
||||
{
|
||||
return sampleCount{ a } += b;
|
||||
}
|
||||
|
||||
inline sampleCount operator - (sampleCount a, sampleCount b)
|
||||
{
|
||||
return sampleCount{ a } -= b;
|
||||
}
|
||||
|
||||
inline sampleCount operator * (sampleCount a, sampleCount b)
|
||||
{
|
||||
return sampleCount{ a } *= b;
|
||||
}
|
||||
|
||||
inline sampleCount operator / (sampleCount a, sampleCount b)
|
||||
{
|
||||
return sampleCount{ a } /= b;
|
||||
}
|
||||
|
||||
inline sampleCount operator % (sampleCount a, sampleCount b)
|
||||
{
|
||||
return sampleCount{ a } %= b;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Function returning the minimum of a sampleCount and a size_t,
|
||||
// hiding the casts
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
inline size_t limitSampleBufferSize( size_t bufferSize, sampleCount limit )
|
||||
{
|
||||
return
|
||||
std::min( sampleCount( bufferSize ), std::max( sampleCount(0), limit ) )
|
||||
.as_size_t();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Supported sample formats
|
||||
// ----------------------------------------------------------------------------
|
||||
enum sampleFormat : unsigned
|
||||
{
|
||||
//! The increasing sequence of these enum values must correspond to the increasing data type width
|
||||
//! These values persist in saved project files, so must not be changed in later program versions
|
||||
int16Sample = 0x00020001,
|
||||
int24Sample = 0x00040001,
|
||||
floatSample = 0x0004000F,
|
||||
|
||||
//! Two synonyms for previous values that might change if more values were added
|
||||
narrowestSampleFormat = int16Sample,
|
||||
widestSampleFormat = floatSample,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Provide the number of bytes a specific sample will take
|
||||
// ----------------------------------------------------------------------------
|
||||
#define SAMPLE_SIZE(SampleFormat) (SampleFormat >> 16)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Generic pointer to sample data
|
||||
// ----------------------------------------------------------------------------
|
||||
typedef char *samplePtr;
|
||||
typedef const char *constSamplePtr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// The type for plugin IDs
|
||||
// ----------------------------------------------------------------------------
|
||||
typedef wxString PluginID;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Supported channel assignments
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// Use to mark end of list
|
||||
ChannelNameEOL = -1,
|
||||
// The default channel assignment
|
||||
ChannelNameMono,
|
||||
// From this point, the channels follow the 22.2 surround sound format
|
||||
ChannelNameFrontLeft,
|
||||
ChannelNameFrontRight,
|
||||
ChannelNameFrontCenter,
|
||||
ChannelNameLowFrequency1,
|
||||
ChannelNameBackLeft,
|
||||
ChannelNameBackRight,
|
||||
ChannelNameFrontLeftCenter,
|
||||
ChannelNameFrontRightCenter,
|
||||
ChannelNameBackCenter,
|
||||
ChannelNameLowFrequency2,
|
||||
ChannelNameSideLeft,
|
||||
ChannelNameSideRight,
|
||||
ChannelNameTopFrontLeft,
|
||||
ChannelNameTopFrontRight,
|
||||
ChannelNameTopFrontCenter,
|
||||
ChannelNameTopCenter,
|
||||
ChannelNameTopBackLeft,
|
||||
ChannelNameTopBackRight,
|
||||
ChannelNameTopSideLeft,
|
||||
ChannelNameTopSideRight,
|
||||
ChannelNameTopBackCenter,
|
||||
ChannelNameBottomFrontCenter,
|
||||
ChannelNameBottomFrontLeft,
|
||||
ChannelNameBottomFrontRight,
|
||||
} ChannelName, *ChannelNames;
|
||||
|
||||
#endif // __AUDACITY_TYPES_H__
|
||||
Reference in New Issue
Block a user