Browse Source

Added AudioProcessor::wrapperType flags

tags/2021-05-28
jules 13 years ago
parent
commit
10c0894141
8 changed files with 57 additions and 40 deletions
  1. +3
    -0
      modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp
  2. +2
    -0
      modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm
  3. +3
    -1
      modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp
  4. +2
    -0
      modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h
  5. +26
    -37
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  6. +2
    -0
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  7. +3
    -2
      modules/juce_audio_processors/processors/juce_AudioProcessor.cpp
  8. +16
    -0
      modules/juce_audio_processors/processors/juce_AudioProcessor.h

+ 3
- 0
modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp View File

@@ -378,6 +378,9 @@ struct AAXClasses
JuceAAX_Parameters()
{
pluginInstance = createPluginFilter();
if (pluginInstance != nullptr)
pluginInstance->wrapperType = AudioProcessor::wrapperType_AAX;
}
static AAX_CEffectParameters* AAX_CALLBACK Create() { return new JuceAAX_Parameters(); }


+ 2
- 0
modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm View File

@@ -143,6 +143,8 @@ public:
juceFilter = createPluginFilter();
jassert (juceFilter != nullptr);
juceFilter->wrapperType = AudioProcessor::wrapperType_AudioUnit;
juceFilter->setPlayHead (this);
juceFilter->addListener (this);


+ 3
- 1
modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp View File

@@ -156,7 +156,9 @@ public:
{
asyncUpdater = new InternalAsyncUpdater (*this);
juceFilter = createPluginFilter();
jassert (juceFilter != 0);
jassert (juceFilter != nullptr);
juceFilter->wrapperType = AudioProcessor::wrapperType_RTAS;
AddChunk (juceChunkType, "Juce Audio Plugin Data");


+ 2
- 0
modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h View File

@@ -77,6 +77,8 @@ public:
JUCEApplication::quit();
}
filter->wrapperType = AudioProcessor::wrapperType_Standalone;
filter->setPlayConfigDetails (JucePlugin_MaxNumInputChannels,
JucePlugin_MaxNumOutputChannels,
44100, 512);


