from __future__ import absolute_import from future.builtins import range "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. """ #DSP channels flags BASS_BFX_CHANALL = -1 #all channels at once (as by default) BASS_BFX_CHANNONE = 0 #disable an effect for all channels BASS_BFX_CHAN1 = 1 #left-front channel BASS_BFX_CHAN2 = 2 #right-front channel BASS_BFX_CHAN3 = 4 #see above info BASS_BFX_CHAN4 = 8 #see above info BASS_BFX_CHAN5 = 16 BASS_BFX_CHAN6 = 32 BASS_BFX_CHAN7 = 64 BASS_BFX_CHAN8 = 128 #DSP effects ( BASS_FX_BFX_ROTATE, BASS_FX_BFX_ECHO, BASS_FX_BFX_FLANGER, BASS_FX_BFX_VOLUME, BASS_FX_BFX_PEAKEQ, BASS_FX_BFX_REVERB, BASS_FX_BFX_LPF, BASS_FX_BFX_MIX, BASS_FX_BFX_DAMP, BASS_FX_BFX_AUTOWAH, BASS_FX_BFX_ECHO2, BASS_FX_BFX_PHASER, BASS_FX_BFX_ECHO3, BASS_FX_BFX_CHORUS, BASS_FX_BFX_APF, BASS_FX_BFX_COMPRESSOR, BASS_FX_BFX_DISTORTION, BASS_FX_BFX_COMPRESSOR2, BASS_FX_BFX_VOLUME_ENV, BASS_FX_BFX_BQF, ) = range(0x10000, 0x10000+20) #BiQuad filters ( BASS_BFX_BQF_LOWPASS, BASS_BFX_BQF_HIGHPASS, BASS_BFX_BQF_BANDPASS, #constant 0 dB peak gain BASS_BFX_BQF_BANDPASS_Q, #constant skirt gain, peak gain = Q BASS_BFX_BQF_NOTCH, BASS_BFX_BQF_ALLPASS, BASS_BFX_BQF_PEAKINGEQ, BASS_BFX_BQF_LOWSHELF, BASS_BFX_BQF_HIGHSHELF, ) = range(9) #Echo class BASS_BFX_ECHO(ctypes.Structure): _fields_ = [ ('fLevel', ctypes.c_float), #[0....1....n] linear ('lDelay', ctypes.c_int), #[1200..30000] ] #Flanger class BASS_BFX_FLANGER(ctypes.Structure): _fields_ = [ ('fWetDry', ctypes.c_float), #[0....1....n] linear ('fSpeed', ctypes.c_float), #[0......0.09] ('lChannel', ctypes.c_int), #BASS_BFX_CHANxxx flag/s ] #volume class BASS_BFX_VOLUME(ctypes.Structure): _fields_ = [ ('lChannel', ctypes.c_int), #BASS_BFX_CHANxxx flag/s or 0 for global volume control ('fVolume', ctypes.c_float), #[0....1....n] linear ] #Peaking Equalizer class BASS_BFX_PEAKEQ(ctypes.Structure): _fields_ = [ ('lBand', ctypes.c_int), #[0...............n] more bands means more memory & cpu usage ('fBandwidth', ctypes.c_float), #[0.1...........<10] in octaves - fQ is not in use (Bandwidth has a priority over fQ) ('fQ', ctypes.c_float), #[0...............1] the EE kinda definition (linear) (if Bandwidth is not in use) ('fCenter', ctypes.c_float), #[1Hz..