gluonhq / attach

GNU General Public License v3.0
48 stars 26 forks source link

Implemented IOSAudioService #347

Closed salmonb closed 1 year ago

salmonb commented 1 year ago

hi,

I made this implementation of the AudioService for iOS. It's especially optimised for games that may play sounds simultaneously frequently. This implementation can manage this without degrading performances.

Can you please merge this PR?

jperedadnr commented 1 year ago

great, I'll have a look. Maybe @AlmasB wants to have a look too (even if it is for iOS).

Coincidently, I just did a quick implementation here: https://github.com/jperedadnr/attach-2/tree/345-audioios, but without multiple players for sound (seems a good idea).

salmonb commented 1 year ago

Ah ok! Funny coincidence...

I already contacted @AlmasB so he can have a look at it, and he said he was happy for me to submit the PR. I don't think he looked deeply however as he said he is not familiar with iOS development (I wan't neither - this is my first development for iOS).

FYI I would like to publish the mobile versions of our WebFX demos on Google Play and App Store. I think it will be beneficial for people to see examples of what they can do with JavaFX and the Gluon toolchain. Are you happy with that?

Our SpaceFX version runs on iOS (the original version doesn't because of some issues with Gluon and also with the game itself, but I made all necessary workarounds & fixes). It works very well on both iPhones and iPads. I will contact Gerrit to see if he is happy if we publish his game in this way, and maybe he would also like to get my changes back to its original version (our version is different because we also target the web).

I developed the IOSAudioService in this context, and especially for SpaceFX and DemoFX (our best demos). SpaceFX is a particular good use case, as it can play many sounds simultaneously (especially when we get the starburst bonus) and many explosions (asteroids, ennemies, etc...) are played several times simultaneously. I experienced several performance issues that were slowing the game, but now everything works very well with this version I'm submitting here.

Let me know what you think about our plan to publish the mobile versions of our demos.

jperedadnr commented 1 year ago

@salmonb You will need to sign the CLA (see https://github.com/gluonhq/attach#issues-and-contributions) before the PR can get merged. As for publishing your apps, of course, that would be great, no problem at all.

salmonb commented 1 year ago

Ok great! I will update the code tomorrow to consider your comments.

Regarding the CLA, I already signed it earlier today. Have you received it?

jperedadnr commented 1 year ago

Yes, got it.

salmonb commented 1 year ago

I made the changes 👍

I also added a last optimisation (see pendingPlay in IOSAudioService.java). Commented and tested.

jperedadnr commented 1 year ago

Thanks, make sure you address the unresolved comments?

salmonb commented 1 year ago

thanks, I think I covered all your comments. Let me know if I forgot something.