- 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.
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.
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
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.