From 9071dfbb8f7b52345dbfb4598efc3014b234864b Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 17 Jun 2013 12:57:45 +0100 Subject: [PATCH] Gracefully handle when a plugin refuses to init 2nd instance --- source/backend/plugin/DssiPlugin.cpp | 19 +++++++++++-------- source/backend/plugin/LadspaPlugin.cpp | 19 +++++++++++-------- source/backend/plugin/Lv2Plugin.cpp | 19 +++++++++++-------- source/backend/plugin/NativePlugin.cpp | 19 +++++++++++-------- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/source/backend/plugin/DssiPlugin.cpp b/source/backend/plugin/DssiPlugin.cpp index 6879eeb4d..918348d25 100644 --- a/source/backend/plugin/DssiPlugin.cpp +++ b/source/backend/plugin/DssiPlugin.cpp @@ -461,16 +461,19 @@ public: if (fHandle2 == nullptr) fHandle2 = fDescriptor->instantiate(fDescriptor, (unsigned long)sampleRate); - if (aIns == 1) + if (fHandle2 != nullptr) { - aIns = 2; - forcedStereoIn = true; - } + if (aIns == 1) + { + aIns = 2; + forcedStereoIn = true; + } - if (aOuts == 1) - { - aOuts = 2; - forcedStereoOut = true; + if (aOuts == 1) + { + aOuts = 2; + forcedStereoOut = true; + } } } diff --git a/source/backend/plugin/LadspaPlugin.cpp b/source/backend/plugin/LadspaPlugin.cpp index 1b25b0687..ea965c917 100644 --- a/source/backend/plugin/LadspaPlugin.cpp +++ b/source/backend/plugin/LadspaPlugin.cpp @@ -453,16 +453,19 @@ public: if (fHandle2 == nullptr) fHandle2 = fDescriptor->instantiate(fDescriptor, (unsigned long)sampleRate); - if (aIns == 1) + if (fHandle2 != nullptr) { - aIns = 2; - forcedStereoIn = true; - } + if (aIns == 1) + { + aIns = 2; + forcedStereoIn = true; + } - if (aOuts == 1) - { - aOuts = 2; - forcedStereoOut = true; + if (aOuts == 1) + { + aOuts = 2; + forcedStereoOut = true; + } } } diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index 6b85712c0..b89aa32e6 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -1400,16 +1400,19 @@ public: if (fHandle2 == nullptr) fHandle2 = fDescriptor->instantiate(fDescriptor, sampleRate, fRdfDescriptor->Bundle, fFeatures); - if (aIns == 1) + if (fHandle2 != nullptr) { - aIns = 2; - forcedStereoIn = true; - } + if (aIns == 1) + { + aIns = 2; + forcedStereoIn = true; + } - if (aOuts == 1) - { - aOuts = 2; - forcedStereoOut = true; + if (aOuts == 1) + { + aOuts = 2; + forcedStereoOut = true; + } } } diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 25de6a960..403bec19e 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -788,16 +788,19 @@ public: if (fHandle2 == nullptr) fHandle2 = fDescriptor->instantiate(fDescriptor, &fHost); - if (aIns == 1) + if (fHandle2 != nullptr) { - aIns = 2; - forcedStereoIn = true; - } + if (aIns == 1) + { + aIns = 2; + forcedStereoIn = true; + } - if (aOuts == 1) - { - aOuts = 2; - forcedStereoOut = true; + if (aOuts == 1) + { + aOuts = 2; + forcedStereoOut = true; + } } }