diff --git a/CMakeLists.txt b/CMakeLists.txt index 02d6c45..4ab3204 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,6 @@ IF (IDF_VERSION_MAJOR GREATER 3) add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libesp_audio_front_end.a" PRIV_REQUIRES esp-sr) ENDIF (IDF_VERSION_MAJOR GREATER 3) target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group" - wakenet multinet dl_lib c_speech_features @@ -36,6 +35,7 @@ ENDIF (IDF_VERSION_MAJOR GREATER 3) esp_audio_front_end esp_tts_chinese voice_set_xiaole + wakenet "-Wl,--end-group") elseif(${IDF_TARGET} STREQUAL "esp32s2") set(COMPONENT_ADD_INCLUDEDIRS @@ -88,7 +88,6 @@ elseif(${IDF_TARGET} STREQUAL "esp32s3") add_prebuilt_library(hufzip "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libhufzip.a" PRIV_REQUIRES esp-sr) target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group" - wakenet hufzip dl_lib esp-dsp @@ -98,6 +97,7 @@ elseif(${IDF_TARGET} STREQUAL "esp32s3") multinet esp_tts_chinese voice_set_xiaole + wakenet "-Wl,--end-group") set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py) diff --git a/include/esp32/esp_mn_iface.h b/include/esp32/esp_mn_iface.h index 63e5a4d..319cb00 100644 --- a/include/esp32/esp_mn_iface.h +++ b/include/esp32/esp_mn_iface.h @@ -7,6 +7,10 @@ #define ESP_MN_MAX_PHRASE_LEN 63 #define ESP_MN_MIN_PHRASE_LEN 2 +#define ESP_MN_PREFIX "mn" +#define ESP_MN_ENGLISH "en" +#define ESP_MN_CHINESE "cn" + typedef enum { ESP_MN_STATE_DETECTING = 0, // detecting ESP_MN_STATE_DETECTED = 1, // detected @@ -84,6 +88,14 @@ typedef int (*esp_mn_iface_op_set_det_threshold_t)(model_iface_data_t *model, fl */ typedef int (*esp_mn_iface_op_get_samp_rate_t)(model_iface_data_t *model); +/** + * @brief Get the language of model + * + * @param model The language name + * @return Language name string defined in esp_mn_models.h, eg: ESP_MN_CHINESE, ESP_MN_ENGLISH + */ +typedef char * (*esp_mn_iface_op_get_language_t)(model_iface_data_t *model); + /** * @brief Feed samples of an audio stream to the speech recognition model and detect if there is a speech command found. * @@ -133,6 +145,7 @@ typedef struct { esp_mn_iface_op_get_samp_chunksize_t get_samp_chunksize; 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_get_language_t get_language; esp_mn_iface_op_detect_t detect; esp_mn_iface_op_destroy_t destroy; esp_mn_iface_op_get_results_t get_results; diff --git a/include/esp32/esp_mn_models.h b/include/esp32/esp_mn_models.h index 37fba80..15d7ddd 100644 --- a/include/esp32/esp_mn_models.h +++ b/include/esp32/esp_mn_models.h @@ -5,11 +5,6 @@ //a specific phrase or word. - -#define ESP_MN_PREFIX "mn" -#define ESP_MN_ENGLISH "en" -#define ESP_MN_CHINESE "cn" - /** * @brief Get the multinet handle from model name * diff --git a/src/esp_process_sdkconfig.c b/src/esp_process_sdkconfig.c index 6731f13..9711add 100644 --- a/src/esp_process_sdkconfig.c +++ b/src/esp_process_sdkconfig.c @@ -878,7 +878,7 @@ esp_mn_error_t* esp_mn_commands_update_from_sdkconfig(const esp_mn_iface_t *mult printf("esp_mn_commands_update_from_sdkconfig\n"); int total_phrase_num = 0; int language_id = 1; // 0: Chinese, 1:English -#ifdef CONFIG_SR_MN_CN_MULTINET2_SINGLE_RECOGNITION +#ifdef CONFIG_IDF_TARGET_ESP32 language_id = 1; #else if (strcmp(ESP_MN_CHINESE, multinet->get_language(model_data)) == 0) {