| @@ -17,12 +17,14 @@ WINDRES ?= windres | |||
| DEBUG ?= false | |||
| BASE_FLAGS = -Wall -Wextra | |||
| ifeq ($(DEBUG),true) | |||
| BASE_FLAGS = -O0 -g | |||
| BASE_FLAGS += -O0 -g | |||
| BASE_FLAGS += -DDEBUG | |||
| STRIP = true # FIXME | |||
| else | |||
| BASE_FLAGS = -O2 -ffast-math -mtune=generic -msse -mfpmath=sse | |||
| BASE_FLAGS += -O2 -ffast-math -mtune=generic -msse -mfpmath=sse | |||
| BASE_FLAGS += -DNDEBUG | |||
| endif | |||
| @@ -819,11 +819,10 @@ void CarlaEngine::removeAllPlugins() | |||
| const unsigned int oldCount = fData->curPluginCount; | |||
| // wait for processing | |||
| // TODO | |||
| fData->curPluginCount = 0; | |||
| fData->maxPluginNumber = 0; | |||
| // wait for processing | |||
| waitForProccessEnd(); | |||
| for (unsigned int i=0; i < oldCount; i++) | |||
| { | |||
| @@ -146,7 +146,7 @@ public: | |||
| if (! kIsInput) | |||
| return 0; | |||
| if (fJackBuffer != nullptr) | |||
| if (fJackBuffer == nullptr) | |||
| return 0; | |||
| return jackbridge_midi_get_event_count(fJackBuffer); | |||
| @@ -717,6 +717,8 @@ protected: | |||
| void handleJackProcessCallback(const uint32_t nframes) | |||
| { | |||
| proccessPendingEvents(); | |||
| #ifndef BUILD_BRIDGE | |||
| if (fData->curPluginCount == 0) | |||
| return; | |||
| @@ -944,8 +946,6 @@ protected: | |||
| #endif | |||
| } | |||
| #endif | |||
| proccessPendingEvents(); | |||
| } | |||
| void handleJackLatencyCallback(const jack_latency_callback_mode_t mode) | |||
| @@ -44,12 +44,19 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned int id) | |||
| CARLA_ASSERT(id < engine->maxPluginNumber()); | |||
| qDebug("CarlaPlugin::CarlaPlugin(%p, %i)", engine, id); | |||
| if (engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK) | |||
| switch (engine->getProccessMode()) | |||
| { | |||
| case PROCESS_MODE_SINGLE_CLIENT: | |||
| case PROCESS_MODE_MULTIPLE_CLIENTS: | |||
| fData->ctrlInChannel = 0; | |||
| break; | |||
| case PROCESS_MODE_CONTINUOUS_RACK: | |||
| CARLA_ASSERT(id < MAX_RACK_PLUGINS && id < MAX_MIDI_CHANNELS); | |||
| if (id < MAX_RACK_PLUGINS && id < MAX_MIDI_CHANNELS) | |||
| fData->ctrlInChannel = id; | |||
| break; | |||
| } | |||
| } | |||
| @@ -1201,7 +1208,8 @@ void CarlaPlugin::postRtEventsRun() | |||
| while (! fData->postRtEvents.data.isEmpty()) | |||
| { | |||
| PluginPostRtEvent& event = fData->postRtEvents.data.getFirst(true); | |||
| listData[i++] = event; | |||
| //listData[i++] = event; | |||
| std::memcpy(&listData[i++], &event, sizeof(PluginPostRtEvent)); | |||
| } | |||
| fData->postRtEvents.mutex.unlock(); | |||
| @@ -1211,6 +1219,9 @@ void CarlaPlugin::postRtEventsRun() | |||
| { | |||
| const PluginPostRtEvent* const event = &listData[i]; | |||
| if (event->type != kPluginPostRtEventNull) | |||
| qWarning("postRtEventsRun() - event type %i", i); | |||
| switch (event->type) | |||
| { | |||
| case kPluginPostRtEventNull: | |||
| @@ -73,7 +73,7 @@ struct PluginAudioData { | |||
| CARLA_ASSERT(ports == nullptr); | |||
| } | |||
| void createNew(const size_t count) | |||
| void createNew(const uint32_t count) | |||
| { | |||
| CARLA_ASSERT(ports == nullptr); | |||
| @@ -176,7 +176,7 @@ struct PluginParameterData { | |||
| CARLA_ASSERT(ranges == nullptr); | |||
| } | |||
| void createNew(const size_t count) | |||
| void createNew(const uint32_t count) | |||
| { | |||
| CARLA_ASSERT(data == nullptr); | |||
| CARLA_ASSERT(ranges == nullptr); | |||
| @@ -321,7 +321,7 @@ public: | |||
| explicit CarlaString(const int value) | |||
| { | |||
| const size_t strBufSize = (unsigned int)std::abs(value/10) + 3; | |||
| const size_t strBufSize = std::abs(value/10) + 3; | |||
| char strBuf[strBufSize]; | |||
| std::snprintf(strBuf, strBufSize, "%d", value); | |||
| @@ -341,7 +341,7 @@ public: | |||
| explicit CarlaString(const long int value) | |||
| { | |||
| const size_t strBufSize = (unsigned long)std::abs(value/10) + 3; | |||
| const size_t strBufSize = std::abs(value/10) + 3; | |||
| char strBuf[strBufSize]; | |||
| std::snprintf(strBuf, strBufSize, "%ld", value); | |||
| @@ -364,6 +364,7 @@ public: | |||
| char strBuf[0xff]; | |||
| std::snprintf(strBuf, 0xff, "%f", value); | |||
| _init(); | |||
| _dup(strBuf); | |||
| } | |||
| @@ -418,8 +419,6 @@ public: | |||
| { | |||
| if (strBuf == nullptr) | |||
| return false; | |||
| if (bufferLen == 0) | |||
| return false; | |||
| if (ignoreCase) | |||
| return (std::strcasestr(buffer, strBuf) != nullptr); | |||
| @@ -436,8 +435,6 @@ public: | |||
| { | |||
| if (strBuf == nullptr) | |||
| return false; | |||
| if (bufferLen == 0) | |||
| return false; | |||
| return (std::strstr(buffer, strBuf) != nullptr); | |||
| } | |||
| @@ -477,11 +474,13 @@ public: | |||
| void truncate(const size_t n) | |||
| { | |||
| if (n >= bufferLen) | |||
| return; | |||
| for (size_t i=n; i < bufferLen; i++) | |||
| buffer[i] = '\0'; | |||
| // FIXME | |||
| bufferLen = std::strlen(buffer); | |||
| bufferLen = n; | |||
| } | |||
| void toBasic() | |||
| @@ -570,13 +569,13 @@ public: | |||
| CarlaString& operator+=(const char* const strBuf) | |||
| { | |||
| const size_t newBufSize = std::strlen(buffer) + ((strBuf != nullptr) ? std::strlen(strBuf) : 0) + 1; | |||
| const size_t newBufSize = bufferLen + ((strBuf != nullptr) ? std::strlen(strBuf) : 0) + 1; | |||
| char newBuf[newBufSize]; | |||
| std::strcpy(newBuf, buffer); | |||
| std::strcat(newBuf, strBuf); | |||
| _dup(newBuf, newBufSize); | |||
| _dup(newBuf, newBufSize-1); | |||
| return *this; | |||
| } | |||
| @@ -588,7 +587,7 @@ public: | |||
| CarlaString operator+(const char* const strBuf) | |||
| { | |||
| const size_t newBufSize = std::strlen(buffer) + ((strBuf != nullptr) ? std::strlen(strBuf) : 0) + 1; | |||
| const size_t newBufSize = bufferLen + ((strBuf != nullptr) ? std::strlen(strBuf) : 0) + 1; | |||
| char newBuf[newBufSize]; | |||
| std::strcpy(newBuf, buffer); | |||
| @@ -26,14 +26,17 @@ extern "C" { | |||
| #include <cassert> | |||
| #include <cstring> | |||
| // list_entry C++11 version (using nullptr instead of 0) | |||
| #undef list_entry | |||
| #define list_entry(ptr, type, member) \ | |||
| ((type *)((char *)(ptr)-(unsigned long)(&((type *)nullptr)->member))) | |||
| // Declare non copyable and prevent heap allocation | |||
| #define LIST_DECLARATIONS(className) \ | |||
| className(const className&); \ | |||
| className& operator= (const className&); | |||
| // FIXME | |||
| //static void* operator new (size_t); | |||
| //static void operator delete (void*); | |||
| className& operator= (const className&); \ | |||
| static void* operator new (size_t) { return nullptr; } \ | |||
| static void operator delete (void*) {} | |||
| typedef struct list_head k_list_head; | |||