Global Buffer which is used for ReadBytes? #1543
-
``I am working on a project where I am using audio tools with my own stream classes. However I would prefer to use whatever global variable calls buffer in ReadBytes (in some code it would be called DMA_BUFFER but I am not sure what it is in audio Tools i would rather not have to initi buffer within readBytes and if there is a global variable that already calls this it would save memory. thanks!! here is the current code size_t readBytes(uint8_t* buffer, size_t length) override { |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I don't quite understand your question and your example code does not provide any context information about the overall data flow: It pretty much depends on what you are using and your platform. In any case there is no global memory in the AudioTools and it is up to each class if some additional buffering is needed. I just see that you are doing a conversion from float: You could save some complexity by using an EncodedAudioStream with a |
Beta Was this translation helpful? Give feedback.
I don't quite understand your question and your example code does not provide any context information about the overall data flow: It pretty much depends on what you are using and your platform. In any case there is no global memory in the AudioTools and it is up to each class if some additional buffering is needed.
E.g. If you use a I2SStream of an ESP32 the reading comes from DMA memory and when you write the data goes to DMA memory, (if you use 2 channels) but this is an implementation detail of the API provided by the ESP32 and not of my functionality.
I just see that you are doing a conversion from float: You could save some complexity by using an EncodedAudioStream with a
DecoderFlo…