def main(): # Ensure gamestate integration cfg is in csgo's cfg directory csgo_dir = get_csgo_path(os.path.join(get_steam_path(), "steamapps")) if csgo_dir is not None: copyfile( "gamestate_integration_ccs.cfg", os.path.join(csgo_dir, "csgo", "cfg", "gamestate_integration_ccs.cfg"), ) oalInit() loop = asyncio.get_event_loop() app = WxAsyncApp() gui.MainFrame( None, title="CSGO Custom Sounds", size=wx.Size(320, 230), style=wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX), ) loop.run_until_complete(app.MainLoop()) # Freeing OpenAL buffers might fail if they are still in use # We don't really care since the OS will clean up anyway. try: oalQuit() except: # noqa pass
def on_key(self, _win, key, _scancode, action, _mods): """ 'Q' or 'Escape' quits """ if action == glfw.PRESS or action == glfw.REPEAT: if key == glfw.KEY_ESCAPE or key == glfw.KEY_Q: glfw.set_window_should_close(self.win, True) if key == glfw.KEY_W: GL.glPolygonMode(GL.GL_FRONT_AND_BACK, next(self.fill_modes)) if key == glfw.KEY_SPACE: glfw.set_time(0.0) if key == glfw.KEY_A: AL.oalQuit() if key == glfw.KEY_S: source = AL.oalOpen("lotr.wav") source.play() # call Node.key_handler which calls key_handlers for all drawables self.key_handler(key)
def run(self): """ Main render loop for this OpenGL window """ self.text_help() source = AL.oalOpen("lotr.wav") source.play() while not glfw.window_should_close(self.win): # clear draw buffer and depth buffer (<-TP2) GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT) win_size = glfw.get_window_size(self.win) view = self.trackball.view_matrix() projection = self.trackball.projection_matrix(win_size) # draw our scene objects self.draw(projection, view, identity()) # flush render commands, and swap draw buffers glfw.swap_buffers(self.win) # Poll for and process events glfw.poll_events() AL.oalQuit()
""" 脚本作用:使用 OpenAl 将播放音频,施加空间旋转效果,用于测试 hrtf """ import openal import importlib import time import math import sys import os os.chdir(os.path.dirname(os.path.abspath(__file__))) r = 1 声源 = openal.oalOpen('lone_ranger_left.wav') 声源.play() angle = 0 for angle in range(360 * 2): x = r * math.cos((angle + 60) / 180 * math.pi) y = r * math.sin((angle + 60) / 180 * math.pi) 声源.set_position((x, y, 0)) time.sleep(3 / 360) openal.oalQuit()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.sendto(b"end", addr) s.close() f.close() print("transmit conplete") s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((host, port)) while True: data = s.recv(packetSize) if data == b'end': break else: audiof.write(data) audiof.close() print("receive complete") print(time.time() - startTime) s.close() source = al.oalOpen(audiof.name) source.play() while source.get_state() == al.AL_PLAYING: pass al.oalQuit() cap.release()
# time.sleep(0.02) if keyboard.is_pressed('f'): hh = threading.Thread(target=playTomOne) hh.start() time.sleep(0.02) hh._stop() if keyboard.is_pressed('g'): hh = threading.Thread(target=playTomTwo) hh.start() time.sleep(0.02) hh._stop() if keyboard.is_pressed('h'): hh = threading.Thread(target=playTomThree) hh.start() time.sleep(0.02) hh._stop() if keyboard.is_pressed('j'): s = threading.Thread(target=playSplash) s.start() time.sleep(0.02) s._stop() if keyboard.is_pressed('esc'): oalQuit() break # oalQuit()
def onExit(self): if self.world: self.world.terminate() self.oscController.cleanup() openal.oalQuit() return True
def __del__(self): openal.oalQuit()
def exit(self): oalQuit()
def close(self): openal.oalQuit()