Browse Source

Cleanup

tags/1.9.4
falkTX 10 years ago
parent
commit
c4ad37bb1c
13 changed files with 91 additions and 49 deletions
  1. +1
    -1
      source/Makefile.mk
  2. +53
    -22
      source/backend/engine/CarlaEngineJack.cpp
  3. +7
    -7
      source/backend/engine/CarlaEngineOsc.cpp
  4. +2
    -2
      source/backend/engine/CarlaEngineRtAudio.cpp
  5. +3
    -4
      source/backend/engine/CarlaEngineThread.cpp
  6. +5
    -3
      source/includes/CarlaDefines.h
  7. +4
    -4
      source/modules/daz-plugins/Makefile
  8. +2
    -2
      source/modules/dgl/Makefile
  9. +1
    -1
      source/modules/rtaudio/Makefile
  10. +1
    -1
      source/modules/rtmidi/Makefile
  11. +1
    -1
      source/modules/stk/Makefile
  12. +1
    -1
      source/modules/theme/Makefile
  13. +10
    -0
      source/utils/CarlaUtils.hpp

+ 1
- 1
source/Makefile.mk View File

@@ -51,7 +51,7 @@ CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual
ifeq ($(LINUX),true)
CFLAGS += -isystem /opt/kxstudio/include
CXXFLAGS += -isystem /opt/kxstudio/include
CXXFLAGS += -isystem /opt/kxstudio/include -isystem /usr/include/qt4
endif
ifeq ($(MACOS),true)
CFLAGS += -isystem /opt/local/include/


+ 53
- 22
source/backend/engine/CarlaEngineJack.cpp View File

@@ -58,6 +58,9 @@ public:
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS)
{
CARLA_ASSERT(client != nullptr && port != nullptr);

if (jack_uuid_t uuid = jackbridge_port_uuid(port))
jackbridge_set_property(client, uuid, "urn:jack:IsControlVoltage", "NO", "text/plain");
}
else
{
@@ -115,6 +118,9 @@ public:
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS)
{
CARLA_ASSERT(client != nullptr && port != nullptr);

if (jack_uuid_t uuid = jackbridge_port_uuid(port))
jackbridge_set_property(client, uuid, "urn:jack:IsControlVoltage", "YES", "text/plain");
}
else
{
@@ -402,7 +408,7 @@ public:
port = jackbridge_port_register(fClient, name, JACK_DEFAULT_AUDIO_TYPE, isInput ? JackPortIsInput : JackPortIsOutput, 0);
break;
case kEnginePortTypeCV:
port = jackbridge_port_register(fClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsControlVoltage | (isInput ? JackPortIsInput : JackPortIsOutput), 0);
port = jackbridge_port_register(fClient, name, JACK_DEFAULT_AUDIO_TYPE, isInput ? JackPortIsInput : JackPortIsOutput, 0);
break;
case kEnginePortTypeEvent:
port = jackbridge_port_register(fClient, name, JACK_DEFAULT_MIDI_TYPE, isInput ? JackPortIsInput : JackPortIsOutput, 0);
@@ -410,6 +416,12 @@ public:
}
}

if (port == nullptr)
{
carla_stderr("CarlaEngineJackClient::addPort(%s, \"%s\", %s) - failed to create JACK port", EnginePortType2Str(portType), name, bool2str(isInput));
return nullptr;
}

// Create Engine port
switch (portType)
{
@@ -1232,14 +1244,14 @@ protected:

const int id(getGroupId(name)); // also checks name nullness

if (id == -1)
if (id < 0)
return;

GroupNameToId groupNameToId;
groupNameToId.setData(id, name);
fUsedGroupNames.removeAll(groupNameToId);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED, id, 0, 0, 0.0f, nullptr);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED, static_cast<uint>(id), 0, 0, 0.0f, nullptr);
}

