Browse Source

Rework some patchbay code, shared common stuff

tags/1.9.4
falkTX 11 years ago
parent
commit
5a12b4bd3e
9 changed files with 267 additions and 543 deletions
  1. +1
    -1
      source/backend/CarlaHost.h
  2. +6
    -6
      source/backend/engine/CarlaEngine.cpp
  3. +1
    -2
      source/backend/engine/CarlaEngineInternal.cpp
  4. +8
    -21
      source/backend/engine/CarlaEngineInternal.hpp
  5. +237
    -499
      source/backend/engine/CarlaEngineJack.cpp
  6. +5
    -5
      source/backend/engine/CarlaEngineNative.cpp
  7. +6
    -6
      source/backend/engine/Makefile
  8. +2
    -2
      source/backend/standalone/CarlaStandalone.cpp
  9. +1
    -1
      source/carla_backend.py

+ 1
- 1
source/backend/CarlaHost.h View File

@@ -499,7 +499,7 @@ CARLA_EXPORT bool carla_save_project(const char* filename);
* @param portIdB Input port
* @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
*/
CARLA_EXPORT bool carla_patchbay_connect(int groupIdA, int portIdA, int groupIdB, int portIdB);
CARLA_EXPORT bool carla_patchbay_connect(uint groupIdA, uint portIdA, uint groupIdB, uint portIdB);

