File tree 1 file changed +10
-4
lines changed
src/AudioTools/CoreAudio/AudioBasic/Collections
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class Allocator {
44
44
void * addr = allocate (sizeof (T) * len);
45
45
T* addrT = (T*)addr;
46
46
// call constructor
47
- for (int j = 0 ; j < len; j++) new (addrT+ j) T ();
47
+ for (int j = 0 ; j < len; j++) new (addrT + j) T ();
48
48
return (T*)addr;
49
49
}
50
50
@@ -113,19 +113,25 @@ class AllocatorExt : public Allocator {
113
113
* @copyright GPLv3
114
114
*/
115
115
116
- class AllocatorIRAM : public Allocator {
116
+ class AllocatorESP32 : public Allocator {
117
+ AllocatorESP32 (int scap = MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) {
118
+ this ->caps = caps;
119
+ }
117
120
void * do_allocate (size_t size) {
118
121
void * result = nullptr ;
119
122
if (size == 0 ) size = 1 ;
120
- if ( result == nullptr ) result = heap_caps_calloc (1 , size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL );
123
+ result = heap_caps_calloc (1 , size, caps );
121
124
if (result == nullptr ) {
122
- LOGE (" IRAM alloc failed for %zu bytes" , size);
125
+ LOGE (" alloc failed for %zu bytes" , size);
123
126
stop ();
124
127
}
125
128
// initialize object
126
129
memset (result, 0 , size);
127
130
return result;
128
131
}
132
+
133
+ protected:
134
+ int caps = 0 ;
129
135
};
130
136
131
137
#if (defined(RP2040) || defined(ESP32)) && defined(ARDUINO)
You can’t perform that action at this time.
0 commit comments