a switch between two separate soundtracks

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
ren10n
Newbie
Posts: 1
Joined: Sun May 15, 2022 10:24 am
Contact:

a switch between two separate soundtracks

#1 Post by ren10n »

Hey! We have two sets of music for our game, so two different tracks for every scene. (It comes from two different authors and we want to keep the both options.)
I made a simple persistent switch in the menu. Then I put it like this:

Code: Select all

    if persistent.composers: 
        play music adventure_1 
    else:    
        play music adventure_2
It works fine, but now I'm looking for a way to also switch the current track. I think it will be fun for a player to do it right in the scene (and it will be more fair for the second composer, bringing his stuff closer).
So what I did for a test:

Code: Select all

init:
    $ adventure = "audio/adventure" + persistent.m_suf + ".mp3"

label start:
    $ persistent.m_suf = "_1"
    play music adventure
    $ renpy.pause (10)
    $ persistent.m_suf = "_2"
    play music adventure
It's not working, same music is playing both times. So making a button with a persistent switch and also play/stop function (that's was the idea) has no use.

My second idea was to use two different channels or mixers, start the both tracks in the same time, but one of them will be always muted, and there will be a button for that. But I'm afraid it compromises the whole idea of volume control :) Or maybe I'm wrong?

Please, point me in the right direction, maybe at least one of this things is doable? Any piece of working code, if I get so lucky, will be extra appreciated :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]