From ba187bbafcfa5416f722ff6f1eec7a499939f6b0 Mon Sep 17 00:00:00 2001 From: "james.k.crook@gmail.com" Date: Sat, 31 Aug 2013 14:24:55 +0000 Subject: [PATCH] Bug 368: No longer look at plugins.cfg to decide whether to rescan. Just use the rescan preference. --- lib-src/sbsms/include/sbsms.h | 13 +++++++----- src/effects/VST/VSTEffect.cpp | 27 +++++++++++++++---------- src/effects/VST/VSTEffect.h | 4 ++-- win/Projects/portmixer/portmixer.vcproj | 2 ++ 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/lib-src/sbsms/include/sbsms.h b/lib-src/sbsms/include/sbsms.h index 167c9e4be..a7557f486 100644 --- a/lib-src/sbsms/include/sbsms.h +++ b/lib-src/sbsms/include/sbsms.h @@ -4,6 +4,9 @@ #include +#undef WXUNUSED +#define WXUNUSED( x ) + namespace _sbsms_ { typedef float t_fft[2]; @@ -49,7 +52,7 @@ typedef long (*SBSMSResampleCB)(void *cbData, SBSMSFrame *frame); class SBSMSInterface { public: virtual ~SBSMSInterface() {} - virtual long samples(audio *buf, long n) { return 0; } + virtual long samples(audio * WXUNUSED(buf), long WXUNUSED(n)) { return 0; } virtual float getStretch(float t)=0; virtual float getPitch(float t)=0; virtual long getPresamples()=0; @@ -78,11 +81,11 @@ class SBSMSRenderer { public: virtual ~SBSMSRenderer() {} virtual void startFrame() {} - virtual void startTime(int c, const TimeType &time, int n) {} - virtual void render(int c, SBSMSTrack *t) {} - virtual void endTime(int c) {} + virtual void startTime(int WXUNUSED(c), const TimeType & WXUNUSED(time), int WXUNUSED(n)) {} + virtual void render(int WXUNUSED(c), SBSMSTrack * WXUNUSED(t)) {} + virtual void endTime(int WXUNUSED(c)) {} virtual void endFrame() {} - virtual void end(const SampleCountType &samples) {} + virtual void end(const SampleCountType & WXUNUSED(samples)) {} }; enum SBSMSError { diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 3d7c08a50..93b6a6f47 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -77,16 +77,21 @@ void RegisterVSTEffects() pm.Open(); + bool bRescanRequired=false; if ( gPrefs->Read(wxT("/VST/Rescan"), (long)true) != false) { + bRescanRequired = true; pm.PurgeType(VSTPLUGINTYPE); } if (!pm.HasType(VSTPLUGINTYPE)) { pm.Close(); - VSTEffect::Scan(); + if( bRescanRequired ) + if( VSTEffect::Scan() != wxID_CANCEL ) + { + gPrefs->Write(wxT("/VST/Rescan"), false); + gPrefs->Flush(); + } pm.Open(); - gPrefs->Write(wxT("/VST/Rescan"), false); - gPrefs->Flush(); } EffectManager & em = EffectManager::Get(); @@ -160,7 +165,7 @@ PluginRegistrationDialog::PluginRegistrationDialog(wxWindow * parent, const wxAr SetLabel(_("Install VST Effects")); // Provide visual label SetName(_("Install VST Effects")); // Provide audible label Populate(); - + SetReturnCode( wxID_OK); mAbort = false; } @@ -335,12 +340,12 @@ void PluginRegistrationDialog::OnApply(wxCommandEvent & WXUNUSED(event)) mPlugins->SetItemImage( i, SHOW_CHECKED ); } } - EndModal( true ); + EndModal(wxID_OK); } void PluginRegistrationDialog::OnCancel(wxCommandEvent & WXUNUSED(event)) { - EndModal(false); + EndModal(wxID_CANCEL); } @@ -1931,10 +1936,10 @@ void VSTEffect::ScanOnePlugin( const wxString & file ) wxExecute((wxChar **) argv, wxEXEC_SYNC | wxEXEC_NODISABLE, NULL); } -void VSTEffect::ShowPluginListDialog( const wxArrayString & files ) +int VSTEffect::ShowPluginListDialog( const wxArrayString & files ) { PluginRegistrationDialog d( wxGetApp().GetTopWindow(), files ); - d.ShowModal(); + return d.ShowModal(); } void VSTEffect::ShowProgressDialog( const wxString & longest, const wxArrayString & files ) @@ -1961,7 +1966,7 @@ void VSTEffect::ShowProgressDialog( const wxString & longest, const wxArrayStrin } /* static */ -void VSTEffect::Scan() +int VSTEffect::Scan() { wxArrayString audacityPathList = wxGetApp().audacityPathList; wxArrayString pathList; @@ -2066,7 +2071,7 @@ void VSTEffect::Scan() // JKC: Let's not show the progress dialog if there are no // files to test. if( cnt <= 0 ) - return; + return wxID_OK; for (size_t i = 0; i < cnt; i++) { if (files[i].Length() > longest.Length()) { @@ -2076,7 +2081,7 @@ void VSTEffect::Scan() //Choose the first for the original version which scans them all //The second to selectively scan. //ShowProgressDialog( longest, files ); - ShowPluginListDialog( files ); + return ShowPluginListDialog( files ); } /* static */ diff --git a/src/effects/VST/VSTEffect.h b/src/effects/VST/VSTEffect.h index cfd4b0f08..99e627388 100644 --- a/src/effects/VST/VSTEffect.h +++ b/src/effects/VST/VSTEffect.h @@ -65,11 +65,11 @@ class VSTEffect:public Effect // Plugin probing - static void Scan(); + static int Scan(); static void Check(const wxChar *fname); static void ScanOnePlugin( const wxString & file ); - static void ShowPluginListDialog( const wxArrayString & files ); + static int ShowPluginListDialog( const wxArrayString & files ); static void ShowProgressDialog( const wxString & longest, const wxArrayString & files ); diff --git a/win/Projects/portmixer/portmixer.vcproj b/win/Projects/portmixer/portmixer.vcproj index 1885aee7f..ed7676a65 100644 --- a/win/Projects/portmixer/portmixer.vcproj +++ b/win/Projects/portmixer/portmixer.vcproj @@ -93,6 +93,7 @@