Merge pull request #152 from manuelcortez/revert-140-i140

Revert "update sound_lib"
This commit is contained in:
José Manuel 2017-07-19 15:27:22 +02:00 committed by GitHub
commit 44187c69de
72 changed files with 3520 additions and 3741 deletions

View File

@ -136,7 +136,7 @@ class Session(object):
def init_sound(self):
try: self.sound = sound.soundSystem(self.settings["sound"])
except: log.exception("Exception thrown during sound system initialization")
except: pass
@_require_configuration
def login(self, verify_credentials=True):

View File

@ -6,11 +6,7 @@ import os
import logging as original_logger
log = original_logger.getLogger("sound")
import paths
from sound_lib.output import Output
from sound_lib.input import Input
from sound_lib.recording import WaveRecording
from sound_lib.stream import FileStream
from sound_lib.stream import URLStream as SoundlibURLStream
import sound_lib
import subprocess
import platform
import output
@ -34,7 +30,7 @@ def recode_audio(filename, quality=4.5):
def recording(filename):
# try:
val = WaveRecording(filename=filename)
val = sound_lib.recording.WaveRecording(filename=filename)
# except sound_lib.main.BassError:
# sound_lib.input.Input()
# val = sound_lib.recording.WaveRecording(filename=filename)
@ -61,9 +57,9 @@ class soundSystem(object):
self.config = soundConfig
# Set the output and input default devices.
try:
self.output = Output()
self.input = Input()
except IOError:
self.output = sound_lib.output.Output()
self.input = sound_lib.input.Input()
except:
pass
# Try to use the selected device from the configuration. It can fail if the machine does not has a mic.
try:
@ -71,7 +67,7 @@ class soundSystem(object):
self.output.set_device(self.output.find_device_by_name(self.config["output_device"]))
self.input.set_device(self.input.find_device_by_name(self.config["input_device"]))
except:
log.exception("Error in input or output devices, using defaults...")
log.error("Error in input or output devices, using defaults...")
self.config["output_device"] = "Default"
self.config["input_device"] = "Default"
@ -93,7 +89,7 @@ class soundSystem(object):
def play(self, sound, argument=False):
if self.soundpack_OK == False: return
if self.config["session_mute"] == True: return
sound_object = FileStream(file="%s/%s" % (self.path, sound))
sound_object = sound_lib.stream.FileStream(file="%s/%s" % (self.path, sound))
sound_object.volume = float(self.config["volume"])
self.files.append(sound_object)
sound_object.play()
@ -144,7 +140,7 @@ class URLStream(object):
elif stream != None:
self.stream=stream
if self.prepared == True:
self.stream = SoundlibURLStream(url=self.url)
self.stream = sound_lib.stream.URLStream(url=self.url)
if hasattr(self,'stream'):
self.stream.volume = float(volume)
self.stream.play()

View File

@ -1,6 +1,7 @@
import output, input, recording, stream
__author__ = 'Christopher Toth'
__version__ = 0.8
__version__ = 0.73
def find_datafiles():
from glob import glob

View File

@ -73,7 +73,7 @@ class Channel (FlagObject):
__len__ = get_length
def __nonzero__(self):
def __bool__(self):
return True
def get_device(self):

View File

@ -50,7 +50,7 @@ class BassConfig(collections.Mapping):
return bass_call(pybass.BASS_SetConfig, key, val)
def __iter__(self):
for key in self.config_map.iterkeys():
for key in self.config_map.keys():
yield key
def __len__(self):

View File

@ -1,2 +1 @@
from __future__ import absolute_import
from .tempo import Tempo

View File

@ -1,5 +1,6 @@
from __future__ import absolute_import
from sound_lib.external import pybass_fx
from effect import SoundEffect
from .effect import SoundEffect
class Volume(SoundEffect):
effect_type = pybass_fx.BASS_FX_BFX_VOLUME

View File

@ -1,3 +1,4 @@
from future.builtins import object
from sound_lib.main import bass_call
import ctypes
from sound_lib.external import pybass

