Can't Register Audio Channel [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
Angelee
Newbie
Posts: 13
Joined: Fri Jan 23, 2015 5:07 am
Contact:

Can't Register Audio Channel [Solved]

#1 Post by Angelee » Sun Jan 25, 2015 5:15 pm

I'm using the "renpy.music.register_channel(name, mixer=None, loop=None, stop_on_mute=True, tight=False, file_prefix='', file_suffix='', buffer_queue=True)" function from the documentation. I figured that creating a separate audio channel will let me play two sound effects at the same time. But...I don't know where to put it. I put it in the scripts file and in the options file and they both gave me errors when I did that. It says that the "sound2" (which I named my channel) is not defined.

If someone could help me out I'd really appreciate it. (ಥ_ಥ)
Last edited by Angelee on Sun Jan 25, 2015 10:36 pm, edited 1 time in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Can't Register Audio Channel

#2 Post by trooper6 » Sun Jan 25, 2015 5:50 pm

I'm pretty sure you can put the declarations in any file since Renpy treats all individual files as one big file.
It should however be in an init block and a python block.

This is what I have in my code:

Code: Select all

init -1 python:
    renpy.music.register_channel("TockBG", mixer= "sfx", loop=True)
    renpy.music.register_channel("ChimeBG", mixer= "sfx", loop=False, tight=True) 
    renpy.music.register_channel("Alarm", mixer= "sfx", loop=False, tight=True)  
It works for me...so what exactly did you put in your code?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Angelee
Newbie
Posts: 13
Joined: Fri Jan 23, 2015 5:07 am
Contact:

Re: Can't Register Audio Channel

#3 Post by Angelee » Sun Jan 25, 2015 7:31 pm

EDIT: Wait, I think I see the problem once I compare our scripts. Let me try something and I'll post the results.

EDIT: Yep, thanks a lot, trooper6! That did the trick. :D The problem was that I didn't put the channel name in quotes.

I put:

renpy.music.register_channel(sound2, mixer="sfx", loop=False, stop_on_mute=True, tight=True, buffer_queue=True)

instead of:

renpy.music.register_channel("sound2", mixer="sfx", loop=False, stop_on_mute=True, tight=True, buffer_queue=True)

Such a simple thing but I was scratching my head for hours! Maybe I'm not cut out for programming, lol. (─‿‿─)

Thanks again!
Last edited by Angelee on Sun Jan 25, 2015 7:42 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Can't Register Audio Channel

#4 Post by philat » Sun Jan 25, 2015 7:37 pm

Put sound2 in quotes. Yeah, I know the documentation isn't super helpful at pointing out when things should be strings or not. ;)

Angelee
Newbie
Posts: 13
Joined: Fri Jan 23, 2015 5:07 am
Contact:

Re: Can't Register Audio Channel

#5 Post by Angelee » Sun Jan 25, 2015 7:44 pm

philat wrote:Put sound2 in quotes. Yeah, I know the documentation isn't super helpful at pointing out when things should be strings or not. ;)
Haha, thanks! I figured it out a second ago. Now I feel so dumb. :oops:

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Can't Register Audio Channel

#6 Post by trooper6 » Sun Jan 25, 2015 8:11 pm

Glad I could help! Don't forget to edit the title of your first post to included [Solved]
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Bing [Bot]