How to add an audio mixer[SOLVED]

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
User avatar
Badriel
Regular
Posts: 66
Joined: Mon Jul 23, 2012 1:10 pm
Completed: Clockwork City
Tumblr: badrielart
Deviantart: badriel
Contact:

How to add an audio mixer[SOLVED]

#1 Post by Badriel »

Hello, I'd like to add an additional audio mixer to a VN, with separate volume bar.
I want to have "ambient" channel, with a volume bar.
So far I've figured I need something like this:

Code: Select all

init python:
    renpy.music.register_channel("ambient", "sfx", True)
But I don't want to use "sfx" mixer, but a custom one. How can I achieve this?
Last edited by Badriel on Mon Jul 08, 2013 10:06 am, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How to add an audio mixer

#2 Post by PyTom »

Just use your own mixer, rather than sfx. You'll also want to update the preferences screen to add a bar with a MixerValue that updates the mixer you create.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Badriel
Regular
Posts: 66
Joined: Mon Jul 23, 2012 1:10 pm
Completed: Clockwork City
Tumblr: badrielart
Deviantart: badriel
Contact:

Re: How to add an audio mixer [SOLVED]

#3 Post by Badriel »

PyTom wrote:Just use your own mixer, rather than sfx. You'll also want to update the preferences screen to add a bar with a MixerValue that updates the mixer you create.
Yeah, that's what I wanted to do from the beginning, but I didn't know how.
But finally I realized how to do it. I added lines:

Code: Select all

elif name == "ambient volume":

            if value is None:
                return MixerValue('ambient')
            else:
                return SetMixer('ambient', value)
into 00screen.rpy
and

Code: Select all

renpy.music.alias_channel(1, "ambient")
into 00mixers.rpy

Post Reply

Who is online

Users browsing this forum: Bing [Bot]