OK, I attached the plug-in. Tried to make it presentable. There's not much in the way of comments, error handling or logging.
How to use:
- Create a parent folder to hold your music (or ambient sounds). Mine is "Music".
- Within that folder, create subfolders with names matching the displays for which you want music to play. For example, my "Music/Hack & Slash" folder contains all the music I want to play when users are browsing Hack & Slash games. If you don't want music for a display, don't make a folder for it.
- Now enable the plugin in AttractMode and specify your parent folder as "Source Directory".
Ignore the other options for now. With this basic configuration you should get unique playlists for whichever displays you want to have music. Be aware there is no checking for illegal characters, so I guess if you put weird characters in your display names you might run into problems creating folders with matching names.
This isn't a jukebox, so although it's based on AudioMode (thanks to whoever wrote that) a lot of that functionality is stripped out. It just plays random music from the appropriate subfolder, and it restarts every time you leave and then return to whatever display the music is associated with.
I added the Alternate Source options in case someone wanted to offer a B-track. It works exactly the same. Just create a second parent folder, with subfolders named after whatever displays you want to play music. Then assign a key to toggle between the original music and the alternate music. This is optional, and hitting the toggle when no alternate source is defined will not do anything. As an example, I have "Music" as my original source, and I have "Music_Chiptunes" as an alternate set of music.
If you use the alternate source options, make sure in your attract.cfg file the value specified for "layout" under each "display" entry is exactly right. The values are case-sensitive. So in my case, I was getting weird behavior if layout was specified as "flavors" rather than the correct "Flavors". It caused the plug-in to reload and it messed up the toggling between the original and alternate music whenever I viewed a display with a misspecified layout.
Finally, in my set-up I have displays where I don't want music, but I want to hear the sound of the snap videos being shown. I also don't want the video sounds to play underneath music. I accomplished this outside of the DisplayMusic plugin. In my layout.nut, I used the video_flags (Vid.Default and Vid.NoAudio) to mute the videos for displays with music, and to play the video sounds in the display with no music.
For anyone who wants display-specific music, I hope this helps.