mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-28 14:18:41 +02:00
Stack-allocate where possible! ...
... Removed many unnecessary naked news and deletes.
This commit is contained in:
parent
be1d9b7dd5
commit
dbaa811577
@ -285,14 +285,15 @@ visit our <a href=\"http://forum.audacityteam.org/\">forum</a>.");
|
|||||||
S.StartNotebookPage( wxT("Audacity") );
|
S.StartNotebookPage( wxT("Audacity") );
|
||||||
S.StartVerticalLay(1);
|
S.StartVerticalLay(1);
|
||||||
|
|
||||||
|
{
|
||||||
//v For now, change to AudacityLogoWithName via old-fashioned way, not Theme.
|
//v For now, change to AudacityLogoWithName via old-fashioned way, not Theme.
|
||||||
wxBitmap *const logo = new wxBitmap((const char **) AudacityLogoWithName_xpm); //v
|
wxBitmap logo(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.
|
||||||
// It also makes it easier to revert to full size if we decide to.
|
// It also makes it easier to revert to full size if we decide to.
|
||||||
const float fScale = 0.5f;// smaller size.
|
const float fScale = 0.5f;// smaller size.
|
||||||
wxImage RescaledImage( logo->ConvertToImage() );
|
wxImage RescaledImage(logo.ConvertToImage());
|
||||||
// wxIMAGE_QUALITY_HIGH not supported by wxWidgets 2.6.1, or we would use it here.
|
// wxIMAGE_QUALITY_HIGH not supported by wxWidgets 2.6.1, or we would use it here.
|
||||||
RescaledImage.Rescale(int(LOGOWITHNAME_WIDTH * fScale), int(LOGOWITHNAME_HEIGHT *fScale));
|
RescaledImage.Rescale(int(LOGOWITHNAME_WIDTH * fScale), int(LOGOWITHNAME_HEIGHT *fScale));
|
||||||
wxBitmap RescaledBitmap(RescaledImage);
|
wxBitmap RescaledBitmap(RescaledImage);
|
||||||
@ -305,7 +306,7 @@ visit our <a href=\"http://forum.audacityteam.org/\">forum</a>.");
|
|||||||
RescaledBitmap,
|
RescaledBitmap,
|
||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale)));
|
wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale)));
|
||||||
delete logo;
|
}
|
||||||
S.Prop(0).AddWindow( icon );
|
S.Prop(0).AddWindow( icon );
|
||||||
|
|
||||||
HtmlWindow *html = safenew LinkingHtmlWindow(S.GetParent(), -1,
|
HtmlWindow *html = safenew LinkingHtmlWindow(S.GetParent(), -1,
|
||||||
|
@ -1371,8 +1371,10 @@ bool AudacityApp::OnInit()
|
|||||||
logoimage.Rescale(logoimage.GetWidth() / 2, logoimage.GetHeight() / 2);
|
logoimage.Rescale(logoimage.GetWidth() / 2, logoimage.GetHeight() / 2);
|
||||||
wxBitmap logo(logoimage);
|
wxBitmap logo(logoimage);
|
||||||
|
|
||||||
wxSplashScreen *temporarywindow =
|
AudacityProject *project;
|
||||||
new wxSplashScreen(logo,
|
{
|
||||||
|
wxSplashScreen temporarywindow(
|
||||||
|
logo,
|
||||||
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,
|
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
@ -1380,8 +1382,8 @@ bool AudacityApp::OnInit()
|
|||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxDefaultSize,
|
wxDefaultSize,
|
||||||
wxSTAY_ON_TOP);
|
wxSTAY_ON_TOP);
|
||||||
temporarywindow->SetTitle(_("Audacity is starting up..."));
|
temporarywindow.SetTitle(_("Audacity is starting up..."));
|
||||||
SetTopWindow(temporarywindow);
|
SetTopWindow(&temporarywindow);
|
||||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||||
|
|
||||||
//JKC: Would like to put module loading here.
|
//JKC: Would like to put module loading here.
|
||||||
@ -1416,7 +1418,7 @@ bool AudacityApp::OnInit()
|
|||||||
|
|
||||||
#endif //__WXMAC__
|
#endif //__WXMAC__
|
||||||
|
|
||||||
AudacityProject *project = CreateNewAudacityProject();
|
project = CreateNewAudacityProject();
|
||||||
mCmdHandler->SetProject(project);
|
mCmdHandler->SetProject(project);
|
||||||
wxWindow * pWnd = MakeHijackPanel();
|
wxWindow * pWnd = MakeHijackPanel();
|
||||||
if (pWnd)
|
if (pWnd)
|
||||||
@ -1427,8 +1429,8 @@ bool AudacityApp::OnInit()
|
|||||||
pWnd->Show(true);
|
pWnd->Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
temporarywindow->Show(false);
|
temporarywindow.Show(false);
|
||||||
delete temporarywindow;
|
}
|
||||||
|
|
||||||
if( project->mShowSplashScreen )
|
if( project->mShowSplashScreen )
|
||||||
project->OnHelpWelcome();
|
project->OnHelpWelcome();
|
||||||
|
@ -170,19 +170,19 @@ void AudacityLogger::Show(bool show)
|
|||||||
frame->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
frame->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||||
|
|
||||||
// loads either the XPM or the windows resource, depending on the platform
|
// loads either the XPM or the windows resource, depending on the platform
|
||||||
|
{
|
||||||
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
||||||
wxIcon *ic;
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
ic = new wxIcon(wxICON(AudacityLogo));
|
wxIcon ic{wxICON(AudacityLogo)};
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
ic = new wxIcon(wxICON(AudacityLogoAlpha));
|
wxIcon ic{wxICON(AudacityLogoAlpha)};
|
||||||
#else
|
#else
|
||||||
ic = new wxIcon();
|
wxIcon ic{};
|
||||||
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
||||||
#endif
|
#endif
|
||||||
frame->SetIcon(*ic);
|
frame->SetIcon(ic);
|
||||||
delete ic;
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Log text
|
// Log text
|
||||||
ShuttleGui S(frame, eIsCreating);
|
ShuttleGui S(frame, eIsCreating);
|
||||||
|
@ -248,9 +248,7 @@ bool ShowAutoRecoveryDialogIfNeeded(AudacityProject** pproj,
|
|||||||
// This must be done before "dlg" is declared.
|
// This must be done before "dlg" is declared.
|
||||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||||
|
|
||||||
AutoRecoveryDialog *dlg = new AutoRecoveryDialog(NULL); //*pproj);
|
int ret = AutoRecoveryDialog{nullptr}.ShowModal();
|
||||||
int ret = dlg->ShowModal();
|
|
||||||
delete dlg;
|
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
|
@ -188,9 +188,11 @@ void BatchProcessDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
// The disabler must get deleted before the EndModal() call. Otherwise,
|
// The disabler must get deleted before the EndModal() call. Otherwise,
|
||||||
// the menus on OSX will remain disabled.
|
// the menus on OSX will remain disabled.
|
||||||
wxWindowDisabler *wd = new wxWindowDisabler(pD);
|
bool success;
|
||||||
bool success = mBatchCommands.ApplyChain();
|
{
|
||||||
delete wd;
|
wxWindowDisabler wd(pD);
|
||||||
|
success = mBatchCommands.ApplyChain();
|
||||||
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
Show();
|
Show();
|
||||||
|
@ -344,8 +344,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
ZoomInfo zoomInfo(0.0, ZoomInfo::GetDefaultZoom());
|
ZoomInfo zoomInfo(0.0, ZoomInfo::GetDefaultZoom());
|
||||||
DirManager *d = new DirManager();
|
DirManager *d = new DirManager();
|
||||||
TrackFactory *fact = new TrackFactory(d, &zoomInfo);
|
WaveTrack *const t = TrackFactory{ d, &zoomInfo }.NewWaveTrack(int16Sample);
|
||||||
WaveTrack *t = fact->NewWaveTrack(int16Sample);
|
|
||||||
Track *tmp = NULL;
|
Track *tmp = NULL;
|
||||||
|
|
||||||
t->SetRate(1);
|
t->SetRate(1);
|
||||||
@ -540,7 +539,6 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
|||||||
delete[]small2;
|
delete[]small2;
|
||||||
delete[]block;
|
delete[]block;
|
||||||
|
|
||||||
delete fact;
|
|
||||||
d->Deref();
|
d->Deref();
|
||||||
|
|
||||||
Sequence::SetMaxDiskBlockSize(oldBlockSize);
|
Sequence::SetMaxDiskBlockSize(oldBlockSize);
|
||||||
|
@ -165,8 +165,8 @@ static void RemoveDependencies(AudacityProject *project,
|
|||||||
{
|
{
|
||||||
DirManager *dirManager = project->GetDirManager();
|
DirManager *dirManager = project->GetDirManager();
|
||||||
|
|
||||||
ProgressDialog *progress =
|
ProgressDialog progress
|
||||||
new ProgressDialog(_("Removing Dependencies"),
|
(_("Removing Dependencies"),
|
||||||
_("Copying audio data into project..."));
|
_("Copying audio data into project..."));
|
||||||
int updateResult = eProgressSuccess;
|
int updateResult = eProgressSuccess;
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ static void RemoveDependencies(AudacityProject *project,
|
|||||||
|
|
||||||
// Update the progress bar
|
// Update the progress bar
|
||||||
completedBytes += SAMPLE_SIZE(format) * len;
|
completedBytes += SAMPLE_SIZE(format) * len;
|
||||||
updateResult = progress->Update(completedBytes, totalBytesToProcess);
|
updateResult = progress.Update(completedBytes, totalBytesToProcess);
|
||||||
if (updateResult != eProgressSuccess)
|
if (updateResult != eProgressSuccess)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -235,8 +235,6 @@ static void RemoveDependencies(AudacityProject *project,
|
|||||||
BlockFile *f = it->second;
|
BlockFile *f = it->second;
|
||||||
dirManager->Deref(f);
|
dirManager->Deref(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -445,15 +445,16 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
|
|||||||
saved version of the old project must not be moved,
|
saved version of the old project must not be moved,
|
||||||
otherwise the old project would not be safe.) */
|
otherwise the old project would not be safe.) */
|
||||||
|
|
||||||
|
{
|
||||||
/*i18n-hint: This title appears on a dialog that indicates the progress in doing something.*/
|
/*i18n-hint: This title appears on a dialog that indicates the progress in doing something.*/
|
||||||
ProgressDialog *progress = new ProgressDialog(_("Progress"),
|
ProgressDialog progress(_("Progress"),
|
||||||
_("Saving project data files"));
|
_("Saving project data files"));
|
||||||
|
|
||||||
int total = mBlockFileHash.size();
|
int total = mBlockFileHash.size();
|
||||||
int count=0;
|
|
||||||
|
|
||||||
BlockHash::iterator iter = mBlockFileHash.begin();
|
BlockHash::iterator iter = mBlockFileHash.begin();
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
int count = 0;
|
||||||
while ((iter != mBlockFileHash.end()) && success)
|
while ((iter != mBlockFileHash.end()) && success)
|
||||||
{
|
{
|
||||||
BlockFile *b = iter->second;
|
BlockFile *b = iter->second;
|
||||||
@ -464,7 +465,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
|
|||||||
success = MoveToNewProjectDirectory(b);
|
success = MoveToNewProjectDirectory(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
progress->Update(count, total);
|
progress.Update(count, total);
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
count++;
|
count++;
|
||||||
@ -486,7 +487,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
|
|||||||
MoveToNewProjectDirectory(b);
|
MoveToNewProjectDirectory(b);
|
||||||
|
|
||||||
if (count >= 0)
|
if (count >= 0)
|
||||||
progress->Update(count, total);
|
progress.Update(count, total);
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
count--;
|
count--;
|
||||||
@ -496,12 +497,9 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
|
|||||||
this->projPath = oldPath;
|
this->projPath = oldPath;
|
||||||
this->projName = oldName;
|
this->projName = oldName;
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete progress;
|
|
||||||
|
|
||||||
// Some subtlety; SetProject is used both to move a temp project
|
// Some subtlety; SetProject is used both to move a temp project
|
||||||
// into a permanent home as well as just set up path variables when
|
// into a permanent home as well as just set up path variables when
|
||||||
@ -515,7 +513,7 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
|
|||||||
// NEW; rmdir will fail on non-empty dirs.
|
// NEW; rmdir will fail on non-empty dirs.
|
||||||
|
|
||||||
wxArrayString dirlist;
|
wxArrayString dirlist;
|
||||||
count = RecursivelyEnumerate(cleanupLoc1, dirlist, wxEmptyString, false, true);
|
const int count = RecursivelyEnumerate(cleanupLoc1, dirlist, wxEmptyString, false, true);
|
||||||
|
|
||||||
//This destroys the empty dirs of the OD block files, which are yet to come.
|
//This destroys the empty dirs of the OD block files, which are yet to come.
|
||||||
//Dont know if this will make the project dirty, but I doubt it. (mchinen)
|
//Dont know if this will make the project dirty, but I doubt it. (mchinen)
|
||||||
@ -1653,13 +1651,12 @@ other projects. \
|
|||||||
if ((nResult != FSCKstatus_CLOSE_REQ) && !ODManager::HasLoadedODFlag())
|
if ((nResult != FSCKstatus_CLOSE_REQ) && !ODManager::HasLoadedODFlag())
|
||||||
{
|
{
|
||||||
// Remove any empty directories.
|
// Remove any empty directories.
|
||||||
ProgressDialog* pProgress =
|
ProgressDialog pProgress
|
||||||
new ProgressDialog(_("Progress"),
|
(_("Progress"),
|
||||||
_("Cleaning up unused directories in project data"));
|
_("Cleaning up unused directories in project data"));
|
||||||
// nDirCount is for updating pProgress. +1 because we may DELETE dirPath.
|
// nDirCount is for updating pProgress. +1 because we may DELETE dirPath.
|
||||||
int nDirCount = RecursivelyCountSubdirs(dirPath) + 1;
|
int nDirCount = RecursivelyCountSubdirs(dirPath) + 1;
|
||||||
RecursivelyRemoveEmptyDirs(dirPath, nDirCount, pProgress);
|
RecursivelyRemoveEmptyDirs(dirPath, nDirCount, &pProgress);
|
||||||
delete pProgress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summarize and flush the log.
|
// Summarize and flush the log.
|
||||||
|
@ -692,14 +692,9 @@ bool FFmpegLibs::LoadLibs(wxWindow * WXUNUSED(parent), bool showerr)
|
|||||||
{
|
{
|
||||||
wxLogError(wxT("Failed to load libraries altogether."));
|
wxLogError(wxT("Failed to load libraries altogether."));
|
||||||
int dontShowDlg;
|
int dontShowDlg;
|
||||||
FFmpegNotFoundDialog *dlg;
|
|
||||||
gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0);
|
gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0);
|
||||||
if ((dontShowDlg == 0) && (showerr))
|
if ((dontShowDlg == 0) && (showerr))
|
||||||
{
|
FFmpegNotFoundDialog{nullptr}.ShowModal();
|
||||||
dlg = new FFmpegNotFoundDialog(NULL);
|
|
||||||
dlg->ShowModal();
|
|
||||||
delete dlg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// Oh well, just give up
|
// Oh well, just give up
|
||||||
|
@ -1001,14 +1001,14 @@ void FreqWindow::Recalc()
|
|||||||
// just the mProgress window with the idea of preventing user interaction with the
|
// just the mProgress window with the idea of preventing user interaction with the
|
||||||
// controls while the plot was being recalculated. This doesn't appear to be necessary
|
// controls while the plot was being recalculated. This doesn't appear to be necessary
|
||||||
// so just use the the top level window instead.
|
// so just use the the top level window instead.
|
||||||
wxWindowDisabler *blocker = new wxWindowDisabler(this);
|
{
|
||||||
|
wxWindowDisabler blocker(this);
|
||||||
wxYieldIfNeeded();
|
wxYieldIfNeeded();
|
||||||
|
|
||||||
mAnalyst->Calculate(alg, windowFunc, mWindowSize, mRate,
|
mAnalyst->Calculate(alg, windowFunc, mWindowSize, mRate,
|
||||||
mData, mDataLen,
|
mData, mDataLen,
|
||||||
&mYMin, &mYMax, mProgress);
|
&mYMin, &mYMax, mProgress);
|
||||||
|
}
|
||||||
delete blocker;
|
|
||||||
if (hadFocus) {
|
if (hadFocus) {
|
||||||
hadFocus->SetFocus();
|
hadFocus->SetFocus();
|
||||||
}
|
}
|
||||||
@ -1040,9 +1040,7 @@ void FreqWindow::OnExport(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextFile f(fName);
|
wxTextFile f(fName);
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
wxFile *temp = new wxFile();
|
wxFile{}.Create(fName);
|
||||||
temp->Create(fName);
|
|
||||||
delete temp;
|
|
||||||
#else
|
#else
|
||||||
f.Create();
|
f.Create();
|
||||||
#endif
|
#endif
|
||||||
|
@ -617,9 +617,7 @@ void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextFile f(fName);
|
wxTextFile f(fName);
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
wxFile *temp = new wxFile();
|
wxFile{}.Create(fName);
|
||||||
temp->Create(fName);
|
|
||||||
delete temp;
|
|
||||||
#else
|
#else
|
||||||
f.Create();
|
f.Create();
|
||||||
#endif
|
#endif
|
||||||
|
@ -2013,18 +2013,19 @@ void LabelTrack::ShowContextMenu()
|
|||||||
{
|
{
|
||||||
wxWindow *parent = wxWindow::FindFocus();
|
wxWindow *parent = wxWindow::FindFocus();
|
||||||
|
|
||||||
wxMenu *menu = new wxMenu();
|
{
|
||||||
menu->Bind(wxEVT_MENU, &LabelTrack::OnContextMenu, this);
|
wxMenu menu;
|
||||||
|
menu.Bind(wxEVT_MENU, &LabelTrack::OnContextMenu, this);
|
||||||
|
|
||||||
menu->Append(OnCutSelectedTextID, _("Cu&t"));
|
menu.Append(OnCutSelectedTextID, _("Cu&t"));
|
||||||
menu->Append(OnCopySelectedTextID, _("&Copy"));
|
menu.Append(OnCopySelectedTextID, _("&Copy"));
|
||||||
menu->Append(OnPasteSelectedTextID, _("&Paste"));
|
menu.Append(OnPasteSelectedTextID, _("&Paste"));
|
||||||
menu->Append(OnDeleteSelectedLabelID, _("&Delete Label"));
|
menu.Append(OnDeleteSelectedLabelID, _("&Delete Label"));
|
||||||
|
|
||||||
menu->Enable(OnCutSelectedTextID, IsTextSelected());
|
menu.Enable(OnCutSelectedTextID, IsTextSelected());
|
||||||
menu->Enable(OnCopySelectedTextID, IsTextSelected());
|
menu.Enable(OnCopySelectedTextID, IsTextSelected());
|
||||||
menu->Enable(OnPasteSelectedTextID, IsTextClipSupported());
|
menu.Enable(OnPasteSelectedTextID, IsTextClipSupported());
|
||||||
menu->Enable(OnDeleteSelectedLabelID, true);
|
menu.Enable(OnDeleteSelectedLabelID, true);
|
||||||
|
|
||||||
const LabelStruct *ls = GetLabel(mSelIndex);
|
const LabelStruct *ls = GetLabel(mSelIndex);
|
||||||
|
|
||||||
@ -2046,9 +2047,8 @@ void LabelTrack::ShowContextMenu()
|
|||||||
x += ls->xText;
|
x += ls->xText;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->PopupMenu(menu, x, ls->y + (mIconHeight / 2) - 1);
|
parent->PopupMenu(&menu, x, ls->y + (mIconHeight / 2) - 1);
|
||||||
|
}
|
||||||
delete menu;
|
|
||||||
|
|
||||||
// it's an invalid dragging event
|
// it's an invalid dragging event
|
||||||
SetWrongDragging(true);
|
SetWrongDragging(true);
|
||||||
|
@ -67,14 +67,14 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
|
|||||||
|
|
||||||
// loads either the XPM or the windows resource, depending on the platform
|
// loads either the XPM or the windows resource, depending on the platform
|
||||||
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
||||||
wxIcon *ic;
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
ic = new wxIcon(wxICON(AudacityLogo));
|
wxIcon ic{ wxICON(AudacityLogo) };
|
||||||
#else
|
#else
|
||||||
ic = new wxIcon(wxICON(AudacityLogo48x48));
|
wxIcon ic{wxICON(AudacityLogo48x48)};
|
||||||
#endif
|
#endif
|
||||||
SetIcon(*ic);
|
SetIcon(ic);
|
||||||
delete ic;
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxPoint panelPos(0, 0);
|
wxPoint panelPos(0, 0);
|
||||||
|
@ -6148,7 +6148,9 @@ void AudacityProject::OnScoreAlign()
|
|||||||
mTracks->GetWaveTracks(true /* selectionOnly */,
|
mTracks->GetWaveTracks(true /* selectionOnly */,
|
||||||
&numWaveTracksSelected, &waveTracks);
|
&numWaveTracksSelected, &waveTracks);
|
||||||
|
|
||||||
Mixer *mix = new Mixer(numWaveTracksSelected, // int numInputTracks
|
int result;
|
||||||
|
{
|
||||||
|
Mixer mix(numWaveTracksSelected, // int numInputTracks
|
||||||
waveTracks, // WaveTrack **inputTracks
|
waveTracks, // WaveTrack **inputTracks
|
||||||
mTracks->GetTimeTrack(), // TimeTrack *timeTrack
|
mTracks->GetTimeTrack(), // TimeTrack *timeTrack
|
||||||
0.0, // double startTime
|
0.0, // double startTime
|
||||||
@ -6162,7 +6164,7 @@ void AudacityProject::OnScoreAlign()
|
|||||||
NULL); // MixerSpec *mixerSpec = NULL
|
NULL); // MixerSpec *mixerSpec = NULL
|
||||||
delete [] waveTracks;
|
delete [] waveTracks;
|
||||||
|
|
||||||
ASAProgress *progress = new ASAProgress;
|
ASAProgress progress;
|
||||||
|
|
||||||
// There's a lot of adjusting made to incorporate the note track offset into
|
// There's a lot of adjusting made to incorporate the note track offset into
|
||||||
// the note track while preserving the position of notes within beats and
|
// the note track while preserving the position of notes within beats and
|
||||||
@ -6171,15 +6173,13 @@ void AudacityProject::OnScoreAlign()
|
|||||||
// example, save the modified note track in ".gro" form to read the details.
|
// example, save the modified note track in ".gro" form to read the details.
|
||||||
//#define SKIP_ACTUAL_SCORE_ALIGNMENT 1
|
//#define SKIP_ACTUAL_SCORE_ALIGNMENT 1
|
||||||
#ifndef SKIP_ACTUAL_SCORE_ALIGNMENT
|
#ifndef SKIP_ACTUAL_SCORE_ALIGNMENT
|
||||||
int result = scorealign((void *) mix, &mixer_process,
|
result = scorealign((void *) &mix, &mixer_process,
|
||||||
2 /* channels */, 44100.0 /* srate */, endTime,
|
2 /* channels */, 44100.0 /* srate */, endTime,
|
||||||
alignedNoteTrack->GetSequence(), progress, params);
|
alignedNoteTrack->GetSequence(), &progress, params);
|
||||||
#else
|
#else
|
||||||
int result = SA_SUCCESS;
|
result = SA_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
delete progress;
|
|
||||||
delete mix;
|
|
||||||
|
|
||||||
if (result == SA_SUCCESS) {
|
if (result == SA_SUCCESS) {
|
||||||
mTracks->Replace(nt, alignedNoteTrack, true);
|
mTracks->Replace(nt, alignedNoteTrack, true);
|
||||||
|
22
src/Mix.cpp
22
src/Mix.cpp
@ -161,38 +161,39 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
|||||||
endTime = mixEndTime;
|
endTime = mixEndTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mixer *mixer = new Mixer(numWaves, waveArray,
|
Mixer mixer(numWaves, waveArray,
|
||||||
Mixer::WarpOptions(tracks->GetTimeTrack()),
|
Mixer::WarpOptions(tracks->GetTimeTrack()),
|
||||||
startTime, endTime, mono ? 1 : 2, maxBlockLen, false,
|
startTime, endTime, mono ? 1 : 2, maxBlockLen, false,
|
||||||
rate, format);
|
rate, format);
|
||||||
|
|
||||||
::wxSafeYield();
|
::wxSafeYield();
|
||||||
ProgressDialog *progress = new ProgressDialog(_("Mix and Render"),
|
|
||||||
_("Mixing and rendering tracks"));
|
|
||||||
|
|
||||||
int updateResult = eProgressSuccess;
|
int updateResult = eProgressSuccess;
|
||||||
|
{
|
||||||
|
ProgressDialog progress(_("Mix and Render"),
|
||||||
|
_("Mixing and rendering tracks"));
|
||||||
|
|
||||||
while (updateResult == eProgressSuccess) {
|
while (updateResult == eProgressSuccess) {
|
||||||
sampleCount blockLen = mixer->Process(maxBlockLen);
|
sampleCount blockLen = mixer.Process(maxBlockLen);
|
||||||
|
|
||||||
if (blockLen == 0)
|
if (blockLen == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (mono) {
|
if (mono) {
|
||||||
samplePtr buffer = mixer->GetBuffer();
|
samplePtr buffer = mixer.GetBuffer();
|
||||||
mixLeft->Append(buffer, format, blockLen);
|
mixLeft->Append(buffer, format, blockLen);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
samplePtr buffer;
|
samplePtr buffer;
|
||||||
buffer = mixer->GetBuffer(0);
|
buffer = mixer.GetBuffer(0);
|
||||||
mixLeft->Append(buffer, format, blockLen);
|
mixLeft->Append(buffer, format, blockLen);
|
||||||
buffer = mixer->GetBuffer(1);
|
buffer = mixer.GetBuffer(1);
|
||||||
mixRight->Append(buffer, format, blockLen);
|
mixRight->Append(buffer, format, blockLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime() - startTime, endTime - startTime);
|
updateResult = progress.Update(mixer.MixGetCurrentTime() - startTime, endTime - startTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
mixLeft->Flush();
|
mixLeft->Flush();
|
||||||
if (!mono)
|
if (!mono)
|
||||||
@ -222,7 +223,6 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete[] waveArray;
|
delete[] waveArray;
|
||||||
delete mixer;
|
|
||||||
|
|
||||||
return (updateResult == eProgressSuccess || updateResult == eProgressStopped);
|
return (updateResult == eProgressSuccess || updateResult == eProgressStopped);
|
||||||
}
|
}
|
||||||
|
@ -1766,14 +1766,14 @@ MixerBoardFrame::MixerBoardFrame(AudacityProject* parent)
|
|||||||
|
|
||||||
// loads either the XPM or the windows resource, depending on the platform
|
// loads either the XPM or the windows resource, depending on the platform
|
||||||
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
||||||
wxIcon *ic;
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
ic = new wxIcon(wxICON(AudacityLogo));
|
wxIcon ic{ wxICON(AudacityLogo) };
|
||||||
#else
|
#else
|
||||||
ic = new wxIcon(wxICON(AudacityLogo48x48));
|
wxIcon ic{wxICON(AudacityLogo48x48)};
|
||||||
#endif
|
#endif
|
||||||
SetIcon(*ic);
|
SetIcon(ic);
|
||||||
delete ic;
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,8 +969,9 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
|
|||||||
// Make sure the progress dialog is deleted before we call EndModal() or
|
// Make sure the progress dialog is deleted before we call EndModal() or
|
||||||
// we will leave the project window in an unusable state on OSX.
|
// we will leave the project window in an unusable state on OSX.
|
||||||
// See bug #1192.
|
// See bug #1192.
|
||||||
ProgressDialog *progress = new ProgressDialog(GetTitle(), msg, pdlgHideStopButton);
|
{
|
||||||
progress->CenterOnParent();
|
ProgressDialog progress(GetTitle(), msg, pdlgHideStopButton);
|
||||||
|
progress.CenterOnParent();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ItemDataMap::iterator iter = mItems.begin(); iter != mItems.end(); ++iter)
|
for (ItemDataMap::iterator iter = mItems.begin(); iter != mItems.end(); ++iter)
|
||||||
@ -981,7 +982,7 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
|
|||||||
if (item.state == STATE_Enabled && item.plugs[0]->GetPluginType() == PluginTypeStub)
|
if (item.state == STATE_Enabled && item.plugs[0]->GetPluginType() == PluginTypeStub)
|
||||||
{
|
{
|
||||||
last3 = last3.AfterFirst(wxT('\n')) + item.path + wxT("\n");
|
last3 = last3.AfterFirst(wxT('\n')) + item.path + wxT("\n");
|
||||||
int status = progress->Update(++i, enableCount, wxString::Format(_("Enabling effect:\n\n%s"), last3.c_str()));
|
int status = progress.Update(++i, enableCount, wxString::Format(_("Enabling effect:\n\n%s"), last3.c_str()));
|
||||||
if (!status)
|
if (!status)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@ -1018,8 +1019,7 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
|
|||||||
}
|
}
|
||||||
|
|
||||||
pm.Save();
|
pm.Save();
|
||||||
|
}
|
||||||
delete progress;
|
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
}
|
}
|
||||||
|
@ -1026,17 +1026,17 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||||||
|
|
||||||
// loads either the XPM or the windows resource, depending on the platform
|
// loads either the XPM or the windows resource, depending on the platform
|
||||||
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
||||||
wxIcon *ic;
|
{
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
ic = new wxIcon(wxICON(AudacityLogo));
|
wxIcon ic{ wxICON(AudacityLogo) };
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
ic = new wxIcon(wxICON(AudacityLogoAlpha));
|
wxIcon ic{wxICON(AudacityLogoAlpha)};
|
||||||
#else
|
#else
|
||||||
ic = new wxIcon();
|
wxIcon ic{};
|
||||||
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
||||||
#endif
|
#endif
|
||||||
SetIcon(*ic);
|
SetIcon(ic);
|
||||||
delete ic;
|
}
|
||||||
#endif
|
#endif
|
||||||
mIconized = false;
|
mIconized = false;
|
||||||
|
|
||||||
@ -1473,9 +1473,8 @@ void AudacityProject::FinishAutoScroll()
|
|||||||
|
|
||||||
// Call our Scroll method which updates our ViewInfo variables
|
// Call our Scroll method which updates our ViewInfo variables
|
||||||
// to reflect the positions of the scrollbars
|
// to reflect the positions of the scrollbars
|
||||||
wxScrollEvent *dummy = new wxScrollEvent();
|
wxScrollEvent dummy;
|
||||||
OnScroll(*dummy);
|
OnScroll(dummy);
|
||||||
delete dummy;
|
|
||||||
|
|
||||||
mAutoScrolling = false;
|
mAutoScrolling = false;
|
||||||
}
|
}
|
||||||
@ -1590,9 +1589,8 @@ void AudacityProject::TP_ScrollWindow(double scrollto)
|
|||||||
|
|
||||||
// Call our Scroll method which updates our ViewInfo variables
|
// Call our Scroll method which updates our ViewInfo variables
|
||||||
// to reflect the positions of the scrollbars
|
// to reflect the positions of the scrollbars
|
||||||
wxScrollEvent *dummy = new wxScrollEvent();
|
wxScrollEvent dummy;
|
||||||
OnScroll(*dummy);
|
OnScroll(dummy);
|
||||||
delete dummy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2643,25 +2641,24 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory)
|
|||||||
// for a long time searching for line breaks. So, we look for our
|
// for a long time searching for line breaks. So, we look for our
|
||||||
// signature at the beginning of the file first:
|
// signature at the beginning of the file first:
|
||||||
|
|
||||||
wxFFile *ff = new wxFFile(fileName, wxT("rb"));
|
char buf[16];
|
||||||
if (!ff->IsOpened()) {
|
{
|
||||||
|
wxFFile ff(fileName, wxT("rb"));
|
||||||
|
if (!ff.IsOpened()) {
|
||||||
wxMessageBox(_("Could not open file: ") + fileName,
|
wxMessageBox(_("Could not open file: ") + fileName,
|
||||||
_("Error opening file"),
|
_("Error opening file"),
|
||||||
wxOK | wxCENTRE, this);
|
wxOK | wxCENTRE, this);
|
||||||
}
|
}
|
||||||
char buf[16];
|
int numRead = ff.Read(buf, 15);
|
||||||
int numRead = ff->Read(buf, 15);
|
|
||||||
if (numRead != 15) {
|
if (numRead != 15) {
|
||||||
wxMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"),
|
wxMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"),
|
||||||
(const wxChar*)fileName), _("Error Opening File or Project"),
|
(const wxChar*)fileName), _("Error Opening File or Project"),
|
||||||
wxOK | wxCENTRE, this);
|
wxOK | wxCENTRE, this);
|
||||||
ff->Close();
|
ff.Close();
|
||||||
delete ff;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf[15] = 0;
|
buf[15] = 0;
|
||||||
ff->Close();
|
}
|
||||||
delete ff;
|
|
||||||
|
|
||||||
wxString temp = LAT1CTOWX(buf);
|
wxString temp = LAT1CTOWX(buf);
|
||||||
|
|
||||||
@ -3617,21 +3614,19 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
|
|||||||
WaveTrack* pWaveTrack;
|
WaveTrack* pWaveTrack;
|
||||||
TrackListOfKindIterator iter(Track::Wave, mTracks);
|
TrackListOfKindIterator iter(Track::Wave, mTracks);
|
||||||
unsigned int numWaveTracks = 0;
|
unsigned int numWaveTracks = 0;
|
||||||
TrackList* pSavedTrackList = new TrackList();
|
|
||||||
|
TrackList pSavedTrackList(true);
|
||||||
for (pTrack = iter.First(); pTrack != NULL; pTrack = iter.Next())
|
for (pTrack = iter.First(); pTrack != NULL; pTrack = iter.Next())
|
||||||
{
|
{
|
||||||
numWaveTracks++;
|
numWaveTracks++;
|
||||||
pWaveTrack = (WaveTrack*)pTrack;
|
pWaveTrack = (WaveTrack*)pTrack;
|
||||||
pSavedTrack = mTrackFactory->DuplicateWaveTrack(*pWaveTrack);
|
pSavedTrack = mTrackFactory->DuplicateWaveTrack(*pWaveTrack);
|
||||||
pSavedTrackList->Add(pSavedTrack);
|
pSavedTrackList.Add(pSavedTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numWaveTracks == 0)
|
if (numWaveTracks == 0)
|
||||||
{
|
|
||||||
// Nothing to save compressed => success. Delete the copies and go.
|
// Nothing to save compressed => success. Delete the copies and go.
|
||||||
delete pSavedTrackList;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
// Okay, now some bold state-faking to default values.
|
// Okay, now some bold state-faking to default values.
|
||||||
for (pTrack = iter.First(); pTrack != NULL; pTrack = iter.Next())
|
for (pTrack = iter.First(); pTrack != NULL; pTrack = iter.Next())
|
||||||
@ -3683,7 +3678,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore the saved track states and clean up.
|
// Restore the saved track states and clean up.
|
||||||
TrackListIterator savedTrackIter(pSavedTrackList);
|
TrackListIterator savedTrackIter(&pSavedTrackList);
|
||||||
for (pTrack = iter.First(), pSavedTrack = savedTrackIter.First();
|
for (pTrack = iter.First(), pSavedTrack = savedTrackIter.First();
|
||||||
((pTrack != NULL) && (pSavedTrack != NULL));
|
((pTrack != NULL) && (pSavedTrack != NULL));
|
||||||
pTrack = iter.Next(), pSavedTrack = savedTrackIter.Next())
|
pTrack = iter.Next(), pSavedTrack = savedTrackIter.Next())
|
||||||
@ -3697,9 +3692,6 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
|
|||||||
pWaveTrack->SetPan(((WaveTrack*)pSavedTrack)->GetPan());
|
pWaveTrack->SetPan(((WaveTrack*)pSavedTrack)->GetPan());
|
||||||
}
|
}
|
||||||
|
|
||||||
pSavedTrackList->Clear(true);
|
|
||||||
delete pSavedTrackList;
|
|
||||||
|
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2162,10 +2162,10 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
|||||||
// and then paint this directly to our offscreen
|
// and then paint this directly to our offscreen
|
||||||
// bitmap. Note that this could be optimized even
|
// bitmap. Note that this could be optimized even
|
||||||
// more, but for now this is not bad. -dmazzoni
|
// more, but for now this is not bad. -dmazzoni
|
||||||
wxImage *image = new wxImage((int)mid.width, (int)mid.height);
|
wxImage image((int)mid.width, (int)mid.height);
|
||||||
if (!image)
|
if (!image.IsOk())
|
||||||
return;
|
return;
|
||||||
unsigned char *data = image->GetData();
|
unsigned char *data = image.GetData();
|
||||||
|
|
||||||
const int half = settings.GetFFTLength() / 2;
|
const int half = settings.GetFFTLength() / 2;
|
||||||
const double binUnit = rate / (2 * half);
|
const double binUnit = rate / (2 * half);
|
||||||
@ -2471,7 +2471,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
|||||||
} // each yy
|
} // each yy
|
||||||
} // each xx
|
} // each xx
|
||||||
|
|
||||||
wxBitmap converted = wxBitmap(*image);
|
wxBitmap converted = wxBitmap(image);
|
||||||
|
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
|
|
||||||
@ -2479,7 +2479,6 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
|||||||
|
|
||||||
dc.Blit(mid.x, mid.y, mid.width, mid.height, &memDC, 0, 0, wxCOPY, FALSE);
|
dc.Blit(mid.x, mid.y, mid.width, mid.height, &memDC, 0, 0, wxCOPY, FALSE);
|
||||||
|
|
||||||
delete image;
|
|
||||||
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
#ifdef EXPERIMENTAL_FFT_Y_GRID
|
||||||
delete[] yGrid;
|
delete[] yGrid;
|
||||||
#endif //EXPERIMENTAL_FFT_Y_GRID
|
#endif //EXPERIMENTAL_FFT_Y_GRID
|
||||||
|
@ -1430,9 +1430,8 @@ void TrackPanel::OnPaint(wxPaintEvent & /* event */)
|
|||||||
wxStopWatch sw;
|
wxStopWatch sw;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Construct the paint DC on the heap so that it may be deleted
|
{
|
||||||
// early
|
wxPaintDC dc(this);
|
||||||
wxPaintDC *dc = new wxPaintDC(this);
|
|
||||||
|
|
||||||
// Retrieve the damage rectangle
|
// Retrieve the damage rectangle
|
||||||
wxRect box = GetUpdateRegion().GetBox();
|
wxRect box = GetUpdateRegion().GetBox();
|
||||||
@ -1467,16 +1466,16 @@ void TrackPanel::OnPaint(wxPaintEvent & /* event */)
|
|||||||
DrawTracks(&mBackingDC);
|
DrawTracks(&mBackingDC);
|
||||||
|
|
||||||
// Copy it to the display
|
// Copy it to the display
|
||||||
dc->Blit(0, 0, mBacking->GetWidth(), mBacking->GetHeight(), &mBackingDC, 0, 0);
|
dc.Blit(0, 0, mBacking->GetWidth(), mBacking->GetHeight(), &mBackingDC, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Copy full, possibly clipped, damage rectangle
|
// Copy full, possibly clipped, damage rectangle
|
||||||
dc->Blit(box.x, box.y, box.width, box.height, &mBackingDC, box.x, box.y);
|
dc.Blit(box.x, box.y, box.width, box.height, &mBackingDC, box.x, box.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done with the clipped DC
|
// Done with the clipped DC
|
||||||
delete dc;
|
}
|
||||||
|
|
||||||
// Drawing now goes directly to the client area. It can't use the paint DC
|
// Drawing now goes directly to the client area. It can't use the paint DC
|
||||||
// becuase the paint DC might be clipped and DrawOverlays() may need to draw
|
// becuase the paint DC might be clipped and DrawOverlays() may need to draw
|
||||||
|
@ -57,15 +57,14 @@ void UndoManager::CalculateSpaceUsage()
|
|||||||
space.Clear();
|
space.Clear();
|
||||||
space.Add(0, stack.GetCount());
|
space.Add(0, stack.GetCount());
|
||||||
|
|
||||||
Set *prev = new Set;
|
Set s1, s2;
|
||||||
Set *cur = new Set;
|
Set *prev = &s1;
|
||||||
|
Set *cur = &s2;
|
||||||
|
|
||||||
for (size_t i = 0, cnt = stack.GetCount(); i < cnt; i++)
|
for (size_t i = 0, cnt = stack.GetCount(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
// Swap map pointers
|
// Swap map pointers
|
||||||
Set *swap = prev;
|
std::swap(cur, prev);
|
||||||
prev = cur;
|
|
||||||
cur = swap;
|
|
||||||
|
|
||||||
// And clean out the NEW current map
|
// And clean out the NEW current map
|
||||||
cur->clear();
|
cur->clear();
|
||||||
@ -102,8 +101,6 @@ void UndoManager::CalculateSpaceUsage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete cur;
|
|
||||||
delete prev;
|
|
||||||
TIMER_STOP( space_calc );
|
TIMER_STOP( space_calc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,12 +828,11 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len)
|
|||||||
text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD);
|
text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD);
|
||||||
text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD);
|
text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD);
|
||||||
text += wxString::Format(_("Direction Changes -- mean: %1.4f sd: (%1.4f)\n"), mDirectionChangesMean, mDirectionChangesSD);
|
text += wxString::Format(_("Direction Changes -- mean: %1.4f sd: (%1.4f)\n"), mDirectionChangesMean, mDirectionChangesSD);
|
||||||
wxMessageDialog * stats = new wxMessageDialog(NULL, text,
|
wxMessageDialog{ NULL, text,
|
||||||
wxT("Calibration Complete"),
|
wxT("Calibration Complete"),
|
||||||
wxOK | wxICON_INFORMATION,
|
wxOK | wxICON_INFORMATION,
|
||||||
wxPoint(-1,-1));
|
wxPoint(-1, -1) }
|
||||||
stats->ShowModal();
|
.ShowModal();
|
||||||
delete stats;
|
|
||||||
|
|
||||||
AdjustThreshold(mThresholdAdjustment);
|
AdjustThreshold(mThresholdAdjustment);
|
||||||
}
|
}
|
||||||
|
@ -1731,7 +1731,7 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress)
|
|||||||
return true; // Nothing to do
|
return true; // Nothing to do
|
||||||
|
|
||||||
double factor = (double)rate / (double)mRate;
|
double factor = (double)rate / (double)mRate;
|
||||||
::Resample* resample = new ::Resample(true, factor, factor); // constant rate resampling
|
::Resample resample(true, factor, factor); // constant rate resampling
|
||||||
|
|
||||||
int bufsize = 65536;
|
int bufsize = 65536;
|
||||||
float* inBuffer = new float[bufsize];
|
float* inBuffer = new float[bufsize];
|
||||||
@ -1764,7 +1764,7 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int inBufferUsed = 0;
|
int inBufferUsed = 0;
|
||||||
outGenerated = resample->Process(factor, inBuffer, inLen, isLast,
|
outGenerated = resample.Process(factor, inBuffer, inLen, isLast,
|
||||||
&inBufferUsed, outBuffer, bufsize);
|
&inBufferUsed, outBuffer, bufsize);
|
||||||
|
|
||||||
pos += inBufferUsed;
|
pos += inBufferUsed;
|
||||||
@ -1795,7 +1795,6 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress)
|
|||||||
|
|
||||||
delete[] inBuffer;
|
delete[] inBuffer;
|
||||||
delete[] outBuffer;
|
delete[] outBuffer;
|
||||||
delete resample;
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
@ -826,11 +826,12 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If provided time warper was NULL, use a default one that does nothing
|
// If provided time warper was NULL, use a default one that does nothing
|
||||||
|
IdentityTimeWarper localWarper;
|
||||||
TimeWarper *warper = NULL;
|
TimeWarper *warper = NULL;
|
||||||
if (effectWarper != NULL) {
|
if (effectWarper != NULL) {
|
||||||
warper = effectWarper;
|
warper = effectWarper;
|
||||||
} else {
|
} else {
|
||||||
warper = new IdentityTimeWarper();
|
warper = &localWarper;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Align to a sample
|
// Align to a sample
|
||||||
@ -974,10 +975,6 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear
|
|||||||
for (int ii = cuts.GetCount(); ii--;)
|
for (int ii = cuts.GetCount(); ii--;)
|
||||||
delete cuts[ii];
|
delete cuts[ii];
|
||||||
|
|
||||||
// If we created a default time warper, we need to DELETE it
|
|
||||||
if (effectWarper == NULL)
|
|
||||||
delete warper;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1645,9 +1642,7 @@ sampleCount WaveTrack::GetMaxBlockSize() const
|
|||||||
{
|
{
|
||||||
// We really need the maximum block size, so create a
|
// We really need the maximum block size, so create a
|
||||||
// temporary sequence to get it.
|
// temporary sequence to get it.
|
||||||
Sequence *tempseq = new Sequence(mDirManager, mFormat);
|
maxblocksize = Sequence{ mDirManager, mFormat }.GetMaxBlockSize();
|
||||||
maxblocksize = tempseq->GetMaxBlockSize();
|
|
||||||
delete tempseq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT(maxblocksize > 0);
|
wxASSERT(maxblocksize > 0);
|
||||||
|
@ -476,9 +476,7 @@ void ContrastDialog::OnExport(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextFile f(fName);
|
wxTextFile f(fName);
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
wxFile *temp = new wxFile();
|
wxFile{}.Create(fName);
|
||||||
temp->Create(fName);
|
|
||||||
delete temp;
|
|
||||||
#else
|
#else
|
||||||
f.Create();
|
f.Create();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1154,6 +1154,16 @@ void Effect::SetBatchProcessing(bool start)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct SetProgress {
|
||||||
|
SetProgress(ProgressDialog *& mProgress_, ProgressDialog *progress)
|
||||||
|
: mProgress(mProgress_)
|
||||||
|
{ mProgress = progress; }
|
||||||
|
~SetProgress() { mProgress = nullptr; }
|
||||||
|
ProgressDialog *& mProgress;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
bool Effect::DoEffect(wxWindow *parent,
|
bool Effect::DoEffect(wxWindow *parent,
|
||||||
double projectRate,
|
double projectRate,
|
||||||
TrackList *list,
|
TrackList *list,
|
||||||
@ -1230,12 +1240,11 @@ bool Effect::DoEffect(wxWindow *parent,
|
|||||||
bool skipFlag = CheckWhetherSkipEffect();
|
bool skipFlag = CheckWhetherSkipEffect();
|
||||||
if (skipFlag == false)
|
if (skipFlag == false)
|
||||||
{
|
{
|
||||||
mProgress = new ProgressDialog(GetName(),
|
ProgressDialog progress(GetName(),
|
||||||
wxString::Format(_("Applying %s..."), GetName().c_str()),
|
wxString::Format(_("Applying %s..."), GetName().c_str()),
|
||||||
pdlgHideStopButton);
|
pdlgHideStopButton);
|
||||||
|
SetProgress sp(mProgress, &progress);
|
||||||
returnVal = Process();
|
returnVal = Process();
|
||||||
delete mProgress;
|
|
||||||
mProgress = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
End();
|
End();
|
||||||
@ -1870,22 +1879,20 @@ bool Effect::ProcessTrack(int count,
|
|||||||
if (isGenerator)
|
if (isGenerator)
|
||||||
{
|
{
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
StepTimeWarper *warper = new StepTimeWarper(mT0 + genLength, genLength - (mT1 - mT0));
|
StepTimeWarper warper(mT0 + genLength, genLength - (mT1 - mT0));
|
||||||
|
|
||||||
// Transfer the data from the temporary tracks to the actual ones
|
// Transfer the data from the temporary tracks to the actual ones
|
||||||
genLeft->Flush();
|
genLeft->Flush();
|
||||||
// mT1 gives us the NEW selection. We want to replace up to GetSel1().
|
// mT1 gives us the NEW selection. We want to replace up to GetSel1().
|
||||||
left->ClearAndPaste(mT0, p->GetSel1(), genLeft, true, true, warper);
|
left->ClearAndPaste(mT0, p->GetSel1(), genLeft, true, true, &warper);
|
||||||
delete genLeft;
|
delete genLeft;
|
||||||
|
|
||||||
if (genRight)
|
if (genRight)
|
||||||
{
|
{
|
||||||
genRight->Flush();
|
genRight->Flush();
|
||||||
right->ClearAndPaste(mT0, mT1, genRight, true, true, warper);
|
right->ClearAndPaste(mT0, mT1, genRight, true, true, &warper);
|
||||||
delete genRight;
|
delete genRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete warper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the plugin to cleanup
|
// Allow the plugin to cleanup
|
||||||
@ -2529,14 +2536,13 @@ void Effect::Preview(bool dryOnly)
|
|||||||
|
|
||||||
// Apply effect
|
// Apply effect
|
||||||
if (!dryOnly) {
|
if (!dryOnly) {
|
||||||
mProgress = new ProgressDialog(GetName(),
|
ProgressDialog progress(GetName(),
|
||||||
_("Preparing preview"),
|
_("Preparing preview"),
|
||||||
pdlgHideCancelButton); // Have only "Stop" button.
|
pdlgHideCancelButton); // Have only "Stop" button.
|
||||||
|
SetProgress sp(mProgress, &progress);
|
||||||
mIsPreview = true;
|
mIsPreview = true;
|
||||||
success = Process();
|
success = Process();
|
||||||
mIsPreview = false;
|
mIsPreview = false;
|
||||||
delete mProgress;
|
|
||||||
mProgress = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@ -2570,15 +2576,15 @@ void Effect::Preview(bool dryOnly)
|
|||||||
// The progress dialog must be deleted before stopping the stream
|
// The progress dialog must be deleted before stopping the stream
|
||||||
// to allow events to flow to the app during StopStream processing.
|
// to allow events to flow to the app during StopStream processing.
|
||||||
// The progress dialog blocks these events.
|
// The progress dialog blocks these events.
|
||||||
ProgressDialog *progress =
|
{
|
||||||
new ProgressDialog(GetName(), _("Previewing"), pdlgHideCancelButton);
|
ProgressDialog progress
|
||||||
|
(GetName(), _("Previewing"), pdlgHideCancelButton);
|
||||||
|
|
||||||
while (gAudioIO->IsStreamActive(token) && previewing == eProgressSuccess) {
|
while (gAudioIO->IsStreamActive(token) && previewing == eProgressSuccess) {
|
||||||
::wxMilliSleep(100);
|
::wxMilliSleep(100);
|
||||||
previewing = progress->Update(gAudioIO->GetStreamTime() - mT0, t1 - mT0);
|
previewing = progress.Update(gAudioIO->GetStreamTime() - mT0, t1 - mT0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
gAudioIO->StopStream();
|
gAudioIO->StopStream();
|
||||||
|
|
||||||
@ -3207,14 +3213,14 @@ void EffectUIHost::OnDebug(wxCommandEvent & evt)
|
|||||||
|
|
||||||
void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
|
void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
wxMenu *menu = new wxMenu();
|
wxMenu menu;
|
||||||
wxMenu *sub;
|
wxMenu *sub;
|
||||||
|
|
||||||
LoadUserPresets();
|
LoadUserPresets();
|
||||||
|
|
||||||
if (mUserPresets.GetCount() == 0)
|
if (mUserPresets.GetCount() == 0)
|
||||||
{
|
{
|
||||||
menu->Append(kUserPresetsDummyID, _("User Presets"))->Enable(false);
|
menu.Append(kUserPresetsDummyID, _("User Presets"))->Enable(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3223,14 +3229,14 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
|
|||||||
{
|
{
|
||||||
sub->Append(kUserPresetsID + i, mUserPresets[i]);
|
sub->Append(kUserPresetsID + i, mUserPresets[i]);
|
||||||
}
|
}
|
||||||
menu->Append(0, _("User Presets"), sub);
|
menu.Append(0, _("User Presets"), sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->Append(kSaveAsID, _("Save Preset..."));
|
menu.Append(kSaveAsID, _("Save Preset..."));
|
||||||
|
|
||||||
if (mUserPresets.GetCount() == 0)
|
if (mUserPresets.GetCount() == 0)
|
||||||
{
|
{
|
||||||
menu->Append(kDeletePresetDummyID, _("Delete Preset"))->Enable(false);
|
menu.Append(kDeletePresetDummyID, _("Delete Preset"))->Enable(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3239,10 +3245,10 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
|
|||||||
{
|
{
|
||||||
sub->Append(kDeletePresetID + i, mUserPresets[i]);
|
sub->Append(kDeletePresetID + i, mUserPresets[i]);
|
||||||
}
|
}
|
||||||
menu->Append(0, _("Delete Preset"), sub);
|
menu.Append(0, _("Delete Preset"), sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->AppendSeparator();
|
menu.AppendSeparator();
|
||||||
|
|
||||||
wxArrayString factory = mEffect->GetFactoryPresets();
|
wxArrayString factory = mEffect->GetFactoryPresets();
|
||||||
|
|
||||||
@ -3262,14 +3268,14 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
|
|||||||
sub->Append(kFactoryPresetsID + i, label);
|
sub->Append(kFactoryPresetsID + i, label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu->Append(0, _("Factory Presets"), sub);
|
menu.Append(0, _("Factory Presets"), sub);
|
||||||
|
|
||||||
menu->AppendSeparator();
|
menu.AppendSeparator();
|
||||||
menu->Append(kImportID, _("Import..."))->Enable(mClient->CanExportPresets());
|
menu.Append(kImportID, _("Import..."))->Enable(mClient->CanExportPresets());
|
||||||
menu->Append(kExportID, _("Export..."))->Enable(mClient->CanExportPresets());
|
menu.Append(kExportID, _("Export..."))->Enable(mClient->CanExportPresets());
|
||||||
menu->AppendSeparator();
|
menu.AppendSeparator();
|
||||||
menu->Append(kOptionsID, _("Options..."))->Enable(mClient->HasOptions());
|
menu.Append(kOptionsID, _("Options..."))->Enable(mClient->HasOptions());
|
||||||
menu->AppendSeparator();
|
menu.AppendSeparator();
|
||||||
|
|
||||||
sub = new wxMenu();
|
sub = new wxMenu();
|
||||||
|
|
||||||
@ -3279,13 +3285,11 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
|
|||||||
sub->Append(kDummyID, wxString::Format(_("Vendor: %s"), mEffect->GetVendor().c_str()));
|
sub->Append(kDummyID, wxString::Format(_("Vendor: %s"), mEffect->GetVendor().c_str()));
|
||||||
sub->Append(kDummyID, wxString::Format(_("Description: %s"), mEffect->GetDescription().c_str()));
|
sub->Append(kDummyID, wxString::Format(_("Description: %s"), mEffect->GetDescription().c_str()));
|
||||||
|
|
||||||
menu->Append(0, _("About"), sub);
|
menu.Append(0, _("About"), sub);
|
||||||
|
|
||||||
wxWindow *btn = FindWindow(kMenuID);
|
wxWindow *btn = FindWindow(kMenuID);
|
||||||
wxRect r = btn->GetRect();
|
wxRect r = btn->GetRect();
|
||||||
btn->PopupMenu(menu, r.GetLeft(), r.GetBottom());
|
btn->PopupMenu(&menu, r.GetLeft(), r.GetBottom());
|
||||||
|
|
||||||
delete menu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectUIHost::OnEnable(wxCommandEvent & WXUNUSED(evt))
|
void EffectUIHost::OnEnable(wxCommandEvent & WXUNUSED(evt))
|
||||||
|
@ -362,7 +362,7 @@ protected:
|
|||||||
// may be needed by any particular subclass of Effect.
|
// may be needed by any particular subclass of Effect.
|
||||||
//
|
//
|
||||||
protected:
|
protected:
|
||||||
ProgressDialog *mProgress;
|
ProgressDialog *mProgress; // Temporary pointer, NOT deleted in destructor.
|
||||||
double mProjectRate; // Sample rate of the project - NEW tracks should
|
double mProjectRate; // Sample rate of the project - NEW tracks should
|
||||||
// be created with this rate...
|
// be created with this rate...
|
||||||
double mSampleRate;
|
double mSampleRate;
|
||||||
|
@ -2161,24 +2161,23 @@ void EffectEqualization::ErrMin(void)
|
|||||||
double correction = 1.6;
|
double correction = 1.6;
|
||||||
bool flag;
|
bool flag;
|
||||||
int j=0;
|
int j=0;
|
||||||
Envelope *testEnvelope;
|
Envelope testEnvelope;
|
||||||
testEnvelope = new Envelope();
|
testEnvelope.SetInterpolateDB(false);
|
||||||
testEnvelope->SetInterpolateDB(false);
|
testEnvelope.Mirror(false);
|
||||||
testEnvelope->Mirror(false);
|
testEnvelope.SetRange(-120.0, 60.0);
|
||||||
testEnvelope->SetRange(-120.0, 60.0);
|
testEnvelope.Flatten(0.);
|
||||||
testEnvelope->Flatten(0.);
|
testEnvelope.SetTrackLen(1.0);
|
||||||
testEnvelope->SetTrackLen(1.0);
|
testEnvelope.CopyFrom(mLogEnvelope, 0.0, 1.0);
|
||||||
testEnvelope->CopyFrom(mLogEnvelope, 0.0, 1.0);
|
|
||||||
|
|
||||||
for(i=0; i < NUM_PTS; i++)
|
for(i=0; i < NUM_PTS; i++)
|
||||||
vals[i] = testEnvelope->GetValue(mWhens[i]);
|
vals[i] = testEnvelope.GetValue(mWhens[i]);
|
||||||
|
|
||||||
// Do error minimisation
|
// Do error minimisation
|
||||||
error = 0.;
|
error = 0.;
|
||||||
GraphicEQ(testEnvelope);
|
GraphicEQ(&testEnvelope);
|
||||||
for(i=0; i < NUM_PTS; i++) //calc initial error
|
for(i=0; i < NUM_PTS; i++) //calc initial error
|
||||||
{
|
{
|
||||||
double err = vals[i] - testEnvelope->GetValue(mWhens[i]);
|
double err = vals[i] - testEnvelope.GetValue(mWhens[i]);
|
||||||
error += err*err;
|
error += err*err;
|
||||||
}
|
}
|
||||||
oldError = error;
|
oldError = error;
|
||||||
@ -2208,11 +2207,11 @@ void EffectEqualization::ErrMin(void)
|
|||||||
mEQVals[i] = -20.;
|
mEQVals[i] = -20.;
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
GraphicEQ(testEnvelope); //calculate envelope
|
GraphicEQ(&testEnvelope); //calculate envelope
|
||||||
error = 0.;
|
error = 0.;
|
||||||
for(int k=0; k < NUM_PTS; k++) //calculate error
|
for(int k=0; k < NUM_PTS; k++) //calculate error
|
||||||
{
|
{
|
||||||
double err = vals[k] - testEnvelope->GetValue(mWhens[k]);
|
double err = vals[k] - testEnvelope.GetValue(mWhens[k]);
|
||||||
error += err*err;
|
error += err*err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2231,9 +2230,8 @@ void EffectEqualization::ErrMin(void)
|
|||||||
if( error > .0025 * mBandsInUse ) // not within 0.05dB on each slider, on average
|
if( error > .0025 * mBandsInUse ) // not within 0.05dB on each slider, on average
|
||||||
{
|
{
|
||||||
Select( (int) mCurves.GetCount()-1 );
|
Select( (int) mCurves.GetCount()-1 );
|
||||||
EnvelopeUpdated(testEnvelope, false);
|
EnvelopeUpdated(&testEnvelope, false);
|
||||||
}
|
}
|
||||||
delete testEnvelope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectEqualization::GraphicEQ(Envelope *env)
|
void EffectEqualization::GraphicEQ(Envelope *env)
|
||||||
|
@ -333,7 +333,7 @@ bool EffectEqualization48x::TrackCompare()
|
|||||||
SecondIMap.Clear();
|
SecondIMap.Clear();
|
||||||
SecondOMap.Clear();
|
SecondOMap.Clear();
|
||||||
|
|
||||||
TrackList *SecondOutputTracks = new TrackList();
|
TrackList SecondOutputTracks(true);
|
||||||
|
|
||||||
//iterate over tracks of type trackType (All types if Track::All)
|
//iterate over tracks of type trackType (All types if Track::All)
|
||||||
TrackListOfKindIterator aIt(mEffectEqualization->mOutputTracksType, mEffectEqualization->mTracks);
|
TrackListOfKindIterator aIt(mEffectEqualization->mOutputTracksType, mEffectEqualization->mTracks);
|
||||||
@ -345,14 +345,14 @@ bool EffectEqualization48x::TrackCompare()
|
|||||||
(mEffectEqualization->mOutputTracksType == Track::All && aTrack->IsSyncLockSelected()))
|
(mEffectEqualization->mOutputTracksType == Track::All && aTrack->IsSyncLockSelected()))
|
||||||
{
|
{
|
||||||
Track *o = aTrack->Duplicate();
|
Track *o = aTrack->Duplicate();
|
||||||
SecondOutputTracks->Add(o);
|
SecondOutputTracks.Add(o);
|
||||||
SecondIMap.Add(aTrack);
|
SecondIMap.Add(aTrack);
|
||||||
SecondIMap.Add(o);
|
SecondIMap.Add(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0;i<2;i++) {
|
for(int i=0;i<2;i++) {
|
||||||
SelectedTrackListOfKindIterator iter(Track::Wave, i?mEffectEqualization->mOutputTracks:SecondOutputTracks);
|
SelectedTrackListOfKindIterator iter(Track::Wave, i ? mEffectEqualization->mOutputTracks : &SecondOutputTracks);
|
||||||
i?sMathPath=sMathPath:sMathPath=0;
|
i?sMathPath=sMathPath:sMathPath=0;
|
||||||
WaveTrack *track = (WaveTrack *) iter.First();
|
WaveTrack *track = (WaveTrack *) iter.First();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -375,7 +375,7 @@ bool EffectEqualization48x::TrackCompare()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectedTrackListOfKindIterator iter(Track::Wave, mEffectEqualization->mOutputTracks);
|
SelectedTrackListOfKindIterator iter(Track::Wave, mEffectEqualization->mOutputTracks);
|
||||||
SelectedTrackListOfKindIterator iter2(Track::Wave, SecondOutputTracks);
|
SelectedTrackListOfKindIterator iter2(Track::Wave, &SecondOutputTracks);
|
||||||
WaveTrack *track = (WaveTrack *) iter.First();
|
WaveTrack *track = (WaveTrack *) iter.First();
|
||||||
WaveTrack *track2 = (WaveTrack *) iter2.First();
|
WaveTrack *track2 = (WaveTrack *) iter2.First();
|
||||||
while (track) {
|
while (track) {
|
||||||
@ -393,7 +393,6 @@ bool EffectEqualization48x::TrackCompare()
|
|||||||
track = (WaveTrack *) iter.Next();
|
track = (WaveTrack *) iter.Next();
|
||||||
track2 = (WaveTrack *) iter2.Next();
|
track2 = (WaveTrack *) iter2.Next();
|
||||||
}
|
}
|
||||||
delete SecondOutputTracks;
|
|
||||||
FreeBuffersWorkers();
|
FreeBuffersWorkers();
|
||||||
mEffectEqualization->ReplaceProcessedTracks(!bBreakLoop);
|
mEffectEqualization->ReplaceProcessedTracks(!bBreakLoop);
|
||||||
return bBreakLoop;
|
return bBreakLoop;
|
||||||
|
@ -290,11 +290,11 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
|||||||
|
|
||||||
WaveTrack * outputTrack = mFactory->NewWaveTrack(track->GetSampleFormat(),track->GetRate());
|
WaveTrack * outputTrack = mFactory->NewWaveTrack(track->GetSampleFormat(),track->GetRate());
|
||||||
|
|
||||||
PaulStretch *stretch=new PaulStretch(amount,stretch_buf_size,track->GetRate());
|
PaulStretch stretch(amount,stretch_buf_size,track->GetRate());
|
||||||
|
|
||||||
sampleCount nget=stretch->get_nsamples_for_fill();
|
sampleCount nget=stretch.get_nsamples_for_fill();
|
||||||
|
|
||||||
int bufsize=stretch->poolsize;
|
int bufsize=stretch.poolsize;
|
||||||
float *buffer0=new float[bufsize];
|
float *buffer0=new float[bufsize];
|
||||||
float *bufferptr0=buffer0;
|
float *bufferptr0=buffer0;
|
||||||
sampleCount outs=0;
|
sampleCount outs=0;
|
||||||
@ -308,13 +308,13 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
|||||||
|
|
||||||
while (s<len){
|
while (s<len){
|
||||||
track->Get((samplePtr)bufferptr0,floatSample,start+s,nget);
|
track->Get((samplePtr)bufferptr0,floatSample,start+s,nget);
|
||||||
stretch->process(buffer0,nget);
|
stretch.process(buffer0,nget);
|
||||||
|
|
||||||
if (first_time) {
|
if (first_time) {
|
||||||
stretch->process(buffer0,0);
|
stretch.process(buffer0,0);
|
||||||
};
|
};
|
||||||
|
|
||||||
outs+=stretch->out_bufsize;
|
outs+=stretch.out_bufsize;
|
||||||
s+=nget;
|
s+=nget;
|
||||||
|
|
||||||
if (first_time){//blend the the start of the selection
|
if (first_time){//blend the the start of the selection
|
||||||
@ -322,7 +322,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
|||||||
first_time=false;
|
first_time=false;
|
||||||
for (int i=0;i<fade_len;i++){
|
for (int i=0;i<fade_len;i++){
|
||||||
float fi=(float)i/(float)fade_len;
|
float fi=(float)i/(float)fade_len;
|
||||||
stretch->out_buf[i]=stretch->out_buf[i]*fi+(1.0-fi)*fade_track_smps[i];
|
stretch.out_buf[i]=stretch.out_buf[i]*fi+(1.0-fi)*fade_track_smps[i];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (s>=len){//blend the end of the selection
|
if (s>=len){//blend the end of the selection
|
||||||
@ -330,13 +330,13 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
|||||||
for (int i=0;i<fade_len;i++){
|
for (int i=0;i<fade_len;i++){
|
||||||
float fi=(float)i/(float)fade_len;
|
float fi=(float)i/(float)fade_len;
|
||||||
int i2=bufsize/2-1-i;
|
int i2=bufsize/2-1-i;
|
||||||
stretch->out_buf[i2]=stretch->out_buf[i2]*fi+(1.0-fi)*fade_track_smps[fade_len-1-i];
|
stretch.out_buf[i2]=stretch.out_buf[i2]*fi+(1.0-fi)*fade_track_smps[fade_len-1-i];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputTrack->Append((samplePtr)stretch->out_buf,floatSample,stretch->out_bufsize);
|
outputTrack->Append((samplePtr)stretch.out_buf,floatSample,stretch.out_bufsize);
|
||||||
|
|
||||||
nget=stretch->get_nsamples();
|
nget=stretch.get_nsamples();
|
||||||
if (TrackProgress(count, (s / (double) len))) {
|
if (TrackProgress(count, (s / (double) len))) {
|
||||||
cancelled=true;
|
cancelled=true;
|
||||||
break;
|
break;
|
||||||
@ -352,7 +352,6 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
|||||||
m_t1 = mT0 + outputTrack->GetEndTime();
|
m_t1 = mT0 + outputTrack->GetEndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete stretch;
|
|
||||||
delete []buffer0;
|
delete []buffer0;
|
||||||
|
|
||||||
delete outputTrack;
|
delete outputTrack;
|
||||||
|
@ -470,25 +470,24 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
|
|||||||
wxString cmd;
|
wxString cmd;
|
||||||
cmd.Printf(wxT("\"%s\" %s \"%s;%s\""), cmdpath.c_str(), VSTCMDKEY, path.c_str(), effectID.c_str());
|
cmd.Printf(wxT("\"%s\" %s \"%s;%s\""), cmdpath.c_str(), VSTCMDKEY, path.c_str(), effectID.c_str());
|
||||||
|
|
||||||
VSTSubProcess *proc = new VSTSubProcess();
|
VSTSubProcess proc;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int flags = wxEXEC_SYNC | wxEXEC_NODISABLE;
|
int flags = wxEXEC_SYNC | wxEXEC_NODISABLE;
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
flags += wxEXEC_NOHIDE;
|
flags += wxEXEC_NOHIDE;
|
||||||
#endif
|
#endif
|
||||||
wxExecute(cmd, flags, proc);
|
wxExecute(cmd, flags, &proc);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
wxLogMessage(_("VST plugin registration failed for %s\n"), path.c_str());
|
wxLogMessage(_("VST plugin registration failed for %s\n"), path.c_str());
|
||||||
delete proc;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString output;
|
wxString output;
|
||||||
wxStringOutputStream ss(&output);
|
wxStringOutputStream ss(&output);
|
||||||
proc->GetInputStream()->Read(ss);
|
proc.GetInputStream()->Read(ss);
|
||||||
|
|
||||||
int keycount = 0;
|
int keycount = 0;
|
||||||
bool haveBegin = false;
|
bool haveBegin = false;
|
||||||
@ -519,7 +518,7 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
|
|||||||
if (idCnt > 3)
|
if (idCnt > 3)
|
||||||
{
|
{
|
||||||
progress = new wxProgressDialog(_("Scanning Shell VST"),
|
progress = new wxProgressDialog(_("Scanning Shell VST"),
|
||||||
wxString::Format(_("Registering %d of %d: %-64.64s"), 0, idCnt, proc->GetName().c_str()),
|
wxString::Format(_("Registering %d of %d: %-64.64s"), 0, idCnt, proc.GetName().c_str()),
|
||||||
idCnt,
|
idCnt,
|
||||||
NULL,
|
NULL,
|
||||||
wxPD_APP_MODAL |
|
wxPD_APP_MODAL |
|
||||||
@ -538,44 +537,44 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyName:
|
case kKeyName:
|
||||||
proc->mName = val;
|
proc.mName = val;
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyPath:
|
case kKeyPath:
|
||||||
proc->mPath = val;
|
proc.mPath = val;
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyVendor:
|
case kKeyVendor:
|
||||||
proc->mVendor = val;
|
proc.mVendor = val;
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyVersion:
|
case kKeyVersion:
|
||||||
proc->mVersion = val;
|
proc.mVersion = val;
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyDescription:
|
case kKeyDescription:
|
||||||
proc->mDescription = val;
|
proc.mDescription = val;
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyEffectType:
|
case kKeyEffectType:
|
||||||
long type;
|
long type;
|
||||||
val.ToLong(&type);
|
val.ToLong(&type);
|
||||||
proc->mType = (EffectType) type;
|
proc.mType = (EffectType) type;
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyInteractive:
|
case kKeyInteractive:
|
||||||
proc->mInteractive = val.IsSameAs(wxT("1"));
|
proc.mInteractive = val.IsSameAs(wxT("1"));
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyAutomatable:
|
case kKeyAutomatable:
|
||||||
proc->mAutomatable = val.IsSameAs(wxT("1"));
|
proc.mAutomatable = val.IsSameAs(wxT("1"));
|
||||||
keycount++;
|
keycount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -593,13 +592,13 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
|
|||||||
{
|
{
|
||||||
idNdx++;
|
idNdx++;
|
||||||
cont = progress->Update(idNdx,
|
cont = progress->Update(idNdx,
|
||||||
wxString::Format(_("Registering %d of %d: %-64.64s"), idNdx, idCnt, proc->GetName().c_str()));
|
wxString::Format(_("Registering %d of %d: %-64.64s"), idNdx, idCnt, proc.GetName().c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip && cont)
|
if (!skip && cont)
|
||||||
{
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
pm.RegisterPlugin(this, proc);
|
pm.RegisterPlugin(this, &proc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -610,8 +609,6 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete proc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress)
|
if (progress)
|
||||||
@ -656,12 +653,10 @@ void VSTEffectsModule::DeleteInstance(IdentInterface *instance)
|
|||||||
// Called from reinvokation of Audacity or DLL to check in a separate process
|
// Called from reinvokation of Audacity or DLL to check in a separate process
|
||||||
void VSTEffectsModule::Check(const wxChar *path)
|
void VSTEffectsModule::Check(const wxChar *path)
|
||||||
{
|
{
|
||||||
VSTEffect *effect = new VSTEffect(path);
|
VSTEffect effect(path);
|
||||||
if (effect)
|
if (effect.SetHost(NULL))
|
||||||
{
|
{
|
||||||
if (effect->SetHost(NULL))
|
wxArrayInt effectIDs = effect.GetEffectIDs();
|
||||||
{
|
|
||||||
wxArrayInt effectIDs = effect->GetEffectIDs();
|
|
||||||
wxString out;
|
wxString out;
|
||||||
|
|
||||||
if (effectIDs.GetCount() > 0)
|
if (effectIDs.GetCount() > 0)
|
||||||
@ -678,14 +673,14 @@ void VSTEffectsModule::Check(const wxChar *path)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyBegin, wxEmptyString);
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyBegin, wxEmptyString);
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyPath, effect->GetPath().c_str());
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyPath, effect.GetPath().c_str());
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyName, effect->GetName().c_str());
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyName, effect.GetName().c_str());
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyVendor, effect->GetVendor().c_str());
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyVendor, effect.GetVendor().c_str());
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyVersion, effect->GetVersion().c_str());
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyVersion, effect.GetVersion().c_str());
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyDescription, effect->GetDescription().c_str());
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyDescription, effect.GetDescription().c_str());
|
||||||
out += wxString::Format(wxT("%s%d=%d\n"), OUTPUTKEY, kKeyEffectType, effect->GetType());
|
out += wxString::Format(wxT("%s%d=%d\n"), OUTPUTKEY, kKeyEffectType, effect.GetType());
|
||||||
out += wxString::Format(wxT("%s%d=%d\n"), OUTPUTKEY, kKeyInteractive, effect->IsInteractive());
|
out += wxString::Format(wxT("%s%d=%d\n"), OUTPUTKEY, kKeyInteractive, effect.IsInteractive());
|
||||||
out += wxString::Format(wxT("%s%d=%d\n"), OUTPUTKEY, kKeyAutomatable, effect->SupportsAutomation());
|
out += wxString::Format(wxT("%s%d=%d\n"), OUTPUTKEY, kKeyAutomatable, effect.SupportsAutomation());
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyEnd, wxEmptyString);
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyEnd, wxEmptyString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,9 +690,6 @@ void VSTEffectsModule::Check(const wxChar *path)
|
|||||||
fwrite(buf, 1, strlen(buf), stdout);
|
fwrite(buf, 1, strlen(buf), stdout);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete effect;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -440,8 +440,9 @@ int ExportCL::Export(AudacityProject *project,
|
|||||||
samplePtr mixed = NULL;
|
samplePtr mixed = NULL;
|
||||||
int updateResult = eProgressSuccess;
|
int updateResult = eProgressSuccess;
|
||||||
|
|
||||||
|
{
|
||||||
// Prepare the progress display
|
// Prepare the progress display
|
||||||
ProgressDialog *progress = new ProgressDialog(_("Export"),
|
ProgressDialog progress(_("Export"),
|
||||||
selectionOnly ?
|
selectionOnly ?
|
||||||
_("Exporting the selected audio using command-line encoder") :
|
_("Exporting the selected audio using command-line encoder") :
|
||||||
_("Exporting the entire project using command-line encoder"));
|
_("Exporting the entire project using command-line encoder"));
|
||||||
@ -487,11 +488,10 @@ int ExportCL::Export(AudacityProject *project,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the progress display
|
// Update the progress display
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done with the progress display
|
// Done with the progress display
|
||||||
delete progress;
|
}
|
||||||
|
|
||||||
// Should make the process die
|
// Should make the process die
|
||||||
process.CloseOutput();
|
process.CloseOutput();
|
||||||
|
@ -833,13 +833,13 @@ int ExportFFmpeg::Export(AudacityProject *project,
|
|||||||
mSampleRate, int16Sample, true, mixerSpec);
|
mSampleRate, int16Sample, true, mixerSpec);
|
||||||
delete[] waveTracks;
|
delete[] waveTracks;
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
int updateResult = eProgressSuccess;
|
||||||
|
{
|
||||||
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
selectionOnly ?
|
selectionOnly ?
|
||||||
wxString::Format(_("Exporting selected audio as %s"), ExportFFmpegOptions::fmts[mSubFormat].description) :
|
wxString::Format(_("Exporting selected audio as %s"), ExportFFmpegOptions::fmts[mSubFormat].description) :
|
||||||
wxString::Format(_("Exporting entire file as %s"), ExportFFmpegOptions::fmts[mSubFormat].description));
|
wxString::Format(_("Exporting entire file as %s"), ExportFFmpegOptions::fmts[mSubFormat].description));
|
||||||
|
|
||||||
int updateResult = eProgressSuccess;
|
|
||||||
|
|
||||||
while (updateResult == eProgressSuccess) {
|
while (updateResult == eProgressSuccess) {
|
||||||
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
||||||
|
|
||||||
@ -850,10 +850,9 @@ int ExportFFmpeg::Export(AudacityProject *project,
|
|||||||
|
|
||||||
EncodeAudioFrame(pcmBuffer, (pcmNumSamples)*sizeof(int16_t)*mChannels);
|
EncodeAudioFrame(pcmBuffer, (pcmNumSamples)*sizeof(int16_t)*mChannels);
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
|
@ -325,7 +325,8 @@ int ExportFLAC::Export(AudacityProject *project,
|
|||||||
tmpsmplbuf[i] = (FLAC__int32 *) calloc(SAMPLES_PER_RUN, sizeof(FLAC__int32));
|
tmpsmplbuf[i] = (FLAC__int32 *) calloc(SAMPLES_PER_RUN, sizeof(FLAC__int32));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
{
|
||||||
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
selectionOnly ?
|
selectionOnly ?
|
||||||
_("Exporting the selected audio as FLAC") :
|
_("Exporting the selected audio as FLAC") :
|
||||||
_("Exporting the entire project as FLAC"));
|
_("Exporting the entire project as FLAC"));
|
||||||
@ -351,12 +352,11 @@ int ExportFLAC::Export(AudacityProject *project,
|
|||||||
}
|
}
|
||||||
encoder.process(tmpsmplbuf, samplesThisRun);
|
encoder.process(tmpsmplbuf, samplesThisRun);
|
||||||
}
|
}
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
}
|
}
|
||||||
f.Detach(); // libflac closes the file
|
f.Detach(); // libflac closes the file
|
||||||
encoder.finish();
|
encoder.finish();
|
||||||
|
}
|
||||||
delete progress;
|
|
||||||
|
|
||||||
for (i = 0; i < numChannels; i++) {
|
for (i = 0; i < numChannels; i++) {
|
||||||
free(tmpsmplbuf[i]);
|
free(tmpsmplbuf[i]);
|
||||||
|
@ -274,12 +274,13 @@ int ExportMP2::Export(AudacityProject *project,
|
|||||||
rate, int16Sample, true, mixerSpec);
|
rate, int16Sample, true, mixerSpec);
|
||||||
delete[] waveTracks;
|
delete[] waveTracks;
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
int updateResult = eProgressSuccess;
|
||||||
|
{
|
||||||
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
selectionOnly ?
|
selectionOnly ?
|
||||||
wxString::Format(_("Exporting selected audio at %ld kbps"), bitrate) :
|
wxString::Format(_("Exporting selected audio at %ld kbps"), bitrate) :
|
||||||
wxString::Format(_("Exporting entire file at %ld kbps"), bitrate));
|
wxString::Format(_("Exporting entire file at %ld kbps"), bitrate));
|
||||||
|
|
||||||
int updateResult = eProgressSuccess;
|
|
||||||
while (updateResult == eProgressSuccess) {
|
while (updateResult == eProgressSuccess) {
|
||||||
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
||||||
|
|
||||||
@ -297,10 +298,9 @@ int ExportMP2::Export(AudacityProject *project,
|
|||||||
|
|
||||||
outFile.Write(mp2Buffer, mp2BufferNumBytes);
|
outFile.Write(mp2Buffer, mp2BufferNumBytes);
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
|
@ -1792,7 +1792,8 @@ int ExportMP3::Export(AudacityProject *project,
|
|||||||
brate);
|
brate);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(), title);
|
{
|
||||||
|
ProgressDialog progress(wxFileName(fName).GetName(), title);
|
||||||
|
|
||||||
while (updateResult == eProgressSuccess) {
|
while (updateResult == eProgressSuccess) {
|
||||||
sampleCount blockLen = mixer->Process(inSamples);
|
sampleCount blockLen = mixer->Process(inSamples);
|
||||||
@ -1829,10 +1830,9 @@ int ExportMP3::Export(AudacityProject *project,
|
|||||||
|
|
||||||
outFile.Write(buffer, bytes);
|
outFile.Write(buffer, bytes);
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
|
@ -255,7 +255,8 @@ int ExportOGG::Export(AudacityProject *project,
|
|||||||
rate, floatSample, true, mixerSpec);
|
rate, floatSample, true, mixerSpec);
|
||||||
delete[] waveTracks;
|
delete[] waveTracks;
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
{
|
||||||
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
selectionOnly ?
|
selectionOnly ?
|
||||||
_("Exporting the selected audio as Ogg Vorbis") :
|
_("Exporting the selected audio as Ogg Vorbis") :
|
||||||
_("Exporting the entire project as Ogg Vorbis"));
|
_("Exporting the entire project as Ogg Vorbis"));
|
||||||
@ -316,10 +317,9 @@ int ExportOGG::Export(AudacityProject *project,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
|
@ -493,7 +493,8 @@ int ExportPCM::Export(AudacityProject *project,
|
|||||||
info.channels, maxBlockLen, true,
|
info.channels, maxBlockLen, true,
|
||||||
rate, format, true, mixerSpec);
|
rate, format, true, mixerSpec);
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
{
|
||||||
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
selectionOnly ?
|
selectionOnly ?
|
||||||
wxString::Format(_("Exporting the selected audio as %s"),
|
wxString::Format(_("Exporting the selected audio as %s"),
|
||||||
formatStr.c_str()) :
|
formatStr.c_str()) :
|
||||||
@ -529,10 +530,9 @@ int ExportPCM::Export(AudacityProject *project,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
|
@ -310,15 +310,12 @@ ImportFileHandle *FFmpegImportPlugin::Open(wxString filename)
|
|||||||
if (!FFmpegLibsInst->ValidLibsLoaded())
|
if (!FFmpegLibsInst->ValidLibsLoaded())
|
||||||
{
|
{
|
||||||
int dontShowDlg;
|
int dontShowDlg;
|
||||||
FFmpegNotFoundDialog *dlg;
|
|
||||||
gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0);
|
gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0);
|
||||||
if (dontShowDlg == 0 && newsession)
|
if (dontShowDlg == 0 && newsession)
|
||||||
{
|
{
|
||||||
gPrefs->Write(wxT("/NewImportingSession"), false);
|
gPrefs->Write(wxT("/NewImportingSession"), false);
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
dlg = new FFmpegNotFoundDialog(NULL);
|
FFmpegNotFoundDialog{ nullptr }.ShowModal();
|
||||||
dlg->ShowModal();
|
|
||||||
delete dlg;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -832,7 +832,8 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
|
|
||||||
// If SHIFT key was down, the user wants append to tracks
|
// If SHIFT key was down, the user wants append to tracks
|
||||||
int recordingChannels = 0;
|
int recordingChannels = 0;
|
||||||
TrackList *tracksCopy = NULL;
|
TrackList tracksCopy(true);
|
||||||
|
bool tracksCopied = false;
|
||||||
bool shifted = mRecord->WasShiftDown();
|
bool shifted = mRecord->WasShiftDown();
|
||||||
if (shifted) {
|
if (shifted) {
|
||||||
bool sel = false;
|
bool sel = false;
|
||||||
@ -872,12 +873,12 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
playbackTracks.Remove(wt);
|
playbackTracks.Remove(wt);
|
||||||
t1 = wt->GetEndTime();
|
t1 = wt->GetEndTime();
|
||||||
if (t1 < t0) {
|
if (t1 < t0) {
|
||||||
if (!tracksCopy) {
|
if (!tracksCopied) {
|
||||||
tracksCopy = new TrackList();
|
tracksCopied = true;
|
||||||
TrackListIterator iter(t);
|
TrackListIterator iter(t);
|
||||||
Track *trk = iter.First();
|
Track *trk = iter.First();
|
||||||
while (trk) {
|
while (trk) {
|
||||||
tracksCopy->Add(trk->Duplicate());
|
tracksCopy.Add(trk->Duplicate());
|
||||||
trk = iter.Next();
|
trk = iter.Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1000,17 +1001,13 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
if (success) {
|
if (success) {
|
||||||
p->SetAudioIOToken(token);
|
p->SetAudioIOToken(token);
|
||||||
mBusyProject = p;
|
mBusyProject = p;
|
||||||
if (shifted && tracksCopy) {
|
|
||||||
tracksCopy->Clear(true);
|
|
||||||
delete tracksCopy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (shifted) {
|
if (shifted) {
|
||||||
// Restore the tracks to remove any inserted silence
|
// Restore the tracks to remove any inserted silence
|
||||||
if (tracksCopy) {
|
if (tracksCopied) {
|
||||||
t->Clear(true);
|
t->Clear(true);
|
||||||
TrackListIterator iter(tracksCopy);
|
TrackListIterator iter(&tracksCopy);
|
||||||
Track *trk = iter.First();
|
Track *trk = iter.First();
|
||||||
while (trk)
|
while (trk)
|
||||||
{
|
{
|
||||||
@ -1018,7 +1015,6 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
trk = iter.RemoveCurrent();
|
trk = iter.RemoveCurrent();
|
||||||
t->Add(tmp);
|
t->Add(tmp);
|
||||||
}
|
}
|
||||||
delete tracksCopy;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -156,9 +156,9 @@ void HelpSystem::ShowHtmlText(wxWindow *pParent,
|
|||||||
// If this section (providing an icon) causes compilation errors on linux, comment it out for now.
|
// If this section (providing an icon) causes compilation errors on linux, comment it out for now.
|
||||||
// it will just mean that the icon is missing. Works OK on Windows.
|
// it will just mean that the icon is missing. Works OK on Windows.
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxIcon ic(wxICON(AudacityLogo));
|
wxIcon ic{ wxICON(AudacityLogo) };
|
||||||
#else
|
#else
|
||||||
wxIcon ic;
|
wxIcon ic{};
|
||||||
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
||||||
#endif
|
#endif
|
||||||
pWnd->SetIcon( ic );
|
pWnd->SetIcon( ic );
|
||||||
|
@ -679,18 +679,18 @@ void Meter::OnMouse(wxMouseEvent &evt)
|
|||||||
if (evt.RightDown() ||
|
if (evt.RightDown() ||
|
||||||
(evt.ButtonDown() && mIconRect.Contains(evt.m_x, evt.m_y)))
|
(evt.ButtonDown() && mIconRect.Contains(evt.m_x, evt.m_y)))
|
||||||
{
|
{
|
||||||
wxMenu *menu = new wxMenu();
|
wxMenu menu;
|
||||||
// Note: these should be kept in the same order as the enum
|
// Note: these should be kept in the same order as the enum
|
||||||
if (mIsInput) {
|
if (mIsInput) {
|
||||||
wxMenuItem *mi;
|
wxMenuItem *mi;
|
||||||
if (mMonitoring)
|
if (mMonitoring)
|
||||||
mi = menu->Append(OnMonitorID, _("Stop Monitoring"));
|
mi = menu.Append(OnMonitorID, _("Stop Monitoring"));
|
||||||
else
|
else
|
||||||
mi = menu->Append(OnMonitorID, _("Start Monitoring"));
|
mi = menu.Append(OnMonitorID, _("Start Monitoring"));
|
||||||
mi->Enable(!mActive || mMonitoring);
|
mi->Enable(!mActive || mMonitoring);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->Append(OnPreferencesID, _("Preferences..."));
|
menu.Append(OnPreferencesID, _("Preferences..."));
|
||||||
|
|
||||||
if (evt.RightDown()) {
|
if (evt.RightDown()) {
|
||||||
ShowMenu(evt.GetPosition());
|
ShowMenu(evt.GetPosition());
|
||||||
@ -698,8 +698,6 @@ void Meter::OnMouse(wxMouseEvent &evt)
|
|||||||
else {
|
else {
|
||||||
ShowMenu(wxPoint(mIconRect.x + 1, mIconRect.y + mIconRect.height + 1));
|
ShowMenu(wxPoint(mIconRect.x + 1, mIconRect.y + mIconRect.height + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete menu;
|
|
||||||
}
|
}
|
||||||
else if (evt.LeftDown()) {
|
else if (evt.LeftDown()) {
|
||||||
if (mIsInput) {
|
if (mIsInput) {
|
||||||
@ -1863,22 +1861,22 @@ void Meter::RestoreState(void *state)
|
|||||||
|
|
||||||
void Meter::ShowMenu(const wxPoint & pos)
|
void Meter::ShowMenu(const wxPoint & pos)
|
||||||
{
|
{
|
||||||
wxMenu *menu = new wxMenu();
|
wxMenu menu;
|
||||||
// Note: these should be kept in the same order as the enum
|
// Note: these should be kept in the same order as the enum
|
||||||
if (mIsInput) {
|
if (mIsInput) {
|
||||||
wxMenuItem *mi;
|
wxMenuItem *mi;
|
||||||
if (mMonitoring)
|
if (mMonitoring)
|
||||||
mi = menu->Append(OnMonitorID, _("Stop Monitoring"));
|
mi = menu.Append(OnMonitorID, _("Stop Monitoring"));
|
||||||
else
|
else
|
||||||
mi = menu->Append(OnMonitorID, _("Start Monitoring"));
|
mi = menu.Append(OnMonitorID, _("Start Monitoring"));
|
||||||
mi->Enable(!mActive || mMonitoring);
|
mi->Enable(!mActive || mMonitoring);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->Append(OnPreferencesID, _("Preferences..."));
|
menu.Append(OnPreferencesID, _("Preferences..."));
|
||||||
|
|
||||||
mAccSilent = true; // temporarily make screen readers say (close to) nothing on focus events
|
mAccSilent = true; // temporarily make screen readers say (close to) nothing on focus events
|
||||||
|
|
||||||
PopupMenu(menu, pos);
|
PopupMenu(&menu, pos);
|
||||||
|
|
||||||
/* if stop/start monitoring was chosen in the menu, then by this point
|
/* if stop/start monitoring was chosen in the menu, then by this point
|
||||||
OnMonitoring has been called and variables which affect the accessibility
|
OnMonitoring has been called and variables which affect the accessibility
|
||||||
@ -1891,8 +1889,6 @@ void Meter::ShowMenu(const wxPoint & pos)
|
|||||||
wxOBJID_CLIENT,
|
wxOBJID_CLIENT,
|
||||||
wxACC_SELF);
|
wxACC_SELF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete menu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Meter::OnMonitor(wxCommandEvent & WXUNUSED(event))
|
void Meter::OnMonitor(wxCommandEvent & WXUNUSED(event))
|
||||||
|
@ -2237,42 +2237,43 @@ void AdornedRulerPanel::OnCaptureLost(wxMouseCaptureLostEvent & WXUNUSED(evt))
|
|||||||
|
|
||||||
void AdornedRulerPanel::ShowMenu(const wxPoint & pos)
|
void AdornedRulerPanel::ShowMenu(const wxPoint & pos)
|
||||||
{
|
{
|
||||||
wxMenu *rulerMenu = new wxMenu();
|
{
|
||||||
|
wxMenu rulerMenu;
|
||||||
|
|
||||||
if (mQuickPlayEnabled)
|
if (mQuickPlayEnabled)
|
||||||
rulerMenu->Append(OnToggleQuickPlayID, _("Disable Quick-Play"));
|
rulerMenu.Append(OnToggleQuickPlayID, _("Disable Quick-Play"));
|
||||||
else
|
else
|
||||||
rulerMenu->Append(OnToggleQuickPlayID, _("Enable Quick-Play"));
|
rulerMenu.Append(OnToggleQuickPlayID, _("Enable Quick-Play"));
|
||||||
|
|
||||||
wxMenuItem *dragitem;
|
wxMenuItem *dragitem;
|
||||||
if (mPlayRegionDragsSelection && !mProject->IsPlayRegionLocked())
|
if (mPlayRegionDragsSelection && !mProject->IsPlayRegionLocked())
|
||||||
dragitem = rulerMenu->Append(OnSyncQuickPlaySelID, _("Disable dragging selection"));
|
dragitem = rulerMenu.Append(OnSyncQuickPlaySelID, _("Disable dragging selection"));
|
||||||
else
|
else
|
||||||
dragitem = rulerMenu->Append(OnSyncQuickPlaySelID, _("Enable dragging selection"));
|
dragitem = rulerMenu.Append(OnSyncQuickPlaySelID, _("Enable dragging selection"));
|
||||||
dragitem->Enable(mQuickPlayEnabled && !mProject->IsPlayRegionLocked());
|
dragitem->Enable(mQuickPlayEnabled && !mProject->IsPlayRegionLocked());
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
if (mTimelineToolTip)
|
if (mTimelineToolTip)
|
||||||
rulerMenu->Append(OnTimelineToolTipID, _("Disable Timeline Tooltips"));
|
rulerMenu.Append(OnTimelineToolTipID, _("Disable Timeline Tooltips"));
|
||||||
else
|
else
|
||||||
rulerMenu->Append(OnTimelineToolTipID, _("Enable Timeline Tooltips"));
|
rulerMenu.Append(OnTimelineToolTipID, _("Enable Timeline Tooltips"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mViewInfo->bUpdateTrackIndicator)
|
if (mViewInfo->bUpdateTrackIndicator)
|
||||||
rulerMenu->Append(OnAutoScrollID, _("Do not scroll while playing"));
|
rulerMenu.Append(OnAutoScrollID, _("Do not scroll while playing"));
|
||||||
else
|
else
|
||||||
rulerMenu->Append(OnAutoScrollID, _("Update display while playing"));
|
rulerMenu.Append(OnAutoScrollID, _("Update display while playing"));
|
||||||
|
|
||||||
wxMenuItem *prlitem;
|
wxMenuItem *prlitem;
|
||||||
if (!mProject->IsPlayRegionLocked())
|
if (!mProject->IsPlayRegionLocked())
|
||||||
prlitem = rulerMenu->Append(OnLockPlayRegionID, _("Lock Play Region"));
|
prlitem = rulerMenu.Append(OnLockPlayRegionID, _("Lock Play Region"));
|
||||||
else
|
else
|
||||||
prlitem = rulerMenu->Append(OnLockPlayRegionID, _("Unlock Play Region"));
|
prlitem = rulerMenu.Append(OnLockPlayRegionID, _("Unlock Play Region"));
|
||||||
prlitem->Enable(mProject->IsPlayRegionLocked() || (mPlayRegionStart != mPlayRegionEnd));
|
prlitem->Enable(mProject->IsPlayRegionLocked() || (mPlayRegionStart != mPlayRegionEnd));
|
||||||
|
|
||||||
PopupMenu(rulerMenu, pos);
|
PopupMenu(&rulerMenu, pos);
|
||||||
|
}
|
||||||
|
|
||||||
delete rulerMenu;
|
|
||||||
// dismiss and clear Quick-Play indicator
|
// dismiss and clear Quick-Play indicator
|
||||||
mQuickPlayInd = false;
|
mQuickPlayInd = false;
|
||||||
DrawQuickPlayIndicator(NULL);
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user