Browse Source

Allow to skip MIDI ports in patchbay plugin, in use for OBS

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.5
falkTX 1 year ago
parent
commit
707926d27a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 29 additions and 18 deletions
  1. +7
    -3
      source/backend/engine/CarlaEngineGraph.cpp
  2. +2
    -1
      source/backend/engine/CarlaEngineGraph.hpp
  3. +3
    -1
      source/backend/engine/CarlaEngineInternal.hpp
  4. +17
    -13
      source/backend/engine/CarlaEngineNative.cpp

+ 7
- 3
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -1749,7 +1749,8 @@ private:

PatchbayGraph::PatchbayGraph(CarlaEngine* const engine,
const uint32_t audioIns, const uint32_t audioOuts,
const uint32_t cvIns, const uint32_t cvOuts)
const uint32_t cvIns, const uint32_t cvOuts,
const bool withMidiIn, const bool withMidiOut)
: CarlaRunner("PatchbayReorderRunner"),
connections(),
graph(),
@@ -1858,6 +1859,7 @@ PatchbayGraph::PatchbayGraph(CarlaEngine* const engine,
node->properties.isOSC = false;
}

if (withMidiIn)
{
NamedAudioGraphIOProcessor* const proc(
new NamedAudioGraphIOProcessor(NamedAudioGraphIOProcessor::midiInputNode));
@@ -1870,6 +1872,7 @@ PatchbayGraph::PatchbayGraph(CarlaEngine* const engine,
node->properties.isOSC = false;
}

if (withMidiOut)
{
NamedAudioGraphIOProcessor* const proc(
new NamedAudioGraphIOProcessor(NamedAudioGraphIOProcessor::midiOutputNode));
@@ -2663,7 +2666,8 @@ EngineInternalGraph::~EngineInternalGraph() noexcept
}

void EngineInternalGraph::create(const uint32_t audioIns, const uint32_t audioOuts,
const uint32_t cvIns, const uint32_t cvOuts)
const uint32_t cvIns, const uint32_t cvOuts,
const bool withMidiIn, const bool withMidiOut)
{
fIsRack = (kEngine->getOptions().processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK);

@@ -2675,7 +2679,7 @@ void EngineInternalGraph::create(const uint32_t audioIns, const uint32_t audioOu
else
{
CARLA_SAFE_ASSERT_RETURN(fPatchbay == nullptr,);
fPatchbay = new PatchbayGraph(kEngine, audioIns, audioOuts, cvIns, cvOuts);
fPatchbay = new PatchbayGraph(kEngine, audioIns, audioOuts, cvIns, cvOuts, withMidiIn, withMidiOut);
}

fNumAudioOuts = audioOuts;


+ 2
- 1
source/backend/engine/CarlaEngineGraph.hpp View File

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

PatchbayGraph(CarlaEngine* engine,
uint32_t audioIns, uint32_t audioOuts,
uint32_t cvIns, uint32_t cvOuts);
uint32_t cvIns, uint32_t cvOuts,
bool withMidiIn, bool withMidiOut);
~PatchbayGraph();

void setBufferSize(uint32_t bufferSize);


+ 3
- 1
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -80,7 +80,9 @@ public:
EngineInternalGraph(CarlaEngine* engine) noexcept;
~EngineInternalGraph() noexcept;

void create(uint32_t audioIns, uint32_t audioOuts, uint32_t cvIns, uint32_t cvOuts);
void create(uint32_t audioIns, uint32_t audioOuts,
uint32_t cvIns, uint32_t cvOuts,
bool withMidiIn = true, bool withMidiOut = true);
void destroy() noexcept;

void setBufferSize(uint32_t bufferSize);


+ 17
- 13
source/backend/engine/CarlaEngineNative.cpp View File

@@ -101,7 +101,8 @@ private:
class CarlaEngineNative : public CarlaEngine
{
public:
CarlaEngineNative(const NativeHostDescriptor* const host, const bool isPatchbay, const bool withMidiOut,
CarlaEngineNative(const NativeHostDescriptor* const host, const bool isPatchbay,
const bool withMidiIn, const bool withMidiOut,
const uint32_t inChan = 2, uint32_t outChan = 2,
const uint32_t cvIns = 0, const uint32_t cvOuts = 0)
: CarlaEngine(),
@@ -114,6 +115,7 @@ public:
fJuceMsgMutex(),
#endif
kIsPatchbay(isPatchbay),
kHasMidiIn(withMidiIn),
kHasMidiOut(withMidiOut),
fIsActive(false),
fIsRunning(false),
@@ -158,7 +160,7 @@ public:
pData->options.preferPluginBridges = false;
pData->options.preferUiBridges = false;
init("Carla-Patchbay");
pData->graph.create(inChan, outChan, cvIns, cvOuts);
pData->graph.create(inChan, outChan, cvIns, cvOuts, withMidiIn, withMidiOut);
}
else
{
@@ -1154,6 +1156,7 @@ protected:
// ---------------------------------------------------------------
// events input (before processing)

if (kHasMidiIn)
{
uint32_t engineEventIndex = 0;

@@ -1545,57 +1548,57 @@ public:

static NativePluginHandle _instantiateRack(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, false, true);
return new CarlaEngineNative(host, false, true, true);
}

static NativePluginHandle _instantiateRackNoMidiOut(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, false, false);
return new CarlaEngineNative(host, false, true, false);
}

static NativePluginHandle _instantiatePatchbay(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true);
return new CarlaEngineNative(host, true, true, true);
}

static NativePluginHandle _instantiatePatchbay3s(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 3, 2);
return new CarlaEngineNative(host, true, true, true, 3, 2);
}

static NativePluginHandle _instantiatePatchbay16(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 16, 16);
return new CarlaEngineNative(host, true, true, true, 16, 16);
}

static NativePluginHandle _instantiatePatchbay32(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 32, 32);
return new CarlaEngineNative(host, true, true, true, 32, 32);
}

static NativePluginHandle _instantiatePatchbay64(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 64, 64);
return new CarlaEngineNative(host, true, true, true, 64, 64);
}

static NativePluginHandle _instantiatePatchbayCV(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 2, 2, 5, 5);
return new CarlaEngineNative(host, true, true, true, 2, 2, 5, 5);
}

static NativePluginHandle _instantiatePatchbayCV8(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 2, 2, 8, 8);
return new CarlaEngineNative(host, true, true, true, 2, 2, 8, 8);
}

static NativePluginHandle _instantiatePatchbayCV32(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 64, 64, 32, 32);
return new CarlaEngineNative(host, true, true, true, 64, 64, 32, 32);
}

static NativePluginHandle _instantiatePatchbayOBS(const NativeHostDescriptor* host)
{
return new CarlaEngineNative(host, true, true, 8, 8);
return new CarlaEngineNative(host, true, false, false, 8, 8);
}

static void _cleanup(NativePluginHandle handle)
@@ -1752,6 +1755,7 @@ private:
#endif

const bool kIsPatchbay; // rack if false
const bool kHasMidiIn;
const bool kHasMidiOut;
bool fIsActive, fIsRunning, fUsesEmbed;
#ifndef CARLA_ENGINE_WITHOUT_UI


Loading…
Cancel
Save