In another post someone was asking about being able to trigger a sound effect before every song.
For those just joining us, the jukebox's GUI is message-driven. This is what makes the interactive parts completely skinnable: the jukebox sends "messages" to all of the components of the interface, and it's up to that component to decide whether or not to respond to a message. Clickable interface elements send those messages as well as receive them. Each message has an "on" and "off" version to indicate which state is being changed to, with the "off" states being represented as "negative" messages.
Here's an example: When the button mapped to Pause is pressed (or an on-screen button with an Action set to BTN_PAUSE), a message called BTN_PAUSE is sent to the interface, with a -BTN_PAUSE (negative BTN_PAUSE) sent a tenth of a second later (to represent the pressing and releasing of a button). The jukebox itself also sees this message and pauses the playing song, sending a MSG_SONGPAUSED message to the interface. When the Pause button is pressed again, another BTN_PAUSE is sent, with another -BTN_PAUSE sent a tenth of a second later; the jukebox resumes play and sends a -MSG_SONGPAUSED to indicate that the juke is no longer paused. So a skin can have a clickable icon mapped to BTN_PAUSE to send and respond to the key events and an icon representing a light mapped to respond to the message that the juke is actually paused. Does this make any sense?
Adding MSG_ messages is relatively trivial, because I don't have to write a command dispatcher for them (the juke doesn't react to them, only the interface); all I have to do is decide when to send the message and whether its "off" message is timed or triggered by something in the jukebox.
So on to the issue at hand: playing a sound effect before each song. There is currently a message for a song starting, MSG_SONGSTART, that you can key a sound effect off, but it's triggered when the music actually starts. there is a configurable delay between songs, controlled by SongDelay in jukebox.ini; there is no message for when this delay stops and starts, but adding one is easy. However, SongDelay does not trigger before the very first song played, nor does it trigger after the last song if there are no more in the queue, so it won't work for the instance of always wanting to do something before a song or after a song. My thinking is to create a BeforeSongDelay and an AfterSongDelay that always play. The only purpose for these, though, is to send messages for a skin to trigger sounds or animations (record change, etc.) from, so it would make sense for them to be in the skin file rather than on the global jukebox.ini level.
But not all skins are going to have delays built-in, and someone might always want a delay...
So I'm trying to think of the best way to handle this:
a) SongDelay is the minimum delay between songs. So if a skin has a BeforeSongDelay of 1 and an AfterSongDelay of 1, and the SongDelay is set to 3, the AfterSongDelay will trigger, then a 1-second pause, then the BeforeSongDelay will trigger. If SongDelay is the same as or shorter than the sum of the two shorter delays, there will be no delay between them at all.
b) SongDelay is the delay between the two delays. So if a skin has a BeforeSongDelay of 1 and an AfterSongDelay of 1, and the SongDelay is set to 3, the AfterSongDelay will trigger, then a 3-second pause, then the BeforeSongDelay will trigger.
c) SongDelay is a default delay and is ignored if a BeforeSongDelay or AfterSongDelay is present. So if a skin has a BeforeSongDelay of 1 and an AfterSongDelay of 1, and the SongDelay is set to 3, the AfterSongDelay will trigger, then the BeforeSongDelay will immediately trigger with no additional delay.
d) SongDelay is a simple toggle: it can be set to Enabled or Disabled, with the actual song delay made up of the two delay entries in the skin. If it's Disabled, not only will the delays never trigger, but neither will any events associated with them.
e) Don't worry about making a decision and add a SongDelayBehavior setting that allows the user to pick from all these options.
f) Eliminate SongDelay completely and just use the two delay settings in the skin.
Is one of these more intuitively "correct" than the others? I keep changing my mind as to which is the most natural... Please post your thoughts on the subject!