I'm working on a music system based on a switch container triggered by state changes. Every piece of music in the project exists in severeal versions (battle, suspense, map view, ...), that were composed to be fluidly interchangeable. When the game state changes, the switch container creates a transition to the appropriate playlist, synced to the same time as the source.
The map view can be toggled by the player, which means that short transitions can lead to an undesirable amount of music switches whithin a short amount of time. I experimented with long fades and exiting the source track only after a bar or more. But not only does that pose a problem dramatically, when the battle music takes forever to set in, it of course also doesn't solve the map view issue entirely, as the transitions still get messy if the player screws around a lot with the map view.
What I would like to do is have fairly quick transitions that are triggered normally at a state change, and for any consecutive state changes not to have an effect until, let's say, five seconds have passed. Although I suppose at that point the switch would have to be triggered by the last state change that was ignored before, so as not to remain stuck in the map view music during battle or something like that.
Any ideas will be greatly appreciated.