View File

@ -1,9 +1,8 @@
from __future__ import absolute_import
import ctypes
from ..external import pybass, pybass_fx
from ..stream import BaseStream
from ..channel import Channel
from ..main import bass_call, bass_call_0
from sound_lib.external import pybass, pybass_fx
from sound_lib.stream import BaseStream
from sound_lib.channel import Channel
from sound_lib.main import bass_call, bass_call_0
class Tempo(BaseStream):

View File

@ -1,5 +1,6 @@
from external import pybass, pybassenc
from main import bass_call, bass_call_0, FlagObject
from __future__ import absolute_import
from .external import pybass, pybassenc
from .main import bass_call, bass_call_0, FlagObject
class Encoder(FlagObject):

View File

@ -1,10 +1,9 @@
from __future__ import absolute_import
import platform
from . import pybassopus
if platform.system() == 'Windows':
from . import pybasswma
#if platform.system() == 'Windows':
# import sound_lib.external.pybasswma
if platform.system() != 'Darwin':
from . import pybass_aac
from . import pybass_alac
from . import pybassflac
from . import pybassmidi
import sound_lib.external.pybass_aac
import sound_lib.external.pybass_alac
import sound_lib.external.pybassopus
import sound_lib.external.pybassflac
import sound_lib.external.pybassmidi

View File

@ -1,3 +1,7 @@
from __future__ import division
from __future__ import absolute_import
from future.builtins import str
from future.builtins import range
# copyright(c) Max Kolosov 2009 maxkolosov@inbox.ru
# http://vosolok2008.narod.ru
# BSD license
@ -519,7 +523,7 @@ BASS_STREAMPROC_END = (-2147483648)# end of user stream flag
# special STREAMPROCs
def streamproc_dummy(handle, buffer, length, user): return 0
streamproc_push = -1
def streamproc_push(handle, buffer, length, user): return -1
STREAMPROC_DUMMY = STREAMPROC(streamproc_dummy)# "dummy" stream
STREAMPROC_PUSH = STREAMPROC(streamproc_push)# push stream
@ -883,13 +887,9 @@ BASS_SetVolume = func_type(ctypes.c_byte, ctypes.c_float)(('BASS_SetVolume', bas
BASS_GetVolume = func_type(ctypes.c_float)(('BASS_GetVolume', bass_module))
#HPLUGIN BASSDEF(BASS_PluginLoad)(const char *file, DWORD flags);
_BASS_PluginLoad = func_type(HPLUGIN, ctypes.c_char_p, ctypes.c_ulong)(('BASS_PluginLoad', bass_module))
def BASS_PluginLoad(file, flags):
if type(file) != bytes:
file = file.encode(sys.getfilesystemencoding())
return _BASS_PluginLoad(file, flags)
BASS_PluginLoad_ = func_type(HPLUGIN, ctypes.c_char_p, ctypes.c_ulong)(('BASS_PluginLoad', bass_module))
def BASS_PluginLoad(path, flags):
return BASS_PluginLoad_(path.encode(sys.getfilesystemencoding()), flags)
#BOOL BASSDEF(BASS_PluginFree)(HPLUGIN handle);
BASS_PluginFree = func_type(ctypes.c_byte, HPLUGIN)(('BASS_PluginFree', bass_module))
#const BASS_PLUGININFO *BASSDEF(BASS_PluginGetInfo)(HPLUGIN handle);

View File

@ -51,3 +51,4 @@ BASS_AAC_StreamCreateFileUser = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_ulon
BASS_MP4_StreamCreateFile = func_type(HSTREAM, ctypes.c_byte, ctypes.c_void_p, QWORD, QWORD, ctypes.c_ulong)(('BASS_MP4_StreamCreateFile', bass_aac_module))
#HSTREAM BASSAACDEF(BASS_MP4_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user);
BASS_MP4_StreamCreateFileUser = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_ulong, ctypes.POINTER(BASS_FILEPROCS), ctypes.c_void_p)(('BASS_MP4_StreamCreateFileUser', bass_aac_module))

View File

@ -1,4 +1,5 @@
from __future__ import absolute_import
from future.builtins import range
"BASS_FX wrapper by Christopher Toth"""
import ctypes

View File

@ -1,10 +1,12 @@
from __future__ import absolute_import
from future.builtins import range
"BASSENC wrapper by Christopher Toth"""
import ctypes
import os
import platform
import pybass
from paths import x86_path, x64_path
from . 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)

