Browse Source

DSSI/LV2: Disable mapping programs if plugin does not expose them

tags/1.9.5
falkTX 10 years ago
parent
commit
ee8dc99cf0
2 changed files with 42 additions and 9 deletions
  1. +11
    -3
      source/backend/plugin/DssiPlugin.cpp
  2. +31
    -6
      source/backend/plugin/Lv2Plugin.cpp

+ 11
- 3
source/backend/plugin/DssiPlugin.cpp View File

@@ -15,6 +15,9 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

// TODO: set fUsesCustomData and latency index before init finishes
// TODO: common laterncy code

#include "CarlaPluginInternal.hpp"
#include "CarlaEngine.hpp"

@@ -169,6 +172,8 @@ public:

uint getOptionsAvailable() const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr, 0x0);

#ifdef __USE_GNU
const bool isDssiVst(strcasestr(pData->filename, "dssi-vst") != nullptr);
#else
@@ -177,7 +182,8 @@ public:

uint options = 0x0;

options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;
if (fDssiDescriptor->get_program != nullptr && fDssiDescriptor->select_program != nullptr)
options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;

if (! isDssiVst)
{
@@ -2160,8 +2166,7 @@ public:
const bool isDssiVst(std::strstr(pData->filename, "dssi-vst") != nullptr);
#endif

pData->options = 0x0;
pData->options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;
pData->options = 0x0;

if (fLatencyIndex >= 0 || isDssiVst)
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS;
@@ -2172,6 +2177,9 @@ public:
if (fUsesCustomData)
pData->options |= PLUGIN_OPTION_USE_CHUNKS;

if (fDssiDescriptor->get_program != nullptr && fDssiDescriptor->select_program != nullptr)
pData->options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;

if (fDssiDescriptor->run_synth != nullptr || fDssiDescriptor->run_multiple_synths != nullptr)
{
pData->options |= PLUGIN_OPTION_SEND_CHANNEL_PRESSURE;


+ 31
- 6
source/backend/plugin/Lv2Plugin.cpp View File

@@ -709,7 +709,8 @@ public:

uint options = 0x0;

options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;
if (fExt.programs != nullptr)
options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;

if (fLatencyIndex == -1 && ! (hasMidiIn || needsFixedBuffer()))
options |= PLUGIN_OPTION_FIXED_BUFFERS;
@@ -1466,8 +1467,6 @@ public:
params += 1;
}

recheckExtensions();

if ((pData->options & PLUGIN_OPTION_FORCE_STEREO) != 0 && (aIns == 1 || aOuts == 1) && fExt.state == nullptr && fExt.worker == nullptr)
{
if (fHandle2 == nullptr)
@@ -2032,8 +2031,7 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;
pData->param.special[j] = PARAMETER_SPECIAL_LATENCY;
CARLA_SAFE_ASSERT(fLatencyIndex == -1);
fLatencyIndex = static_cast<int32_t>(j);
CARLA_SAFE_ASSERT(fLatencyIndex == static_cast<int32_t>(j));
}
else if (LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(portDesignation))
{
@@ -4050,6 +4048,29 @@ public:
if (fExt.worker != nullptr && fExt.worker->work == nullptr)
fExt.worker = nullptr;
}

CARLA_SAFE_ASSERT_RETURN(fLatencyIndex == -1,);

for (uint32_t i=0, count=fRdfDescriptor->PortCount, iCtrl=0; i<count; ++i)
{
const LV2_Property portTypes(fRdfDescriptor->Ports[i].Types);

if (! LV2_IS_PORT_CONTROL(portTypes))
continue;

iCtrl++;

if (! LV2_IS_PORT_OUTPUT(portTypes))
continue;

const LV2_Property portDesignation(fRdfDescriptor->Ports[i].Designation);

if (! LV2_IS_PORT_DESIGNATION_LATENCY(portDesignation))
continue;

fLatencyIndex = static_cast<int32_t>(iCtrl);
break;
}
}

// -------------------------------------------------------------------
@@ -4844,11 +4865,15 @@ public:
if (std::strcmp(uri, "http://hyperglitch.com/dev/VocProc") == 0)
fCanInit2 = false;

recheckExtensions();

// ---------------------------------------------------------------
// set default options

pData->options = 0x0;
pData->options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;

if (fExt.programs != nullptr)
pData->options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;

if (fLatencyIndex >= 0 || getMidiInCount() > 0 || needsFixedBuffer())
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS;


Loading…
Cancel
Save