File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/AudioTools/CoreAudio/AudioBasic/Collections Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class Allocator {
4444 void * addr = allocate (sizeof (T) * len);
4545 T* addrT = (T*)addr;
4646 // 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 ();
4848 return (T*)addr;
4949 }
5050
@@ -113,19 +113,25 @@ class AllocatorExt : public Allocator {
113113 * @copyright GPLv3
114114 */
115115
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+ }
117120 void * do_allocate (size_t size) {
118121 void * result = nullptr ;
119122 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 );
121124 if (result == nullptr ) {
122- LOGE (" IRAM alloc failed for %zu bytes" , size);
125+ LOGE (" alloc failed for %zu bytes" , size);
123126 stop ();
124127 }
125128 // initialize object
126129 memset (result, 0 , size);
127130 return result;
128131 }
132+
133+ protected:
134+ int caps = 0 ;
129135};
130136
131137#if (defined(RP2040) || defined(ESP32)) && defined(ARDUINO)
You can’t perform that action at this time.
0 commit comments