+ 26
- 37
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -173,11 +173,10 @@ namespace
{
const MOUSEHOOKSTRUCTEX& hs = *(MOUSEHOOKSTRUCTEX*) lParam;
Component* const comp = Desktop::getInstance().findComponentAt (Point<int> (hs.pt.x,
hs.pt.y));
if (comp != nullptr && comp->getWindowHandle() != 0)
return PostMessage ((HWND) comp->getWindowHandle(), WM_MOUSEWHEEL,
hs.mouseData & 0xffff0000, (hs.pt.x & 0xffff) | (hs.pt.y << 16));
if (Component* const comp = Desktop::getInstance().findComponentAt (Point<int> (hs.pt.x, hs.pt.y)))
if (comp->getWindowHandle() != 0)
return PostMessage ((HWND) comp->getWindowHandle(), WM_MOUSEWHEEL,
hs.mouseData & 0xffff0000, (hs.pt.x & 0xffff) | (hs.pt.y << 16));
}
return CallNextHookEx (mouseWheelHook, nCode, wParam, lParam);
@@ -562,12 +561,8 @@ public:
// copy back any temp channels that may have been used..
for (i = 0; i < numOut; ++i)
{
const float* const chan = tempChannels.getUnchecked(i);
if (chan != nullptr)
if (const float* const chan = tempChannels.getUnchecked(i))
memcpy (outputs[i], chan, sizeof (float) * numSamples);
}
}
}
@@ -673,7 +668,7 @@ public:
bool getCurrentPosition (AudioPlayHead::CurrentPositionInfo& info)
{
const VstTimeInfo* const ti = getTimeInfo (kVstPpqPosValid | kVstTempoValid | kVstBarsValid | kVstCyclePosValid
| kVstTimeSigValid | kVstSmpteValid | kVstClockValid);
| kVstTimeSigValid | kVstSmpteValid | kVstClockValid);
if (ti == nullptr || ti->sampleRate <= 0)
return false;
@@ -840,9 +835,8 @@ public:
return filter != nullptr && filter->isParameterAutomatable ((int) index);
}
class ChannelConfigComparator
struct ChannelConfigComparator
{
public:
static int compareElements (const short* const first, const short* const second) noexcept
{
if (first[0] < second[0]) return -1;
@@ -953,18 +947,18 @@ public:
VstInt32 setChunk (void* data, VstInt32 byteSize, bool onlyRestoreCurrentProgramData)
{
if (filter == nullptr)
return 0;
chunkMemory.setSize (0);
chunkMemoryTime = 0;
if (byteSize > 0 && data != nullptr)
if (filter != nullptr)
{
if (onlyRestoreCurrentProgramData)
filter->setCurrentProgramStateInformation (data, byteSize);
else
filter->setStateInformation (data, byteSize);
chunkMemory.setSize (0);
chunkMemoryTime = 0;
if (byteSize > 0 && data != nullptr)
{
if (onlyRestoreCurrentProgramData)
filter->setCurrentProgramStateInformation (data, byteSize);
else
filter->setStateInformation (data, byteSize);
}
}
return 0;
@@ -1036,9 +1030,7 @@ public:
if (editorComp == nullptr)
{
AudioProcessorEditor* const ed = filter->createEditorIfNeeded();
if (ed != nullptr)
if (AudioProcessorEditor* const ed = filter->createEditorIfNeeded())
{
cEffect.flags |= effFlagsHasEditor;
ed->setOpaque (true);
@@ -1065,8 +1057,7 @@ public:
if (editorComp != nullptr)
{
Component* const modalComponent = Component::getCurrentlyModalComponent();
if (modalComponent != nullptr)
if (Component* const modalComponent = Component::getCurrentlyModalComponent())
{
modalComponent->exitModalState (0);
@@ -1236,8 +1227,8 @@ public:
#endif
}
if (editorComp->getPeer() != nullptr)
editorComp->getPeer()->handleMovedOrResized();
if (ComponentPeer* peer = editorComp->getPeer())
peer->handleMovedOrResized();
}
}
@@ -1309,9 +1300,7 @@ public:
void resized()
{
Component* const editor = getChildComponent(0);
if (editor != nullptr)
if (Component* const editor = getChildComponent(0))
editor->setBounds (getLocalBounds());
}
@@ -1463,10 +1452,10 @@ namespace
MessageManagerLock mmLock;
#endif
AudioProcessor* const filter = createPluginFilter();
if (filter != nullptr)
if (AudioProcessor* const filter = createPluginFilter())
{
filter->wrapperType = AudioProcessor::wrapperType_VST;
JuceVSTWrapper* const wrapper = new JuceVSTWrapper (audioMaster, filter);
return wrapper->getAeffect();
}


+ 2
- 0
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -2973,6 +2973,8 @@ const XmlElement* VSTPluginFormat::getVSTXML (AudioPluginInstance* plugin)
{
if (VSTPluginInstance* const vst = dynamic_cast <VSTPluginInstance*> (plugin))
return vst->getVSTXML();
return nullptr;
}
#endif


+ 3
- 2
modules/juce_audio_processors/processors/juce_AudioProcessor.cpp View File

@@ -24,7 +24,8 @@
*/
AudioProcessor::AudioProcessor()
: playHead (nullptr),
: wrapperType (wrapperType_Undefined),
playHead (nullptr),
sampleRate (0),
blockSize (0),
numInputChannels (0),
@@ -315,4 +316,4 @@ void AudioPlayHead::CurrentPositionInfo::resetToDefault()
timeSigNumerator = 4;
timeSigDenominator = 4;
bpm = 120;
}
}

+ 16
- 0
modules/juce_audio_processors/processors/juce_AudioProcessor.h View File

@@ -562,6 +562,22 @@ public:
/** Not for public use - this is called to initialise the processor before playing. */
void setSpeakerArrangement (const String& inputs, const String& outputs);
/** Flags to indicate the type of plugin context in which a processor is being used. */
enum WrapperType
{
wrapperType_Undefined = 0,
wrapperType_VST,
wrapperType_AudioUnit,
wrapperType_RTAS,
wrapperType_AAX,
wrapperType_Standalone
};
/** When loaded by a plugin wrapper, this flag will be set to indicate the type
of plugin within which the processor is running.
*/
WrapperType wrapperType;
protected:
//==============================================================================
/** Helper function that just converts an xml element into a binary blob.


Loading…
Cancel
Save