dweymouth / supersonic

A lightweight and full-featured cross-platform desktop client for self-hosted music servers
GNU General Public License v3.0
882 stars 45 forks source link

Suggestion: ReplayGain mode according to what is playing #157

Closed AnonEstranho closed 10 months ago

AnonEstranho commented 1 year ago

Hello there. I want to suggest a feature that an Android app (Symfonium) does regarding replay gain: replay gain can be set to album or track tag (like Supersonic), but it also provides an automatic option that chooses the replaygain tag according to what you're listening: if an album (so the replaygain album tag is used) or shuffling a playlist (so the repalygain track is used).

Thank you.

dweymouth commented 1 year ago

Good suggestion and I was actually thinking about this a little bit, but I'm not sure how to handle all the edge cases. If you know how Symfonium handles it that could be helpful and I can use that for inspiration.

First, what does it look like in the UI - is it just adding an "Auto" option to the ReplayGain selection? (i.e. "None", "Album", "Track", "Auto")?

Now, the edge cases:

  1. With auto replaygain, if you play an album, it should use Album gain. But now what if you append a playlist to the queue to play after the album is finished? Should it switch to Track gain once the first track of the playlist starts? Now if you append an additional album, it should switch back into album mode once it gets to that position in the queue?
  2. Now what if you do the above, but then reorder tracks in the play queue (I don't support this feature yet but I will eventually)?
  3. Now what if you load multiple albums into the queue, and then reorder the tracks so the albums are interleaved? Does it need to switch to Track gain even though everything was loaded initially in album mode?

Also, note that if I were to add this, in the above scenarios there would probably be a slight glitch when transitioning from Album to Track gain at a track boundary, since I only receive a callback from MPV after a track has began playing, and then I could adjust the replaygain setting in response to that.

The easiest thing I guess would be to change the ReplayGain mode only when clicking on the "Play" button from the album page or playlist page, since this action clears the entire queue and loads only that item to play. Then in the above scenarios, the mode would stay with whatever it was when the first tracks were loaded into the queue