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

Exposes the AVAudioPlayer instance method setVolume(_:fadeDuration:) and adds completion handler to play method. #10

Merged
merged 5 commits into from
Feb 8, 2024

Conversation

coderExMachina
Copy link
Contributor

@coderExMachina coderExMachina commented Jan 15, 2024

This allows to set the volume of a specific sound or all sounds with the option to specify the fade duration and adds a completion handler to the play method.

… This allows to set the volume of a specific sound or all sounds with the option to specify the fade duration.
- Modified `play` method to accept an optional completion handler that is executed when a sound finishes playing.
- Updated `stop` method to remove the associated completion handler when a sound is stopped before it finishes.
- Revised DocC comments for `play`, `stop`, and `audioPlayerDidFinishPlaying` methods to accurately reflect the changes in functionality.
@coderExMachina coderExMachina changed the title Exposes the AVAudioPlayer instance method setVolume(_:fadeDuration:) Exposes the AVAudioPlayer instance method setVolume(_:fadeDuration:) and adds completion handler to play method. Jan 16, 2024
@twostraws
Copy link
Owner

Thank you for this! I like the idea, but I'm not sure what's going on with all the whitespace changes, and the DispatchQueue code is making me a bit uneasy. Could you perhaps add a little context?

@coderExMachina
Copy link
Contributor Author

Thanks for your comment! My reasoning for using DispatchQueue.main.async { } was that the completion handler might interact with the UI. Hence I thought it would be necessary to use it. Could you let me know what part makes you feel uneasy? Id be happy to adapt the solution. (As for the whitespace: This must have happened when I let Xcode re-indent my code - I can revert that. Cheers!

@coderExMachina
Copy link
Contributor Author

I have made a couple of changes now, that hopefully address your concerns. Let me know what you think! Thanks :)

@twostraws
Copy link
Owner

Thank you!

@twostraws twostraws merged commit 9f9fd6a into twostraws:main Feb 8, 2024
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

Successfully merging this pull request may close these issues.

2 participants