revert WebRTC related changes to AppAudioManager

Initially we were using AppAudioManager in our WebRTC calling
implementation to manage call related audio, but our differences from
how redphone uses the AppAudioManager diverged too much, so instead
we're instead using CallAudioManager.

reverting these changes lest we inadvertently break something re:
RedPhone.

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent b6f098bfa7
commit 6b4dedfefe

@ -14,8 +14,6 @@
@import AVFoundation;
NS_ASSUME_NONNULL_BEGIN
@interface AppAudioManager : NSObject <SoundPlayerDelegate>
enum AudioProfile {
@ -33,9 +31,7 @@ enum AudioProfile {
- (void)respondToTerminationType:(enum CallTerminationType)terminationType;
- (BOOL)toggleSpeakerPhone;
- (void)toggleSpeakerPhoneIsEnabled:(BOOL)enabled NS_SWIFT_NAME(toggleSpeakerPhone(isEnabled:));
- (void)cancelAllAudio;
- (void)cancellAllAudio;
- (void)requestRequiredPermissionsIfNeededWithCompletion:(PermissionBlock)permissionBlock incoming:(BOOL)isIncoming;
- (BOOL)requestRecordingPrivilege;
@ -46,9 +42,4 @@ enum AudioProfile {
- (void)didCompleteSoundInstanceOfType:(SoundInstanceType)instanceType;
- (void)handleInboundRing;
- (void)setDefaultAudioProfile;
@end
NS_ASSUME_NONNULL_END

@ -3,7 +3,6 @@
#import "AudioRouter.h"
#import "SoundBoard.h"
NS_ASSUME_NONNULL_BEGIN
#define DEFAULT_CATEGORY AVAudioSessionCategorySoloAmbient
#define RECORDING_CATEGORY AVAudioSessionCategoryPlayAndRecord
@ -35,8 +34,8 @@ AppAudioManager *sharedAppAudioManager;
#pragma mark AudioState Management
- (void)setAudioProfile:(enum AudioProfile)profile {
_audioProfile = profile;
[self updateAudioRouter];
_audioProfile = profile;
}
- (void)updateAudioRouter {
@ -56,6 +55,17 @@ AppAudioManager *sharedAppAudioManager;
}
}
- (void)overrideAudioProfile {
isSpeakerphoneActive = YES;
[self updateAudioRouter];
}
- (void)resetOverride {
isSpeakerphoneActive = NO;
[self updateAudioRouter];
}
- (enum AudioProfile)getCurrentAudioProfile {
return (isSpeakerphoneActive) ? AudioProfile_ExternalSpeaker : _audioProfile;
}
@ -100,33 +110,24 @@ AppAudioManager *sharedAppAudioManager;
}
- (void)handleInboundRing {
[self setAudioProfile:AudioProfile_ExternalSpeaker];
[_soundPlayer playSound:[SoundBoard instanceOfInboundRingtone]];
}
- (void)handleOutboundRing {
[self setDefaultAudioProfile];
[self setAudioProfile:AudioProfile_Default];
[_soundPlayer playSound:[SoundBoard instanceOfOutboundRingtone]];
}
- (void)handleSecuring {
[_soundPlayer stopAllAudio];
[self setDefaultAudioProfile];
[self setAudioProfile:AudioProfile_Default];
[_soundPlayer playSound:[SoundBoard instanceOfHandshakeSound]];
}
- (void)handleCallEstablished {
[_soundPlayer stopAllAudio];
[self setDefaultAudioProfile];
[_soundPlayer playSound:[SoundBoard instanceOfCompletedSound]];
}
/**
* Route traffic through internal speaker, unless speakerphone is enabled.
*/
- (void)setDefaultAudioProfile
{
[self setAudioProfile:AudioProfile_Default];
[_soundPlayer playSound:[SoundBoard instanceOfCompletedSound]];
}
- (BOOL)toggleSpeakerPhone {
@ -136,17 +137,9 @@ AppAudioManager *sharedAppAudioManager;
return isSpeakerphoneActive;
}
- (void)toggleSpeakerPhoneIsEnabled:(BOOL)enabled
{
DDLogInfo(@"%@ Toggled speaker phone: %@", self.tag, enabled ? @"ON" : @"OFF");
isSpeakerphoneActive = enabled;
[self updateAudioRouter];
}
#pragma mark Audio Control
- (void)cancelAllAudio
{
- (void)cancellAllAudio {
[_soundPlayer stopAllAudio];
}
@ -203,8 +196,7 @@ AppAudioManager *sharedAppAudioManager;
return (nil != e);
}
- (void)awake
{
- (void)awake {
[_soundPlayer awake];
}
@ -217,18 +209,5 @@ AppAudioManager *sharedAppAudioManager;
}
}
#pragma mark - Logging
+ (NSString *)tag
{
return [NSString stringWithFormat:@"[%@]", self.class];
}
- (NSString *)tag
{
return self.class.tag;
}
@end
NS_ASSUME_NONNULL_END

@ -61,7 +61,7 @@
[super viewWillDisappear:animated];
[self stopRingingAnimation];
[self stopConnectingFlashAnimation];
[AppAudioManager.sharedInstance cancelAllAudio];
[AppAudioManager.sharedInstance cancellAllAudio];
[UIDevice.currentDevice setProximityMonitoringEnabled:NO];
}

Loading…
Cancel
Save