Class ITXAudioEffectManager
腾讯云视频通话功能音乐和人声设置接口
Inheritance
Inherited Members
Namespace: trtc
Assembly: cs.temp.dll.dll
Syntax
public abstract class ITXAudioEffectManager
Methods
getMusicCurrentPosInMS(Int32)
2.10 获取背景音乐当前的播放进度(单位:毫秒)
Declaration
public abstract int getMusicCurrentPosInMS(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
Returns
| Type | Description |
|---|---|
| System.Int32 | 成功返回当前播放时间,单位:毫秒,失败返回-1 |
getMusicDurationInMS(String)
2.12 获取景音乐文件的总时长(单位:毫秒)
Declaration
public abstract int getMusicDurationInMS(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path | 音乐文件路径,如果 path 为空,那么返回当前正在播放的 music 时长。 |
Returns
| Type | Description |
|---|---|
| System.Int32 | 成功返回时长,失败返回-1 |
pausePlayMusic(Int32)
2.3 暂停播放背景音乐
Declaration
public abstract void pausePlayMusic(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
resumePlayMusic(Int32)
2.4 恢复播放背景音乐
Declaration
public abstract void resumePlayMusic(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
seekMusicToPosInMS(Int32, Int32)
2.11 设置背景音乐的播放进度(单位:毫秒)
Declaration
public abstract void seekMusicToPosInMS(int id, int pts)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
| System.Int32 | pts | 单位: 毫秒 |
Remarks
请尽量避免频繁地调用该接口,因为该接口可能会再次读写音乐文件,耗时稍高。 当配合进度条使用时,请在进度条拖动完毕的回调中调用,而避免在拖动过程中实时调用。
setAllMusicVolume(Int32)
2.7 设置全局背景音乐的本地和远端音量的大小
Declaration
public abstract void setAllMusicVolume(int volume)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | volume | 音量大小,100为原始音量,范围是:[0 ~ 150],默认值为100 |
Remarks
如果要将 volume 设置为大于100的数值,需要进行特殊配置,请联系技术支持。
setMusicObserver(Int32, ITXMusicPlayObserver)
设置背景音乐的播放进度回调接口
Declaration
public abstract void setMusicObserver(int musicId, ITXMusicPlayObserver observer)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | musicId | 音乐 ID |
| ITXMusicPlayObserver | observer | 具体参考 ITXMusicPlayObserver 中定义接口 |
setMusicPitch(Int32, Double)
2.8 调整背景音乐的音调高低
Declaration
public abstract void setMusicPitch(int id, double pitch)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
| System.Double | pitch | 音调,默认值是0.0f,范围是:[-1 ~ 1] 之间的浮点数; |
setMusicPlayoutVolume(Int32, Int32)
2.6 设置背景音乐的本地音量大小,即主播可以通过此接口设置主播自己本地的背景音乐的音量大小。
Declaration
public abstract void setMusicPlayoutVolume(int id, int volume)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
| System.Int32 | volume | 音量大小,100为原始音量,范围是:[0 ~ 150],默认值为100 |
Remarks
如果要将 volume 设置为大于100的数值,需要进行特殊配置,请联系技术支持。
setMusicPublishVolume(Int32, Int32)
2.5 设置背景音乐的远端音量大小,即主播可以通过此接口设置远端观众能听到的背景音乐的音量大小。
Declaration
public abstract void setMusicPublishVolume(int id, int volume)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
| System.Int32 | volume | 音量大小,100为原始音量,范围是:[0 ~ 150],默认值为100 |
Remarks
如果要将 volume 设置为大于100的数值,需要进行特殊配置,请联系技术支持。
setMusicSpeedRate(Int32, Double)
2.9 调整背景音乐的变速效果
Declaration
public abstract void setMusicSpeedRate(int id, double speedRate)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |
| System.Double | speedRate | 速度,默认值是1.0f,范围是:[0.5 ~ 2] 之间的浮点数; |
setVoiceCaptureVolume(Int32)
1.5 设置麦克风采集人声的音量
Declaration
public abstract void setVoiceCaptureVolume(int volume)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | volume | 音量大小,100为原始音量,范围是:[0 ~ 150],默认值为100 |
Remarks
如果要将 volume 设置为大于100的数值,需要进行特殊配置,请联系技术支持。
setVoiceReverbType(TXVoiceReverbType)
1.3 设置人声的混响效果(KTV、小房间、大会堂、低沉、洪亮...)
Declaration
public abstract void setVoiceReverbType(TXVoiceReverbType reverbType)
Parameters
| Type | Name | Description |
|---|---|---|
| TXVoiceReverbType | reverbType |
Remarks
设置的效果在退房后会失效,如果下次进房还需要对应特效,需要调用此接口再次设置。
startPlayMusic(AudioMusicParam)
2.1 开始播放背景音乐
每个音乐都需要您指定具体的 ID,您可以通过该 ID 对音乐的开始、停止、音量等进行设置。
Declaration
public abstract void startPlayMusic(AudioMusicParam musicParam)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioMusicParam | musicParam | 音乐参数 |
Remarks
若您想同时播放多个音乐,请分配不同的 ID 进行播放。 如果使用同一个 ID 播放不同音乐,SDK 会先停止播放旧的音乐,再播放新的音乐。
stopPlayMusic(Int32)
2.2 停止播放背景音乐
Declaration
public abstract void stopPlayMusic(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | id | 音乐 ID |