def __init__(self): self.sounds = [] self.ex = 0 self.ey = 0 self.ez = 0 self.context = synthizer.Context() self.internal_reverb = synthizer.GlobalFdnReverb(self.context) self.verb = False self.is_cleaning = False
def __init__(self): log.info("sound manager created") self.sounds=[] self.ex=0 self.ey=0 self.ez=0 self.volume_step=0.0 self.context=synthizer.Context() self.max_distance=50 self.internal_reverb = synthizer.GlobalFdnReverb(self.context) self.verb=False self.orientation=0 self.facing=0 self.cleantimer=timer.Timer() self.cleantime=5000 self.is_cleaning=False self.thread=threading.Thread(target=self.sound_thread,daemon=True).start()
import time import random import sys import math import atexit # Normally you want to use the synthizer.initialized context manager, but I'm using this example # as a script that sets up a Python shell for debugging, and I # forgot to shut this down and had to kill via task manager one too many times. # # You always need to shut Synthizer down, but I'll be improving things so that failing to do so # doesn't freeze things so badly that you have to kill it via task manager. atexit.register(synthizer.shutdown) synthizer.configure_logging_backend(synthizer.LoggingBackend.STDERR) synthizer.set_log_level(synthizer.LogLevel.DEBUG) synthizer.initialize() ctx = synthizer.Context(enable_events=True) gen = synthizer.StreamingGenerator(ctx, "file", sys.argv[1], "") #buffer = synthizer.Buffer.from_stream("file", sys.argv[1], "") #gen.buffer = buffer #ctx.panner_strategy = synthizer.PannerStrategy.HRTF src = synthizer.PannedSource(ctx) src.add_generator(gen) src.panner_strategy = synthizer.PannerStrategy.HRTF reverb = synthizer.GlobalFdnReverb(ctx) ctx.config_route(src, reverb)