NERtc Unity SDK V.5.4.124
载入中...
搜索中...
未找到
Public 成员函数 | 所有成员列表
nertc.IAudioDeviceManager类 参考abstract
类 nertc.IAudioDeviceManager 继承关系图:

Public 成员函数

IDeviceCollection EnumerateRecordDevices ()
 
int SetRecordDevice (string deviceId)
 
int GetRecordDevice (out string deviceId)
 
IDeviceCollection EnumeratePlayoutDevices ()
 
int SetPlayoutDevice (string deviceId)
 
int GetPlayoutDevice (out string deviceId)
 
int SetRecordDeviceVolume (uint volume)
 
int GetRecordDeviceVolume (ref uint volume)
 
int SetPlayoutDeviceVolume (uint volume)
 
int GetPlayoutDeviceVolume (ref uint volume)
 
int SetPlayoutDeviceMute (bool mute)
 
int GetPlayoutDeviceMute (ref bool mute)
 
int SetRecordDeviceMute (bool mute)
 
int GetRecordDeviceMute (ref bool mute)
 
int StartRecordDeviceTest (ulong indicationInterval)
 
int StopRecordDeviceTest ()
 
int StartPlayoutDeviceTest (string testAudioFilePath)
 
int StopPlayoutDeviceTest ()
 
int StartAudioDeviceLoopbackTest (ulong indicationInterval)
 
int StopAudioDeviceLoopbackTest ()
 

详细描述

音频设备管理方法。
此接口类提供用于管理音频设备的相关接口。可以通过 IRtcEngine 类来获取 IAudioDeviceManager 接口。该接口类只支持 Windows 和 macOS 系统,不支持 Android 和 iOS 系统。

成员函数说明

◆ EnumerateRecordDevices()

IDeviceCollection nertc.IAudioDeviceManager.EnumerateRecordDevices ( )
abstract

获取系统中所有的音频采集设备列表。
该方法返回一个 IDeviceCollection 对象,包含系统中所有的音频采集设备。通过 IDeviceCollection 对象,App 可以枚举音频采集设备。

注解
在使用结束后,App 需调用 Destroy 方法销毁返回的对象。
返回
  • 方法调用成功:一个 IDeviceCollection 对象,包含所有的音频采集设备。
  • 方法调用失败:NULL。

◆ SetRecordDevice()

int nertc.IAudioDeviceManager.SetRecordDevice ( string deviceId)
abstract

指定音频采集设备。

参数
deviceId音频采集设备的设备 ID。可通过 EnumerateRecordDevices获取。插拔设备不会影响 deviceId。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ GetRecordDevice()

int nertc.IAudioDeviceManager.GetRecordDevice ( out string deviceId)
abstract

获取当前使用的音频采集设备 ID。

参数
deviceId音频采集设备的设备 ID。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ EnumeratePlayoutDevices()

IDeviceCollection nertc.IAudioDeviceManager.EnumeratePlayoutDevices ( )
abstract

获取系统中所有的播放设备列表。
该方法返回一个 IDeviceCollection 对象,包含系统中所有的播放设备。通过 IDeviceCollection 对象,App 可以枚举播放设备。在使用结束后,App 需调用 Destroy 方法销毁返回的对象。

注解
程序必须调用 Destroy 方法销毁返回的值。
返回
  • 方法调用成功:一个 IDeviceCollection 对象,包含所有的音频播放设备。
  • 方法调用失败:NULL。

◆ SetPlayoutDevice()

int nertc.IAudioDeviceManager.SetPlayoutDevice ( string deviceId)
abstract

指定播放设备。

参数
deviceId音频播放设备的设备 ID。可以通过 EnumeratePlayoutDevices 获取。插拔设备不会影响 deviceId。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ GetPlayoutDevice()

int nertc.IAudioDeviceManager.GetPlayoutDevice ( out string deviceId)
abstract

获取当前使用的音频播放设备 ID。

参数
deviceId音频播放设备的设备 ID。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ SetRecordDeviceVolume()

int nertc.IAudioDeviceManager.SetRecordDeviceVolume ( uint volume)
abstract

设置音频采集设备音量。

参数
volume音频采集设备音量。取值范围为 0~255。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ GetRecordDeviceVolume()

int nertc.IAudioDeviceManager.GetRecordDeviceVolume ( ref uint volume)
abstract

获取音频采集设备音量。

参数
volume音频采集设备音量。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ SetPlayoutDeviceVolume()

int nertc.IAudioDeviceManager.SetPlayoutDeviceVolume ( uint volume)
abstract

设置音频播放设备音量。

参数
volume音频播放设备音量。取值范围为 0~255。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ GetPlayoutDeviceVolume()

int nertc.IAudioDeviceManager.GetPlayoutDeviceVolume ( ref uint volume)
abstract

获取音频播放设备音量。

参数
volume音频播放设备音量。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ SetPlayoutDeviceMute()

