Browse Source

Update LV2 wrapper to work with latest juce

tags/2018-04-16
falkTX 5 years ago
parent
commit
f16693519b
6 changed files with 59 additions and 20 deletions
  1. +53
    -14
      libs/juce/source/modules/juce_audio_plugin_client/LV2/juce_LV2_Wrapper.cpp
  2. +2
    -2
      ports/LUFSMeter/source/JucePluginCharacteristics.h
  3. +1
    -1
      ports/klangfalter/source/JucePluginCharacteristics.h
  4. +1
    -1
      ports/luftikus/source/JucePluginCharacteristics.h
  5. +1
    -1
      ports/pitchedDelay/source/JucePluginCharacteristics.h
  6. +1
    -1
      ports/refine/source/JucePluginCharacteristics.h

+ 53
- 14
libs/juce/source/modules/juce_audio_plugin_client/LV2/juce_LV2_Wrapper.cpp View File

@@ -519,7 +519,7 @@ void createLv2Files(const char* basename)

std::cout << "Writing " << binary << ".ttl..."; std::cout.flush();
std::fstream plugin(binaryTTL.toUTF8(), std::ios::out);
plugin << makePluginFile(filter, JucePlugin_MaxNumInputChannels, JucePlugin_MaxNumOutputChannels) << std::endl;
plugin << makePluginFile(filter, filter->getTotalNumInputChannels(), filter->getTotalNumOutputChannels()) << std::endl;
plugin.close();
std::cout << " done!" << std::endl;

@@ -873,8 +873,8 @@ public:
#if JucePlugin_WantsLV2Latency
controlPortOffset += 1;
#endif
controlPortOffset += JucePlugin_MaxNumInputChannels;
controlPortOffset += JucePlugin_MaxNumOutputChannels;
controlPortOffset += filter->getTotalNumInputChannels();
controlPortOffset += filter->getTotalNumOutputChannels();

lastProgramCount = filter->getNumPrograms();
}
@@ -1123,8 +1123,8 @@ class JuceLv2Wrapper : public AudioPlayHead
public:
//==============================================================================
JuceLv2Wrapper (double sampleRate_, const LV2_Feature* const* features)
: numInChans (JucePlugin_MaxNumInputChannels),
numOutChans (JucePlugin_MaxNumOutputChannels),
: numInChans (0),
numOutChans (0),
bufferSize (2048),
sampleRate (sampleRate_),
uridMap (nullptr),
@@ -1152,6 +1152,14 @@ public:
}
jassert (filter != nullptr);

// LV2 does not support disabling buses: so always enable all of them
filter->enableAllBuses();

findMaxTotalChannels (numInChans, numOutChans);

// You must at least have some channels
jassert (filter->isMidiEffect() || (numInChans > 0 || numOutChans > 0));

filter->setPlayConfigDetails (numInChans, numOutChans, 0, 0);
filter->setPlayHead (this);

@@ -1168,11 +1176,8 @@ public:
portLatency = nullptr;
#endif

for (int i=0; i < numInChans; ++i)
portAudioIns[i] = nullptr;
for (int i=0; i < numOutChans; ++i)
portAudioOuts[i] = nullptr;

portAudioIns.insertMultiple (0, nullptr, numInChans);
portAudioOuts.insertMultiple (0, nullptr, numOutChans);
portControls.insertMultiple (0, nullptr, filter->getNumParameters());

for (int i=0; i < filter->getNumParameters(); ++i)
@@ -1270,6 +1275,40 @@ public:
lastControlValues.clear();
}

//==============================================================================
void findMaxTotalChannels (int& maxTotalIns, int& maxTotalOuts)
{
#ifdef JucePlugin_PreferredChannelConfigurations
int configs[][2] = { JucePlugin_PreferredChannelConfigurations };
maxTotalIns = maxTotalOuts = 0;

for (auto& config : configs)
{
maxTotalIns = jmax (maxTotalIns, config[0]);
maxTotalOuts = jmax (maxTotalOuts, config[1]);
}
#else
auto numInputBuses = filter->getBusCount (true);
auto numOutputBuses = filter->getBusCount (false);

if (numInputBuses > 1 || numOutputBuses > 1)
{
maxTotalIns = maxTotalOuts = 0;

for (int i = 0; i < numInputBuses; ++i)
maxTotalIns += filter->getChannelCountOfBus (true, i);

for (int i = 0; i < numOutputBuses; ++i)
maxTotalOuts += filter->getChannelCountOfBus (false, i);
}
else
{
maxTotalIns = numInputBuses > 0 ? filter->getBus (true, 0)->getMaxSupportedChannels (64) : 0;
maxTotalOuts = numOutputBuses > 0 ? filter->getBus (false, 0)->getMaxSupportedChannels (64) : 0;
}
#endif
}

//==============================================================================
// LV2 core calls

