Skip to content

Commit

Permalink
ios: use NS_CLOSED_ENUM for intensity level
Browse files Browse the repository at this point in the history
  • Loading branch information
z-dule committed Jul 4, 2024
1 parent 05c5208 commit b927d6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 28 deletions.
2 changes: 1 addition & 1 deletion iosx/include/AVSMediaManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef NS_ENUM (NSUInteger, AVSRecordingRoute) {
};


typedef NS_ENUM (NSUInteger, AVSIntensityLevel) {
typedef NS_CLOSED_ENUM (NSUInteger, AVSIntensityLevel) {
AVSIntensityLevelNone = 0,
AVSIntensityLevelSome = 50,
AVSIntensityLevelFull = 100
Expand Down
29 changes: 4 additions & 25 deletions iosx/src/mediamgr/AVSMediaManager+Client.m
Original file line number Diff line number Diff line change
Expand Up @@ -243,34 +243,13 @@ - (BOOL)isInControlOfAudio

- (AVSIntensityLevel)intensityLevel
{
float intensity = [self intensity];

if ( intensity == 0 ) {
return AVSIntensityLevelNone;
}

if ( intensity == 100 ) {
return AVSIntensityLevelFull;
}

return AVSIntensityLevelSome;
return [self intensity];
}

- (void)setIntensityLevel:(AVSIntensityLevel)intensityLevel
- (void)setIntensityLevel:(AVSIntensityLevel)intensityLevel
{
switch ( intensityLevel ) {
case AVSIntensityLevelNone:
[self setIntensity:0];
break;

case AVSIntensityLevelSome:
[self setIntensity:50];
break;

case AVSIntensityLevelFull:
[self setIntensity:100];
break;
}

[self setIntensity:intensityLevel];
}


Expand Down
4 changes: 2 additions & 2 deletions iosx/src/mediamgr/AVSMediaManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ - (void)registerMedia:(id<AVSMedia>)media withOptions:(NSDictionary *)options
{
bool mixing = true;
bool incall = false;
int intensity = 100;
int intensity = AVSIntensityLevelFull;
int priority = 0;

mediamgr_register_media(_mm, [media.name UTF8String], (__bridge_retained void *)(media),
Expand Down Expand Up @@ -386,7 +386,7 @@ - (void)setPreferredRecordingRoute:(AVSRecordingRoute)route

- (float)intensityForMediaName:(NSString *)name
{
return 0.0f;
return AVSIntensityLevelNone;
}

- (void)setIntensity:(float)intensity forMediaName:(NSString *)name
Expand Down

0 comments on commit b927d6e

Please sign in to comment.