This document describes the GME APIs for voice chat sound effect so that developers can easily debug and integrate them.
API | Description |
---|---|
PlayEffect | Plays back sound effect. |
PauseEffect | Pauses sound effect. |
PauseAllEffects | Pauses all sound effects. |
ResumeEffect | Resumes sound effect. |
ResumeAllEffects | Resumes all sound effects. |
StopEffect | Stops sound effect. |
StopAllEffects | Stops all sound effects. |
SetVoiceType | Sets voice changing effect. |
SetKaraokeType | Sets karaoke sound effect. |
GetEffectsVolume | Obtains the volume of sound effects. |
SetEffectsVolume | Sets the volume of sound effects. |
The API PlayEffect is used to play sound effects. The sound effect ID, which represents an independent playback event, should be managed in the App. The playback can be controlled by this ID. The file supports the m4a, wav, and mp3 formats.
ITMGAudioEffectCtrl virtual int PlayEffect(int soundId, const char* filePath, bool loop, double pitch, double pan, double gain)
Parameter | Type | Description |
---|---|---|
soundId | int | Sound effect ID |
filePath | char* | Sound effect path |
loop | bool | Whether to repeat playback |
pitch | double | Payback frequency. The default value is 1.0. Smaller value means slower playback speed and longer duration. |
pan | double | Sound channel, with values ranging from -1.0 to 1.0. The value -1.0 means only the left channel is enabled. |
gain | double | Gain volume, with values ranging from 0.0 to 1.0. The default value is 1.0. |
double pitch = 1.0;
double pan = 0.0;
double gain = 0.0;
//Windows
ITMGContextGetInstance()->GetAudioEffectCtrl()->PlayEffect(soundId,filepath,true,pitch,pan,gain);
//Android
ITMGContext.GetInstance(this).GetAudioEffectCtrl().PlayEffect(soundId,filePath,loop);
//iOS
[[[ITMGContext GetInstance] GetAudioEffectCtrl] PlayEffect:soundId filePath:path loop:isLoop];
The API PauseEffect is used to pause sound effects.
ITMGAudioEffectCtrl virtual int PauseEffect(int soundId)
Parameter | Type | Description |
---|---|---|
soundId | int | Sound effect ID |
ITMGContextGetInstance()->GetAudioEffectCtrl()->PauseEffect(soundId);
The API PauseAllEffects is used to pause all sound effects.
ITMGAudioEffectCtrl virtual int PauseAllEffects()
ITMGContextGetInstance()->GetAudioEffectCtrl()->PauseAllEffects();
The API ResumeEffect is used to resume sound effects.
ITMGAudioEffectCtrl virtual int ResumeEffect(int soundId)
Parameter | Type | Description |
---|---|---|
soundId | int | Sound effect ID |
ITMGContextGetInstance()->GetAudioEffectCtrl()->ResumeEffect(soundId);
The API ResumeAllEffects is used to resume all sound effects.
ITMGAudioEffectCtrl virtual int ResumeAllEffects()
ITMGContextGetInstance()->GetAudioEffectCtrl()->ResumeAllEffects();
The API StopEffect is used to stop sound effects.
ITMGAudioEffectCtrl virtual int StopEffect(int soundId)
Parameter | Type | Description |
---|---|---|
soundId | int | Sound effect ID |
ITMGContextGetInstance()->GetAudioEffectCtrl()->StopEffect(soundId);
The API StopAllEffects is used to stop all sound effects.
ITMGAudioEffectCtrl virtual int StopAllEffects()
ITMGContextGetInstance()->GetAudioEffectCtrl()->StopAllEffects();
The API SetVoiceType is used to set voice changing effects.
TMGAudioEffectCtrl int setVoiceType(int type)
Parameter | Type | Description |
---|---|---|
type | int | Indicates the type of local voice changing effect. |
Type parameter | Value | Description |
---|---|---|
ITMG_VOICE_TYPE_ORIGINAL_SOUND | 0 | Original |
ITMG_VOICE_TYPE_LOLITA | 1 | Lolita |
ITMG_VOICE_TYPE_UNCLE | 2 | Uncle |
ITMG_VOICE_TYPE_INTANGIBLE | 3 | Ethereal |
ITMG_VOICE_TYPE_DEAD_FATBOY | 4 | Fatty |
ITMG_VOICE_TYPE_HEAVY_MENTA | 5 | Heavy metal |
ITMG_VOICE_TYPE_DIALECT | 6 | Foreign |
ITMG_VOICE_TYPE_INFLUENZA | 7 | Catching cold |
ITMG_VOICE_TYPE_CAGED_ANIMAL | 8 | Animal |
ITMG_VOICE_TYPE_HEAVY_MACHINE | 9 | Machine |
ITMG_VOICE_TYPE_STRONG_CURRENT | 10 | Strong current |
ITMG_VOICE_TYPE_KINDER_GARTEN | 11 | Kid |
ITMG_VOICE_TYPE_HUANG | 12 | Minion |
ITMGContextGetInstance()->GetAudioEffectCtrl()->setVoiceType(0);
The API SetKaraokeType is used to set karaoke sound effects.
TMGAudioEffectCtrl int SetKaraokeType(int type)
Parameter | Type | Description |
---|---|---|
type | int | Indicates the type of local voice changing effect. |
Type parameter | Value | Description |
---|---|---|
ITMG_KARAOKE_TYPE_ORIGINAL | 0 | Original |
ITMG_KARAOKE_TYPE_POP | 1 | Pop |
ITMG_KARAOKE_TYPE_ROCK | 2 | Rock |
ITMG_KARAOKE_TYPE_RB | 3 | Hip-hop |
ITMG_KARAOKE_TYPE_DANCE | 4 | Dance |
ITMG_KARAOKE_TYPE_HEAVEN | 5 | Ethereal |
ITMG_KARAOKE_TYPE_TTS | 6 | Voice synthesis |
ITMGContextGetInstance()->GetAudioEffectCtrl()->SetKaraokeType(0);
The API GetEffectsVolume is used to obtain the volume of sound effects. The default value is 100. A value greater than 100 means "volume up", while a value less than 100 means "volume down".
ITMGAudioEffectCtrl virtual int GetEffectsVolume()
ITMGContextGetInstance()->GetAudioEffectCtrl()->GetEffectsVolume();
The API SetEffectsVolume is used to set the volume of sound effects.
ITMGAudioEffectCtrl virtual int SetEffectsVolume(int volume)
Parameter | Type | Description |
---|---|---|
volume | int | Volume value |
int volume=1;
ITMGContextGetInstance()->GetAudioEffectCtrl()->SetEffectsVolume(volume);
Was this page helpful?