Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat. support setLocalVoiceChanger #25

Merged
merged 1 commit into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ android {
}

dependencies {
implementation 'io.agora.rtc:full-sdk:2.8.0'
implementation 'io.agora.rtc:full-sdk:2.8.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ public void onMethodCall(MethodCall call , Result result) {
result.success(null);
}
break;
case "setLocalVoiceChanger": {
int changer = call.argument("changer");
mRtcEngine.setLocalVoiceChanger(changer);
result.success(null);
}
break;
case "setRemoteRenderMode": {
int uid = call.argument("uid");
int mode = call.argument("mode");
Expand Down
4 changes: 4 additions & 0 deletions ios/Classes/AgoraRtcEnginePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
NSInteger mode = [self intFromArguments:arguments key:@"mode"];
[self.agoraRtcEngine setLocalRenderMode:mode];
result(nil);
} else if ([@"setLocalVoiceChanger" isEqualToString:method]) {
NSInteger changer = [self intFromArguments:arguments key:@"changer"];
[self.agoraRtcEngine setLocalVoiceChanger:changer];
result(nil);
} else if ([@"setRemoteRenderMode" isEqualToString:method]) {
NSInteger uid = [self intFromArguments:arguments key:@"uid"];
NSInteger mode = [self intFromArguments:arguments key:@"mode"];
Expand Down
56 changes: 55 additions & 1 deletion lib/agora_rtc_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class AgoraRtcEngine {
/// Before calling this method to set a new channel profile, [destroy] the current RtcEngine and [create] a new RtcEngine first.
/// Call this method before [joinChannel], you cannot configure the channel profile when the channel is in use.
static Future<void> setChannelProfile(ChannelProfile profile) async {
await _channel.invokeMethod('setChannelProfile', {'profile': profile.index});
await _channel.invokeMethod('setChannelProfile', {'profile': profile.index});
}

/// Sets the role of a user (Live Broadcast only).
Expand Down Expand Up @@ -481,6 +481,12 @@ class AgoraRtcEngine {
'setLocalRenderMode', {'mode': _intFromVideoRenderMode(renderMode)});
}

/// Sets the local voice changer option.
static Future<void> setLocalVoiceChanger(VoiceChanger changer) async {
await _channel.invokeMethod(
'setLocalVoiceChanger', {'changer': _intLocalVoiceChangere(changer)});
}

/// Sets the remote video display mode.
///
/// This method can be invoked multiple times during a call to change the display mode.
Expand Down Expand Up @@ -1004,6 +1010,31 @@ class AgoraRtcEngine {
return 1;
}
}

static int _intLocalVoiceChangere(VoiceChanger changer) {
switch (changer) {
case VoiceChanger.VOICE_CHANGER_OLDMAN:
return 1;
break;
case VoiceChanger.VOICE_CHANGER_BABYBOY:
return 2;
break;
case VoiceChanger.VOICE_CHANGER_BABYGILR:
return 3;
break;
case VoiceChanger.VOICE_CHANGER_ZHUBAJIE:
return 4;
break;
case VoiceChanger.VOICE_CHANGER_ETHEREAL:
return 5;
break;
case VoiceChanger.VOICE_CHANGER_HULK:
return 6;
break;
default:
return 0;
}
}
}

class AudioVolumeInfo {
Expand Down Expand Up @@ -1204,6 +1235,29 @@ enum VideoRenderMode {
Fit,
}

enum VoiceChanger {
/// The original voice (no local voice change).
VOICE_CHANGER_OFF,

/// An old man's voice.
VOICE_CHANGER_OLDMAN,

/// A little boy's voice.
VOICE_CHANGER_BABYBOY,

///A little girl's voice.
VOICE_CHANGER_BABYGILR,

/// Zhu Bajie's voice (Zhu Bajie is a character from Journey to the West who has a voice like a growling bear).
VOICE_CHANGER_ZHUBAJIE,

/// Ethereal vocal effects.
VOICE_CHANGER_ETHEREAL,

/// Hulk's voice.
VOICE_CHANGER_HULK
}

enum UserPriority {
High,
Normal,
Expand Down