示例#1
0
文件: pybassmix.py 项目: Oire/TWBlue
'''

import os, sys, ctypes, platform
from . import pybass

QWORD = pybass.QWORD
HSYNC = pybass.HSYNC
HSTREAM = pybass.HSTREAM
DOWNLOADPROC = pybass.DOWNLOADPROC
SYNCPROC = pybass.SYNCPROC
BASS_FILEPROCS = pybass.BASS_FILEPROCS

from .paths import x86_path, x64_path
import libloader

bassmix_module = libloader.load_library('bassmix', x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()
	
# additional BASS_SetConfig option
BASS_CONFIG_MIXER_FILTER = 0x10600
BASS_CONFIG_MIXER_BUFFER = 0x10601
BASS_CONFIG_SPLIT_BUFFER = 0x10610

# BASS_Mixer_StreamCreate flags
BASS_MIXER_END = 0x10000# end the stream when there are no sources
BASS_MIXER_NONSTOP = 0x20000# don't stall when there are no sources
BASS_MIXER_RESUME = 0x1000# resume stalled immediately upon new/unpaused source

# source flags
BASS_MIXER_FILTER = 0x1000# resampling filter
BASS_MIXER_BUFFER = 0x2000# buffer data for BASS_Mixer_ChannelGetData/Level
示例#2
0
Supported tags:
---------------
  MP3 ID3v1 and ID3v2.2/3/4
  OGG/FLAC comments
  WMA
  APE, OFR, MPC, AAC - all use APE tags
  MP4
  MOD/etc titles
'''

import sys, ctypes, platform
from paths import x86_path, x64_path
import libloader
tags_module = libloader.load_library('tags',
                                     x86_path=x86_path,
                                     x64_path=x64_path)
func_type = libloader.get_functype(
)  # Current version. Just increments each release.

TAGS_VERSION = 17

# returns description of the last error.
#const char*  _stdcall TAGS_GetLastErrorDesc();
TAGS_GetLastErrorDesc = func_type(ctypes.c_char_p)(
    ('TAGS_GetLastErrorDesc', tags_module))

# main purpose of this library
#const char*  _stdcall TAGS_Read( DWORD dwHandle, const char* fmt );
TAGS_Read = func_type(ctypes.c_char_p, ctypes.c_ulong,
                      ctypes.c_char_p)(('TAGS_Read', tags_module))
示例#3
0
__version__ = '0.1'
__versionTime__ = '2009-11-15'
__author__ = 'Max Kolosov <*****@*****.**>'
__doc__ = '''
pybassmidi.py - is ctypes python module for
BASSMIDI - extension to the BASS audio library,
enabling the playing of MIDI files and real-time events,
using SF2 soundfonts to provide the sounds.
'''

import sys, ctypes, platform, os
from . import pybass
from .paths import x86_path, x64_path
import libloader

