Files
3d_audio/lib_xua/lib_xua/api/xua_pdm_mic.h
Steven Dan d8b2974133 init
2025-12-11 09:43:42 +08:00

53 lines
1.4 KiB
C

// Copyright 2015-2024 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#ifndef XUA_PDM_MIC_H
#define XUA_PDM_MIC_H
#include <xccompat.h>
#include <stdint.h>
#include "mic_array_conf.h"
#include "mic_array.h"
#ifdef __cplusplus
extern "C" {
#endif
void ma_init(unsigned mic_samp_rate);
void ma_task(chanend c_mic_to_audio);
#ifdef __cplusplus
}
#endif
/** USB PDM Mic task.
*
* This task runs the PDM rx and decimators and passes PCM samples to XUA.
* It runs forever and currently supports a single sample rate of
* 48 kHz, 32 kHz or 16 kHz
*
* \param c_mic_to_audio 1-bit input port for MIDI
*
**/
void mic_array_task(chanend c_mic_to_audio);
/** User pre-PDM mic function callback (optional).
* Use to initialise any PDM related hardware.
*
**/
void user_pdm_init();
/** USB PDM Mic PCM sample post processing callback (optional).
*
* This is called after the raw PCM samples are received from mic_array.
* It can be used to modify the samples (gain, filter etc.) before sending
* to XUA audiohub. Please note this is called from Audiohub (I2S) and
* so any processing must take significantly less than on half of a sample
* period else I2S will break timing.
*
* \param mic_audio Array of samples for in-place processing
*
**/void user_pdm_process(int32_t mic_audio[MIC_ARRAY_CONFIG_MIC_COUNT]);
#endif