Ability to pause Melody IC 1270
Phoenix616 opened this issue · 6 comments
Is your feature request related to a problem? Please describe.
When wanting to pause a song played with the MIDI player IC 1270 it starts again at the start of the song rather than the position you were at.
Describe the solution you'd like
A way to start playing again at the position that you stopped at. This might be done via a parameter on the sign (PAUSE) but that means there would need to be a reset too, alternatively a redstone input from the side of the sign could pause it instead.
Describe alternatives you've considered
Using a different plugin or splitting up midi files (which wouldn't allow to arbitrarily pause)
Additional context
None?
The main concern here is that pausing it instead of resetting it requires keeping around a MIDI Sequencer, which has an open file handle and uses a decent amount of memory.
When they’re being used it’s generally fine, but when players can arbitrarily pause theoretically limitless amounts this could become a major issue in terms of performance. The open file handle problem could also cause some pretty major issues.
Maybe there could be a timeout or a max amount of concurrently paused ICs?
Also for my usecase this wouldn't really be a risk as on my server players don't have access to it, only builders/mods use it in custom minigames on my server so maybe a config option which defaults to disabled could help prevent this issue for the wider userbase.
A timeout would be problematic, but having a max amount paused could technically work.
My concerns there would be around what would happen if that limit is hit, would it just reset them?
Also - this would require the IC being consistently loaded, which is going to add extra strain on the chunk system etc. I feel like adding this would overall create too many problems for it to be worthwhile
I would imagine the best behaviour would be resetting the oldest one when the limit is reached. As for the chunk: I don't really think keeping a couple chunks loaded until the limit is reached would be an issue if the limit isn't too big but I guess they could reset on unload?
Also for me personally these chunks would never unload while the IC is paused anyways. I realise that my usecase seems to be a bit fringe and might not represent how this could be used by a more normal player setup especially if it would put a strain on the system.
Also just to be clear: I'm open to actually implement a PR for this once we have a design which could work around the potential performance impact.
I’d rather it not reset the oldest one when the limit is reached as that’s realistically more confusing behaviour, and also would require more tracking.
And sure, unloading the sequencer on IC unload sounds fine.
I’d have to check what the current sign syntax is to work out where there’d be space for it, but a PR would be appreciated.