/*!
* Disconnect two patchbay ports.


+ 6
- 6
source/backend/engine/CarlaEngine.cpp View File

@@ -616,7 +616,7 @@ uint CarlaEngine::getDriverCount()
if (jackbridge_is_ok())
count += 1;

#ifndef BUILD_BRIDGE
#if 0 //ndef BUILD_BRIDGE
count += getRtAudioApiCount();
# ifdef HAVE_JUCE
count += getJuceApiCount();
@@ -635,7 +635,7 @@ const char* CarlaEngine::getDriverName(const uint index2)
if (jackbridge_is_ok() && index-- == 0)
return "JACK";

#ifndef BUILD_BRIDGE
#if 0 //ndef BUILD_BRIDGE
if (index < getRtAudioApiCount())
return getRtAudioApiName(index);

@@ -663,7 +663,7 @@ const char* const* CarlaEngine::getDriverDeviceNames(const uint index2)
return ret;
}

#ifndef BUILD_BRIDGE
#if 0 //ndef BUILD_BRIDGE
if (index < getRtAudioApiCount())
return getRtAudioApiDeviceNames(index);

@@ -695,7 +695,7 @@ const EngineDriverDeviceInfo* CarlaEngine::getDriverDeviceInfo(const uint index2
return &devInfo;
}

#ifndef BUILD_BRIDGE
#if 0 //ndef BUILD_BRIDGE
if (index < getRtAudioApiCount())
return getRtAudioDeviceInfo(index, deviceName);

@@ -719,7 +719,7 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName)
if (std::strcmp(driverName, "JACK") == 0)
return newJack();

#ifndef BUILD_BRIDGE
#if 0 //ndef BUILD_BRIDGE
// -------------------------------------------------------------------
// common

@@ -1988,7 +1988,7 @@ bool CarlaEngine::patchbayDisconnect(const uint connectionId)
{
CARLA_SAFE_ASSERT_RETURN(pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY, false);
CARLA_SAFE_ASSERT_RETURN(pData->audio.isReady, false);
carla_debug("CarlaEngineRtAudio::patchbayDisconnect(%u)", connectionId);
carla_debug("CarlaEngine::patchbayDisconnect(%u)", connectionId);

if (pData->graph.isRack)
{


+ 1
- 2
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -146,7 +146,7 @@ bool RackGraph::connect(CarlaEngine* const engine, const uint groupA, const uint
return false;
}

ConnectionToId connectionToId = { lastConnectionId++, groupA, portA, groupB, portB };
ConnectionToId connectionToId = { ++lastConnectionId, groupA, portA, groupB, portB };

char strBuf[STR_MAX+1];
strBuf[STR_MAX] = '\0';
@@ -155,7 +155,6 @@ bool RackGraph::connect(CarlaEngine* const engine, const uint groupA, const uint
engine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf);

audio.usedConnections.append(connectionToId);

return true;
}



+ 8
- 21
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -23,8 +23,8 @@
#include "CarlaEngineThread.hpp"

#include "CarlaMathUtils.hpp"
#include "CarlaPatchbayUtils.hpp"
#include "CarlaMutex.hpp"
#include "LinkedList.hpp"

// -----------------------------------------------------------------------
// Engine helper macro, sets lastError and returns false/NULL
@@ -45,6 +45,13 @@ CARLA_BACKEND_START_NAMESPACE

const ushort kMaxEngineEventInternalCount = 512;

// -----------------------------------------------------------------------
// Patchbay stuff

struct GroupPort {
uint group, port;
};

#ifndef BUILD_BRIDGE
// -----------------------------------------------------------------------
// Rack Graph stuff
@@ -69,26 +76,6 @@ enum RackGraphCarlaPortIds {
RACK_GRAPH_CARLA_PORT_MAX = 7
};

struct GroupNameToId {
uint group;
char name[STR_MAX+1];
};

struct PortNameToId {
uint port;
char name[STR_MAX+1];
};

struct ConnectionToId {
uint id;
uint groupA, portA;
uint groupB, portB;
};

struct GroupPort {
uint group, port;
};

// -----------------------------------------------------------------------
// RackGraph



+ 237
- 499
source/backend/engine/CarlaEngineJack.cpp
File diff suppressed because it is too large
View File


+ 5
- 5
source/backend/engine/CarlaEngineNative.cpp View File

@@ -126,12 +126,12 @@ protected:
}
else if (std::strcmp(msg, "patchbay_connect") == 0)
{
int32_t groupA, portA, groupB, portB;
uint32_t groupA, portA, groupB, portB;

CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(groupA), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(portA), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(groupB), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(portB), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(groupA), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(portA), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(groupB), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(portB), true);

try {
ok = fEngine->patchbayConnect(groupA, portA, groupB, portB);


+ 6
- 6
source/backend/engine/Makefile View File

@@ -15,13 +15,13 @@ OBJS = \
CarlaEngineThread.cpp.o

OBJSa = $(OBJS) \
CarlaEngineJack.cpp.o \
CarlaEngineRtAudio.cpp.o
CarlaEngineJack.cpp.o
# CarlaEngineRtAudio.cpp.o

ifeq ($(HAVE_JUCE),true)
OBJSa += \
CarlaEngineJuce.cpp.o
endif
# ifeq ($(HAVE_JUCE),true)
# OBJSa += \
# CarlaEngineJuce.cpp.o
# endif

ifneq ($(WIN32),true)
OBJSa += \


+ 2
- 2
source/backend/standalone/CarlaStandalone.cpp View File

@@ -1209,9 +1209,9 @@ bool carla_save_project(const char* filename)
#ifndef BUILD_BRIDGE
// -------------------------------------------------------------------------------------------------------------------

bool carla_patchbay_connect(int groupIdA, int portIdA, int groupIdB, int portIdB)
bool carla_patchbay_connect(uint groupIdA, uint portIdA, uint groupIdB, uint portIdB)
{
carla_debug("carla_patchbay_connect(%i, %i, %i, %i)", groupIdA, portIdA, groupIdB, portIdB);
carla_debug("carla_patchbay_connect(%u, %u, %u, %u)", groupIdA, portIdA, groupIdB, portIdB);

if (gStandalone.engine != nullptr)
return gStandalone.engine->patchbayConnect(groupIdA, portIdA, groupIdB, portIdB);


+ 1
- 1
source/carla_backend.py View File

@@ -1812,7 +1812,7 @@ class Host(object):
self.lib.carla_save_project.argtypes = [c_char_p]
self.lib.carla_save_project.restype = c_bool

self.lib.carla_patchbay_connect.argtypes = [c_int, c_int, c_int, c_int]
self.lib.carla_patchbay_connect.argtypes = [c_uint, c_uint, c_uint, c_uint]
self.lib.carla_patchbay_connect.restype = c_bool

self.lib.carla_patchbay_disconnect.argtypes = [c_uint]


Loading…
Cancel
Save