def init(): global periodic_thread global periodic_thread_quit global pcm_ok global mix_ok if not renpy.config.sound: pcm_ok = False mix_ok = False return if pcm_ok is None and renpysound: bufsize = 2048 if renpy.emscripten: # Large buffer (and latency) as compromise to avoid sound jittering bufsize = 8192 # works for me # bufsize = 16384 # jitter/silence right after starting a sound if 'RENPY_SOUND_BUFSIZE' in os.environ: bufsize = int(os.environ['RENPY_SOUND_BUFSIZE']) try: renpysound.init(renpy.config.sound_sample_rate, 2, bufsize, False, renpy.config.equal_mono) pcm_ok = True except: if renpy.config.debug_sound: raise pcm_ok = False # Find all of the mixers in the game. mixers = [] for c in all_channels: if c.mixer not in mixers: mixers.append(c.mixer) default_volume = 1.0 for m in mixers: renpy.game.preferences.volumes.setdefault(m, default_volume) renpy.game.preferences.mute.setdefault(m, False) with periodic_condition: periodic_thread_quit = False periodic_thread = threading.Thread(target=periodic_thread_main) periodic_thread.daemon = True periodic_thread.start()
def init(): global periodic_thread global periodic_thread_quit global pcm_ok global mix_ok if not renpy.config.sound: pcm_ok = False mix_ok = False return if pcm_ok is None and renpysound: bufsize = 2048 if renpy.emscripten: # Large buffer (and latency) as compromise to avoid sound jittering bufsize = 8192 # works for me #bufsize = 16384 # jitter/silence right after starting a sound if 'RENPY_SOUND_BUFSIZE' in os.environ: bufsize = int(os.environ['RENPY_SOUND_BUFSIZE']) try: renpysound.init(renpy.config.sound_sample_rate, 2, bufsize, False, renpy.config.equal_mono) pcm_ok = True except: if renpy.config.debug_sound: raise pcm_ok = False # Find all of the mixers in the game. mixers = [ ] for c in all_channels: if c.mixer not in mixers: mixers.append(c.mixer) default_volume = 1.0 for m in mixers: renpy.game.preferences.volumes.setdefault(m, default_volume) renpy.game.preferences.mute.setdefault(m, False) with periodic_condition: periodic_thread_quit = False periodic_thread = threading.Thread(target=periodic_thread_main) periodic_thread.daemon = True periodic_thread.start()
def init(): global periodic_thread global periodic_thread_quit global pcm_ok global mix_ok if not renpy.config.sound: pcm_ok = False mix_ok = False return if pcm_ok is None and renpysound: bufsize = 2048 if 'RENPY_SOUND_BUFSIZE' in os.environ: bufsize = int(os.environ['RENPY_SOUND_BUFSIZE']) try: renpysound.init(renpy.config.sound_sample_rate, 2, bufsize, False) pcm_ok = True except: if renpy.config.debug_sound: raise pcm_ok = False # Find all of the mixers in the game. mixers = [ ] for c in all_channels: if c.mixer not in mixers: mixers.append(c.mixer) default_volume = 1.0 for m in mixers: renpy.game.preferences.volumes.setdefault(m, default_volume) renpy.game.preferences.mute.setdefault(m, False) with periodic_condition: periodic_thread_quit = False periodic_thread = threading.Thread(target=periodic_thread_main) periodic_thread.daemon = True periodic_thread.start()
def init(): global periodic_thread global periodic_thread_quit global pcm_ok global mix_ok if not renpy.config.sound: pcm_ok = False mix_ok = False return if pcm_ok is None and renpysound: bufsize = 2048 if 'RENPY_SOUND_BUFSIZE' in os.environ: bufsize = int(os.environ['RENPY_SOUND_BUFSIZE']) try: renpysound.init(renpy.config.sound_sample_rate, 2, bufsize, False) pcm_ok = True except: if renpy.config.debug_sound: raise pcm_ok = False # Find all of the mixers in the game. mixers = [] for c in all_channels: if c.mixer not in mixers: mixers.append(c.mixer) default_volume = 1.0 for m in mixers: renpy.game.preferences.volumes.setdefault(m, default_volume) renpy.game.preferences.mute.setdefault(m, False) with periodic_condition: periodic_thread_quit = False periodic_thread = threading.Thread(target=periodic_thread_main) periodic_thread.daemon = True periodic_thread.start()
def init(): global pcm_ok global mix_ok if not renpy.config.sound: pcm_ok = False mix_ok = False return if pcm_ok is None and renpysound: bufsize = 2048 if "RENPY_SOUND_BUFSIZE" in os.environ: bufsize = int(os.environ["RENPY_SOUND_BUFSIZE"]) try: renpysound.init(renpy.config.sound_sample_rate, 2, bufsize, False) pcm_ok = True except: if renpy.config.debug_sound: raise pcm_ok = False # Find all of the mixers in the game. mixers = [] for c in all_channels: if c.mixer not in mixers: mixers.append(c.mixer) default_volume = 1.0 for m in mixers: renpy.game.preferences.volumes.setdefault(m, default_volume) renpy.game.preferences.mute.setdefault(m, False)
def init(): global periodic_thread global periodic_thread_quit global pcm_ok global mix_ok if not renpy.config.sound or ("RENPY_DISABLE_SOUND" in os.environ): pcm_ok = False mix_ok = False return if renpy.emscripten and renpy.config.webaudio: import renpy.audio.webaudio as webaudio if webaudio.can_play_types(renpy.config.webaudio_required_types): renpysound.__dict__.update(webaudio.__dict__) if pcm_ok is None and renpysound: bufsize = 2048 if renpy.emscripten: # Large buffer (and latency) as compromise to avoid sound jittering bufsize = 8192 # works for me # bufsize = 16384 # jitter/silence right after starting a sound if 'RENPY_SOUND_BUFSIZE' in os.environ: bufsize = int(os.environ['RENPY_SOUND_BUFSIZE']) try: renpysound.init(renpy.config.sound_sample_rate, 2, bufsize, False, renpy.config.equal_mono) pcm_ok = True except Exception: if renpy.config.debug_sound: raise os.environ["SDL_AUDIODRIVER"] = "dummy" try: renpysound.init(renpy.config.sound_sample_rate, 2, bufsize, False, renpy.config.equal_mono) pcm_ok = True except Exception: pcm_ok = False # Find all of the mixers in the game. mixers = [] for c in all_channels: if c.mixer not in mixers: mixers.append(c.mixer) default_volume = 1.0 for m in mixers: renpy.game.preferences.volumes.setdefault(m, default_volume) renpy.game.preferences.mute.setdefault(m, False) with periodic_condition: periodic_thread_quit = False periodic_thread = threading.Thread(target=periodic_thread_main) periodic_thread.daemon = True periodic_thread.start()