This is an excellent tool you've released! Thanks very much for sharing it. Since you seem very knowledgeable about this, and I am but a novice at best, I was wondering if you might have a simple solution to the following.
I've been fiddling around with my own project, and I started with the official documentation for the music room https://www.renpy.org/doc/html/rooms.html#music-room
I've made a few small, novice-level adjustments so far. But what I am really aiming for is allowing the player to choose what music to listen to, and letting it continue to play until they decide to change songs or turn it off, even when they go back to playing the game.
Here is what I have so far, mostly from the documentation:
########## MUSIC PLAYER SCREEN ########## init python: # Step 1. Create a MusicRoom instance. mr = MusicRoom(fadeout=1.0) # Step 2. Add music files. mr.add("track1.ogg", always_unlocked=True) mr.add("track2.ogg", always_unlocked=True) mr.add("track3.ogg", always_unlocked=True) # Step 3. Create the music room screen. screen music_room: tag menu frame: xpos 320 ypos 100 has vbox # The buttons that play each track. textbutton "Play: Track 1" action mr.Play("track1.ogg") textbutton "Play: Track 2" action mr.Play("track2.ogg") textbutton "Play: Track 3" action mr.Play("track3.ogg") null height 20 # Buttons that let us advance tracks. textbutton "Next Song" action mr.Next() textbutton "Previous Song" action mr.Previous() null height 20 # A custom button to stop playing music. textbutton "Stop Music" action mr.Stop() null height 20 # The button that lets the user exit the music room. Customized to include a separate function for handling the game menu too. if main_menu: textbutton "Return" action ShowMenu("main_menu") elif not main_menu: textbutton "Return" action Return() # Start the music playing on entry to the music room. # on "replace" action mr.Play() #Commented out intentionally, since it seemed undesirable, but may need to re-enable later. # Restore the main menu music upon leaving. if renpy.music.get_playing() == "audio/music/track1.ogg": on "replaced" action Play("music", "track1.ogg") elif renpy.music.get_playing() == "audio/music/track2.ogg": on "replaced" action Play("music", "track2.ogg") elif renpy.music.get_playing() == "audio/music/track3.ogg": on "replaced" action Play("music", "track3.ogg")
The default function for returning to the main menu screen, with the small adjustments I've added to it, works as I had intended. However, when accessing the music room during gameplay via the game menu, and using the Return button to go back to the game, the music stops playing when it leaves the music room.
I understand that it's because the music from script.rpy would take precedence while playing in a normal scenario, but I have not set any music to play in script.rpy in this case, and instead I wish for the music room's current state to carry over into other menus and during gameplay, like it does when going back to the main menu using the "replaced" function (which I admittedly don't understand the significance of.)
If there is a simple and elegant solution (or a messy one is fine too) that you could share to point me in the right direction, I'd appreciate it!
At any rate, thanks for your time today!