def start(): # Prepare audio feedback try: global sink global source global data global ping_delay global ping_pos_x global ping_pos_z global ping_pitch global ping_delay_mult sound_beep = resource_path("beep.wav") ping_delay = 1000 ping_pos_x = 0.0 ping_pos_z = 0.0 ping_pitch = 1.0 ping_delay_mult = 2 sink = SoundSink() sink.activate() source = SoundSource(position=[ping_pos_x, 0, ping_pos_z]) # source.looping = False source.gain = 50.0 data = load_wav_file(sound_beep) sink.play(source) print("Audio system started") except Exception as e: print("E.Starting Audio: " + str(e)) addLogEntry(e)
def play_sfx(self, name, offset=(0., 0., 0.), volume=1.): source = SoundSource() source.queue(load_wav_file(get_sfx(name))) source.gain = volume source.position = tuple( new_pt(*self.sink.listener.position) + new_pt(*offset)) self.sink.play(source)
def Start(): #Prepare audio feedback try: global sink global source global data sink = SoundSink() sink.activate() source = SoundSource(position=[0, 0, 50]) source.looping = False source.gain = 50.0 data = load_wav_file(sound_beep) #source.queue(data) sink.play(source) print("Audio system started") except Exception as e: print("E.Starting Audio:" + str(e)) AddLogEntry(e)