void handleJackPortRegistrationCallback(const jack_port_id_t port, const bool reg)
@@ -1261,9 +1273,10 @@ protected:
{
const int jackPortFlags(jackbridge_port_flags(jackPort));

if (groupId == -1)
if (groupId < 0)
{
groupId = fLastGroupId++;
CARLA_SAFE_ASSERT_RETURN(groupId >= 0,);

GroupNameToId groupNameToId;
groupNameToId.setData(groupId, groupName);
@@ -1271,12 +1284,12 @@ protected:

if (jackPortFlags & JackPortIsPhysical)
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupId, PATCHBAY_ICON_HARDWARE, 0, 0.0f, groupName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), PATCHBAY_ICON_HARDWARE, 0, 0.0f, groupName);
// hardware
}
else
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupId, 0, 0, 0.0f, groupName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), 0, 0, 0.0f, groupName);
//fGroupIconsChanged.append(groupId);
// "application"
}
@@ -1284,7 +1297,16 @@ protected:

bool portIsInput = (jackPortFlags & JackPortIsInput);
bool portIsAudio = (std::strcmp(jackbridge_port_type(jackPort), JACK_DEFAULT_AUDIO_TYPE) == 0);
bool portIsCV = (jackPortFlags & JackPortIsControlVoltage);
bool portIsCV = false;

if (jack_uuid_t uuid = jackbridge_port_uuid(jackPort))
{
char* value = nullptr;
char* type = nullptr;

if (jackbridge_get_property(uuid, "urn:jack:IsControlVoltage", &value, &type) && value != nullptr && type != nullptr && std::strcmp(type, "text/plain") == 0)
portIsCV = (std::strcmp(value, "YES") == 0);
}

unsigned int canvasPortFlags = 0x0;
canvasPortFlags |= portIsInput ? PATCHBAY_PORT_IS_INPUT : 0x0;
@@ -1297,20 +1319,20 @@ protected:
portNameToId.setData(groupId, fLastPortId++, portName, fullPortName);
fUsedPortNames.append(portNameToId);

callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, groupId, portNameToId.portId, canvasPortFlags, 0.0f, portName);
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, static_cast<uint>(groupId), portNameToId.portId, static_cast<int>(canvasPortFlags), 0.0f, portName);
}
else
{
const int portId(getPortId(fullPortName));

CARLA_SAFE_ASSERT_RETURN(groupId != -1,);
CARLA_SAFE_ASSERT_RETURN(portId != -1,);
CARLA_SAFE_ASSERT_RETURN(groupId >= 0,);
CARLA_SAFE_ASSERT_RETURN(portId >= 0,);

PortNameToId portNameToId;
portNameToId.setData(groupId, portId, portName, fullPortName);
fUsedPortNames.removeOne(portNameToId);

callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, groupId, portId, 0, 0.0f, nullptr);
callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, static_cast<uint>(groupId), portId, 0, 0.0f, nullptr);
}
}

@@ -1338,7 +1360,7 @@ protected:
connectionToId.setData(fLastConnectionId++, portIdA, portIdB);
fUsedConnections.append(connectionToId);

callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr);
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, static_cast<uint>(connectionToId.id), connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr);
}
else
{
@@ -1348,7 +1370,7 @@ protected:

if (connectionToId.portOut == portIdA && connectionToId.portIn == portIdB)
{
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connectionToId.id, connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr);
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, static_cast<uint>(connectionToId.id), connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr);
fUsedConnections.remove(it);
break;
}
@@ -1365,7 +1387,7 @@ protected:
if (std::strcmp(groupNameToId.name, oldName) == 0)
{
groupNameToId.rename(newName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED, groupNameToId.id, 0, 0, 0.0f, newName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED, static_cast<uint>(groupNameToId.id), 0, 0, 0.0f, newName);
break;
}
}
@@ -1384,7 +1406,7 @@ protected:

const int groupId(getGroupId(groupName));

CARLA_SAFE_ASSERT_RETURN(groupId != -1,);
CARLA_SAFE_ASSERT_RETURN(groupId >= 0,);

