Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
pdm_handle.h
Go to the documentation of this file.
1
5#ifndef PLATFORM_PDM_HANDLE_H
6#define PLATFORM_PDM_HANDLE_H
7
8#include <array>
9#include <stdint.h>
10#include <cstddef>
11
12namespace lampda {
13namespace platform {
15namespace microphone {
16
18static constexpr int16_t gainUpdateBaseline = 80;
19
23struct PdmData
24{
26 static constexpr uint16_t SAMPLE_SIZE = 512;
28 std::array<int16_t, SAMPLE_SIZE> data;
32 uint64_t sampleTime_us;
33
35 uint16_t sampleRead = 0;
37 bool is_valid() const { return sampleRead > 0; }
38};
39
40namespace _private {
41
42PdmData get();
43
44// start the microphone readings
45bool start();
46// close the microphone readings
47void stop();
48
49} // namespace _private
50
51} // namespace microphone
52} // namespace platform
53} // namespace lampda
54
55#endif
static constexpr int16_t gainUpdateBaseline
CALIBRATED value of a gain baseline.
Definition: pdm_handle.h:18
Program scope.
Definition: control_fixed_modes.hpp:12
Store the audio data obtained from the microphone.
Definition: pdm_handle.h:24
uint16_t sampleRead
number of sound sample in array. Will be <= SAMPLE_SIZE
Definition: pdm_handle.h:35
bool is_valid() const
if this is false, all the data are garbage
Definition: pdm_handle.h:37
uint64_t sampleTime_us
time at the start of the sample in microseconds
Definition: pdm_handle.h:32
uint64_t sampleDuration_us
duration of the sample in microseconds
Definition: pdm_handle.h:30
std::array< int16_t, SAMPLE_SIZE > data
raw audio data buffer
Definition: pdm_handle.h:28
static constexpr uint16_t SAMPLE_SIZE
Size of the sound sample.
Definition: pdm_handle.h:26