bassmidi_module = libloader.load_library('bassmidi', x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()
#Register the plugin with the Bass plugin system.
pybass.BASS_PluginLoad(libloader.find_library_path('bassmidi', x86_path=x86_path, x64_path=x64_path), 0)

HSOUNDFONT = ctypes.c_ulong

QWORD = pybass.QWORD
HSTREAM = pybass.HSTREAM
DOWNLOADPROC = pybass.DOWNLOADPROC
BASS_FILEPROCS = pybass.BASS_FILEPROCS


# Additional BASS_SetConfig options
BASS_CONFIG_MIDI_COMPACT = 0x10400
BASS_CONFIG_MIDI_VOICES = 0x10401
示例#4
0
BASSWASAPI is basically a wrapper for WASAPI drivers
BASSWASAPI requires a soundcard with WASAPI drivers. 
'''

import sys, ctypes, platform

from . import pybass
from .paths import x86_path, x64_path
import libloader

HSTREAM = pybass.HSTREAM
BASS_FILEPROCS = pybass.BASS_FILEPROCS

basswasapi_module = libloader.load_library('basswasapi',
                                           x86_path=x86_path,
                                           x64_path=x64_path)
func_type = libloader.get_functype()

# Additional error codes returned by BASS_ErrorGetCode
BASS_ERROR_WASAPI = 5000


# Device info structure
class BASS_WASAPI_DEVICEINFO(ctypes.Structure):
    _fields_ = [('name', ctypes.c_char_p), ('id', ctypes.c_char_p),
                ('type', ctypes.c_ulong), ('flags', ctypes.c_ulong),
                ('minperiod', ctypes.c_float), ('defperiod', ctypes.c_float),
                ('mixfreq', ctypes.c_ulong), ('mixchans', ctypes.c_ulong)]

示例#5
0
from __future__ import absolute_import
"BASS_FX wrapper by Christopher Toth" ""

import ctypes
import os
from . import pybass
from .paths import x86_path, x64_path
import libloader

bass_fx_module = libloader.load_library('bass_fx',
                                        x86_path=x86_path,
                                        x64_path=x64_path)
func_type = libloader.get_functype()

#Error codes returned by BASS_ErrorGetCode
BASS_ERROR_FX_NODECODE = 4000
BASS_ERROR_FX_BPMINUSE = 4001

#Tempo / Reverse / BPM / Beat flag
BASS_FX_FREESOURCE = 0x10000

#BASS_FX Version
BASS_FX_GetVersion = func_type(ctypes.c_ulong)(
    ('BASS_FX_GetVersion', bass_fx_module))
"""D S P (Digital Signal Processing)"""
"""
Multi-channel order of each channel is as follows:
	 3 channels       left-front, right-front, center.
	 4 channels       left-front, right-front, left-rear/side, right-rear/side.
	 6 channels (5.1) left-front, right-front, center, LFE, left-rear/side, right-rear/side.
	 8 channels (7.1) left-front, right-front, center, LFE, left-rear/side, right-rear/side, left-rear center, right-rear center.
示例#6
0
# -*- coding: utf-8 -*-
import application
import platform
import exceptions
from ctypes import c_char_p
from libloader import load_library
import paths
if platform.architecture()[0][:2] == "32":
    lib = load_library("api_keys32", x86_path=paths.app_path("keys/lib"))
else:
    lib = load_library("api_keys64", x64_path=paths.app_path("keys/lib"))
#	import linuxKeys
#	lib = linuxKeys

keyring = None


def setup():
    global keyring
    if keyring == None:
        keyring = Keyring()


class Keyring(object):
    def __init__(self):
        super(Keyring, self).__init__()

    def _call_method(self, function):
        result = getattr(lib, function)
        result = c_char_p(result.__call__())
        return result.value
示例#7
0
__version__ = '0.1'
__versionTime__ = '2009-11-15'
__author__ = 'Max Kolosov <*****@*****.**>'
__doc__ = '''
pybassflac.py - is ctypes python module for
BASSFLAC - extension to the BASS audio library,
enabling the playing of FLAC (Free Lossless Audio Codec) encoded files.
'''

import os, sys, ctypes
from . import pybass
from .paths import x86_path, x64_path
import libloader

bassflac_module = libloader.load_library('bassflac',
                                         x86_path=x86_path,
                                         x64_path=x64_path)
func_type = libloader.get_functype()
#Register the plugin with the Bass plugin system.
pybass.BASS_PluginLoad(
    libloader.find_library_path('bassflac',
                                x86_path=x86_path,
                                x64_path=x64_path), 0)

QWORD = pybass.QWORD
HSTREAM = pybass.HSTREAM
DOWNLOADPROC = pybass.DOWNLOADPROC
BASS_FILEPROCS = pybass.BASS_FILEPROCS

# BASS_CHANNELINFO type
BASS_CTYPE_STREAM_FLAC = 0x10900
示例#8
0
"BASSENC wrapper by Christopher Toth"""

import ctypes
import os
import platform
import pybass
from paths import x86_path, x64_path
import libloader

bassenc_module = libloader.load_library('bassenc', x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()

HENCODE = ctypes.c_ulong #encoder handle

#Additional error codes returned by BASS_ErrorGetCode
BASS_ERROR_ACM_CANCEL = 2000 #ACM codec selection cancelled
pybass.error_descriptions[BASS_ERROR_ACM_CANCEL] = "ACM codec selection cancelled"
BASS_ERROR_CAST_DENIED = 2100 #access denied (invalid password)
pybass.error_descriptions[BASS_ERROR_CAST_DENIED] = "access denied (invalid password)"

#Additional BASS_SetConfig options
BASS_CONFIG_ENCODE_PRIORITY = 0x10300
BASS_CONFIG_ENCODE_QUEUE = 0x10301
BASS_CONFIG_ENCODE_CAST_TIMEOUT = 0x10310

#Additional BASS_SetConfigPtr options
BASS_CONFIG_ENCODE_CAST_PROXY = 0x10311

#BASS_Encode_Start flags
BASS_ENCODE_NOHEAD = 1 #don't send a WAV header to the encoder
BASS_ENCODE_FP_8BIT = 2	#convert floating-point sample data to 8-bit integer
示例#9
0
"BASS_ALAC wrapper by Christopher Toth"""

import ctypes
import os
import pybass
from paths import x86_path, x64_path
import libloader

bass_fx_module = libloader.load_library('bass_alac', x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()

pybass.BASS_PluginLoad(libloader.find_library_path('bass_alac', x86_path=x86_path, x64_path=x64_path), 0)

BASS_TAG_MP4 = 7
BASS_CTYPE_STREAM_ALAC = 0x10e00


#HSTREAM BASSALACDEF(BASS_ALAC_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags);
BASS_ALAC_StreamCreateFile = func_type(pybass.HSTREAM, ctypes.c_byte, ctypes.c_void_p, pybass.QWORD, pybass.QWORD, ctypes.c_ulong)

#HSTREAM BASSALACDEF(BASS_ALAC_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user);
BASS_ALAC_StreamCreateFileUser = func_type(pybass.HSTREAM, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_void_p, ctypes.c_void_p)

示例#10
0
__version__ = '0.1'
__versionTime__ = '2009-11-15'
__author__ = 'Max Kolosov <*****@*****.**>'

import os
import sys
import ctypes
from . import pybass
from .paths import x86_path, x64_path
import libloader

bassopus_module = libloader.load_library('bassopus',
                                         x86_path=x86_path,
                                         x64_path=x64_path)
func_type = libloader.get_functype()
# Register the plugin with the Bass plugin system.
pybass.BASS_PluginLoad(
    libloader.find_library_path('bassopus',
                                x86_path=x86_path,
                                x64_path=x64_path), 0)

QWORD = pybass.QWORD
HSTREAM = pybass.HSTREAM
DOWNLOADPROC = pybass.DOWNLOADPROC
BASS_FILEPROCS = pybass.BASS_FILEPROCS

# BASS_CHANNELINFO type
BASS_CTYPE_STREAM_OPUS = 0x11200

# HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void
# *file, QWORD offset, QWORD length, DWORD flags);
示例#11
0
            msg += '  %s is required for this functionality.' % requires
        if suggestions:
            msg += '  Consider alternative(s) %s.' % ', '.join(suggestions)
        Exception.__init__(self, msg)

def missing_function(name, requires=None, suggestions=None):
    def MissingFunction(*args, **kwargs):
        raise MissingFunctionException(name, requires, suggestions)
    return MissingFunction

#from pyglet.compat import asbytes
asbytes = str

__all__ = ['link_GL', 'link_GLU', 'link_GLX']

gl_lib = libloader.load_library('GL')
glu_lib = libloader.load_library('GLU')

# Look for glXGetProcAddressARB extension, use it as fallback (for
# ATI fglrx and DRI drivers).
try:
    glXGetProcAddressARB = getattr(gl_lib, 'glXGetProcAddressARB')
    glXGetProcAddressARB.restype = POINTER(CFUNCTYPE(None))
    glXGetProcAddressARB.argtypes = [POINTER(c_ubyte)]
    _have_getprocaddress = True
except AttributeError:
    _have_getprocaddress = False
    
def link_GL(name, restype, argtypes, requires=None, suggestions=None):
    try:
        func = getattr(gl_lib, name)
示例#12
0
Windows Media player, so will already be on most users' systems, but they
can also be installed separately (WMFDIST.EXE is available from the BASS website).
'''

import os, sys, ctypes, pybass
from paths import x86_path, x64_path
import libloader

QWORD = pybass.QWORD
HSTREAM = pybass.HSTREAM
BASS_FILEPROCS = pybass.BASS_FILEPROCS

HWMENCODE = ctypes.c_ulong  # WMA encoding handle

basswma_module = libloader.load_library('basswma',
                                        x86_path=x86_path,
                                        x64_path=x64_path)
func_type = libloader.get_functype()
#Register the plugin with the Bass plugin system.
pybass.BASS_PluginLoad(
    libloader.find_library_path('basswma',
                                x86_path=x86_path,
                                x64_path=x64_path), 0)

# Additional error codes returned by BASS_ErrorGetCode
BASS_ERROR_WMA_LICENSE = 1000  # the file is protected
BASS_ERROR_WMA = 1001  # Windows Media (9 or above) is not installed
BASS_ERROR_WMA_WM9 = BASS_ERROR_WMA
BASS_ERROR_WMA_DENIED = 1002  # access denied (user/pass is invalid)
BASS_ERROR_WMA_INDIVIDUAL = 1004  # individualization is needed
BASS_ERROR_WMA_PUBINIT = 1005  # publishing point initialization problem
示例#13
0
# BSD license

__version__ = '0.1'
__versionTime__ = '2009-11-15'
__author__ = 'Max Kolosov <*****@*****.**>'
__doc__ = '''
pybassflac.py - is ctypes python module for
BASSFLAC - extension to the BASS audio library,
enabling the playing of FLAC (Free Lossless Audio Codec) encoded files.
'''

import os, sys, ctypes, pybass
from paths import x86_path, x64_path
import libloader

bassopus_module = libloader.load_library('bassopus', x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()
#Register the plugin with the Bass plugin system.
pybass.BASS_PluginLoad(libloader.find_library_path('bassopus', x86_path=x86_path, x64_path=x64_path), 0)

QWORD = pybass.QWORD
HSTREAM = pybass.HSTREAM
DOWNLOADPROC = pybass.DOWNLOADPROC
BASS_FILEPROCS = pybass.BASS_FILEPROCS

# BASS_CHANNELINFO type
BASS_CTYPE_STREAM_OPUS = 0x11200


#HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags);
BASS_OPUS_StreamCreateFile = func_type(HSTREAM, ctypes.c_byte, ctypes.c_void_p, QWORD, QWORD, ctypes.c_ulong)(('BASS_OPUS_StreamCreateFile', bassopus_module))
示例#14
0
string (including conditional processing).

Supported tags:
---------------
  MP3 ID3v1 and ID3v2.2/3/4
  OGG/FLAC comments
  WMA
  APE, OFR, MPC, AAC - all use APE tags
  MP4
  MOD/etc titles
'''

import sys, ctypes, platform
from paths import x86_path, x64_path
import libloader
tags_module = libloader.load_library('tags', x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()# Current version. Just increments each release.

TAGS_VERSION = 17

# returns description of the last error.
#const char*  _stdcall TAGS_GetLastErrorDesc();
TAGS_GetLastErrorDesc = func_type(ctypes.c_char_p)(('TAGS_GetLastErrorDesc', tags_module))

# main purpose of this library
#const char*  _stdcall TAGS_Read( DWORD dwHandle, const char* fmt );
TAGS_Read = func_type(ctypes.c_char_p, ctypes.c_ulong, ctypes.c_char_p)(('TAGS_Read', tags_module))

# retrieves the current version
#DWORD _stdcall TAGS_GetVersion();
TAGS_GetVersion = func_type(ctypes.c_ulong)(('TAGS_GetVersion', tags_module))
示例#15
0
can also be installed separately (WMFDIST.EXE is available from the BASS website).
"""

import os, sys, ctypes
from sound_lib.external import pybass

from .paths import x86_path, x64_path
import libloader

QWORD = pybass.QWORD
HSTREAM = pybass.HSTREAM
BASS_FILEPROCS = pybass.BASS_FILEPROCS

HWMENCODE = ctypes.c_ulong  # WMA encoding handle

basswma_module = libloader.load_library("basswma", x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()
# Register the plugin with the Bass plugin system.
pybass.BASS_PluginLoad(libloader.find_library_path("basswma", x86_path=x86_path, x64_path=x64_path), 0)


# Additional error codes returned by BASS_ErrorGetCode
BASS_ERROR_WMA_LICENSE = 1000  # the file is protected
BASS_ERROR_WMA = 1001  # Windows Media (9 or above) is not installed
BASS_ERROR_WMA_WM9 = BASS_ERROR_WMA
BASS_ERROR_WMA_DENIED = 1002  # access denied (user/pass is invalid)
BASS_ERROR_WMA_INDIVIDUAL = 1004  # individualization is needed
BASS_ERROR_WMA_PUBINIT = 1005  # publishing point initialization problem

# Additional BASS_SetConfig options
BASS_CONFIG_WMA_PRECHECK = 0x10100
示例#16
0
# -*- coding: utf-8 -*-
import application
import platform
import exceptions
from ctypes import c_char_p
from libloader import load_library
import paths
if platform.architecture()[0][:2] == "32":
	lib = load_library("api_keys32", x86_path=paths.app_path("keys/lib"))
else:
	lib = load_library("api_keys64", x64_path=paths.app_path("keys/lib"))
#	import linuxKeys
#	lib = linuxKeys

keyring = None

def setup():
	global keyring
	if keyring == None:
		keyring = Keyring()

class Keyring(object):
	def __init__(self):
		super(Keyring, self).__init__()

	def _call_method(self, function):
		result = getattr(lib, function)
		result = c_char_p(result.__call__())
		return result.value

	def get(self, func):