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

Seems to be a maximum number of different sounds able to be played #37

Closed
RobertFiorentino opened this issue Apr 27, 2018 · 4 comments
Closed

Comments

@RobertFiorentino
Copy link

I'm creating a soundboard that has 112 sounds right now, however when I try to play them all one after another they stop working after the 50th sound. No matter what order I play the sounds, after 50 they stop working. Is there a max amount of sounds that can load, and if so how can I increase that limit?

@adamcichy
Copy link
Owner

Looks like a limitation of AVFoundation. Have you tried changing the category?

Sound.category = .playback

@RobertFiorentino
Copy link
Author

No good. Many games use more than 50 sounds, would two separate Sound instances work, if I were to alter the class methods appropriately?

@adamcichy
Copy link
Owner

Try changing number of players per sound.
Sound. playersPerSound = ...
Default is 5.

@RobertFiorentino
Copy link
Author

Thanks for the help! I found that raising this number actually made the problem worse. The problem is with too many players. Lowering it proportionally raised the amount of different sounds I could have. However I was able to clear the sounds that built up by setting the playersPerSound (even to the same number) because the setter clears out the sounds array. So my solution is to set playersPerSound ever so often (I just do it every time I call stopAllSounds).

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

2 participants