More fixes for the realtime stuff.

Nothing new added in this one.  Should fix the odd behavior
with a single track not really working correctly.
This commit is contained in:
lllucius 2014-11-03 22:47:55 +00:00
parent 17207fa39a
commit 4583e91621
3 changed files with 22 additions and 19 deletions

View File

@ -1291,7 +1291,7 @@ bool Effect::RealtimeInitialize()
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
if (mClient)
{
mNumGroups = -1;
mHighGroup = -1;
return mClient->RealtimeInitialize();
}
#endif
@ -1362,6 +1362,11 @@ sampleCount Effect::RealtimeProcess(int group,
int indx = 0;
int ondx = 0;
if (group == 0)
{
mCurrentGroup = 0;
}
// Call the client until we run out of input or output channels
while (ichans > 0 && ochans > 0)
{
@ -1427,18 +1432,16 @@ sampleCount Effect::RealtimeProcess(int group,
// If the current group hasn't yet been seen, then we must
// add a new processor to handle this channel (sub)group
if (group >= mNumGroups)
if (group > mHighGroup)
{
mClient->RealtimeAddProcessor(gchans, rate);
mHighGroup = group;
}
// Finally call the plugin to process the block
len = mClient->RealtimeProcess(group++, clientIn, clientOut, numSamples);
len = mClient->RealtimeProcess(mCurrentGroup++, clientIn, clientOut, numSamples);
}
// Remember the number of channel groups we've seen
mNumGroups++;
return len;
#else
return 0;

View File

@ -413,6 +413,9 @@ class AUDACITY_DLL_API Effect : public EffectHostInterface
sampleCount mBlockSize;
int mNumChannels;
int mCurrentGroup;
int mHighGroup;
friend class EffectManager;// so it can call PromptUser in support of batch commands.
friend class EffectRack;
};

View File

@ -55,8 +55,6 @@
#include <wx/tokenzr.h>
#include <wx/utils.h>
#include <vector>
#if defined(__WXMAC__)
#include <dlfcn.h>
#include <wx/mac/private.h>
@ -348,7 +346,7 @@ wxArrayString VSTEffectsModule::FindPlugins(PluginManagerInterface & pm)
wxStringTokenizer tok(vstpath);
while (tok.HasMoreTokens())
{
pathList.push_back(wxString(tok.GetNextToken()));
pathList.Add(tok.GetNextToken());
}
}
@ -356,8 +354,8 @@ wxArrayString VSTEffectsModule::FindPlugins(PluginManagerInterface & pm)
#define VSTPATH wxT("/Library/Audio/Plug-Ins/VST")
// Look in /Library/Audio/Plug-Ins/VST and $HOME/Library/Audio/Plug-Ins/VST
pathList.push_back(VSTPATH);
pathList.push_back(wxString::FromUTF8(getenv("HOME")) + VSTPATH);
pathList.Add(VSTPATH);
pathList.Add(wxString::FromUTF8(getenv("HOME")) + VSTPATH);
// Recursively search all paths for Info.plist files. This will identify all
// bundles.
@ -393,7 +391,7 @@ wxArrayString VSTEffectsModule::FindPlugins(PluginManagerInterface & pm)
tpath[len] = 0;
dpath[0] = 0;
ExpandEnvironmentStrings(tpath, dpath, WXSIZEOF(dpath));
pathList.push_back(dpath);
pathList.Add(dpath);
}
// Then try HKEY_LOCAL_MACHINE registry key
@ -410,7 +408,7 @@ wxArrayString VSTEffectsModule::FindPlugins(PluginManagerInterface & pm)
tpath[len] = 0;
dpath[0] = 0;
ExpandEnvironmentStrings(tpath, dpath, WXSIZEOF(dpath));
pathList.push_back(dpath);
pathList.Add(dpath);
}
// Add the default path last
@ -418,7 +416,7 @@ wxArrayString VSTEffectsModule::FindPlugins(PluginManagerInterface & pm)
ExpandEnvironmentStrings(wxT("%ProgramFiles%\\Steinberg\\VSTPlugins"),
dpath,
WXSIZEOF(dpath));
pathList.push_back(dpath);
pathList.Add(dpath);
// Recursively scan for all DLLs
pm.FindFilesInPathList(wxT("*.dll"), pathList, files, true);
@ -3251,7 +3249,7 @@ wxString VSTEffect::GetFamily()
}
bool VSTEffect::IsInteractive()
{
{
return mInteractive;
}
@ -3457,8 +3455,8 @@ bool VSTEffect::RealtimeAddProcessor(int numChannels, float sampleRate)
VSTEffect *slave = new VSTEffect(mPath, this);
mSlaves.Add(slave);
slave->SetSampleRate(sampleRate);
slave->SetChannelCount(numChannels);
slave->SetSampleRate(sampleRate);
int clen = 0;
if (mAEffect->flags & effFlagsProgramChunks)
@ -3480,15 +3478,14 @@ bool VSTEffect::RealtimeAddProcessor(int numChannels, float sampleRate)
}
}
return ProcessInitialize();
return slave->RealtimeInitialize();
}
static int asdf=0;
bool VSTEffect::RealtimeFinalize()
{
asdf=1;
for (size_t i = 0, cnt = mSlaves.GetCount(); i < cnt; i++)
{
mSlaves[i]->RealtimeFinalize();
delete mSlaves[i];
}
mSlaves.Clear();