Well, basically, it's practically quite easy even though there's not much theoritical information about it... At least none of what I could find... But, this is the method I used for my Music Room...
Code: Select all
init python:
# Creates a new music channel, named "bgm", which uses "bgm" mixer...
renpy.music.register_channel("bgm", mixer="bgm", loop=True)
# Creates a MusicRoom instance, using the just-defined music channel!
mr = MusicRoom(channel="bgm")
# This function is based on 00preferences.rpy in renpy/common directory!
def set_bgm_volume(value=None):
if value is None:
return MixerValue('bgm')
else:
return SetMixer('bgm', value)
screen music_room:
# Buttons and more...
vbar value set_bgm_volume()
Now, for the explanation part!
Function used to register a new music channel:
renpy.music.register_channel(name, mixer=None, loop=None, stop_on_mute=True, tight=False, file_prefix='', file_suffix='', buffer_queue=True)(
source)
I named the custom channel as "bgm" and used another custom mixer, which is also called "bgm"...
Then, I created my own function,
set_bgm_volume(), which does all the volume adjustment work basically, since now you can just use this function as-it-is in the bar after value, like
If you encounter any difficulties, feel free to ask right away!
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...