for (LinkedList<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next())
{
@@ -1394,7 +1416,7 @@ protected:
{
CARLA_SAFE_ASSERT(portNameId.groupId == groupId);
portNameId.rename(portName, newName);
callback(ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED, groupId, portNameId.portId, 0, 0.0f, newName);
callback(ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED, static_cast<uint>(groupId), portNameId.portId, 0, 0.0f, newName);
break;
}
}
@@ -1653,7 +1675,7 @@ private:
groupNameToId.setData(fLastGroupId++, ourName);
fUsedGroupNames.append(groupNameToId);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupNameToId.id, PATCHBAY_ICON_CARLA, 0, 0.0f, ourName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0 /* our client */, PATCHBAY_ICON_CARLA, 0, 0.0f, ourName);
}

if (const char** ports = jackbridge_get_ports(fClient, nullptr, nullptr, 0))
@@ -1682,7 +1704,7 @@ private:
if (parsedGroups.contains(qGroupName))
{
groupId = getGroupId(groupName);
CARLA_SAFE_ASSERT(groupId != -1);
CARLA_SAFE_ASSERT(groupId >= 0);
}
else
{
@@ -1725,12 +1747,21 @@ private:
}
#endif

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupId, groupIcon, 0, 0.0f, groupName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), groupIcon, 0, 0.0f, groupName);
}

bool portIsInput = (jackPortFlags & JackPortIsInput);
bool portIsAudio = (std::strcmp(jackbridge_port_type(jackPort), JACK_DEFAULT_AUDIO_TYPE) == 0);
bool portIsCV = (portIsAudio && (jackPortFlags & JackPortIsControlVoltage) != 0);
bool portIsCV = false;

if (jack_uuid_t uuid = jackbridge_port_uuid(jackPort))
{
char* value = nullptr;
char* type = nullptr;

if (jackbridge_get_property(uuid, "urn:jack:IsControlVoltage", &value, &type) && value != nullptr && type != nullptr && std::strcmp(type, "text/plain") == 0)
portIsCV = (std::strcmp(value, "YES") == 0);
}

unsigned int canvasPortFlags = 0x0;
canvasPortFlags |= portIsInput ? PATCHBAY_PORT_IS_INPUT : 0x0;
@@ -1743,7 +1774,7 @@ private:
portNameToId.setData(groupId, fLastPortId++, portName, fullPortName);
fUsedPortNames.append(portNameToId);

callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, groupId, portNameToId.portId, canvasPortFlags, 0.0f, portName);
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, static_cast<uint>(groupId), portNameToId.portId, static_cast<int>(canvasPortFlags), 0.0f, portName);
}

// query connections, after all ports are in place
@@ -1767,7 +1798,7 @@ private:
connectionToId.setData(fLastConnectionId++, thisPortId, targetPortId);
fUsedConnections.append(connectionToId);

callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr);
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, static_cast<uint>(connectionToId.id), connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr);
}

jackbridge_free(connections);


+ 7
- 7
source/backend/engine/CarlaEngineOsc.cpp View File

@@ -200,7 +200,7 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
}

// Get plugin id from path, "/carla/23/method" -> 23
unsigned int pluginId = 0;
uint pluginId = 0;
size_t offset;

if (isDigit(path[nameSize+2]))
@@ -216,23 +216,23 @@ int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, cons
{
// 3 digits, /xyz/method
offset = 6;
pluginId += (path[nameSize+2]-'0')*100;
pluginId += (path[nameSize+3]-'0')*10;
pluginId += (path[nameSize+4]-'0');
pluginId += uint(path[nameSize+2]-'0')*100;
pluginId += uint(path[nameSize+3]-'0')*10;
pluginId += uint(path[nameSize+4]-'0');
}
else
{
// 2 digits, /xy/method
offset = 5;
pluginId += (path[nameSize+2]-'0')*10;
pluginId += (path[nameSize+3]-'0');
pluginId += uint(path[nameSize+2]-'0')*10;
pluginId += uint(path[nameSize+3]-'0');
}
}
else
{
// single digit, /x/method
offset = 4;
pluginId += path[nameSize+2]-'0';
pluginId += uint(path[nameSize+2]-'0');
}
}
else


+ 2
- 2
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -62,7 +62,7 @@ static void initRtApis()
}
}

