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.
galadain
Regular
Posts: 31 Joined: Wed Sep 09, 2020 4:24 pm
Contact:
#1
Post
by galadain » Thu May 27, 2021 7:38 pm
I'm playing movies playing movies by first defining it like this:
Code: Select all
image fight_scn1 = Movie(play="fight_scn1.webm")
And then calling the movie with:
I need the movie to play while the user is clicking through text. This code works perfect for what I want. The problem is the standard volume options don't work for the movie played this way. Users can't control or mute the volume. How do I fix this?
Last edited by
galadain on Sat Jun 19, 2021 12:04 pm, edited 1 time in total.
galadain
Regular
Posts: 31 Joined: Wed Sep 09, 2020 4:24 pm
Contact:
#3
Post
by galadain » Sun May 30, 2021 4:05 pm
Okay. So I tried to make the following changes to control the movie playback sound with the normal Ren'Py voice channel controls.
Code: Select all
image fight_scn1 = Movie(channel=voice.channel, play="fight_scn1.webm")
Code: Select all
image fight_scn1 = Movie(channel=voice, play="fight_scn1.webm")
Neither option works. Please advise.
Alex
Lemma-Class Veteran
Posts: 3093 Joined: Fri Dec 11, 2009 5:25 pm
Contact:
#4
Post
by Alex » Sun May 30, 2021 6:55 pm
Try it like
Code: Select all
init python:
renpy.music.register_channel("my_movie_channel", mixer="my_mixer", loop=True, movie=True)
image my_movie = Movie(channel="my_movie_channel", play="images/Clips/oa4_launch.webm")
# The game starts here.
label start:
"..."
show my_movie at truecenter
"?!"
And bar in preferences screen
Code: Select all
label _("My_movie Volume")
hbox:
bar value MixerValue("my_mixer")
textbutton "0.5" action Function(preferences.set_volume,"my_mixer", 0.5)
textbutton "1.0" action Function(preferences.set_volume,"my_mixer", 1.0)
https://www.renpy.org/doc/html/audio.ht ... er_channel
https://www.renpy.org/doc/html/screen_a ... MixerValue
https://www.renpy.org/doc/html/screen_a ... l#Function
https://www.renpy.org/doc/html/preferen ... set_volume
galadain
Regular
Posts: 31 Joined: Wed Sep 09, 2020 4:24 pm
Contact:
#5
Post
by galadain » Wed Jun 16, 2021 5:30 pm
Sorry I didn't reply sooner. Is there a way to accomplish this using the existing audio channels/controls instead of creating a new one?
Alex
Lemma-Class Veteran
Posts: 3093 Joined: Fri Dec 11, 2009 5:25 pm
Contact:
#6
Post
by Alex » Thu Jun 17, 2021 4:14 pm
No, I'm afraid, 'cause audio channels doesn't have 'movie=True' property. Besides, you wanted to control the volume of the sound in video. So, make a channel and mixer and change their volume as you need separately from music/sound.
galadain
Regular
Posts: 31 Joined: Wed Sep 09, 2020 4:24 pm
Contact:
#7
Post
by galadain » Thu Jun 17, 2021 4:59 pm
Here's my code:
Preferences
Code: Select all
label _("My_movie Volume")
hbox:
bar value MixerValue("my_mixer")
textbutton "0.5" action Function(preferences.set_volume,"my_mixer", 0.5)
textbutton "1.0" action Function(preferences.set_volume,"my_mixer", 1.0)
Script
Code: Select all
$ renpy.music.register_channel("my_movie_channel", mixer="my_mixer", loop=True, movie=True)
image mov1 = Movie(channel="my_movie_channel", play="mov1.webm")
# The game starts here.
label start:
scene mov1
with fade
No errors and the movie still plays. Still no control over volume even with the new bar.
Alex
Lemma-Class Veteran
Posts: 3093 Joined: Fri Dec 11, 2009 5:25 pm
Contact:
#8
Post
by Alex » Thu Jun 17, 2021 6:55 pm
Hm, that's strange - it worked for me with starship launching video from tutorial game. Could you try different videos?
galadain
Regular
Posts: 31 Joined: Wed Sep 09, 2020 4:24 pm
Contact:
#9
Post
by galadain » Fri Jun 18, 2021 7:19 pm
Tried it with three different movies. Still no audio control with new or existing channels
Code: Select all
image mov1 = Movie(channel="my_movie_channel", play="mov1.webm")
image mov2 = Movie(channel="my_movie_channel", play="mov2.webm")
image mov3 = Movie(channel="my_movie_channel", play="mov3.webm")
Code: Select all
scene mov1
with fade
scene mov2
with fade
scene mov3
with fade
Alex
Lemma-Class Veteran
Posts: 3093 Joined: Fri Dec 11, 2009 5:25 pm
Contact:
#10
Post
by Alex » Fri Jun 18, 2021 7:31 pm
Still working for me... So, you hear sound but unable to change its volume? Try the new project to test just this code.
galadain
Regular
Posts: 31 Joined: Wed Sep 09, 2020 4:24 pm
Contact:
#11
Post
by galadain » Fri Jun 18, 2021 9:54 pm
Correct. I can hear the sound as if I was playing the .webm in a normal Windows media player. However, none of the Ren'py volume options, including the custom one you suggested I create, control the volume for the movie.
I'm curious I've I'm putting this code in the correct place.
Code: Select all
label _("My_movie Volume")
hbox:
bar value MixerValue("my_mixer")
textbutton "0.5" action Function(preferences.set_volume,"my_mixer", 0.5)
textbutton "1.0" action Function(preferences.set_volume,"my_mixer", 1.0)
Which script file and under what section should that code be in?
Alex
Lemma-Class Veteran
Posts: 3093 Joined: Fri Dec 11, 2009 5:25 pm
Contact:
#12
Post
by Alex » Sat Jun 19, 2021 5:06 am
galadain wrote: ↑ Fri Jun 18, 2021 9:54 pm
...
Code: Select all
label _("My_movie Volume")
hbox:
bar value MixerValue("my_mixer")
textbutton "0.5" action Function(preferences.set_volume,"my_mixer", 0.5)
textbutton "1.0" action Function(preferences.set_volume,"my_mixer", 1.0)
Which script file and under what section should that code be in?
This should be a part of preferences screen - slider for volume control (like it already made for music, sound and voice).
Try this project - run the game, open preferences and move the slider.
galadain
Regular
Posts: 31 Joined: Wed Sep 09, 2020 4:24 pm
Contact:
#13
Post
by galadain » Sat Jun 19, 2021 12:03 pm
Changed my code to make it identical to yours and it's working now. Thanks!
Users browsing this forum: Google [Bot] , henne