@@ -325,8 +325,9 @@ + (void) configure: (tAudioManagerMode) mode {
325
325
326
326
-(BOOL ) isOtherAudioPlaying {
327
327
UInt32 isPlaying = 0 ;
328
- UInt32 varSize = sizeof (isPlaying);
329
- AudioSessionGetProperty (kAudioSessionProperty_OtherAudioIsPlaying , &varSize, &isPlaying);
328
+ // UInt32 varSize = sizeof(isPlaying);
329
+ // AudioSessionGetProperty (kAudioSessionProperty_OtherAudioIsPlaying, &varSize, &isPlaying);
330
+ isPlaying = [[AVAudioSession sharedInstance ] isOtherAudioPlaying ];
330
331
return (isPlaying != 0 );
331
332
}
332
333
@@ -405,9 +406,9 @@ - (id) init: (tAudioManagerMode) mode {
405
406
if ((self = [super init ])) {
406
407
407
408
// Initialise the audio session
408
- AVAudioSession* session = [AVAudioSession sharedInstance ];
409
- session.delegate = self;
410
-
409
+ // AVAudioSession* session = [AVAudioSession sharedInstance];
410
+ // session.delegate = self;
411
+ [[AVAudioSession sharedInstance ] setActive: YES error: nil ];
411
412
_mode = mode;
412
413
backgroundMusicCompletionSelector = nil ;
413
414
_isObservingAppEvents = FALSE ;
@@ -474,33 +475,13 @@ -(BOOL) isBackgroundMusicPlaying {
474
475
// however, on a 3gs running 3.1.2 no route change is generated when the user switches the
475
476
// ringer mute switch to off (i.e. enables sound) therefore polling is the only reliable way to
476
477
// determine ringer switch state
477
- -(BOOL ) isDeviceMuted {
478
+ -(BOOL ) isDeviceMuted {
478
479
479
480
#if TARGET_IPHONE_SIMULATOR
480
481
// Calling audio route stuff on the simulator causes problems
481
482
return NO ;
482
- #else
483
- CFStringRef newAudioRoute;
484
- UInt32 propertySize = sizeof (CFStringRef);
485
-
486
- AudioSessionGetProperty (
487
- kAudioSessionProperty_AudioRoute ,
488
- &propertySize,
489
- &newAudioRoute
490
- );
491
-
492
- if (newAudioRoute == NULL ) {
493
- // Don't expect this to happen but playing safe otherwise a null in the CFStringCompare will cause a crash
494
- return YES ;
495
- } else {
496
- CFComparisonResult newDeviceIsMuted = CFStringCompare (
497
- newAudioRoute,
498
- (CFStringRef) @" " ,
499
- 0
500
- );
501
-
502
- return (newDeviceIsMuted == kCFCompareEqualTo );
503
- }
483
+ #else
484
+ return NO ;
504
485
#endif
505
486
}
506
487
0 commit comments