/*
 * 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_SYNTHESIZER_H__
#define __SPEECH_SYNTHESIZER_H__

#include <common/macros.h>
#include <stdint.h>

#include "audioconfig.h"
#include "config.h"
#include "result.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _SpeechSynthesizerSession SpeechSynthesizerSession;

AISDK_EXTERN
SpeechSynthesizerSession *speech_synthesizer_create_session();

AISDK_EXTERN
void speech_synthesizer_destroy_session(SpeechSynthesizerSession **session);

AISDK_EXTERN
int speech_synthesizer_init_session(SpeechSynthesizerSession *session);

AISDK_EXTERN
void speech_synthesizer_set_audio_config(SpeechSynthesizerSession *session,
                                         AudioConfig *audio_config);
AISDK_EXTERN
void speech_synthesizer_set_model_config(SpeechSynthesizerSession *session,
                                         SpeechModelConfig *config);
AISDK_EXTERN
void speech_synthesizer_result_set_callback(
    SpeechSynthesizerSession *session, SpeechSynthesisResultCallback callback,
    void *user_data);

AISDK_EXTERN
void speech_synthesizer_synthesize_text_async(SpeechSynthesizerSession *session,
                                              const char *text,
                                              uint32_t text_length);

AISDK_EXTERN
int speech_synthesizer_stop_speaking(SpeechSynthesizerSession *session);

#ifdef __cplusplus
}
#endif

#endif
