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,27 +285,28 @@ 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.
|
{
|
||||||
wxBitmap *const logo = new wxBitmap((const char **) AudacityLogoWithName_xpm); //v
|
//v For now, change to AudacityLogoWithName via old-fashioned way, not Theme.
|
||||||
|
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);
|
||||||
|
|
||||||
icon =
|
icon =
|
||||||
safenew wxStaticBitmap(S.GetParent(), -1,
|
safenew wxStaticBitmap(S.GetParent(), -1,
|
||||||
//*logo, //v
|
//*logo, //v
|
||||||
//v theTheme.Bitmap(bmpAudacityLogo), wxPoint(93, 10), wxSize(215, 190));
|
//v theTheme.Bitmap(bmpAudacityLogo), wxPoint(93, 10), wxSize(215, 190));
|
||||||
//v theTheme.Bitmap(bmpAudacityLogoWithName),
|
//v theTheme.Bitmap(bmpAudacityLogoWithName),
|
||||||
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,
|
||||||
|
@ -1159,7 +1159,7 @@ bool AudacityApp::OnInit()
|
|||||||
|
|
||||||
#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);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AUDACITY_NAME
|
#ifdef AUDACITY_NAME
|
||||||
@ -1203,32 +1203,32 @@ bool AudacityApp::OnInit()
|
|||||||
|
|
||||||
#ifdef AUDACITY_NAME
|
#ifdef AUDACITY_NAME
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/.%s-files"),
|
AddUniquePathToPathList(wxString::Format(wxT("%s/.%s-files"),
|
||||||
home.c_str(), wxT(AUDACITY_NAME)),
|
home.c_str(), wxT(AUDACITY_NAME)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/%s"),
|
AddUniquePathToPathList(wxString::Format(wxT("%s/share/%s"),
|
||||||
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/%s"),
|
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/%s"),
|
||||||
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
#else //AUDACITY_NAME
|
#else //AUDACITY_NAME
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"),
|
AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"),
|
||||||
home.c_str()),
|
home.c_str()),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/audacity"),
|
AddUniquePathToPathList(wxString::Format(wxT("%s/share/audacity"),
|
||||||
wxT(INSTALL_PREFIX)),
|
wxT(INSTALL_PREFIX)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/audacity"),
|
AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/audacity"),
|
||||||
wxT(INSTALL_PREFIX)),
|
wxT(INSTALL_PREFIX)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
#endif //AUDACITY_NAME
|
#endif //AUDACITY_NAME
|
||||||
|
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"),
|
AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"),
|
||||||
wxT(INSTALL_PREFIX)),
|
wxT(INSTALL_PREFIX)),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
|
|
||||||
AddUniquePathToPathList(wxString::Format(wxT("./locale")),
|
AddUniquePathToPathList(wxString::Format(wxT("./locale")),
|
||||||
audacityPathList);
|
audacityPathList);
|
||||||
|
|
||||||
#endif //__WXGTK__
|
#endif //__WXGTK__
|
||||||
|
|
||||||
@ -1242,12 +1242,12 @@ bool AudacityApp::OnInit()
|
|||||||
// On Windows, the path to the Audacity program is in argv[0]
|
// On Windows, the path to the Audacity program is in argv[0]
|
||||||
wxString progPath = wxPathOnly(argv[0]);
|
wxString progPath = wxPathOnly(argv[0]);
|
||||||
AddUniquePathToPathList(progPath, audacityPathList);
|
AddUniquePathToPathList(progPath, audacityPathList);
|
||||||
AddUniquePathToPathList(progPath+wxT("\\Languages"), audacityPathList);
|
AddUniquePathToPathList(progPath + wxT("\\Languages"), audacityPathList);
|
||||||
|
|
||||||
// See bug #1271 for explanation of location
|
// See bug #1271 for explanation of location
|
||||||
tmpDirLoc = FileNames::MkDir(wxStandardPaths::Get().GetUserLocalDataDir());
|
tmpDirLoc = FileNames::MkDir(wxStandardPaths::Get().GetUserLocalDataDir());
|
||||||
defaultTempDir.Printf(wxT("%s\\SessionData"),
|
defaultTempDir.Printf(wxT("%s\\SessionData"),
|
||||||
tmpDirLoc.c_str());
|
tmpDirLoc.c_str());
|
||||||
#endif //__WXWSW__
|
#endif //__WXWSW__
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
@ -1257,15 +1257,15 @@ bool AudacityApp::OnInit()
|
|||||||
AddUniquePathToPathList(progPath, audacityPathList);
|
AddUniquePathToPathList(progPath, audacityPathList);
|
||||||
// If Audacity is a "bundle" package, then the root directory is
|
// If Audacity is a "bundle" package, then the root directory is
|
||||||
// the great-great-grandparent of the directory containing the executable.
|
// the great-great-grandparent of the directory containing the executable.
|
||||||
AddUniquePathToPathList(progPath+wxT("/../../../"), audacityPathList);
|
AddUniquePathToPathList(progPath + wxT("/../../../"), audacityPathList);
|
||||||
|
|
||||||
// These allow for searching the "bundle"
|
// These allow for searching the "bundle"
|
||||||
AddUniquePathToPathList(progPath+wxT("/../"), audacityPathList);
|
AddUniquePathToPathList(progPath + wxT("/../"), audacityPathList);
|
||||||
AddUniquePathToPathList(progPath+wxT("/../Resources"), audacityPathList);
|
AddUniquePathToPathList(progPath + wxT("/../Resources"), audacityPathList);
|
||||||
|
|
||||||
defaultTempDir.Printf(wxT("%s/audacity-%s"),
|
defaultTempDir.Printf(wxT("%s/audacity-%s"),
|
||||||
tmpDirLoc.c_str(),
|
tmpDirLoc.c_str(),
|
||||||
wxGetUserId().c_str());
|
wxGetUserId().c_str());
|
||||||
#endif //__WXMAC__
|
#endif //__WXMAC__
|
||||||
|
|
||||||
// Define languanges for which we have translations, but that are not yet
|
// Define languanges for which we have translations, but that are not yet
|
||||||
@ -1283,9 +1283,9 @@ bool AudacityApp::OnInit()
|
|||||||
// Initialize preferences and language
|
// Initialize preferences and language
|
||||||
InitPreferences();
|
InitPreferences();
|
||||||
|
|
||||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
|
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
|
||||||
this->AssociateFileTypes();
|
this->AssociateFileTypes();
|
||||||
#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 = new FileHistory(ID_RECENT_LAST - ID_RECENT_FIRST + 1, ID_RECENT_CLEAR);
|
||||||
@ -1303,10 +1303,10 @@ bool AudacityApp::OnInit()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//<<<< Try to avoid dialogs before this point.
|
//<<<< Try to avoid dialogs before this point.
|
||||||
// The reason is that InitTempDir starts the single instance checker.
|
// The reason is that InitTempDir starts the single instance checker.
|
||||||
// If we're waiitng in a dialog before then we can very easily
|
// If we're waiitng in a dialog before then we can very easily
|
||||||
// start multiple instances, defeating the single instance checker.
|
// start multiple instances, defeating the single instance checker.
|
||||||
|
|
||||||
// Initialize the CommandHandler
|
// Initialize the CommandHandler
|
||||||
InitCommandHandler();
|
InitCommandHandler();
|
||||||
@ -1367,68 +1367,70 @@ bool AudacityApp::OnInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BG: Create a temporary window to set as the top window
|
// BG: Create a temporary window to set as the top window
|
||||||
wxImage logoimage((const char **) AudacityLogoWithName_xpm);
|
wxImage logoimage((const char **)AudacityLogoWithName_xpm);
|
||||||
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,
|
{
|
||||||
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,
|
wxSplashScreen temporarywindow(
|
||||||
0,
|
logo,
|
||||||
NULL,
|
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,
|
||||||
wxID_ANY,
|
0,
|
||||||
wxDefaultPosition,
|
NULL,
|
||||||
wxDefaultSize,
|
wxID_ANY,
|
||||||
wxSTAY_ON_TOP);
|
wxDefaultPosition,
|
||||||
temporarywindow->SetTitle(_("Audacity is starting up..."));
|
wxDefaultSize,
|
||||||
SetTopWindow(temporarywindow);
|
wxSTAY_ON_TOP);
|
||||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
temporarywindow.SetTitle(_("Audacity is starting up..."));
|
||||||
|
SetTopWindow(&temporarywindow);
|
||||||
|
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||||
|
|
||||||
//JKC: Would like to put module loading here.
|
//JKC: Would like to put module loading here.
|
||||||
|
|
||||||
// More initialization
|
// More initialization
|
||||||
|
|
||||||
InitDitherers();
|
InitDitherers();
|
||||||
InitAudioIO();
|
InitAudioIO();
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
|
|
||||||
// On the Mac, users don't expect a program to quit when you close the last window.
|
// On the Mac, users don't expect a program to quit when you close the last window.
|
||||||
// Create a menubar that will show when all project windows are closed.
|
// Create a menubar that will show when all project windows are closed.
|
||||||
|
|
||||||
wxMenu *fileMenu = new wxMenu();
|
wxMenu *fileMenu = new wxMenu();
|
||||||
wxMenu *recentMenu = new wxMenu();
|
wxMenu *recentMenu = new wxMenu();
|
||||||
fileMenu->Append(wxID_NEW, wxString(_("&New")) + wxT("\tCtrl+N"));
|
fileMenu->Append(wxID_NEW, wxString(_("&New")) + wxT("\tCtrl+N"));
|
||||||
fileMenu->Append(wxID_OPEN, wxString(_("&Open...")) + wxT("\tCtrl+O"));
|
fileMenu->Append(wxID_OPEN, wxString(_("&Open...")) + wxT("\tCtrl+O"));
|
||||||
fileMenu->AppendSubMenu(recentMenu, _("Open &Recent..."));
|
fileMenu->AppendSubMenu(recentMenu, _("Open &Recent..."));
|
||||||
fileMenu->Append(wxID_ABOUT, _("&About Audacity..."));
|
fileMenu->Append(wxID_ABOUT, _("&About Audacity..."));
|
||||||
fileMenu->Append(wxID_PREFERENCES, wxString(_("&Preferences...")) + wxT("\tCtrl+,"));
|
fileMenu->Append(wxID_PREFERENCES, wxString(_("&Preferences...")) + wxT("\tCtrl+,"));
|
||||||
|
|
||||||
wxMenuBar *menuBar = new wxMenuBar();
|
wxMenuBar *menuBar = new wxMenuBar();
|
||||||
menuBar->Append(fileMenu, _("&File"));
|
menuBar->Append(fileMenu, _("&File"));
|
||||||
|
|
||||||
wxMenuBar::MacSetCommonMenuBar(menuBar);
|
wxMenuBar::MacSetCommonMenuBar(menuBar);
|
||||||
|
|
||||||
mRecentFiles->UseMenu(recentMenu);
|
mRecentFiles->UseMenu(recentMenu);
|
||||||
mRecentFiles->AddFilesToMenu(recentMenu);
|
mRecentFiles->AddFilesToMenu(recentMenu);
|
||||||
|
|
||||||
SetExitOnFrameDelete(false);
|
SetExitOnFrameDelete(false);
|
||||||
|
|
||||||
#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)
|
||||||
{
|
{
|
||||||
project->Show( false );
|
project->Show(false);
|
||||||
pWnd->SetParent( project );
|
pWnd->SetParent(project);
|
||||||
SetTopWindow(pWnd);
|
SetTopWindow(pWnd);
|
||||||
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__)
|
wxIcon ic{wxICON(AudacityLogo)};
|
||||||
ic = new wxIcon(wxICON(AudacityLogo));
|
#elif defined(__WXGTK__)
|
||||||
#elif defined(__WXGTK__)
|
wxIcon ic{wxICON(AudacityLogoAlpha)};
|
||||||
ic = new wxIcon(wxICON(AudacityLogoAlpha));
|
#else
|
||||||
#else
|
wxIcon ic{};
|
||||||
ic = new wxIcon();
|
|
||||||
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48));
|
||||||
#endif
|
|
||||||
frame->SetIcon(*ic);
|
|
||||||
delete ic;
|
|
||||||
#endif
|
#endif
|
||||||
|
frame->SetIcon(ic);
|
||||||
|
#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,9 +165,9 @@ 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;
|
||||||
|
|
||||||
// Hash aliasedFiles based on their full paths and
|
// Hash aliasedFiles based on their full paths and
|
||||||
@ -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,64 +445,62 @@ 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.*/
|
|
||||||
ProgressDialog *progress = new ProgressDialog(_("Progress"),
|
|
||||||
_("Saving project data files"));
|
|
||||||
|
|
||||||
int total = mBlockFileHash.size();
|
|
||||||
int count=0;
|
|
||||||
|
|
||||||
BlockHash::iterator iter = mBlockFileHash.begin();
|
|
||||||
bool success = true;
|
|
||||||
while ((iter != mBlockFileHash.end()) && success)
|
|
||||||
{
|
{
|
||||||
BlockFile *b = iter->second;
|
/*i18n-hint: This title appears on a dialog that indicates the progress in doing something.*/
|
||||||
|
ProgressDialog progress(_("Progress"),
|
||||||
|
_("Saving project data files"));
|
||||||
|
|
||||||
if (b->IsLocked())
|
int total = mBlockFileHash.size();
|
||||||
success = CopyToNewProjectDirectory(b);
|
|
||||||
else{
|
|
||||||
success = MoveToNewProjectDirectory(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
progress->Update(count, total);
|
|
||||||
|
|
||||||
++iter;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
// If the move failed, we try to move/copy as many files
|
|
||||||
// back as possible so that no damage was done. (No sense
|
|
||||||
// in checking for errors this time around - there's nothing
|
|
||||||
// that could be done about it.)
|
|
||||||
// Likely causes: directory was not writeable, disk was full
|
|
||||||
|
|
||||||
projFull = oldLoc;
|
|
||||||
|
|
||||||
BlockHash::iterator iter = mBlockFileHash.begin();
|
BlockHash::iterator iter = mBlockFileHash.begin();
|
||||||
while (iter != mBlockFileHash.end())
|
bool success = true;
|
||||||
|
int count = 0;
|
||||||
|
while ((iter != mBlockFileHash.end()) && success)
|
||||||
{
|
{
|
||||||
BlockFile *b = iter->second;
|
BlockFile *b = iter->second;
|
||||||
MoveToNewProjectDirectory(b);
|
|
||||||
|
|
||||||
if (count>=0)
|
if (b->IsLocked())
|
||||||
progress->Update(count, total);
|
success = CopyToNewProjectDirectory(b);
|
||||||
|
else{
|
||||||
|
success = MoveToNewProjectDirectory(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
progress.Update(count, total);
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
count--;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->projFull = oldFull;
|
if (!success) {
|
||||||
this->projPath = oldPath;
|
// If the move failed, we try to move/copy as many files
|
||||||
this->projName = oldName;
|
// back as possible so that no damage was done. (No sense
|
||||||
|
// in checking for errors this time around - there's nothing
|
||||||
|
// that could be done about it.)
|
||||||
|
// Likely causes: directory was not writeable, disk was full
|
||||||
|
|
||||||
delete progress;
|
projFull = oldLoc;
|
||||||
|
|
||||||
return false;
|
BlockHash::iterator iter = mBlockFileHash.begin();
|
||||||
|
while (iter != mBlockFileHash.end())
|
||||||
|
{
|
||||||
|
BlockFile *b = iter->second;
|
||||||
|
MoveToNewProjectDirectory(b);
|
||||||
|
|
||||||
|
if (count >= 0)
|
||||||
|
progress.Update(count, total);
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->projFull = oldFull;
|
||||||
|
this->projPath = oldPath;
|
||||||
|
this->projName = oldName;
|
||||||
|
|
||||||
|
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
|
||||||
// loading a project; in this latter case, the movement code does
|
// loading a project; in this latter case, the movement code does
|
||||||
@ -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);
|
{
|
||||||
wxYieldIfNeeded();
|
wxWindowDisabler blocker(this);
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
@ -1033,16 +1033,14 @@ void FreqWindow::OnExport(wxCommandEvent & WXUNUSED(event))
|
|||||||
wxString fName = _("spectrum.txt");
|
wxString fName = _("spectrum.txt");
|
||||||
|
|
||||||
fName = FileSelector(_("Export Spectral Data As:"),
|
fName = FileSelector(_("Export Spectral Data As:"),
|
||||||
wxEmptyString, fName, wxT("txt"), wxT("*.txt"), wxFD_SAVE | wxRESIZE_BORDER, this);
|
wxEmptyString, fName, wxT("txt"), wxT("*.txt"), wxFD_SAVE | wxRESIZE_BORDER, this);
|
||||||
|
|
||||||
if (fName == wxT(""))
|
if (fName == wxT(""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
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
|
||||||
|
@ -589,12 +589,12 @@ void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
|
|||||||
wxString fName = mTrackNames[mTrackNames.GetCount() - 1].AfterFirst(wxT('-')).Mid(1);
|
wxString fName = mTrackNames[mTrackNames.GetCount() - 1].AfterFirst(wxT('-')).Mid(1);
|
||||||
|
|
||||||
fName = FileSelector(_("Export Labels As:"),
|
fName = FileSelector(_("Export Labels As:"),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
fName.c_str(),
|
fName.c_str(),
|
||||||
wxT("txt"),
|
wxT("txt"),
|
||||||
wxT("*.txt"),
|
wxT("*.txt"),
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
if (fName == wxT(""))
|
if (fName == wxT(""))
|
||||||
return;
|
return;
|
||||||
@ -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,42 +2013,42 @@ void LabelTrack::ShowContextMenu()
|
|||||||
{
|
{
|
||||||
wxWindow *parent = wxWindow::FindFocus();
|
wxWindow *parent = wxWindow::FindFocus();
|
||||||
|
|
||||||
wxMenu *menu = new wxMenu();
|
|
||||||
menu->Bind(wxEVT_MENU, &LabelTrack::OnContextMenu, this);
|
|
||||||
|
|
||||||
menu->Append(OnCutSelectedTextID, _("Cu&t"));
|
|
||||||
menu->Append(OnCopySelectedTextID, _("&Copy"));
|
|
||||||
menu->Append(OnPasteSelectedTextID, _("&Paste"));
|
|
||||||
menu->Append(OnDeleteSelectedLabelID, _("&Delete Label"));
|
|
||||||
|
|
||||||
menu->Enable(OnCutSelectedTextID, IsTextSelected());
|
|
||||||
menu->Enable(OnCopySelectedTextID, IsTextSelected());
|
|
||||||
menu->Enable(OnPasteSelectedTextID, IsTextClipSupported());
|
|
||||||
menu->Enable(OnDeleteSelectedLabelID, true);
|
|
||||||
|
|
||||||
const LabelStruct *ls = GetLabel(mSelIndex);
|
|
||||||
|
|
||||||
wxClientDC dc(parent);
|
|
||||||
|
|
||||||
if (msFont.Ok())
|
|
||||||
{
|
{
|
||||||
dc.SetFont(msFont);
|
wxMenu menu;
|
||||||
}
|
menu.Bind(wxEVT_MENU, &LabelTrack::OnContextMenu, this);
|
||||||
|
|
||||||
int x;
|
menu.Append(OnCutSelectedTextID, _("Cu&t"));
|
||||||
if (mMouseXPos != -1)
|
menu.Append(OnCopySelectedTextID, _("&Copy"));
|
||||||
{
|
menu.Append(OnPasteSelectedTextID, _("&Paste"));
|
||||||
x = mMouseXPos;
|
menu.Append(OnDeleteSelectedLabelID, _("&Delete Label"));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dc.GetTextExtent(ls->title.Left(mCurrentCursorPos), &x, NULL);
|
|
||||||
x += ls->xText;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent->PopupMenu(menu, x, ls->y + (mIconHeight / 2) - 1);
|
menu.Enable(OnCutSelectedTextID, IsTextSelected());
|
||||||
|
menu.Enable(OnCopySelectedTextID, IsTextSelected());
|
||||||
|
menu.Enable(OnPasteSelectedTextID, IsTextClipSupported());
|
||||||
|
menu.Enable(OnDeleteSelectedLabelID, true);
|
||||||
|
|
||||||
delete menu;
|
const LabelStruct *ls = GetLabel(mSelIndex);
|
||||||
|
|
||||||
|
wxClientDC dc(parent);
|
||||||
|
|
||||||
|
if (msFont.Ok())
|
||||||
|
{
|
||||||
|
dc.SetFont(msFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
int x;
|
||||||
|
if (mMouseXPos != -1)
|
||||||
|
{
|
||||||
|
x = mMouseXPos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dc.GetTextExtent(ls->title.Left(mCurrentCursorPos), &x, NULL);
|
||||||
|
x += ls->xText;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent->PopupMenu(&menu, x, ls->y + (mIconHeight / 2) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
// it's an invalid dragging event
|
// it's an invalid dragging event
|
||||||
SetWrongDragging(true);
|
SetWrongDragging(true);
|
||||||
|
@ -66,15 +66,15 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
|
|||||||
mProject = parent;
|
mProject = 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,38 +6148,38 @@ void AudacityProject::OnScoreAlign()
|
|||||||
mTracks->GetWaveTracks(true /* selectionOnly */,
|
mTracks->GetWaveTracks(true /* selectionOnly */,
|
||||||
&numWaveTracksSelected, &waveTracks);
|
&numWaveTracksSelected, &waveTracks);
|
||||||
|
|
||||||
Mixer *mix = new Mixer(numWaveTracksSelected, // int numInputTracks
|
int result;
|
||||||
waveTracks, // WaveTrack **inputTracks
|
{
|
||||||
mTracks->GetTimeTrack(), // TimeTrack *timeTrack
|
Mixer mix(numWaveTracksSelected, // int numInputTracks
|
||||||
0.0, // double startTime
|
waveTracks, // WaveTrack **inputTracks
|
||||||
endTime, // double stopTime
|
mTracks->GetTimeTrack(), // TimeTrack *timeTrack
|
||||||
2, // int numOutChannels
|
0.0, // double startTime
|
||||||
44100, // int outBufferSize
|
endTime, // double stopTime
|
||||||
true, // bool outInterleaved
|
2, // int numOutChannels
|
||||||
mRate, // double outRate
|
44100, // int outBufferSize
|
||||||
floatSample, // sampleFormat outFormat
|
true, // bool outInterleaved
|
||||||
true, // bool highQuality = true
|
mRate, // double outRate
|
||||||
NULL); // MixerSpec *mixerSpec = NULL
|
floatSample, // sampleFormat outFormat
|
||||||
delete [] waveTracks;
|
true, // bool highQuality = true
|
||||||
|
NULL); // MixerSpec *mixerSpec = NULL
|
||||||
|
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
|
||||||
// measures. For debugging, you can see just the pre-scorealign note track
|
// measures. For debugging, you can see just the pre-scorealign note track
|
||||||
// manipulation by setting SKIP_ACTUAL_SCORE_ALIGNMENT. You could then, for
|
// manipulation by setting SKIP_ACTUAL_SCORE_ALIGNMENT. You could then, for
|
||||||
// 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);
|
||||||
|
50
src/Mix.cpp
50
src/Mix.cpp
@ -161,39 +161,40 @@ 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;
|
||||||
while(updateResult == eProgressSuccess) {
|
{
|
||||||
sampleCount blockLen = mixer->Process(maxBlockLen);
|
ProgressDialog progress(_("Mix and Render"),
|
||||||
|
_("Mixing and rendering tracks"));
|
||||||
|
|
||||||
if (blockLen == 0)
|
while (updateResult == eProgressSuccess) {
|
||||||
break;
|
sampleCount blockLen = mixer.Process(maxBlockLen);
|
||||||
|
|
||||||
if (mono) {
|
if (blockLen == 0)
|
||||||
samplePtr buffer = mixer->GetBuffer();
|
break;
|
||||||
mixLeft->Append(buffer, format, blockLen);
|
|
||||||
|
if (mono) {
|
||||||
|
samplePtr buffer = mixer.GetBuffer();
|
||||||
|
mixLeft->Append(buffer, format, blockLen);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
samplePtr buffer;
|
||||||
|
buffer = mixer.GetBuffer(0);
|
||||||
|
mixLeft->Append(buffer, format, blockLen);
|
||||||
|
buffer = mixer.GetBuffer(1);
|
||||||
|
mixRight->Append(buffer, format, blockLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateResult = progress.Update(mixer.MixGetCurrentTime() - startTime, endTime - startTime);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
samplePtr buffer;
|
|
||||||
buffer = mixer->GetBuffer(0);
|
|
||||||
mixLeft->Append(buffer, format, blockLen);
|
|
||||||
buffer = mixer->GetBuffer(1);
|
|
||||||
mixRight->Append(buffer, format, blockLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime() - startTime, endTime - startTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
mixLeft->Flush();
|
mixLeft->Flush();
|
||||||
if (!mono)
|
if (!mono)
|
||||||
mixRight->Flush();
|
mixRight->Flush();
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -1765,15 +1765,15 @@ MixerBoardFrame::MixerBoardFrame(AudacityProject* parent)
|
|||||||
mMixerBoard->UpdateTrackClusters();
|
mMixerBoard->UpdateTrackClusters();
|
||||||
|
|
||||||
// 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,58 +969,58 @@ 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();
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for (ItemDataMap::iterator iter = mItems.begin(); iter != mItems.end(); ++iter)
|
|
||||||
{
|
{
|
||||||
ItemData & item = iter->second;
|
ProgressDialog progress(GetTitle(), msg, pdlgHideStopButton);
|
||||||
wxString path = item.path;
|
progress.CenterOnParent();
|
||||||
|
|
||||||
if (item.state == STATE_Enabled && item.plugs[0]->GetPluginType() == PluginTypeStub)
|
int i = 0;
|
||||||
|
for (ItemDataMap::iterator iter = mItems.begin(); iter != mItems.end(); ++iter)
|
||||||
{
|
{
|
||||||
last3 = last3.AfterFirst(wxT('\n')) + item.path + wxT("\n");
|
ItemData & item = iter->second;
|
||||||
int status = progress->Update(++i, enableCount, wxString::Format(_("Enabling effect:\n\n%s"), last3.c_str()));
|
wxString path = item.path;
|
||||||
if (!status)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to register the plugin via each provider until one succeeds
|
if (item.state == STATE_Enabled && item.plugs[0]->GetPluginType() == PluginTypeStub)
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
|
||||||
{
|
{
|
||||||
if (mm.RegisterPlugin(item.plugs[j]->GetProviderID(), path))
|
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()));
|
||||||
|
if (!status)
|
||||||
{
|
{
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
|
||||||
{
|
|
||||||
pm.mPlugins.erase(item.plugs[j]->GetProviderID() + wxT("_") + path);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to register the plugin via each provider until one succeeds
|
||||||
|
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
||||||
|
{
|
||||||
|
if (mm.RegisterPlugin(item.plugs[j]->GetProviderID(), path))
|
||||||
|
{
|
||||||
|
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
||||||
|
{
|
||||||
|
pm.mPlugins.erase(item.plugs[j]->GetProviderID() + wxT("_") + path);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (item.state == STATE_New)
|
||||||
|
{
|
||||||
|
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
||||||
|
{
|
||||||
|
item.plugs[j]->SetValid(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (item.state != STATE_New)
|
||||||
|
{
|
||||||
|
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
||||||
|
{
|
||||||
|
item.plugs[j]->SetEnabled(item.state == STATE_Enabled);
|
||||||
|
item.plugs[j]->SetValid(item.valid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (item.state == STATE_New)
|
|
||||||
{
|
pm.Save();
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
|
||||||
{
|
|
||||||
item.plugs[j]->SetValid(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (item.state != STATE_New)
|
|
||||||
{
|
|
||||||
for (size_t j = 0, cnt = item.plugs.GetCount(); j < cnt; j++)
|
|
||||||
{
|
|
||||||
item.plugs[j]->SetEnabled(item.state == STATE_Enabled);
|
|
||||||
item.plugs[j]->SetValid(item.valid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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"));
|
|
||||||
if (!ff->IsOpened()) {
|
|
||||||
wxMessageBox(_("Could not open file: ") + fileName,
|
|
||||||
_("Error opening file"),
|
|
||||||
wxOK | wxCENTRE, this);
|
|
||||||
}
|
|
||||||
char buf[16];
|
char buf[16];
|
||||||
int numRead = ff->Read(buf, 15);
|
{
|
||||||
if (numRead != 15) {
|
wxFFile ff(fileName, wxT("rb"));
|
||||||
wxMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"),
|
if (!ff.IsOpened()) {
|
||||||
(const wxChar*)fileName), _("Error Opening File or Project"),
|
wxMessageBox(_("Could not open file: ") + fileName,
|
||||||
wxOK | wxCENTRE, this);
|
_("Error opening file"),
|
||||||
ff->Close();
|
wxOK | wxCENTRE, this);
|
||||||
delete ff;
|
}
|
||||||
return;
|
int numRead = ff.Read(buf, 15);
|
||||||
|
if (numRead != 15) {
|
||||||
|
wxMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"),
|
||||||
|
(const wxChar*)fileName), _("Error Opening File or Project"),
|
||||||
|
wxOK | wxCENTRE, this);
|
||||||
|
ff.Close();
|
||||||
|
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,53 +1430,52 @@ 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 = new wxPaintDC(this);
|
|
||||||
|
|
||||||
// Retrieve the damage rectangle
|
|
||||||
wxRect box = GetUpdateRegion().GetBox();
|
|
||||||
|
|
||||||
// Recreate the backing bitmap if we have a full refresh
|
|
||||||
// (See TrackPanel::Refresh())
|
|
||||||
if (mRefreshBacking || (box == GetRect()))
|
|
||||||
{
|
{
|
||||||
// Reset (should a mutex be used???)
|
wxPaintDC dc(this);
|
||||||
mRefreshBacking = false;
|
|
||||||
|
|
||||||
if (mResizeBacking)
|
// Retrieve the damage rectangle
|
||||||
|
wxRect box = GetUpdateRegion().GetBox();
|
||||||
|
|
||||||
|
// Recreate the backing bitmap if we have a full refresh
|
||||||
|
// (See TrackPanel::Refresh())
|
||||||
|
if (mRefreshBacking || (box == GetRect()))
|
||||||
{
|
{
|
||||||
// Reset
|
// Reset (should a mutex be used???)
|
||||||
mResizeBacking = false;
|
mRefreshBacking = false;
|
||||||
|
|
||||||
// Delete the backing bitmap
|
if (mResizeBacking)
|
||||||
if (mBacking)
|
|
||||||
{
|
{
|
||||||
mBackingDC.SelectObject(wxNullBitmap);
|
// Reset
|
||||||
delete mBacking;
|
mResizeBacking = false;
|
||||||
mBacking = NULL;
|
|
||||||
|
// Delete the backing bitmap
|
||||||
|
if (mBacking)
|
||||||
|
{
|
||||||
|
mBackingDC.SelectObject(wxNullBitmap);
|
||||||
|
delete mBacking;
|
||||||
|
mBacking = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize sz = GetClientSize();
|
||||||
|
mBacking = new wxBitmap();
|
||||||
|
mBacking->Create(sz.x, sz.y); //, *dc);
|
||||||
|
mBackingDC.SelectObject(*mBacking);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize sz = GetClientSize();
|
// Redraw the backing bitmap
|
||||||
mBacking = new wxBitmap();
|
DrawTracks(&mBackingDC);
|
||||||
mBacking->Create(sz.x, sz.y); //, *dc);
|
|
||||||
mBackingDC.SelectObject(*mBacking);
|
// Copy it to the display
|
||||||
|
dc.Blit(0, 0, mBacking->GetWidth(), mBacking->GetHeight(), &mBackingDC, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Copy full, possibly clipped, damage rectangle
|
||||||
|
dc.Blit(box.x, box.y, box.width, box.height, &mBackingDC, box.x, box.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redraw the backing bitmap
|
// Done with the clipped DC
|
||||||
DrawTracks(&mBackingDC);
|
|
||||||
|
|
||||||
// Copy it to the display
|
|
||||||
dc->Blit(0, 0, mBacking->GetWidth(), mBacking->GetHeight(), &mBackingDC, 0, 0);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Copy full, possibly clipped, damage rectangle
|
|
||||||
dc->Blit(box.x, box.y, box.width, box.height, &mBackingDC, box.x, box.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,13 +827,12 @@ void VoiceKey::CalibrateNoise(WaveTrack & t, sampleCount start, sampleCount len)
|
|||||||
/* i18n-hint: %1.4f is replaced by a number. sd stands for 'Standard Deviations'*/
|
/* i18n-hint: %1.4f is replaced by a number. sd stands for 'Standard Deviations'*/
|
||||||
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,16 +2576,16 @@ 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();
|
||||||
|
|
||||||
while (gAudioIO->IsBusy()) {
|
while (gAudioIO->IsBusy()) {
|
||||||
@ -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)
|
||||||
|
@ -332,8 +332,8 @@ bool EffectEqualization48x::TrackCompare()
|
|||||||
wxArrayPtrVoid SecondOMap;
|
wxArrayPtrVoid SecondOMap;
|
||||||
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,47 +653,42 @@ 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();
|
||||||
|
wxString out;
|
||||||
|
|
||||||
|
if (effectIDs.GetCount() > 0)
|
||||||
{
|
{
|
||||||
wxArrayInt effectIDs = effect->GetEffectIDs();
|
wxString subids;
|
||||||
wxString out;
|
|
||||||
|
|
||||||
if (effectIDs.GetCount() > 0)
|
for (size_t i = 0, cnt = effectIDs.GetCount(); i < cnt; i++)
|
||||||
{
|
{
|
||||||
wxString subids;
|
subids += wxString::Format(wxT("%d;"), effectIDs[i]);
|
||||||
|
|
||||||
for (size_t i = 0, cnt = effectIDs.GetCount(); i < cnt; i++)
|
|
||||||
{
|
|
||||||
subids += wxString::Format(wxT("%d;"), effectIDs[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
out = wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeySubIDs, subids.RemoveLast().c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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, 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, 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=%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, kKeyAutomatable, effect->SupportsAutomation());
|
|
||||||
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyEnd, wxEmptyString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to output info in one chunk to prevent output
|
out = wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeySubIDs, subids.RemoveLast().c_str());
|
||||||
// from the effect intermixing with the info
|
}
|
||||||
const wxCharBuffer buf = out.ToUTF8();
|
else
|
||||||
fwrite(buf, 1, strlen(buf), stdout);
|
{
|
||||||
fflush(stdout);
|
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, 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, 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=%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, kKeyAutomatable, effect.SupportsAutomation());
|
||||||
|
out += wxString::Format(wxT("%s%d=%s\n"), OUTPUTKEY, kKeyEnd, wxEmptyString);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete effect;
|
// We want to output info in one chunk to prevent output
|
||||||
|
// from the effect intermixing with the info
|
||||||
|
const wxCharBuffer buf = out.ToUTF8();
|
||||||
|
fwrite(buf, 1, strlen(buf), stdout);
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,59 +440,59 @@ int ExportCL::Export(AudacityProject *project,
|
|||||||
samplePtr mixed = NULL;
|
samplePtr mixed = NULL;
|
||||||
int updateResult = eProgressSuccess;
|
int updateResult = eProgressSuccess;
|
||||||
|
|
||||||
// Prepare the progress display
|
{
|
||||||
ProgressDialog *progress = new ProgressDialog(_("Export"),
|
// Prepare the progress display
|
||||||
selectionOnly ?
|
ProgressDialog progress(_("Export"),
|
||||||
_("Exporting the selected audio using command-line encoder") :
|
selectionOnly ?
|
||||||
_("Exporting the entire project using command-line encoder"));
|
_("Exporting the selected audio using command-line encoder") :
|
||||||
|
_("Exporting the entire project using command-line encoder"));
|
||||||
|
|
||||||
// Start piping the mixed data to the command
|
// Start piping the mixed data to the command
|
||||||
while (updateResult == eProgressSuccess && process.IsActive() && os->IsOk()) {
|
while (updateResult == eProgressSuccess && process.IsActive() && os->IsOk()) {
|
||||||
// Capture any stdout and stderr from the command
|
// Capture any stdout and stderr from the command
|
||||||
Drain(process.GetInputStream(), &output);
|
Drain(process.GetInputStream(), &output);
|
||||||
Drain(process.GetErrorStream(), &output);
|
Drain(process.GetErrorStream(), &output);
|
||||||
|
|
||||||
// Need to mix another block
|
// Need to mix another block
|
||||||
if (numBytes == 0) {
|
if (numBytes == 0) {
|
||||||
sampleCount numSamples = mixer->Process(maxBlockLen);
|
sampleCount numSamples = mixer->Process(maxBlockLen);
|
||||||
if (numSamples == 0) {
|
if (numSamples == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mixed = mixer->GetBuffer();
|
mixed = mixer->GetBuffer();
|
||||||
numBytes = numSamples * channels;
|
numBytes = numSamples * channels;
|
||||||
|
|
||||||
// Byte-swapping is neccesary on big-endian machines, since
|
// Byte-swapping is neccesary on big-endian machines, since
|
||||||
// WAV files are little-endian
|
// WAV files are little-endian
|
||||||
#if wxBYTE_ORDER == wxBIG_ENDIAN
|
#if wxBYTE_ORDER == wxBIG_ENDIAN
|
||||||
wxUint16 *buffer = (wxUint16 *) mixed;
|
wxUint16 *buffer = (wxUint16 *) mixed;
|
||||||
for (int i = 0; i < numBytes; i++) {
|
for (int i = 0; i < numBytes; i++) {
|
||||||
buffer[i] = wxUINT16_SWAP_ON_BE(buffer[i]);
|
buffer[i] = wxUINT16_SWAP_ON_BE(buffer[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
numBytes *= SAMPLE_SIZE(int16Sample);
|
numBytes *= SAMPLE_SIZE(int16Sample);
|
||||||
}
|
|
||||||
|
|
||||||
// Don't write too much at once...pipes may not be able to handle it
|
|
||||||
size_t bytes = wxMin(numBytes, 4096);
|
|
||||||
numBytes -= bytes;
|
|
||||||
|
|
||||||
while (bytes > 0) {
|
|
||||||
os->Write(mixed, bytes);
|
|
||||||
if (!os->IsOk()) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
bytes -= os->LastWrite();
|
|
||||||
mixed += os->LastWrite();
|
// Don't write too much at once...pipes may not be able to handle it
|
||||||
|
size_t bytes = wxMin(numBytes, 4096);
|
||||||
|
numBytes -= bytes;
|
||||||
|
|
||||||
|
while (bytes > 0) {
|
||||||
|
os->Write(mixed, bytes);
|
||||||
|
if (!os->IsOk()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bytes -= os->LastWrite();
|
||||||
|
mixed += os->LastWrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the progress display
|
||||||
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
}
|
}
|
||||||
|
// Done with the progress display
|
||||||
// Update the progress display
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done with the progress display
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
// Should make the process die
|
// Should make the process die
|
||||||
process.CloseOutput();
|
process.CloseOutput();
|
||||||
|
|
||||||
|
@ -831,30 +831,29 @@ int ExportFFmpeg::Export(AudacityProject *project,
|
|||||||
t0, t1,
|
t0, t1,
|
||||||
channels, pcmBufferSize, true,
|
channels, pcmBufferSize, true,
|
||||||
mSampleRate, int16Sample, true, mixerSpec);
|
mSampleRate, int16Sample, true, mixerSpec);
|
||||||
delete [] waveTracks;
|
delete[] waveTracks;
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
|
||||||
selectionOnly ?
|
|
||||||
wxString::Format(_("Exporting selected audio as %s"), ExportFFmpegOptions::fmts[mSubFormat].description) :
|
|
||||||
wxString::Format(_("Exporting entire file as %s"), ExportFFmpegOptions::fmts[mSubFormat].description));
|
|
||||||
|
|
||||||
int updateResult = eProgressSuccess;
|
int updateResult = eProgressSuccess;
|
||||||
|
{
|
||||||
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
|
selectionOnly ?
|
||||||
|
wxString::Format(_("Exporting selected audio as %s"), ExportFFmpegOptions::fmts[mSubFormat].description) :
|
||||||
|
wxString::Format(_("Exporting entire file as %s"), ExportFFmpegOptions::fmts[mSubFormat].description));
|
||||||
|
|
||||||
while(updateResult == eProgressSuccess) {
|
while (updateResult == eProgressSuccess) {
|
||||||
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
||||||
|
|
||||||
if (pcmNumSamples == 0)
|
if (pcmNumSamples == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
short *pcmBuffer = (short *)mixer->GetBuffer();
|
short *pcmBuffer = (short *)mixer->GetBuffer();
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
Finalize();
|
Finalize();
|
||||||
|
@ -325,38 +325,38 @@ 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"));
|
||||||
|
|
||||||
while (updateResult == eProgressSuccess) {
|
while (updateResult == eProgressSuccess) {
|
||||||
sampleCount samplesThisRun = mixer->Process(SAMPLES_PER_RUN);
|
sampleCount samplesThisRun = mixer->Process(SAMPLES_PER_RUN);
|
||||||
if (samplesThisRun == 0) { //stop encoding
|
if (samplesThisRun == 0) { //stop encoding
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (i = 0; i < numChannels; i++) {
|
|
||||||
samplePtr mixed = mixer->GetBuffer(i);
|
|
||||||
if (format == int24Sample) {
|
|
||||||
for (j = 0; j < samplesThisRun; j++) {
|
|
||||||
tmpsmplbuf[i][j] = ((int *) mixed)[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (j = 0; j < samplesThisRun; j++) {
|
|
||||||
tmpsmplbuf[i][j] = ((short *) mixed)[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
encoder.process(tmpsmplbuf, samplesThisRun);
|
else {
|
||||||
|
for (i = 0; i < numChannels; i++) {
|
||||||
|
samplePtr mixed = mixer->GetBuffer(i);
|
||||||
|
if (format == int24Sample) {
|
||||||
|
for (j = 0; j < samplesThisRun; j++) {
|
||||||
|
tmpsmplbuf[i][j] = ((int *)mixed)[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (j = 0; j < samplesThisRun; j++) {
|
||||||
|
tmpsmplbuf[i][j] = ((short *)mixed)[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
||||||
|
encoder.finish();
|
||||||
}
|
}
|
||||||
f.Detach(); // libflac closes the file
|
|
||||||
encoder.finish();
|
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
for (i = 0; i < numChannels; i++) {
|
for (i = 0; i < numChannels; i++) {
|
||||||
free(tmpsmplbuf[i]);
|
free(tmpsmplbuf[i]);
|
||||||
|
@ -272,36 +272,36 @@ int ExportMP2::Export(AudacityProject *project,
|
|||||||
t0, t1,
|
t0, t1,
|
||||||
stereo? 2: 1, pcmBufferSize, true,
|
stereo? 2: 1, pcmBufferSize, true,
|
||||||
rate, int16Sample, true, mixerSpec);
|
rate, int16Sample, true, mixerSpec);
|
||||||
delete [] waveTracks;
|
delete[] waveTracks;
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
|
||||||
selectionOnly ?
|
|
||||||
wxString::Format(_("Exporting selected audio at %ld kbps"), bitrate) :
|
|
||||||
wxString::Format(_("Exporting entire file at %ld kbps"), bitrate));
|
|
||||||
|
|
||||||
int updateResult = eProgressSuccess;
|
int updateResult = eProgressSuccess;
|
||||||
while(updateResult == eProgressSuccess) {
|
{
|
||||||
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
|
selectionOnly ?
|
||||||
|
wxString::Format(_("Exporting selected audio at %ld kbps"), bitrate) :
|
||||||
|
wxString::Format(_("Exporting entire file at %ld kbps"), bitrate));
|
||||||
|
|
||||||
if (pcmNumSamples == 0)
|
while (updateResult == eProgressSuccess) {
|
||||||
break;
|
sampleCount pcmNumSamples = mixer->Process(pcmBufferSize);
|
||||||
|
|
||||||
short *pcmBuffer = (short *)mixer->GetBuffer();
|
if (pcmNumSamples == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
int mp2BufferNumBytes = twolame_encode_buffer_interleaved(
|
short *pcmBuffer = (short *)mixer->GetBuffer();
|
||||||
|
|
||||||
|
int mp2BufferNumBytes = twolame_encode_buffer_interleaved(
|
||||||
encodeOptions,
|
encodeOptions,
|
||||||
pcmBuffer,
|
pcmBuffer,
|
||||||
pcmNumSamples,
|
pcmNumSamples,
|
||||||
mp2Buffer,
|
mp2Buffer,
|
||||||
mp2BufferSize);
|
mp2BufferSize);
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
int mp2BufferNumBytes = twolame_encode_flush(
|
int mp2BufferNumBytes = twolame_encode_flush(
|
||||||
|
@ -1792,48 +1792,48 @@ 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);
|
||||||
|
|
||||||
if (blockLen == 0) {
|
if (blockLen == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
short *mixed = (short *)mixer->GetBuffer();
|
short *mixed = (short *)mixer->GetBuffer();
|
||||||
|
|
||||||
if (blockLen < inSamples) {
|
if (blockLen < inSamples) {
|
||||||
if (channels > 1) {
|
if (channels > 1) {
|
||||||
bytes = exporter.EncodeRemainder(mixed, blockLen , buffer);
|
bytes = exporter.EncodeRemainder(mixed, blockLen, buffer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bytes = exporter.EncodeRemainderMono(mixed, blockLen, buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bytes = exporter.EncodeRemainderMono(mixed, blockLen , buffer);
|
if (channels > 1) {
|
||||||
|
bytes = exporter.EncodeBuffer(mixed, buffer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bytes = exporter.EncodeBufferMono(mixed, buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
if (bytes < 0) {
|
||||||
if (channels > 1) {
|
wxString msg;
|
||||||
bytes = exporter.EncodeBuffer(mixed, buffer);
|
msg.Printf(_("Error %ld returned from MP3 encoder"), bytes);
|
||||||
}
|
wxMessageBox(msg);
|
||||||
else {
|
break;
|
||||||
bytes = exporter.EncodeBufferMono(mixed, buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outFile.Write(buffer, bytes);
|
||||||
|
|
||||||
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes < 0) {
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf(_("Error %ld returned from MP3 encoder"), bytes);
|
|
||||||
wxMessageBox(msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
outFile.Write(buffer, bytes);
|
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
bytes = exporter.FinishStream(buffer);
|
bytes = exporter.FinishStream(buffer);
|
||||||
|
@ -253,74 +253,74 @@ int ExportOGG::Export(AudacityProject *project,
|
|||||||
t0, t1,
|
t0, t1,
|
||||||
numChannels, SAMPLES_PER_RUN, false,
|
numChannels, SAMPLES_PER_RUN, false,
|
||||||
rate, floatSample, true, mixerSpec);
|
rate, floatSample, true, mixerSpec);
|
||||||
delete [] waveTracks;
|
delete[] waveTracks;
|
||||||
|
|
||||||
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(),
|
{
|
||||||
selectionOnly ?
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
_("Exporting the selected audio as Ogg Vorbis") :
|
selectionOnly ?
|
||||||
_("Exporting the entire project as Ogg Vorbis"));
|
_("Exporting the selected audio as Ogg Vorbis") :
|
||||||
|
_("Exporting the entire project as Ogg Vorbis"));
|
||||||
|
|
||||||
while (updateResult == eProgressSuccess && !eos) {
|
while (updateResult == eProgressSuccess && !eos) {
|
||||||
float **vorbis_buffer = vorbis_analysis_buffer(&dsp, SAMPLES_PER_RUN);
|
float **vorbis_buffer = vorbis_analysis_buffer(&dsp, SAMPLES_PER_RUN);
|
||||||
sampleCount samplesThisRun = mixer->Process(SAMPLES_PER_RUN);
|
sampleCount samplesThisRun = mixer->Process(SAMPLES_PER_RUN);
|
||||||
|
|
||||||
if (samplesThisRun == 0) {
|
if (samplesThisRun == 0) {
|
||||||
// Tell the library that we wrote 0 bytes - signalling the end.
|
// Tell the library that we wrote 0 bytes - signalling the end.
|
||||||
vorbis_analysis_wrote(&dsp, 0);
|
vorbis_analysis_wrote(&dsp, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
for (int i = 0; i < numChannels; i++) {
|
for (int i = 0; i < numChannels; i++) {
|
||||||
float *temp = (float *)mixer->GetBuffer(i);
|
float *temp = (float *)mixer->GetBuffer(i);
|
||||||
memcpy(vorbis_buffer[i], temp, sizeof(float)*SAMPLES_PER_RUN);
|
memcpy(vorbis_buffer[i], temp, sizeof(float)*SAMPLES_PER_RUN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// tell the encoder how many samples we have
|
||||||
|
vorbis_analysis_wrote(&dsp, samplesThisRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tell the encoder how many samples we have
|
// I don't understand what this call does, so here is the comment
|
||||||
vorbis_analysis_wrote(&dsp, samplesThisRun);
|
// from the example, verbatim:
|
||||||
}
|
//
|
||||||
|
// vorbis does some data preanalysis, then divvies up blocks
|
||||||
|
// for more involved (potentially parallel) processing. Get
|
||||||
|
// a single block for encoding now
|
||||||
|
while (vorbis_analysis_blockout(&dsp, &block) == 1) {
|
||||||
|
|
||||||
// I don't understand what this call does, so here is the comment
|
// analysis, assume we want to use bitrate management
|
||||||
// from the example, verbatim:
|
vorbis_analysis(&block, NULL);
|
||||||
//
|
vorbis_bitrate_addblock(&block);
|
||||||
// vorbis does some data preanalysis, then divvies up blocks
|
|
||||||
// for more involved (potentially parallel) processing. Get
|
|
||||||
// a single block for encoding now
|
|
||||||
while (vorbis_analysis_blockout(&dsp, &block) == 1) {
|
|
||||||
|
|
||||||
// analysis, assume we want to use bitrate management
|
while (vorbis_bitrate_flushpacket(&dsp, &packet)) {
|
||||||
vorbis_analysis(&block, NULL);
|
|
||||||
vorbis_bitrate_addblock(&block);
|
|
||||||
|
|
||||||
while (vorbis_bitrate_flushpacket(&dsp, &packet)) {
|
// add the packet to the bitstream
|
||||||
|
ogg_stream_packetin(&stream, &packet);
|
||||||
|
|
||||||
// add the packet to the bitstream
|
// From vorbis-tools-1.0/oggenc/encode.c:
|
||||||
ogg_stream_packetin(&stream, &packet);
|
// If we've gone over a page boundary, we can do actual output,
|
||||||
|
// so do so (for however many pages are available).
|
||||||
|
|
||||||
// From vorbis-tools-1.0/oggenc/encode.c:
|
while (!eos) {
|
||||||
// If we've gone over a page boundary, we can do actual output,
|
int result = ogg_stream_pageout(&stream, &page);
|
||||||
// so do so (for however many pages are available).
|
if (!result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
while (!eos) {
|
outFile.Write(page.header, page.header_len);
|
||||||
int result = ogg_stream_pageout(&stream, &page);
|
outFile.Write(page.body, page.body_len);
|
||||||
if (!result) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
outFile.Write(page.header, page.header_len);
|
if (ogg_page_eos(&page)) {
|
||||||
outFile.Write(page.body, page.body_len);
|
eos = 1;
|
||||||
|
}
|
||||||
if (ogg_page_eos(&page)) {
|
|
||||||
eos = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
ogg_stream_clear(&stream);
|
ogg_stream_clear(&stream);
|
||||||
|
@ -493,47 +493,47 @@ 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(),
|
{
|
||||||
selectionOnly ?
|
ProgressDialog progress(wxFileName(fName).GetName(),
|
||||||
wxString::Format(_("Exporting the selected audio as %s"),
|
selectionOnly ?
|
||||||
formatStr.c_str()) :
|
wxString::Format(_("Exporting the selected audio as %s"),
|
||||||
wxString::Format(_("Exporting the entire project as %s"),
|
formatStr.c_str()) :
|
||||||
formatStr.c_str()));
|
wxString::Format(_("Exporting the entire project as %s"),
|
||||||
|
formatStr.c_str()));
|
||||||
|
|
||||||
while(updateResult == eProgressSuccess) {
|
while (updateResult == eProgressSuccess) {
|
||||||
sampleCount samplesWritten;
|
sampleCount samplesWritten;
|
||||||
sampleCount numSamples = mixer->Process(maxBlockLen);
|
sampleCount numSamples = mixer->Process(maxBlockLen);
|
||||||
|
|
||||||
if (numSamples == 0)
|
if (numSamples == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
samplePtr mixed = mixer->GetBuffer();
|
samplePtr mixed = mixer->GetBuffer();
|
||||||
|
|
||||||
ODManager::LockLibSndFileMutex();
|
ODManager::LockLibSndFileMutex();
|
||||||
if (format == int16Sample)
|
if (format == int16Sample)
|
||||||
samplesWritten = sf_writef_short(sf, (short *)mixed, numSamples);
|
samplesWritten = sf_writef_short(sf, (short *)mixed, numSamples);
|
||||||
else
|
else
|
||||||
samplesWritten = sf_writef_float(sf, (float *)mixed, numSamples);
|
samplesWritten = sf_writef_float(sf, (float *)mixed, numSamples);
|
||||||
ODManager::UnlockLibSndFileMutex();
|
ODManager::UnlockLibSndFileMutex();
|
||||||
|
|
||||||
if (samplesWritten != numSamples) {
|
if (samplesWritten != numSamples) {
|
||||||
char buffer2[1000];
|
char buffer2[1000];
|
||||||
sf_error_str(sf, buffer2, 1000);
|
sf_error_str(sf, buffer2, 1000);
|
||||||
wxMessageBox(wxString::Format(
|
wxMessageBox(wxString::Format(
|
||||||
/* i18n-hint: %s will be the error message from libsndfile, which
|
/* i18n-hint: %s will be the error message from libsndfile, which
|
||||||
* is usually something unhelpful (and untranslated) like "system
|
* is usually something unhelpful (and untranslated) like "system
|
||||||
* error" */
|
* error" */
|
||||||
_("Error while writing %s file (disk full?).\nLibsndfile says \"%s\""),
|
_("Error while writing %s file (disk full?).\nLibsndfile says \"%s\""),
|
||||||
formatStr.c_str(),
|
formatStr.c_str(),
|
||||||
wxString::FromAscii(buffer2).c_str()));
|
wxString::FromAscii(buffer2).c_str()));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete progress;
|
|
||||||
|
|
||||||
delete mixer;
|
delete mixer;
|
||||||
|
|
||||||
delete[] waveTracks;
|
delete[] waveTracks;
|
||||||
|
@ -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