const char* getRtAudioApiName(const RtAudio::Api api)
static const char* getRtAudioApiName(const RtAudio::Api api)
{
switch (api)
{
@@ -98,7 +98,7 @@ const char* getRtAudioApiName(const RtAudio::Api api)
return nullptr;
}

RtMidi::Api getMatchedAudioMidiAPi(const RtAudio::Api rtApi)
static RtMidi::Api getMatchedAudioMidiAPi(const RtAudio::Api rtApi)
{
switch (rtApi)
{


+ 3
- 4
source/backend/engine/CarlaEngineThread.cpp View File

@@ -55,13 +55,12 @@ void CarlaEngineThread::run()
oscRegisted = fEngine->isOscControlRegistered();
#endif

for (unsigned int i=0, count = fEngine->getCurrentPluginCount(); i < count; ++i)
for (uint i=0, count = fEngine->getCurrentPluginCount(); i < count; ++i)
{
CarlaPlugin* const plugin(fEngine->getPluginUnchecked(i));

CARLA_SAFE_ASSERT_CONTINUE(plugin != nullptr && plugin->isEnabled());

CARLA_SAFE_ASSERT_INT2(i == plugin->getId(), i, plugin->getId());
CARLA_SAFE_ASSERT_UINT2(i == plugin->getId(), i, plugin->getId());

needsSingleThread = (plugin->getHints() & PLUGIN_NEEDS_SINGLE_THREAD);

@@ -93,7 +92,7 @@ void CarlaEngineThread::run()
#ifdef BUILD_BRIDGE
fEngine->oscSend_bridge_parameter_value(j, value);
#else
fEngine->oscSend_control_set_parameter_value(i, j, value);
fEngine->oscSend_control_set_parameter_value(i, static_cast<int32_t>(j), value);
#endif
}
}


+ 5
- 3
source/includes/CarlaDefines.h View File

@@ -137,9 +137,11 @@
#endif

/* Define CARLA_SAFE_ASSERT* */
#define CARLA_SAFE_ASSERT(cond) if (cond) pass(); else carla_safe_assert (#cond, __FILE__, __LINE__);
#define CARLA_SAFE_ASSERT_INT(cond, value) if (cond) pass(); else carla_safe_assert_int (#cond, __FILE__, __LINE__, value);
#define CARLA_SAFE_ASSERT_INT2(cond, v1, v2) if (cond) pass(); else carla_safe_assert_int2(#cond, __FILE__, __LINE__, v1, v2);
#define CARLA_SAFE_ASSERT(cond) if (cond) pass(); else carla_safe_assert (#cond, __FILE__, __LINE__);
#define CARLA_SAFE_ASSERT_INT(cond, value) if (cond) pass(); else carla_safe_assert_int (#cond, __FILE__, __LINE__, value);
#define CARLA_SAFE_ASSERT_INT2(cond, v1, v2) if (cond) pass(); else carla_safe_assert_int2 (#cond, __FILE__, __LINE__, v1, v2);
#define CARLA_SAFE_ASSERT_UINT(cond, value) if (cond) pass(); else carla_safe_assert_uint (#cond, __FILE__, __LINE__, value);
#define CARLA_SAFE_ASSERT_UINT2(cond, v1, v2) if (cond) pass(); else carla_safe_assert_uint2(#cond, __FILE__, __LINE__, v1, v2);

#define CARLA_SAFE_ASSERT_BREAK(cond) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); break; }
#define CARLA_SAFE_ASSERT_CONTINUE(cond) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); continue; }


+ 4
- 4
source/modules/daz-plugins/Makefile View File

@@ -1,6 +1,6 @@
#!/usr/bin/make -f
# Makefile for daz-plugins #
# ---------------- #
# ------------------------ #
# Created by falkTX
#

@@ -14,7 +14,7 @@ BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils -I../distrho -isystem ..
# --------------------------------------------------------------

LINK_FLAGS += -L..
ifeq ($(HAVE_OPENGL),true)
ifeq ($(HAVE_DGL),true)
LINK_FLAGS += -ldgl $(DGL_LIBS)
endif
ifeq ($(HAVE_JUCE),true)
@@ -67,7 +67,7 @@ endif

# ZynAddSubFX
ifeq ($(HAVE_ZYN_DEPS),true)
ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS) -w
ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS)
ZYN_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml zlib)
LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib)
ifeq ($(HAVE_ZYN_UI_DEPS),true)
@@ -264,7 +264,7 @@ midi-sequencer.cpp.o: midi-sequencer.cpp midi-base.hpp $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