int nertc.IAudioDeviceManager.SetPlayoutDeviceMute ( bool mute)
abstract

静音或取消静音音频播放设备。

参数
mute是否静音音频播放设备。
  • true:静音音频播放设备。
  • false:取消静音音频播放设备。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ GetPlayoutDeviceMute()

int nertc.IAudioDeviceManager.GetPlayoutDeviceMute ( ref bool mute)
abstract

获取音频播放设备静音状态。

参数
mute音频播放设备静音状态。
  • true:静音状态。
  • false:非静音状态。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ SetRecordDeviceMute()

int nertc.IAudioDeviceManager.SetRecordDeviceMute ( bool mute)
abstract

静音或取消静音音频采集设备。

参数
mute是否静音音频采集设备。
  • true:静音音频采集设备。
  • false:取消静音音频采集设备。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ GetRecordDeviceMute()

int nertc.IAudioDeviceManager.GetRecordDeviceMute ( ref bool mute)
abstract

获取音频采集设备静音状态。

参数
mute音频采集设备静音状态。
  • true: 静音状态。
  • false: 非静音状态。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ StartRecordDeviceTest()

int nertc.IAudioDeviceManager.StartRecordDeviceTest ( ulong indicationInterval)
abstract

启动音频采集设备测试。
该方法测试音频采集设备是否能正常工作。
调用该方法后,SDK 会按设置的时间间隔触发 OnLocalAudioVolumeIndication 回调, 报告采集设备的音量信息。

注解
  • 该方法需在加入房间前调用。
  • 音频采集设备测试会在通话开始后自动结束,您也可以手动调用 StopRecordDeviceTest 停止音频采集设备测试。
参数
indicationIntervalSDK 返回 OnLocalAudioVolumeIndication 回调的时间间隔,单位为毫秒。
返回
  • 0: Success.
  • other: Failure.

◆ StopRecordDeviceTest()

int nertc.IAudioDeviceManager.StopRecordDeviceTest ( )
abstract

停止音频采集设备测试。
该方法停止音频采集设备测试。

注解
  • 该方法需在加入房间前调用。
  • 音频采集设备测试会在通话开始后自动结束,您也可以手动调用 StopRecordDeviceTest 停止音频采集设备测试。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ StartPlayoutDeviceTest()

int nertc.IAudioDeviceManager.StartPlayoutDeviceTest ( string testAudioFilePath)
abstract

启动音频播放设备测试。 该方法测试音频播放设备是否能正常工作。启动测试后,SDK 播放指定的音频文件,测试者如果能听到声音,说明播放设备能正常工作。 调用该方法后,SDK 会每隔 100 ms 触发一次 OnLocalAudioVolumeIndication 回调,报告播放设备的音量信息。

注解
  • 该方法需在加入房间前调用。
  • 音频播放设备测试会在通话开始后自动结束,您也可以手动调用 StopPlayoutDeviceTest 停止音频播放设备测试。
  • 支持文件格式包括 wav、mp3、aac。
参数
testAudioFilePath音频文件的绝对路径,路径字符串使用 UTF-8 编码格式。
返回
  • 0: 成功,并且可以听到所设置文件的声音。
  • 其他:失败。

◆ StopPlayoutDeviceTest()

int nertc.IAudioDeviceManager.StopPlayoutDeviceTest ( )
abstract

停止播放设备测试。

注解
  • 该方法需在加入房间前调用。
  • 播放设备测试会在通话开始后自动结束,您也可以手动调用 StopPlayoutDeviceTest 停止播放设备测试。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ StartAudioDeviceLoopbackTest()

int nertc.IAudioDeviceManager.StartAudioDeviceLoopbackTest ( ulong indicationInterval)
abstract

开始音频设备回路测试。
该方法测试音频采集和播放设备是否能正常工作。一旦测试开始,音频采集设备会采集本地音频,然后使用音频播放设备播放出来。 SDK 会按设置的时间间隔触发 nertc::OnLocalAudioVolumeIndication "onLocalAudioVolumeIndication" 回调, 报告音量信息。

注解
  • 该方法需在加入房间前调用。
  • 音频设备回路测试会在通话开始后自动结束,您也可以手动调用 StopAudioDeviceLoopbackTest 停止音频设备回路测试。
  • 该方法仅在本地进行音频设备测试,不涉及网络连接。
参数
indicationIntervalSDK 返回 onLocalAudioVolumeIndication 回调的 时间间隔,单位为毫秒。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

◆ StopAudioDeviceLoopbackTest()

int nertc.IAudioDeviceManager.StopAudioDeviceLoopbackTest ( )
abstract

停止音频设备回路测试。

注解
  • 该方法需在加入房间前调用。
  • 音频设备回路测试会在通话开始后自动结束,您也可以手动调用 StopAudioDeviceLoopbackTest 停止音频设备回路测试。
返回
  • 0: 方法调用成功;
  • 其他: 方法调用失败。

该类的文档由以下文件生成: