Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPAudioEngine Mute Behavior #52

Open
ronyeh opened this issue Jan 29, 2016 · 7 comments
Open

SPAudioEngine Mute Behavior #52

ronyeh opened this issue Jan 29, 2016 · 7 comments

Comments

@ronyeh
Copy link

ronyeh commented Jan 29, 2016

I added a note on Line 67 of this commit: bf413cf

Recently I upgraded my Tiny Piano app to use Sparrow 2.X's SPAudioEngine. However, behavior has changed from 1.X. I used to use SPAudioSessionCategory_MediaPlayback, because it would continue the audio even if the device was muted. This was important as sometimes people would leave their ringer on mute and then leave a 1-star review for my app, saying that it's dumb that the audio doesn't work in a piano app.

However, SPAudioSessionCategory_MediaPlayback no longer overrides the mute switch.

See the comment here: https://github.com/Gamua/Sparrow-Framework/blob/master/sparrow/src/Classes/SPAudioEngine.h#L41

The comment above suggests that the old functionality is desired, and that we should instead add a new enum to the SPAudioSessionCategory to allow users to choose AVAudioSessionCategoryMultiRoute.

In summary, I think the mappings should be like this:

SPAudioSessionCategory_MediaPlayback => AVAudioSessionCategoryPlayback
SPAudioSessionCategory_MultiRoute => AVAudioSessionCategoryMultiRoute

@racarone
Copy link

Ya this is definitely a mistype! Thanks for the catch!

I've deprecated SPAudioSessionCategory and added a startWithCategory: method to SPAudioEngine that uses AVAudioSessionCategorys directly. The old version will select the correct category, but I think using the categories directly just makes more sense now.

@ronyeh
Copy link
Author

ronyeh commented Jan 30, 2016

Thanks Robert. I think that is a great solution!
On Jan 30, 2016 5:18 AM, "Robert Carone" [email protected] wrote:

Ya this is definitely a mistype! Thanks for the catch!

I've updated the branch and deprecated SPAudioSessionCategory and added a
startWithCategory: method to SPAudioEngine that uses
AVAudioSessionCategory directly. The old version will now select the
correct category now, but I think using the categories directly just makes
more sense now.


Reply to this email directly or view it on GitHub
#52 (comment)
.

@PrimaryFeather
Copy link

Thanks for the fix, Robert! Ron, sorry for the bad reviews — but it's great to see you're still a loyal Sparrow user! 😄 I hope that Tiny Piano and it's siblings are still working great for you!!

@ronyeh
Copy link
Author

ronyeh commented Feb 2, 2016

No worries! I found the regression before shipping the new update. :-)

I'm not actually using Sparrow 2.X yet, since Tiny Piano is 4 yrs old and I haven't bothered to upgrade. I just borrowed some stuff from the new SPAudioEngine and noticed that it wasn't working the same way.

@PrimaryFeather
Copy link

Makes sense! Never change a running system — still one of the most important truths in our field! 😉

@ronyeh
Copy link
Author

ronyeh commented Feb 2, 2016

It's truly a testament to the robustness of your code, that it still works
years down the road!

On Tue, Feb 2, 2016 at 1:50 AM, Daniel Sperl [email protected]
wrote:

Makes sense! Never change a running system — still one of the most
important truths in our field! [image: 😉]


Reply to this email directly or view it on GitHub
#52 (comment)
.

@PrimaryFeather
Copy link

The principle behind that is simple: use as few iOS APIs as possible! 😝

All jokes aside, whenever one my apps stopped working in a new iOS version, it was because one of the iOS APIs were changed or introduced a bug. I can't blame Apple, because there is a lot going on in the iOS ecosystem — but as an app developer, you're definitely on the safer side by not using their APIs too much. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants