Namespace: DadGUI::cMemoryManager Files: cMemoryManager.h / cMemoryManager.cpp Directory: DAD_FORGE/GUI/Components/ Description: Memory manager for preset slots, supporting MIDI program changes and GUI state persistence.
đź“‹ Class Description
The cMemoryManager class is responsible for managing the lifecycle of presets stored in non-volatile memory (Flash). It allows saving and restoring the user interface state. It can be controlled via the MIDI interface (Program Change, Preset Up/Down). It also ensures data integrity by verifying memory header validity and managing restore processes to notify the graphical interface.
đź”— External Dependencies
File Inclusions
Included File
Source
Role
"GUI_Define.h"
DAD_FORGE/GUI
Global GUI definitions
"cCallBackIterator.h"
DAD_FORGE/Core
Callback iterator management
"ID.h"
DAD_FORGE/Core
Identifier definitions
External Functions Called
Function
Source
Usage
bool Load(...)
BlockStorageManager
Loads data from Flash
bool Save(...)
BlockStorageManager
Saves data to Flash
bool Delete(...)
BlockStorageManager
Deletes a data block
uint32_t getSize(...)
BlockStorageManager
Retrieves a block’s size
void sendEvent_SerializeSave(...)
Global GUI Event Manager
Triggers GUI state serialization
void sendEvent_SerializeRestore(...)
Global GUI Event Manager
Triggers GUI state deserialization
void NotifyStartRestore(...)
Global GUI Manager
Notifies the start of a restore process
void NotifyEndRestore(...)
Global GUI Manager
Notifies the end of a restore process
Global Variables Used and Driver Objects
Variable / Object
Type
Source
Role
__BlockStorageManager
BlockStorageManager
Global Driver
Physical storage manager (Flash)
__GUI_EventManager
EventManager
Global GUI Context
Serialization event manager
__GUI
GUI_Manager
Global GUI Context
Global GUI manager
🎯 Associated Enumerations and Structures
sMemoryHeader
Structure stored in memory to maintain preset system integrity.
Element
Type
Description
m_ActiveSlot
uint8_t
Index of the currently loaded and active slot.
m_SlotID[MAX_SLOT]
uint32_t
Array of unique identifiers for each slot (0 = empty).
m_SlotSize[MAX_SLOT]
uint32_t
Size of stored data for each slot in bytes.
📚 Public Methods
Init
Element
Details
Method
void Init()
Description
Loads the memory header. If the header is corrupted, resets all slots. Otherwise, automatically restores the last active slot.