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