Remove playmuted audio configuration

This commit is contained in:
Tiago Koji Castro Shibata
2017-07-18 15:15:04 -03:00
parent 4e9212b152
commit 3dfe3808c6
7 changed files with 24 additions and 41 deletions
+10 -19
View File
@@ -345,35 +345,26 @@ void vibrate()
}
}
void setAudioMixWithOthers(bool mixMode, bool playMuted)
void setAudioMixWithOthers(bool mixEnabled)
{
@autoreleasepool
{
NSString *category = AVAudioSessionCategoryPlayback;
AVAudioSessionCategoryOptions options = 0;
NSError *err = nil;
NSString *category = AVAudioSessionCategorySoloAmbient;
NSError *err;
if (mixMode)
{
if (playMuted)
options = AVAudioSessionCategoryOptionMixWithOthers;
else
category = AVAudioSessionCategoryAmbient;
}
else if (!playMuted)
{
category = AVAudioSessionCategorySoloAmbient;
}
if (mixEnabled)
category = AVAudioSessionCategoryAmbient;
[[AVAudioSession sharedInstance] setCategory:category withOptions:options error:&err];
if (err != nil)
if (![[AVAudioSession sharedInstance] setCategory:category error:&err])
NSLog(@"Error in AVAudioSession setCategory: %@", [err localizedDescription]);
}
}
bool audioShouldBeSilenced()
bool hasBackgroundMusic()
{
return [[AVAudioSession sharedInstance] secondaryAudioShouldBeSilencedHint];
if ([[AVAudioSession sharedInstance] respondsToSelector:@selector(secondaryAudioShouldBeSilencedHint)])
return [[AVAudioSession sharedInstance] secondaryAudioShouldBeSilencedHint];
return false;
}
} // ios