Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class _Server(pyo.Server): # pragma: no cover
# make libs class variables so they don't get deleted first
core = core
logging = logging
def __del__(self):
self.stop()
# make sure enough time passes for the server to shutdown
self.core.wait(0.5)
self.shutdown()
# make sure enough time passes for the server to shutdown
self.core.wait(0.5)
# this may never get printed
self.logging.debug('pyo sound server shutdown')
if '.'.join(map(str, pyo.getVersion())) < '0.6.4':
Server = _Server
else:
Server = pyo.Server
# if we already have a server, just re-initialize it
if 'pyoSndServer' in globals() and hasattr(pyoSndServer, 'shutdown'):
pyoSndServer.stop()
# make sure enough time passes for the server to shutdown
core.wait(0.5)
pyoSndServer.shutdown()
core.wait(0.5)
pyoSndServer.reinit(sr=rate, nchnls=maxChnls,
buffersize=buffer, audio=audioDriver)
pyoSndServer.boot()
else:
if platform == 'win32':
class _Server(pyo.Server): # pragma: no cover
# make libs class variables so they don't get deleted first
core = core
logging = logging
def __del__(self):
self.stop()
# make sure enough time passes for the server to shutdown
self.core.wait(0.5)
self.shutdown()
# make sure enough time passes for the server to shutdown
self.core.wait(0.5)
# this may never get printed
self.logging.debug('pyo sound server shutdown')
if '.'.join(map(str, pyo.getVersion())) < '0.6.4':
Server = _Server
else:
Server = pyo.Server
# if we already have a server, just re-initialize it
if 'pyoSndServer' in globals() and hasattr(pyoSndServer, 'shutdown'):
pyoSndServer.stop()
# make sure enough time passes for the server to shutdown
core.wait(0.5)
pyoSndServer.shutdown()
core.wait(0.5)
pyoSndServer.reinit(sr=rate, nchnls=maxChnls,
buffersize=buffer, audio=audioDriver)
pyoSndServer.boot()
else:
if sys.platform == 'win32':
import scipy; fileLikeObj.write("\n\tscipy:"+str(scipy.__version__))
except:
fileLikeObj.write('\n\tError with import scipy.')
try:
import matplotlib; fileLikeObj.write("\n\tmatplotlib:"+str(matplotlib.__version__))
except:
fileLikeObj.write('\n\tError with import matplotlib.')
try:
import pyglet; fileLikeObj.write("\n\tpyglet:"+pyglet.version)
except:
fileLikeObj.write('\n\tError with import pyglet.')
try:
fileLikeObj.write('\n\t')
import pyo
pv=pyo.getVersion()
fileLikeObj.write("\tpyo: pyo"+'.'.join(map(str,pv)))
except:
fileLikeObj.write('\n\tError with import pyo.')
try:
from psychopy import __version__, visual
fileLikeObj.write("\n\tPsychoPy"+str(__version__))
except:
fileLikeObj.write('\n\tError with import PsychoPy.')
try:
from ioHub import __version__ as ioHubVersion
fileLikeObj.write("\n\tioHub"+str(ioHubVersion))
except:
fileLikeObj.write('\n\tError with import ioHub.')
win = visual.Window([100,100])#some drivers want a window open first
print("\nPython info")
print(sys.executable)
print(sys.version)
import numpy
print("numpy", numpy.__version__)
import scipy
print("scipy", scipy.__version__)
import matplotlib
print("matplotlib", matplotlib.__version__)
import pyglet
print("pyglet", pyglet.version)
# pyo is a new dependency, for sound:
try:
import pyo
print("pyo", '%i.%i.%i' % pyo.getVersion())
except Exception:
print('pyo [not installed]')
from psychopy import __version__
print("\nPsychoPy", __version__)
win = visual.Window([100, 100]) # some drivers want a window open first
print("have shaders:", win._haveShaders)
print("\nOpenGL info:")
# get info about the graphics card and drivers
print("vendor:", gl_info.get_vendor())
print("rendering engine:", gl_info.get_renderer())
print("OpenGL version:", gl_info.get_version())
print("(Selected) Extensions:")
extensionsOfInterest = ['GL_ARB_multitexture',
'GL_EXT_framebuffer_object', 'GL_ARB_fragment_program',
def validateVersions():
import sys
from pyo import getVersion
import wxversion
if sys.version_info[0] > VERSIONS['python'][0]:
printMessage("python {}.x must be used to run Pyo Synth from sources".format(VERSIONS['python'][0]), 2)
if getVersion() != VERSIONS['pyo']:
printMessage("pyo version installed: {}.{}.{} ; pyo version required {}.{}.{}".format(*getVersion()+VERSIONS['pyo']), 1)
printMessage("Installed pyo version doesn't match what Pyo Synth uses. Some objects might not be available.", 1)
if not wxversion.checkInstalled('2.8'):
printMessage("wxPython version required {}.{}.{}".format(*VERSIONS['wx']), 1)
outputText += self.getLine(' '*8, "matplotlib ({})".format(
matplotlib.__version__))
import pyglet
outputText += self.getLine(' '*8, "pyglet ({})".format(pyglet.version))
try:
import glfw
outputText += self.getLine(' '*8, "PyGLFW ({})".format(
glfw.__version__))
except Exception:
outputText += self.getLine(' '*8, 'PyGLFW [not installed]')
# sound related
try:
import pyo
outputText += self.getLine(
' '*8, "pyo", ('%i.%i.%i' % pyo.getVersion()))
except Exception:
outputText += self.getLine(' '*8, 'pyo [not installed]')
try:
import psychtoolbox
outputText += self.getLine(' '*8, "psychtoolbox ({})".format(
psychtoolbox._version.__version__))
except Exception:
outputText += self.getLine(' '*8, 'psychtoolbox [not installed]')
# wxpython version
try:
import wx
outputText += self.getLine(' '*8, "wxPython ({})".format(
wx.__version__))
except Exception:
outputText += self.getLine(' '*8, 'wxPython [not installed]')