| 1 | /* |
| 2 | * Copyright 2024 KylinSoft Co., Ltd. |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify it under |
| 5 | * the terms of the GNU General Public License as published by the Free Software |
| 6 | * Foundation, either version 3 of the License, or (at your option) any later |
| 7 | * version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 12 | * details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #ifndef __KYLIN_AI_AUDIO_CONFIG_H__ |
| 19 | #define __KYLIN_AI_AUDIO_CONFIG_H__cxx . . $ `include/kylin-ai/coreai/speech/audioconfig.h:19:9`! |
| 20 | |
| 21 | #include <common/macros.h> |
| 22 | #include <stdint.h> |
| 23 | |
| 24 | #include "audiodatastream.h"cxx . . $ `<file>/include/kylin-ai/coreai/speech/audiodatastream.h`/ |
| 25 | |
| 26 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | typedef struct _AudioConfigcxx . . $ _AudioConfig# AudioConfig; |
| 31 | |
| 32 | /// 流式接口使用的配置 /// |
| 33 | // 使用默认麦克风的音频输入 |
| 34 | |
| 35 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 36 | AudioConfig * |
| 37 | audio_config_create_continuous_audio_input_from_default_microphone(); |
| 38 | // 使用数据流的数据作为输入 |
| 39 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 40 | AudioConfig *audio_config_create_continuous_audio_input_from_audio_data_stream( |
| 41 | AudioDataStream *audio_data_stream); |
| 42 | ////// |
| 43 | |
| 44 | /// 非流式接口使用的配置 /// |
| 45 | // 使用整块原始数据作为输入 |
| 46 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 47 | AudioConfig *audio_config_create_once_audio_input_from_pcm_data( |
| 48 | const uint8_tcxx . . $ uint8_t# *audio_data, uint32_tcxx . . $ uint32_t# data_length); |
| 49 | // 使用pcm文件的数据作为输入 |
| 50 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 51 | AudioConfig *audio_config_create_once_audio_input_from_pcm_file( |
| 52 | const char *pcm_file); |
| 53 | |
| 54 | // 使用整块原始数据作为输出 |
| 55 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 56 | AudioConfig *audio_config_create_audio_output_from_pcm_data(); |
| 57 | // 使用系统默认扬声器作为音频输出 |
| 58 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 59 | AudioConfig *audio_config_create_audio_output_from_default_speaker(); |
| 60 | // 使用pcm文件作为音频输出 |
| 61 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 62 | AudioConfig *audio_config_create_audio_output_from_pcm_file_name( |
| 63 | const char *pcm_file); |
| 64 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 65 | void audio_config_destroy(AudioConfig **config); |
| 66 | |
| 67 | // 设置音频的格式 |
| 68 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 69 | void audio_config_set_input_audio_rate(AudioConfig *config, int rate); |
| 70 | |
| 71 | // 设置输出音频的格式:语速,可选值:[0-100],默认为50 |
| 72 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 73 | void audio_config_set_output_audio_speed(AudioConfig *config, int speed); |
| 74 | |
| 75 | // 设置输出音频的格式:音量,可选值:[0-100],默认为50 |
| 76 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 77 | void audio_config_set_output_audio_volume(AudioConfig *config, int volume); |
| 78 | |
| 79 | // 设置输出音频的格式:音高,可选值:[0-100],默认为50 |
| 80 | AISDK_EXTERNcxx . . $ `<external>/16012735566347328758/macros.h:21:9`! |
| 81 | void audio_config_set_output_audio_pitch(AudioConfig *config, int pitch); |
| 82 | |
| 83 | #ifdef __cpluspluscxx . . $ `<built-in>:470:9`! |
| 84 | } |
| 85 | #endif |
| 86 | |
| 87 | #endif |