Pause a music

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
Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

Pause a music

#1 Post by Keul » Tue Jul 24, 2012 9:51 am

Hello

I know that I can mute the music, but I'd prefer to be able to pause it.

The library (lib\windows-x86\pysdlsound.sound.pyd - \lib\linux-x86\lib\python2.6\pysdlsound\sound.so - .app\Contents\Resources\lib\python2.6\lib-dynload\pysdlsound\sound.so ) contains functions to do it (it's compiled code, but you can do a CTRL+F) and see references to pysdlsound.sound.pause and pysdlsound.sound.unpause

I've tried that by adding in the file renpy\audio\music.py :

Code: Select all

def pause(channel="music"):
    if renpy.game.context().init_phase:
        return
    try:        
        c = get_channel(channel)
        c.pause()
    except:
        if renpy.config.debug_sound:
            raise
(and the same with unpause instead of pause)

But it doesn't work.


(it would also be great to add more envolved loop system, with an intro, loop and maybe powerfull things, like a get_pos(), set_pause(x.y), and an event manager to keep things accurate, like on_pos(time,function_to_execute)

Post Reply

Who is online

Users browsing this forum: Ocelot