vex-%.cpp.o: vex-%.cpp
$(CXX) $< $(BUILD_CXX_FLAGS) -w -c -o $@
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

zynaddsubfx-%.cpp.o: zynaddsubfx-%.cpp $(CXXDEPS) $(ZYN_UI_FILES_H)
$(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@


+ 2
- 2
source/modules/dgl/Makefile View File

@@ -8,8 +8,8 @@ include ../../Makefile.mk

# --------------------------------------------------------------

BUILD_C_FLAGS += $(DGL_FLAGS) -I. -w
BUILD_CXX_FLAGS += $(DGL_FLAGS) -I. -w
BUILD_C_FLAGS += $(DGL_FLAGS) -I.
BUILD_CXX_FLAGS += $(DGL_FLAGS) -I.
LINK_FLAGS += $(DGL_LIBS)

OBJS = \


+ 1
- 1
source/modules/rtaudio/Makefile View File

@@ -8,7 +8,7 @@ include ../../Makefile.mk

# --------------------------------------------------------------

BUILD_CXX_FLAGS += $(RTAUDIO_FLAGS) -I. -Iinclude -I.. -I../../includes -w
BUILD_CXX_FLAGS += $(RTAUDIO_FLAGS) -I. -Iinclude -I.. -I../../includes
LINK_FLAGS += $(RTAUDIO_LIBS) -L.. -ljackbridge

OBJS = RtAudio.cpp.o


+ 1
- 1
source/modules/rtmidi/Makefile View File

@@ -8,7 +8,7 @@ include ../../Makefile.mk

# --------------------------------------------------------------

BUILD_CXX_FLAGS += $(RTMIDI_FLAGS) -I. -Iinclude -I.. -I../../includes -w
BUILD_CXX_FLAGS += $(RTMIDI_FLAGS) -I. -Iinclude -I.. -I../../includes
LINK_FLAGS += $(RTMIDI_LIBS)

OBJS = RtMidi.cpp.o


+ 1
- 1
source/modules/stk/Makefile View File

@@ -12,7 +12,7 @@ BUILD_CXX_FLAGS += $(STK_FLAGS) -I.
LINK_FLAGS += $(STK_LIBS)

ifeq ($(MACOS),true)
BUILD_CXX_FLAGS += -objc++
BUILD_CXX_FLAGS += -ObjC++
OBJS = stk.mm.o
OBJS_posix32 = stk.mm.posix32.o
OBJS_posix64 = stk.mm.posix64.o


+ 1
- 1
source/modules/theme/Makefile View File

@@ -8,7 +8,7 @@ include ../../Makefile.mk

# --------------------------------------------------------------

BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils -w
BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils

ifeq ($(HAVE_QT4),true)
QT4_CXX_FLAGS = $(BUILD_CXX_FLAGS)


+ 10
- 0
source/utils/CarlaUtils.hpp View File

@@ -147,6 +147,11 @@ void carla_safe_assert_int(const char* const assertion, const char* const file,
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, value %i", assertion, file, line, value);
}
static inline
void carla_safe_assert_uint(const char* const assertion, const char* const file, const int line, const uint value) noexcept
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, value %u", assertion, file, line, value);
}

/*
* Print a safe assertion error message, with 2 extra integer values.
@@ -156,6 +161,11 @@ void carla_safe_assert_int2(const char* const assertion, const char* const file,
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, v1 %i, v2 %i", assertion, file, line, v1, v2);
}
static inline
void carla_safe_assert_uint2(const char* const assertion, const char* const file, const int line, const uint v1, const uint v2) noexcept
{
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, v1 %u, v2 %u", assertion, file, line, v1, v2);
}

// -----------------------------------------------------------------------
// carla_*sleep


Loading…
Cancel
Save