mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Opus support for TWBlue. Code by @masonasons
This commit is contained in:
parent
56b64e5c6d
commit
071d75926b
1
src/sound_lib/external/__init__.py
vendored
1
src/sound_lib/external/__init__.py
vendored
@ -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
|
||||
|
47
src/sound_lib/external/pybassopus.py
vendored
Normal file
47
src/sound_lib/external/pybassopus.py
vendored
Normal file
@ -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 <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, 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())
|
BIN
src/sound_lib/lib/x64/bassopus.dll
Normal file
BIN
src/sound_lib/lib/x64/bassopus.dll
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x64/libbassopus.dylib
Normal file
BIN
src/sound_lib/lib/x64/libbassopus.dylib
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x64/libbassopus.so
Normal file
BIN
src/sound_lib/lib/x64/libbassopus.so
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x86/bassopus.dll
Normal file
BIN
src/sound_lib/lib/x86/bassopus.dll
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x86/libbassopus.dylib
Normal file
BIN
src/sound_lib/lib/x86/libbassopus.dylib
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x86/libbassopus.so
Normal file
BIN
src/sound_lib/lib/x86/libbassopus.so
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user