Inherits agora_gaming_rtc.IAudioEffectManager.
|
override double | GetEffectsVolume () |
|
override int | SetEffectsVolume (int volume) |
|
override int | PlayEffect (int soundId, string filePath, int loopCount, double pitch=1.0D, double pan=0.0D, int gain=100, bool publish=false) |
|
override int | PlayEffect (int soundId, string filePath, int loopCount, double pitch, double pan, int gain, bool publish, int startPos) |
|
override int | GetEffectDuration (string filePath) |
|
override int | SetEffectPosition (int soundId, int pos) |
|
override int | GetEffectCurrentPosition (int soundId) |
|
override int | StopEffect (int soundId) |
|
override int | StopAllEffects () |
|
override int | PreloadEffect (int soundId, string filePath) |
|
override int | UnloadEffect (int soundId) |
|
override int | PauseEffect (int soundId) |
|
override int | PauseAllEffects () |
|
override int | ResumeEffect (int soundId) |
|
override int | ResumeAllEffects () |
|
override int | SetVoiceOnlyMode (bool enable) |
|
override int | SetRemoteVoicePosition (uint uid, double pan, double gain) |
|
override int | SetLocalVoicePitch (double pitch) |
|
◆ GetEffectsVolume()
override double agora_gaming_rtc.AudioEffectManagerImpl.GetEffectsVolume |
( |
| ) |
|
Retrieves the volume of the audio effects.
The value ranges between 0.0 and 100.0.
- Note
- Ensure that this method is called after PlayEffect.
- Returns
- ≥ 0: Volume of the audio effects, if this method call succeeds.
- < 0: Failure.
◆ SetEffectsVolume()
override int agora_gaming_rtc.AudioEffectManagerImpl.SetEffectsVolume |
( |
int |
volume | ) |
|
Sets the volume of the audio effects.
- Note
- Ensure that this method is called after PlayEffect.
- Parameters
-
volume | Sets the volume of the audio effects. The value ranges between 0 and 100 (default). |
- Returns
- 0: Success.
- < 0: Failure.
◆ PlayEffect() [1/2]
override int agora_gaming_rtc.AudioEffectManagerImpl.PlayEffect |
( |
int |
soundId, |
|
|
string |
filePath, |
|
|
int |
loopCount, |
|
|
double |
pitch = 1.0D , |
|
|
double |
pan = 0.0D , |
|
|
int |
gain = 100 , |
|
|
bool |
publish = false |
|
) |
| |
Plays a specified local or online audio effect file.
- Deprecated:
- This method is deprecated. Use PlayEffect[2/2] instead.
This method allows you to set the loop count, pitch, pan, and gain of the audio effect file, as well as whether the remote user can hear the audio effect.
To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time.
- Note
- If the audio effect is preloaded into the memory through the PreloadEffect method, the value of
soundId
must be the same as that in the PreloadEffect
method.
- Playing multiple online audio effect files simultaneously is not supported on macOS and Windows.
- Ensure that you call this method after joining a channel.
- Parameters
-
soundId | ID of the specified audio effect. Each audio effect has a unique ID. |
filePath | Specifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file. For example: C:\music\audio.mp4 . Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. For more information, see Supported Media Formats in Media Foundation. When you access a local file on Android, Agora recommends passing a URI address or the path starts with /assets/ in this parameter. |
loopCount | Sets the number of times the audio effect loops:
- 0: Play the audio effect once.
- 1: Play the audio effect twice.
- -1: Play the audio effect in an indefinite loop until the StopEffect or StopAllEffects method is called.
|
pitch | Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. |
pan | Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0:
- 0.0: The audio effect displays ahead.
- 1.0: The audio effect displays to the right.
- -1.0: The audio effect displays to the left.
|
gain | Sets the volume of the audio effect. The value ranges between 0 and 100 (default). The lower the value, the lower the volume of the audio effect. |
publish | Sets whether or not to publish the specified audio effect to the remote stream:
- true: The locally played audio effect is published to the Agora Cloud and the remote users can hear it.
- false: The locally played audio effect is not published to the Agora Cloud and the remote users cannot hear it.
|
- Returns
- 0: Success.
- < 0: Failure.
◆ PlayEffect() [2/2]
override int agora_gaming_rtc.AudioEffectManagerImpl.PlayEffect |
( |
int |
soundId, |
|
|
string |
filePath, |
|
|
int |
loopCount, |
|
|
double |
pitch, |
|
|
double |
pan, |
|
|
int |
gain, |
|
|
bool |
publish, |
|
|
int |
startPos |
|
) |
| |
Plays a specified local or online audio effect file.
- Since
- v3.4.2
To play multiple audio effect files at the same time, call this method multiple times with different soundId
and filePath
values. For the best user experience, Agora recommends playing no more than three audio effect files at the same time.
After completing playing an audio effect file, the SDK triggers the OnAudioEffectFinishedHandler callback.
- Note
- Call this method after joining a channel.
- Parameters
-
soundId | Audio effect ID. The ID of each audio effect file is unique. If you preloaded an audio effect into memory by calling PreloadEffect, ensure that this parameter is set to the same value as in PreloadEffect . |
filePath | The absolute path or URL address (including the filename extensions) of the audio effect file. For example: C:\music\audio.mp4 . Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. For more information, see Supported Media Formats in Media Foundation. When you access a local file on Android, Agora recommends passing a URI address or the path starts with /assets/ in this parameter. If you preloaded an audio effect into memory by calling PreloadEffect , ensure that this parameter is set to the same value as in PreloadEffect . |
loopCount | The number of times the audio effect loops:
- ≥ 0: The number of loops. For example,
1 means loop one time, which means play the audio effect two times in total.
-1 : Play the audio effect in an indefinite loop.
|
pitch | The pitch of the audio effect. The range is 0.5 to 2.0. The default value is 1.0, which means the original pitch. The lower the value, the lower the pitch. |
pan | The spatial position of the audio effect. The range is -1.0 to 1.0 . For example:
-1.0 : The audio effect occurs on the left.
0.0 : The audio effect occurs in the front.
1.0 : The audio effect occurs on the right.
|
gain | The volume of the audio effect. The range is 0.0 to 100.0. The default value is 100.0, which means the original volume. The smaller the value, the less the gain. |
publish | Whether to publish the audio effect to the remote users:
- true: Publish. Both the local user and remote users can hear the audio effect.
- false: Do not publish. Only the local user can hear the audio effect.
|
startPos | The playback position (ms) of the audio effect file. |
- Returns
- 0: Success.
- < 0: Failure.
◆ GetEffectDuration()
override int agora_gaming_rtc.AudioEffectManagerImpl.GetEffectDuration |
( |
string |
filePath | ) |
|
Gets the duration of the audio effect file.
- Since
- v3.4.2
- Note
- Call this method after joining a channel.
- Parameters
-
filePath | The absolute path (including the filename extensions) of the local audio effect file. For example: C:\music\audio.mp4 . Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. For more information, see Supported Media Formats in Media Foundation. When you access a local file on Android, Agora recommends passing a URI address or the path starts with /assets/ in this parameter. |
- Returns
- ≥ 0: A successful method call. Returns the total duration (ms) of the specified audio effect file.
- < 0: Failure.
-22(ERR_RESOURCE_LIMITED)
: Cannot find the audio effect file. Please set a correct filePath
.
◆ SetEffectPosition()
override int agora_gaming_rtc.AudioEffectManagerImpl.SetEffectPosition |
( |
int |
soundId, |
|
|
int |
pos |
|
) |
| |
Sets the playback position of an audio effect file.
- Since
- v3.4.2
After a successful setting, the local audio effect file starts playing at the specified position.
- Note
- Call this method after PlayEffect.
- Parameters
-
soundId | Audio effect ID. Ensure that this parameter is set to the same value as in PlayEffect . |
pos | The playback position (ms) of the audio effect file. |
- Returns
- 0: Success.
- < 0: Failure.
-22(ERR_RESOURCE_LIMITED)
: Cannot find the audio effect file. Please set a correct soundId
.
◆ GetEffectCurrentPosition()
override int agora_gaming_rtc.AudioEffectManagerImpl.GetEffectCurrentPosition |
( |
int |
soundId | ) |
|
Gets the playback position of the audio effect file.
- Since
- v3.4.2
- Note
- Call this method after PlayEffect.
- Parameters
-
soundId | Audio effect ID. Ensure that this parameter is set to the same value as in PlayEffect . |
- Returns
- ≥ 0: A successful method call. Returns the playback position (ms) of the specified audio effect file.
- < 0: Failure.
-22(ERR_RESOURCE_LIMITED)
: Cannot find the audio effect file. Please set a correct soundId
.
◆ StopEffect()
override int agora_gaming_rtc.AudioEffectManagerImpl.StopEffect |
( |
int |
soundId | ) |
|
Stops playing a specified audio effect.
- Parameters
-
soundId | ID of the audio effect to stop playing. Each audio effect has a unique ID. |
- Returns
- 0: Success.
- < 0: Failure.
◆ StopAllEffects()
override int agora_gaming_rtc.AudioEffectManagerImpl.StopAllEffects |
( |
| ) |
|
Stops playing all audio effects.
- Returns
- 0: Success.
- < 0: Failure.
◆ PreloadEffect()
override int agora_gaming_rtc.AudioEffectManagerImpl.PreloadEffect |
( |
int |
soundId, |
|
|
string |
filePath |
|
) |
| |
Preloads a specified audio effect file into the memory.
To ensure smooth communication, limit the size of the audio effect file. We recommend using this method to preload the audio effect before calling the JoinChannelByKey method.
Supported audio formats: mp3, aac, m4a, 3gp, and wav.
- Note
- This method does not support online audio effect files.
- Parameters
-
soundId | ID of the audio effect. Each audio effect has a unique ID. |
filePath | The absolute path of the audio effect file. For example: C:\music\audio.mp4 . Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. For more information, see Supported Media Formats in Media Foundation. When you access a local file on Android, Agora recommends passing a URI address or the path starts with /assets/ in this parameter. |
- Returns
- 0: Success.
- < 0: Failure.
◆ UnloadEffect()
override int agora_gaming_rtc.AudioEffectManagerImpl.UnloadEffect |
( |
int |
soundId | ) |
|
Releases a specified preloaded audio effect from the memory.
- Parameters
-
soundId | ID of the audio effect. Each audio effect has a unique ID. |
- Returns
- 0: Success.
- < 0: Failure.
◆ PauseEffect()
override int agora_gaming_rtc.AudioEffectManagerImpl.PauseEffect |
( |
int |
soundId | ) |
|
Pauses a specified audio effect.
- Parameters
-
soundId | ID of the audio effect. Each audio effect has a unique ID. |
- Returns
- 0: Success.
- < 0: Failure.
◆ PauseAllEffects()
override int agora_gaming_rtc.AudioEffectManagerImpl.PauseAllEffects |
( |
| ) |
|
Pauses all audio effects.
- Returns
- 0: Success.
- < 0: Failure.
◆ ResumeEffect()
override int agora_gaming_rtc.AudioEffectManagerImpl.ResumeEffect |
( |
int |
soundId | ) |
|
Resumes playing a specified audio effect.
- Parameters
-
soundId | ID of the audio effect. Each audio effect has a unique ID. |
- Returns
- 0: Success.
- < 0: Failure.
◆ ResumeAllEffects()
override int agora_gaming_rtc.AudioEffectManagerImpl.ResumeAllEffects |
( |
| ) |
|
Resumes playing all audio effects.
- Returns
- 0: Success.
- < 0: Failure.
◆ SetVoiceOnlyMode()
override int agora_gaming_rtc.AudioEffectManagerImpl.SetVoiceOnlyMode |
( |
bool |
enable | ) |
|
Sets the voice-only mode (transmit the audio stream only), and the other streams will be ignored; for example the sound of the keyboard strokes.
- Parameters
-
enable | Whether to enable the voice-only mode.
- true: Enable.
- false: Disable.
|
- Returns
- 0: Success.
- < 0: Failure.
◆ SetRemoteVoicePosition()
override int agora_gaming_rtc.AudioEffectManagerImpl.SetRemoteVoicePosition |
( |
uint |
uid, |
|
|
double |
pan, |
|
|
double |
gain |
|
) |
| |
Sets the sound position and gain of a remote user.
When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
- Note
- For this method to work, enable stereo panning for remote users by calling the EnableSoundPositionIndication method before joining a channel.
- This method requires hardware support. For the best sound positioning, we recommend using a stereo speaker.
- Ensure that you call this method after joining a channel.
- Parameters
-
uid | The ID of the remote user. |
pan | The sound position of the remote user. The value ranges from -1.0 to 1.0:
- 0.0: the remote sound comes from the front.
- -1.0: the remote sound comes from the left.
- 1.0: the remote sound comes from the right.
|
gain | Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain. |
- Returns
- 0: Success.
- < 0: Failure.
◆ SetLocalVoicePitch()
override int agora_gaming_rtc.AudioEffectManagerImpl.SetLocalVoicePitch |
( |
double |
pitch | ) |
|
Changes the voice pitch of the local speaker.
- Note
- You can call this method either before or after joining a channel.
- Parameters
-
pitch | Sets the voice pitch. The value ranges between 0.5 and 2.0. The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch). |
- Returns
- 0: Success.
- < 0: Failure.