Fix for bug #981

This commit is contained in:
Leland Lucius 2015-05-28 09:57:59 -05:00
parent ca7c107fdc
commit b8ce7f6125
8 changed files with 46 additions and 18 deletions

13
lib-src/mod-nyq-bench/NyqBench.cpp Normal file → Executable file
View File

@ -689,10 +689,6 @@ NyqBench::NyqBench(wxWindow * parent)
mScript = NULL;
mOutput = NULL;
// No need to delete...EffectManager will do it
mEffect = new NyquistEffect(wxT("===nyquistworker==="));
EffectManager::Get().RegisterEffect(mEffect);
mPath = gPrefs->Read(wxT("NyqBench/Path"), wxEmptyString);
mAutoLoad = (gPrefs->Read(wxT("NyqBench/AutoLoad"), 0L) != 0);
mAutoWrap = (gPrefs->Read(wxT("NyqBench/AutoWrap"), true) != 0);
@ -1353,6 +1349,10 @@ void NyqBench::OnLargeIcons(wxCommandEvent & e)
void NyqBench::OnGo(wxCommandEvent & e)
{
// No need to delete...EffectManager will do it
mEffect = new NyquistEffect(wxT("Nyquist Effect Workbench"));
const PluginID & ID = EffectManager::Get().RegisterEffect(mEffect);
mEffect->SetCommand(mScript->GetValue());
mEffect->RedirectOutput();
@ -1366,14 +1366,15 @@ void NyqBench::OnGo(wxCommandEvent & e)
mRunning = true;
UpdateWindowUI();
const PluginID & id = EffectManager::Get().GetEffectByIdentifier(mEffect->GetSymbol());
p->OnEffect(id);
p->OnEffect(ID);
mRunning = false;
UpdateWindowUI();
}
Raise();
EffectManager::Get().UnregisterEffect(ID);
}
void NyqBench::OnStop(wxCommandEvent & e)

0
lib-src/mod-nyq-bench/NyqBench.h Normal file → Executable file
View File

View File

@ -66,7 +66,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>audacity.lib;wxbase28ud.lib;wxbase28ud_net.lib;wxmsw28ud_adv.lib;wxmsw28ud_core.lib;wxmsw28ud_html.lib;wxpngd.lib;wxzlibd.lib;wxjpegd.lib;wxtiffd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)modules\$(ProjectName).dll</OutputFile>
<OutputFile>..\..\win\$(ConfigurationName)\modules\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>..\..\win/$(Configuration);$(WXWIN)\lib\vc_dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@ -91,7 +91,7 @@ copy "$(TargetPath)" "%25dest%25"
</ClCompile>
<Link>
<AdditionalDependencies>audacity.lib;wxbase28u.lib;wxbase28u_net.lib;wxmsw28u_adv.lib;wxmsw28u_core.lib;wxmsw28u_html.lib;wxpng.lib;wxzlib.lib;wxjpeg.lib;wxtiff.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)modules\$(ProjectName).dll</OutputFile>
<OutputFile>..\..\win\$(ConfigurationName)\modules\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>../../win/$(Configuration);$(WXWIN)\lib\vc_dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>

View File

@ -2201,6 +2201,18 @@ const PluginID & PluginManager::RegisterPlugin(EffectIdentInterface *effect)
return plug.GetID();
}
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
void PluginManager::UnregisterPlugin(const PluginID & ID)
{
if (mPlugins.find(ID) == mPlugins.end())
{
return;
}
mPlugins.erase(ID);
}
int PluginManager::GetPluginCount(PluginType type)
{
int num = 0;

View File

@ -262,6 +262,7 @@ public:
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
const PluginID & RegisterPlugin(EffectIdentInterface *effect);
void UnregisterPlugin(const PluginID & ID);
private:
void Load();

18
src/effects/EffectManager.cpp Normal file → Executable file
View File

@ -65,10 +65,22 @@ EffectManager::~EffectManager()
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
void EffectManager::RegisterEffect(Effect *f)
const PluginID & EffectManager::RegisterEffect(Effect *f)
{
// This will go away after all effects have been converted
mEffects[PluginManager::Get().RegisterPlugin(f)] = f;
const PluginID & ID = PluginManager::Get().RegisterPlugin(f);
mEffects[ID] = f;
return ID;
}
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
void EffectManager::UnregisterEffect(const PluginID & ID)
{
PluginID id = ID;
PluginManager::Get().UnregisterPlugin(id);
mEffects.erase(id);
}
bool EffectManager::DoEffect(const PluginID & ID,

5
src/effects/EffectManager.h Normal file → Executable file
View File

@ -56,10 +56,11 @@ public:
EffectManager();
virtual ~EffectManager();
/** Register an effect so it can be executed. */
/** (Un)Register an effect so it can be executed. */
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
void RegisterEffect(Effect *f);
const PluginID & RegisterEffect(Effect *f);
void UnregisterEffect(const PluginID & ID);
/** Run an effect given the plugin ID */
// Returns true on success. Will only operate on tracks that

11
src/effects/nyquist/Nyquist.cpp Normal file → Executable file
View File

@ -150,11 +150,6 @@ NyquistEffect::~NyquistEffect()
{
}
void NyquistEffect::RedirectOutput()
{
wxFAIL_MSG(XO("JKC: This function used to exist. Have a look in SVN and see if you can find it") );
}
// IdentInterface implementation
wxString NyquistEffect::GetPath()
@ -1180,6 +1175,12 @@ wxArrayString NyquistEffect::ParseChoice(const NyqControl & ctrl)
return choices;
}
void NyquistEffect::RedirectOutput()
{
mRedirectOutput = true;
}
void NyquistEffect::SetCommand(wxString cmd)
{
mExternal = true;