Browse Source

VST3 hosting fixes

tags/2021-05-28
jules 11 years ago
parent
commit
766e98b01f
2 changed files with 12 additions and 10 deletions
  1. +3
    -3
      modules/juce_audio_processors/format_types/juce_VST3Common.h
  2. +9
    -7
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp

+ 3
- 3
modules/juce_audio_processors/format_types/juce_VST3Common.h View File

@@ -126,9 +126,9 @@ class ComSmartPtr
{ {
public: public:
ComSmartPtr() noexcept : source (nullptr) {} ComSmartPtr() noexcept : source (nullptr) {}
ComSmartPtr (ObjectType* object) noexcept : source (object) { if (source != nullptr) source->addRef(); }
ComSmartPtr (const ComSmartPtr& other) noexcept : source (other.source) { if (source != nullptr) source->addRef(); }
~ComSmartPtr() { if (source != nullptr) source->release(); }
ComSmartPtr (ObjectType* object, bool autoAddRef = true) noexcept : source (object) { if (source != nullptr && autoAddRef) source->addRef(); }
ComSmartPtr (const ComSmartPtr& other) noexcept : source (other.source) { if (source != nullptr) source->addRef(); }
~ComSmartPtr() { if (source != nullptr) source->release(); }
operator ObjectType*() const noexcept { return source; } operator ObjectType*() const noexcept { return source; }
ObjectType* get() const noexcept { return source; } ObjectType* get() const noexcept { return source; }


+ 9
- 7
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -1243,7 +1243,8 @@ public:
VST3PluginWindow (AudioProcessor* owner, IPlugView* pluginView) VST3PluginWindow (AudioProcessor* owner, IPlugView* pluginView)
: AudioProcessorEditor (owner), : AudioProcessorEditor (owner),
ComponentMovementWatcher (this), ComponentMovementWatcher (this),
view (pluginView),
refCount (1),
view (pluginView, false),
pluginHandle (nullptr), pluginHandle (nullptr),
recursiveResize (false) recursiveResize (false)
{ {
@@ -1545,10 +1546,11 @@ public:
Array<SpeakerArrangement> inArrangements, outArrangements; Array<SpeakerArrangement> inArrangements, outArrangements;
for (int i = 0; i < numInputAudioBusses; ++i)
// NB: Some plugins need a valid arrangement despite specifying 0 for their I/O busses
for (int i = 0; i < jmax (1, numInputAudioBusses); ++i)
inArrangements.add (getArrangementForNumChannels (jmax (0, (int) getBusInfo (true, true, i).channelCount))); inArrangements.add (getArrangementForNumChannels (jmax (0, (int) getBusInfo (true, true, i).channelCount)));
for (int i = 0; i < numOutputAudioBusses; ++i)
for (int i = 0; i < jmax (1, numOutputAudioBusses); ++i)
outArrangements.add (getArrangementForNumChannels (jmax (0, (int) getBusInfo (false, true, i).channelCount))); outArrangements.add (getArrangementForNumChannels (jmax (0, (int) getBusInfo (false, true, i).channelCount)));
warnOnFailure (processor->setBusArrangements (inArrangements.getRawDataPointer(), numInputAudioBusses, warnOnFailure (processor->setBusArrangements (inArrangements.getRawDataPointer(), numInputAudioBusses,
@@ -1688,7 +1690,7 @@ public:
if (getActiveEditor() != nullptr) if (getActiveEditor() != nullptr)
return true; return true;
ComSmartPtr<IPlugView> view (tryCreatingView());
ComSmartPtr<IPlugView> view (tryCreatingView(), false);
return view != nullptr; return view != nullptr;
} }
@@ -2079,11 +2081,11 @@ private:
Vst::BusInfo getBusInfo (bool forInput, bool forAudio, int index = 0) const Vst::BusInfo getBusInfo (bool forInput, bool forAudio, int index = 0) const
{ {
Vst::BusInfo busInfo; Vst::BusInfo busInfo;
busInfo.mediaType = forAudio ? Vst::kAudio : Vst::kEvent;
busInfo.direction = forInput ? Vst::kInput : Vst::kOutput;
component->getBusInfo (forAudio ? Vst::kAudio : Vst::kEvent,
forInput ? Vst::kInput : Vst::kOutput,
component->getBusInfo (busInfo.mediaType, busInfo.direction,
(Steinberg::int32) index, busInfo); (Steinberg::int32) index, busInfo);
return busInfo; return busInfo;
} }


Loading…
Cancel
Save