View File

@ -202,4 +202,3 @@ BASS_MIDI_FontUnpack = func_type(ctypes.c_byte, HSOUNDFONT, ctypes.c_void_p, cty
BASS_MIDI_FontSetVolume = func_type(ctypes.c_byte, HSOUNDFONT, ctypes.c_float)(('BASS_MIDI_FontSetVolume', bassmidi_module))
#float BASSMIDIDEF(BASS_MIDI_FontGetVolume)(HSOUNDFONT handle);
BASS_MIDI_FontGetVolume = func_type(ctypes.c_float, HSOUNDFONT)(('BASS_MIDI_FontGetVolume', bassmidi_module))

View File

@ -1,3 +1,4 @@
from __future__ import absolute_import
# Copyright(c) Max Kolosov 2009 maxkolosov@inbox.ru
# http://vosolok2008.narod.ru
# BSD license
@ -13,7 +14,8 @@ features. It also provides the ability to go the other way and split a
BASS channel into multiple channels.
'''
import os, sys, ctypes, platform, pybass
import os, sys, ctypes, platform
from . import pybass
QWORD = pybass.QWORD
HSYNC = pybass.HSYNC
@ -22,7 +24,7 @@ DOWNLOADPROC = pybass.DOWNLOADPROC
SYNCPROC = pybass.SYNCPROC
BASS_FILEPROCS = pybass.BASS_FILEPROCS
from paths import x86_path, x64_path
from .paths import x86_path, x64_path
import libloader
bassmix_module = libloader.load_library('bassmix', x86_path=x86_path, x64_path=x64_path)

View File

@ -1,11 +1,18 @@
# Copyright(c) Max Kolosov 2009 maxkolosov@inbox.ru
# http://vosolok2008.narod.ru
# BSD license
__version__ = '0.1'
__versionTime__ = '2009-11-15'
__author__ = 'Max Kolosov <maxkolosov@inbox.ru>'
__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 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)
@ -29,3 +36,12 @@ BASS_OPUS_StreamCreateURL = func_type(HSTREAM, ctypes.c_char_p, ctypes.c_ulong,
#HSTREAM BASSFLACDEF(BASS_FLAC_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user);
BASS_OPUS_StreamCreateFileUser = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_ulong, ctypes.POINTER(BASS_FILEPROCS), ctypes.c_void_p)(('BASS_OPUS_StreamCreateFileUser', bassopus_module))
if __name__ == "__main__":
if not pybass.BASS_Init(-1, 44100, 0, 0, 0):
print 'BASS_Init error', pybass.get_error_description(pybass.BASS_ErrorGetCode())
else:
handle = BASS_OPUS_StreamCreateFile(False, 'test.opus', 0, 0, 0)
pybass.play_handle(handle)
if not pybass.BASS_Free():
print 'BASS_Free error', pybass.get_error_description(pybass.BASS_ErrorGetCode())

View File

@ -1,154 +0,0 @@
# Copyright(c) Andrew Evans 2013
# BSD license
__version__ = '0.1'
__versionTime__ = '2013-03-28'
__author__ = 'Andrew Evans <themindflows@gmail.com>'
__doc__ = '''
pybasswasapi.py - is ctypes python module for WASAPI (http://www.un4seen.com).
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)
]
class BASS_WASAPI_INFO(ctypes.Structure):
_fields_ = [
('initflag', ctypes.c_ulong),
('freq', ctypes.c_ulong),
('chans', ctypes.c_ulong),
('format', ctypes.c_ulong),
('buflen', ctypes.c_ulong),
('volmax', ctypes.c_float),
('volmin', ctypes.c_float),
('volstep', ctypes.c_float)
]
# BASS_WASAPI_DEVICEINFO "type"
BASS_WASAPI_TYPE_NETWORKDEVICE = 0
BASS_WASAPI_TYPE_SPEAKERS = 1
BASS_WASAPI_TYPE_LINELEVEL = 2
BASS_WASAPI_TYPE_HEADPHONES = 3
BASS_WASAPI_TYPE_MICROPHONE = 4
BASS_WASAPI_TYPE_HEADSET = 5
BASS_WASAPI_TYPE_HANDSET = 6
BASS_WASAPI_TYPE_DIGITAL = 7
BASS_WASAPI_TYPE_SPDIF = 8
BASS_WASAPI_TYPE_HDMI = 9
BASS_WASAPI_TYPE_UNKNOWN = 10
# BASS_WASAPI_DEVICEINFO flags
BASS_DEVICE_ENABLED = 1
BASS_DEVICE_DEFAULT = 2
BASS_DEVICE_INIT = 4
BASS_DEVICE_LOOPBACK = 8
BASS_DEVICE_INPUT = 16
BASS_DEVICE_UNPLUGGED = 32
BASS_DEVICE_DISABLED = 64
# BASS_WASAPI_Init flags
BASS_WASAPI_EXCLUSIVE = 1
BASS_WASAPI_AUTOFORMAT = 2
BASS_WASAPI_BUFFER = 4
BASS_WASAPI_SESSIONVOL = 8
BASS_WASAPI_EVENT = 16
# BASS_WASAPI_INFO "format"
BASS_WASAPI_FORMAT_FLOAT = 0
BASS_WASAPI_FORMAT_8BIT = 1
BASS_WASAPI_FORMAT_16BIT = 2
BASS_WASAPI_FORMAT_24BIT = 3
BASS_WASAPI_FORMAT_32BIT = 4
# BASS_WASAPI_Set/GetVolume "curve"
BASS_WASAPI_CURVE_DB = 0
BASS_WASAPI_CURVE_LINEAR = 1
BASS_WASAPI_CURVE_WINDOWS = 2
#typedef DWORD (CALLBACK WASAPIPROC)(void *buffer, DWORD length, void *user);
WASAPIPROC = func_type(ctypes.c_ulong, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_void_p)
#typedef void (CALLBACK WASAPINOTIFYPROC)(DWORD notify, DWORD device, void *user);
WASAPINOTIFYPROC = func_type(ctypes.c_ulong, ctypes.c_ulong, ctypes.c_void_p)
# Device notifications
BASS_WASAPI_NOTIFY_ENABLED = 0
BASS_WASAPI_NOTIFY_DISABLED = 1
BASS_WASAPI_NOTIFY_DEFOUTPUT = 2
BASS_WASAPI_NOTIFY_DEFINPUT = 3
# DWORD BASSWASAPIDEF(BASS_WASAPI_GetVersion)();
BASS_WASAPI_GetVersion = func_type(HSTREAM)(('BASS_WASAPI_GetVersion', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_SetNotify)(WASAPINOTIFYPROC *proc, void *user);
BASS_WASAPI_SetNotify = func_type(HSTREAM, ctypes.POINTER(WASAPINOTIFYPROC), ctypes.c_void_p)(('BASS_WASAPI_SetNotify', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_GetDeviceInfo)(DWORD device, BASS_WASAPI_DEVICEINFO *info);
BASS_WASAPI_GetDeviceInfo = func_type(HSTREAM, ctypes.c_ulong, ctypes.POINTER(BASS_WASAPI_DEVICEINFO))(('BASS_WASAPI_GetDeviceInfo', basswasapi_module))
# float BASSDEF(BASS_WASAPI_GetDeviceLevel)(DWORD device, int chan);
BASS_WASAPI_GetDeviceLevel = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_int)(('BASS_WASAPI_GetDeviceLevel', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_SetDevice)(DWORD device);
BASS_WASAPI_SetDevice = func_type(HSTREAM, ctypes.c_ulong)(('BASS_WASAPI_SetDevice', basswasapi_module))
# DWORD BASSWASAPIDEF(BASS_WASAPI_GetDevice)();
BASS_WASAPI_GetDevice = func_type(HSTREAM)(('BASS_WASAPI_GetDevice', basswasapi_module))
# DWORD BASSWASAPIDEF(BASS_WASAPI_CheckFormat)(DWORD device, DWORD freq, DWORD chans, DWORD flags);
BASS_WASAPI_CheckFormat = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong)(('BASS_WASAPI_CheckFormat', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_Init)(int device, DWORD freq, DWORD chans, DWORD flags, float buffer, float period, WASAPIPROC *proc, void *user);
BASS_WASAPI_Init = func_type(HSTREAM, ctypes.c_int, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_float, ctypes.c_float, WASAPIPROC, ctypes.c_void_p)(('BASS_WASAPI_Init', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_Free)();
BASS_WASAPI_Free = func_type(HSTREAM)(('BASS_WASAPI_Free', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_GetInfo)(BASS_WASAPI_INFO *info);
BASS_WASAPI_GetInfo = func_type(HSTREAM, ctypes.POINTER(BASS_WASAPI_INFO))(('BASS_WASAPI_GetInfo', basswasapi_module))
# float BASSWASAPIDEF(BASS_WASAPI_GetCPU)();
BASS_WASAPI_GetCPU = func_type(HSTREAM)(('BASS_WASAPI_GetCPU', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_Lock)(BOOL lock);
BASS_WASAPI_Lock = func_type(HSTREAM, ctypes.c_bool)(('BASS_WASAPI_Lock', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_Start)();
BASS_WASAPI_Start = func_type(HSTREAM)(('BASS_WASAPI_Start', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_Stop)(BOOL reset);
BASS_WASAPI_Stop = func_type(ctypes.c_bool, ctypes.c_bool)(('BASS_WASAPI_Stop', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_IsStarted)();
BASS_WASAPI_IsStarted = func_type(HSTREAM)(('BASS_WASAPI_IsStarted', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_SetVolume)(DWORD curve, float volume);
BASS_WASAPI_SetVolume = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_float)(('BASS_WASAPI_SetVolume', basswasapi_module))
# float BASSWASAPIDEF(BASS_WASAPI_GetVolume)(DWORD curve);
BASS_WASAPI_GetVolume = func_type(HSTREAM, ctypes.c_ulong)(('BASS_WASAPI_GetVolume', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_SetMute)(BOOL mute);
BASS_WASAPI_SetMute = func_type(HSTREAM, ctypes.c_bool)(('BASS_WASAPI_SetMute', basswasapi_module))
# BOOL BASSWASAPIDEF(BASS_WASAPI_GetMute)();
BASS_WASAPI_GetMute = func_type(HSTREAM)(('BASS_WASAPI_GetMute', basswasapi_module))
# DWORD BASSWASAPIDEF(BASS_WASAPI_PutData)(void *buffer, DWORD length);
BASS_WASAPI_PutData = func_type(HSTREAM, ctypes.c_void_p, ctypes.c_ulong)(('BASS_WASAPI_PutData', basswasapi_module))
# DWORD BASSDEF(BASS_WASAPI_GetData)(void *buffer, DWORD length);
BASS_WASAPI_GetData = func_type(HSTREAM, ctypes.c_void_p, ctypes.c_ulong)(('BASS_WASAPI_GetData', basswasapi_module))
# DWORD BASSDEF(BASS_WASAPI_GetLevel)();
BASS_WASAPI_GetLevel = func_type(HSTREAM)(('BASS_WASAPI_GetLevel', basswasapi_module))

View File

@ -21,9 +21,9 @@ 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
from . import pybass
from sound_lib.external import pybass
from .paths import x86_path, x64_path
import libloader
@ -146,4 +146,3 @@ BASS_WMA_EncodeClose = func_type(ctypes.c_byte, HWMENCODE)(('BASS_WMA_EncodeClos
#void *BASSWMADEF(BASS_WMA_GetWMObject)(DWORD handle);
BASS_WMA_GetWMObject = func_type(ctypes.c_void_p, ctypes.c_ulong)(('BASS_WMA_GetWMObject', basswma_module))

View File

@ -1,47 +0,0 @@
# Copyright(c) Max Kolosov 2009 maxkolosov@inbox.ru
# http://vosolok2008.narod.ru
# BSD license
__version__ = '0.1'
__versionTime__ = '2009-11-10'
__author__ = 'Max Kolosov <maxkolosov@inbox.ru>'
__doc__ = '''
pytags.py - is ctypes python module for
TAGS (Another Tags Reading Library written by Wraith).
BASS audio library has limited support for reading tags, associated with a
stream. This library extends that functionality, allowing developer/user to
extract specific song information from the stream handle used with BASS. The
extracted tag values are formatted into text ouput according to given format
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))

View File

@ -1,17 +1,19 @@
from __future__ import absolute_import
from future.builtins import object
from ctypes import string_at
import platform
import wave
from .external.pybass import *
if platform.system() == 'Windows':
from .external.pybasswasapi import *
from . import config
from .main import bass_call, bass_call_0
from .main import bass_call, bass_call_0, BassError
class Input (object):
def __init__ (self, device=-1):
try:
bass_call(BASS_RecordInit, device)
except BassError:
pass
self._device = device
self.config = config.BassConfig()
@ -46,8 +48,6 @@ class Input (object):
retrieved = info.name
if platform.system() == 'Windows':
retrieved = retrieved.decode('mbcs')
elif platform.system() == 'Darwin':
retrieved = retrieved.decode('utf-8')
retrieved = retrieved.replace('(', '').replace(')', '').strip()
result.append(retrieved)
count += 1
@ -64,31 +64,3 @@ class Input (object):
return self.find_device_by_name(device_name)
except ValueError:
return self.find_default_device()
class WASAPIInput(object):
def __init__(self, device=-2, frequency=0, channels=0, flags=0, buffer=0.0, period=0.0, callback=None):
if callback is None:
callback = lambda buffer, length, user: True
self.proc = WASAPIPROC(callback)
bass_call(BASS_WASAPI_Init, device, frequency, channels, flags, buffer, period, self.proc, None)
def free(self):
bass_call(BASS_WASAPI_Free)
def set_device(self, device):
bass_call(BASS_WASAPI_SetDevice, device)
def get_device(self):
return bass_call_0(BASS_WASAPI_GetDevice)
device = property(fget=get_device, fset=set_device)
def start(self):
return bass_call(BASS_WASAPI_Start)
def stop(self, reset=False):
return bass_call(BASS_WASAPI_Stop, reset)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from future.builtins import object
from ctypes import pointer
from functools import partial
from main import bass_call, update_3d_system
from external.pybass import *
from .main import bass_call, update_3d_system
from .external.pybass import *
def _getter(base_prop, attr, obj):
return getattr(getattr(obj, base_prop), attr)

View File

@ -1,4 +1,5 @@
from __future__ import absolute_import
from future.builtins import object
from .external.pybass import *
from functools import update_wrapper

View File

@ -1,17 +1,18 @@
from external import pybass
from channel import Channel
from __future__ import absolute_import
from .external import pybass
from .channel import Channel
class Music(Channel):
def __init__(self, mem=False, file=None, offset=0, length=0, flags=0, freq=0):
handle = BASS_MusicLoad(mem, file, offset, length, flags, freq)
handle = pybass.BASS_MusicLoad(mem, file, offset, length, flags, freq)
super(Music, self).__init__(handle)
self.add_attributes_to_mapping(
music_amplify=pybass.BASS_ATTRIB_MUSIC_AMPLIFY,
music_bpm = BASS_ATTRIB_MUSIC_BPM,
music_pansep=BASS_ATTRIB_MUSIC_PANSEP,
music_speed=BASS_ATTRIB_MUSIC_SPEED,
music_vol_chan=BASS_ATTRIB_MUSIC_VOL_CHAN,
music_vol_global=BASS_ATTRIB_MUSIC_VOL_GLOBAL,
music_vol_inst=BASS_ATTRIB_MUSIC_VOL_INST,
music_bpm = pybass.BASS_ATTRIB_MUSIC_BPM,
music_pansep=pybass.BASS_ATTRIB_MUSIC_PANSEP,
music_speed=pybass.BASS_ATTRIB_MUSIC_SPEED,
music_vol_chan=pybass.BASS_ATTRIB_MUSIC_VOL_CHAN,
music_vol_global=pybass.BASS_ATTRIB_MUSIC_VOL_GLOBAL,
music_vol_inst=pybass.BASS_ATTRIB_MUSIC_VOL_INST,
)

View File

@ -1,8 +1,10 @@
from __future__ import division
from __future__ import absolute_import
from future.builtins import object
from functools import partial
import platform
from ctypes import c_char_p, c_float, pointer, string_at
from .external.pybass import *
from sound_lib.external.pybass import *
from . import config
from .main import bass_call, bass_call_0, EAX_ENVIRONMENTS, update_3d_system
@ -109,8 +111,6 @@ class Output (object):
retrieved = info.name
if platform.system() == 'Windows':
retrieved = retrieved.decode('mbcs')
elif platform.system() == 'Darwin':
retrieved = retrieved.decode('utf-8')
retrieved = retrieved.replace('(', '').replace(')', '').strip()
result.append(retrieved)
count += 1
@ -168,7 +168,7 @@ class ThreeDOutput(Output):
arg = -1
return arg
environment = convert_arg(environment)
if isinstance(environment, basestring) and environment in EAX_ENVIRONMENTS:
if isinstance(environment, str) and environment in EAX_ENVIRONMENTS:
environment = EAX_ENVIRONMENTS[environment]
volume = convert_arg(volume)
decay = convert_arg(decay)

View File

@ -4,9 +4,7 @@ import sys
from .channel import Channel
from .main import bass_call, bass_call_0
from .external.pybass import *
try:
convert_to_unicode = unicode
except NameError:
convert_to_unicode = str
class BaseStream(Channel):
@ -34,7 +32,7 @@ class FileStream(BaseStream):
def __init__(self, mem=False, file=None, offset=0, length=0, flags=0, three_d=False, mono=False, autofree=False, decode=False, unicode=True):
"""Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file."""
if platform.system() == 'Darwin':
if platform.system() == 'Darwin' or platform.system() == "Linux":
unicode = False
file = file.encode(sys.getfilesystemencoding())
self.setup_flag_mapping()
@ -61,14 +59,3 @@ class URLStream(BaseStream):
flags = flags | self.flags_for(three_d=three_d, autofree=autofree, decode=decode)
handle = bass_call(BASS_StreamCreateURL, url, offset, flags, self.downloadproc, user)
super(URLStream, self).__init__(handle)
class PushStream(BaseStream):
def __init__(self, freq=44100, chans=2, flags=0, user=None, three_d=False, autofree=False, decode=False):
self.proc = STREAMPROC_PUSH
self.setup_flag_mapping()
flags = flags | self.flags_for(three_d=three_d, autofree=autofree, decode=decode)
handle = bass_call(BASS_StreamCreate, freq, chans, flags, self.proc, user)
super(PushStream, self).__init__(handle)
def push(self, data):
return bass_call_0(BASS_StreamPutData, self.handle, data, len(data))