From 6f927f81fb9bdef1212661a3405db2dcbda4549b Mon Sep 17 00:00:00 2001 From: Wang Wang Wang Date: Fri, 10 Dec 2021 18:03:34 +0800 Subject: [PATCH] feat(MN_CN V4.0): Add get command det threshold API --- include/esp32s3/esp_mn_iface.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/esp32s3/esp_mn_iface.h b/include/esp32s3/esp_mn_iface.h index 469557b..d4e5aa3 100644 --- a/include/esp32s3/esp_mn_iface.h +++ b/include/esp32s3/esp_mn_iface.h @@ -47,10 +47,21 @@ typedef int (*esp_mn_iface_op_set_det_threshold_t)(model_iface_data_t *model, fl * @brief Set the detection threshold to manually abjust the probability * * @param model The model object to query - * @param speech_command_id The ID of speech command - * @param det_treshold The threshold to trigger speech commands, the range of det_threshold is 0.0~0.9999 + * @param phrase_id The ID of speech command phrase + * @param det_treshold The threshold to trigger speech command phrases */ -typedef int (*esp_mn_iface_op_set_command_det_threshold_t)(model_iface_data_t *model, int speech_command_id, float det_threshold); +typedef void (*esp_mn_iface_op_set_command_det_threshold_t)(model_iface_data_t *model, int phrase_id, float det_threshold); + +/** + * @brief Get the detection threshold by phrase ID + * + * @param model The model object to query + * @param phrase_id The ID of speech command phrase + * + * @return The threshold of speech command phrases + */ +typedef float (*esp_mn_iface_op_get_command_det_threshold_t)(model_iface_data_t *model, int phrase_id); + /** * @brief Get the sample rate of the samples to feed to the detect function * @@ -91,6 +102,7 @@ typedef struct { esp_mn_iface_op_get_samp_chunknum_t get_samp_chunknum; esp_mn_iface_op_set_det_threshold_t set_det_threshold; esp_mn_iface_op_set_command_det_threshold_t set_command_det_threshold; + esp_mn_iface_op_get_command_det_threshold_t get_command_det_threshold; esp_mn_iface_op_detect_t detect; esp_mn_iface_op_destroy_t destroy; esp_mn_iface_op_reset_t reset;