NIM 跨平台 C++ SDK
载入中...
搜索中...
未找到
nim_audio_cpp.h
浏览该文件的文档.
1
8#ifndef _NIM_TOOLS_SDK_CPP_AUDIO_H_
9#define _NIM_TOOLS_SDK_CPP_AUDIO_H_
10
11#include <assert.h>
12#include <windows.h>
13#include <functional>
14#include <list>
15#include <string>
16
21namespace nim_audio {
22
23#include "nim_audio_def.h"
24
28class Audio {
29public:
36 static bool Init(const std::wstring& user_data_parent_path, const std::wstring& dll_path = L"");
37
42 static void Cleanup();
43
52 static bool PlayAudio(const wchar_t* file_path, const char* call_id, const char* res_id, nim_audio_type audio_format);
53
63 static bool PlayAudio(const wchar_t* file_path, const char* call_id, const char* res_id, nim_audio_type audio_format, int seek);
64
69 static bool StopPlayAudio();
70
76 static bool RegStartPlayCb(nim_rescode_id_cb cb);
77
83 static bool RegStopPlayCb(nim_rescode_id_cb cb);
84
90 static bool RegStartCaptureCb(nim_rescode_cb cb);
91
98
104 static bool RegCancelAudioCb(nim_rescode_cb cb);
105
115 static bool StartCapture(const char* call_id,
116 const char* res_id,
117 nim_audio_type audio_format = AAC,
118 int volume = 180,
119 const wchar_t* capture_device = nullptr);
120
125 static bool StopCapture();
126
131 static bool CancelAudio(const wchar_t* file_path);
132
139
144 static bool EnumCaptureDevice();
145
146private:
147 template <typename F>
148 static F Function(const char* function_name) {
149 F f = (F)::GetProcAddress(instance_audio_, function_name);
150 assert(f);
151 return f;
152 }
153
154private:
155 static HINSTANCE instance_audio_;
156};
157
158} // namespace nim_audio
159
160#endif //_NIM_TOOLS_SDK_CPP_AUDIO_H_
NIM 提供的语音录制和播放接口
Definition: nim_audio_cpp.h:28
static HINSTANCE instance_audio_
Definition: nim_audio_cpp.h:155
static bool RegStartCaptureCb(nim_rescode_cb cb)
Definition: nim_audio_cpp.cpp:89
static bool Init(const std::wstring &user_data_parent_path, const std::wstring &dll_path=L"")
Definition: nim_audio_cpp.cpp:39
static bool StopPlayAudio()
Definition: nim_audio_cpp.cpp:74
static bool StartCapture(const char *call_id, const char *res_id, nim_audio_type audio_format=AAC, int volume=180, const wchar_t *capture_device=nullptr)
Definition: nim_audio_cpp.cpp:104
static bool RegStartPlayCb(nim_rescode_id_cb cb)
Definition: nim_audio_cpp.cpp:79
static bool RegEnumCaptureDeviceCb(nim_enum_capture_device_cb cb)
Definition: nim_audio_cpp.cpp:123
static bool PlayAudio(const wchar_t *file_path, const char *call_id, const char *res_id, nim_audio_type audio_format)
Definition: nim_audio_cpp.cpp:66
static void Cleanup()
Definition: nim_audio_cpp.cpp:57
static bool StopCapture()
Definition: nim_audio_cpp.cpp:113
static bool CancelAudio(const wchar_t *file_path)
Definition: nim_audio_cpp.cpp:118
static bool RegStopPlayCb(nim_rescode_id_cb cb)
Definition: nim_audio_cpp.cpp:84
static F Function(const char *function_name)
Definition: nim_audio_cpp.h:148
static bool RegCancelAudioCb(nim_rescode_cb cb)
Definition: nim_audio_cpp.cpp:99
static bool EnumCaptureDevice()
Definition: nim_audio_cpp.cpp:128
static bool RegStopCaptureCb(nim_stop_capture_cb cb)
Definition: nim_audio_cpp.cpp:94
NIM提供的语音播放工具
Definition: nim_audio_cpp.cpp:10
NIM 提供的语音录制和播放工具接口的相关定义的头文件
void(* nim_stop_capture_cb)(int rescode, const char *call_id, const char *res_id, const char *file_path, const char *file_ext, long file_size, int audio_duration)
Definition: nim_audio_def.h:74
void(* nim_rescode_cb)(int)
Definition: nim_audio_def.h:47
void(* nim_rescode_id_cb)(int rescode, const char *file_path, const char *call_id, const char *res_id)
Definition: nim_audio_def.h:56
void(* nim_enum_capture_device_cb)(int rescode, const wchar_t *device_list)
Definition: nim_audio_def.h:87
nim_audio_type
Definition: nim_audio_def.h:36
@ AAC
aac格式
Definition: nim_audio_def.h:38