diff --git a/source/backend/CarlaBackend.hpp b/source/backend/CarlaBackend.hpp index d8fc714b4..5493f1571 100644 --- a/source/backend/CarlaBackend.hpp +++ b/source/backend/CarlaBackend.hpp @@ -620,7 +620,7 @@ enum ProcessMode { */ enum TransportMode { TRANSPORT_MODE_INTERNAL = 0, //!< Internal transport mode. - TRANSPORT_MODE_JACK = 1, //!< JACK transport, only available if driver name is "JACK" + TRANSPORT_MODE_JACK = 1 //!< JACK transport, only available if driver name is "JACK" }; /*! diff --git a/source/bridges/qtcreator/carla-bridge-plugin.pro b/source/bridges/qtcreator/carla-bridge-plugin.pro index 0e76910f0..8ae629a80 100644 --- a/source/bridges/qtcreator/carla-bridge-plugin.pro +++ b/source/bridges/qtcreator/carla-bridge-plugin.pro @@ -107,7 +107,7 @@ INCLUDEPATH = .. \ # ----------------------------------------------------------- -DEFINES = QTCREATOR_TEST +DEFINES = QTCREATOR_TEST HAVE_CPP11_SUPPORT DEFINES += DEBUG #DEFINES += VESTIGE_HEADER DEFINES += BUILD_BRIDGE BUILD_BRIDGE_PLUGIN BRIDGE_PLUGIN diff --git a/source/carla_shared.py b/source/carla_shared.py index bd783eecd..f21707b5e 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -316,6 +316,7 @@ PROCESS_MODE_SINGLE_CLIENT = 0 PROCESS_MODE_MULTIPLE_CLIENTS = 1 PROCESS_MODE_CONTINUOUS_RACK = 2 PROCESS_MODE_PATCHBAY = 3 +PROCESS_MODE_BRIDGE = 4 # Transport Mode TRANSPORT_MODE_INTERNAL = 0 diff --git a/source/includes/CarlaDefines.hpp b/source/includes/CarlaDefines.hpp index 47e49f5dd..18f9fccdb 100644 --- a/source/includes/CarlaDefines.hpp +++ b/source/includes/CarlaDefines.hpp @@ -23,7 +23,7 @@ # define CARLA_OS_MAC #elif defined(__HAIKU__) # define CARLA_OS_HAIKU -#elif defined(__linux__) || defined(__linux) || defined(QTCREATOR_TEST) +#elif defined(__linux__) || defined(__linux) # define CARLA_OS_LINUX #elif defined(WIN64) || defined(_WIN64) || defined(__WIN64__) # define CARLA_OS_WIN64 @@ -40,7 +40,7 @@ #endif // Check for C++11 support -#if defined(HAVE_CPP11_SUPPORT) || defined(QTCREATOR_TEST) +#if defined(HAVE_CPP11_SUPPORT) # define CARLA_PROPER_CPP11_SUPPORT #elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 diff --git a/source/libs/rtmempool/list.h b/source/libs/rtmempool/list.h index fbc17f3a1..48cb45a83 100644 --- a/source/libs/rtmempool/list.h +++ b/source/libs/rtmempool/list.h @@ -25,7 +25,9 @@ #define __LINUX_LIST_H__ /* This file is from Linux Kernel (include/linux/list.h) - * and modified by simply removing hardware prefetching of list items. + * and modified by removing hardware prefetching of list items + * and added list_split_tail* functions. + * * Here by copyright, credits attributed to wherever they belong. * Filipe Coelho (aka falkTX ) */ @@ -224,6 +226,19 @@ static inline void __list_splice(struct list_head *list, struct list_head *head) at->prev = last; } +static inline void __list_splice_tail(struct list_head *list, struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->prev; + + first->prev = at; + at->next = first; + + last->next = head; + head->prev = last; +} + /** * list_splice - join two lists * @list: the new list to add. @@ -235,6 +250,19 @@ static inline void list_splice(struct list_head *list, struct list_head *head) __list_splice(list, head); } +/** + * list_splice_tail - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * @list goes to the end (at head->prev) + */ +static inline void list_splice_tail(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice_tail(list, head); +} + /** * list_splice_init - join two lists and reinitialise the emptied list. * @list: the new list to add. @@ -250,6 +278,22 @@ static inline void list_splice_init(struct list_head *list, struct list_head *he } } +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + * @list goes to the end (at head->prev) + */ +static inline void list_splice_tail_init(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice_tail(list, head); + INIT_LIST_HEAD(list); + } +} + /** * list_entry - get the struct for this entry * @ptr: the &struct list_head pointer. diff --git a/source/tests/ANSI.cpp b/source/tests/ANSI.cpp index 5e4e07fde..b1f3dc90e 100644 --- a/source/tests/ANSI.cpp +++ b/source/tests/ANSI.cpp @@ -17,7 +17,7 @@ // still need qt classes check //#include "CarlaPlugin.hpp" -#include "plugin/DssiPlugin.cpp" +//#include "plugin/DssiPlugin.cpp" #if 0 #include "CarlaDefines.hpp" diff --git a/source/tests/RtList.cpp b/source/tests/RtList.cpp index 51cebd579..cc56d32ab 100644 --- a/source/tests/RtList.cpp +++ b/source/tests/RtList.cpp @@ -71,7 +71,7 @@ struct PostRtEvents { { if (mutex.tryLock()) { - dataPendingRT.splice(data, true); + dataPendingRT.spliceAppend(data, true); mutex.unlock(); } } @@ -145,6 +145,13 @@ int main() assert(postRtEvents.data.count() == 4); assert(postRtEvents.dataPendingRT.count() == 0); + for (auto it = postRtEvents.data.begin(); it.valid(); it.next()) + { + MyData& my = *it; + + printf("FOR DATA!!!: %i %s\n", my.idStr, (const char*)my.str); + } + run4Tests(); // reset diff --git a/source/utils/RtList.hpp b/source/utils/RtList.hpp index 4b7b83c41..e81171912 100644 --- a/source/utils/RtList.hpp +++ b/source/utils/RtList.hpp @@ -26,9 +26,9 @@ extern "C" { } // Declare non copyable and prevent heap allocation -#define LIST_DECLARATIONS(className) \ - className(const className&); \ - className& operator= (const className&); \ +#define LIST_DECLARATIONS(className) \ + className(const className&); \ + className& operator= (const className&); \ static void* operator new (size_t) { return nullptr; } \ static void operator delete (void*) {} @@ -42,6 +42,46 @@ template class List { protected: + struct Data { + T value; + k_list_head siblings; + }; + + class Itenerator { + public: + Itenerator(k_list_head* queue) + : kQueue(queue), + fEntry(queue->next), + fData(nullptr) + { + CARLA_ASSERT(kQueue != nullptr); + CARLA_ASSERT(fEntry != nullptr); + } + + bool valid() + { + prefetch(fEntry->next); + return (fEntry != kQueue); + } + + void next() + { + fEntry = fEntry->next; + } + + T& operator*() + { + fData = list_entry(fEntry, Data, siblings); + CARLA_ASSERT(fData != nullptr); + return fData->value; + } + + private: + k_list_head* const kQueue; + k_list_head* fEntry; + Data* fData; + }; + List() : kDataSize(sizeof(Data)), fCount(0) @@ -55,6 +95,11 @@ public: CARLA_ASSERT(fCount == 0); } + Itenerator begin() + { + return Itenerator(&fQueue); + } + void clear() { if (fCount != 0) @@ -110,7 +155,7 @@ public: T& getAt(const size_t index, const bool remove = false) { if (fCount == 0 || index >= fCount) - return _retEmpty(); + return _getEmpty(); size_t i = 0; Data* data = nullptr; @@ -137,7 +182,7 @@ public: CARLA_ASSERT(data != nullptr); - return (data != nullptr) ? data->value : _retEmpty(); + return (data != nullptr) ? data->value : _getEmpty(); } T& getFirst(const bool remove = false) @@ -194,7 +239,22 @@ public: } } - virtual void splice(List& list, const bool init = false) + virtual void spliceAppend(List& list, const bool init = false) + { + if (init) + { + list_splice_tail_init(&fQueue, &list.fQueue); + list.fCount += fCount; + fCount = 0; + } + else + { + list_splice_tail(&fQueue, &list.fQueue); + list.fCount += fCount; + } + } + + virtual void spliceInsert(List& list, const bool init = false) { if (init) { @@ -214,11 +274,6 @@ protected: size_t fCount; k_list_head fQueue; - struct Data { - T value; - k_list_head siblings; - }; - virtual Data* _allocate() = 0; virtual void _deallocate(Data* const dataPtr) = 0; @@ -232,7 +287,7 @@ private: T& _getFirstOrLast(const bool first, const bool remove) { if (fCount == 0) - return _retEmpty(); + return _getEmpty(); k_list_head* const entry = first ? fQueue.next : fQueue.prev; Data* const data = list_entry(entry, Data, siblings); @@ -240,7 +295,7 @@ private: CARLA_ASSERT(data != nullptr); if (data == nullptr) - return _retEmpty(); + return _getEmpty(); T& ret = data->value; @@ -254,7 +309,7 @@ private: return ret; } - T& _retEmpty() + T& _getEmpty() { // FIXME ? static T value; @@ -371,11 +426,18 @@ public: kMemPool->resize(minPreallocated, maxPreallocated); } - void splice(RtList& list, const bool init = false) + void spliceAppend(RtList& list, const bool init = false) + { + CARLA_ASSERT(kMemPool == list.kMemPool); + + List::spliceAppend(list, init); + } + + void spliceInsert(RtList& list, const bool init = false) { CARLA_ASSERT(kMemPool == list.kMemPool); - List::splice(list, init); + List::spliceInsert(list, init); } private: