Beispiel #1
0
def split_nul_strings(s):
    # NUL-separated list of strings, double-NUL-terminated.
    nul = False
    i = 0
    while True:
        if s[i] == '\0':
            if nul:
                break
            else:
                nul = True
        else:
            nul = False
        i += 1
    s = s[:i - 1]
    return s.split('\0')

    op = optparse.OptionParser()
    op.add_option('-d',
                  '--device',
                  dest='device',
                  help='use device DEVICE',
                  metavar='DEVICE')
    (options, args) = op.parse_args(sys.argv[1:])

    default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value
    capture_default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value

    print('Default device:         %s' % default_device)
    print('Default capture device: %s' % capture_default_device)

    if alc.alcIsExtensionPresent(None, 'ALC_ENUMERATION_EXT'):
        # Hmm, actually not allowed to pass NULL to alcIsExtension present..
        # how is this supposed to work?
        devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_DEVICE_SPECIFIER))
        capture_devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))

    print('Devices:                %s' % ', '.join(devices))
    print('Capture devices:        %s' % ', '.join(capture_devices))
    print()

    if options.device:
        print('Using device "%s"...' % options.device)
        driver = openal.create_audio_driver(options.device)
    else:
        print('Using default device...')
        driver = openal.create_audio_driver()

    print('OpenAL version %d.%d' % driver.get_version())
    print('Extensions:              %s' % ', '.join(driver.get_extensions()))
Beispiel #2
0
def split_nul_strings(s):
    # NUL-separated list of strings, double-NUL-terminated.
    nul = False
    i = 0
    while True:
        if s[i] == '\0':
            if nul:
                break
            else:
                nul = True
        else:
            nul = False
        i += 1
    s = s[:i - 1]
    return s.split('\0')

    op = optparse.OptionParser()
    op.add_option('-d', '--device', dest='device',
                  help='use device DEVICE', metavar='DEVICE')
    (options, args) = op.parse_args(sys.argv[1:])

    default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value
    capture_default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value

    print('Default device:         %s' % default_device)
    print('Default capture device: %s' % capture_default_device)

    if alc.alcIsExtensionPresent(None, 'ALC_ENUMERATION_EXT'):
        # Hmm, actually not allowed to pass NULL to alcIsExtension present..
        # how is this supposed to work?
        devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_DEVICE_SPECIFIER))
        capture_devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))

    print('Devices:                %s' % ', '.join(devices))
    print('Capture devices:        %s' % ', '.join(capture_devices))
    print()

    if options.device:
        print('Using device "%s"...' % options.device)
        driver = openal.create_audio_driver(options.device)
    else:
        print('Using default device...')
        driver = openal.create_audio_driver()

    print('OpenAL version %d.%d' % driver.get_version())
    print('Extensions:              %s' % ', '.join(driver.get_extensions()))
Beispiel #3
0
def test_openal_listener():
    driver = openal.create_audio_driver()
    listener = driver.get_listener()
    check_listener_defaults(listener=listener)
    check_modifying_values(listener=listener)
    # Need to garbage collect the listener before the driver is deleted
    del listener
Beispiel #4
0
def dump_al():
    '''Dump OpenAL info.'''
    try:
        from pyglet.media.drivers import openal
    except:
        print 'OpenAL not available.'
        return
    print 'Library:', openal.al._lib

    driver = openal.create_audio_driver()
    print 'Version:', driver.get_version()
    print 'Extensions:'
    for extension in driver.get_extensions():
        print '  ', extension
Beispiel #5
0
def dump_al():
    '''Dump OpenAL info.'''
    try:
        from pyglet.media.drivers import openal
    except:
        print('OpenAL not available.')
        return
    print('Library:', openal.lib_openal._lib)

    driver = openal.create_audio_driver()
    print('Version: {}.{}'.format(*driver.get_version()))
    print('Extensions:')
    for extension in driver.get_extensions():
        print('  ', extension)
Beispiel #6
0
def dump_al():
    """Dump OpenAL info."""
    try:
        from pyglet.media.drivers import openal
    except:
        print('OpenAL not available.')
        return
    print('Library:', openal.lib_openal._lib)

    driver = openal.create_audio_driver()
    print('Version: {}.{}'.format(*driver.get_version()))
    print('Extensions:')
    for extension in driver.get_extensions():
        print('  ', extension)
Beispiel #7
0
def dump_al():
    '''Dump OpenAL info.'''
    try:
        from pyglet.media.drivers import openal
    except:
        print 'OpenAL not available.'
        return
    print 'Library:', openal.al._lib

    driver = openal.create_audio_driver()
    print 'Version:', driver.get_version()
    print 'Extensions:'
    for extension in driver.get_extensions():
        print '  ', extension
Beispiel #8
0
def dump_al():
    """Dump OpenAL info."""
    try:
        from pyglet.media.drivers import openal
    except:
        print("OpenAL not available.")
        return
    print("Library:", openal.al._lib)

    driver = openal.create_audio_driver()
    print("Version:", driver.get_version())
    print("Extensions:")
    for extension in driver.get_extensions():
        print("  ", extension)
Beispiel #9
0
    default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value
    capture_default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value

    print('Default device:         %s' % default_device)
    print('Default capture device: %s' % capture_default_device)

    if alc.alcIsExtensionPresent(
            None, ctypes.create_string_buffer(b'ALC_ENUMERATION_EXT')):
        devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_DEVICE_SPECIFIER))
        capture_devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))

        print('Devices:                %s' % b', '.join(devices))
        print('Capture devices:        %s\n' % b', '.join(capture_devices))

    if options.device:
        print('Using device "%s"...' % options.device)
        driver = openal.create_audio_driver(asbytes(options.device))
    else:
        print('Using default device...')
        driver = openal.create_audio_driver()

    print('OpenAL version %d.%d' % driver.get_version())
    print('Extensions:              %s' % ', '.join(driver.get_extensions()))
Beispiel #10
0
        alc.alcGetString(None, alc.ALC_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value
    capture_default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value

    print 'Default device:         %s' % default_device
    print 'Default capture device: %s' % capture_default_device

    if alc.alcIsExtensionPresent(None, 'ALC_ENUMERATION_EXT'):
        # Hmm, actually not allowed to pass NULL to alcIsExtension present..
        # how is this supposed to work?
        devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_DEVICE_SPECIFIER))
        capture_devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))

    print 'Devices:                %s' % ', '.join(devices)
    print 'Capture devices:        %s' % ', '.join(capture_devices)
    print

    if options.device:
        print 'Using device "%s"...' % options.device
        driver = openal.create_audio_driver(options.device)
    else:
        print 'Using default device...'
        driver = openal.create_audio_driver()

    print 'OpenAL version %d.%d' % driver.get_version()
    print 'Extensions:              %s' % ', '.join(driver.get_extensions())
Beispiel #11
0
        ctypes.c_char_p).value
    capture_default_device = ctypes.cast(
        alc.alcGetString(None, alc.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER),
        ctypes.c_char_p).value

    print 'Default device:         %s' % default_device
    print 'Default capture device: %s' % capture_default_device

    if alc.alcIsExtensionPresent(None, 'ALC_ENUMERATION_EXT'):
        # Hmm, actually not allowed to pass NULL to alcIsExtension present..
        # how is this supposed to work?
        devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_DEVICE_SPECIFIER))
        capture_devices = split_nul_strings(
            alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))

    print 'Devices:                %s' % ', '.join(devices)
    print 'Capture devices:        %s' % ', '.join(capture_devices)
    print


    if options.device:
        print 'Using device "%s"...' % options.device
        driver = openal.create_audio_driver(options.device)
    else:
        print 'Using default device...'
        driver = openal.create_audio_driver()

    print 'OpenAL version %d.%d' % driver.get_version()
    print 'Extensions:              %s' % ', '.join(driver.get_extensions())