Advertisement
meanhacker

modBass (Bass.bas)

Mar 12th, 2011
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' BASS 2.4 Visual Basic module
  2. ' Copyright (c) 1999-2010 Un4seen Developments Ltd.
  3. '
  4. ' See the BASS.CHM file for more detailed documentation
  5.  
  6. ' NOTE: VB does not support 64-bit integers, so VB users only have access
  7. '       to the low 32-bits of 64-bit return values. 64-bit parameters can
  8. '       be specified though, using the "64" version of the function.
  9.  
  10. ' NOTE: Use "StrPtr(filename)" to pass a filename to the BASS_MusicLoad,
  11. '       BASS_SampleLoad and BASS_StreamCreateFile functions.
  12.  
  13. ' NOTE: Use the VBStrFromAnsiPtr function to convert "char *" to VB "String".
  14.  
  15. Global Const BASSVERSION = &H204    'API version
  16. Global Const BASSVERSIONTEXT = "2.4"
  17.  
  18. Global Const BASSTRUE As Long = 1   'Use this instead of VB Booleans
  19. Global Const BASSFALSE As Long = 0  'Use this instead of VB Booleans
  20.  
  21. ' Error codes returned by BASS_ErrorGetCode
  22. Global Const BASS_OK = 0               'all is OK
  23. Global Const BASS_ERROR_MEM = 1        'memory error
  24. Global Const BASS_ERROR_FILEOPEN = 2   'can't open the file
  25. Global Const BASS_ERROR_DRIVER = 3     'can't find a free sound driver
  26. Global Const BASS_ERROR_BUFLOST = 4    'the sample buffer was lost
  27. Global Const BASS_ERROR_HANDLE = 5     'invalid handle
  28. Global Const BASS_ERROR_FORMAT = 6     'unsupported sample format
  29. Global Const BASS_ERROR_POSITION = 7   'invalid position
  30. Global Const BASS_ERROR_INIT = 8       'BASS_Init has not been successfully called
  31. Global Const BASS_ERROR_START = 9      'BASS_Start has not been successfully called
  32. Global Const BASS_ERROR_ALREADY = 14   'already initialized/paused/whatever
  33. Global Const BASS_ERROR_NOCHAN = 18    'can't get a free channel
  34. Global Const BASS_ERROR_ILLTYPE = 19   'an illegal type was specified
  35. Global Const BASS_ERROR_ILLPARAM = 20  'an illegal parameter was specified
  36. Global Const BASS_ERROR_NO3D = 21      'no 3D support
  37. Global Const BASS_ERROR_NOEAX = 22     'no EAX support
  38. Global Const BASS_ERROR_DEVICE = 23    'illegal device number
  39. Global Const BASS_ERROR_NOPLAY = 24    'not playing
  40. Global Const BASS_ERROR_FREQ = 25      'illegal sample rate
  41. Global Const BASS_ERROR_NOTFILE = 27   'the stream is not a file stream
  42. Global Const BASS_ERROR_NOHW = 29      'no hardware voices available
  43. Global Const BASS_ERROR_EMPTY = 31     'the MOD music has no sequence data
  44. Global Const BASS_ERROR_NONET = 32     'no internet connection could be opened
  45. Global Const BASS_ERROR_CREATE = 33    'couldn't create the file
  46. Global Const BASS_ERROR_NOFX = 34      'effects are not available
  47. Global Const BASS_ERROR_NOTAVAIL = 37  'requested data is not available
  48. Global Const BASS_ERROR_DECODE = 38    'the channel is a "decoding channel"
  49. Global Const BASS_ERROR_DX = 39        'a sufficient DirectX version is not installed
  50. Global Const BASS_ERROR_TIMEOUT = 40   'connection timedout
  51. Global Const BASS_ERROR_FILEFORM = 41  'unsupported file format
  52. Global Const BASS_ERROR_SPEAKER = 42   'unavailable speaker
  53. Global Const BASS_ERROR_VERSION = 43   'invalid BASS version (used by add-ons)
  54. Global Const BASS_ERROR_CODEC = 44     'codec is not available/supported
  55. Global Const BASS_ERROR_ENDED = 45     'the channel/file has ended
  56. Global Const BASS_ERROR_BUSY = 46      'the device is busy
  57. Global Const BASS_ERROR_UNKNOWN = -1   'some other mystery problem
  58.  
  59. ' BASS_SetConfig options
  60. Global Const BASS_CONFIG_BUFFER = 0
  61. Global Const BASS_CONFIG_UPDATEPERIOD = 1
  62. Global Const BASS_CONFIG_GVOL_SAMPLE = 4
  63. Global Const BASS_CONFIG_GVOL_STREAM = 5
  64. Global Const BASS_CONFIG_GVOL_MUSIC = 6
  65. Global Const BASS_CONFIG_CURVE_VOL = 7
  66. Global Const BASS_CONFIG_CURVE_PAN = 8
  67. Global Const BASS_CONFIG_FLOATDSP = 9
  68. Global Const BASS_CONFIG_3DALGORITHM = 10
  69. Global Const BASS_CONFIG_NET_TIMEOUT = 11
  70. Global Const BASS_CONFIG_NET_BUFFER = 12
  71. Global Const BASS_CONFIG_PAUSE_NOPLAY = 13
  72. Global Const BASS_CONFIG_NET_PREBUF = 15
  73. Global Const BASS_CONFIG_NET_PASSIVE = 18
  74. Global Const BASS_CONFIG_REC_BUFFER = 19
  75. Global Const BASS_CONFIG_NET_PLAYLIST = 21
  76. Global Const BASS_CONFIG_MUSIC_VIRTUAL = 22
  77. Global Const BASS_CONFIG_VERIFY = 23
  78. Global Const BASS_CONFIG_UPDATETHREADS = 24
  79. Global Const BASS_CONFIG_DEV_BUFFER = 27
  80. Global Const BASS_CONFIG_DEV_DEFAULT = 36
  81. Global Const BASS_CONFIG_NET_READTIMEOUT = 37
  82.  
  83. ' BASS_SetConfigPtr options
  84. Global Const BASS_CONFIG_NET_AGENT = 16
  85. Global Const BASS_CONFIG_NET_PROXY = 17
  86.  
  87. ' Initialization flags
  88. Global Const BASS_DEVICE_8BITS = 1     'use 8 bit resolution, else 16 bit
  89. Global Const BASS_DEVICE_MONO = 2      'use mono, else stereo
  90. Global Const BASS_DEVICE_3D = 4        'enable 3D functionality
  91. Global Const BASS_DEVICE_LATENCY = 256 'calculate device latency (BASS_INFO struct)
  92. Global Const BASS_DEVICE_CPSPEAKERS = 1024 'detect speakers via Windows control panel
  93. Global Const BASS_DEVICE_SPEAKERS = 2048 'force enabling of speaker assignment
  94. Global Const BASS_DEVICE_NOSPEAKER = 4096 'ignore speaker arrangement
  95.  
  96. ' DirectSound interfaces (for use with BASS_GetDSoundObject)
  97. Global Const BASS_OBJECT_DS = 1                     ' DirectSound
  98. Global Const BASS_OBJECT_DS3DL = 2                  'IDirectSound3DListener
  99.  
  100. ' Device info structure
  101. Type BASS_DEVICEINFO
  102.     name As Long          ' description
  103.    driver As Long        ' driver
  104.    flags As Long
  105. End Type
  106.  
  107. ' BASS_DEVICEINFO flags
  108. Global Const BASS_DEVICE_ENABLED = 1
  109. Global Const BASS_DEVICE_DEFAULT = 2
  110. Global Const BASS_DEVICE_INIT = 4
  111.  
  112. Type BASS_INFO
  113.     flags As Long         ' device capabilities (DSCAPS_xxx flags)
  114.    hwsize As Long        ' size of total device hardware memory
  115.    hwfree As Long        ' size of free device hardware memory
  116.    freesam As Long       ' number of free sample slots in the hardware
  117.    free3d As Long        ' number of free 3D sample slots in the hardware
  118.    minrate As Long       ' min sample rate supported by the hardware
  119.    maxrate As Long       ' max sample rate supported by the hardware
  120.    eax As Long           ' device supports EAX? (always BASSFALSE if BASS_DEVICE_3D was not used)
  121.    minbuf As Long        ' recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
  122.    dsver As Long         ' DirectSound version
  123.    latency As Long       ' delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
  124.    initflags As Long     ' BASS_Init "flags" parameter
  125.    speakers As Long      ' number of speakers available
  126.    freq As Long          ' current output rate (OSX only)
  127. End Type
  128.  
  129. ' BASS_INFO flags (from DSOUND.H)
  130. Global Const DSCAPS_CONTINUOUSRATE = 16    ' supports all sample rates between min/maxrate
  131. Global Const DSCAPS_EMULDRIVER = 32        ' device does NOT have hardware DirectSound support
  132. Global Const DSCAPS_CERTIFIED = 64         ' device driver has been certified by Microsoft
  133. Global Const DSCAPS_SECONDARYMONO = 256    ' mono
  134. Global Const DSCAPS_SECONDARYSTEREO = 512  ' stereo
  135. Global Const DSCAPS_SECONDARY8BIT = 1024   ' 8 bit
  136. Global Const DSCAPS_SECONDARY16BIT = 2048  ' 16 bit
  137.  
  138. ' Recording device info structure
  139. Type BASS_RECORDINFO
  140.     flags As Long         ' device capabilities (DSCCAPS_xxx flags)
  141.    formats As Long       ' supported standard formats (WAVE_FORMAT_xxx flags)
  142.    inputs As Long        ' number of inputs
  143.    singlein As Long      ' BASSTRUE = only 1 input can be set at a time
  144.    freq As Long          ' current input rate (Vista/OSX only)
  145. End Type
  146.  
  147. ' BASS_RECORDINFO flags (from DSOUND.H)
  148. Global Const DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER ' device does NOT have hardware DirectSound recording support
  149. Global Const DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED   ' device driver has been certified by Microsoft
  150.  
  151. ' defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
  152. Global Const WAVE_FORMAT_1M08 = &H1          ' 11.025 kHz, Mono,   8-bit
  153. Global Const WAVE_FORMAT_1S08 = &H2          ' 11.025 kHz, Stereo, 8-bit
  154. Global Const WAVE_FORMAT_1M16 = &H4          ' 11.025 kHz, Mono,   16-bit
  155. Global Const WAVE_FORMAT_1S16 = &H8          ' 11.025 kHz, Stereo, 16-bit
  156. Global Const WAVE_FORMAT_2M08 = &H10         ' 22.05  kHz, Mono,   8-bit
  157. Global Const WAVE_FORMAT_2S08 = &H20         ' 22.05  kHz, Stereo, 8-bit
  158. Global Const WAVE_FORMAT_2M16 = &H40         ' 22.05  kHz, Mono,   16-bit
  159. Global Const WAVE_FORMAT_2S16 = &H80         ' 22.05  kHz, Stereo, 16-bit
  160. Global Const WAVE_FORMAT_4M08 = &H100        ' 44.1   kHz, Mono,   8-bit
  161. Global Const WAVE_FORMAT_4S08 = &H200        ' 44.1   kHz, Stereo, 8-bit
  162. Global Const WAVE_FORMAT_4M16 = &H400        ' 44.1   kHz, Mono,   16-bit
  163. Global Const WAVE_FORMAT_4S16 = &H800        ' 44.1   kHz, Stereo, 16-bit
  164.  
  165. ' Sample info structure
  166. Type BASS_SAMPLE
  167.     freq As Long          ' default playback rate
  168.    volume As Single      ' default volume (0-100)
  169.    pan As Single         ' default pan (-100=left, 0=middle, 100=right)
  170.    flags As Long         ' BASS_SAMPLE_xxx flags
  171.    length As Long        ' length (in samples, not bytes)
  172.    max As Long           ' maximum simultaneous playbacks
  173.    origres As Long       ' original resolution
  174.    chans As Long         ' number of channels
  175.    mingap As Long        ' minimum gap (ms) between creating channels
  176.    mode3d As Long        ' BASS_3DMODE_xxx mode
  177.    mindist As Single     ' minimum distance
  178.    MAXDIST As Single     ' maximum distance
  179.    iangle As Long        ' angle of inside projection cone
  180.    oangle As Long        ' angle of outside projection cone
  181.    outvol As Single      ' delta-volume outside the projection cone
  182.    vam As Long           ' voice allocation/management flags (BASS_VAM_xxx)
  183.    priority As Long      ' priority (0=lowest, &Hffffffff=highest)
  184. End Type
  185.  
  186. Global Const BASS_SAMPLE_8BITS = 1          ' 8 bit
  187. Global Const BASS_SAMPLE_FLOAT = 256        ' 32-bit floating-point
  188. Global Const BASS_SAMPLE_MONO = 2           ' mono
  189. Global Const BASS_SAMPLE_LOOP = 4           ' looped
  190. Global Const BASS_SAMPLE_3D = 8             ' 3D functionality
  191. Global Const BASS_SAMPLE_SOFTWARE = 16      ' not using hardware mixing
  192. Global Const BASS_SAMPLE_MUTEMAX = 32       ' mute at max distance (3D only)
  193. Global Const BASS_SAMPLE_VAM = 64           ' DX7 voice allocation & management
  194. Global Const BASS_SAMPLE_FX = 128           ' old implementation of DX8 effects
  195. Global Const BASS_SAMPLE_OVER_VOL = &H10000 ' override lowest volume
  196. Global Const BASS_SAMPLE_OVER_POS = &H20000 ' override longest playing
  197. Global Const BASS_SAMPLE_OVER_DIST = &H30000 ' override furthest from listener (3D only)
  198.  
  199. Global Const BASS_STREAM_PRESCAN = &H20000   ' enable pin-point seeking/length (MP3/MP2/MP1)
  200. Global Const BASS_MP3_SETPOS = BASS_STREAM_PRESCAN
  201. Global Const BASS_STREAM_AUTOFREE = &H40000 ' automatically free the stream when it stop/ends
  202. Global Const BASS_STREAM_RESTRATE = &H80000 ' restrict the download rate of internet file streams
  203. Global Const BASS_STREAM_BLOCK = &H100000   ' download/play internet file stream in small blocks
  204. Global Const BASS_STREAM_DECODE = &H200000  ' don't play the stream, only decode (BASS_ChannelGetData)
  205. Global Const BASS_STREAM_STATUS = &H800000  ' give server status info (HTTP/ICY tags) in DOWNLOADPROC
  206.  
  207. Global Const BASS_MUSIC_FLOAT = BASS_SAMPLE_FLOAT
  208. Global Const BASS_MUSIC_MONO = BASS_SAMPLE_MONO
  209. Global Const BASS_MUSIC_LOOP = BASS_SAMPLE_LOOP
  210. Global Const BASS_MUSIC_3D = BASS_SAMPLE_3D
  211. Global Const BASS_MUSIC_FX = BASS_SAMPLE_FX
  212. Global Const BASS_MUSIC_AUTOFREE = BASS_STREAM_AUTOFREE
  213. Global Const BASS_MUSIC_DECODE = BASS_STREAM_DECODE
  214. Global Const BASS_MUSIC_PRESCAN = BASS_STREAM_PRESCAN ' calculate playback length
  215. Global Const BASS_MUSIC_CALCLEN = BASS_MUSIC_PRESCAN
  216. Global Const BASS_MUSIC_RAMP = &H200        ' normal ramping
  217. Global Const BASS_MUSIC_RAMPS = &H400       ' sensitive ramping
  218. Global Const BASS_MUSIC_SURROUND = &H800    ' surround sound
  219. Global Const BASS_MUSIC_SURROUND2 = &H1000  ' surround sound (mode 2)
  220. Global Const BASS_MUSIC_FT2MOD = &H2000     ' play .MOD as FastTracker 2 does
  221. Global Const BASS_MUSIC_PT1MOD = &H4000     ' play .MOD as ProTracker 1 does
  222. Global Const BASS_MUSIC_NONINTER = &H10000  ' non-interpolated sample mixing
  223. Global Const BASS_MUSIC_SINCINTER = &H800000 ' sinc interpolated sample mixing
  224. Global Const BASS_MUSIC_POSRESET = 32768  ' stop all notes when moving position
  225. Global Const BASS_MUSIC_POSRESETEX = &H400000 ' stop all notes and reset bmp/etc when moving position
  226. Global Const BASS_MUSIC_STOPBACK = &H80000  ' stop the music on a backwards jump effect
  227. Global Const BASS_MUSIC_NOSAMPLE = &H100000 ' don't load the samples
  228.  
  229. ' Speaker assignment flags
  230. Global Const BASS_SPEAKER_FRONT = &H1000000 ' front speakers
  231. Global Const BASS_SPEAKER_REAR = &H2000000  ' rear/side speakers
  232. Global Const BASS_SPEAKER_CENLFE = &H3000000 ' center & LFE speakers (5.1)
  233. Global Const BASS_SPEAKER_REAR2 = &H4000000 ' rear center speakers (7.1)
  234. Global Const BASS_SPEAKER_LEFT = &H10000000 ' modifier: left
  235. Global Const BASS_SPEAKER_RIGHT = &H20000000 ' modifier: right
  236. Global Const BASS_SPEAKER_FRONTLEFT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_LEFT
  237. Global Const BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_RIGHT
  238. Global Const BASS_SPEAKER_REARLEFT = BASS_SPEAKER_REAR Or BASS_SPEAKER_LEFT
  239. Global Const BASS_SPEAKER_REARRIGHT = BASS_SPEAKER_REAR Or BASS_SPEAKER_RIGHT
  240. Global Const BASS_SPEAKER_CENTER = BASS_SPEAKER_CENLFE Or BASS_SPEAKER_LEFT
  241. Global Const BASS_SPEAKER_LFE = BASS_SPEAKER_CENLFE Or BASS_SPEAKER_RIGHT
  242. Global Const BASS_SPEAKER_REAR2LEFT = BASS_SPEAKER_REAR2 Or BASS_SPEAKER_LEFT
  243. Global Const BASS_SPEAKER_REAR2RIGHT = BASS_SPEAKER_REAR2 Or BASS_SPEAKER_RIGHT
  244.  
  245. Global Const BASS_UNICODE = &H80000000
  246.  
  247. Global Const BASS_RECORD_PAUSE = 32768 ' start recording paused
  248.  
  249. ' DX7 voice allocation flags
  250. Global Const BASS_VAM_HARDWARE = 1
  251. Global Const BASS_VAM_SOFTWARE = 2
  252. Global Const BASS_VAM_TERM_TIME = 4
  253. Global Const BASS_VAM_TERM_DIST = 8
  254. Global Const BASS_VAM_TERM_PRIO = 16
  255.  
  256. ' Channel info structure
  257. Type BASS_CHANNELINFO
  258.     freq As Long          ' default playback rate
  259.    chans As Long         ' channels
  260.    flags As Long         ' BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
  261.    ctype As Long         ' type of channel
  262.    origres As Long       ' original resolution
  263.    plugin As Long        ' plugin
  264.    sample As Long        ' sample
  265.    filename As Long      ' filename
  266. End Type
  267.  
  268. ' BASS_CHANNELINFO types
  269. Global Const BASS_CTYPE_SAMPLE = 1
  270. Global Const BASS_CTYPE_RECORD = 2
  271. Global Const BASS_CTYPE_STREAM = &H10000
  272. Global Const BASS_CTYPE_STREAM_OGG = &H10002
  273. Global Const BASS_CTYPE_STREAM_MP1 = &H10003
  274. Global Const BASS_CTYPE_STREAM_MP2 = &H10004
  275. Global Const BASS_CTYPE_STREAM_MP3 = &H10005
  276. Global Const BASS_CTYPE_STREAM_AIFF = &H10006
  277. Global Const BASS_CTYPE_STREAM_WAV = &H40000 ' WAVE flag, LOWORD=codec
  278. Global Const BASS_CTYPE_STREAM_WAV_PCM = &H50001
  279. Global Const BASS_CTYPE_STREAM_WAV_FLOAT = &H50003
  280. Global Const BASS_CTYPE_MUSIC_MOD = &H20000
  281. Global Const BASS_CTYPE_MUSIC_MTM = &H20001
  282. Global Const BASS_CTYPE_MUSIC_S3M = &H20002
  283. Global Const BASS_CTYPE_MUSIC_XM = &H20003
  284. Global Const BASS_CTYPE_MUSIC_IT = &H20004
  285. Global Const BASS_CTYPE_MUSIC_MO3 = &H100    ' MO3 flag
  286.  
  287. Type BASS_PLUGINFORM
  288.     ctype As Long         ' channel type
  289.    name As Long          ' format description
  290.    exts As Long          ' file extension filter (*.ext1;*.ext2;etc...)
  291. End Type
  292.  
  293. Type BASS_PLUGININFO
  294.     Version As Long       ' version (same form as BASS_GetVersion)
  295.    formatc As Long       ' number of formats
  296.    formats As Long       ' the array of formats
  297. End Type
  298.  
  299. ' 3D vector (for 3D positions/velocities/orientations)
  300. Type BASS_3DVECTOR
  301.     X As Single           ' +=right, -=left
  302.    Y As Single           ' +=up, -=down
  303.    z As Single           ' +=front, -=behind
  304. End Type
  305.  
  306. ' 3D channel modes
  307. Global Const BASS_3DMODE_NORMAL = 0     ' normal 3D processing
  308. Global Const BASS_3DMODE_RELATIVE = 1   ' position is relative to the listener
  309. Global Const BASS_3DMODE_OFF = 2        ' no 3D processing
  310.  
  311. ' software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM)
  312. Global Const BASS_3DALG_DEFAULT = 0
  313. Global Const BASS_3DALG_OFF = 1
  314. Global Const BASS_3DALG_FULL = 2
  315. Global Const BASS_3DALG_LIGHT = 3
  316.  
  317. ' EAX environments, use with BASS_SetEAXParameters
  318. Global Const EAX_ENVIRONMENT_GENERIC = 0
  319. Global Const EAX_ENVIRONMENT_PADDEDCELL = 1
  320. Global Const EAX_ENVIRONMENT_ROOM = 2
  321. Global Const EAX_ENVIRONMENT_BATHROOM = 3
  322. Global Const EAX_ENVIRONMENT_LIVINGROOM = 4
  323. Global Const EAX_ENVIRONMENT_STONEROOM = 5
  324. Global Const EAX_ENVIRONMENT_AUDITORIUM = 6
  325. Global Const EAX_ENVIRONMENT_CONCERTHALL = 7
  326. Global Const EAX_ENVIRONMENT_CAVE = 8
  327. Global Const EAX_ENVIRONMENT_ARENA = 9
  328. Global Const EAX_ENVIRONMENT_HANGAR = 10
  329. Global Const EAX_ENVIRONMENT_CARPETEDHALLWAY = 11
  330. Global Const EAX_ENVIRONMENT_HALLWAY = 12
  331. Global Const EAX_ENVIRONMENT_STONECORRIDOR = 13
  332. Global Const EAX_ENVIRONMENT_ALLEY = 14
  333. Global Const EAX_ENVIRONMENT_FOREST = 15
  334. Global Const EAX_ENVIRONMENT_CITY = 16
  335. Global Const EAX_ENVIRONMENT_MOUNTAINS = 17
  336. Global Const EAX_ENVIRONMENT_QUARRY = 18
  337. Global Const EAX_ENVIRONMENT_PLAIN = 19
  338. Global Const EAX_ENVIRONMENT_PARKINGLOT = 20
  339. Global Const EAX_ENVIRONMENT_SEWERPIPE = 21
  340. Global Const EAX_ENVIRONMENT_UNDERWATER = 22
  341. Global Const EAX_ENVIRONMENT_DRUGGED = 23
  342. Global Const EAX_ENVIRONMENT_DIZZY = 24
  343. Global Const EAX_ENVIRONMENT_PSYCHOTIC = 25
  344. Global Const EAX_ENVIRONMENT_COUNT = 26 ' total number of environments
  345.  
  346. Global Const BASS_STREAMPROC_END = &H80000000 ' end of user stream flag
  347.  
  348. ' special STREAMPROCs
  349. Global Const STREAMPROC_DUMMY = 0 ' "dummy" stream
  350. Global Const STREAMPROC_PUSH = -1 ' push stream
  351.  
  352. ' BASS_StreamCreateFileUser file systems
  353. Global Const STREAMFILE_NOBUFFER = 0
  354. Global Const STREAMFILE_BUFFER = 1
  355. Global Const STREAMFILE_BUFFERPUSH = 2
  356.  
  357. Type BASS_FILEPROCS
  358.     close As Long
  359.     length As Long
  360.     read As Long
  361.     seek As Long
  362. End Type
  363.  
  364. ' BASS_StreamPutFileData options
  365. Global Const BASS_FILEDATA_END = 0 ' end & close the file
  366.  
  367. ' BASS_StreamGetFilePosition modes
  368. Global Const BASS_FILEPOS_CURRENT = 0
  369. Global Const BASS_FILEPOS_DECODE = BASS_FILEPOS_CURRENT
  370. Global Const BASS_FILEPOS_DOWNLOAD = 1
  371. Global Const BASS_FILEPOS_END = 2
  372. Global Const BASS_FILEPOS_START = 3
  373. Global Const BASS_FILEPOS_CONNECTED = 4
  374. Global Const BASS_FILEPOS_BUFFER = 5
  375.  
  376. ' BASS_ChannelSetSync types
  377. Global Const BASS_SYNC_POS = 0
  378. Global Const BASS_SYNC_END = 2
  379. Global Const BASS_SYNC_META = 4
  380. Global Const BASS_SYNC_SLIDE = 5
  381. Global Const BASS_SYNC_STALL = 6
  382. Global Const BASS_SYNC_DOWNLOAD = 7
  383. Global Const BASS_SYNC_FREE = 8
  384. Global Const BASS_SYNC_SETPOS = 11
  385. Global Const BASS_SYNC_MUSICPOS = 10
  386. Global Const BASS_SYNC_MUSICINST = 1
  387. Global Const BASS_SYNC_MUSICFX = 3
  388. Global Const BASS_SYNC_OGG_CHANGE = 12
  389. Global Const BASS_SYNC_MIXTIME = &H40000000 ' FLAG: sync at mixtime, else at playtime
  390. Global Const BASS_SYNC_ONETIME = &H80000000 ' FLAG: sync only once, else continuously
  391.  
  392. ' BASS_ChannelIsActive return values
  393. Global Const BASS_ACTIVE_STOPPED = 0
  394. Global Const BASS_ACTIVE_PLAYING = 1
  395. Global Const BASS_ACTIVE_STALLED = 2
  396. Global Const BASS_ACTIVE_PAUSED = 3
  397.  
  398. ' Channel attributes
  399. Global Const BASS_ATTRIB_FREQ = 1
  400. Global Const BASS_ATTRIB_VOL = 2
  401. Global Const BASS_ATTRIB_PAN = 3
  402. Global Const BASS_ATTRIB_EAXMIX = 4
  403. Global Const BASS_ATTRIB_NOBUFFER = 5
  404. Global Const BASS_ATTRIB_MUSIC_AMPLIFY = &H100
  405. Global Const BASS_ATTRIB_MUSIC_PANSEP = &H101
  406. Global Const BASS_ATTRIB_MUSIC_PSCALER = &H102
  407. Global Const BASS_ATTRIB_MUSIC_BPM = &H103
  408. Global Const BASS_ATTRIB_MUSIC_SPEED = &H104
  409. Global Const BASS_ATTRIB_MUSIC_VOL_GLOBAL = &H105
  410. Global Const BASS_ATTRIB_MUSIC_VOL_CHAN = &H200 ' + channel #
  411. Global Const BASS_ATTRIB_MUSIC_VOL_INST = &H300 ' + instrument #
  412.  
  413. ' BASS_ChannelGetData flags
  414. Global Const BASS_DATA_AVAILABLE = 0         ' query how much data is buffered
  415. Global Const BASS_DATA_FLOAT = &H40000000    ' flag: return floating-point sample data
  416. Global Const BASS_DATA_FFT256 = &H80000000   ' 256 sample FFT
  417. Global Const BASS_DATA_FFT512 = &H80000001   ' 512 FFT
  418. Global Const BASS_DATA_FFT1024 = &H80000002  ' 1024 FFT
  419. Global Const BASS_DATA_FFT2048 = &H80000003  ' 2048 FFT
  420. Global Const BASS_DATA_FFT4096 = &H80000004  ' 4096 FFT
  421. Global Const BASS_DATA_FFT8192 = &H80000005  ' 8192 FFT
  422. Global Const BASS_DATA_FFT16384 = &H80000006 ' 16384 FFT
  423. Global Const BASS_DATA_FFT_INDIVIDUAL = &H10 ' FFT flag: FFT for each channel, else all combined
  424. Global Const BASS_DATA_FFT_NOWINDOW = &H20   ' FFT flag: no Hanning window
  425. Global Const BASS_DATA_FFT_REMOVEDC = &H40   ' FFT flag: pre-remove DC bias
  426.  
  427. ' BASS_ChannelGetTags types : what's returned
  428. Global Const BASS_TAG_ID3 = 0                ' ID3v1 tags : TAG_ID3 structure
  429. Global Const BASS_TAG_ID3V2 = 1              ' ID3v2 tags : variable length block
  430. Global Const BASS_TAG_OGG = 2                ' OGG comments : series of null-terminated UTF-8 strings
  431. Global Const BASS_TAG_HTTP = 3               ' HTTP headers : series of null-terminated ANSI strings
  432. Global Const BASS_TAG_ICY = 4                ' ICY headers : series of null-terminated ANSI strings
  433. Global Const BASS_TAG_META = 5               ' ICY metadata : ANSI string
  434. Global Const BASS_TAG_APE = 6                ' APEv2 tags : series of null-terminated UTF-8 strings
  435. Global Const BASS_TAG_VENDOR = 9             ' OGG encoder : UTF-8 string
  436. Global Const BASS_TAG_LYRICS3 = 10           ' Lyric3v2 tag : ASCII string
  437. Global Const BASS_TAG_RIFF_INFO = &H100      ' RIFF "INFO" tags : series of null-terminated ANSI strings
  438. Global Const BASS_TAG_RIFF_BEXT = &H101      ' RIFF/BWF "bext" tags : TAG_BEXT structure
  439. Global Const BASS_TAG_RIFF_CART = &H102      ' RIFF/BWF "cart" tags : TAG_CART structure
  440. Global Const BASS_TAG_RIFF_DISP = &H103      ' RIFF "DISP" text tag : ANSI string
  441. Global Const BASS_TAG_APE_BINARY = &H1000    ' + index #, binary APEv2 tag : TAG_APE_BINARY structure
  442. Global Const BASS_TAG_MUSIC_NAME = &H10000   ' MOD music name : ANSI string
  443. Global Const BASS_TAG_MUSIC_ORDERS = &H10002 ' MOD order list : BYTE array of pattern numbers
  444. Global Const BASS_TAG_MUSIC_MESSAGE = &H10001 ' MOD message : ANSI string
  445. Global Const BASS_TAG_MUSIC_INST = &H10100   ' + instrument #, MOD instrument name : ANSI string
  446. Global Const BASS_TAG_MUSIC_SAMPLE = &H10300 ' + sample #, MOD sample name : ANSI string
  447.  
  448. ' ID3v1 tag structure
  449. Type TAG_ID3
  450.     id As String * 3
  451.     title As String * 30
  452.     artist As String * 30
  453.     album As String * 30
  454.     year As String * 4
  455.     comment As String * 30
  456.     genre As Byte
  457. End Type
  458.  
  459. ' Binary APEv2 tag structure
  460. Type TAG_APE_BINARY
  461.         key As Long
  462.         data As Long
  463.         length As Long
  464. End Type
  465.  
  466. ' BWF "bext" tag structure
  467. Type TAG_BEXT
  468.     Description As String * 256         ' description
  469.    Originator As String * 32           ' name of the originator
  470.    OriginatorReference As String * 32  ' reference of the originator
  471.    OriginationDate As String * 10      ' date of creation (yyyy-mm-dd)
  472.    OriginationTime As String * 8       ' time of creation (hh-mm-ss)
  473.    TimeReferenceLo As Long             ' low 32 bits of first sample count since midnight (little-endian)
  474.    TimeReferenceHi As Long             ' high 32 bits of first sample count since midnight (little-endian)
  475.    Version As Integer                  ' BWF version (little-endian)
  476.    UMID(64) As Byte                    ' SMPTE UMID
  477.    Reserved(190) As Byte
  478.     CodingHistory() As String           ' history
  479. End Type
  480.  
  481. ' BASS_ChannelGetLength/GetPosition/SetPosition modes
  482. Global Const BASS_POS_BYTE = 0          ' byte position
  483. Global Const BASS_POS_MUSIC_ORDER = 1   ' order.row position, MAKELONG(order,row)
  484. Global Const BASS_POS_DECODE = &H10000000 ' flag: get the decoding (not playing) position
  485. Global Const BASS_POS_DECODETO = &H20000000 ' flag: decode to the position instead of seeking
  486.  
  487. ' BASS_RecordSetInput flags
  488. Global Const BASS_INPUT_OFF = &H10000
  489. Global Const BASS_INPUT_ON = &H20000
  490.  
  491. Global Const BASS_INPUT_TYPE_MASK = &HFF000000
  492. Global Const BASS_INPUT_TYPE_UNDEF = &H0
  493. Global Const BASS_INPUT_TYPE_DIGITAL = &H1000000
  494. Global Const BASS_INPUT_TYPE_LINE = &H2000000
  495. Global Const BASS_INPUT_TYPE_MIC = &H3000000
  496. Global Const BASS_INPUT_TYPE_SYNTH = &H4000000
  497. Global Const BASS_INPUT_TYPE_CD = &H5000000
  498. Global Const BASS_INPUT_TYPE_PHONE = &H6000000
  499. Global Const BASS_INPUT_TYPE_SPEAKER = &H7000000
  500. Global Const BASS_INPUT_TYPE_WAVE = &H8000000
  501. Global Const BASS_INPUT_TYPE_AUX = &H9000000
  502. Global Const BASS_INPUT_TYPE_ANALOG = &HA000000
  503.  
  504. ' DX8 effect types, use with BASS_ChannelSetFX
  505. Global Const BASS_FX_DX8_CHORUS = 0
  506. Global Const BASS_FX_DX8_COMPRESSOR = 1
  507. Global Const BASS_FX_DX8_DISTORTION = 2
  508. Global Const BASS_FX_DX8_ECHO = 3
  509. Global Const BASS_FX_DX8_FLANGER = 4
  510. Global Const BASS_FX_DX8_GARGLE = 5
  511. Global Const BASS_FX_DX8_I3DL2REVERB = 6
  512. Global Const BASS_FX_DX8_PARAMEQ = 7
  513. Global Const BASS_FX_DX8_REVERB = 8
  514.  
  515. Type BASS_DX8_CHORUS
  516.     fWetDryMix As Single
  517.     fDepth As Single
  518.     fFeedback As Single
  519.     fFrequency As Single
  520.     lWaveform As Long   ' 0=triangle, 1=sine
  521.    fDelay As Single
  522.     lPhase As Long              ' BASS_DX8_PHASE_xxx
  523. End Type
  524.  
  525. Type BASS_DX8_COMPRESSOR
  526.     fGain As Single
  527.     fAttack As Single
  528.     fRelease As Single
  529.     fThreshold As Single
  530.     fRatio As Single
  531.     fPredelay As Single
  532. End Type
  533.  
  534. Type BASS_DX8_DISTORTION
  535.     fGain As Single
  536.     fEdge As Single
  537.     fPostEQCenterFrequency As Single
  538.     fPostEQBandwidth As Single
  539.     fPreLowpassCutoff As Single
  540. End Type
  541.  
  542. Type BASS_DX8_ECHO
  543.     fWetDryMix As Single
  544.     fFeedback As Single
  545.     fLeftDelay As Single
  546.     fRightDelay As Single
  547.     lPanDelay As Long
  548. End Type
  549.  
  550. Type BASS_DX8_FLANGER
  551.     fWetDryMix As Single
  552.     fDepth As Single
  553.     fFeedback As Single
  554.     fFrequency As Single
  555.     lWaveform As Long   ' 0=triangle, 1=sine
  556.    fDelay As Single
  557.     lPhase As Long              ' BASS_DX8_PHASE_xxx
  558. End Type
  559.  
  560. Type BASS_DX8_GARGLE
  561.     dwRateHz As Long               ' Rate of modulation in hz
  562.    dwWaveShape As Long            ' 0=triangle, 1=square
  563. End Type
  564.  
  565. Type BASS_DX8_I3DL2REVERB
  566.     lRoom As Long                    ' [-10000, 0]      default: -1000 mB
  567.    lRoomHF As Long                  ' [-10000, 0]      default: 0 mB
  568.    flRoomRolloffFactor As Single    ' [0.0, 10.0]      default: 0.0
  569.    flDecayTime As Single            ' [0.1, 20.0]      default: 1.49s
  570.    flDecayHFRatio As Single         ' [0.1, 2.0]       default: 0.83
  571.    lReflections As Long             ' [-10000, 1000]   default: -2602 mB
  572.    flReflectionsDelay As Single     ' [0.0, 0.3]       default: 0.007 s
  573.    lReverb As Long                  ' [-10000, 2000]   default: 200 mB
  574.    flReverbDelay As Single          ' [0.0, 0.1]       default: 0.011 s
  575.    flDiffusion As Single            ' [0.0, 100.0]     default: 100.0 %
  576.    flDensity As Single              ' [0.0, 100.0]     default: 100.0 %
  577.    flHFReference As Single          ' [20.0, 20000.0]  default: 5000.0 Hz
  578. End Type
  579.  
  580. Type BASS_DX8_PARAMEQ
  581.     fCenter As Single
  582.     fBandwidth As Single
  583.     fGain As Single
  584. End Type
  585.  
  586. Type BASS_DX8_REVERB
  587.     fInGain As Single                ' [-96.0,0.0]            default: 0.0 dB
  588.    fReverbMix As Single             ' [-96.0,0.0]            default: 0.0 db
  589.    fReverbTime As Single            ' [0.001,3000.0]         default: 1000.0 ms
  590.    fHighFreqRTRatio As Single       ' [0.001,0.999]          default: 0.001
  591. End Type
  592.  
  593. Global Const BASS_DX8_PHASE_NEG_180 = 0
  594. Global Const BASS_DX8_PHASE_NEG_90 = 1
  595. Global Const BASS_DX8_PHASE_ZERO = 2
  596. Global Const BASS_DX8_PHASE_90 = 3
  597. Global Const BASS_DX8_PHASE_180 = 4
  598.  
  599. Type GUID       ' used with BASS_Init - use VarPtr(guid) in clsid parameter
  600.    Data1 As Long
  601.     Data2 As Integer
  602.     Data3 As Integer
  603.     Data4(7) As Byte
  604. End Type
  605.  
  606.  
  607. Declare Function BASS_SetConfig Lib "bass.dll" (ByVal opt As Long, ByVal value As Long) As Long
  608. Declare Function BASS_GetConfig Lib "bass.dll" (ByVal opt As Long) As Long
  609. Declare Function BASS_SetConfigPtr Lib "bass.dll" (ByVal opt As Long, ByVal value As Any) As Long
  610. Declare Function BASS_GetConfigPtr Lib "bass.dll" (ByVal opt As Long) As Long
  611. Declare Function BASS_GetVersion Lib "bass.dll" () As Long
  612. Declare Function BASS_ErrorGetCode Lib "bass.dll" () As Long
  613. Declare Function BASS_GetDeviceInfo Lib "bass.dll" (ByVal device As Long, ByRef info As BASS_DEVICEINFO) As Long
  614. Declare Function BASS_Init Lib "bass.dll" (ByVal device As Long, ByVal freq As Long, ByVal flags As Long, ByVal win As Long, ByVal clsid As Long) As Long
  615. Declare Function BASS_SetDevice Lib "bass.dll" (ByVal device As Long) As Long
  616. Declare Function BASS_GetDevice Lib "bass.dll" () As Long
  617. Declare Function BASS_Free Lib "bass.dll" () As Long
  618. Declare Function BASS_GetDSoundObject Lib "bass.dll" (ByVal object As Long) As Long
  619. Declare Function BASS_GetInfo Lib "bass.dll" (ByRef info As BASS_INFO) As Long
  620. Declare Function BASS_Update Lib "bass.dll" (ByVal legnth As Long) As Long
  621. Declare Function BASS_GetCPU Lib "bass.dll" () As Single
  622. Declare Function BASS_Start Lib "bass.dll" () As Long
  623. Declare Function BASS_Stop Lib "bass.dll" () As Long
  624. Declare Function BASS_Pause Lib "bass.dll" () As Long
  625. Declare Function BASS_SetVolume Lib "bass.dll" (ByVal volume As Single) As Long
  626. Declare Function BASS_GetVolume Lib "bass.dll" () As Single
  627.  
  628. Declare Function BASS_PluginLoad Lib "bass.dll" (ByVal filename As String, ByVal flags As Long) As Long
  629. Declare Function BASS_PluginFree Lib "bass.dll" (ByVal handle As Long) As Long
  630. Declare Function BASS_PluginGetInfo_ Lib "bass.dll" Alias "BASS_PluginGetInfo" (ByVal handle As Long) As Long
  631.  
  632. Declare Function BASS_Set3DFactors Lib "bass.dll" (ByVal distf As Single, ByVal rollf As Single, ByVal doppf As Single) As Long
  633. Declare Function BASS_Get3DFactors Lib "bass.dll" (ByRef distf As Single, ByRef rollf As Single, ByRef doppf As Single) As Long
  634. Declare Function BASS_Set3DPosition Lib "bass.dll" (ByRef pos As Any, ByRef vel As Any, ByRef front As Any, ByRef top As Any) As Long
  635. Declare Function BASS_Get3DPosition Lib "bass.dll" (ByRef pos As Any, ByRef vel As Any, ByRef front As Any, ByRef top As Any) As Long
  636. Declare Function BASS_Apply3D Lib "bass.dll" () As Long
  637. Declare Function BASS_SetEAXParameters Lib "bass.dll" (ByVal env As Long, ByVal vol As Single, ByVal decay As Single, ByVal damp As Single) As Long
  638. Declare Function BASS_GetEAXParameters Lib "bass.dll" (ByRef env As Long, ByRef vol As Single, ByRef decay As Single, ByRef damp As Single) As Long
  639.  
  640. Declare Function BASS_MusicLoad64 Lib "bass.dll" Alias "BASS_MusicLoad" (ByVal mem As Long, ByVal file As Any, ByVal offset As Long, ByVal offsethigh As Long, ByVal length As Long, ByVal flags As Long, ByVal freq As Long) As Long
  641. Declare Function BASS_MusicFree Lib "bass.dll" (ByVal handle As Long) As Long
  642.  
  643. Declare Function BASS_SampleLoad64 Lib "bass.dll" Alias "BASS_SampleLoad" (ByVal mem As Long, ByVal file As Any, ByVal offset As Long, ByVal offsethigh As Long, ByVal length As Long, ByVal max As Long, ByVal flags As Long) As Long
  644. Declare Function BASS_SampleCreate Lib "bass.dll" (ByVal length As Long, ByVal freq As Long, ByVal chans As Long, ByVal max As Long, ByVal flags As Long) As Long
  645. Declare Function BASS_SampleFree Lib "bass.dll" (ByVal handle As Long) As Long
  646. Declare Function BASS_SampleSetData Lib "bass.dll" (ByVal handle As Long, ByRef buffer As Any) As Long
  647. Declare Function BASS_SampleGetData Lib "bass.dll" (ByVal handle As Long, ByRef buffer As Any) As Long
  648. Declare Function BASS_SampleGetInfo Lib "bass.dll" (ByVal handle As Long, ByRef info As BASS_SAMPLE) As Long
  649. Declare Function BASS_SampleSetInfo Lib "bass.dll" (ByVal handle As Long, ByRef info As BASS_SAMPLE) As Long
  650. Declare Function BASS_SampleGetChannel Lib "bass.dll" (ByVal handle As Long, ByVal onlynew As Long) As Long
  651. Declare Function BASS_SampleGetChannels Lib "bass.dll" (ByVal handle As Long, ByRef CHANNELS As Long) As Long
  652. Declare Function BASS_SampleStop Lib "bass.dll" (ByVal handle As Long) As Long
  653.  
  654. Declare Function BASS_StreamCreate Lib "bass.dll" (ByVal freq As Long, ByVal chans As Long, ByVal flags As Long, ByVal proc As Long, ByVal user As Long) As Long
  655. Declare Function BASS_StreamCreateFile64 Lib "bass.dll" Alias "BASS_StreamCreateFile" (ByVal mem As Long, ByVal file As Any, ByVal offset As Long, ByVal offsethigh As Long, ByVal length As Long, ByVal lengthhigh As Long, ByVal flags As Long) As Long
  656. Declare Function BASS_StreamCreateURL Lib "bass.dll" (ByVal url As String, ByVal offset As Long, ByVal flags As Long, ByVal proc As Long, ByVal user As Long) As Long
  657. Declare Function BASS_StreamCreateFileUser Lib "bass.dll" (ByVal system As Long, ByVal flags As Long, ByVal procs As Long, ByVal user As Long) As Long
  658. Declare Function BASS_StreamFree Lib "bass.dll" (ByVal handle As Long) As Long
  659. Declare Function BASS_StreamGetFilePosition Lib "bass.dll" (ByVal handle As Long, ByVal mode As Long) As Long
  660. Declare Function BASS_StreamPutData Lib "bass.dll" (ByVal handle As Long, ByRef buffer As Any, ByVal length As Long) As Long
  661. Declare Function BASS_StreamPutFileData Lib "bass.dll" (ByVal handle As Long, ByRef buffer As Any, ByVal length As Long) As Long
  662.  
  663. Declare Function BASS_RecordGetDeviceInfo Lib "bass.dll" (ByVal device As Long, ByRef info As BASS_DEVICEINFO) As Long
  664. Declare Function BASS_RecordInit Lib "bass.dll" (ByVal device As Long) As Long
  665. Declare Function BASS_RecordSetDevice Lib "bass.dll" (ByVal device As Long) As Long
  666. Declare Function BASS_RecordGetDevice Lib "bass.dll" () As Long
  667. Declare Function BASS_RecordFree Lib "bass.dll" () As Long
  668. Declare Function BASS_RecordGetInfo Lib "bass.dll" (ByRef info As BASS_RECORDINFO) As Long
  669. Declare Function BASS_RecordGetInputName Lib "bass.dll" (ByVal inputn As Long) As Long
  670. Declare Function BASS_RecordSetInput Lib "bass.dll" (ByVal inputn As Long, ByVal flags As Long, ByVal volume As Single) As Long
  671. Declare Function BASS_RecordGetInput Lib "bass.dll" (ByVal inputn As Long, ByRef volume As Single) As Long
  672. Declare Function BASS_RecordStart Lib "bass.dll" (ByVal freq As Long, ByVal chans As Long, ByVal flags As Long, ByVal proc As Long, ByVal user As Long) As Long
  673.  
  674. Declare Function BASS_ChannelBytes2Seconds64 Lib "bass.dll" Alias "BASS_ChannelBytes2Seconds" (ByVal handle As Long, ByVal pos As Long, ByVal poshigh As Long) As Double
  675. Declare Function BASS_ChannelSeconds2Bytes Lib "bass.dll" (ByVal handle As Long, ByVal pos As Double) As Long
  676. Declare Function BASS_ChannelGetDevice Lib "bass.dll" (ByVal handle As Long) As Long
  677. Declare Function BASS_ChannelSetDevice Lib "bass.dll" (ByVal handle As Long, ByVal device As Long) As Long
  678. Declare Function BASS_ChannelIsActive Lib "bass.dll" (ByVal handle As Long) As Long
  679. Declare Function BASS_ChannelGetInfo Lib "bass.dll" (ByVal handle As Long, ByRef info As BASS_CHANNELINFO) As Long
  680. Declare Function BASS_ChannelGetTags Lib "bass.dll" (ByVal handle As Long, ByVal tags As Long) As Long
  681. Declare Function BASS_ChannelFlags Lib "bass.dll" (ByVal handle As Long, ByVal flags As Long, ByVal mask As Long) As Long
  682. Declare Function BASS_ChannelUpdate Lib "bass.dll" (ByVal handle As Long, ByVal length As Long) As Long
  683. Declare Function BASS_ChannelLock Lib "bass.dll" (ByVal handle As Long, ByVal lock_ As Long) As Long
  684. Declare Function BASS_ChannelPlay Lib "bass.dll" (ByVal handle As Long, ByVal restart As Long) As Long
  685. Declare Function BASS_ChannelStop Lib "bass.dll" (ByVal handle As Long) As Long
  686. Declare Function BASS_ChannelPause Lib "bass.dll" (ByVal handle As Long) As Long
  687. Declare Function BASS_ChannelSetAttribute Lib "bass.dll" (ByVal handle As Long, ByVal attrib As Long, ByVal value As Single) As Long
  688. Declare Function BASS_ChannelGetAttribute Lib "bass.dll" (ByVal handle As Long, ByVal attrib As Long, ByRef value As Single) As Long
  689. Declare Function BASS_ChannelSlideAttribute Lib "bass.dll" (ByVal handle As Long, ByVal attrib As Long, ByVal value As Single, ByVal time As Long) As Long
  690. Declare Function BASS_ChannelIsSliding Lib "bass.dll" (ByVal handle As Long, ByVal attrib As Long) As Long
  691. Declare Function BASS_ChannelSet3DAttributes Lib "bass.dll" (ByVal handle As Long, ByVal mode As Long, ByVal min As Single, ByVal max As Single, ByVal iangle As Long, ByVal oangle As Long, ByVal outvol As Single) As Long
  692. Declare Function BASS_ChannelGet3DAttributes Lib "bass.dll" (ByVal handle As Long, ByRef mode As Long, ByRef min As Single, ByRef max As Single, ByRef iangle As Long, ByRef oangle As Long, ByRef outvol As Single) As Long
  693. Declare Function BASS_ChannelSet3DPosition Lib "bass.dll" (ByVal handle As Long, ByRef pos As Any, ByRef orient As Any, ByRef vel As Any) As Long
  694. Declare Function BASS_ChannelGet3DPosition Lib "bass.dll" (ByVal handle As Long, ByRef pos As Any, ByRef orient As Any, ByRef vel As Any) As Long
  695. Declare Function BASS_ChannelGetLength Lib "bass.dll" (ByVal handle As Long, ByVal mode As Long) As Long
  696. Declare Function BASS_ChannelSetPosition64 Lib "bass.dll" Alias "BASS_ChannelSetPosition" (ByVal handle As Long, ByVal pos As Long, ByVal poshigh As Long, ByVal mode As Long) As Long
  697. Declare Function BASS_ChannelGetPosition Lib "bass.dll" (ByVal handle As Long, ByVal mode As Long) As Long
  698. Declare Function BASS_ChannelGetLevel Lib "bass.dll" (ByVal handle As Long) As Long
  699. Declare Function BASS_ChannelGetData Lib "bass.dll" (ByVal handle As Long, ByRef buffer As Any, ByVal length As Long) As Long
  700. Declare Function BASS_ChannelSetSync64 Lib "bass.dll" Alias "BASS_ChannelSetSync" (ByVal handle As Long, ByVal type_ As Long, ByVal param As Long, ByVal paramhigh As Long, ByVal proc As Long, ByVal user As Long) As Long
  701. Declare Function BASS_ChannelRemoveSync Lib "bass.dll" (ByVal handle As Long, ByVal sync As Long) As Long
  702. Declare Function BASS_ChannelSetDSP Lib "bass.dll" (ByVal handle As Long, ByVal proc As Long, ByVal user As Long, ByVal priority As Long) As Long
  703. Declare Function BASS_ChannelRemoveDSP Lib "bass.dll" (ByVal handle As Long, ByVal dsp As Long) As Long
  704. Declare Function BASS_ChannelSetLink Lib "bass.dll" (ByVal handle As Long, ByVal chan As Long) As Long
  705. Declare Function BASS_ChannelRemoveLink Lib "bass.dll" (ByVal handle As Long, ByVal chan As Long) As Long
  706. Declare Function BASS_ChannelSetFX Lib "bass.dll" (ByVal handle As Long, ByVal type_ As Long, ByVal priority As Long) As Long
  707. Declare Function BASS_ChannelRemoveFX Lib "bass.dll" (ByVal handle As Long, ByVal fx As Long) As Long
  708. Declare Function BASS_FXSetParameters Lib "bass.dll" (ByVal handle As Long, ByRef par As Any) As Long
  709. Declare Function BASS_FXGetParameters Lib "bass.dll" (ByVal handle As Long, ByRef par As Any) As Long
  710. Declare Function BASS_FXReset Lib "bass.dll" (ByVal handle As Long) As Long
  711.  
  712. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal length As Long)
  713. Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Long) As Long
  714.  
  715. Public Function BASS_SPEAKER_N(ByVal n As Long) As Long
  716. BASS_SPEAKER_N = n * (2 ^ 24)
  717. End Function
  718.  
  719. ' 32-bit wrappers for 64-bit BASS functions
  720. Function BASS_MusicLoad(ByVal mem As Long, ByVal file As Long, ByVal offset As Long, ByVal length As Long, ByVal flags As Long, ByVal freq As Long) As Long
  721. BASS_MusicLoad = BASS_MusicLoad64(mem, file, offset, 0, length, flags Or BASS_UNICODE, freq)
  722. End Function
  723.  
  724. Function BASS_SampleLoad(ByVal mem As Long, ByVal file As Long, ByVal offset As Long, ByVal length As Long, ByVal max As Long, ByVal flags As Long) As Long
  725. BASS_SampleLoad = BASS_SampleLoad64(mem, file, offset, 0, length, max, flags Or BASS_UNICODE)
  726. End Function
  727.  
  728. Function BASS_StreamCreateFile(ByVal mem As Long, ByVal file As Long, ByVal offset As Long, ByVal length As Long, ByVal flags As Long) As Long
  729. BASS_StreamCreateFile = BASS_StreamCreateFile64(mem, file, offset, 0, length, 0, flags Or BASS_UNICODE)
  730. End Function
  731.  
  732. Function BASS_ChannelBytes2Seconds(ByVal handle As Long, ByVal pos As Long) As Double
  733. BASS_ChannelBytes2Seconds = BASS_ChannelBytes2Seconds64(handle, pos, 0)
  734. End Function
  735.  
  736. Function BASS_ChannelSetPosition(ByVal handle As Long, ByVal pos As Long, ByVal mode As Long) As Long
  737. BASS_ChannelSetPosition = BASS_ChannelSetPosition64(handle, pos, 0, mode)
  738. End Function
  739.  
  740. Function BASS_ChannelSetSync(ByVal handle As Long, ByVal type_ As Long, ByVal param As Long, ByVal proc As Long, ByVal user As Long) As Long
  741. BASS_ChannelSetSync = BASS_ChannelSetSync64(handle, type_, param, 0, proc, user)
  742. End Function
  743.  
  744. ' BASS_PluginGetInfo wrappers
  745. Function BASS_PluginGetInfo(ByVal handle As Long) As BASS_PLUGININFO
  746. Dim pinfo As BASS_PLUGININFO, plug As Long
  747. plug = BASS_PluginGetInfo_(handle)
  748. If plug Then
  749.     Call CopyMemory(pinfo, ByVal plug, LenB(pinfo))
  750. End If
  751. BASS_PluginGetInfo = pinfo
  752. End Function
  753.  
  754. Function BASS_PluginGetInfoFormat(ByVal handle As Long, ByVal index As Long) As BASS_PLUGINFORM
  755. Dim pform As BASS_PLUGINFORM, plug As Long
  756. plug = BASS_PluginGetInfo(handle).formats
  757. If plug Then
  758.     plug = plug + (index * LenB(pform))
  759.     Call CopyMemory(pform, ByVal plug, LenB(pform))
  760. End If
  761. BASS_PluginGetInfoFormat = pform
  762. End Function
  763.  
  764. ' callback functions
  765. Function STREAMPROC(ByVal handle As Long, ByVal buffer As Long, ByVal length As Long, ByVal user As Long) As Long
  766.    
  767.     'CALLBACK FUNCTION !!!
  768.    
  769.     ' User stream callback function
  770.    ' NOTE: A stream function should obviously be as quick
  771.    ' as possible, other streams (and MOD musics) can't be mixed until it's finished.
  772.    ' handle : The stream that needs writing
  773.    ' buffer : Buffer to write the samples in
  774.    ' length : Number of bytes to write
  775.    ' user   : The 'user' parameter value given when calling BASS_StreamCreate
  776.    ' RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end
  777.    '          the stream.
  778.    
  779. End Function
  780.  
  781. Sub DOWNLOADPROC(ByVal buffer As Long, ByVal length As Long, ByVal user As Long)
  782.    
  783.     'CALLBACK FUNCTION !!!
  784.  
  785.     ' Internet stream download callback function.
  786.    ' buffer : Buffer containing the downloaded data... NULL=end of download
  787.    ' length : Number of bytes in the buffer
  788.    ' user   : The 'user' parameter given when calling BASS_StreamCreateURL
  789.    
  790. End Sub
  791.  
  792. Sub SYNCPROC(ByVal handle As Long, ByVal channel As Long, ByVal data As Long, ByVal user As Long)
  793.    
  794.     'CALLBACK FUNCTION !!!
  795.    
  796.     'Similarly in here, write what to do when sync function
  797.    'is called, i.e screen flash etc.
  798.    
  799.     ' NOTE: a sync callback function should be very quick as other
  800.    ' syncs cannot be processed until it has finished.
  801.    ' handle : The sync that has occured
  802.    ' channel: Channel that the sync occured in
  803.    ' data   : Additional data associated with the sync's occurance
  804.    ' user   : The 'user' parameter given when calling BASS_ChannelSetSync */
  805.    
  806. End Sub
  807.  
  808. Sub DSPPROC(ByVal handle As Long, ByVal channel As Long, ByVal buffer As Long, ByVal length As Long, ByVal user As Long)
  809.  
  810.     'CALLBACK FUNCTION !!!
  811.  
  812.     ' VB doesn't support pointers, so you should copy the buffer into an array,
  813.    ' process it, and then copy it back into the buffer.
  814.  
  815.     ' DSP callback function. NOTE: A DSP function should obviously be as quick as
  816.    ' possible... other DSP functions, streams and MOD musics can not be processed
  817.    ' until it's finished.
  818.    ' handle : The DSP handle
  819.    ' channel: Channel that the DSP is being applied to
  820.    ' buffer : Buffer to apply the DSP to
  821.    ' length : Number of bytes in the buffer
  822.    ' user   : The 'user' parameter given when calling BASS_ChannelSetDSP
  823.    
  824. End Sub
  825.  
  826. Function RECORDPROC(ByVal handle As Long, ByVal buffer As Long, ByVal length As Long, ByVal user As Long) As Long
  827.  
  828.     'CALLBACK FUNCTION !!!
  829.  
  830.     ' Recording callback function.
  831.    ' handle : The recording handle
  832.    ' buffer : Buffer containing the recorded samples
  833.    ' length : Number of bytes
  834.    ' user   : The 'user' parameter value given when calling BASS_RecordStart
  835.    ' RETURN : BASSTRUE = continue recording, BASSFALSE = stop
  836.  
  837. End Function
  838.  
  839. ' User file stream callback functions (BASS_FILEPROCS)
  840. Sub FILECLOSEPROC(ByVal user As Long)
  841.  
  842. End Sub
  843.  
  844. Function FILELENPROC(ByVal user As Long) As Currency ' ???
  845.  
  846. End Function
  847.  
  848. Function FILEREADPROC(ByVal buffer As Long, ByVal length As Long, ByVal user As Long) As Long
  849.  
  850. End Function
  851.  
  852. Function FILESEEKPROC(ByVal offset As Long, ByVal offsethigh As Long, ByVal user As Long) As Long
  853.  
  854. End Function
  855.  
  856.  
  857. Function BASS_SetEAXPreset(preset) As Long
  858. ' This function is a workaround, because VB doesn't support multiple comma seperated
  859. ' paramaters for each Global Const, simply pass the EAX_ENVIRONMENT_xxx value to this function
  860. ' instead of BASS_SetEAXParameters as you would do in C/C++
  861. Select Case preset
  862.     Case EAX_ENVIRONMENT_GENERIC
  863.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_GENERIC, 0.5, 1.493, 0.5)
  864.     Case EAX_ENVIRONMENT_PADDEDCELL
  865.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_PADDEDCELL, 0.25, 0.1, 0)
  866.     Case EAX_ENVIRONMENT_ROOM
  867.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_ROOM, 0.417, 0.4, 0.666)
  868.     Case EAX_ENVIRONMENT_BATHROOM
  869.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_BATHROOM, 0.653, 1.499, 0.166)
  870.     Case EAX_ENVIRONMENT_LIVINGROOM
  871.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_LIVINGROOM, 0.208, 0.478, 0)
  872.     Case EAX_ENVIRONMENT_STONEROOM
  873.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_STONEROOM, 0.5, 2.309, 0.888)
  874.     Case EAX_ENVIRONMENT_AUDITORIUM
  875.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_AUDITORIUM, 0.403, 4.279, 0.5)
  876.     Case EAX_ENVIRONMENT_CONCERTHALL
  877.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_CONCERTHALL, 0.5, 3.961, 0.5)
  878.     Case EAX_ENVIRONMENT_CAVE
  879.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_CAVE, 0.5, 2.886, 1.304)
  880.     Case EAX_ENVIRONMENT_ARENA
  881.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_ARENA, 0.361, 7.284, 0.332)
  882.     Case EAX_ENVIRONMENT_HANGAR
  883.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_HANGAR, 0.5, 10, 0.3)
  884.     Case EAX_ENVIRONMENT_CARPETEDHALLWAY
  885.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153, 0.259, 2)
  886.     Case EAX_ENVIRONMENT_HALLWAY
  887.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_HALLWAY, 0.361, 1.493, 0)
  888.     Case EAX_ENVIRONMENT_STONECORRIDOR
  889.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_STONECORRIDOR, 0.444, 2.697, 0.638)
  890.     Case EAX_ENVIRONMENT_ALLEY
  891.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_ALLEY, 0.25, 1.752, 0.776)
  892.     Case EAX_ENVIRONMENT_FOREST
  893.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_FOREST, 0.111, 3.145, 0.472)
  894.     Case EAX_ENVIRONMENT_CITY
  895.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_CITY, 0.111, 2.767, 0.224)
  896.     Case EAX_ENVIRONMENT_MOUNTAINS
  897.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_MOUNTAINS, 0.194, 7.841, 0.472)
  898.     Case EAX_ENVIRONMENT_QUARRY
  899.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_QUARRY, 1, 1.499, 0.5)
  900.     Case EAX_ENVIRONMENT_PLAIN
  901.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_PLAIN, 0.097, 2.767, 0.224)
  902.     Case EAX_ENVIRONMENT_PARKINGLOT
  903.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_PARKINGLOT, 0.208, 1.652, 1.5)
  904.     Case EAX_ENVIRONMENT_SEWERPIPE
  905.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_SEWERPIPE, 0.652, 2.886, 0.25)
  906.     Case EAX_ENVIRONMENT_UNDERWATER
  907.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_UNDERWATER, 1, 1.499, 0)
  908.     Case EAX_ENVIRONMENT_DRUGGED
  909.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_DRUGGED, 0.875, 8.392, 1.388)
  910.     Case EAX_ENVIRONMENT_DIZZY
  911.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_DIZZY, 0.139, 17.234, 0.666)
  912.     Case EAX_ENVIRONMENT_PSYCHOTIC
  913.         BASS_SetEAXPreset = BASS_SetEAXParameters(EAX_ENVIRONMENT_PSYCHOTIC, 0.486, 7.563, 0.806)
  914. End Select
  915. End Function
  916.  
  917. Public Function LoByte(ByVal lparam As Long) As Long
  918. LoByte = lparam And &HFF&
  919. End Function
  920. Public Function HiByte(ByVal lparam As Long) As Long
  921. HiByte = (lparam And &HFF00&) / &H100&
  922. End Function
  923. Public Function LoWord(ByVal lparam As Long) As Long
  924. LoWord = lparam And &HFFFF&
  925. End Function
  926. Public Function HiWord(ByVal lparam As Long) As Long
  927. If lparam < 0 Then
  928.     HiWord = (lparam \ &H10000 - 1) And &HFFFF&
  929. Else
  930.     HiWord = lparam \ &H10000
  931. End If
  932. End Function
  933. Function MakeWord(ByVal LoByte As Long, ByVal HiByte As Long) As Long
  934. MakeWord = (LoByte And &HFF&) Or ((HiByte And &HFF&) * &H100&)
  935. End Function
  936. Function MakeLong(ByVal LoWord As Long, ByVal HiWord As Long) As Long
  937. MakeLong = LoWord And &HFFFF&
  938. HiWord = HiWord And &HFFFF&
  939. If HiWord And &H8000& Then
  940.     MakeLong = MakeLong Or (((HiWord And &H7FFF&) * &H10000) Or &H80000000)
  941. Else
  942.     MakeLong = MakeLong Or (HiWord * &H10000)
  943. End If
  944. End Function
  945.  
  946. Public Function VBStrFromAnsiPtr(ByVal lpStr As Long) As String
  947. Dim bStr() As Byte
  948. Dim cChars As Long
  949. On Error Resume Next
  950. ' Get the number of characters in the buffer
  951. cChars = lstrlen(lpStr)
  952. If cChars Then
  953.     ' Resize the byte array
  954.    ReDim bStr(0 To cChars - 1) As Byte
  955.     ' Grab the ANSI buffer
  956.    Call CopyMemory(bStr(0), ByVal lpStr, cChars)
  957. End If
  958. ' Now convert to a VB Unicode string
  959. VBStrFromAnsiPtr = StrConv(bStr, vbUnicode)
  960. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement