📄 bass.bas
字号:
Attribute VB_Name = "modBass"
' BASS 2.4 Visual Basic module
' Copyright (c) 1999-2008 Un4seen Developments Ltd.
'
' See the BASS.CHM file for more detailed documentation
' NOTE: VB does not support 64-bit integers, so VB users only have access
' to the low 32-bits of 64-bit return values. 64-bit parameters can
' be specified though, using the "64" version of the function.
' NOTE: Use "StrPtr(filename)" to pass a filename to the BASS_MusicLoad,
' BASS_SampleLoad and BASS_StreamCreateFile functions.
' NOTE: Use the VBStrFromAnsiPtr function to convert "char *" to VB "String".
Global Const BASSVERSION = &H204 'API version
Global Const BASSVERSIONTEXT = "2.4"
Global Const BASSTRUE As Long = 1 'Use this instead of VB Booleans
Global Const BASSFALSE As Long = 0 'Use this instead of VB Booleans
' Error codes returned by BASS_ErrorGetCode
Global Const BASS_OK = 0 'all is OK
Global Const BASS_ERROR_MEM = 1 'memory error
Global Const BASS_ERROR_FILEOPEN = 2 'can't open the file
Global Const BASS_ERROR_DRIVER = 3 'can't find a free sound driver
Global Const BASS_ERROR_BUFLOST = 4 'the sample buffer was lost
Global Const BASS_ERROR_HANDLE = 5 'invalid handle
Global Const BASS_ERROR_FORMAT = 6 'unsupported sample format
Global Const BASS_ERROR_POSITION = 7 'invalid position
Global Const BASS_ERROR_INIT = 8 'BASS_Init has not been successfully called
Global Const BASS_ERROR_START = 9 'BASS_Start has not been successfully called
Global Const BASS_ERROR_ALREADY = 14 'already initialized/paused/whatever
Global Const BASS_ERROR_NOCHAN = 18 'can't get a free channel
Global Const BASS_ERROR_ILLTYPE = 19 'an illegal type was specified
Global Const BASS_ERROR_ILLPARAM = 20 'an illegal parameter was specified
Global Const BASS_ERROR_NO3D = 21 'no 3D support
Global Const BASS_ERROR_NOEAX = 22 'no EAX support
Global Const BASS_ERROR_DEVICE = 23 'illegal device number
Global Const BASS_ERROR_NOPLAY = 24 'not playing
Global Const BASS_ERROR_FREQ = 25 'illegal sample rate
Global Const BASS_ERROR_NOTFILE = 27 'the stream is not a file stream
Global Const BASS_ERROR_NOHW = 29 'no hardware voices available
Global Const BASS_ERROR_EMPTY = 31 'the MOD music has no sequence data
Global Const BASS_ERROR_NONET = 32 'no internet connection could be opened
Global Const BASS_ERROR_CREATE = 33 'couldn't create the file
Global Const BASS_ERROR_NOFX = 34 'effects are not available
Global Const BASS_ERROR_NOTAVAIL = 37 'requested data is not available
Global Const BASS_ERROR_DECODE = 38 'the channel is a "decoding channel"
Global Const BASS_ERROR_DX = 39 'a sufficient DirectX version is not installed
Global Const BASS_ERROR_TIMEOUT = 40 'connection timedout
Global Const BASS_ERROR_FILEFORM = 41 'unsupported file format
Global Const BASS_ERROR_SPEAKER = 42 'unavailable speaker
Global Const BASS_ERROR_VERSION = 43 'invalid BASS version (used by add-ons)
Global Const BASS_ERROR_CODEC = 44 'codec is not available/supported
Global Const BASS_ERROR_ENDED = 45 'the channel/file has ended
Global Const BASS_ERROR_UNKNOWN = -1 'some other mystery problem
' BASS_SetConfig options
Global Const BASS_CONFIG_BUFFER = 0
Global Const BASS_CONFIG_UPDATEPERIOD = 1
Global Const BASS_CONFIG_GVOL_SAMPLE = 4
Global Const BASS_CONFIG_GVOL_STREAM = 5
Global Const BASS_CONFIG_GVOL_MUSIC = 6
Global Const BASS_CONFIG_CURVE_VOL = 7
Global Const BASS_CONFIG_CURVE_PAN = 8
Global Const BASS_CONFIG_FLOATDSP = 9
Global Const BASS_CONFIG_3DALGORITHM = 10
Global Const BASS_CONFIG_NET_TIMEOUT = 11
Global Const BASS_CONFIG_NET_BUFFER = 12
Global Const BASS_CONFIG_PAUSE_NOPLAY = 13
Global Const BASS_CONFIG_NET_PREBUF = 15
Global Const BASS_CONFIG_NET_PASSIVE = 18
Global Const BASS_CONFIG_REC_BUFFER = 19
Global Const BASS_CONFIG_NET_PLAYLIST = 21
Global Const BASS_CONFIG_MUSIC_VIRTUAL = 22
Global Const BASS_CONFIG_VERIFY = 23
Global Const BASS_CONFIG_UPDATETHREADS = 24
' BASS_SetConfigPtr options
Global Const BASS_CONFIG_NET_AGENT = 16
Global Const BASS_CONFIG_NET_PROXY = 17
' Initialization flags
Global Const BASS_DEVICE_8BITS = 1 'use 8 bit resolution, else 16 bit
Global Const BASS_DEVICE_MONO = 2 'use mono, else stereo
Global Const BASS_DEVICE_3D = 4 'enable 3D functionality
Global Const BASS_DEVICE_LATENCY = 256 'calculate device latency (BASS_INFO struct)
Global Const BASS_DEVICE_CPSPEAKERS = 1024 'detect speakers via Windows control panel
Global Const BASS_DEVICE_SPEAKERS = 2048 'force enabling of speaker assignment
Global Const BASS_DEVICE_NOSPEAKER = 4096 'ignore speaker arrangement
' DirectSound interfaces (for use with BASS_GetDSoundObject)
Global Const BASS_OBJECT_DS = 1 ' DirectSound
Global Const BASS_OBJECT_DS3DL = 2 'IDirectSound3DListener
' Device info structure
Type BASS_DEVICEINFO
name As Long ' description
driver As Long ' driver
flags As Long
End Type
' BASS_DEVICEINFO flags
Global Const BASS_DEVICE_ENABLED = 1
Global Const BASS_DEVICE_DEFAULT = 2
Global Const BASS_DEVICE_INIT = 4
Type BASS_INFO
flags As Long ' device capabilities (DSCAPS_xxx flags)
hwsize As Long ' size of total device hardware memory
hwfree As Long ' size of free device hardware memory
freesam As Long ' number of free sample slots in the hardware
free3d As Long ' number of free 3D sample slots in the hardware
minrate As Long ' min sample rate supported by the hardware
maxrate As Long ' max sample rate supported by the hardware
eax As Long ' device supports EAX? (always BASSFALSE if BASS_DEVICE_3D was not used)
minbuf As Long ' recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
dsver As Long ' DirectSound version
latency As Long ' delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
initflags As Long ' BASS_Init "flags" parameter
speakers As Long ' number of speakers available
freq As Long ' current output rate (OSX only)
End Type
' BASS_INFO flags (from DSOUND.H)
Global Const DSCAPS_CONTINUOUSRATE = 16 ' supports all sample rates between min/maxrate
Global Const DSCAPS_EMULDRIVER = 32 ' device does NOT have hardware DirectSound support
Global Const DSCAPS_CERTIFIED = 64 ' device driver has been certified by Microsoft
Global Const DSCAPS_SECONDARYMONO = 256 ' mono
Global Const DSCAPS_SECONDARYSTEREO = 512 ' stereo
Global Const DSCAPS_SECONDARY8BIT = 1024 ' 8 bit
Global Const DSCAPS_SECONDARY16BIT = 2048 ' 16 bit
' Recording device info structure
Type BASS_RECORDINFO
flags As Long ' device capabilities (DSCCAPS_xxx flags)
formats As Long ' supported standard formats (WAVE_FORMAT_xxx flags)
inputs As Long ' number of inputs
singlein As Long ' BASSTRUE = only 1 input can be set at a time
freq As Long ' current input rate (Vista/OSX only)
End Type
' BASS_RECORDINFO flags (from DSOUND.H)
Global Const DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER ' device does NOT have hardware DirectSound recording support
Global Const DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED ' device driver has been certified by Microsoft
' defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
Global Const WAVE_FORMAT_1M08 = &H1 ' 11.025 kHz, Mono, 8-bit
Global Const WAVE_FORMAT_1S08 = &H2 ' 11.025 kHz, Stereo, 8-bit
Global Const WAVE_FORMAT_1M16 = &H4 ' 11.025 kHz, Mono, 16-bit
Global Const WAVE_FORMAT_1S16 = &H8 ' 11.025 kHz, Stereo, 16-bit
Global Const WAVE_FORMAT_2M08 = &H10 ' 22.05 kHz, Mono, 8-bit
Global Const WAVE_FORMAT_2S08 = &H20 ' 22.05 kHz, Stereo, 8-bit
Global Const WAVE_FORMAT_2M16 = &H40 ' 22.05 kHz, Mono, 16-bit
Global Const WAVE_FORMAT_2S16 = &H80 ' 22.05 kHz, Stereo, 16-bit
Global Const WAVE_FORMAT_4M08 = &H100 ' 44.1 kHz, Mono, 8-bit
Global Const WAVE_FORMAT_4S08 = &H200 ' 44.1 kHz, Stereo, 8-bit
Global Const WAVE_FORMAT_4M16 = &H400 ' 44.1 kHz, Mono, 16-bit
Global Const WAVE_FORMAT_4S16 = &H800 ' 44.1 kHz, Stereo, 16-bit
' Sample info structure
Type BASS_SAMPLE
freq As Long ' default playback rate
volume As Single ' default volume (0-100)
pan As Single ' default pan (-100=left, 0=middle, 100=right)
flags As Long ' BASS_SAMPLE_xxx flags
length As Long ' length (in samples, not bytes)
max As Long ' maximum simultaneous playbacks
origres As Long ' original resolution
chans As Long ' number of channels
mingap As Long ' minimum gap (ms) between creating channels
mode3d As Long ' BASS_3DMODE_xxx mode
mindist As Single ' minimum distance
MAXDIST As Single ' maximum distance
iangle As Long ' angle of inside projection cone
oangle As Long ' angle of outside projection cone
outvol As Single ' delta-volume outside the projection cone
vam As Long ' voice allocation/management flags (BASS_VAM_xxx)
priority As Long ' priority (0=lowest, &Hffffffff=highest)
End Type
Global Const BASS_SAMPLE_8BITS = 1 ' 8 bit
Global Const BASS_SAMPLE_FLOAT = 256 ' 32-bit floating-point
Global Const BASS_SAMPLE_MONO = 2 ' mono
Global Const BASS_SAMPLE_LOOP = 4 ' looped
Global Const BASS_SAMPLE_3D = 8 ' 3D functionality
Global Const BASS_SAMPLE_SOFTWARE = 16 ' not using hardware mixing
Global Const BASS_SAMPLE_MUTEMAX = 32 ' mute at max distance (3D only)
Global Const BASS_SAMPLE_VAM = 64 ' DX7 voice allocation & management
Global Const BASS_SAMPLE_FX = 128 ' old implementation of DX8 effects
Global Const BASS_SAMPLE_OVER_VOL = &H10000 ' override lowest volume
Global Const BASS_SAMPLE_OVER_POS = &H20000 ' override longest playing
Global Const BASS_SAMPLE_OVER_DIST = &H30000 ' override furthest from listener (3D only)
Global Const BASS_STREAM_PRESCAN = &H20000 ' enable pin-point seeking/length (MP3/MP2/MP1)
Global Const BASS_MP3_SETPOS = BASS_STREAM_PRESCAN
Global Const BASS_STREAM_AUTOFREE = &H40000 ' automatically free the stream when it stop/ends
Global Const BASS_STREAM_RESTRATE = &H80000 ' restrict the download rate of internet file streams
Global Const BASS_STREAM_BLOCK = &H100000 ' download/play internet file stream in small blocks
Global Const BASS_STREAM_DECODE = &H200000 ' don't play the stream, only decode (BASS_ChannelGetData)
Global Const BASS_STREAM_STATUS = &H800000 ' give server status info (HTTP/ICY tags) in DOWNLOADPROC
Global Const BASS_MUSIC_FLOAT = BASS_SAMPLE_FLOAT
Global Const BASS_MUSIC_MONO = BASS_SAMPLE_MONO
Global Const BASS_MUSIC_LOOP = BASS_SAMPLE_LOOP
Global Const BASS_MUSIC_3D = BASS_SAMPLE_3D
Global Const BASS_MUSIC_FX = BASS_SAMPLE_FX
Global Const BASS_MUSIC_AUTOFREE = BASS_STREAM_AUTOFREE
Global Const BASS_MUSIC_DECODE = BASS_STREAM_DECODE
Global Const BASS_MUSIC_PRESCAN = BASS_STREAM_PRESCAN ' calculate playback length
Global Const BASS_MUSIC_CALCLEN = BASS_MUSIC_PRESCAN
Global Const BASS_MUSIC_RAMP = &H200 ' normal ramping
Global Const BASS_MUSIC_RAMPS = &H400 ' sensitive ramping
Global Const BASS_MUSIC_SURROUND = &H800 ' surround sound
Global Const BASS_MUSIC_SURROUND2 = &H1000 ' surround sound (mode 2)
Global Const BASS_MUSIC_FT2MOD = &H2000 ' play .MOD as FastTracker 2 does
Global Const BASS_MUSIC_PT1MOD = &H4000 ' play .MOD as ProTracker 1 does
Global Const BASS_MUSIC_NONINTER = &H10000 ' non-interpolated sample mixing
Global Const BASS_MUSIC_SINCINTER = &H800000 ' sinc interpolated sample mixing
Global Const BASS_MUSIC_POSRESET = 32768 ' stop all notes when moving position
Global Const BASS_MUSIC_POSRESETEX = &H400000 ' stop all notes and reset bmp/etc when moving position
Global Const BASS_MUSIC_STOPBACK = &H80000 ' stop the music on a backwards jump effect
Global Const BASS_MUSIC_NOSAMPLE = &H100000 ' don't load the samples
' Speaker assignment flags
Global Const BASS_SPEAKER_FRONT = &H1000000 ' front speakers
Global Const BASS_SPEAKER_REAR = &H2000000 ' rear/side speakers
Global Const BASS_SPEAKER_CENLFE = &H3000000 ' center & LFE speakers (5.1)
Global Const BASS_SPEAKER_REAR2 = &H4000000 ' rear center speakers (7.1)
Global Const BASS_SPEAKER_LEFT = &H10000000 ' modifier: left
Global Const BASS_SPEAKER_RIGHT = &H20000000 ' modifier: right
Global Const BASS_SPEAKER_FRONTLEFT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_LEFT
Global Const BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_RIGHT
Global Const BASS_SPEAKER_REARLEFT = BASS_SPEAKER_REAR Or BASS_SPEAKER_LEFT
Global Const BASS_SPEAKER_REARRIGHT = BASS_SPEAKER_REAR Or BASS_SPEAKER_RIGHT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -