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

Allows multiple instance of the same clip to be played simultaneously. #25

Merged
merged 4 commits into from
Mar 1, 2015

Conversation

fluddokt
Copy link

This might fix some issues with some sounds not being played sometimes.

Also might require more memory since more clips are created.

fd added 2 commits February 26, 2015 23:45
This might fix some issues with some sounds not being played sometimes.

Also might require more memory since more clips are created.
@fluddokt fluddokt closed this Feb 27, 2015
@fluddokt fluddokt reopened this Feb 28, 2015
@itdelatrisu
Copy link
Owner

Could the extra clips be destroyed afterwards? Just from one play of this map, about 40 clips get created and my memory usage went up by ~80mb with the default skin. That's probably too much...

@fluddokt
Copy link
Author

Yea, but it becomes a question of when to destroy it.
It could be destroyed right after each clip is done playing, but opening and closing clips is bad I think.
After playing the beatmap?
But if its reaching that much clips, then its probably going to need about that much clips to play another beatmap.

Maybe I should try the other idea of using TargetDataLine and see how that turns out.

@itdelatrisu
Copy link
Owner

Yeah, I can't think of a good solution. The game hangs a lot when closing clips, so closing them immediately isn't an option. But it seems silly to allocate so much extra space for sound effects...

How does this sound? We could set a reasonable global limit on the number of Clips created, and whenever that limit is reached, just reuse the last clip played from each MultiClip (e.g. cutting off the original). We could close all the extra clips before/after playing a beatmap (maybe in a separate thread?).

reuse clips
close extraclips in ranking
@fluddokt
Copy link
Author

Maybe have a limit on each MultiClip instead, so that one MultiClip can't just steal all the extra clips?

@itdelatrisu
Copy link
Owner

I think it's actually okay as-is, since extra space gets allocated to whatever clips need them most. I'll merge this now and make a couple of small changes (reducing number of methods, setting MAX_CLIP to 20, etc.). Thanks so much!

itdelatrisu added a commit that referenced this pull request Mar 1, 2015
Allows multiple instance of the same clip to be played simultaneously.
@itdelatrisu itdelatrisu merged commit 540b1c4 into itdelatrisu:master Mar 1, 2015
itdelatrisu added a commit that referenced this pull request Mar 1, 2015
- Moved all MultiClip-handling methods into the MultiClip class.
- Destroy extra clips when starting and finishing new beatmaps.
- Reduced maximum number of extra clips to 20.
- Attempted fixes at multithreading issues.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants