def get_audio_driver():
    global _audio_driver

    if _audio_driver:
        return _audio_driver

    _audio_driver = None

    for driver_name in pyglet.options['audio']:
        try:
            if driver_name == 'pulse':
                from drivers import pulse
                _audio_driver = pulse.create_audio_driver()
                break
            elif driver_name == 'openal':
                from drivers import openal
                _audio_driver = openal.create_audio_driver()
                break
            elif driver_name == 'directsound':
                from drivers import directsound
                _audio_driver = directsound.create_audio_driver()
                break
            elif driver_name == 'silent':
                _audio_driver = get_silent_audio_driver()
                break
        except Exception as exp:
            if _debug:
                print 'Error importing driver %s:\n%s' % (driver_name, str(exp))
    return _audio_driver
Example #2
0
def get_audio_driver():
    global _audio_driver
    if _audio_driver:
        return _audio_driver

    _audio_driver = None

    # TODO  options
    #driver_names = ('silent',)
    #driver_names = ('directsound',) # 'pulse', 'openal')
    #driver_names = ('openal',)
    driver_names = ('pulse', )

    for driver_name in driver_names:
        try:
            if driver_name == 'pulse':
                from drivers import pulse
                _audio_driver = pulse.create_audio_driver()
                break
            elif driver_name == 'openal':
                from drivers import openal
                _audio_driver = openal.create_audio_driver()
                break
            elif driver_name == 'directsound':
                from drivers import directsound
                _audio_driver = directsound.create_audio_driver()
            elif driver_name == 'silent':
                from drivers import silent
                _audio_driver = silent.create_audio_driver()
                break
        except None:
            if _debug:
                print 'Error importing driver %s' % driver_name
    return _audio_driver
Example #3
0
def get_audio_driver():
    global _audio_driver

    if _audio_driver:
        return _audio_driver

    _audio_driver = None

    for driver_name in pyglet.options['audio']:
        try:
            if driver_name == 'pulse':
                from drivers import pulse
                _audio_driver = pulse.create_audio_driver()
                break
            elif driver_name == 'openal':
                from drivers import openal
                _audio_driver = openal.create_audio_driver()
                break
            elif driver_name == 'directsound':
                from drivers import directsound
                _audio_driver = directsound.create_audio_driver()
                break
            elif driver_name == 'silent':
                _audio_driver = get_silent_audio_driver()
                break
        except Exception as exp:
            if _debug:
                print 'Error importing driver %s:\n%s' % (driver_name,
                                                          str(exp))
    return _audio_driver
Example #4
0
def get_audio_driver():
    global _audio_driver
    if _audio_driver:
        return _audio_driver

    _audio_driver = None

    # TODO  options
    #driver_names = ('silent',)
    #driver_names = ('directsound',) # 'pulse', 'openal')
    #driver_names = ('openal',)
    driver_names = ('pulse',)

    for driver_name in driver_names:
        try:
            if driver_name == 'pulse':
                from drivers import pulse
                _audio_driver = pulse.create_audio_driver()
                break
            elif driver_name == 'openal':
                from drivers import openal
                _audio_driver = openal.create_audio_driver()
                break
            elif driver_name == 'directsound':
                from drivers import directsound
                _audio_driver = directsound.create_audio_driver()
            elif driver_name == 'silent':
                from drivers import silent
                _audio_driver = silent.create_audio_driver()
                break
        except None:
            if _debug:
                print 'Error importing driver %s' % driver_name
    return _audio_driver