diff --git a/src/sound_lib/external/__init__.py b/src/sound_lib/external/__init__.py index 69f5de51..d7b031be 100644 --- a/src/sound_lib/external/__init__.py +++ b/src/sound_lib/external/__init__.py @@ -4,5 +4,6 @@ import platform if platform.system() != 'Darwin': 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 diff --git a/src/sound_lib/external/pybassopus.py b/src/sound_lib/external/pybassopus.py new file mode 100644 index 00000000..093712d5 --- /dev/null +++ b/src/sound_lib/external/pybassopus.py @@ -0,0 +1,47 @@ +# Copyright(c) Max Kolosov 2009 maxkolosov@inbox.ru +# http://vosolok2008.narod.ru +# 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)) +#HSTREAM BASSFLACDEF(BASS_FLAC_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); +BASS_OPUS_StreamCreateURL = func_type(HSTREAM, ctypes.c_char_p, ctypes.c_ulong, ctypes.c_ulong, DOWNLOADPROC, ctypes.c_void_p)(('BASS_OPUS_StreamCreateURL', bassopus_module)) +#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()) diff --git a/src/sound_lib/lib/x64/bassopus.dll b/src/sound_lib/lib/x64/bassopus.dll new file mode 100644 index 00000000..cd842695 Binary files /dev/null and b/src/sound_lib/lib/x64/bassopus.dll differ diff --git a/src/sound_lib/lib/x64/libbassopus.dylib b/src/sound_lib/lib/x64/libbassopus.dylib new file mode 100644 index 00000000..d076f215 Binary files /dev/null and b/src/sound_lib/lib/x64/libbassopus.dylib differ diff --git a/src/sound_lib/lib/x64/libbassopus.so b/src/sound_lib/lib/x64/libbassopus.so new file mode 100644 index 00000000..3920b187 Binary files /dev/null and b/src/sound_lib/lib/x64/libbassopus.so differ diff --git a/src/sound_lib/lib/x86/bassopus.dll b/src/sound_lib/lib/x86/bassopus.dll new file mode 100644 index 00000000..b8f1a094 Binary files /dev/null and b/src/sound_lib/lib/x86/bassopus.dll differ diff --git a/src/sound_lib/lib/x86/libbassopus.dylib b/src/sound_lib/lib/x86/libbassopus.dylib new file mode 100644 index 00000000..d076f215 Binary files /dev/null and b/src/sound_lib/lib/x86/libbassopus.dylib differ diff --git a/src/sound_lib/lib/x86/libbassopus.so b/src/sound_lib/lib/x86/libbassopus.so new file mode 100644 index 00000000..93c8a52f Binary files /dev/null and b/src/sound_lib/lib/x86/libbassopus.so differ