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

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

#include "audiodatastream.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _AudioConfig AudioConfig;

/// 流式接口使用的配置 ///
// 使用默认麦克风的音频输入

AISDK_EXTERN
AudioConfig *
audio_config_create_continuous_audio_input_from_default_microphone();
// 使用数据流的数据作为输入
AISDK_EXTERN
AudioConfig *audio_config_create_continuous_audio_input_from_audio_data_stream(
    AudioDataStream *audio_data_stream);
//////

/// 非流式接口使用的配置 ///
// 使用整块原始数据作为输入
AISDK_EXTERN
AudioConfig *audio_config_create_once_audio_input_from_pcm_data(
    const uint8_t *audio_data, uint32_t data_length);
// 使用pcm文件的数据作为输入
AISDK_EXTERN
AudioConfig *audio_config_create_once_audio_input_from_pcm_file(
    const char *pcm_file);

// 使用整块原始数据作为输出
AISDK_EXTERN
AudioConfig *audio_config_create_audio_output_from_pcm_data();
// 使用系统默认扬声器作为音频输出
AISDK_EXTERN
AudioConfig *audio_config_create_audio_output_from_default_speaker();
// 使用pcm文件作为音频输出
AISDK_EXTERN
AudioConfig *audio_config_create_audio_output_from_pcm_file_name(
    const char *pcm_file);
AISDK_EXTERN
void audio_config_destroy(AudioConfig **config);

// 设置音频的格式
AISDK_EXTERN
void audio_config_set_input_audio_rate(AudioConfig *config, int rate);

// 设置输出音频的格式：语速，可选值：[0-100]，默认为50
AISDK_EXTERN
void audio_config_set_output_audio_speed(AudioConfig *config, int speed);

// 设置输出音频的格式：音量，可选值：[0-100]，默认为50
AISDK_EXTERN
void audio_config_set_output_audio_volume(AudioConfig *config, int volume);

// 设置输出音频的格式：音高，可选值：[0-100]，默认为50
AISDK_EXTERN
void audio_config_set_output_audio_pitch(AudioConfig *config, int pitch);

#ifdef __cplusplus
}
#endif

#endif
