home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / ModBass / vb / Bass.bas < prev    next >
Encoding:
BASIC Source File  |  2000-01-24  |  58.4 KB  |  1,137 lines

  1. Attribute VB_Name = "modBass"
  2. 'BASS 0.8 Multimedia Library
  3. '-----------------------------
  4. '(c) 1999-2000 Ian Luck.
  5. 'Please report bugs/suggestions/etc... to bass@un4seen.com
  6.  
  7. 'Visual Basic API Version 0.8 by Adam Hoult
  8. '------------------------------------------
  9. 'Questions, suggestions, etc. regarding the Visual Basic API
  10. 'can be sent to admin@daedalusd.com
  11.  
  12. 'NOTE: This unit will only work with BASS.DLL version 0.8
  13. 'Check http://www.un4seen.com/music for any later
  14. 'versions of BASS.BAS
  15.  
  16. ' HISTORY - UK Dates (DD/MM/YYYY)
  17. ' -------------------------------
  18. ' 12/01/2000 BASS.BAS 0.8
  19. '            Happy new Year !! =) Updated for BASS 0.8
  20. '            Tons of stuff added, especially to do with
  21. '            Directsound objects etc plus some other
  22. '            General Enhancements.
  23. '
  24. ' 22/09/1999 BASS.BAS 0.7
  25. '            Updated the BAS file for use with the new
  26. '            version of BASS (0.7). Added the extra A3D
  27. '            calls, plus the new POSRESET flag. Also
  28. '            updated the needed functions.
  29. '
  30. ' 07/09/1999 BASS.BAS 0.6
  31. '            The first BASS API for Visual Basic
  32. '            Tested with VB5, but should also work
  33. '            properly under VB4 & VB6 (Not sure about
  34. '            VB3 due to the use of callbacks.)
  35.  
  36. Global Const BASSTRUE As Integer = 1   'Use this instead of VB Booleans
  37. Global Const BASSFALSE As Integer = 0  'Use this instead of VB Booleans
  38.  
  39. '***********************************************
  40. '* Error codes returned by BASS_GetErrorCode() *
  41. '***********************************************
  42. Global Const BASS_OK = 0               'all is OK
  43. Global Const BASS_ERROR_MEM = 1        'memory error
  44. Global Const BASS_ERROR_FILEOPEN = 2   'can't open the file
  45. Global Const BASS_ERROR_DRIVER = 3     'can't find a free sound driver
  46. Global Const BASS_ERROR_BUFLOST = 4    'the sample buffer was lost - please report this!
  47. Global Const BASS_ERROR_HANDLE = 5     'invalid handle
  48. Global Const BASS_ERROR_FORMAT = 6     'unsupported format
  49. Global Const BASS_ERROR_POSITION = 7   'invalid playback position
  50. Global Const BASS_ERROR_INIT = 8       'BASS_Init has not been successfully called
  51. Global Const BASS_ERROR_START = 9      'BASS_Start has not been successfully called
  52. Global Const BASS_ERROR_INITCD = 10    'can't initialize CD
  53. Global Const BASS_ERROR_CDINIT = 11    'BASS_CDInit has not been successfully called
  54. Global Const BASS_ERROR_NOCD = 12      'no CD in drive
  55. Global Const BASS_ERROR_CDTRACK = 13   'can't play the selected CD track
  56. Global Const BASS_ERROR_ALREADY = 14   'already initialized
  57. Global Const BASS_ERROR_CDVOL = 15     'CD has no volume control
  58. Global Const BASS_ERROR_NOPAUSE = 16   'not paused
  59. Global Const BASS_ERROR_NOTAUDIO = 17  'not an audio track
  60. Global Const BASS_ERROR_NOCHAN = 18    'can't get a free channel
  61. Global Const BASS_ERROR_ILLTYPE = 19   'an illegal type was specified
  62. Global Const BASS_ERROR_ILLPARAM = 20  'an illegal parameter was specified
  63. Global Const BASS_ERROR_NO3D = 21      'no 3D support
  64. Global Const BASS_ERROR_NOEAX = 22     'no EAX support
  65. Global Const BASS_ERROR_DEVICE = 23    'illegal device number
  66. Global Const BASS_ERROR_NOPLAY = 24    'not playing
  67. Global Const BASS_ERROR_FREQ = 25      'illegal sample rate
  68. Global Const BASS_ERROR_NOA3D = 26     'A3D.DLL is not installed
  69. Global Const BASS_ERROR_NOTFILE = 27   'the stream is not a file stream (WAV/MP3)
  70. Global Const BASS_ERROR_NOHW = 29      'no hardware voices available
  71. Global Const BASS_ERROR_UNKNOWN = -1   'some other mystery error
  72.  
  73. '**********************
  74. '* Device setup flags *
  75. '**********************
  76. Global Const BASS_DEVICE_8BITS = 1     'use 8 bit resolution, else 16 bit
  77. Global Const BASS_DEVICE_MONO = 2      'use mono, else stereo
  78. Global Const BASS_DEVICE_3D = 4        'enable 3D functionality
  79. ' If the BASS_DEVICE_3D flag is not specified when initilizing BASS,
  80. ' then the 3D flags (BASS_SAMPLE_3D and BASS_MUSIC_3D) are ignored when
  81. ' loading/creating a sample/stream/music.
  82. Global Const BASS_DEVICE_A3D = 8       'enable A3D functionality
  83. Global Const BASS_DEVICE_NOSYNC = 16       'disable synchronizers
  84.  
  85. '***********************************
  86. '* BASS_INFO flags (from DSOUND.H) *
  87. '***********************************
  88. Global Const DSCAPS_CONTINUOUSRATE = 16
  89. ' supports all sample rates between min/maxrate
  90. Global Const DSCAPS_EMULDRIVER = 32
  91. ' device does NOT have hardware DirectSound support
  92. Global Const DSCAPS_CERTIFIED = 64
  93. ' device driver has been certified by Microsoft
  94. ' The following flags tell what type of samples are supported by HARDWARE
  95. ' mixing, all these formats are supported by SOFTWARE mixing
  96. Global Const DSCAPS_SECONDARYMONO = 256    ' mono
  97. Global Const DSCAPS_SECONDARYSTEREO = 512  ' stereo
  98. Global Const DSCAPS_SECONDARY8BIT = 1024   ' 8 bit
  99. Global Const DSCAPS_SECONDARY16BIT = 2048  ' 16 bit
  100.  
  101. '***************
  102. '* Music flags *
  103. '***************
  104. Global Const BASS_MUSIC_RAMP = 1       ' normal ramping
  105. Global Const BASS_MUSIC_RAMPS = 2      ' sensitive ramping
  106. ' Ramping doesn't take a lot of extra processing and improves
  107. ' the sound quality by removing "clicks". Sensitive ramping will
  108. ' leave sharp attacked samples, unlike normal ramping.
  109. Global Const BASS_MUSIC_LOOP = 4       ' loop music
  110. Global Const BASS_MUSIC_FT2MOD = 16    ' play .MOD as FastTracker 2 does
  111. Global Const BASS_MUSIC_PT1MOD = 32    ' play .MOD as ProTracker 1 does
  112. Global Const BASS_MUSIC_MONO = 64      ' force mono mixing (less CPU usage)
  113. Global Const BASS_MUSIC_3D = 128       ' enable 3D functionality
  114. Global Const BASS_MUSIC_POSRESET = 256 ' stop all notes when moving position
  115.  
  116. '*********************
  117. '* Sample info flags *
  118. '*********************
  119. Global Const BASS_SAMPLE_8BITS = 1             ' 8 bit, else 16 bit
  120. Global Const BASS_SAMPLE_MONO = 2              ' mono, else stereo
  121. Global Const BASS_SAMPLE_LOOP = 4              ' looped
  122. Global Const BASS_SAMPLE_3D = 8                ' 3D functionality enabled
  123. Global Const BASS_SAMPLE_SOFTWARE = 16         ' it's NOT using hardware mixing
  124. Global Const BASS_SAMPLE_MUTEMAX = 32          ' muted at max distance (3D only)
  125. Global Const BASS_SAMPLE_VAM = 64              ' uses the DX7 voice allocation & management
  126. Global Const BASS_SAMPLE_OVER_VOL = 65536      ' override lowest volume
  127. Global Const BASS_SAMPLE_OVER_POS = 131072     ' override longest playing
  128. Global Const BASS_SAMPLE_OVER_DIST = 196608    ' override furthest from listener (3D only)
  129.  
  130. Global Const BASS_MP3_HALFRATE = 65536         ' reduced quality MP3 (half sample rate)
  131. Global Const BASS_MP3_SETPOS = 131072          ' enable BASS_ChannelSetPosition on the MP3
  132.  
  133. '********************
  134. '* 3D channel modes *
  135. '********************
  136. Global Const BASS_3DMODE_NORMAL = 0
  137. ' normal 3D processing
  138. Global Const BASS_3DMODE_RELATIVE = 1
  139. ' The channel's 3D position (position/velocity/orientation) are relative to
  140. ' the listener. When the listener's position/velocity/orientation is changed
  141. ' with BASS_Set3DPosition, the channel's position relative to the listener does
  142. ' not change.
  143. Global Const BASS_3DMODE_OFF = 2
  144. ' Turn off 3D processing on the channel, the sound will be played
  145. ' in the center.
  146.  
  147.  
  148. '****************************************************
  149. '* EAX environments, use with BASS_SetEAXParameters *
  150. '****************************************************
  151. Global Const EAX_ENVIRONMENT_GENERIC = 0
  152. Global Const EAX_ENVIRONMENT_PADDEDCELL = 1
  153. Global Const EAX_ENVIRONMENT_ROOM = 2
  154. Global Const EAX_ENVIRONMENT_BATHROOM = 3
  155. Global Const EAX_ENVIRONMENT_LIVINGROOM = 4
  156. Global Const EAX_ENVIRONMENT_STONEROOM = 5
  157. Global Const EAX_ENVIRONMENT_AUDITORIUM = 6
  158. Global Const EAX_ENVIRONMENT_CONCERTHALL = 7
  159. Global Const EAX_ENVIRONMENT_CAVE = 8
  160. Global Const EAX_ENVIRONMENT_ARENA = 9
  161. Global Const EAX_ENVIRONMENT_HANGAR = 10
  162. Global Const EAX_ENVIRONMENT_CARPETEDHALLWAY = 11
  163. Global Const EAX_ENVIRONMENT_HALLWAY = 12
  164. Global Const EAX_ENVIRONMENT_STONECORRIDOR = 13
  165. Global Const EAX_ENVIRONMENT_ALLEY = 14
  166. Global Const EAX_ENVIRONMENT_FOREST = 15
  167. Global Const EAX_ENVIRONMENT_CITY = 16
  168. Global Const EAX_ENVIRONMENT_MOUNTAINS = 17
  169. Global Const EAX_ENVIRONMENT_QUARRY = 18
  170. Global Const EAX_ENVIRONMENT_PLAIN = 19
  171. Global Const EAX_ENVIRONMENT_PARKINGLOT = 20
  172. Global Const EAX_ENVIRONMENT_SEWERPIPE = 21
  173. Global Const EAX_ENVIRONMENT_UNDERWATER = 22
  174. Global Const EAX_ENVIRONMENT_DRUGGED = 23
  175. Global Const EAX_ENVIRONMENT_DIZZY = 24
  176. Global Const EAX_ENVIRONMENT_PSYCHOTIC = 25
  177. ' total number of environments
  178. Global Const EAX_ENVIRONMENT_COUNT = 26
  179.  
  180. '*************************************************************
  181. '* EAX presets, usage: BASS_SetEAXParametersVB(EAX_PRESET_xxx) *
  182. '*************************************************************
  183. Global Const EAX_PRESET_GENERIC = 1
  184. Global Const EAX_PRESET_PADDEDCELL = 2
  185. Global Const EAX_PRESET_ROOM = 3
  186. Global Const EAX_PRESET_BATHROOM = 4
  187. Global Const EAX_PRESET_LIVINGROOM = 5
  188. Global Const EAX_PRESET_STONEROOM = 6
  189. Global Const EAX_PRESET_AUDITORIUM = 7
  190. Global Const EAX_PRESET_CONCERTHALL = 8
  191. Global Const EAX_PRESET_CAVE = 9
  192. Global Const EAX_PRESET_ARENA = 10
  193. Global Const EAX_PRESET_HANGAR = 11
  194. Global Const EAX_PRESET_CARPETEDHALLWAY = 12
  195. Global Const EAX_PRESET_HALLWAY = 13
  196. Global Const EAX_PRESET_STONECORRIDOR = 14
  197. Global Const EAX_PRESET_ALLEY = 15
  198. Global Const EAX_PRESET_FOREST = 16
  199. Global Const EAX_PRESET_CITY = 17
  200. Global Const EAX_PRESET_MOUNTAINS = 18
  201. Global Const EAX_PRESET_QUARRY = 19
  202. Global Const EAX_PRESET_PLAIN = 20
  203. Global Const EAX_PRESET_PARKINGLOT = 21
  204. Global Const EAX_PRESET_SEWERPIPE = 22
  205. Global Const EAX_PRESET_UNDERWATER = 23
  206. Global Const EAX_PRESET_DRUGGED = 24
  207. Global Const EAX_PRESET_DIZZY = 25
  208. Global Const EAX_PRESET_PSYCHOTIC = 26
  209.  
  210. '******************************
  211. '* A3D resource manager modes *
  212. '******************************
  213. Global Const A3D_RESMODE_OFF = 0                'off
  214. Global Const A3D_RESMODE_NOTIFY = 1             'notify when there are no free hardware channels
  215. Global Const A3D_RESMODE_DYNAMIC = 2            'non-looping channels are managed
  216. Global Const A3D_RESMODE_DYNAMIC_LOOPERS = 3    'all (inc. looping) channels are managed (req A3D 1.2)
  217.  
  218.  
  219. '**********************************************************************
  220. '* Sync types (with BASS_ChannelSetSync() "param" and SYNCPROC "data" *
  221. '* definitions) & flags.                                              *
  222. '**********************************************************************
  223. ' Sync when a music reaches a position.
  224. ' param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all)
  225. ' data : LOWORD=order HIWORD=row
  226. Global Const BASS_SYNC_MUSICPOS = 0
  227. ' Sync when an instrument (sample for the non-instrument based formats)
  228. ' is played in a music (not including retrigs).
  229. ' param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all)
  230. ' data : LOWORD=note HIWORD=volume (0-64)
  231. Global Const BASS_SYNC_MUSICINST = 1
  232. ' Sync when a music or file stream reaches the end.
  233. ' param: not used
  234. ' data : not used
  235. Global Const BASS_SYNC_END = 2
  236. ' Sync when the "sync" effect (XM/MTM/MOD: E8x, IT/S3M: S0x) is used.
  237. ' param: 0:data=pos, 1:data="x" value
  238. ' data : param=0: LOWORD=order HIWORD=row, param=1: "x" value */
  239. Global Const BASS_SYNC_MUSICFX = 3
  240. 'FLAG: sync at mixtime, else at playtime
  241. Global Const BASS_SYNC_MIXTIME = 1073741824#
  242. ' FLAG: sync only once, else continuously
  243. Global Const BASS_SYNC_ONETIME = 2147483648#
  244.  
  245. Global Const CDCHANNEL = 0                    ' CD channel, for use with BASS_Channel functions
  246.  
  247. '**************************************************************
  248. '* DirectSound interfaces (for use with BASS_GetDSoundObject) *
  249. '**************************************************************
  250. Global Const BASS_OBJECT_DS = 1                     ' DirectSound
  251. Global Const BASS_OBJECT_DS3DL = 2                  'IDirectSound3DListener
  252.  
  253. '******************************
  254. '* DX7 voice allocation flags *
  255. '******************************
  256. ' Play the sample in hardware. If no hardware voices are available then
  257. ' the "play" call will fail
  258. Global Const BASS_VAM_HARDWARE = 1
  259. ' Play the sample in software (ie. non-accelerated). No other VAM flags
  260. 'may be used together with this flag.
  261. Global Const BASS_VAM_SOFTWARE = 2
  262.  
  263. '******************************
  264. '* DX7 voice management flags *
  265. '******************************
  266. ' These flags enable hardware resource stealing... if the hardware has no
  267. ' available voices, a currently playing buffer will be stopped to make room for
  268. ' the new buffer. NOTE: only samples loaded/created with the BASS_SAMPLE_VAM
  269. ' flag are considered for termination by the DX7 voice management.
  270.  
  271. ' If there are no free hardware voices, the buffer to be terminated will be
  272. ' the one with the least time left to play.
  273. Global Const BASS_VAM_TERM_TIME = 4
  274. ' If there are no free hardware voices, the buffer to be terminated will be
  275. ' one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is beyond
  276. ' it 's max distance. If there are no buffers that match this criteria, then the
  277. ' "play" call will fail.
  278. Global Const BASS_VAM_TERM_DIST = 8
  279. ' If there are no free hardware voices, the buffer to be terminated will be
  280. ' the one with the lowest priority.
  281. Global Const BASS_VAM_TERM_PRIO = 16
  282.  
  283. '**********************************************************************
  284. '* software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm) *
  285. '**********************************************************************
  286. ' default algorithm (currently translates to BASS_3DALG_OFF)
  287. Global Const BASS_3DALG_DEFAULT = 0
  288. ' Uses normal left and right panning. The vertical axis is ignored except for
  289. 'scaling of volume due to distance. Doppler shift and volume scaling are still
  290. 'applied, but the 3D filtering is not performed. This is the most CPU efficient
  291. 'software implementation, but provides no virtual 3D audio effect. Head Related
  292. 'Transfer Function processing will not be done. Since only normal stereo panning
  293. 'is used, a channel using this algorithm may be accelerated by a 2D hardware
  294. 'voice if no free 3D hardware voices are available.
  295. Global Const BASS_3DALG_OFF = 1
  296. ' This algorithm gives the highest quality 3D audio effect, but uses more CPU.
  297. ' Requires Windows 98 2nd Edition or Windows 2000 that uses WDM drivers, if this
  298. ' mode is not available then BASS_3DALG_OFF will be used instead.
  299. Global Const BASS_3DALG_FULL = 2
  300. ' This algorithm gives a good 3D audio effect, and uses less CPU than the FULL
  301. ' mode. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM drivers, if
  302. ' this mode is not available then BASS_3DALG_OFF will be used instead.
  303. Global Const BASS_3DALG_LIGHT = 3
  304.  
  305. Type BASS_INFO
  306.     size As Long                'size of this struct (set this before calling the function)
  307.     flags As Long               'device capabilities (DSCAPS_xxx flags)
  308.     ' The following values are irrelevant if the device doesn't have hardware
  309.     ' support (DSCAPS_EMULDRIVER is specified in flags)
  310.     hwsize As Long              'size of total device hardware memory
  311.     hwfree As Long              'size of free device hardware memory
  312.     freesam As Long             'number of free sample slots in the hardware
  313.     free3d As Long              'number of free 3D sample slots in the hardware
  314.     minrate As Long             'min sample rate supported by the hardware
  315.     maxrate As Long             'max sample rate supported by the hardware
  316.     eax As Integer              'device supports EAX? (always BASSFALSE if BASS_DEVICE_3D was not used)
  317.     a3d As Long                 'A3D version (0=unsupported or BASS_DEVICE_A3D was not used)
  318.     dsver As Long               'DirectSound version (use to check for DX5/7 functions)
  319. End Type
  320.  
  321. '*************************
  322. '* Sample info structure *
  323. '*************************
  324. Type BASS_SAMPLE
  325.     freq As Long                'default playback rate
  326.     volume As Long              'default volume (0-100)
  327.     pan As Integer              'default pan (-100=left, 0=middle, 100=right)
  328.     flags As Long               'BASS_SAMPLE_xxx flags
  329.     length As Long              'length (in samples, not bytes)
  330.     max As Long ' maximum simultaneous playbacks
  331.     ' The following are the sample's default 3D attributes (if the sample
  332.     ' is 3D, BASS_SAMPLE_3D is in flags) see BASS_ChannelSet3DAttributes
  333.     mode3d As Long              'BASS_3DMODE_xxx mode
  334.     mindist As Single           'minimum distance
  335.     MAXDIST As Single           'maximum distance
  336.     iangle As Long              'angle of inside projection cone
  337.     oangle As Long              'angle of outside projection cone
  338.     outvol As Long              'delta-volume outside the projection cone
  339.     ' The following are the defaults used if the sample uses the DirectX 7
  340.     ' voice allocation/management features.
  341.     vam As Long                 'voice allocation/management flags (BASS_VAM_xxx)
  342.     priority As Long            'priority (0=lowest, 0xffffffff=highest)
  343. End Type
  344.  
  345. '********************************************************
  346. '* 3D vector (for 3D positions/velocities/orientations) *
  347. '********************************************************
  348. Type BASS_3DVECTOR
  349.     X As Single                 '+=right, -=left
  350.     Y As Single                 '+=up, -=down
  351.     z As Single                 '+=front, -=behind
  352. End Type
  353.  
  354. ' Retrieve the version number of BASS that is loaded. RETURN : The BASS version (LOWORD.HIWORD)
  355. Declare Function BASS_GetVersion Lib "bass.dll" () As Long
  356.  
  357. ' Get the text description of a device. This function can be used to enumerate the available devices.
  358. ' devnum: The device(0 = First)
  359. ' desc: Pointer to store pointer to text description
  360. Declare Function BASS_GetDeviceDescription Lib "bass.dll" (ByVal devnum As Long, ByRef Desc As String) As Integer
  361.  
  362. ' Set the amount that BASS mixes ahead new musics/streams.
  363. ' Changing this setting does not affect musics/streams
  364. ' that have already been loaded/created. Increasing the
  365. ' buffer length, decreases the chance of the sound
  366. ' possibly breaking-up on slower computers, but also
  367. ' requires more memory. The default length is 0.5 secs.
  368. ' length : The buffer length in seconds (limited to 0.3-2.0s)
  369.  
  370. ' NOTE: This setting does not represent the latency
  371. ' (delay between playing and hearing the sound). The
  372. ' latency depends on the drivers, the power of the CPU,
  373. ' and the complexity of what's being mixed (eg. an IT
  374. ' using filters requires more processing than a plain
  375. ' 4 channel MOD). So the buffer length actually has no
  376. ' effect on the latency.
  377. Declare Sub BASS_SetBufferLength Lib "bass.dll" (ByVal length As Single)
  378.  
  379. ' Set the global music/sample/stream volume levels.
  380. ' musvol : MOD music global volume level (0-100, -1=leave current)
  381. ' samvol : Sample global volume level (0-100, -1=leave current)
  382. ' strvol : Stream global volume level (0-100, -1=leave current)
  383. Declare Sub BASS_SetGlobalVolumes Lib "bass.dll" (ByVal musvol As Long, ByVal samvol As Long, ByVal strvol As Long)
  384.  
  385. ' Retrive the global music/sample/stream volume levels.
  386. ' musvol : MOD music global volume level (NULL=don't retrieve it)
  387. ' samvol : Sample global volume level (NULL=don't retrieve it)
  388. ' strvol : Stream global volume level (NULL=don't retrieve it)
  389. Declare Sub BASS_GetGlobalVolumes Lib "bass.dll" (ByRef musvol As Long, ByRef samvol As Long, ByRef strvol As Long)
  390.  
  391. ' Make the volume/panning values translate to a logarithmic curve,
  392. ' or a linear "curve" (the default)
  393. ' volume :   volume curve(BASSFALSE = linear, BASSTRUE = Log)
  394. ' pan    : panning curve (BASSFALSE=linear, BASSTRUE=log) */
  395. Declare Sub BASS_SetLogCurves Lib "bass.dll" (ByVal volume As Integer, ByVal pan As Integer)
  396.  
  397. ' Set the 3D algorithm for software mixed 3D channels (does not affect
  398. ' hardware mixed channels). Changing the mode only affects subsequently
  399. ' created or loaded samples/streams/musics, not those that already exist.
  400. ' Requires DirectX 7 or above.
  401. ' algo : algorithm flag (BASS_3DALG_xxx)
  402. Declare Sub BASS_Set3DAlgorithm Lib "bass.dll" (ByVal algo As Long)
  403.  
  404. ' Get the BASS_ERROR_xxx error code. Use this function to get the reason for an error.
  405. Declare Function BASS_ErrorGetCode Lib "bass.dll" () As Long
  406.  
  407. ' Initialize the digital output. This must be called
  408. ' before all following BASS functions (except CD functions).
  409. ' The volume is initially set to 100 (the maximum),
  410. ' use BASS_SetVolume() to adjust it.
  411. ' device : Device to use (0=first, -1=default, -2=no sound)
  412. ' freq   : Output sample rate
  413. ' flags:     BASS_DEVICE_xxx flags
  414. ' win:       Owner window
  415.  
  416. ' NOTE: The "no sound" device (device=-2), allows loading
  417. ' and "playing" of MOD musics only (all sample/stream
  418. ' functions and most other functions fail). This is so
  419. ' that you can still use the MOD musics as synchronizers
  420. ' when there is no soundcard present. When using device -2,
  421. ' you should still set the other arguments as you would do
  422. ' normally.
  423. Declare Function BASS_Init Lib "bass.dll" (ByVal device As Integer, ByVal freq As Long, ByVal flags As Long, ByVal win As Long) As Integer
  424.  
  425. ' Free all resources used by the digital output, including  all musics and samples.
  426. Declare Sub BASS_Free Lib "bass.dll" ()
  427.  
  428. ' Retrieve a pointer to a DirectSound interface. This can be used by
  429. ' advanced users to "plugin" external functionality.
  430. ' object : The interface to retrieve (BASS_OBJECT_xxx)
  431. ' RETURN : A pointer to the requested interface (NULL=error)
  432. Declare Sub BASS_GetDSoundObject Lib "bass.dll" (ByRef object As Long)
  433.  
  434. ' Retrieve some information on the device being used.
  435. ' info   : Pointer to store info at
  436. Declare Sub BASS_GetInfo Lib "bass.dll" (ByRef info As BASS_INFO)
  437.  
  438. ' Get the current CPU usage of BASS. This includes the time taken to mix
  439. ' the MOD musics and sample streams, and also the time taken by any user
  440. ' DSP functions. It does not include plain sample mixing which is done by
  441. ' the output device (hardware accelerated) or DirectSound (emulated). Audio
  442. ' CD playback requires no CPU usage.
  443. ' RETURN : The CPU usage percentage (floating-point)
  444. Declare Function BASS_GetCPU Lib "bass.dll" () As Single
  445.  
  446. ' Start the digital output.
  447. Declare Function BASS_Start Lib "bass.dll" () As Integer
  448.  
  449. ' Stop the digital output, stopping all musics/samples/streams.
  450. Declare Function BASS_Stop Lib "bass.dll" () As Integer
  451.  
  452. ' Stop the digital output, pausing all musics/samples/
  453. ' streams. Use BASS_Start to resume the digital output.
  454. Declare Function BASS_Pause Lib "bass.dll" () As Integer
  455.  
  456. ' Set the digital output master volume.
  457. ' volume : Desired volume level (0-100)
  458. Declare Function BASS_SetVolume Lib "bass.dll" (ByVal volume As Long) As Integer
  459.  
  460. ' Get the digital output master volume.
  461. ' RETURN : The volume level (0-100, -1=error)
  462. Declare Function BASS_GetVolume Lib "bass.dll" () As Long
  463.  
  464. ' Set the factors that affect the calculations of 3D sound.
  465. ' distf  : Distance factor (0.0-10.0, 1.0=use meters, 0.3=use feet, <0.0=leave current)
  466. '          By default BASS measures distances in meters, you can change this
  467. '          setting if you are using a different unit of measurement.
  468. ' roolf  : Rolloff factor, how fast the sound quietens with distance
  469. '          (0.0=no rolloff, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
  470. ' doppf  : Doppler factor (0.0=no doppler, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
  471. '          The doppler effect is the way a sound appears to change frequency when it is
  472. '          moving towards or away from you. The listener and sound velocity settings are
  473. '          used to calculate this effect, this "doppf" value can be used to lessen or
  474. '          exaggerate the effect.
  475. Declare Function BASS_Set3DFactors Lib "bass.dll" (ByVal distf As Single, ByVal rollf As Single, ByVal doppf As Single) As Integer
  476.  
  477. ' Get the factors that affect the calculations of 3D sound.
  478. ' distf  : Distance factor (NULL=don't get it)
  479. ' roolf  : Rolloff factor (NULL=don't get it)
  480. ' doppf  : Doppler factor (NULL=don't get it)
  481. Declare Function BASS_Get3DFactors Lib "bass.dll" (ByRef distf As Single, ByRef rollf As Single, doppf As Single) As Integer
  482.  
  483. ' Set the position/velocity/orientation of the listener (ie. the player/viewer).
  484. ' pos    : Position of the listener (NULL=leave current)
  485. ' vel    : listener 's velocity, used to calculate doppler effect (NULL=leave current)
  486. ' front  : Direction that listener's front is pointing (NULL=leave current)
  487. ' top    : Direction that listener's top is pointing (NULL=leave current)
  488. ' NOTE   : front & top must both be set in a single call
  489. Declare Function BASS_Set3DPosition Lib "bass.dll" (ByRef pos As Any, ByRef vel As Any, ByRef front As Any, ByRef top As Any) As Integer
  490.  
  491. ' Get the position/velocity/orientation of the listener.
  492. ' pos    : Position of the listener (NULL=don't get it)
  493. ' vel    : listener 's velocity (NULL=don't get it)
  494. ' front  : Direction that listener's front is pointing (NULL=don't get it)
  495. ' top    : Direction that listener's top is pointing (NULL=don't get it)
  496. ' NOTE   : front & top must both be retrieved in a single call
  497. Declare Function BASS_Get3DPosition Lib "bass.dll" (ByRef pos As Any, ByRef vel As Any, ByRef front As Any, ByRef top As Any) As Integer
  498.  
  499. ' Apply changes made to the 3D system. This must be called to apply any changes
  500. ' made with BASS_Set3DFactors, BASS_Set3DPosition, BASS_ChannelSet3DAttributes or
  501. ' BASS_ChannelSet3DPosition. It improves performance to have DirectSound do all the
  502. ' required recalculating at the same time like this, rather than recalculating after
  503. ' every little change is made. NOTE: This is automatically called when starting a 3D
  504. ' sample with BASS_SamplePlay3D/Ex.
  505. Declare Function BASS_Apply3D Lib "bass.dll" () As Integer
  506.  
  507. ' Set the type of EAX environment and it's parameters. Obviously, EAX functions
  508. ' have no effect if no EAX supporting device (ie. SB Live) is used.
  509. ' env    : Reverb environment (EAX_ENVIRONMENT_xxx, -1=leave current)
  510. ' vol    : Volume of the reverb (0.0=off, 1.0=max, <0.0=leave current)
  511. ' decay  : Time in seconds it takes the reverb to diminish by 60dB (0.1-20.0, <0.0=leave current)
  512. ' damp   : The damping, high or low frequencies decay faster (0.0=high decays quickest,
  513. '          1.0=low/high decay equally, 2.0=low decays quickest, <0.0=leave current)
  514. Declare Function BASS_SetEAXParameters Lib "bass.dll" (ByVal env As Long, ByVal vol As Single, ByVal decay As Single, ByVal damp As Single) As Integer
  515.  
  516. ' Get the current EAX parameters.
  517. ' env    : Reverb environment (NULL=don't get it)
  518. ' vol    : Reverb volume (NULL=don't get it)
  519. ' decay  : Decay duration (NULL=don't get it)
  520. ' damp   : The damping (NULL=don't get it)
  521. Declare Function BASS_GetEAXParameters Lib "bass.dll" (ByRef env As Long, ByRef vol As Single, ByRef decay As Single, ByRef damp As Single) As Integer
  522.  
  523. ' Set the A3D resource management mode.
  524. ' mode   : The mode (A3D_RESMODE_OFF=disable resource management,
  525. ' A3D_RESMODE_DYNAMIC = enable resource manager but looping channels are not managed,
  526. ' A3D_RESMODE_DYNAMIC_LOOPERS = enable resource manager including looping channels,
  527. ' A3D_RESMODE_NOTIFY = plays will fail when there are no available resources)
  528. Declare Function BASS_SetA3DResManager Lib "bass.dll" (ByVal mode As Long) As Integer
  529.  
  530. ' Get the A3D resource management mode.
  531. ' RETURN : The mode (0xffffffff=error)
  532. Declare Function BASS_GetA3DResManager Lib "bass.dll" () As Long
  533.  
  534. ' Set the A3D high frequency absorbtion factor.
  535. ' factor  : Absorbtion factor (0.0=disabled, <1.0=diminished, 1.0=default,
  536. '           >1.0=exaggerated)
  537. Declare Function BASS_SetA3DHFAbsorbtion Lib "bass.dll" (ByVal factor As Single) As Integer
  538.  
  539. ' Retrieve the current A3D high frequency absorbtion factor.
  540. ' factor  : The absorbtion factor
  541. Declare Function BASS_GetA3DHFAbsorbtion Lib "bass.dll" (ByRef factor As Single) As Integer
  542.  
  543. ' Load a music (MO3/XM/MOD/S3M/IT/MTM). The amplification and pan
  544. ' seperation are initially set to 50, use BASS_MusicSetAmplify()
  545. ' and BASS_MusicSetPanSep() to adjust them.
  546. ' mem    : BASSTRUE = Load music from memory
  547. ' f      : Filename (mem=BASSFALSE) or memory location (mem=BASSTRUE)
  548. ' offset : File offset to load the music from (only used if mem=BASSFALSE)
  549. ' length : Data length (only used if mem=BASSFALSE, 0=use to end of file)
  550. ' flags  :     BASS_MUSIC_xxx flags
  551. ' RETURN : The loaded music's handle (NULL=error)
  552. Declare Function BASS_MusicLoad Lib "bass.dll" (ByVal mem As Integer, ByVal f As Any, ByVal offset As Long, ByVal length As Long, ByVal flags As Long) As Long
  553.  
  554. '  Free a music's resources. handle =  Music handle
  555. Declare Sub BASS_MusicFree Lib "bass.dll" (ByVal handle As Long)
  556.  
  557. ' Retrieves a music's name.
  558. ' handle :  Music handle
  559. ' Return : The Music 's name (NULL=error)
  560. Declare Function BASS_MusicGetName Lib "bass.dll" (ByVal handle As Long) As String
  561.  
  562. ' Retrieves the length of a music in patterns (ie. how many "orders"
  563. ' there are).
  564. ' handle :  Music handle
  565. ' RETURN : The length of the music (0xFFFFFFFF=error)
  566. Declare Function BASS_MusicGetLength Lib "bass.dll" (ByVal handle As Long) As Long
  567.  
  568. ' Play a music. Playback continues from where it was last stopped/paused.
  569. ' Multiple musics may be played simultaneously.
  570. ' handle : Handle of music to play
  571. Declare Function BASS_MusicPlay Lib "bass.dll" (ByVal handle As Long) As Integer
  572.  
  573. ' Play a music, specifying start position and playback flags.
  574. ' handle : Handle of music to play
  575. ' pos    : Position to start playback from, LOWORD=order HIWORD=row
  576. ' flags  : BASS_MUSIC_xxx flags. These flags overwrite the defaults
  577. '          specified when the music was loaded. (-1=use current flags)
  578. ' reset  : BASSTRUE = Stop all current playing notes and reset bpm/etc...
  579. Declare Function BASS_MusicPlayEx Lib "bass.dll" (ByVal handle As Long, ByVal pos As Long, ByVal flags As Long, ByVal reset As Integer) As Integer
  580.  
  581. ' Set a music's amplification level.
  582. ' handle:    Music handle
  583. ' amp:       Amplification Level(0 - 100)
  584. Declare Function BASS_MusicSetAmplify Lib "bass.dll" (ByVal handle As Long, amp As Long) As Integer
  585.  
  586. ' Set a music's pan seperation.
  587. ' handle:    Music handle
  588. ' pan:       pan seperation(0 - 100, 50 = linear)
  589. Declare Function BASS_MusicSetPanSep Lib "bass.dll" (ByVal handle As Long, pan As Long) As Integer
  590.  
  591. ' Set a music's "GetPosition" scaler
  592. ' When you call BASS_ChannelGetPosition, the "row" (HIWORD) will be
  593. ' scaled by this value. By using a higher scaler, you can get a more
  594. ' precise position indication.
  595. ' handle:    Music handle
  596. ' Scale: The scaler(1 - 256)
  597. Declare Function BASS_MusicSetPositionScaler Lib "bass.dll" (ByVal handle As Long, ByVal pscale As Long) As Integer
  598.  
  599. ' Load a WAV sample. If you're loading a sample with 3D functionality,
  600. ' then you should use BASS_GetInfo and BASS_SetInfo to set the default 3D
  601. ' parameters. You can also use these two functions to set the sample's
  602. ' default frequency/volume/pan/looping.
  603. ' mem    : BASSTRUE = Load sample from memory
  604. ' f      : Filename (mem=BASSFALSE) or memory location (mem=BASSTRUE)
  605. ' offset : File offset to load the sample from (only used if mem=BASSFALSE)
  606. ' length : Data length (only used if mem=BASSFALSE, 0=use to end of file)
  607. ' max    : Maximum number of simultaneous playbacks (1-65535)
  608. ' flags  : BASS_SAMPLE_xxx flags (only the LOOP/3D/SOFTWARE/DEFER/MUTEMAX/OVER_xxx flags are used)
  609. ' RETURN : The loaded sample's handle (NULL=error)
  610. Declare Function BASS_SampleLoad Lib "bass.dll" (ByVal mem As Integer, ByVal f As Any, ByVal offset As Long, ByVal length As Long, ByVal max As Long, ByVal flags As Long) As Long
  611.  
  612. ' Create a sample. This function allows you to generate custom samples, or
  613. ' load samples that are not in the WAV format. A pointer is returned to the
  614. ' memory location at which you should write the sample's data. After writing
  615. ' the data, call BASS_SampleCreateDone to get the new sample's handle.
  616. ' length:    The sample 's length (in samples, NOT bytes)
  617. ' freq   : default sample rate
  618. ' max    : Maximum number of simultaneous playbacks (1-65535)
  619. ' flags:     BASS_SAMPLE_xxx flags
  620. ' RETURN : Memory location to write the sample's data (NULL=error)
  621. Declare Function BASS_SampleCreate Lib "bass.dll" (ByVal length As Long, ByVal freq As Long, ByVal max As Long, ByVal flags As Long) As Long
  622.  
  623. ' Finished creating a new sample.
  624. ' Return: The New sample 's handle (NULL=error)
  625. Declare Function BASS_SampleCreateDone Lib "bass.dll" () As Long
  626.  
  627. ' Free a sample's resources.
  628. ' handle:    Sample handle
  629. Declare Sub BASS_SampleFree Lib "bass.dll" (ByVal handle As Long)
  630.  
  631. ' Retrieve a sample's current default attributes.
  632. ' handle:    Sample handle
  633. ' info   : Pointer to store sample info
  634. Declare Function BASS_SampleGetInfo Lib "bass.dll" (ByVal handle As Long, ByRef info As BASS_SAMPLE) As Integer
  635.  
  636. 'Set a sample's default attributes.
  637. ' handle:    Sample handle
  638. ' info   : Sample info, only the freq/volume/pan/3D attributes and
  639. '          looping/override method flags are used
  640. Declare Function BASS_SampleSetInfo Lib "bass.dll" (ByVal handle As Long, ByRef info As BASS_SAMPLE) As Integer
  641.  
  642. ' Play a sample, using the sample's default attributes.
  643. ' handle : Handle of sample to play
  644. ' RETURN : Handle of channel used to play the sample (NULL=error)
  645. Declare Function BASS_SamplePlay Lib "bass.dll" (ByVal handle As Long) As Long
  646.  
  647. ' Play a sample, using specified attributes.
  648. ' handle : Handle of sample to play
  649. ' start  : Playback start position (in samples, not bytes)
  650. ' freq:      Playback Rate(-1 = Default)
  651. ' volume : Volume (-1=default, 0=silent, 100=max)
  652. ' pan:       pan position(-101 = Default, -100 = Left, 0 = middle, 100 = Right)
  653. ' loop   : 1 = Loop sample (-1=default)
  654. ' RETURN : Handle of channel used to play the sample (NULL=error)
  655. Declare Function BASS_SamplePlayEx Lib "bass.dll" (ByVal handle As Long, ByVal start As Long, ByVal freq As Long, ByVal volume As Long, ByVal pan As Long, ByVal pLoop As Integer) As Long
  656.  
  657. ' Play a 3D sample, setting it's 3D position, orientation and velocity.
  658. ' handle : Handle of sample to play
  659. ' pos    : position of the sound (NULL = x/y/z=0.0)
  660. ' orient : orientation of the sound, this is irrelevant if it's an
  661. '          omnidirectional sound source (NULL = x/y/z=0.0)
  662. ' vel    : velocity of the sound (NULL = x/y/z=0.0)
  663. ' RETURN : Handle of channel used to play the sample (NULL=error)
  664. Declare Function BASS_SamplePlay3D Lib "bass.dll" (ByVal handle As Long, ByRef pos As Any, ByRef orient As Any, ByRef vel As Any) As Long
  665.  
  666. ' Play a 3D sample, using specified attributes.
  667. ' handle : Handle of sample to play
  668. ' pos    : position of the sound (NULL = x/y/z=0.0)
  669. ' orient : orientation of the sound, this is irrelevant if it's an
  670. '          omnidirectional sound source (NULL = x/y/z=0.0)
  671. ' vel    : velocity of the sound (NULL = x/y/z=0.0)
  672. ' start  : Playback start position (in samples, not bytes)
  673. ' freq:      Playback Rate(-1 = Default)
  674. ' volume : Volume (-1=default, 0=silent, 100=max)
  675. ' loop   : 1 = Loop sample (-1=default)
  676. ' RETURN : Handle of channel used to play the sample (NULL=error)
  677. Declare Function BASS_SamplePlay3DEx Lib "bass.dll" (ByVal handle As Long, ByRef pos As Any, ByRef orient As Any, ByRef vel As Any, ByVal start As Long, ByVal freq As Long, ByVal volume As Long, ByVal pLoop As Integer) As Long
  678.  
  679. ' Stops all instances of a sample. For example, if a sample is playing
  680. ' simultaneously 3 times, calling this function will stop all 3 of them,
  681. ' which is obviously simpler than calling BASS_ChannelStop() 3 times.
  682. ' handle : Handle of sample to stop
  683. Declare Function BASS_SampleStop Lib "bass.dll" (ByVal handle As Long) As Integer
  684.  
  685. ' Create a user sample stream.
  686. ' freq   : Stream playback rate
  687. ' flags  : BASS_SAMPLE_xxx flags (only the 8BITS/MONO/3D flags are used)
  688. ' proc   : User defined stream writing function pass using "AddressOf STREAMPROC"
  689. ' RETURN : The created stream's handle (NULL=error)
  690. Declare Function BASS_StreamCreate Lib "bass.dll" (ByVal freq As Long, ByVal flags As Long, ByRef proc As Long, ByVal user As Long) As Long
  691.  
  692. ' Create a sample stream from an MP3 or WAV file.
  693. ' mem    : BASSTRUE = Stream file from memory
  694. ' f      : Filename (mem=BASSFALSE) or memory location (mem=BASSTRUE)
  695. ' offset : File offset of the stream data
  696. ' length : File length (0=use whole file if mem=BASSFALSE)
  697. ' flags  : BASS_SAMPLE_3D and/or BASS_MP3_LOWQ flags
  698. ' user   : The 'user' value passed to the callback function
  699. ' RETURN : The created stream's handle (NULL=error)
  700. Declare Function BASS_StreamCreateFile Lib "bass.dll" (ByVal mem As Integer, ByVal f As Any, ByVal offset As Long, ByVal length As Long, ByVal flags As Long) As Long
  701.  
  702. ' Free a sample stream's resources.
  703. ' stream:    stream handle
  704. Declare Sub BASS_StreamFree Lib "bass.dll" (ByVal handle As Long)
  705.  
  706. ' Retrieves the playback length (in bytes) of a file stream. It's not always
  707. ' possible to 100% accurately guess the length of a stream, so the length returned
  708. ' may be only an approximation when using some WAV codecs.
  709. ' handle :  Stream handle
  710. ' RETURN : The length (0xffffffff=error)
  711. Declare Function BASS_StreamGetLength Lib "bass.dll" (ByVal handle As Long) As Long
  712.  
  713. ' Retrieves the playback length (in bytes) of a block in a file stream.
  714. ' handle :  Stream handle
  715. ' RETURN : The block length (0xffffffff=error)
  716. Declare Function BASS_StreamGetBlockLength Lib "bass.dll" (ByVal handle As Long) As Long
  717.  
  718. ' Play a sample stream, optionally flushing the buffer first.
  719. ' handle : Handle of stream to play
  720. ' flush  : Flush buffer contents. If you stop a stream and then want to
  721. '          continue it from where it stopped, don't flush it. Flushing
  722. '          a file stream causes it to restart from the beginning.
  723. ' flags  : BASS_SAMPLE_xxx flags (only affects file streams, and only the
  724. '          LOOP flag is used)
  725. Declare Function BASS_StreamPlay Lib "bass.dll" (ByVal handle As Long, ByVal flush As Integer, ByVal flags As Long) As Integer
  726.  
  727. ' Initialize the CD functions, must be called before any other CD
  728. ' functions. The volume is initially set to 100 (the maximum), use
  729. ' BASS_ChannelSetAttributes() to adjust it.
  730. ' drive  : The CD drive, for example: "d:" (NULL=use default drive)
  731. Declare Function BASS_CDInit Lib "bass.dll" (ByVal drive As Any) As Integer
  732.  
  733. ' Free resources used by the CD
  734. Declare Sub BASS_CDFree Lib "bass.dll" ()
  735.  
  736. ' Check if there is a CD in the drive.
  737. ' RETURN : 1 if cd in drive, 0 if not.
  738. Declare Function BASS_CDInDrive Lib "bass.dll" () As Long
  739.  
  740. ' Play a CD track.
  741. ' track  : Track number to play (1=first)
  742. ' loop   : BASSTRUE = Loop the track
  743. ' wait   : BASSTRUE = don't return until playback has started
  744. '          (some drives will always wait anyway)
  745. Declare Function BASS_CDPlay Lib "bass.dll" (ByVal track As Long, ByVal pLoop As Integer, ByVal wait As Integer) As Integer
  746.  
  747. '*************************************************************************
  748. '* A "channel" can be a playing sample (HCHANNEL), a MOD music (HMUSIC), *
  749. '* a sample stream (HSTREAM), or the CD (CDCHANNEL). The following       *
  750. '* functions can be used with one or more of these channel types.        *
  751. '*************************************************************************
  752.  
  753. ' Check if a channel is active (playing).
  754. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  755. ' Returns : BASSTRUE if active, BASSFALSE if inactive
  756. Declare Function BASS_ChannelIsActive Lib "bass.dll" (ByVal handle As Long) As Integer
  757.  
  758. ' Get some info about a channel.
  759. ' handle:    channel handle(HCHANNEL / HMUSIC / HSTREAM)
  760. ' RETURN : BASS_SAMPLE_xxx flags (0xffffffff=error)
  761. Declare Function BASS_ChannelGetFlags Lib "bass.dll" (ByVal handle As Long) As Long
  762.  
  763. ' Stop a channel.
  764. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  765. Declare Function BASS_ChannelStop Lib "bass.dll" (ByVal handle As Long) As Integer
  766.  
  767. ' Pause a channel.
  768. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  769. Declare Function BASS_ChannelPause Lib "bass.dll" (ByVal handle As Long) As Integer
  770.  
  771. ' Resume a paused channel.
  772. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  773. Declare Function BASS_ChannelResume Lib "bass.dll" (ByVal handle As Long) As Integer
  774.  
  775. ' Update a channel's attributes. The actual setting may not be exactly
  776. ' as specified, depending on the accuracy of the device and drivers.
  777. ' NOTE: Only the volume can be adjusted for the CD "channel", but not all
  778. ' soundcards allow controlling of the CD volume level.
  779. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  780. ' freq   : Playback rate (-1=leave current)
  781. ' volume : Volume (-1=leave current, 0=silent, 100=max)
  782. ' pan    : pan position(-101 = current, -100 = Left, 0 = middle, 100 = Right)
  783. '          panning has no effect on 3D channels
  784. Declare Function BASS_ChannelSetAttributes Lib "bass.dll" (ByVal handle As Long, ByVal freq As Long, ByVal volume As Long, ByVal pan As Long) As Integer
  785.  
  786. ' Retrieve a channel's attributes. Only the volume is available for
  787. ' the CD "channel" (if allowed by the soundcard/drivers).
  788. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  789. ' freq   : Pointer to store playback rate (NULL=don't retrieve it)
  790. ' volume : Pointer to store volume (NULL=don't retrieve it)
  791. ' pan    : Pointer to store pan position (NULL=don't retrieve it)
  792. Declare Function BASS_ChannelGetAttributes Lib "bass.dll" (ByVal handle As Long, ByRef freq As Long, ByRef volume As Long, ByRef pan As Long) As Integer
  793.  
  794. ' Set a channel's 3D attributes.
  795. ' handle : channel handle(HCHANNEL / HSTREAM / HMUSIC)
  796. ' mode   : BASS_3DMODE_xxx mode (-1=leave current setting)
  797. ' min    : minimum distance, volume stops increasing within this distance (<0.0=leave current)
  798. ' max    : maximum distance, volume stops decreasing past this distance (<0.0=leave current)
  799. ' iangle : angle of inside projection cone in degrees (360=omnidirectional, -1=leave current)
  800. ' oangle : angle of outside projection cone in degrees (-1=leave current)
  801. '          NOTE: iangle & oangle must both be set in a single call
  802. ' outvol : delta-volume outside the projection cone (0=silent, 100=same as inside)
  803. ' The iangle/oangle angles decide how wide the sound is projected around the
  804. ' orientation angle. Within the inside angle the volume level is the channel
  805. ' level as set with BASS_ChannelSetAttributes, from the inside to the outside
  806. ' angles the volume gradually changes by the "outvol" setting.
  807. 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 Long) As Integer
  808.  
  809. ' Retrieve a channel's 3D attributes.
  810. ' handle : channel handle(HCHANNEL / HSTREAM / HMUSIC)
  811. ' mode   : BASS_3DMODE_xxx mode (NULL=don't retrieve it)
  812. ' min    : minumum distance (NULL=don't retrieve it)
  813. ' max    : maximum distance (NULL=don't retrieve it)
  814. ' iangle : angle of inside projection cone (NULL=don't retrieve it)
  815. ' oangle : angle of outside projection cone (NULL=don't retrieve it)
  816. '          NOTE: iangle & oangle must both be retrieved in a single call
  817. ' outvol : delta-volume outside the projection cone (NULL=don't retrieve it)
  818. 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 Long) As Integer
  819.  
  820. ' Update a channel's 3D position, orientation and velocity. The velocity
  821. ' is only used to calculate the doppler effect.
  822. ' handle : channel handle(HCHANNEL / HSTREAM / HMUSIC)
  823. ' pos    : position of the sound (NULL=leave current)
  824. ' orient : orientation of the sound, this is irrelevant if it's an
  825. '          omnidirectional sound source (NULL=leave current)
  826. ' vel    : velocity of the sound (NULL=leave current)
  827. Declare Function BASS_ChannelSet3DPosition Lib "bass.dll" (ByVal handle As Long, ByRef pos As Any, ByRef orient As Any, ByRef vel As Any) As Integer
  828.  
  829. ' Retrieve a channel's current 3D position, orientation and velocity.
  830. ' handle : channel handle(HCHANNEL / HSTREAM / HMUSIC)
  831. ' pos    : position of the sound (NULL=don't retrieve it)
  832. ' orient : orientation of the sound, this is irrelevant if it's an
  833. '          omnidirectional sound source (NULL=don't retrieve it)
  834. ' vel    : velocity of the sound (NULL=don't retrieve it)
  835. Declare Function BASS_ChannelGet3DPosition Lib "bass.dll" (ByVal handle As Long, ByRef pos As Any, ByRef orient As Any, ByRef vel As Any) As Integer
  836.  
  837. ' Set the current playback position of a channel.
  838. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  839. ' pos    : the position
  840. '          if HCHANNEL: position in bytes
  841. '          if HMUSIC: LOWORD=order HIWORD=row ... use MAKELONG(order,row)
  842. '          if HSTREAM: position in bytes, file streams (WAV/MP3) only (MP3s require BASS_MP3_SETPOS)
  843. '          if CDCHANNEL: position in milliseconds from start of track
  844. Declare Function BASS_ChannelSetPosition Lib "bass.dll" (ByVal handle As Long, ByVal pos As Long) As Integer
  845.  
  846. ' Get the current playback position of a channel.
  847. ' handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  848. ' RETURN : the position (0xffffffff=error)
  849. '          if HCHANNEL: position in bytes
  850. '          if HMUSIC: LOWORD=order HIWORD=row (use GetLoWord(position), GetHiWord(Position))
  851. '          if HSTREAM: total bytes played since the stream was last flushed
  852. '          if CDCHANNEL: position in milliseconds from start of track
  853. Declare Function BASS_ChannelGetPosition Lib "bass.dll" (ByVal handle As Long) As Long
  854.  
  855. ' Calculate a channel's current output level.
  856. ' handle : channel handle(HMUSIC / HSTREAM)
  857. ' RETURN : LOWORD=left level (0-128) HIWORD=right level (0-128) (0xffffffff=error)
  858. '          Use GetLoWord and GetHiWord functions on return function.
  859. Declare Function BASS_ChannelGetLevel Lib "bass.dll" (ByVal handle As Long) As Long
  860.  
  861. ' Retrieves upto "length" bytes of the channel's current sample data. This is
  862. ' useful if you wish to "visualize" the sound.
  863. ' handle:  Channel handle(HMUSIC / HSTREAM)
  864. ' buffer : Location to write the sample data
  865. ' length : Number of bytes wanted
  866. ' RETURN : Number of bytes actually written to the buffer (0xffffffff=error) */
  867. Declare Function BASS_ChannelGetData Lib "bass.dll" (ByVal handle As Long, ByRef buffer As Any, ByVal length As Long) As Long
  868.  
  869. ' Setup a sync on a channel. Multiple syncs may be used per channel.
  870. ' handle : Channel handle (currently there are only HMUSIC syncs)
  871. ' atype  : Sync type (BASS_SYNC_xxx type & flags)
  872. ' param  : Sync parameters (see the BASS_SYNC_xxx type description)
  873. ' proc   : User defined callback function (use AddressOf SYNCPROC)
  874. ' user   : The 'user' value passed to the callback function
  875. ' Return : Sync handle(Null = Error)
  876. Declare Function BASS_ChannelSetSync Lib "bass.dll" (ByVal handle As Long, ByVal param As Long, ByRef proc As Long, ByVal user As Long) As Long
  877.  
  878. ' Remove a sync from a channel
  879. ' handle : channel handle(HMUSIC)
  880. ' sync   : Handle of sync to remove
  881. Declare Function BASS_ChannelRemoveSync Lib "bass.dll" (ByVal handle As Long, sync As Long) As Integer
  882.  
  883. ' Setup a user DSP function on a channel. When multiple DSP functions
  884. ' are used on a channel, they are called in the order that they were added.
  885. ' handle:  channel handle(HMUSIC / HSTREAM)
  886. ' proc   : User defined callback function
  887. ' user   : The 'user' value passed to the callback function
  888. ' RETURN : DSP handle (NULL=error)
  889. Declare Function BASS_ChannelSetDSP Lib "bass.dll" (ByVal handle As Long, ByRef proc As Long, ByVal user As Long) As Long
  890.  
  891. ' Remove a DSP function from a channel
  892. ' handle : channel handle(HMUSIC / HSTREAM)
  893. ' dsp    : Handle of DSP to remove */
  894. ' RETURN : BASSTRUE / BASSFALSE
  895. Declare Function BASS_ChannelRemoveDSP Lib "bass.dll" (ByVal handle As Long, ByVal dsp As Long) As Integer
  896.  
  897. ' Set the wet(reverb)/dry(no reverb) mix ratio on the channel. By default
  898. ' the distance of the sound from the listener is used to calculate the mix.
  899. ' NOTE: The channel must have 3D functionality enabled for the EAX environment
  900. ' to have any affect on it.
  901. ' handle : channel handle(HCHANNEL / HSTREAM / HMUSIC)
  902. ' mix    : The ratio (0.0=reverb off, 1.0=max reverb, -1.0=let EAX calculate
  903. '          the reverb mix based on the distance)
  904. Declare Function BASS_ChannelSetEAXMix Lib "bass.dll" (ByVal handle As Long, ByVal mix As Single) As Integer
  905.  
  906. ' Get the wet(reverb)/dry(no reverb) mix ratio on the channel.
  907. ' handle:    channel handle(HCHANNEL / HSTREAM / HMUSIC)
  908. ' mix    : Pointer to store the ratio at
  909. Declare Function BASS_ChannelGetEAXMix Lib "bass.dll" (ByVal handle As Long, ByRef mix As Single) As Integer
  910. Function STREAMPROC(ByVal handle As Long, ByRef buffer As Long, ByVal length As Long, ByVal user As Long) As Long
  911.     
  912.     'CALLBACK FUNCTION !!!
  913.     
  914.     'In here you can write a function to write out to a file, or send over the
  915.     'internet etc, and stream into a BASS Buffer on the client, its up to you.
  916.     'This function must return the number of bytes written out, so that BASS,
  917.     'knows where to carry on sending from.
  918.  
  919.     ' NOTE: A stream function should obviously be as quick
  920.     ' as possible, other streams (and MOD musics) can't be mixed until it's finished.
  921.     ' handle : The stream that needs writing
  922.     ' buffer : Buffer to write the samples in
  923.     ' length : Number of bytes to write
  924.     ' user   : The 'user' parameter value given when calling BASS_StreamCreate
  925.     ' RETURN : Number of bytes written. If less than "length" then the
  926.     '          stream is assumed to be at the end, and is stopped.
  927.     
  928. End Function
  929. Sub SYNCPROC(ByVal handle As Long, ByVal channel As Long, ByVal data As Long, ByVal user As Long)
  930.     
  931.     'CALLBACK FUNCTION !!!
  932.     
  933.     'Similarly in here, write what to do when sync function
  934.     'is called, i.e screen flash etc.
  935.     
  936.     ' NOTE: a sync callback function should be very
  937.     ' quick (eg. just posting a message) as other syncs cannot be processed
  938.     ' until it has finished.
  939.     ' handle : The sync that has occured
  940.     ' channel: Channel that the sync occured in
  941.     ' data   : Additional data associated with the sync's occurance
  942.     ' user   : The 'user' parameter given when calling BASS_ChannelSetSync */
  943.     
  944. End Sub
  945. Sub DSPPROC(ByVal handle As Long, ByVal channel As Long, ByRef buffer As Long, ByVal length As Long, ByVal user As Long)
  946.  
  947.     'CALLBACK FUNCTION !!!
  948.  
  949.     ' DSP callback function. NOTE: A DSP function should obviously be as quick as
  950.     ' possible... other DSP functions, streams and MOD musics can not be processed
  951.     ' until it's finished.
  952.     ' handle : The DSP handle
  953.     ' channel: Channel that the DSP is being applied to
  954.     ' buffer : Buffer to apply the DSP to
  955.     ' length : Number of bytes in the buffer
  956.     ' user   : The 'user' parameter given when calling BASS_ChannelSetDSP
  957.     
  958. End Sub
  959. Function BASS_SetEAXParametersVB(Preset) As Integer
  960. ' This function is a workaround, because VB doesn't support multiple comma seperated
  961. ' paramaters for each Global Const, simply pass the EAX_PRESET_XXXX value to this function
  962. ' instead of BASS_SetEasParamaets as you would to in C++
  963. Select Case Preset
  964.     Case EAX_PRESET_GENERIC
  965.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_GENERIC, 0.5, 1.493, 0.5)
  966.     Case EAX_PRESET_PADDEDCELL
  967.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_PADDEDCELL, 0.25, 0.1, 0)
  968.     Case EAX_PRESET_ROOM
  969.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_ROOM, 0.417, 0.4, 0.666)
  970.     Case EAX_PRESET_BATHROOM
  971.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_BATHROOM, 0.653, 1.499, 0.166)
  972.     Case EAX_PRESET_LIVINGROOM
  973.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_LIVINGROOM, 0.208, 0.478, 0)
  974.     Case EAX_PRESET_STONEROOM
  975.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_STONEROOM, 0.5, 2.309, 0.888)
  976.     Case EAX_PRESET_AUDITORIUM
  977.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_AUDITORIUM, 0.403, 4.279, 0.5)
  978.     Case EAX_PRESET_CONCERTHALL
  979.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_CONCERTHALL, 0.5, 3.961, 0.5)
  980.     Case EAX_PRESET_CAVE
  981.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_CAVE, 0.5, 2.886, 1.304)
  982.     Case EAX_PRESET_ARENA
  983.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_ARENA, 0.361, 7.284, 0.332)
  984.     Case EAX_PRESET_HANGAR
  985.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_HANGAR, 0.5, 10, 0.3)
  986.     Case EAX_PRESET_CARPETEDHALLWAY
  987.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153, 0.259, 2)
  988.     Case EAX_PRESET_HALLWAY
  989.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_HALLWAY, 0.361, 1.493, 0)
  990.     Case EAX_PRESET_STONECORRIDOR
  991.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_STONECORRIDOR, 0.444, 2.697, 0.638)
  992.     Case EAX_PRESET_ALLEY
  993.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_ALLEY, 0.25, 1.752, 0.776)
  994.     Case EAX_PRESET_FOREST
  995.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_FOREST, 0.111, 3.145, 0.472)
  996.     Case EAX_PRESET_CITY
  997.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_CITY, 0.111, 2.767, 0.224)
  998.     Case EAX_PRESET_MOUNTAINS
  999.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_MOUNTAINS, 0.194, 7.841, 0.472)
  1000.     Case EAX_PRESET_QUARRY
  1001.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_QUARRY, 1, 1.499, 0.5)
  1002.     Case EAX_PRESET_PLAIN
  1003.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_PLAIN, 0.097, 2.767, 0.224)
  1004.     Case EAX_PRESET_PARKINGLOT
  1005.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_PARKINGLOT, 0.208, 1.652, 1.5)
  1006.     Case EAX_PRESET_SEWERPIPE
  1007.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_SEWERPIPE, 0.652, 2.886, 0.25)
  1008.     Case EAX_PRESET_UNDERWATER
  1009.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_UNDERWATER, 1, 1.499, 0)
  1010.     Case EAX_PRESET_DRUGGED
  1011.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_DRUGGED, 0.875, 8.392, 1.388)
  1012.     Case EAX_PRESET_DIZZY
  1013.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_DIZZY, 0.139, 17.234, 0.666)
  1014.     Case EAX_PRESET_PSYCHOTIC
  1015.         BASS_SetEAXParametersVB = BASS_SetEAXParameters(EAX_ENVIRONMENT_PSYCHOTIC, 0.486, 7.563, 0.806)
  1016. End Select
  1017. End Function
  1018. Function BASS_GetStringVersion() As String
  1019. 'This function will return the string version
  1020. 'of the BASS DLL. For example the provided function within the DLL
  1021. '"BASS_GetVersion" will return 393216, whereas this function works
  1022. 'out the actual version string as you would need to see it.
  1023. BASS_GetStringVersion = Trim(Str(GetLoWord(BASS_GetVersion))) & "." & Trim(Str(GetHiWord(BASS_GetVersion)))
  1024. End Function
  1025.  
  1026. Public Function GetHiWord(lparam As Long) As Long
  1027. ' This is the HIWORD of the lParam:
  1028. GetHiWord = lparam \ &H10000 And &HFFFF&
  1029. End Function
  1030. Public Function GetLoWord(lparam As Long) As Long
  1031. ' This is the LOWORD of the lParam:
  1032. GetLoWord = lparam And &HFFFF&
  1033. End Function
  1034.  
  1035. Public Function BASS_GetErrorDescription(ErrorCode As Long) As String
  1036. Select Case ErrorCode
  1037.     Case BASS_OK
  1038.         BASS_GetErrorDescription = "All is OK"
  1039.     Case BASS_ERROR_MEM
  1040.         BASS_GetErrorDescription = "Memory Error"
  1041.     Case BASS_ERROR_FILEOPEN
  1042.         BASS_GetErrorDescription = "Can't Open the File"
  1043.     Case BASS_ERROR_DRIVER
  1044.         BASS_GetErrorDescription = "Can't Find a Free Sound Driver"
  1045.     Case BASS_ERROR_BUFLOST
  1046.         BASS_GetErrorDescription = "The Sample Buffer Was Lost - Please Report This!"
  1047.     Case BASS_ERROR_HANDLE
  1048.         BASS_GetErrorDescription = "Invalid Handle"
  1049.     Case BASS_ERROR_FORMAT
  1050.         BASS_GetErrorDescription = "Unsupported Format"
  1051.     Case BASS_ERROR_POSITION
  1052.         BASS_GetErrorDescription = "Invalid Playback Position"
  1053.     Case BASS_ERROR_INIT
  1054.         BASS_GetErrorDescription = "BASS_Init Has Not Been Successfully Called"
  1055.     Case BASS_ERROR_START
  1056.         BASS_GetErrorDescription = "BASS_Start Has Not Been Successfully Called"
  1057.     Case BASS_ERROR_INITCD
  1058.         BASS_GetErrorDescription = "Can't Initialize CD"
  1059.     Case BASS_ERROR_CDINIT
  1060.         BASS_GetErrorDescription = "BASS_CDInit Has Not Been Successfully Called"
  1061.     Case BASS_ERROR_NOCD
  1062.         BASS_GetErrorDescription = "No CD in drive"
  1063.     Case BASS_ERROR_CDTRACK
  1064.         BASS_GetErrorDescription = "Can't Play the Selected CD Track"
  1065.     Case BASS_ERROR_ALREADY
  1066.         BASS_GetErrorDescription = "Already Initialized"
  1067.     Case BASS_ERROR_CDVOL
  1068.         BASS_GetErrorDescription = "CD Has No Volume Control"
  1069.     Case BASS_ERROR_NOPAUSE
  1070.         BASS_GetErrorDescription = "Not Paused"
  1071.     Case BASS_ERROR_NOTAUDIO
  1072.         BASS_GetErrorDescription = "Not An Audio Track"
  1073.     Case BASS_ERROR_NOCHAN
  1074.         BASS_GetErrorDescription = "Can't Get a Free Channel"
  1075.     Case BASS_ERROR_ILLTYPE
  1076.         BASS_GetErrorDescription = "An Illegal Type Was Specified"
  1077.     Case BASS_ERROR_ILLPARAM
  1078.         BASS_GetErrorDescription = "An Illegal Parameter Was Specified"
  1079.     Case BASS_ERROR_NO3D
  1080.         BASS_GetErrorDescription = "No 3D Support"
  1081.     Case BASS_ERROR_NOEAX
  1082.         BASS_GetErrorDescription = "No EAX Support"
  1083.     Case BASS_ERROR_DEVICE
  1084.         BASS_GetErrorDescription = "Illegal Device Number"
  1085.     Case BASS_ERROR_NOPLAY
  1086.         BASS_GetErrorDescription = "Not Playing"
  1087.     Case BASS_ERROR_FREQ
  1088.         BASS_GetErrorDescription = "Illegal Sample Rate"
  1089.     Case BASS_ERROR_NOA3D
  1090.         BASS_GetErrorDescription = "A3D.DLL is Not Installed"
  1091.     Case BASS_ERROR_NOTFILE
  1092.         BASS_GetErrorDescription = "The Stream is Not a File Stream (WAV/MP3)"
  1093.     Case BASS_ERROR_NOHW
  1094.         BASS_GetErrorDescription = "No Hardware Voices Available"
  1095.     Case BASS_ERROR_UNKNOWN
  1096.         BASS_GetErrorDescription = "Some Other Mystery Error"
  1097. End Select
  1098. End Function
  1099.  
  1100. Function MakeLong(LoWord As Long, HiWord As Long) As Long
  1101. 'Replacement for the c++ Function MAKELONG
  1102. 'You need this to pass values to certain function calls.
  1103. 'i.e BASS_ChannelSetPosition needs to pass a value
  1104. 'using make long, i.e BASS_ChannelSetPosition Handle,MakeLong(Order,Row)
  1105. MakeLong = LoWord Or LShift(HiWord, 16)
  1106. End Function
  1107.  
  1108.  
  1109. Public Function LShift(ByVal lValue As Long, ByVal lNumberOfBitsToShift As Long) As Long
  1110.     Const ksCallname As String = "LShift"
  1111.     On Error GoTo Procedure_Error
  1112.     LShift = lValue * (2 ^ lNumberOfBitsToShift)
  1113.     
  1114. Procedure_Exit:
  1115.     Exit Function
  1116.     
  1117. Procedure_Error:
  1118.     Err.Raise Err.Number, ksCallname, Err.Description, Err.HelpFile, Err.HelpContext
  1119.     Resume Procedure_Exit
  1120. End Function
  1121.  
  1122. Public Function RShift(ByVal lValue As Long, ByVal lNumberOfBitsToShift As Long) As Long
  1123.  
  1124.     Const ksCallname As String = "RShift"
  1125.     On Error GoTo Procedure_Error
  1126.     RShift = lValue \ (2 ^ lNumberOfBitsToShift)
  1127.     
  1128. Procedure_Exit:
  1129.     Exit Function
  1130.     
  1131. Procedure_Error:
  1132.     Err.Raise Err.Number, ksCallname, Err.Description, Err.HelpFile, Err.HelpContext
  1133.     Resume Procedure_Exit
  1134. End Function
  1135.  
  1136.  
  1137.