NIM Tools API  5.5.0
All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
Functions
nim_audio.h File Reference

NIM 提供的语音录制和播放C接口的说明文件 More...

#include "include/nim_audio_def.h"
#include "nim_sdk_dll.h"

Go to the source code of this file.

Functions

NIM_SDK_DLL_API bool nim_audio_init_module (const wchar_t *user_data_parent_path)
 
NIM_SDK_DLL_API bool nim_audio_uninit_module ()
 
NIM_SDK_DLL_API bool nim_audio_play_audio (const wchar_t *file_path, const char *call_id, const char *res_id, int audio_format)
 
NIM_SDK_DLL_API bool nim_audio_play_audio_ex (const wchar_t *file_path, const char *call_id, const char *res_id, int audio_format, int seek)
 
NIM_SDK_DLL_API bool nim_audio_stop_play_audio ()
 
NIM_SDK_DLL_API bool nim_audio_reg_start_play_cb (nim_rescode_id_cb cb)
 
NIM_SDK_DLL_API bool nim_audio_reg_stop_play_cb (nim_rescode_id_cb cb)
 
NIM_SDK_DLL_API bool nim_audio_reg_start_capture_cb (nim_rescode_cb cb)
 
NIM_SDK_DLL_API bool nim_audio_reg_stop_capture_cb (nim_stop_capture_cb cb)
 
NIM_SDK_DLL_API bool nim_audio_reg_cancel_audio_cb (nim_rescode_cb cb)
 
NIM_SDK_DLL_API bool nim_audio_start_capture (const char *call_id, const char *res_id, int audio_format=0, int volume=180, const wchar_t *capture_device=nullptr)
 
NIM_SDK_DLL_API bool nim_audio_stop_capture ()
 
NIM_SDK_DLL_API bool nim_audio_cancel_audio (const wchar_t *file_path)
 
NIM_SDK_DLL_API bool nim_audio_reg_enum_capture_device_cb (nim_enum_capture_device_cb cb)
 
NIM_SDK_DLL_API bool nim_audio_enum_capture_device ()
 

Detailed Description

NIM 提供的语音录制和播放C接口的说明文件

Author
Oleg
Date
2015/2/10

Function Documentation

◆ nim_audio_cancel_audio()

bool nim_audio_cancel_audio ( const wchar_t *  file_path)

NIM SDK 取消录制并删除临时文件

Returns
bool true 调用成功,false 调用失败

◆ nim_audio_enum_capture_device()

bool nim_audio_enum_capture_device ( )

NIM SDK 枚举本地录音采集设备

Returns
bool true 调用成功,false 调用失败

◆ nim_audio_init_module()

bool nim_audio_init_module ( const wchar_t *  user_data_parent_path)

NIM SDK 初始化语音模块

Parameters
[in]user_data_parent_path缓存目录
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_play_audio()

bool nim_audio_play_audio ( const wchar_t *  file_path,
const char *  call_id,
const char *  res_id,
int  audio_format 
)

NIM SDK 播放,通过回调获取开始播放状态

Parameters
[in]file_path播放文件绝对路径
[in]call_id用以定位资源的一级ID,可选
[in]res_id用以定位资源的二级ID,可选
[in]audio_format播放音频格式,AAC : 0, AMR : 1
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_play_audio_ex()

bool nim_audio_play_audio_ex ( const wchar_t *  file_path,
const char *  call_id,
const char *  res_id,
int  audio_format,
int  seek 
)

NIM SDK 播放,通过回调获取开始播放状态

Parameters
[in]file_path播放文件绝对路径
[in]call_id用以定位资源的一级ID,可选
[in]res_id用以定位资源的二级ID,可选
[in]audio_format播放音频格式,AAC : 0, AMR : 1
[in]seek播放的起始位置(时间) 单位ms
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_reg_cancel_audio_cb()

bool nim_audio_reg_cancel_audio_cb ( nim_rescode_cb  cb)

NIM SDK 注册取消录制并删除临时文件事件回调

Parameters
[in]cb回调函数 见nim_audio_def.h
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_reg_enum_capture_device_cb()

bool nim_audio_reg_enum_capture_device_cb ( nim_enum_capture_device_cb  cb)

NIM SDK 注册枚举本地录音采集设备回调

Parameters
[in]cb回调函数 见nim_audio_def.h
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_reg_start_capture_cb()

bool nim_audio_reg_start_capture_cb ( nim_rescode_cb  cb)

NIM SDK 注册录制语音回调

Parameters
[in]cb回调函数 见nim_audio_def.h
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_reg_start_play_cb()

bool nim_audio_reg_start_play_cb ( nim_rescode_id_cb  cb)

NIM SDK 注册播放开始事件回调

Parameters
[in]cb回调函数 见nim_audio_def.h
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_reg_stop_capture_cb()

bool nim_audio_reg_stop_capture_cb ( nim_stop_capture_cb  cb)

NIM SDK 注册录制语音结束回调

Parameters
[in]cb回调函数 见nim_audio_def.h
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_reg_stop_play_cb()

bool nim_audio_reg_stop_play_cb ( nim_rescode_id_cb  cb)

NIM SDK 注册播放结束事件回调

Parameters
[in]cb回调函数 见nim_audio_def.h
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_start_capture()

bool nim_audio_start_capture ( const char *  call_id,
const char *  res_id,
int  audio_format = 0,
int  volume = 180,
const wchar_t *  capture_device = nullptr 
)

NIM SDK 录制语音

Parameters
[in]call_id用以定位资源的一级ID,可选
[in]res_id用以定位资源的二级ID,可选
[in]audio_format音频格式,AAC : 0, AMR : 1
[in]volume音量(0 - 255, 默认180)
[in]capture_device录音设备
Returns
bool true 调用成功,false 调用失败

◆ nim_audio_stop_capture()

bool nim_audio_stop_capture ( )

NIM SDK 停止录制语音

Returns
bool true 调用成功,false 调用失败

◆ nim_audio_stop_play_audio()

bool nim_audio_stop_play_audio ( )

NIM SDK 停止播放,通过回调获取停止播放状态

Returns
bool true 调用成功,false 调用失败

◆ nim_audio_uninit_module()

bool nim_audio_uninit_module ( )

NIM SDK 卸载语音模块(只有在主程序关闭时才有必要调用此接口)

Returns
bool true 调用成功,false 调用失败