Ren'Py Audio queue stops on rollback or console open, cannot resume.

Pr0GamerJohnny

Conversation Conqueror
Sep 7, 2022
6,728
10,070
Should be a simple function to randomize a playlist of existing tracks and queue them up. Assuming a library of track1.mp3-track20 in the correct folder, channel is defined as

renpy.music.register_channel("bgm", mixer="music", loop=False, stop_on_mute=True, tight=False, file_prefix="audio/musicCustom/", file_suffix=".mp3", buffer_queue=True)

trackLibrary is a list containing ints 1-20 in order.

Code:
label randomizePlaylist:
    $ tempLibrary = trackLibrary
    while len(tempLibrary) > 0:
        $ removeNum = renpy.random.randint(1,len(tempLibrary)) - 1
        $ currSong = tempLibrary[removeNum]
        $ newSong = "track%s" % currSong
        $ tempLibrary.remove(currSong)
        queue bgm newSong
    return
When randomizePlaylist is called in game, it successfully starts playing, and transitions between songs without issue. However, opening the console in game or doing any rollbacks cuts off playback completely, and even more strange after this is done, calling randomizePlaylist again does absolutely nothing.

Both renpy.music.is_playing("bgm") and renpy.music.get_loop("bgm") show none after the rollback or console.

Any ideas on what's causing this? Only other thread I found that may or not be related is https://f95zone.to/threads/help-in-audio.103342/ , but that deals with save game music.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,188
It's only a guess, but:
renpy.music.register_channel("bgm", mixer="music", loop=False, stop_on_mute=True, tight=False, file_prefix="audio/musicCustom/", file_suffix=".mp3", buffer_queue=True)
Aren't opening the console supposed to mute the channel, since you aren't anymore playing the game ? And I guess that the same apply for rollback. What mean that by doing one or the other, you are asking Ren'Py to stop playing music.


Both renpy.music.is_playing("bgm") and renpy.music.get_loop("bgm") show none after the rollback or console.
What mean that there's no music currently played, and then tend to confirm my guess.
 

Pr0GamerJohnny

Conversation Conqueror
Sep 7, 2022
6,728
10,070
It's only a guess, but:


Aren't opening the console supposed to mute the channel, since you aren't anymore playing the game ? And I guess that the same apply for rollback. What mean that by doing one or the other, you are asking Ren'Py to stop playing music.




What mean that there's no music currently played, and then tend to confirm my guess.
Ah thanks for your reply, i actually solved it - it's related to this:

Simply having the audio channel as loop default fixed it - I thought that would be a problem with queuing but queuing pre-empts looping.

So for future reference and anyone else's reference searching this forums:

Having an audio channel with loop=False gets into all kinds of trouble with rollback etc, as in literally breaks the audio namespace. (excluding the sfx channel [sound] which is noloop by default)