Skip to content

Commit

Permalink
Bypass culling in case of cluster reclaiming and disabled sequentiali…
Browse files Browse the repository at this point in the history
…ty tests in alpha or beta verions (#722)

* Bypass culling in case of cluster reclaiming and disabled sequentiality tests in alpha or beta verions

* Format fixes :)
  • Loading branch information
PaulFreund authored Nov 15, 2023
1 parent a802e9f commit 45f5425
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 21 deletions.
6 changes: 6 additions & 0 deletions src/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/deluge/gui/views/instrument_clip_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/deluge/memory/cache_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/deluge/model/clip/instrument_clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/deluge/model/note/note_row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
18 changes: 12 additions & 6 deletions src/deluge/modulation/automation/auto_param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 3 additions & 5 deletions src/deluge/util/container/array/ordered_resizeable_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -273,6 +270,7 @@ void OrderedResizeableArray::testSequentiality(char const* errorCode) {

lastKey = key;
}
#endif
}

#define TEST_SEARCH_MULTIPLE_NUM_ITEMS 50000
Expand Down Expand Up @@ -624,7 +622,7 @@ void OrderedResizeableArrayWith32bitKey::shiftHorizontal(int32_t shiftAmount, in
}
}

#if ALPHA_OR_BETA_VERSION
#if ENABLE_SEQUENTIALITY_TESTS
testSequentiality("E378");
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -144,4 +141,5 @@ void OrderedResizeableArrayWithMultiWordKey::testSequentiality(char const* error
}
}
}
#endif
}

0 comments on commit 45f5425

Please sign in to comment.