mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-24 16:20:05 +02:00
Remove some naked new amd delete in: various
This commit is contained in:
parent
186679b3a6
commit
942c62b6f6
@ -314,7 +314,7 @@ void QuitAudacity(bool bForce)
|
|||||||
|
|
||||||
//print out profile if we have one by deleting it
|
//print out profile if we have one by deleting it
|
||||||
//temporarilly commented out till it is added to all projects
|
//temporarilly commented out till it is added to all projects
|
||||||
//delete Profiler::Instance();
|
//DELETE Profiler::Instance();
|
||||||
|
|
||||||
//remove our logger
|
//remove our logger
|
||||||
std::unique_ptr<wxLog>{ wxLog::SetActiveTarget(NULL) }; // DELETE
|
std::unique_ptr<wxLog>{ wxLog::SetActiveTarget(NULL) }; // DELETE
|
||||||
@ -994,8 +994,7 @@ wxString AudacityApp::InitLang( const wxString & lang )
|
|||||||
{
|
{
|
||||||
wxString result = lang;
|
wxString result = lang;
|
||||||
|
|
||||||
if (mLocale)
|
mLocale.reset();
|
||||||
delete mLocale;
|
|
||||||
|
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
// This should be reviewed again during the wx3 conversion.
|
// This should be reviewed again during the wx3 conversion.
|
||||||
@ -1021,7 +1020,7 @@ wxString AudacityApp::InitLang( const wxString & lang )
|
|||||||
if (!info)
|
if (!info)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
mLocale = new wxLocale(info->Language);
|
mLocale = std::make_unique<wxLocale>(info->Language);
|
||||||
|
|
||||||
for(unsigned int i=0; i<audacityPathList.GetCount(); i++)
|
for(unsigned int i=0; i<audacityPathList.GetCount(); i++)
|
||||||
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);
|
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);
|
||||||
@ -1182,9 +1181,6 @@ bool AudacityApp::OnInit()
|
|||||||
m_aliasMissingWarningShouldShow = true;
|
m_aliasMissingWarningShouldShow = true;
|
||||||
m_LastMissingBlockFile = NULL;
|
m_LastMissingBlockFile = NULL;
|
||||||
|
|
||||||
mChecker = NULL;
|
|
||||||
mIPCServ = NULL;
|
|
||||||
|
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
// Disable window animation
|
// Disable window animation
|
||||||
wxSystemOptions::SetOption(wxMAC_WINDOW_PLAIN_TRANSITION, 1);
|
wxSystemOptions::SetOption(wxMAC_WINDOW_PLAIN_TRANSITION, 1);
|
||||||
@ -1330,7 +1326,7 @@ bool AudacityApp::OnInit()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO - read the number of files to store in history from preferences
|
// TODO - read the number of files to store in history from preferences
|
||||||
mRecentFiles = new FileHistory(ID_RECENT_LAST - ID_RECENT_FIRST + 1, ID_RECENT_CLEAR);
|
mRecentFiles = std::make_unique<FileHistory>(ID_RECENT_LAST - ID_RECENT_FIRST + 1, ID_RECENT_CLEAR);
|
||||||
mRecentFiles->Load(*gPrefs, wxT("RecentFiles"));
|
mRecentFiles->Load(*gPrefs, wxT("RecentFiles"));
|
||||||
|
|
||||||
theTheme.EnsureInitialised();
|
theTheme.EnsureInitialised();
|
||||||
@ -1547,17 +1543,10 @@ bool AudacityApp::OnInit()
|
|||||||
|
|
||||||
void AudacityApp::InitCommandHandler()
|
void AudacityApp::InitCommandHandler()
|
||||||
{
|
{
|
||||||
mCmdHandler = new CommandHandler(*this);
|
mCmdHandler = std::make_unique<CommandHandler>(*this);
|
||||||
//SetNextHandler(mCmdHandler);
|
//SetNextHandler(mCmdHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityApp::DeInitCommandHandler()
|
|
||||||
{
|
|
||||||
wxASSERT(NULL != mCmdHandler);
|
|
||||||
delete mCmdHandler;
|
|
||||||
mCmdHandler = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// AppCommandEvent callback - just pass the event on to the CommandHandler
|
// AppCommandEvent callback - just pass the event on to the CommandHandler
|
||||||
void AudacityApp::OnReceiveCommand(AppCommandEvent &event)
|
void AudacityApp::OnReceiveCommand(AppCommandEvent &event)
|
||||||
{
|
{
|
||||||
@ -1701,7 +1690,8 @@ bool AudacityApp::InitTempDir()
|
|||||||
bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
||||||
{
|
{
|
||||||
wxString name = wxString::Format(wxT("audacity-lock-%s"), wxGetUserId().c_str());
|
wxString name = wxString::Format(wxT("audacity-lock-%s"), wxGetUserId().c_str());
|
||||||
mChecker = new wxSingleInstanceChecker();
|
mChecker.reset();
|
||||||
|
auto checker = std::make_unique<wxSingleInstanceChecker>();
|
||||||
|
|
||||||
#if defined(__UNIX__)
|
#if defined(__UNIX__)
|
||||||
wxString sockFile(dir + wxT("/.audacity.sock"));
|
wxString sockFile(dir + wxT("/.audacity.sock"));
|
||||||
@ -1709,7 +1699,7 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
|||||||
|
|
||||||
wxString runningTwoCopiesStr = _("Running two copies of Audacity simultaneously may cause\ndata loss or cause your system to crash.\n\n");
|
wxString runningTwoCopiesStr = _("Running two copies of Audacity simultaneously may cause\ndata loss or cause your system to crash.\n\n");
|
||||||
|
|
||||||
if (!mChecker->Create(name, dir)) {
|
if (!checker->Create(name, dir)) {
|
||||||
// Error initializing the wxSingleInstanceChecker. We don't know
|
// Error initializing the wxSingleInstanceChecker. We don't know
|
||||||
// whether there is another instance running or not.
|
// whether there is another instance running or not.
|
||||||
|
|
||||||
@ -1721,12 +1711,10 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
|||||||
_("Error Locking Temporary Folder"),
|
_("Error Locking Temporary Folder"),
|
||||||
wxYES_NO | wxICON_EXCLAMATION,
|
wxYES_NO | wxICON_EXCLAMATION,
|
||||||
NULL);
|
NULL);
|
||||||
if (action == wxNO) {
|
if (action == wxNO)
|
||||||
delete mChecker;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( mChecker->IsAnotherRunning() ) {
|
else if ( checker->IsAnotherRunning() ) {
|
||||||
// Parse the command line to ensure correct syntax, but
|
// Parse the command line to ensure correct syntax, but
|
||||||
// ignore options and only use the filenames, if any.
|
// ignore options and only use the filenames, if any.
|
||||||
auto parser = ParseCommandLine();
|
auto parser = ParseCommandLine();
|
||||||
@ -1747,7 +1735,7 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
|||||||
// where the server may not have been fully initialized.
|
// where the server may not have been fully initialized.
|
||||||
for (int i = 0; i < 50; i++)
|
for (int i = 0; i < 50; i++)
|
||||||
{
|
{
|
||||||
wxConnectionBase *conn = client.MakeConnection(wxEmptyString, IPC_APPL, IPC_TOPIC);
|
std::unique_ptr<wxConnectionBase> conn{ client.MakeConnection(wxEmptyString, IPC_APPL, IPC_TOPIC) };
|
||||||
if (conn)
|
if (conn)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -1765,8 +1753,6 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
|||||||
ok = conn->Execute(wxEmptyString);
|
ok = conn->Execute(wxEmptyString);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete conn;
|
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1816,19 +1802,18 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
|||||||
_("Use the New or Open commands in the currently running Audacity\nprocess to open multiple projects simultaneously.\n");
|
_("Use the New or Open commands in the currently running Audacity\nprocess to open multiple projects simultaneously.\n");
|
||||||
wxMessageBox(prompt, _("Audacity is already running"),
|
wxMessageBox(prompt, _("Audacity is already running"),
|
||||||
wxOK | wxICON_ERROR);
|
wxOK | wxICON_ERROR);
|
||||||
delete mChecker;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
// Create the DDE IPC server
|
// Create the DDE IPC server
|
||||||
mIPCServ = new IPCServ(IPC_APPL);
|
mIPCServ = std::make_unique<IPCServ>(IPC_APPL);
|
||||||
#else
|
#else
|
||||||
int mask = umask(077);
|
int mask = umask(077);
|
||||||
remove(OSFILENAME(sockFile));
|
remove(OSFILENAME(sockFile));
|
||||||
wxUNIXaddress addr;
|
wxUNIXaddress addr;
|
||||||
addr.Filename(sockFile);
|
addr.Filename(sockFile);
|
||||||
mIPCServ = new wxSocketServer(addr, wxSOCKET_NOWAIT);
|
mIPCServ = std::make_unique<wxSocketServer>(addr, wxSOCKET_NOWAIT);
|
||||||
umask(mask);
|
umask(mask);
|
||||||
|
|
||||||
if (!mIPCServ || !mIPCServ->IsOk())
|
if (!mIPCServ || !mIPCServ->IsOk())
|
||||||
@ -1841,6 +1826,7 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
|
|||||||
mIPCServ->SetNotify(wxSOCKET_CONNECTION_FLAG);
|
mIPCServ->SetNotify(wxSOCKET_CONNECTION_FLAG);
|
||||||
mIPCServ->Notify(true);
|
mIPCServ->Notify(true);
|
||||||
#endif
|
#endif
|
||||||
|
mChecker = std::move(checker);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2021,11 +2007,7 @@ int AudacityApp::OnExit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeInitCommandHandler();
|
|
||||||
|
|
||||||
mRecentFiles->Save(*gPrefs, wxT("RecentFiles"));
|
mRecentFiles->Save(*gPrefs, wxT("RecentFiles"));
|
||||||
delete mRecentFiles;
|
|
||||||
mRecentFiles = NULL;
|
|
||||||
|
|
||||||
FinishPreferences();
|
FinishPreferences();
|
||||||
|
|
||||||
@ -2040,9 +2022,6 @@ int AudacityApp::OnExit()
|
|||||||
// Terminate the PluginManager (must be done before deleting the locale)
|
// Terminate the PluginManager (must be done before deleting the locale)
|
||||||
PluginManager::Get().Terminate();
|
PluginManager::Get().Terminate();
|
||||||
|
|
||||||
if (mLocale)
|
|
||||||
delete mLocale;
|
|
||||||
|
|
||||||
if (mIPCServ)
|
if (mIPCServ)
|
||||||
{
|
{
|
||||||
#if defined(__UNIX__)
|
#if defined(__UNIX__)
|
||||||
@ -2052,12 +2031,8 @@ int AudacityApp::OnExit()
|
|||||||
remove(OSFILENAME(addr.Filename()));
|
remove(OSFILENAME(addr.Filename()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
delete mIPCServ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mChecker)
|
|
||||||
delete mChecker;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ class AudacityApp final : public wxApp {
|
|||||||
int flags = wxDIR_FILES);
|
int flags = wxDIR_FILES);
|
||||||
static bool IsTempDirectoryNameOK( const wxString & Name );
|
static bool IsTempDirectoryNameOK( const wxString & Name );
|
||||||
|
|
||||||
FileHistory *GetRecentFiles() {return mRecentFiles;}
|
FileHistory *GetRecentFiles() {return mRecentFiles.get();}
|
||||||
void AddFileToHistory(const wxString & name);
|
void AddFileToHistory(const wxString & name);
|
||||||
bool GetWindowRectAlreadySaved()const {return mWindowRectAlreadySaved;}
|
bool GetWindowRectAlreadySaved()const {return mWindowRectAlreadySaved;}
|
||||||
void SetWindowRectAlreadySaved(bool alreadySaved) {mWindowRectAlreadySaved = alreadySaved;}
|
void SetWindowRectAlreadySaved(bool alreadySaved) {mWindowRectAlreadySaved = alreadySaved;}
|
||||||
@ -283,12 +283,12 @@ class AudacityApp final : public wxApp {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CommandHandler *mCmdHandler;
|
std::unique_ptr<CommandHandler> mCmdHandler;
|
||||||
FileHistory *mRecentFiles;
|
std::unique_ptr<FileHistory> mRecentFiles;
|
||||||
|
|
||||||
wxLocale *mLocale;
|
std::unique_ptr<wxLocale> mLocale;
|
||||||
|
|
||||||
wxSingleInstanceChecker *mChecker;
|
std::unique_ptr<wxSingleInstanceChecker> mChecker;
|
||||||
|
|
||||||
wxTimer mTimer;
|
wxTimer mTimer;
|
||||||
|
|
||||||
@ -298,7 +298,6 @@ class AudacityApp final : public wxApp {
|
|||||||
ODLock m_LastMissingBlockFileLock;
|
ODLock m_LastMissingBlockFileLock;
|
||||||
|
|
||||||
void InitCommandHandler();
|
void InitCommandHandler();
|
||||||
void DeInitCommandHandler();
|
|
||||||
|
|
||||||
bool InitTempDir();
|
bool InitTempDir();
|
||||||
bool CreateSingleInstanceChecker(const wxString &dir);
|
bool CreateSingleInstanceChecker(const wxString &dir);
|
||||||
@ -308,9 +307,9 @@ class AudacityApp final : public wxApp {
|
|||||||
bool mWindowRectAlreadySaved;
|
bool mWindowRectAlreadySaved;
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
IPCServ *mIPCServ;
|
std::unique_ptr<IPCServ> mIPCServ;
|
||||||
#else
|
#else
|
||||||
wxSocketServer *mIPCServ;
|
std::unique_ptr<wxSocketServer> mIPCServ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -373,7 +373,7 @@ DeviceChangeHandler::DeviceChangeHandler()
|
|||||||
: wxEvtHandler()
|
: wxEvtHandler()
|
||||||
{
|
{
|
||||||
mTimer.SetOwner(this);
|
mTimer.SetOwner(this);
|
||||||
mListener = new DeviceChangeListener();
|
mListener = std::make_unique<DeviceChangeListener>();
|
||||||
mListener->SetHandler(this);
|
mListener->SetHandler(this);
|
||||||
mListener->Enable(true);
|
mListener->Enable(true);
|
||||||
}
|
}
|
||||||
@ -381,10 +381,7 @@ DeviceChangeHandler::DeviceChangeHandler()
|
|||||||
DeviceChangeHandler::~DeviceChangeHandler()
|
DeviceChangeHandler::~DeviceChangeHandler()
|
||||||
{
|
{
|
||||||
if (mListener)
|
if (mListener)
|
||||||
{
|
|
||||||
mListener->Enable(false);
|
mListener->Enable(false);
|
||||||
delete mListener;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceChangeHandler::Enable(bool enable)
|
void DeviceChangeHandler::Enable(bool enable)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#if defined(EXPERIMENTAL_DEVICE_CHANGE_HANDLER)
|
#if defined(EXPERIMENTAL_DEVICE_CHANGE_HANDLER)
|
||||||
|
|
||||||
|
#include "MemoryX.h"
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(HAVE_LIBUDEV_H)
|
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(HAVE_LIBUDEV_H)
|
||||||
#define HAVE_DEVICE_CHANGE
|
#define HAVE_DEVICE_CHANGE
|
||||||
#endif
|
#endif
|
||||||
@ -48,7 +50,7 @@ private:
|
|||||||
void OnChange(wxCommandEvent & evt);
|
void OnChange(wxCommandEvent & evt);
|
||||||
void OnTimer(wxTimerEvent & evt);
|
void OnTimer(wxTimerEvent & evt);
|
||||||
|
|
||||||
DeviceChangeInterface *mListener;
|
std::unique_ptr<DeviceChangeInterface> mListener;
|
||||||
wxTimer mTimer;
|
wxTimer mTimer;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@ -20,21 +20,19 @@
|
|||||||
FileIO::FileIO(const wxString & name, FileIOMode mode)
|
FileIO::FileIO(const wxString & name, FileIOMode mode)
|
||||||
: mName(name),
|
: mName(name),
|
||||||
mMode(mode),
|
mMode(mode),
|
||||||
mInputStream(NULL),
|
|
||||||
mOutputStream(NULL),
|
|
||||||
mOpen(false)
|
mOpen(false)
|
||||||
{
|
{
|
||||||
wxString scheme;
|
wxString scheme;
|
||||||
|
|
||||||
if (mMode == FileIO::Input) {
|
if (mMode == FileIO::Input) {
|
||||||
mInputStream = new wxFFileInputStream(mName);
|
mInputStream = std::make_unique<wxFFileInputStream>(mName);
|
||||||
if (mInputStream == NULL || !mInputStream->IsOk()) {
|
if (mInputStream == NULL || !mInputStream->IsOk()) {
|
||||||
wxPrintf(wxT("Couldn't get input stream: %s\n"), name.c_str());
|
wxPrintf(wxT("Couldn't get input stream: %s\n"), name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mOutputStream = new wxFFileOutputStream(mName);
|
mOutputStream = std::make_unique<wxFFileOutputStream>(mName);
|
||||||
if (mOutputStream == NULL || !mOutputStream->IsOk()) {
|
if (mOutputStream == NULL || !mOutputStream->IsOk()) {
|
||||||
wxPrintf(wxT("Couldn't get output stream: %s\n"), name.c_str());
|
wxPrintf(wxT("Couldn't get output stream: %s\n"), name.c_str());
|
||||||
return;
|
return;
|
||||||
@ -56,16 +54,8 @@ bool FileIO::IsOpened()
|
|||||||
|
|
||||||
void FileIO::Close()
|
void FileIO::Close()
|
||||||
{
|
{
|
||||||
if (mOutputStream) {
|
mOutputStream.reset();
|
||||||
delete mOutputStream;
|
mInputStream.reset();
|
||||||
mOutputStream = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mInputStream) {
|
|
||||||
delete mInputStream;
|
|
||||||
mInputStream = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mOpen = false;
|
mOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#ifndef __AUDACITY_FILEIO__
|
#ifndef __AUDACITY_FILEIO__
|
||||||
#define __AUDACITY_FILEIO__
|
#define __AUDACITY_FILEIO__
|
||||||
|
|
||||||
|
#include "MemoryX.h"
|
||||||
#include <wx/object.h>
|
#include <wx/object.h>
|
||||||
#include <wx/wfstream.h>
|
#include <wx/wfstream.h>
|
||||||
|
|
||||||
@ -37,8 +38,8 @@ class FileIO
|
|||||||
private:
|
private:
|
||||||
wxString mName;
|
wxString mName;
|
||||||
FileIOMode mMode;
|
FileIOMode mMode;
|
||||||
wxInputStream *mInputStream;
|
std::unique_ptr<wxInputStream> mInputStream;
|
||||||
wxOutputStream *mOutputStream;
|
std::unique_ptr<wxOutputStream> mOutputStream;
|
||||||
bool mOpen;
|
bool mOpen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -190,8 +190,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
|
|||||||
: wxDialogWrapper(parent, id, title, pos, wxDefaultSize,
|
: wxDialogWrapper(parent, id, title, pos, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX),
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX),
|
||||||
mData(NULL),
|
mData(NULL),
|
||||||
mBitmap(NULL),
|
mAnalyst(std::make_unique<SpectrumAnalyst>())
|
||||||
mAnalyst(new SpectrumAnalyst())
|
|
||||||
{
|
{
|
||||||
SetName(GetTitle());
|
SetName(GetTitle());
|
||||||
|
|
||||||
@ -239,8 +238,8 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
|
|||||||
axisChoices.Add(_("Log frequency"));
|
axisChoices.Add(_("Log frequency"));
|
||||||
|
|
||||||
mFreqFont = wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
mFreqFont = wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||||
mArrowCursor = new wxCursor(wxCURSOR_ARROW);
|
mArrowCursor = std::make_unique<wxCursor>(wxCURSOR_ARROW);
|
||||||
mCrossCursor = new wxCursor(wxCURSOR_CROSS);
|
mCrossCursor = std::make_unique<wxCursor>(wxCURSOR_CROSS);
|
||||||
|
|
||||||
gPrefs->Read(wxT("/FreqWindow/DrawGrid"), &mDrawGrid, true);
|
gPrefs->Read(wxT("/FreqWindow/DrawGrid"), &mDrawGrid, true);
|
||||||
|
|
||||||
@ -515,12 +514,8 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
|
|||||||
|
|
||||||
FreqWindow::~FreqWindow()
|
FreqWindow::~FreqWindow()
|
||||||
{
|
{
|
||||||
if (mBitmap)
|
|
||||||
delete mBitmap;
|
|
||||||
if (mData)
|
if (mData)
|
||||||
delete[] mData;
|
delete[] mData;
|
||||||
delete mArrowCursor;
|
|
||||||
delete mCrossCursor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FreqWindow::Show(bool show)
|
bool FreqWindow::Show(bool show)
|
||||||
@ -622,15 +617,11 @@ void FreqWindow::DrawBackground(wxMemoryDC & dc)
|
|||||||
{
|
{
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
if (mBitmap)
|
mBitmap.reset();
|
||||||
{
|
|
||||||
delete mBitmap;
|
|
||||||
mBitmap = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPlotRect = mFreqPlot->GetClientRect();
|
mPlotRect = mFreqPlot->GetClientRect();
|
||||||
|
|
||||||
mBitmap = new wxBitmap(mPlotRect.width, mPlotRect.height);
|
mBitmap = std::make_unique<wxBitmap>(mPlotRect.width, mPlotRect.height);
|
||||||
|
|
||||||
dc.SelectObject(*mBitmap);
|
dc.SelectObject(*mBitmap);
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ private:
|
|||||||
|
|
||||||
wxFont mFreqFont;
|
wxFont mFreqFont;
|
||||||
|
|
||||||
wxCursor *mArrowCursor;
|
std::unique_ptr<wxCursor> mArrowCursor;
|
||||||
wxCursor *mCrossCursor;
|
std::unique_ptr<wxCursor> mCrossCursor;
|
||||||
|
|
||||||
wxButton *mCloseButton;
|
wxButton *mCloseButton;
|
||||||
wxButton *mExportButton;
|
wxButton *mExportButton;
|
||||||
@ -208,7 +208,7 @@ private:
|
|||||||
float mYMax;
|
float mYMax;
|
||||||
float mYStep;
|
float mYStep;
|
||||||
|
|
||||||
wxBitmap *mBitmap;
|
std::unique_ptr<wxBitmap> mBitmap;
|
||||||
|
|
||||||
int mMouseX;
|
int mMouseX;
|
||||||
int mMouseY;
|
int mMouseY;
|
||||||
|
@ -91,13 +91,12 @@ static tpRegScriptServerFunc scriptFn;
|
|||||||
Module::Module(const wxString & name)
|
Module::Module(const wxString & name)
|
||||||
{
|
{
|
||||||
mName = name;
|
mName = name;
|
||||||
mLib = new wxDynamicLibrary();
|
mLib = std::make_unique<wxDynamicLibrary>();
|
||||||
mDispatch = NULL;
|
mDispatch = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::~Module()
|
Module::~Module()
|
||||||
{
|
{
|
||||||
delete mLib;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::Load()
|
bool Module::Load()
|
||||||
@ -183,15 +182,18 @@ void * Module::GetSymbol(const wxString &name)
|
|||||||
std::unique_ptr<ModuleManager> ModuleManager::mInstance{};
|
std::unique_ptr<ModuleManager> ModuleManager::mInstance{};
|
||||||
|
|
||||||
// Provide builtin modules a means to identify themselves
|
// Provide builtin modules a means to identify themselves
|
||||||
static wxArrayPtrVoid *pBuiltinModuleList = NULL;
|
using BuiltinModuleList = std::vector<ModuleMain>;
|
||||||
|
namespace {
|
||||||
|
BuiltinModuleList &builtinModuleList()
|
||||||
|
{
|
||||||
|
static BuiltinModuleList theList;
|
||||||
|
return theList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RegisterBuiltinModule(ModuleMain moduleMain)
|
void RegisterBuiltinModule(ModuleMain moduleMain)
|
||||||
{
|
{
|
||||||
if (pBuiltinModuleList == NULL)
|
builtinModuleList().push_back(moduleMain);
|
||||||
{
|
|
||||||
pBuiltinModuleList = new wxArrayPtrVoid;
|
|
||||||
}
|
|
||||||
|
|
||||||
pBuiltinModuleList->Add((void *)moduleMain);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -206,19 +208,8 @@ ModuleManager::ModuleManager()
|
|||||||
|
|
||||||
ModuleManager::~ModuleManager()
|
ModuleManager::~ModuleManager()
|
||||||
{
|
{
|
||||||
size_t cnt = mModules.GetCount();
|
|
||||||
|
|
||||||
for (size_t ndx = 0; ndx < cnt; ndx++) {
|
|
||||||
delete (Module *) mModules[ndx];
|
|
||||||
}
|
|
||||||
mModules.Clear();
|
|
||||||
|
|
||||||
mDynModules.clear();
|
mDynModules.clear();
|
||||||
|
builtinModuleList().clear();
|
||||||
if (pBuiltinModuleList != NULL)
|
|
||||||
{
|
|
||||||
delete pBuiltinModuleList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@ -299,10 +290,11 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
|||||||
ModulePrefs::SetModuleStatus( files[i], kModuleFailed );
|
ModulePrefs::SetModuleStatus( files[i], kModuleFailed );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Module *module = new Module(files[i]);
|
auto umodule = make_movable<Module>(files[i]);
|
||||||
if (module->Load()) // it will get rejected if there are version problems
|
if (umodule->Load()) // it will get rejected if there are version problems
|
||||||
{
|
{
|
||||||
Get().mModules.Add(module);
|
auto module = umodule.get();
|
||||||
|
Get().mModules.push_back(std::move(umodule));
|
||||||
// We've loaded and initialised OK.
|
// We've loaded and initialised OK.
|
||||||
// So look for special case functions:
|
// So look for special case functions:
|
||||||
wxLogNull logNo; // Don't show wxWidgets errors if we can't do these. (Was: Fix bug 544.)
|
wxLogNull logNo; // Don't show wxWidgets errors if we can't do these. (Was: Fix bug 544.)
|
||||||
@ -319,10 +311,6 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
|||||||
ModulePrefs::SetModuleStatus( files[i], iModuleStatus);
|
ModulePrefs::SetModuleStatus( files[i], iModuleStatus);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// No need to save status, as we already set kModuleFailed.
|
|
||||||
delete module;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
::wxSetWorkingDirectory(saveOldCWD);
|
::wxSetWorkingDirectory(saveOldCWD);
|
||||||
|
|
||||||
@ -338,11 +326,7 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
|||||||
// static
|
// static
|
||||||
int ModuleManager::Dispatch(ModuleDispatchTypes type)
|
int ModuleManager::Dispatch(ModuleDispatchTypes type)
|
||||||
{
|
{
|
||||||
size_t cnt = Get().mModules.GetCount();
|
for (const auto &module: mModules) {
|
||||||
|
|
||||||
for (size_t ndx = 0; ndx < cnt; ndx++) {
|
|
||||||
Module *module = (Module *)Get().mModules[ndx];
|
|
||||||
|
|
||||||
module->Dispatch(type);
|
module->Dispatch(type);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -413,10 +397,10 @@ void ModuleManager::InitializeBuiltins()
|
|||||||
{
|
{
|
||||||
PluginManager & pm = PluginManager::Get();
|
PluginManager & pm = PluginManager::Get();
|
||||||
|
|
||||||
for (size_t i = 0, cnt = pBuiltinModuleList->GetCount(); i < cnt; i++)
|
for (auto moduleMain : builtinModuleList())
|
||||||
{
|
{
|
||||||
ModuleInterfaceHandle module {
|
ModuleInterfaceHandle module {
|
||||||
((ModuleMain)(*pBuiltinModuleList)[i])(this, NULL), ModuleInterfaceDeleter{}
|
moduleMain(this, NULL), ModuleInterfaceDeleter{}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (module->Initialize())
|
if (module->Initialize())
|
||||||
@ -484,7 +468,7 @@ void ModuleInterfaceDeleter::operator() (ModuleInterface *pInterface) const
|
|||||||
if (iter != libs.end())
|
if (iter != libs.end())
|
||||||
libs.erase(iter); // This causes unloading in ~wxDynamicLibrary
|
libs.erase(iter); // This causes unloading in ~wxDynamicLibrary
|
||||||
|
|
||||||
delete pInterface;
|
std::unique_ptr < ModuleInterface > { pInterface }; // DELETE it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
wxString mName;
|
wxString mName;
|
||||||
wxDynamicLibrary *mLib;
|
std::unique_ptr<wxDynamicLibrary> mLib;
|
||||||
fnModuleDispatch mDispatch;
|
fnModuleDispatch mDispatch;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ private:
|
|||||||
ModuleMap mDynModules;
|
ModuleMap mDynModules;
|
||||||
LibraryMap mLibs;
|
LibraryMap mLibs;
|
||||||
|
|
||||||
wxArrayPtrVoid mModules;
|
std::vector<movable_ptr<Module>> mModules;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __AUDACITY_MODULEMANAGER_H__ */
|
#endif /* __AUDACITY_MODULEMANAGER_H__ */
|
||||||
|
@ -1681,11 +1681,6 @@ PluginManager::~PluginManager()
|
|||||||
{
|
{
|
||||||
// Ensure termination (harmless if already done)
|
// Ensure termination (harmless if already done)
|
||||||
Terminate();
|
Terminate();
|
||||||
|
|
||||||
if (mSettings)
|
|
||||||
{
|
|
||||||
delete mSettings;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -1750,20 +1745,19 @@ void PluginManager::Terminate()
|
|||||||
void PluginManager::Load()
|
void PluginManager::Load()
|
||||||
{
|
{
|
||||||
// Create/Open the registry
|
// Create/Open the registry
|
||||||
mRegistry = new wxFileConfig(wxEmptyString, wxEmptyString, FileNames::PluginRegistry());
|
wxFileConfig registry(wxEmptyString, wxEmptyString, FileNames::PluginRegistry());
|
||||||
|
|
||||||
// If this group doesn't exist then we have something that's not a registry.
|
// If this group doesn't exist then we have something that's not a registry.
|
||||||
// We should probably warn the user, but it's pretty unlikely that this will happen.
|
// We should probably warn the user, but it's pretty unlikely that this will happen.
|
||||||
if (!mRegistry->HasGroup(REGROOT))
|
if (!registry.HasGroup(REGROOT))
|
||||||
{
|
{
|
||||||
// Must start over
|
// Must start over
|
||||||
mRegistry->DeleteAll();
|
registry.DeleteAll();
|
||||||
delete mRegistry;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a registry version that we can understand
|
// Check for a registry version that we can understand
|
||||||
wxString regver = mRegistry->Read(REGVERKEY);
|
wxString regver = registry.Read(REGVERKEY);
|
||||||
if (regver < REGVERCUR )
|
if (regver < REGVERCUR )
|
||||||
{
|
{
|
||||||
// This is where we'd put in conversion code when the
|
// This is where we'd put in conversion code when the
|
||||||
@ -1774,25 +1768,23 @@ void PluginManager::Load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load all provider plugins first
|
// Load all provider plugins first
|
||||||
LoadGroup(PluginTypeModule);
|
LoadGroup(®istry, PluginTypeModule);
|
||||||
|
|
||||||
// Now the rest
|
// Now the rest
|
||||||
LoadGroup(PluginTypeEffect);
|
LoadGroup(®istry, PluginTypeEffect);
|
||||||
LoadGroup(PluginTypeExporter);
|
LoadGroup(®istry, PluginTypeExporter);
|
||||||
LoadGroup(PluginTypeImporter);
|
LoadGroup(®istry, PluginTypeImporter);
|
||||||
|
|
||||||
LoadGroup(PluginTypeStub);
|
LoadGroup(®istry, PluginTypeStub);
|
||||||
|
|
||||||
// Not used by 2.1.1 or greater, but must load to allow users to switch between 2.1.0
|
// Not used by 2.1.1 or greater, but must load to allow users to switch between 2.1.0
|
||||||
// and 2.1.1+. This should be removed after a few releases past 2.1.0.
|
// and 2.1.1+. This should be removed after a few releases past 2.1.0.
|
||||||
LoadGroup(PluginTypeNone);
|
LoadGroup(®istry, PluginTypeNone);
|
||||||
|
|
||||||
delete mRegistry;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManager::LoadGroup(PluginType type)
|
void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type)
|
||||||
{
|
{
|
||||||
wxString strVal;
|
wxString strVal;
|
||||||
bool boolVal;
|
bool boolVal;
|
||||||
@ -1801,22 +1793,22 @@ void PluginManager::LoadGroup(PluginType type)
|
|||||||
wxString group = GetPluginTypeString(type);
|
wxString group = GetPluginTypeString(type);
|
||||||
wxString cfgPath = REGROOT + group + wxCONFIG_PATH_SEPARATOR;
|
wxString cfgPath = REGROOT + group + wxCONFIG_PATH_SEPARATOR;
|
||||||
|
|
||||||
mRegistry->SetPath(cfgPath);
|
pRegistry->SetPath(cfgPath);
|
||||||
for (bool cont = mRegistry->GetFirstGroup(groupName, groupIndex);
|
for (bool cont = pRegistry->GetFirstGroup(groupName, groupIndex);
|
||||||
cont;
|
cont;
|
||||||
mRegistry->SetPath(cfgPath),
|
pRegistry->SetPath(cfgPath),
|
||||||
cont = mRegistry->GetNextGroup(groupName, groupIndex))
|
cont = pRegistry->GetNextGroup(groupName, groupIndex))
|
||||||
{
|
{
|
||||||
PluginDescriptor plug;
|
PluginDescriptor plug;
|
||||||
|
|
||||||
mRegistry->SetPath(groupName);
|
pRegistry->SetPath(groupName);
|
||||||
|
|
||||||
groupName = ConvertID(groupName);
|
groupName = ConvertID(groupName);
|
||||||
|
|
||||||
// Bypass group if the ID is already in use
|
// Bypass group if the ID is already in use
|
||||||
if (mPlugins.find(groupName) != mPlugins.end())
|
if (mPlugins.find(groupName) != mPlugins.end())
|
||||||
{
|
{
|
||||||
mRegistry->SetPath(wxT(".."));
|
pRegistry->SetPath(wxT(".."));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1826,7 +1818,7 @@ void PluginManager::LoadGroup(PluginType type)
|
|||||||
plug.SetPluginType(type);
|
plug.SetPluginType(type);
|
||||||
|
|
||||||
// Get the provider ID and bypass group if not found
|
// Get the provider ID and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_PROVIDERID, &strVal, wxEmptyString))
|
if (!pRegistry->Read(KEY_PROVIDERID, &strVal, wxEmptyString))
|
||||||
{
|
{
|
||||||
// Bypass group if the provider isn't valid
|
// Bypass group if the provider isn't valid
|
||||||
if (!strVal.IsEmpty() && mPlugins.find(strVal) == mPlugins.end())
|
if (!strVal.IsEmpty() && mPlugins.find(strVal) == mPlugins.end())
|
||||||
@ -1837,50 +1829,50 @@ void PluginManager::LoadGroup(PluginType type)
|
|||||||
plug.SetProviderID(PluginID(strVal));
|
plug.SetProviderID(PluginID(strVal));
|
||||||
|
|
||||||
// Get the path (optional)
|
// Get the path (optional)
|
||||||
mRegistry->Read(KEY_PATH, &strVal, wxEmptyString);
|
pRegistry->Read(KEY_PATH, &strVal, wxEmptyString);
|
||||||
plug.SetPath(strVal);
|
plug.SetPath(strVal);
|
||||||
|
|
||||||
// Get the name and bypass group if not found
|
// Get the name and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_NAME, &strVal))
|
if (!pRegistry->Read(KEY_NAME, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetName(strVal);
|
plug.SetName(strVal);
|
||||||
|
|
||||||
// Get the symbol...use name if not found
|
// Get the symbol...use name if not found
|
||||||
if (!mRegistry->Read(KEY_SYMBOL, &strVal))
|
if (!pRegistry->Read(KEY_SYMBOL, &strVal))
|
||||||
{
|
{
|
||||||
strVal = plug.GetName();
|
strVal = plug.GetName();
|
||||||
}
|
}
|
||||||
plug.SetSymbol(strVal);
|
plug.SetSymbol(strVal);
|
||||||
|
|
||||||
// Get the version and bypass group if not found
|
// Get the version and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_VERSION, &strVal))
|
if (!pRegistry->Read(KEY_VERSION, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetVersion(strVal);
|
plug.SetVersion(strVal);
|
||||||
|
|
||||||
// Get the vendor and bypass group if not found
|
// Get the vendor and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_VENDOR, &strVal))
|
if (!pRegistry->Read(KEY_VENDOR, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetVendor(strVal);
|
plug.SetVendor(strVal);
|
||||||
|
|
||||||
// Get the description and bypass group if not found
|
// Get the description and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_DESCRIPTION, &strVal))
|
if (!pRegistry->Read(KEY_DESCRIPTION, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetDescription(strVal);
|
plug.SetDescription(strVal);
|
||||||
|
|
||||||
// Is it enabled...default to no if not found
|
// Is it enabled...default to no if not found
|
||||||
mRegistry->Read(KEY_ENABLED, &boolVal, false);
|
pRegistry->Read(KEY_ENABLED, &boolVal, false);
|
||||||
plug.SetEnabled(boolVal);
|
plug.SetEnabled(boolVal);
|
||||||
|
|
||||||
// Is it valid...default to no if not found
|
// Is it valid...default to no if not found
|
||||||
mRegistry->Read(KEY_VALID, &boolVal, false);
|
pRegistry->Read(KEY_VALID, &boolVal, false);
|
||||||
plug.SetValid(boolVal);
|
plug.SetValid(boolVal);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -1894,7 +1886,7 @@ void PluginManager::LoadGroup(PluginType type)
|
|||||||
case PluginTypeEffect:
|
case PluginTypeEffect:
|
||||||
{
|
{
|
||||||
// Get the effect type and bypass group if not found
|
// Get the effect type and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_EFFECTTYPE, &strVal))
|
if (!pRegistry->Read(KEY_EFFECTTYPE, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1925,35 +1917,35 @@ void PluginManager::LoadGroup(PluginType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the effect family and bypass group if not found
|
// Get the effect family and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_EFFECTFAMILY, &strVal))
|
if (!pRegistry->Read(KEY_EFFECTFAMILY, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetEffectFamily(strVal);
|
plug.SetEffectFamily(strVal);
|
||||||
|
|
||||||
// Is it a default (above the line) effect and bypass group if not found
|
// Is it a default (above the line) effect and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_EFFECTDEFAULT, &boolVal))
|
if (!pRegistry->Read(KEY_EFFECTDEFAULT, &boolVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetEffectDefault(boolVal);
|
plug.SetEffectDefault(boolVal);
|
||||||
|
|
||||||
// Is it an interactive effect and bypass group if not found
|
// Is it an interactive effect and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_EFFECTINTERACTIVE, &boolVal))
|
if (!pRegistry->Read(KEY_EFFECTINTERACTIVE, &boolVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetEffectInteractive(boolVal);
|
plug.SetEffectInteractive(boolVal);
|
||||||
|
|
||||||
// Is it a realtime capable effect and bypass group if not found
|
// Is it a realtime capable effect and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_EFFECTREALTIME, &boolVal))
|
if (!pRegistry->Read(KEY_EFFECTREALTIME, &boolVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetEffectRealtime(boolVal);
|
plug.SetEffectRealtime(boolVal);
|
||||||
|
|
||||||
// Does the effect support automation...bypass group if not found
|
// Does the effect support automation...bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_EFFECTAUTOMATABLE, &boolVal))
|
if (!pRegistry->Read(KEY_EFFECTAUTOMATABLE, &boolVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1964,21 +1956,21 @@ void PluginManager::LoadGroup(PluginType type)
|
|||||||
case PluginTypeImporter:
|
case PluginTypeImporter:
|
||||||
{
|
{
|
||||||
// Get the importer identifier and bypass group if not found
|
// Get the importer identifier and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_IMPORTERIDENT, &strVal))
|
if (!pRegistry->Read(KEY_IMPORTERIDENT, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetImporterIdentifier(strVal);
|
plug.SetImporterIdentifier(strVal);
|
||||||
|
|
||||||
// Get the importer filter description and bypass group if not found
|
// Get the importer filter description and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_IMPORTERFILTER, &strVal))
|
if (!pRegistry->Read(KEY_IMPORTERFILTER, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plug.SetImporterFilterDescription(strVal);
|
plug.SetImporterFilterDescription(strVal);
|
||||||
|
|
||||||
// Get the importer extensions and bypass group if not found
|
// Get the importer extensions and bypass group if not found
|
||||||
if (!mRegistry->Read(KEY_IMPORTEREXTENSIONS, &strVal))
|
if (!pRegistry->Read(KEY_IMPORTEREXTENSIONS, &strVal))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2021,34 +2013,32 @@ void PluginManager::LoadGroup(PluginType type)
|
|||||||
void PluginManager::Save()
|
void PluginManager::Save()
|
||||||
{
|
{
|
||||||
// Create/Open the registry
|
// Create/Open the registry
|
||||||
mRegistry = new wxFileConfig(wxEmptyString, wxEmptyString, FileNames::PluginRegistry());
|
wxFileConfig registry(wxEmptyString, wxEmptyString, FileNames::PluginRegistry());
|
||||||
|
|
||||||
// Clear it out
|
// Clear it out
|
||||||
mRegistry->DeleteAll();
|
registry.DeleteAll();
|
||||||
|
|
||||||
// Write the version string
|
// Write the version string
|
||||||
mRegistry->Write(REGVERKEY, REGVERCUR);
|
registry.Write(REGVERKEY, REGVERCUR);
|
||||||
|
|
||||||
// Save the individual groups
|
// Save the individual groups
|
||||||
SaveGroup(PluginTypeEffect);
|
SaveGroup(®istry, PluginTypeEffect);
|
||||||
SaveGroup(PluginTypeExporter);
|
SaveGroup(®istry, PluginTypeExporter);
|
||||||
SaveGroup(PluginTypeImporter);
|
SaveGroup(®istry, PluginTypeImporter);
|
||||||
SaveGroup(PluginTypeStub);
|
SaveGroup(®istry, PluginTypeStub);
|
||||||
|
|
||||||
// Not used by 2.1.1 or greater, but must save to allow users to switch between 2.1.0
|
// Not used by 2.1.1 or greater, but must save to allow users to switch between 2.1.0
|
||||||
// and 2.1.1+. This should be removed after a few releases past 2.1.0.
|
// and 2.1.1+. This should be removed after a few releases past 2.1.0.
|
||||||
SaveGroup(PluginTypeNone);
|
SaveGroup(®istry, PluginTypeNone);
|
||||||
|
|
||||||
// And now the providers
|
// And now the providers
|
||||||
SaveGroup(PluginTypeModule);
|
SaveGroup(®istry, PluginTypeModule);
|
||||||
|
|
||||||
// Just to be safe
|
// Just to be safe
|
||||||
mRegistry->Flush();
|
registry.Flush();
|
||||||
|
|
||||||
delete mRegistry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManager::SaveGroup(PluginType type)
|
void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type)
|
||||||
{
|
{
|
||||||
wxString group = GetPluginTypeString(type);
|
wxString group = GetPluginTypeString(type);
|
||||||
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
|
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
|
||||||
@ -2060,17 +2050,17 @@ void PluginManager::SaveGroup(PluginType type)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mRegistry->SetPath(REGROOT + group + wxCONFIG_PATH_SEPARATOR + ConvertID(plug.GetID()));
|
pRegistry->SetPath(REGROOT + group + wxCONFIG_PATH_SEPARATOR + ConvertID(plug.GetID()));
|
||||||
|
|
||||||
mRegistry->Write(KEY_PATH, plug.GetPath());
|
pRegistry->Write(KEY_PATH, plug.GetPath());
|
||||||
mRegistry->Write(KEY_SYMBOL, plug.GetSymbol());
|
pRegistry->Write(KEY_SYMBOL, plug.GetSymbol());
|
||||||
mRegistry->Write(KEY_NAME, plug.GetName(false));
|
pRegistry->Write(KEY_NAME, plug.GetName(false));
|
||||||
mRegistry->Write(KEY_VERSION, plug.GetVersion(false));
|
pRegistry->Write(KEY_VERSION, plug.GetVersion(false));
|
||||||
mRegistry->Write(KEY_VENDOR, plug.GetVendor(false));
|
pRegistry->Write(KEY_VENDOR, plug.GetVendor(false));
|
||||||
mRegistry->Write(KEY_DESCRIPTION, plug.GetDescription(false));
|
pRegistry->Write(KEY_DESCRIPTION, plug.GetDescription(false));
|
||||||
mRegistry->Write(KEY_PROVIDERID, plug.GetProviderID());
|
pRegistry->Write(KEY_PROVIDERID, plug.GetProviderID());
|
||||||
mRegistry->Write(KEY_ENABLED, plug.IsEnabled());
|
pRegistry->Write(KEY_ENABLED, plug.IsEnabled());
|
||||||
mRegistry->Write(KEY_VALID, plug.IsValid());
|
pRegistry->Write(KEY_VALID, plug.IsValid());
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@ -2101,19 +2091,19 @@ void PluginManager::SaveGroup(PluginType type)
|
|||||||
{
|
{
|
||||||
stype = KEY_EFFECTTYPE_HIDDEN;
|
stype = KEY_EFFECTTYPE_HIDDEN;
|
||||||
}
|
}
|
||||||
mRegistry->Write(KEY_EFFECTTYPE, stype);
|
pRegistry->Write(KEY_EFFECTTYPE, stype);
|
||||||
mRegistry->Write(KEY_EFFECTFAMILY, plug.GetEffectFamily(false));
|
pRegistry->Write(KEY_EFFECTFAMILY, plug.GetEffectFamily(false));
|
||||||
mRegistry->Write(KEY_EFFECTDEFAULT, plug.IsEffectDefault());
|
pRegistry->Write(KEY_EFFECTDEFAULT, plug.IsEffectDefault());
|
||||||
mRegistry->Write(KEY_EFFECTINTERACTIVE, plug.IsEffectInteractive());
|
pRegistry->Write(KEY_EFFECTINTERACTIVE, plug.IsEffectInteractive());
|
||||||
mRegistry->Write(KEY_EFFECTREALTIME, plug.IsEffectRealtime());
|
pRegistry->Write(KEY_EFFECTREALTIME, plug.IsEffectRealtime());
|
||||||
mRegistry->Write(KEY_EFFECTAUTOMATABLE, plug.IsEffectAutomatable());
|
pRegistry->Write(KEY_EFFECTAUTOMATABLE, plug.IsEffectAutomatable());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PluginTypeImporter:
|
case PluginTypeImporter:
|
||||||
{
|
{
|
||||||
mRegistry->Write(KEY_IMPORTERIDENT, plug.GetImporterIdentifier());
|
pRegistry->Write(KEY_IMPORTERIDENT, plug.GetImporterIdentifier());
|
||||||
mRegistry->Write(KEY_IMPORTERFILTER, plug.GetImporterFilterDescription());
|
pRegistry->Write(KEY_IMPORTERFILTER, plug.GetImporterFilterDescription());
|
||||||
const wxArrayString & extensions = plug.GetImporterExtensions();
|
const wxArrayString & extensions = plug.GetImporterExtensions();
|
||||||
wxString strExt;
|
wxString strExt;
|
||||||
for (size_t i = 0, cnt = extensions.size(); i < cnt; i++)
|
for (size_t i = 0, cnt = extensions.size(); i < cnt; i++)
|
||||||
@ -2121,7 +2111,7 @@ void PluginManager::SaveGroup(PluginType type)
|
|||||||
strExt += extensions[i] + wxT(":");
|
strExt += extensions[i] + wxT(":");
|
||||||
}
|
}
|
||||||
strExt.RemoveLast(1);
|
strExt.RemoveLast(1);
|
||||||
mRegistry->Write(KEY_IMPORTEREXTENSIONS, strExt);
|
pRegistry->Write(KEY_IMPORTEREXTENSIONS, strExt);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2517,7 +2507,7 @@ wxFileConfig *PluginManager::GetSettings()
|
|||||||
{
|
{
|
||||||
if (!mSettings)
|
if (!mSettings)
|
||||||
{
|
{
|
||||||
mSettings = new wxFileConfig(wxEmptyString, wxEmptyString, FileNames::PluginSettings());
|
mSettings = std::make_unique<wxFileConfig>(wxEmptyString, wxEmptyString, FileNames::PluginSettings());
|
||||||
|
|
||||||
// Check for a settings version that we can understand
|
// Check for a settings version that we can understand
|
||||||
if (mSettings->HasEntry(SETVERKEY))
|
if (mSettings->HasEntry(SETVERKEY))
|
||||||
@ -2540,7 +2530,7 @@ wxFileConfig *PluginManager::GetSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mSettings;
|
return mSettings.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginManager::HasGroup(const wxString & group)
|
bool PluginManager::HasGroup(const wxString & group)
|
||||||
|
@ -273,9 +273,9 @@ private:
|
|||||||
~PluginManager();
|
~PluginManager();
|
||||||
|
|
||||||
void Load();
|
void Load();
|
||||||
void LoadGroup(PluginType type);
|
void LoadGroup(wxFileConfig *pRegistry, PluginType type);
|
||||||
void Save();
|
void Save();
|
||||||
void SaveGroup(PluginType type);
|
void SaveGroup(wxFileConfig *pRegistry, PluginType type);
|
||||||
|
|
||||||
PluginDescriptor & CreatePlugin(const PluginID & id, IdentInterface *ident, PluginType type);
|
PluginDescriptor & CreatePlugin(const PluginID & id, IdentInterface *ident, PluginType type);
|
||||||
|
|
||||||
@ -316,8 +316,7 @@ private:
|
|||||||
|
|
||||||
bool IsDirty();
|
bool IsDirty();
|
||||||
void SetDirty(bool dirty = true);
|
void SetDirty(bool dirty = true);
|
||||||
wxFileConfig *mRegistry;
|
std::unique_ptr<wxFileConfig> mSettings;
|
||||||
wxFileConfig *mSettings;
|
|
||||||
|
|
||||||
bool mDirty;
|
bool mDirty;
|
||||||
int mCurrentIndex;
|
int mCurrentIndex;
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
|
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
|
|
||||||
|
std::unique_ptr<wxFileConfig> ugPrefs {};
|
||||||
wxFileConfig *gPrefs = NULL;
|
wxFileConfig *gPrefs = NULL;
|
||||||
int gMenusDirty = 0;
|
int gMenusDirty = 0;
|
||||||
|
|
||||||
@ -134,9 +135,11 @@ void InitPreferences()
|
|||||||
|
|
||||||
wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));
|
wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));
|
||||||
|
|
||||||
gPrefs = new wxFileConfig(appName, wxEmptyString,
|
ugPrefs = std::make_unique<wxFileConfig>
|
||||||
configFileName.GetFullPath(),
|
(appName, wxEmptyString,
|
||||||
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
|
configFileName.GetFullPath(),
|
||||||
|
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
|
||||||
|
gPrefs = ugPrefs.get();
|
||||||
|
|
||||||
wxConfigBase::Set(gPrefs);
|
wxConfigBase::Set(gPrefs);
|
||||||
|
|
||||||
@ -318,7 +321,7 @@ void FinishPreferences()
|
|||||||
{
|
{
|
||||||
if (gPrefs) {
|
if (gPrefs) {
|
||||||
wxConfigBase::Set(NULL);
|
wxConfigBase::Set(NULL);
|
||||||
delete gPrefs;
|
ugPrefs.reset();
|
||||||
gPrefs = NULL;
|
gPrefs = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ but it will probably work fine if you use it on a high level.
|
|||||||
|
|
||||||
*//*******************************************************************/
|
*//*******************************************************************/
|
||||||
|
|
||||||
|
#include "Audacity.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -54,10 +55,6 @@ Profiler::~Profiler()
|
|||||||
fprintf(log,"\n****************************************\n\n\n");
|
fprintf(log,"\n****************************************\n\n\n");
|
||||||
|
|
||||||
fclose(log);
|
fclose(log);
|
||||||
|
|
||||||
//DELETE everything.
|
|
||||||
for(int i=0;i<(int)mTasks.size();i++)
|
|
||||||
delete mTasks[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,14 +80,10 @@ void Profiler::End(char* fileName, int lineNum, char* taskDescription)
|
|||||||
///Gets the singleton instance
|
///Gets the singleton instance
|
||||||
Profiler* Profiler::Instance()
|
Profiler* Profiler::Instance()
|
||||||
{
|
{
|
||||||
static Profiler* pro=NULL;
|
static Profiler pro;
|
||||||
//this isn't 100% threadsafe but I think Okay for this purpose.
|
//this isn't 100% threadsafe but I think Okay for this purpose.
|
||||||
|
|
||||||
if(!pro)
|
return &pro;
|
||||||
pro = new Profiler();
|
|
||||||
|
|
||||||
return pro;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///find a taskProfile for the given task, otherwise create
|
///find a taskProfile for the given task, otherwise create
|
||||||
@ -99,12 +92,12 @@ TaskProfile* Profiler::GetOrCreateTaskProfile(char* fileName, int lineNum)
|
|||||||
for(int i=0;i<(int)mTasks.size();i++)
|
for(int i=0;i<(int)mTasks.size();i++)
|
||||||
{
|
{
|
||||||
if(strcmp(fileName,mTasks[i]->mFileName)==0 && lineNum == mTasks[i]->mLine)
|
if(strcmp(fileName,mTasks[i]->mFileName)==0 && lineNum == mTasks[i]->mLine)
|
||||||
return mTasks[i];
|
return mTasks[i].get();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskProfile* tp = new TaskProfile();
|
auto tp = make_movable<TaskProfile>();
|
||||||
mTasks.push_back(tp);
|
mTasks.push_back(std::move(tp));
|
||||||
return tp;
|
return mTasks.back().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskProfile* Profiler::GetTaskProfileByDescription(char* description)
|
TaskProfile* Profiler::GetTaskProfileByDescription(char* description)
|
||||||
@ -112,7 +105,7 @@ TaskProfile* Profiler::GetTaskProfileByDescription(char* description)
|
|||||||
for(int i=0;i<(int)mTasks.size();i++)
|
for(int i=0;i<(int)mTasks.size();i++)
|
||||||
{
|
{
|
||||||
if(strcmp(description,mTasks[i]->mDescription)==0)
|
if(strcmp(description,mTasks[i]->mDescription)==0)
|
||||||
return mTasks[i];
|
return mTasks[i].get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -26,6 +26,7 @@ but it will probably work fine if you use it on a high level.
|
|||||||
|
|
||||||
#ifndef __AUDACITY_PROFILER__
|
#ifndef __AUDACITY_PROFILER__
|
||||||
#define __AUDACITY_PROFILER__
|
#define __AUDACITY_PROFILER__
|
||||||
|
#include "MemoryX.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "ondemand/ODTaskThread.h"
|
#include "ondemand/ODTaskThread.h"
|
||||||
@ -59,7 +60,7 @@ class Profiler
|
|||||||
TaskProfile* GetTaskProfileByDescription(char* description);
|
TaskProfile* GetTaskProfileByDescription(char* description);
|
||||||
|
|
||||||
//List of current Task to do.
|
//List of current Task to do.
|
||||||
std::vector<TaskProfile*> mTasks;
|
std::vector<movable_ptr<TaskProfile>> mTasks;
|
||||||
//mutex for above variable
|
//mutex for above variable
|
||||||
ODLock mTasksMutex;
|
ODLock mTasksMutex;
|
||||||
|
|
||||||
|
@ -2026,7 +2026,7 @@ ShuttleGui::ShuttleGui(wxWindow * pParent, teShuttleMode ShuttleMode) :
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpShuttle = new ShuttlePrefs;
|
mpShuttle = std::make_unique<ShuttlePrefs>();
|
||||||
// In this case the client is the GUI, so if creating we do want to
|
// In this case the client is the GUI, so if creating we do want to
|
||||||
// store in the client.
|
// store in the client.
|
||||||
mpShuttle->mbStoreInClient = (mShuttleMode == eIsCreating );
|
mpShuttle->mbStoreInClient = (mShuttleMode == eIsCreating );
|
||||||
@ -2034,8 +2034,6 @@ ShuttleGui::ShuttleGui(wxWindow * pParent, teShuttleMode ShuttleMode) :
|
|||||||
|
|
||||||
ShuttleGui::~ShuttleGui()
|
ShuttleGui::~ShuttleGui()
|
||||||
{
|
{
|
||||||
if( mpShuttle )
|
|
||||||
delete mpShuttle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we have Audacity specific shuttle functions.
|
// Now we have Audacity specific shuttle functions.
|
||||||
|
@ -286,7 +286,7 @@ protected:
|
|||||||
wxSizer * pSizerStack[ nMaxNestedSizers ];
|
wxSizer * pSizerStack[ nMaxNestedSizers ];
|
||||||
wxString mBoxName;
|
wxString mBoxName;
|
||||||
|
|
||||||
Shuttle * mpShuttle; /*! Controls source/destination of shuttled data. You can
|
std::unique_ptr<Shuttle> mpShuttle; /*! Controls source/destination of shuttled data. You can
|
||||||
leave this NULL if you are shuttling to variables */
|
leave this NULL if you are shuttling to variables */
|
||||||
int miNoMatchSelector; //! Used in choices to determine which item to use on no match.
|
int miNoMatchSelector; //! Used in choices to determine which item to use on no match.
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void SplashDialog::Populate( ShuttleGui & S )
|
|||||||
S.StartVerticalLay(1);
|
S.StartVerticalLay(1);
|
||||||
|
|
||||||
//v For now, change to AudacityLogoWithName via old-fashioned ways, not Theme.
|
//v For now, change to AudacityLogoWithName via old-fashioned ways, not Theme.
|
||||||
m_pLogo = new wxBitmap((const char **) AudacityLogoWithName_xpm); //v
|
m_pLogo = std::make_unique<wxBitmap>((const char **) AudacityLogoWithName_xpm); //v
|
||||||
|
|
||||||
// JKC: Resize to 50% of size. Later we may use a smaller xpm as
|
// JKC: Resize to 50% of size. Later we may use a smaller xpm as
|
||||||
// our source, but this allows us to tweak the size - if we want to.
|
// our source, but this allows us to tweak the size - if we want to.
|
||||||
@ -123,7 +123,6 @@ void SplashDialog::Populate( ShuttleGui & S )
|
|||||||
|
|
||||||
SplashDialog::~SplashDialog()
|
SplashDialog::~SplashDialog()
|
||||||
{
|
{
|
||||||
delete m_pLogo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashDialog::OnDontShow( wxCommandEvent & Evt )
|
void SplashDialog::OnDontShow( wxCommandEvent & Evt )
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#ifndef __AUDACITY_SPLASH_DLG__
|
#ifndef __AUDACITY_SPLASH_DLG__
|
||||||
#define __AUDACITY_SPLASH_DLG__
|
#define __AUDACITY_SPLASH_DLG__
|
||||||
|
|
||||||
|
#include "MemoryX.h"
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include "widgets/wxPanelWrapper.h"
|
#include "widgets/wxPanelWrapper.h"
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ private:
|
|||||||
void OnDontShow( wxCommandEvent & Evt );
|
void OnDontShow( wxCommandEvent & Evt );
|
||||||
|
|
||||||
HtmlWindow * mpHtml;
|
HtmlWindow * mpHtml;
|
||||||
wxBitmap* m_pLogo; //vvv
|
std::unique_ptr<wxBitmap> m_pLogo; //vvv
|
||||||
static SplashDialog * pSelf;
|
static SplashDialog * pSelf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -274,12 +274,11 @@ TrackArtist::TrackArtist()
|
|||||||
UpdatePrefs();
|
UpdatePrefs();
|
||||||
|
|
||||||
SetColours();
|
SetColours();
|
||||||
vruler = new Ruler;
|
vruler = std::make_unique<Ruler>();
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackArtist::~TrackArtist()
|
TrackArtist::~TrackArtist()
|
||||||
{
|
{
|
||||||
delete vruler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackArtist::SetColours()
|
void TrackArtist::SetColours()
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#ifndef __AUDACITY_TRACKARTIST__
|
#ifndef __AUDACITY_TRACKARTIST__
|
||||||
#define __AUDACITY_TRACKARTIST__
|
#define __AUDACITY_TRACKARTIST__
|
||||||
|
|
||||||
|
#include "MemoryX.h"
|
||||||
#include <wx/brush.h>
|
#include <wx/brush.h>
|
||||||
#include <wx/pen.h>
|
#include <wx/pen.h>
|
||||||
#include "Experimental.h"
|
#include "Experimental.h"
|
||||||
@ -200,7 +201,7 @@ class AUDACITY_DLL_API TrackArtist {
|
|||||||
wxPen muteClippedPen;
|
wxPen muteClippedPen;
|
||||||
wxPen blankSelectedPen;
|
wxPen blankSelectedPen;
|
||||||
|
|
||||||
Ruler *vruler;
|
std::unique_ptr<Ruler> vruler;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
bool fftYGridOld;
|
bool fftYGridOld;
|
||||||
|
@ -55,13 +55,6 @@ EffectManager::~EffectManager()
|
|||||||
// wxWidgets has already destroyed the rack since it was derived from wxFrame. So
|
// wxWidgets has already destroyed the rack since it was derived from wxFrame. So
|
||||||
// no need to DELETE it here.
|
// no need to DELETE it here.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EffectMap::iterator iter = mHostEffects.begin();
|
|
||||||
while (iter != mHostEffects.end())
|
|
||||||
{
|
|
||||||
delete iter->second;
|
|
||||||
++iter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here solely for the purpose of Nyquist Workbench until
|
// Here solely for the purpose of Nyquist Workbench until
|
||||||
@ -706,13 +699,11 @@ Effect *EffectManager::GetEffect(const PluginID & ID)
|
|||||||
// TODO: This is temporary and should be redone when all effects are converted
|
// TODO: This is temporary and should be redone when all effects are converted
|
||||||
if (mEffects.find(ID) == mEffects.end())
|
if (mEffects.find(ID) == mEffects.end())
|
||||||
{
|
{
|
||||||
Effect *effect;
|
|
||||||
|
|
||||||
// This will instantiate the effect client if it hasn't already been done
|
// This will instantiate the effect client if it hasn't already been done
|
||||||
EffectIdentInterface *ident = dynamic_cast<EffectIdentInterface *>(PluginManager::Get().GetInstance(ID));
|
EffectIdentInterface *ident = dynamic_cast<EffectIdentInterface *>(PluginManager::Get().GetInstance(ID));
|
||||||
if (ident && ident->IsLegacy())
|
if (ident && ident->IsLegacy())
|
||||||
{
|
{
|
||||||
effect = dynamic_cast<Effect *>(ident);
|
auto effect = dynamic_cast<Effect *>(ident);
|
||||||
if (effect && effect->Startup(NULL))
|
if (effect && effect->Startup(NULL))
|
||||||
{
|
{
|
||||||
mEffects[ID] = effect;
|
mEffects[ID] = effect;
|
||||||
@ -720,18 +711,17 @@ Effect *EffectManager::GetEffect(const PluginID & ID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
effect = new Effect();
|
auto effect = std::make_shared<Effect>(); // TODO: use make_unique and store in std::unordered_map
|
||||||
if (effect)
|
if (effect)
|
||||||
{
|
{
|
||||||
EffectClientInterface *client = dynamic_cast<EffectClientInterface *>(ident);
|
EffectClientInterface *client = dynamic_cast<EffectClientInterface *>(ident);
|
||||||
if (client && effect->Startup(client))
|
if (client && effect->Startup(client))
|
||||||
{
|
{
|
||||||
mEffects[ID] = effect;
|
auto pEffect = effect.get();
|
||||||
mHostEffects[ID] = effect;
|
mEffects[ID] = pEffect;
|
||||||
return effect;
|
mHostEffects[ID] = std::move(effect);
|
||||||
|
return pEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete effect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMessageBox(wxString::Format(_("Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in Help->Show Log"),
|
wxMessageBox(wxString::Format(_("Attempting to initialize the following effect failed:\n\n%s\n\nMore information may be available in Help->Show Log"),
|
||||||
|
@ -35,6 +35,7 @@ effects.
|
|||||||
|
|
||||||
WX_DEFINE_USER_EXPORTED_ARRAY(Effect *, EffectArray, class AUDACITY_DLL_API);
|
WX_DEFINE_USER_EXPORTED_ARRAY(Effect *, EffectArray, class AUDACITY_DLL_API);
|
||||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(Effect *, EffectMap, class AUDACITY_DLL_API);
|
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(Effect *, EffectMap, class AUDACITY_DLL_API);
|
||||||
|
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(std::shared_ptr<Effect>, EffectOwnerMap, class AUDACITY_DLL_API);
|
||||||
|
|
||||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||||
class EffectRack;
|
class EffectRack;
|
||||||
@ -127,7 +128,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
EffectMap mEffects;
|
EffectMap mEffects;
|
||||||
EffectMap mHostEffects;
|
EffectOwnerMap mHostEffects;
|
||||||
|
|
||||||
int mNumEffects;
|
int mNumEffects;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user