Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #47 from apple-ihack-geek/bk-bluetooth-playback-fix
Browse files Browse the repository at this point in the history
Bluetooth Playback fix and ExactJump near min/max fix
  • Loading branch information
jpsim authored May 3, 2017
2 parents 87a9b9e + 964aa0a commit 08850cf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions JPSVolumeButtonHandler/JPSVolumeButtonHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (id)init {

if (self) {
_appIsActive = YES;
_sessionCategory = AVAudioSessionCategoryPlayAndRecord;
_sessionCategory = AVAudioSessionCategoryPlayback;

_volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(MAXFLOAT, MAXFLOAT, 0, 0)];

Expand Down Expand Up @@ -220,8 +220,11 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
CGFloat difference = fabs(newVolume-oldVolume);

JPSLog(@"Old Vol:%f New Vol:%f Difference = %f", (double)oldVolume, (double)newVolume, (double) difference);
if (_exactJumpsOnly && (difference > .063 || difference < .062)) {
JPSLog(@"Ignoring non-standard Jump of %f, which is not the .0625 a press of the actually volume button would have resulted in.", difference);

if (_exactJumpsOnly && difference < .062 && (newVolume == 1. || newVolume == 0)) {
JPSLog(@"Using a non-standard Jump of %f (%f-%f) which is less than the .0625 because a press of the volume button resulted in hitting min or max volume", difference, oldVolume, newVolume);
} else if (_exactJumpsOnly && (difference > .063 || difference < .062)) {
JPSLog(@"Ignoring non-standard Jump of %f (%f-%f), which is not the .0625 a press of the actually volume button would have resulted in.", difference, oldVolume, newVolume);
[self setInitialVolume];
return;
}
Expand Down

0 comments on commit 08850cf

Please sign in to comment.