From 2a05540076d6aa012bec82bb005583f0548cbfe6 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 6 Mar 2013 17:17:21 +0000 Subject: [PATCH] More cleanup, fix last commit --- source/backend/engine/CarlaEngineJack.cpp | 2 - source/backend/plugin/CarlaPluginInternal.hpp | 72 +++++++++---------- source/backend/plugin/NativePlugin.cpp | 32 +++++---- source/carla.py | 2 +- 4 files changed, 55 insertions(+), 53 deletions(-) diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index e2a35ee44..9ceaf7936 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -1144,8 +1144,6 @@ protected: QString groupName = fullName.split(":").at(0); int groupId = getGroupId(groupName); - carla_stderr2("---------------------------------------------------- groupName: \"%s\", ID: %i", groupName.toUtf8().constData(), groupId); - const char* portName = jack_port_short_name(jackPort); if (reg) diff --git a/source/backend/plugin/CarlaPluginInternal.hpp b/source/backend/plugin/CarlaPluginInternal.hpp index d0600cefd..d0a11e78c 100644 --- a/source/backend/plugin/CarlaPluginInternal.hpp +++ b/source/backend/plugin/CarlaPluginInternal.hpp @@ -80,21 +80,21 @@ struct PluginAudioData { ~PluginAudioData() { - CARLA_ASSERT(count == 0); + CARLA_ASSERT_INT(count == 0, count); CARLA_ASSERT(ports == nullptr); } - void createNew(const uint32_t count) + void createNew(const uint32_t newCount) { - CARLA_ASSERT(count == 0); + CARLA_ASSERT_INT(count == 0, count); CARLA_ASSERT(ports == nullptr); + CARLA_ASSERT_INT(newCount > 0, newCount); - if (ports != nullptr) + if (ports != nullptr || newCount == 0) return; - ports = new PluginAudioPort[count]; - - this->count = count; + ports = new PluginAudioPort[newCount]; + count = newCount; } void clear() @@ -186,24 +186,24 @@ struct PluginParameterData { ~PluginParameterData() { - CARLA_ASSERT(count == 0); + CARLA_ASSERT_INT(count == 0, count); CARLA_ASSERT(data == nullptr); CARLA_ASSERT(ranges == nullptr); } - void createNew(const uint32_t count) + void createNew(const uint32_t newCount) { - CARLA_ASSERT(count == 0); + CARLA_ASSERT_INT(count == 0, count); CARLA_ASSERT(data == nullptr); CARLA_ASSERT(ranges == nullptr); + CARLA_ASSERT_INT(newCount > 0, newCount); - if (data != nullptr || ranges != nullptr) + if (data != nullptr || ranges != nullptr || newCount == 0) return; - data = new ParameterData[count]; - ranges = new ParameterRanges[count]; - - this->count = count; + data = new ParameterData[newCount]; + ranges = new ParameterRanges[newCount]; + count = newCount; } void clear() @@ -248,26 +248,26 @@ struct PluginProgramData { ~PluginProgramData() { - CARLA_ASSERT(count == 0); - CARLA_ASSERT(current == -1); + CARLA_ASSERT_INT(count == 0, count); + CARLA_ASSERT_INT(current == -1, current); CARLA_ASSERT(names == nullptr); } - void createNew(const uint32_t count) + void createNew(const uint32_t newCount) { - CARLA_ASSERT(count == 0); - CARLA_ASSERT(current == -1); + CARLA_ASSERT_INT(count == 0, count); + CARLA_ASSERT_INT(current == -1, current); CARLA_ASSERT(names == nullptr); + CARLA_ASSERT_INT(newCount > 0, newCount); - if (names != nullptr) + if (names != nullptr || newCount == 0) return; - names = new ProgramName[count]; + names = new ProgramName[newCount]; + count = newCount; - for (uint32_t i=0; i < count; i++) + for (uint32_t i=0; i < newCount; i++) names[i] = nullptr; - - this->count = count; } void clear() @@ -305,23 +305,23 @@ struct PluginMidiProgramData { ~PluginMidiProgramData() { - CARLA_ASSERT(count == 0); - CARLA_ASSERT(current == -1); + CARLA_ASSERT_INT(count == 0, count); + CARLA_ASSERT_INT(current == -1, current); CARLA_ASSERT(data == nullptr); } - void createNew(const uint32_t count) + void createNew(const uint32_t newCount) { - CARLA_ASSERT(count == 0); - CARLA_ASSERT(current == -1); + CARLA_ASSERT_INT(count == 0, count); + CARLA_ASSERT_INT(current == -1, current); CARLA_ASSERT(data == nullptr); + CARLA_ASSERT_INT(newCount > 0, newCount); - if (data != nullptr) + if (data != nullptr || newCount == 0) return; - data = new MidiProgramData[count]; - - this->count = count; + data = new MidiProgramData[newCount]; + count = newCount; } void clear() @@ -359,7 +359,7 @@ struct PluginPostRtEvent { value2(-1), value3(0.0f) {} -#ifdef DEBUG +#if 1//def DEBUG CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(PluginPostRtEvent) #else CARLA_DECLARE_NON_COPY_STRUCT(PluginPostRtEvent) @@ -378,7 +378,7 @@ struct ExternalMidiNote { note(0), velo(0) {} -#ifdef DEBUG +#if 1//def DEBUG CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(ExternalMidiNote) #else CARLA_DECLARE_NON_COPY_STRUCT(ExternalMidiNote) diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 9435b5606..5df645a10 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -35,28 +35,32 @@ struct NativePluginMidiData { indexes(nullptr), ports(nullptr) {} - void createNew(const uint32_t count) + ~NativePluginMidiData() { + CARLA_ASSERT_INT(count == 0, count); CARLA_ASSERT(ports == nullptr); CARLA_ASSERT(indexes == nullptr); + } - if (ports == nullptr) - { - ports = new CarlaEngineEventPort*[count]; + void createNew(const uint32_t newCount) + { + CARLA_ASSERT_INT(count == 0, count); + CARLA_ASSERT(ports == nullptr); + CARLA_ASSERT(indexes == nullptr); + CARLA_ASSERT_INT(newCount > 0, newCount); - for (uint32_t i=0; i < count; i++) - ports[i] = nullptr; - } + if (ports != nullptr || indexes != nullptr || newCount == 0) + return; - if (indexes == nullptr) - { - indexes = new uint32_t[count]; + ports = new CarlaEngineEventPort*[newCount]; + indexes = new uint32_t[newCount]; + count = newCount; - for (uint32_t i=0; i < count; i++) - indexes[i] = 0; - } + for (uint32_t i=0; i < newCount; i++) + ports[i] = nullptr; - this->count = count; + for (uint32_t i=0; i < newCount; i++) + indexes[i] = 0; } void clear() diff --git a/source/carla.py b/source/carla.py index 407a7ddaa..eaf229720 100755 --- a/source/carla.py +++ b/source/carla.py @@ -588,7 +588,7 @@ class CarlaMainW(QMainWindow): patchcanvas.setOptions(pOptions) patchcanvas.setFeatures(pFeatures) - patchcanvas.init("Carla", self.scene, canvasCallback, True) + patchcanvas.init("Carla", self.scene, canvasCallback, False) patchcanvas.setCanvasSize(0, 0, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT) patchcanvas.setInitialPos(DEFAULT_CANVAS_WIDTH / 2, DEFAULT_CANVAS_HEIGHT / 2)