Class ITXAudioEffectManager
TRTC music and audio effect APIs
Inheritance
Inherited Members
Namespace: trtc
Assembly: cs.temp.dll.dll
Syntax
public abstract class ITXAudioEffectManager
Methods
getMusicCurrentPosInMS(Int32)
2.10 Get the playback progress (ms) of background music
Declaration
public abstract int getMusicCurrentPosInMS(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
Returns
Type | Description |
---|---|
System.Int32 | The current playback time (ms) is returned if this API is called successfully; otherwise, |
getMusicDurationInMS(String)
2.12 Get the total music length (ms)
Declaration
public abstract int getMusicDurationInMS(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path of the music file. If it is not specified, the length of the music file being played is returned. |
Returns
Type | Description |
---|---|
System.Int32 | The total music length is returned if this API is called successfully; otherwise, |
pausePlayMusic(Int32)
2.3 Pause background music
Declaration
public abstract void pausePlayMusic(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
resumePlayMusic(Int32)
2.4 Resume background music
Declaration
public abstract void resumePlayMusic(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
seekMusicToPosInMS(Int32, Int32)
2.11 Set the playback progress (ms) of background music
Declaration
public abstract void seekMusicToPosInMS(int id, int pts)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
System.Int32 | pts | Playback progress (ms) |
Remarks
Do not call this API frequently as the music file may be read and written each time the API is called, which can be time-consuming. If you use this API to implement a draggable progress bar, do not call it during dragging, but after receiving the callback that indicates the completion of dragging.
setAllMusicVolume(Int32)
2.7 Set the global (local and remote) volume of background music
Declaration
public abstract void setAllMusicVolume(int volume)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | volume | Volume. Value range: 0-150. Default value: |
Remarks
You need to contact technical support to use a value higher than 100
.
setMusicObserver(Int32, ITXMusicPlayObserver)
Set the callback of the playback progress of background music
Declaration
public abstract void setMusicObserver(int musicId, ITXMusicPlayObserver observer)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | musicId | Music ID |
ITXMusicPlayObserver | observer | For more information, please see the APIs defined in |
setMusicPitch(Int32, Double)
2.8 Adjust the pitch of background music
Declaration
public abstract void setMusicPitch(int id, double pitch)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
System.Double | pitch | Pitch. Value range: [-1, 1] (floating point number). Default value: 0.0f |
setMusicPlayoutVolume(Int32, Int32)
2.6 Set the volume of background music heard by the anchor
Declaration
public abstract void setMusicPlayoutVolume(int id, int volume)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
System.Int32 | volume | Volume. Value range: 0-150. Default value: |
Remarks
You need to contact technical support to use a value higher than 100
.
setMusicPublishVolume(Int32, Int32)
2.5 Set the volume of the anchor’s background music heard by remote users
Declaration
public abstract void setMusicPublishVolume(int id, int volume)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
System.Int32 | volume | Volume. Value range: 0-150. Default value: |
Remarks
You need to contact technical support to use a value higher than 100
.
setMusicSpeedRate(Int32, Double)
2.9 Change the speed of background music
Declaration
public abstract void setMusicSpeedRate(int id, double speedRate)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |
System.Double | speedRate |
setVoiceCaptureVolume(Int32)
1.5 Set the mic capturing volume
Declaration
public abstract void setVoiceCaptureVolume(int volume)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | volume | Volume. Value range: 0-150. Default value: |
Remarks
You need to contact technical support to use a value higher than 100
.
setVoiceReverbType(TXVoiceReverbType)
1.3 Set a reverb effect (karaoke, room, hall, deep, resonant, etc.)
Declaration
public abstract void setVoiceReverbType(TXVoiceReverbType reverbType)
Parameters
Type | Name | Description |
---|---|---|
TXVoiceReverbType | reverbType |
Remarks
An effect becomes invalid after you leave the room. If you want to use the same effect the next time, you need to call this API again after room entry.
startPlayMusic(AudioMusicParam)
2.1 Start background music
You must assign an ID to each music track so that you can start, stop, or set the volume of music tracks by ID.
Declaration
public abstract void startPlayMusic(AudioMusicParam musicParam)
Parameters
Type | Name | Description |
---|---|---|
AudioMusicParam | musicParam | Music parameters |
Remarks
To play multiple music tracks at the same time, assign different IDs to them. If you use the same ID to play a music track different from the current one, the SDK will stop the current one before playing the new one.
stopPlayMusic(Int32)
2.2 Stop background music
Declaration
public abstract void stopPlayMusic(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Music ID |