/*
 * Copyright 2024 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef __SPEECH_RECOGNIZER_H__
#define __SPEECH_RECOGNIZER_H__

#include "audioconfig.h"
#include "common/macros.h"
#include "config.h"
#include "result.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _SpeechRecognitionSession SpeechRecognitionSession;

AISDK_EXTERN
SpeechRecognitionSession *speech_recognizer_create_session();

AISDK_EXTERN
void speech_recognizer_destroy_session(SpeechRecognitionSession **session);

AISDK_EXTERN
int speech_recognizer_init_session(SpeechRecognitionSession *session);

// 识别结果回调
AISDK_EXTERN
void speech_recognizer_result_set_callback(
    SpeechRecognitionSession *session, SpeechRecognitionResultCallback callback,
    void *user_data);

// 配置模型
AISDK_EXTERN
void speech_recognizer_set_model_config(SpeechRecognitionSession *session,
                                        SpeechModelConfig *config);
// 设置输入音频的配置
AISDK_EXTERN
void speech_recognizer_set_audio_config(SpeechRecognitionSession *session,
                                        AudioConfig *audio_config);

// 开始连续语音识别
AISDK_EXTERN
void speech_recognizer_start_continuous_recognition_async(
    SpeechRecognitionSession *session);

// 停止连续语音识别
AISDK_EXTERN
void speech_recognizer_stop_continuous_recognition_async(
    SpeechRecognitionSession *session);

// 1一次性识别，适用于识别一个音频文件或者一段内存数据
AISDK_EXTERN
void speech_recognizer_recognize_once_async(SpeechRecognitionSession *session);

#ifdef __cplusplus
}
#endif

#endif
