A rough example of what I mean would be:
Code: Select all
play music "music1.ogg"
[some gameplay here]
$time = getmusictime
stop music
play music "music 2.ogg"
queue music "<from time>music1.ogg"
Any help would be appreciated, thanks!
Code: Select all
play music "music1.ogg"
[some gameplay here]
$time = getmusictime
stop music
play music "music 2.ogg"
queue music "<from time>music1.ogg"
Alright, how do I use that to resume the music then?Imperf3kt wrote: ↑Thu Mar 07, 2019 5:01 pm You could use renpy.music.get_pos()
https://www.renpy.org/doc/html/audio.ht ... ic.get_pos
Code: Select all
$ battlemusic = renpy.music.get_pos(channel='music')
play music "sounds/exp/jingle.ogg"
pause 1.5
play music "<from battlemusic>sounds/exp/random battle 1.ogg" loop
Code: Select all
play music "<from [battlemusic]>music.ogg" loop
Code: Select all
play music "<from battlemusic>music.ogg" loop
Code: Select all
init python:
renpy.music.register_channel(name='music_2', mixer='music') # 2nd channel using same volume setting as music
label start:
play music "music1.ogg"
"..."
$ renpy.music.set_volume(0.0, delay=0.5, channel='music') # 0.0 is based on the mixer volume
$ renpy.music.set_pause(True, channel='music')
play music_2 "sounds/exp/jingle.ogg"
pause 3.0
$ renpy.music.set_pause(False, channel='music')
$ renpy.music.set_volume(1.0, delay=0.5, channel='music') # 1.0 is back to normal volume
"..."
Remix wrote: ↑Fri Mar 08, 2019 3:53 pm Would it not be better/nicer to define a second music channel, fade out and pause the main channel, play the second, then revert?Code: Select all
init python: renpy.music.register_channel(name='music_2', mixer='music') # 2nd channel using same volume setting as music label start: play music "music1.ogg" "..." $ renpy.music.set_volume(0.0, delay=0.5, channel='music') # 0.0 is based on the mixer volume $ renpy.music.set_pause(True, channel='music') play music_2 "sounds/exp/jingle.ogg" pause 3.0 $ renpy.music.set_pause(False, channel='music') $ renpy.music.set_volume(1.0, delay=0.5, channel='music') # 1.0 is back to normal volume "..."
Nope, the fade out and fade in value are as a float percentage of the mixer volume (as set in preferences), so 1.0 might be 30% if music is set to that and 0.0 will always be zero volume.
CoolerMudkip wrote: ↑Thu Mar 07, 2019 10:41 am Is it possible to get the currently elapsed time into a track? For example, if the game is 45 seconds into the track, retrieve that information? I'm trying to use it in order to pause the music, play another short track, then resume the previous music where it left off. (An example of very similar behavior would be Ralsei's lullaby move from Deltarune.) I know of sounds, but I don't want them to both play at the same time.
A rough example of what I mean would be:Is this possible?Code: Select all
play music "music1.ogg" [some gameplay here] $time = getmusictime stop music play music "music2.ogg" queue music "<from time>music1.ogg"
Any help would be appreciated, thanks!
Code: Select all
play music 'music1.ogg'
'some gameplay here'
$ mytime = renpy.music.get_pos(channel='music')
$ renpy.block_rollback() # << this line is not necessary, but without it, there could be problems (If a player uses rollback)
play music 'music 2.ogg'
queue music "<from %d>music1.ogg" % mytime
Users browsing this forum: Bing [Bot]