#include <Microphone_PDM.h>
Class to configure buffer sampling mode.
This class both configures the settings and also is a container for the sample data.
Allocate this structure with new Microphone_PDM_BufferSampling(), not on the stack! The object ownerships transfers to the Microphone_PDM class which will take care of deleting it.
◆ done()
bool Microphone_PDM_BufferSampling::done |
( |
| ) |
const |
|
virtual |
If not using the completion callback, call this to see when the buffering is done.
- Returns
- true
-
false
The buffer member is the pointer to the buffer. The bufferSize member is the size in bytes.
◆ preCompletion()
virtual void Microphone_PDM_BufferSampling::preCompletion |
( |
| ) |
|
|
inlinevirtual |
This methods can be overridden process the data before calling the completion callback.
The Microphone_PDM_BufferSampling_wav class does this to write the wav header.
◆ start()
bool Microphone_PDM_BufferSampling::start |
( |
| ) |
|
|
virtual |
Start sampling data.
- Returns
- true
-
false
◆ withCompletionCallback()
Microphone_PDM_BufferSampling & Microphone_PDM_BufferSampling::withCompletionCallback |
( |
std::function< void(uint8_t *buf, size_t bufSize)> |
completionCallback | ) |
|
|
inline |
Sets a callback function to call when samples are received (optional)
- Parameters
-
completionCallback | Function or lambda to call when the samples are |
◆ withReserveHeaderSize()
◆ buffer
uint8_t* Microphone_PDM_BufferSampling::buffer = 0 |
Buffer allocated dynamically if bufferSamplingStart() is used. Released by bufferSamplingRelease().
◆ bufferSize
size_t Microphone_PDM_BufferSampling::bufferSize = 0 |
Size of bufferSamplingBuffer in bytes. Set by bufferSamplingStart().
◆ completionCallback
std::function<void(uint8_t *buf, size_t bufSize)> Microphone_PDM_BufferSampling::completionCallback = 0 |
Callback to call when buffer is complete
◆ durationMs
unsigned long Microphone_PDM_BufferSampling::durationMs = 0 |
How long to capture in milliseconds
◆ offset
size_t Microphone_PDM_BufferSampling::offset = 0 |
Current offset writing to bufferSamplingBuffer if bufferSamplingStart() is being used
◆ reserveHeaderSize
size_t Microphone_PDM_BufferSampling::reserveHeaderSize = 0 |
Reserves space before the data. This is done by the Microphone_PDM_BufferSampling_wav to leave room for the wav header so the memory does not need to be resized or moved.
◆ sampleSizeInBytes
size_t Microphone_PDM_BufferSampling::sampleSizeInBytes |
Filled in during start() so it doesn't need to be retrieved from the Microphone_PDM class every time it's needed (which is often).
The documentation for this class was generated from the following files: