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

Added music mode support #1810

Merged
merged 6 commits into from
Aug 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ class Utilities {
required bool joinWithMutedAudio,
required bool isSoftwareDecoderDisabled,
required bool isNoiseCancellationEnabled,
required bool isAutomaticGainControlEnabled,
required bool isNoiseSuppressionEnabled,
HMSAudioMode? audioMode,
}) {
return HMSTrackSetting(
Expand All @@ -414,7 +416,9 @@ class Utilities {
? HMSTrackInitState.MUTED
: HMSTrackInitState.UNMUTED,
audioMode: audioMode,
enableNoiseCancellation: isNoiseCancellationEnabled),
enableNoiseCancellation: isNoiseCancellationEnabled,
enableAutomaticGainControl: isAutomaticGainControlEnabled,
enableNoiseSupression: isNoiseSuppressionEnabled),
videoTrackSetting: HMSVideoTrackSetting(
trackInitialState: joinWithMutedVideo
? HMSTrackInitState.MUTED
Expand Down
14 changes: 12 additions & 2 deletions packages/hms_room_kit/lib/src/hms_prebuilt_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,25 @@ class HMSPrebuiltOptions {
final HMSIOSScreenshareConfig? iOSScreenshareConfig;

///To enable noise cancellation in prebuilt.
///Default value is true
///Default value is false
final bool enableNoiseCancellation;

///To enable automatic gain control in prebuilt.
///Default value is false
final bool isAutomaticGainControlEnabled;

///To enable noise suppression in prebuilt.
///Default value is false
final bool isNoiseSuppressionEnabled;

///[HMSPrebuiltOptions] is a class that is used to pass the options to the prebuilt
HMSPrebuiltOptions(
{this.userName,
this.userId,
this.endPoints,
this.debugInfo = false,
this.iOSScreenshareConfig,
this.enableNoiseCancellation = false});
this.enableNoiseCancellation = false,
this.isAutomaticGainControlEnabled = false,
this.isNoiseSuppressionEnabled = false});
}
8 changes: 6 additions & 2 deletions packages/hms_room_kit/lib/src/hmssdk_interactor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class HMSSDKInteractor {
bool isAudioMixerDisabled = true,
HMSAudioMode audioMode = HMSAudioMode.VOICE,
bool isPrebuilt = false,
bool isNoiseCancellationEnabled = false}) {
bool isNoiseCancellationEnabled = false,
bool isAutomaticGainControlEnabled = false,
bool isNoiseSuppressionEnabled = false}) {
HMSLogSettings hmsLogSettings = HMSLogSettings(
maxDirSizeInBytes: 1000000,
isLogStorageEnabled: true,
Expand All @@ -50,7 +52,9 @@ class HMSSDKInteractor {
joinWithMutedAudio: joinWithMutedAudio,
isSoftwareDecoderDisabled: isSoftwareDecoderDisabled,
audioMode: audioMode,
isNoiseCancellationEnabled: isNoiseCancellationEnabled);
isNoiseCancellationEnabled: isNoiseCancellationEnabled,
isAutomaticGainControlEnabled: isAutomaticGainControlEnabled,
isNoiseSuppressionEnabled: isNoiseSuppressionEnabled);

hmsSDK = HMSSDK(
iOSScreenshareConfig: iOSScreenshareConfig,
Expand Down
4 changes: 4 additions & 0 deletions packages/hms_room_kit/lib/src/screen_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ class _ScreenControllerState extends State<ScreenController> {
isAudioMixerDisabled: AppDebugConfig.isAudioMixerDisabled,
isNoiseCancellationEnabled:
widget.options?.enableNoiseCancellation ?? false,
isAutomaticGainControlEnabled:
widget.options?.isAutomaticGainControlEnabled ?? false,
isNoiseSuppressionEnabled:
widget.options?.isNoiseSuppressionEnabled ?? false,
isPrebuilt: true);
await _hmsSDKInteractor.build();

Expand Down
2 changes: 0 additions & 2 deletions packages/hms_room_kit/lib/src/service/app_debug_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class AppDebugConfig {
Setting these values to defaults and can be toggled from the application
This will not be shipped with the ui_kit package and only used for internal testing
*/
static bool skipPreview = false;
static bool mirrorCamera = true;
static bool showStats = false;
static bool isSoftwareDecoderDisabled = true;
Expand All @@ -25,7 +24,6 @@ class AppDebugConfig {

/// Resets the debug configuration to default values
static void resetToDefault() {
skipPreview = false;
mirrorCamera = true;
showStats = false;
isSoftwareDecoderDisabled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ class HMSTrackSettingsExtension {
hmsAudioTrackSettings.enableNoiseCancellation(true)
}
}

val enableAutomaticGainControl = audioHashMap["enable_automatic_gain_control"] as? Boolean
enableAutomaticGainControl?.let {
if(it){
hmsAudioTrackSettings.enableAutomaticGainControl(true)
}
}

val enableNoiseSupression = audioHashMap["enable_noise_supression"] as? Boolean
enableNoiseSupression?.let {
if(it){
hmsAudioTrackSettings.enableNoiseSupression(true)
}
}
}

var hmsVideoTrackSettings = HMSVideoTrackSettings.Builder()
Expand Down
8 changes: 7 additions & 1 deletion packages/hmssdk_flutter/example/ExampleAppChangelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ Board: https://app.devrev.ai/100ms/vistas/vista-250
- Add support for zoom in camera controls
https://app.devrev.ai/100ms/works/ISS-23282

- Add support for Music Mode
https://app.devrev.ai/100ms/works/ISS-22859

- Support for long running sessions
https://app.devrev.ai/100ms/works/ISS-23134

Room Kit: 1.1.6
Core SDK: 1.10.6
Android SDK: 2.9.64
Android SDK: 2.9.65
iOS SDK: 1.15.0
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class _AppSettingsBottomSheetState extends State<AppSettingsBottomSheet> {
AppDebugConfig.isSoftwareDecoderDisabled = isSoftwareDecoderDisabled;
AppDebugConfig.mirrorCamera = mirrorCamera;
AppDebugConfig.showStats = showStats;
AppDebugConfig.skipPreview = skipPreview;
AppDebugConfig.isDebugMode = isDebugMode;
AppDebugConfig.nameChangeOnPreview = true;
AppDebugConfig.isVirtualBackgroundEnabled = isVirtualBackgroundEnabled;
Expand Down
10 changes: 9 additions & 1 deletion packages/hmssdk_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ class _HomePageState extends State<HomePage> {
TextEditingController meetingLinkController = TextEditingController();
Uuid? uuid;
String uuidString = "";
HMSAudioMode audioMode = HMSAudioMode.VOICE;

PackageInfo _packageInfo = PackageInfo(
appName: 'Unknown',
Expand Down Expand Up @@ -264,6 +265,9 @@ class _HomePageState extends State<HomePage> {
} else {
meetingLinkController.text = widget.deepLinkURL ?? "";
}

int audioModeInt = await Utilities.getIntData(key: "audio-mode");
audioMode = HMSAudioMode.values[audioModeInt];
}

Future<bool> _closeApp() {
Expand Down Expand Up @@ -348,7 +352,11 @@ class _HomePageState extends State<HomePage> {
appGroup: "group.flutterhms",
preferredExtension:
"live.100ms.flutter.FlutterBroadcastUploadExtension"),
enableNoiseCancellation: true)),
enableNoiseCancellation: true,
isNoiseSuppressionEnabled:
audioMode == HMSAudioMode.MUSIC,
isAutomaticGainControlEnabled:
audioMode == HMSAudioMode.MUSIC)),
)));
}

Expand Down
2 changes: 1 addition & 1 deletion packages/hmssdk_flutter/lib/assets/sdk-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"iOSBroadcastExtension": "0.0.9",
"iOSHLSPlayerSDK": "0.0.2",
"iOSNoiseCancellationModels": "1.0.0",
"android": "2.9.64"
"android": "2.9.65"
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,26 @@ class HMSAudioTrackSetting {
///Refer: Read more about noise cancellation [here](///)
final bool enableNoiseCancellation;

///[enableAutomaticGainControl] property sets the automatic gain control status in the room whether is enabled or not.
///
///Refer: Read more about automatic gain control [here](///)
final bool enableAutomaticGainControl;

///[enableNoiseSupression] property sets the noise suppression status in the room whether is enabled or not.
///
///Refer: Read more about noise suppression [here](///)
final bool enableNoiseSupression;

HMSAudioTrackSetting(
{this.useHardwareAcousticEchoCanceler,
this.audioSource,
this.trackInitialState = HMSTrackInitState.UNMUTED,
this.audioMode,
this.phoneCallState =
HMSAndroidPhoneCallState.DISABLE_MUTE_ON_VOIP_PHONE_CALL_RING,
this.enableNoiseCancellation = false});
this.enableNoiseCancellation = false,
this.enableAutomaticGainControl = false,
this.enableNoiseSupression = false});

factory HMSAudioTrackSetting.fromMap(Map map) {
List<HMSAudioNode> nodeList = [];
Expand Down Expand Up @@ -109,7 +121,9 @@ class HMSAudioTrackSetting {
'phone_call_state':
HMSAndroidPhoneCallStateValue.getValuefromHMSPhoneCallState(
phoneCallState),
'enable_noise_cancellation': enableNoiseCancellation
'enable_noise_cancellation': enableNoiseCancellation,
'enable_automatic_gain_control': enableAutomaticGainControl,
'enable_noise_supression': enableNoiseSupression
};
}
}
Loading