def register_channel(name, mixer=None, loop=None, stop_on_mute=True, tight=False, file_prefix="", file_suffix="", buffer_queue=True, movie=False): """ :doc: audio This registers a new audio channel named `name`. Audio can then be played on the channel by supplying the channel name to the play or queue statements. `mixer` The name of the mixer the channel uses. By default, Ren'Py knows about the "music", "sfx", and "voice" mixers. Using other names is possible, but may require changing the preferences screens. `loop` If true, sounds on this channel loop by default. `stop_on_mute` If true, music on the channel is stopped when the channel is muted. `tight` If true, sounds will loop even when fadeout is occurring. This should be set to True for a sound effects or seamless music channel, and False if the music fades out on its own. `file_prefix` A prefix that is prepended to the filenames of the sound files being played on this channel. `file_suffix` A suffix that is appended to the filenames of the sound files being played on this channel. `buffer_queue` Should we buffer the first second or so of a queued file? This should be True for audio, and False for movie playback. `movie` If true, this channel will be set up to play back videos. """ if name == "movie": movie = True if not renpy.game.context().init_phase and (" " not in name): raise Exception("Can't register channel outside of init phase.") if renpy.android and renpy.config.hw_video and name == "movie": c = AndroidVideoChannel(name, default_loop=loop, file_prefix=file_prefix, file_suffix=file_suffix) elif renpy.ios and renpy.config.hw_video and name == "movie": c = IOSVideoChannel(name, default_loop=loop, file_prefix=file_prefix, file_suffix=file_suffix) else: c = Channel(name, loop, stop_on_mute, tight, file_prefix, file_suffix, buffer_queue, movie=movie) c.mixer = mixer all_channels.append(c) channels[name] = c
def register_channel(name, mixer=None, loop=None, stop_on_mute=True, tight=False, file_prefix="", file_suffix="", buffer_queue=True, movie=False, framedrop=True): """ :doc: audio This registers a new audio channel named `name`. Audio can then be played on the channel by supplying the channel name to the play or queue statements. `mixer` The name of the mixer the channel uses. By default, Ren'Py knows about the "music", "sfx", and "voice" mixers. Using other names is possible, but may require changing the preferences screens. `loop` If true, sounds on this channel loop by default. `stop_on_mute` If true, music on the channel is stopped when the channel is muted. `tight` If true, sounds will loop even when fadeout is occurring. This should be set to True for a sound effects or seamless music channel, and False if the music fades out on its own. `file_prefix` A prefix that is prepended to the filenames of the sound files being played on this channel. `file_suffix` A suffix that is appended to the filenames of the sound files being played on this channel. `buffer_queue` Should we buffer the first second or so of a queued file? This should be True for audio, and False for movie playback. `movie` If true, this channel will be set up to play back videos. `framedrop` This controls what a video does when lagging. If true, frames will be dropped to keep up with realtime and the soundtrack. If false, Ren'Py will display frames late rather than dropping them. """ if name == "movie": movie = True if not renpy.game.context().init_phase and (" " not in name): raise Exception("Can't register channel outside of init phase.") if renpy.android and renpy.config.hw_video and name == "movie": c = AndroidVideoChannel(name, default_loop=loop, file_prefix=file_prefix, file_suffix=file_suffix) elif renpy.ios and renpy.config.hw_video and name == "movie": c = IOSVideoChannel(name, default_loop=loop, file_prefix=file_prefix, file_suffix=file_suffix) else: c = Channel(name, loop, stop_on_mute, tight, file_prefix, file_suffix, buffer_queue, movie=movie, framedrop=framedrop) c.mixer = mixer all_channels.append(c) channels[name] = c