From ae624a1914ca57ea4fc4947a72dc76068d1ffd02 Mon Sep 17 00:00:00 2001 From: m-m-adams Date: Mon, 23 Oct 2023 01:04:38 -0400 Subject: [PATCH] dbt format --- src/deluge/dsp/delay/delay_buffer.cpp | 3 ++- src/deluge/dsp/timestretch/time_stretcher.cpp | 4 ++-- src/deluge/gui/views/instrument_clip_view.cpp | 6 ++++-- src/deluge/hid/display/seven_segment.cpp | 12 ++++++++---- src/deluge/hid/hid_sysex.cpp | 6 ++++-- src/deluge/io/debug/sysex.cpp | 3 ++- src/deluge/memory/memory_region.cpp | 2 +- src/deluge/model/action/action_logger.cpp | 7 ++++--- .../model/global_effectable/global_effectable.cpp | 8 ++++---- src/deluge/model/note/note_row.cpp | 3 ++- src/deluge/model/sample/sample.cpp | 6 ++++-- src/deluge/modulation/automation/auto_param.cpp | 4 +++- src/deluge/modulation/params/param_manager.cpp | 3 ++- src/deluge/processing/sound/sound.cpp | 8 ++++---- src/deluge/storage/storage_manager.cpp | 5 +++-- 15 files changed, 49 insertions(+), 31 deletions(-) diff --git a/src/deluge/dsp/delay/delay_buffer.cpp b/src/deluge/dsp/delay/delay_buffer.cpp index 35a2400914..c74c8bbdd7 100644 --- a/src/deluge/dsp/delay/delay_buffer.cpp +++ b/src/deluge/dsp/delay/delay_buffer.cpp @@ -63,7 +63,8 @@ uint8_t DelayBuffer::init(uint32_t newRate, uint32_t failIfThisSize, bool includ sizeIncludingExtra = size + (includeExtraSpace ? delaySpaceBetweenReadAndWrite : 0); AudioEngine::logAction("DelayBuffer::init before"); - bufferStart = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed(sizeIncludingExtra * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference + bufferStart = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed( + sizeIncludingExtra * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference AudioEngine::logAction("DelayBuffer::init after"); if (bufferStart == 0) { return ERROR_INSUFFICIENT_RAM; diff --git a/src/deluge/dsp/timestretch/time_stretcher.cpp b/src/deluge/dsp/timestretch/time_stretcher.cpp index c1551085ef..e09fe70ebc 100644 --- a/src/deluge/dsp/timestretch/time_stretcher.cpp +++ b/src/deluge/dsp/timestretch/time_stretcher.cpp @@ -1049,8 +1049,8 @@ void TimeStretcher::reassessWhetherToBeFillingBuffer(int32_t phaseIncrement, int #endif bool TimeStretcher::allocateBuffer(int32_t numChannels) { - buffer = - (int32_t*)GeneralMemoryAllocator::get().allocMaxSpeed(TimeStretch::kBufferSize * sizeof(int32_t) * numChannels); //@TODO: Measure if internal vs SDRAM matters + buffer = (int32_t*)GeneralMemoryAllocator::get().allocMaxSpeed( + TimeStretch::kBufferSize * sizeof(int32_t) * numChannels); //@TODO: Measure if internal vs SDRAM matters return (buffer != NULL); } diff --git a/src/deluge/gui/views/instrument_clip_view.cpp b/src/deluge/gui/views/instrument_clip_view.cpp index bc9d5dbab4..ec375b355d 100644 --- a/src/deluge/gui/views/instrument_clip_view.cpp +++ b/src/deluge/gui/views/instrument_clip_view.cpp @@ -932,7 +932,8 @@ void InstrumentClipView::copyNotes() { if (numNotes > 0) { - void* copiedNoteRowMemory = GeneralMemoryAllocator::get().allocLowSpeed(sizeof(CopiedNoteRow)); //@TODO: Shouldn't this be internal first? + void* copiedNoteRowMemory = GeneralMemoryAllocator::get().allocLowSpeed( + sizeof(CopiedNoteRow)); //@TODO: Shouldn't this be internal first? if (!copiedNoteRowMemory) { ramError: deleteCopiedNoteRows(); @@ -948,7 +949,8 @@ void InstrumentClipView::copyNotes() { prevPointer = &newCopiedNoteRow->next; // Allocate some memory for the notes - newCopiedNoteRow->notes = (Note*)GeneralMemoryAllocator::get().allocLowSpeed(sizeof(Note) * numNotes); //@TODO: Shouldn't this be internal first? + newCopiedNoteRow->notes = (Note*)GeneralMemoryAllocator::get().allocLowSpeed( + sizeof(Note) * numNotes); //@TODO: Shouldn't this be internal first? if (!newCopiedNoteRow->notes) { goto ramError; diff --git a/src/deluge/hid/display/seven_segment.cpp b/src/deluge/hid/display/seven_segment.cpp index 5afb795a4c..456526f628 100644 --- a/src/deluge/hid/display/seven_segment.cpp +++ b/src/deluge/hid/display/seven_segment.cpp @@ -99,7 +99,8 @@ void SevenSegment::removeTopLayer() { void SevenSegment::setText(std::string_view newText, bool alignRight, uint8_t drawDot, bool doBlink, uint8_t* newBlinkMask, bool blinkImmediately, bool shouldBlinkFast, int32_t scrollPos, uint8_t* encodedAddition, bool justReplaceBottomLayer) { - void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed(sizeof(NumericLayerBasicText)); //@TODO: This looks like it belongs to internal + void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed( + sizeof(NumericLayerBasicText)); //@TODO: This looks like it belongs to internal if (!layerSpace) { return; } @@ -147,7 +148,8 @@ void SevenSegment::setText(std::string_view newText, bool alignRight, uint8_t dr NumericLayerScrollingText* SevenSegment::setScrollingText(char const* newText, int32_t startAtTextPos, int32_t initialDelay) { - void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed(sizeof(NumericLayerScrollingText)); //@TODO: This looks like it belongs to internal + void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed( + sizeof(NumericLayerScrollingText)); //@TODO: This looks like it belongs to internal if (!layerSpace) { return NULL; } @@ -195,7 +197,8 @@ void SevenSegment::transitionToNewLayer(NumericLayer* newLayer) { // If transition... if (!popupActive && nextTransitionDirection != 0 && topLayer != NULL) { - void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed(sizeof(NumericLayerScrollTransition));//@TODO: This looks like it belongs to internal + void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed( + sizeof(NumericLayerScrollTransition)); //@TODO: This looks like it belongs to internal if (layerSpace) { scrollTransition = new (layerSpace) NumericLayerScrollTransition(); @@ -541,7 +544,8 @@ void SevenSegment::render() { // Call this to make the loading animation happen void SevenSegment::displayLoadingAnimation(bool delayed, bool transparent) { - void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed(sizeof(NumericLayerLoadingAnimation)); //@TODO: This looks like it belongs to internal + void* layerSpace = GeneralMemoryAllocator::get().allocLowSpeed( + sizeof(NumericLayerLoadingAnimation)); //@TODO: This looks like it belongs to internal if (!layerSpace) { return; } diff --git a/src/deluge/hid/hid_sysex.cpp b/src/deluge/hid/hid_sysex.cpp index 8479b61071..ba5ec05b95 100644 --- a/src/deluge/hid/hid_sysex.cpp +++ b/src/deluge/hid/hid_sysex.cpp @@ -50,8 +50,10 @@ void HIDSysex::requestOLEDDisplay(MIDIDevice* device, uint8_t* data, int32_t len } if (oledDeltaImage == nullptr) { - oledDeltaImage = (uint8_t*)GeneralMemoryAllocator::get().allocMaxSpeed( - sizeof(uint8_t[OLED_MAIN_HEIGHT_PIXELS >> 3][OLED_MAIN_WIDTH_PIXELS])); //@TODO: Check if there is a speed difference putting this into nonaudio + oledDeltaImage = (uint8_t*)GeneralMemoryAllocator::get().allocMaxSpeed(sizeof( + uint8_t + [OLED_MAIN_HEIGHT_PIXELS >> 3] + [OLED_MAIN_WIDTH_PIXELS])); //@TODO: Check if there is a speed difference putting this into nonaudio } } sendDisplayIfChanged(); diff --git a/src/deluge/io/debug/sysex.cpp b/src/deluge/io/debug/sysex.cpp index e1a57a40f8..f94ba4b2d1 100644 --- a/src/deluge/io/debug/sysex.cpp +++ b/src/deluge/io/debug/sysex.cpp @@ -101,7 +101,8 @@ static void firstPacket(uint8_t* data, int32_t len) { } load_bufsize = load_codesize + (511 - ((load_codesize - 1) & 511)); - load_buf = (uint8_t*)GeneralMemoryAllocator::get().allocMaxSpeed(load_bufsize); //@TODO: could this be in nonaudio instead? + load_buf = (uint8_t*)GeneralMemoryAllocator::get().allocMaxSpeed( + load_bufsize); //@TODO: could this be in nonaudio instead? if (load_buf == nullptr) { // fail :( return; diff --git a/src/deluge/memory/memory_region.cpp b/src/deluge/memory/memory_region.cpp index d340b7a4b5..681197e82e 100644 --- a/src/deluge/memory/memory_region.cpp +++ b/src/deluge/memory/memory_region.cpp @@ -724,7 +724,7 @@ NeighbouringMemoryGrabAttemptResult MemoryRegion::attemptToGrabNeighbouringMemor return toReturn; } -gotEnoughMemory: {} +gotEnoughMemory : {} // There's a small chance it will have found a bit less memory the second time through if stealing an allocation resulted in another little bit of memory being freed, // that adding onto the discovered amount, and getting us less of a surplus while still reaching the desired (well actually the min) amount } diff --git a/src/deluge/model/action/action_logger.cpp b/src/deluge/model/action/action_logger.cpp index 2f97662137..af4ef2e20b 100644 --- a/src/deluge/model/action/action_logger.cpp +++ b/src/deluge/model/action/action_logger.cpp @@ -126,7 +126,8 @@ Action* ActionLogger::getNewAction(int32_t newActionType, int32_t addToExistingI } // And make a new one - void* actionMemory = GeneralMemoryAllocator::get().allocLowSpeed(sizeof(Action)); //@TODO: How many actions do we have, does it make sense to put them into nonaudio? + void* actionMemory = GeneralMemoryAllocator::get().allocLowSpeed( + sizeof(Action)); //@TODO: How many actions do we have, does it make sense to put them into nonaudio? if (!actionMemory) { Debug::println("no ram to create new Action"); @@ -137,8 +138,8 @@ Action* ActionLogger::getNewAction(int32_t newActionType, int32_t addToExistingI int32_t numClips = currentSong->sessionClips.getNumElements() + currentSong->arrangementOnlyClips.getNumElements(); - ActionClipState* clipStates = - (ActionClipState*)GeneralMemoryAllocator::get().allocLowSpeed(numClips * sizeof(ActionClipState)); // See question above + ActionClipState* clipStates = (ActionClipState*)GeneralMemoryAllocator::get().allocLowSpeed( + numClips * sizeof(ActionClipState)); // See question above if (!clipStates) { delugeDealloc(actionMemory); diff --git a/src/deluge/model/global_effectable/global_effectable.cpp b/src/deluge/model/global_effectable/global_effectable.cpp index 315bb39367..2575405721 100644 --- a/src/deluge/model/global_effectable/global_effectable.cpp +++ b/src/deluge/model/global_effectable/global_effectable.cpp @@ -761,8 +761,8 @@ void GlobalEffectable::processFXForGlobalEffectable(StereoSample* inputBuffer, i if (modFXTypeNow == ModFXType::FLANGER || modFXTypeNow == ModFXType::CHORUS || modFXTypeNow == ModFXType::CHORUS_STEREO) { if (!modFXBuffer) { - modFXBuffer = - (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed(kModFXBufferSize * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference + modFXBuffer = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed( + kModFXBufferSize * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference if (!modFXBuffer) { modFXTypeNow = ModFXType::NONE; } @@ -777,8 +777,8 @@ void GlobalEffectable::processFXForGlobalEffectable(StereoSample* inputBuffer, i } else if (modFXTypeNow == ModFXType::GRAIN) { if (!modFXGrainBuffer) { - modFXGrainBuffer = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed(kModFXGrainBufferSize - * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference + modFXGrainBuffer = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed( + kModFXGrainBufferSize * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference if (!modFXGrainBuffer) { modFXTypeNow = ModFXType::NONE; } diff --git a/src/deluge/model/note/note_row.cpp b/src/deluge/model/note/note_row.cpp index fa473a06ab..81b3444d27 100644 --- a/src/deluge/model/note/note_row.cpp +++ b/src/deluge/model/note/note_row.cpp @@ -3315,7 +3315,8 @@ void NoteRow::rememberDrumName() { } // If we're here, we're at the end of the list, didn't find an instance of the name, and want to add it to the end of the list now - void* drumNameMemory = GeneralMemoryAllocator::get().allocLowSpeed(sizeof(DrumName)); //@TODO: tiny object, should be in internal? + void* drumNameMemory = + GeneralMemoryAllocator::get().allocLowSpeed(sizeof(DrumName)); //@TODO: tiny object, should be in internal? if (drumNameMemory) { *prevPointer = new (drumNameMemory) DrumName(&soundDrum->name); } diff --git a/src/deluge/model/sample/sample.cpp b/src/deluge/model/sample/sample.cpp index 9ac3ee4ee0..4c563ec155 100644 --- a/src/deluge/model/sample/sample.cpp +++ b/src/deluge/model/sample/sample.cpp @@ -306,7 +306,8 @@ int32_t Sample::fillPercCache(TimeStretcher* timeStretcher, int32_t startPosSamp numPercCacheClusters = ((lengthInSamplesAfterReduction - 1) >> audioFileManager.clusterSizeMagnitude) + 1; // Stores this number for the future too int32_t memorySize = numPercCacheClusters * sizeof(Cluster*); - percCacheClusters[reversed] = (Cluster**)GeneralMemoryAllocator::get().allocMaxSpeed(memorySize); //@TODO: Really not sure about those + percCacheClusters[reversed] = + (Cluster**)GeneralMemoryAllocator::get().allocMaxSpeed(memorySize); //@TODO: Really not sure about those if (!percCacheClusters[reversed]) { LOCK_EXIT return ERROR_INSUFFICIENT_RAM; @@ -321,7 +322,8 @@ int32_t Sample::fillPercCache(TimeStretcher* timeStretcher, int32_t startPosSamp if (!percCacheMemory[reversed]) { int32_t percCacheSize = lengthInSamplesAfterReduction; - percCacheMemory[reversed] = (uint8_t*)GeneralMemoryAllocator::get().allocLowSpeed(percCacheSize); //@TODO: Really not sure about those + percCacheMemory[reversed] = (uint8_t*)GeneralMemoryAllocator::get().allocLowSpeed( + percCacheSize); //@TODO: Really not sure about those if (!percCacheMemory[reversed]) { LOCK_EXIT return ERROR_INSUFFICIENT_RAM; diff --git a/src/deluge/modulation/automation/auto_param.cpp b/src/deluge/modulation/automation/auto_param.cpp index 958da325e1..d4df547acc 100644 --- a/src/deluge/modulation/automation/auto_param.cpp +++ b/src/deluge/modulation/automation/auto_param.cpp @@ -2115,7 +2115,9 @@ void AutoParam::copy(int32_t startPos, int32_t endPos, CopiedParamAutomation* co // Allocate some memory for the nodes copiedParamAutomation->nodes = (ParamNode*)GeneralMemoryAllocator::get().allocLowSpeed( - sizeof(ParamNode) * copiedParamAutomation->numNodes); //@TODO: Does it make sense these are in SDRAM? Are the other nodes also in SDRAM? + sizeof(ParamNode) + * copiedParamAutomation + ->numNodes); //@TODO: Does it make sense these are in SDRAM? Are the other nodes also in SDRAM? if (!copiedParamAutomation->nodes) { copiedParamAutomation->numNodes = 0; diff --git a/src/deluge/modulation/params/param_manager.cpp b/src/deluge/modulation/params/param_manager.cpp index b54be432f1..ce2a427569 100644 --- a/src/deluge/modulation/params/param_manager.cpp +++ b/src/deluge/modulation/params/param_manager.cpp @@ -71,7 +71,8 @@ int32_t ParamManager::setupMIDI() { } int32_t ParamManager::setupUnpatched() { - void* memoryUnpatched = GeneralMemoryAllocator::get().allocMaxSpeed(sizeof(UnpatchedParamSet)); //@TODO: We could try putting all the params into SDRAM and see the rendering difference + void* memoryUnpatched = GeneralMemoryAllocator::get().allocMaxSpeed(sizeof( + UnpatchedParamSet)); //@TODO: We could try putting all the params into SDRAM and see the rendering difference if (!memoryUnpatched) { return ERROR_INSUFFICIENT_RAM; } diff --git a/src/deluge/processing/sound/sound.cpp b/src/deluge/processing/sound/sound.cpp index 77e8f8cbd4..ff306a5543 100644 --- a/src/deluge/processing/sound/sound.cpp +++ b/src/deluge/processing/sound/sound.cpp @@ -348,8 +348,8 @@ bool Sound::setModFXType(ModFXType newType) { if (newType == ModFXType::FLANGER || newType == ModFXType::CHORUS || newType == ModFXType::CHORUS_STEREO) { if (!modFXBuffer) { // TODO: should give an error here if no free ram - modFXBuffer = - (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed(kModFXBufferSize * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference + modFXBuffer = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed( + kModFXBufferSize * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference if (!modFXBuffer) { return false; } @@ -361,8 +361,8 @@ bool Sound::setModFXType(ModFXType newType) { } else if (newType == ModFXType::GRAIN) { if (!modFXGrainBuffer) { - modFXGrainBuffer = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed(kModFXGrainBufferSize - * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference + modFXGrainBuffer = (StereoSample*)GeneralMemoryAllocator::get().allocMaxSpeed( + kModFXGrainBufferSize * sizeof(StereoSample)); //@TODO: Measure and put into nonaudio if no difference if (!modFXGrainBuffer) { return false; } diff --git a/src/deluge/storage/storage_manager.cpp b/src/deluge/storage/storage_manager.cpp index 914dc04ff4..216ff015da 100644 --- a/src/deluge/storage/storage_manager.cpp +++ b/src/deluge/storage/storage_manager.cpp @@ -1566,8 +1566,9 @@ Instrument* StorageManager::createNewInstrument(InstrumentType newInstrumentType Instrument* StorageManager::createNewNonAudioInstrument(InstrumentType instrumentType, int32_t slot, int32_t subSlot) { int32_t size = (instrumentType == InstrumentType::MIDI_OUT) ? sizeof(MIDIInstrument) : sizeof(CVInstrument); - void* instrumentMemory = GeneralMemoryAllocator::get().allocLowSpeed(size); // @TODO: Check size and if it makes sense these are in SDRAM - if (!instrumentMemory) { // RAM fail + void* instrumentMemory = + GeneralMemoryAllocator::get().allocLowSpeed(size); // @TODO: Check size and if it makes sense these are in SDRAM + if (!instrumentMemory) { // RAM fail return NULL; }