@@ -1311,7 +1350,7 @@ public:
{
if (portId == index++)
{
portAudioIns[i] = (float*)dataLocation;
portAudioIns.set(i, (float*)dataLocation);
return;
}
}
@@ -1320,7 +1359,7 @@ public:
{
if (portId == index++)
{
portAudioOuts[i] = (float*)dataLocation;
portAudioOuts.set(i, (float*)dataLocation);
return;
}
}
@@ -1908,8 +1947,8 @@ private:
#if JucePlugin_WantsLV2Latency
float* portLatency;
#endif
float* portAudioIns[JucePlugin_MaxNumInputChannels];
float* portAudioOuts[JucePlugin_MaxNumOutputChannels];
Array<float*> portAudioIns;
Array<float*> portAudioOuts;
Array<float*> portControls;

uint32 bufferSize;


+ 2
- 2
ports/LUFSMeter/source/JucePluginCharacteristics.h View File

@@ -22,7 +22,7 @@
#define JucePlugin_PluginCode 'LufM'
#define JucePlugin_MaxNumInputChannels 24
#define JucePlugin_MaxNumOutputChannels 24
#define JucePlugin_PreferredChannelConfigurations {24, 24}, {23, 23}, {22, 22}, {21, 21}, {20, 20}, {19, 19}, {18, 18}, {17, 17}, {16, 16}, {15, 15}, {14, 14}, {13, 13}, {12, 12}, {11, 11}, {10, 10}, {9, 9}, {8, 8}, {7, 7}, {6, 6}, {5, 5}, {4, 4}, {3, 3}, {2, 2}, {1, 1}
#define JucePlugin_PreferredChannelConfigurations {24, 24}
#define JucePlugin_AUExportPrefix LUFSMeterMultichannelAU
#define JucePlugin_AUExportPrefixQuoted "LUFSMeterMultichannelAU"
#define JucePlugin_CFBundleIdentifier com.klangfreund.lufsmetermultichannel
@@ -33,7 +33,7 @@
#define JucePlugin_PluginCode 'Lufs'
#define JucePlugin_MaxNumInputChannels 2
#define JucePlugin_MaxNumOutputChannels 2
#define JucePlugin_PreferredChannelConfigurations {2, 2}, {1, 1}
#define JucePlugin_PreferredChannelConfigurations {2, 2}
#define JucePlugin_AUExportPrefix LUFSMeterAU
#define JucePlugin_AUExportPrefixQuoted "LUFSMeterAU"
#define JucePlugin_CFBundleIdentifier com.klangfreund.lufsmeter


+ 1
- 1
ports/klangfalter/source/JucePluginCharacteristics.h View File

@@ -36,7 +36,7 @@
#define JucePlugin_MaxNumOutputChannels 2
#endif
#ifndef JucePlugin_PreferredChannelConfigurations
#define JucePlugin_PreferredChannelConfigurations {1, 1}, {2, 2}, {1, 2}
#define JucePlugin_PreferredChannelConfigurations {1, 1}, {1, 2}, {2, 2}
#endif
#ifndef JucePlugin_IsSynth
#define JucePlugin_IsSynth 0


+ 1
- 1
ports/luftikus/source/JucePluginCharacteristics.h View File

@@ -18,7 +18,7 @@
#define JucePlugin_PluginCode 'lkLK'
#define JucePlugin_MaxNumInputChannels 2
#define JucePlugin_MaxNumOutputChannels 2
#define JucePlugin_PreferredChannelConfigurations {2, 2}, {1, 1}
#define JucePlugin_PreferredChannelConfigurations {1, 1}, {2, 2}
#define JucePlugin_IsSynth 0
#define JucePlugin_IsMidiEffect 0
#define JucePlugin_WantsMidiInput 0


+ 1
- 1
ports/pitchedDelay/source/JucePluginCharacteristics.h View File

@@ -18,7 +18,7 @@
#define JucePlugin_PluginCode 'lkPD'
#define JucePlugin_MaxNumInputChannels 2
#define JucePlugin_MaxNumOutputChannels 2
#define JucePlugin_PreferredChannelConfigurations {2, 2}, {1, 1}
#define JucePlugin_PreferredChannelConfigurations {1, 1}, {2, 2}
#define JucePlugin_IsSynth 0
#define JucePlugin_IsMidiEffect 0
#define JucePlugin_WantsMidiInput 0


+ 1
- 1
ports/refine/source/JucePluginCharacteristics.h View File

@@ -18,7 +18,7 @@
#define JucePlugin_PluginCode 'LkRf'
#define JucePlugin_MaxNumInputChannels 2
#define JucePlugin_MaxNumOutputChannels 2
#define JucePlugin_PreferredChannelConfigurations {2, 2}, {1, 1}
#define JucePlugin_PreferredChannelConfigurations {1, 1}, {2, 2}
#define JucePlugin_IsSynth 0
#define JucePlugin_IsMidiEffect 0
#define JucePlugin_WantsMidiInput 0


Loading…
Cancel
Save