bbbradsmith / nsfplay

Nintendo NES sound file NSF music player
https://bbbradsmith.github.io/nsfplay/
277 stars 42 forks source link

Infinite mode #36

Closed jprjr closed 4 years ago

jprjr commented 4 years ago

Copying from #35

There's a couple of use cases - in my case, I'm working on integrating xgm as a plugin for Music Player Daemon to play back NSF, but want to use my own time-keeping and fade routines, so disabling the automatic fade-out is useful.

Another idea (admittedly, I'm nowhere near close to implementing) is being able to use xgm in a game for playing level music. I'd want to be able to trigger a fade-out on an event occurring rather than a specific time.

GetInfinite may not be necessary, I'm guessing if a library user is using SetInfinite, they're probably not going to need to check. Just figured it's good to always have a getter as well as a setter.

bbbradsmith commented 4 years ago

Well, what I was getting at is that as a pull request it looks incomplete to me until there's actually something there to make use of it, and there's a danger of code like this getting lost or becoming redundant if it isn't a visible functioning component of the project. I don't want to merge this until it's connected to something tangible.

However, this is a feature that would be useful to general users too, so that's a perfectly good opportunity to hook it up. In that respect, this still needs:

  1. A CONFIG entry to make it a persistent setting.
  2. A user interface to make the setting accessible to the user.

Request #33 seems to cross paths with this feature, so I'd suggest the actual setting be a selection of behaviour for what to do when the track ends.

  1. advance (default)
  2. play infinitely
  3. stop

For the UI part, probably a dropdown list becomes appropriate. It should probably fit in the "sequencer" panel somewhere, but its layout is a bit of a mess, and also any UI changes need both English and Japanese forms. (The crusty/unwieldy UI is a big reason I'm trying to avoid adding features before 3.0.)

So... I'm writing this out for myself as a to-do, as much as commentary to you. I don't know if you'd want to do either of those two tasks above, but I'll get to them before release of 2.5 at least. The implementation of "infinite" as a starting point is good, CheckTerminal() looks like an appropriate place to apply it.