diff --git a/src/definitions.h b/src/definitions.h index fb899e9ac6..740767bb71 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -2,6 +2,12 @@ #define ALPHA_OR_BETA_VERSION 1 // Whether to compile with additional error-checking +#if !defined(NDEBUG) +#define ENABLE_SEQUENTIALITY_TESTS 1 +#else +#define ENABLE_SEQUENTIALITY_TESTS 0 +#endif + #include "RZA1/cpu_specific.h" #include "RZA1/system/r_typedefs.h" #include "fault_handler.h" diff --git a/src/deluge/gui/views/instrument_clip_view.cpp b/src/deluge/gui/views/instrument_clip_view.cpp index c489cedda1..87b2f8d065 100644 --- a/src/deluge/gui/views/instrument_clip_view.cpp +++ b/src/deluge/gui/views/instrument_clip_view.cpp @@ -5329,7 +5329,7 @@ void InstrumentClipView::editNumEuclideanEvents(ModelStackWithNoteRow* modelStac // Swap the new temporary note data into the permanent place noteRow->notes.swapStateWith(&newNotes); -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS noteRow->notes.testSequentiality("E376"); #endif } diff --git a/src/deluge/memory/cache_manager.cpp b/src/deluge/memory/cache_manager.cpp index 8380c85718..aed961342d 100644 --- a/src/deluge/memory/cache_manager.cpp +++ b/src/deluge/memory/cache_manager.cpp @@ -150,6 +150,7 @@ uint32_t CacheManager::ReclaimMemory(MemoryRegion& region, int32_t totalSizeNeed spaceSize += result.amountsExtended[0] + result.amountsExtended[1]; Debug::println("stole and grabbed neighbouring stuff too..........."); + AudioEngine::bypassCulling = true; // Paul: We don't want our samples to drop out because of this maneuver stolen = true; break; } diff --git a/src/deluge/model/clip/instrument_clip.cpp b/src/deluge/model/clip/instrument_clip.cpp index a48439b7c8..3cf5988c3a 100644 --- a/src/deluge/model/clip/instrument_clip.cpp +++ b/src/deluge/model/clip/instrument_clip.cpp @@ -4385,7 +4385,7 @@ void InstrumentClip::recordNoteOn(ModelStackWithNoteRow* modelStack, int32_t vel else if (reversed) { doHomogenize: -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS param->nodes.testSequentiality( "E442"); // drbourbon got, when check was inside homogenizeRegion(). Now trying to work out where that came from. March 2022. #endif diff --git a/src/deluge/model/note/note_row.cpp b/src/deluge/model/note/note_row.cpp index 839bbe5c6c..a92fdb9658 100644 --- a/src/deluge/model/note/note_row.cpp +++ b/src/deluge/model/note/note_row.cpp @@ -504,7 +504,7 @@ int32_t NoteRow::addCorrespondingNotes(int32_t targetPos, int32_t newNotesLength // Swap the new temporary note data into the permanent place notes.swapStateWith(&newNotes); -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS notes.testSequentiality("E318"); #endif @@ -810,7 +810,7 @@ int32_t NoteRow::clearArea(int32_t areaStart, int32_t areaWidth, ModelStackWithN // Swap the new temporary note data into the permanent place notes.swapStateWith(&newNotes); -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS notes.testSequentiality("E319"); #endif @@ -1118,7 +1118,7 @@ int32_t NoteRow::editNoteRepeatAcrossAllScreens(int32_t editPos, int32_t squareW // Swap the new temporary note data into the permanent place notes.swapStateWith(&newNotes); -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS notes.testSequentiality("E328"); #endif @@ -1413,7 +1413,7 @@ int32_t NoteRow::nudgeNotesAcrossAllScreens(int32_t editPos, ModelStackWithNoteR // Swap the new temporary note data into the permanent place notes.swapStateWith(&newNotes); -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS notes.testSequentiality("E327"); #endif diff --git a/src/deluge/modulation/automation/auto_param.cpp b/src/deluge/modulation/automation/auto_param.cpp index 4c41e9352c..a7124afa83 100644 --- a/src/deluge/modulation/automation/auto_param.cpp +++ b/src/deluge/modulation/automation/auto_param.cpp @@ -204,7 +204,7 @@ void AutoParam::setCurrentValueInResponseToUserInput(int32_t value, ModelStackWi bool shouldInterpolateLeft = reversed || shouldInterpolateRegionStart; -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS // drbourbon got, when check was inside homogenizeRegion(). Now trying to work out where that came from. // March 2022. nodes.testSequentiality("E435"); @@ -249,7 +249,7 @@ void AutoParam::setCurrentValueInResponseToUserInput(int32_t value, ModelStackWi skipThat : {} } -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS nodes.testSequentiality("ffff"); #endif @@ -688,7 +688,7 @@ int32_t AutoParam::processCurrentPos(ModelStackWithAutoParam const* modelStack, nextNodeInOurDirection = nodes.getElement(iRight); } -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS nodes.testSequentiality("eeee"); #endif } @@ -955,7 +955,7 @@ void AutoParam::setValueForRegion(uint32_t pos, uint32_t length, int32_t value, // Or, normal case else { -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS // drbourbon got, when check was inside homogenizeRegion(). Now trying to work out where that came from. // March 2022. Sven got, oddly while editing note velocity. Then again by "Adding some snares while playing". nodes.testSequentiality("E441"); @@ -1017,7 +1017,11 @@ int32_t AutoParam::homogenizeRegion(ModelStackWithAutoParam const* modelStack, i if (startPos < 0) { FREEZE_WITH_ERROR("E437"); } - // nodes.testSequentiality("E435"); // drbourbon got! March 2022. Now moved check to each caller. + + //#if ENABLE_SEQUENTIALITY_TESTS + // // nodes.testSequentiality("E435"); // drbourbon got! March 2022. Now moved check to each caller. + //#endif + if (nodes.getNumElements() && nodes.getFirst()->pos < 0) { FREEZE_WITH_ERROR("E436"); } @@ -1211,9 +1215,11 @@ int32_t AutoParam::homogenizeRegion(ModelStackWithAutoParam const* modelStack, i edgeIndexes[REGION_EDGE_LEFT] -= edgeIndexes[REGION_EDGE_RIGHT]; } -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS nodes.testSequentiality( "E433"); // Was "GGGG". Leo got. Sven got. (Probably now solved). (Nope, Michael got on V4.1.0-alpha10 (OLED)!) +#endif +#if ALPHA_OR_BETA_VERSION if (nodes.getNumElements()) { ParamNode* rightmostNode = nodes.getElement(nodes.getNumElements() - 1); if (rightmostNode->pos >= effectiveLength) { diff --git a/src/deluge/util/container/array/ordered_resizeable_array.cpp b/src/deluge/util/container/array/ordered_resizeable_array.cpp index ca7bab72dd..6156895274 100644 --- a/src/deluge/util/container/array/ordered_resizeable_array.cpp +++ b/src/deluge/util/container/array/ordered_resizeable_array.cpp @@ -260,10 +260,7 @@ void OrderedResizeableArray::deleteAtKey(int32_t key) { } void OrderedResizeableArray::testSequentiality(char const* errorCode) { - if (!ALPHA_OR_BETA_VERSION) { - return; - } - +#if ENABLE_SEQUENTIALITY_TESTS int32_t lastKey = -2147483648; for (int32_t i = 0; i < getNumElements(); i++) { int32_t key = getKeyAtIndex(i); @@ -273,6 +270,7 @@ void OrderedResizeableArray::testSequentiality(char const* errorCode) { lastKey = key; } +#endif } #define TEST_SEARCH_MULTIPLE_NUM_ITEMS 50000 @@ -624,7 +622,7 @@ void OrderedResizeableArrayWith32bitKey::shiftHorizontal(int32_t shiftAmount, in } } -#if ALPHA_OR_BETA_VERSION +#if ENABLE_SEQUENTIALITY_TESTS testSequentiality("E378"); #endif } diff --git a/src/deluge/util/container/array/ordered_resizeable_array_with_multi_word_key.cpp b/src/deluge/util/container/array/ordered_resizeable_array_with_multi_word_key.cpp index 7369862355..999c170ef9 100644 --- a/src/deluge/util/container/array/ordered_resizeable_array_with_multi_word_key.cpp +++ b/src/deluge/util/container/array/ordered_resizeable_array_with_multi_word_key.cpp @@ -121,10 +121,7 @@ bool OrderedResizeableArrayWithMultiWordKey::deleteAtKeyMultiWord(uint32_t* __re } void OrderedResizeableArrayWithMultiWordKey::testSequentiality(char const* errorCode) { - if (!ALPHA_OR_BETA_VERSION) { - return; - } - +#if ENABLE_SEQUENTIALITY_TESTS for (int32_t i = 1; i < getNumElements(); i++) { uint32_t* __restrict__ wordsHere = (uint32_t*)getElementAddress(i); uint32_t* __restrict__ lastWords = (uint32_t*)getElementAddress(i - 1); @@ -144,4 +141,5 @@ void OrderedResizeableArrayWithMultiWordKey::testSequentiality(char const* error } } } +#endif }