Skip to content

Commit b68716f

Browse files
committed
DefaultESP32AllocatorRAM
1 parent 0afdee2 commit b68716f

File tree

1 file changed

+7
-5
lines changed
  • src/AudioTools/CoreAudio/AudioBasic/Collections

1 file changed

+7
-5
lines changed

src/AudioTools/CoreAudio/AudioBasic/Collections/Allocator.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22
#include <stdlib.h>
33

4-
#include "AudioToolsConfig.h"
54
#include "AudioTools/CoreAudio/AudioLogger.h"
65
#include "AudioTools/CoreAudio/AudioRuntime.h"
6+
#include "AudioToolsConfig.h"
77

88
namespace audio_tools {
99

@@ -47,10 +47,10 @@ class Allocator {
4747
// call constructor
4848
#ifndef NO_INPLACE_INIT_SUPPORT
4949
for (int j = 0; j < len; j++) new (addrT + j) T();
50-
#else
50+
#else
5151
T default_value;
5252
for (int j = 0; j < len; j++) {
53-
memcpy((uint8_t*)addr+(j*sizeof(T)), &default_value, sizeof(T));
53+
memcpy((uint8_t*)addr + (j * sizeof(T)), &default_value, sizeof(T));
5454
}
5555
#endif
5656
return (T*)addr;
@@ -114,7 +114,6 @@ class AllocatorExt : public Allocator {
114114
}
115115
};
116116

117-
118117
#if (defined(ESP32)) && defined(ARDUINO)
119118

120119
/**
@@ -125,7 +124,8 @@ class AllocatorExt : public Allocator {
125124
* @copyright GPLv3
126125
*/
127126

128-
class AllocatorESP32 : public Allocator {
127+
class AllocatorESP32 : public Allocator {
128+
public:
129129
AllocatorESP32(int caps = MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) {
130130
this->caps = caps;
131131
}
@@ -144,6 +144,8 @@ class AllocatorExt : public Allocator {
144144
int caps = 0;
145145
};
146146

147+
static AllocatorESP32 DefaultESP32AllocatorRAM;
148+
147149
#endif
148150

149151
#if (defined(RP2040) || defined(ESP32)) && defined(ARDUINO)

0 commit comments

Comments
 (0)